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' | probcomp/bayeslite/src/sessions.py | [
{
"content": " def dump_session_as_json(self, session_id):\n \"\"\"Returns a JSON string representing the list of SQL or BQL entries\n (e.g. queries) executed within session `session_id`.\"\"\"\n if session_id > self.session_id or session_id < 1:\n raise ValueError('No such session (%d)' % session_id)\n version = cursor_value(self._sql('''\n SELECT version FROM bayesdb_session\n WHERE id = ?\n ''', (session_id,)))\n cursor = self._sql('''\n SELECT * FROM bayesdb_session_entries\n WHERE session_id = ?\n ORDER BY start_time DESC\n ''', (session_id,))\n # XXX Get the description first because apsw cursors, for\n # whatever reason, don't let you get the description after\n # you've gotten all the results.\n # (see also bql.py BayesDBCursor.__init__)\n fields = []\n try:\n fields = [d[0] for d in cursor.description]\n except apsw.ExecutionCompleteError:\n pass # Probably no rows.\n entries = cursor.fetchall()\n session = {\n 'entries': entries,\n 'fields': fields,\n 'version': version,\n }\n return json.dumps(session, sort_keys=True)",
"metadata": "root.SessionOrchestrator.dump_session_as_json",
"header": "['class', 'SessionOrchestrator', '(', 'object', ')', ':', '___EOS___']",
"index": 190
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Sess",
"ion",
"Orc",
"hes",
"trat",
"or_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"dump",
"\\u",
"session",
"\\u",
"as",
"\\u",
"json_",
"(_",
"self_",
",_",
"session",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"JSO",
"N",
" ",
"string",
" ",
"represent",
"ing",
" ",
"the",
" ",
"list",
" ",
"of",
" ",
"SQL",
" ",
"or",
" ",
"BQ",
"L",
" ",
"entri",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(",
"e",
".",
"g",
".",
" ",
" ",
"querie",
"s",
")",
" ",
"executed",
" ",
"within",
" ",
"session",
" ",
"`",
"session",
"\\u",
"id",
"`.\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"session",
"\\u",
"id_",
">_",
"self_",
"._",
"session",
"\\u",
"id_",
"or_",
"session",
"\\u",
"id_",
"<_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"No",
" ",
"suc",
"h",
" ",
"session",
" ",
"(%",
"d",
")'_",
"%_",
"session",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"version_",
"=_",
"cursor",
"\\u",
"value_",
"(_",
"self_",
"._",
"\\u",
"sql_",
"(_",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"SELECT",
" ",
"version",
" ",
"FROM",
" ",
"bayes",
"db",
"\\u",
"session",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"WHE",
"RE",
" ",
"id",
" ",
"=",
" ",
"?",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
",_",
"(_",
"session",
"\\u",
"id_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cursor_",
"=_",
"self_",
"._",
"\\u",
"sql_",
"(_",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"SELECT",
" ",
"*",
" ",
"FROM",
" ",
"bayes",
"db",
"\\u",
"session",
"\\u",
"entri",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"WHE",
"RE",
" ",
"session",
"\\u",
"id",
" ",
"=",
" ",
"?",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ORDE",
"R",
" ",
"BY",
" ",
"start",
"\\u",
"time",
" ",
"DESC",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
",_",
"(_",
"session",
"\\u",
"id_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
" ",
"Get",
" ",
"the",
" ",
"description",
" ",
"first",
" ",
"bec",
"aus",
"e",
" ",
"aps",
"w",
" ",
"cursors",
",",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"what",
"ever",
" ",
"reason",
",",
" ",
"don",
"'",
"t",
" ",
"let",
" ",
"you",
" ",
"get",
" ",
"the",
" ",
"description",
" ",
"after_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
"'",
"ve",
" ",
"got",
"ten",
" ",
"all",
" ",
"the",
" ",
"results",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"see",
" ",
"als",
"o",
" ",
"bq",
"l",
".",
"py",
" ",
"Bayes",
"DB",
"Curs",
"or",
".\\u",
"\\u",
"init",
"\\u\\u)",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"[_",
"d_",
"[_",
"0_",
"]_",
"for_",
"d_",
"in_",
"cursor_",
"._",
"description_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"aps",
"w_",
"._",
"Execut",
"ion",
"Complete",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"#",
" ",
"Prob",
"abl",
"y",
" ",
"no",
" ",
"rows",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"entries_",
"=_",
"cursor_",
"._",
"fetchall_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"session_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"entri",
"es",
"'_",
":_",
"entries_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"fields_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"version",
"'_",
":_",
"version_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"json_",
"._",
"dumps_",
"(_",
"session_",
",_",
"sort",
"\\u",
"keys_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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= options['logcrawler']['host_log_basedir']\n host_log_dir = self._get_logfiles_links_dest(\n host_log_basedir,\n options['environment'],\n )\n\n logger.info('Un-linking log files for container %s.'\n % self.short_id)\n\n try:\n shutil.rmtree('/tmp/' + self.namespace)\n except (IOError, OSError) as e:\n pass\n try:\n shutil.move(host_log_dir, '/tmp/' + self.namespace)\n except (IOError, OSError) as e:\n logger.exception(e)\n pass",
"metadata": "root.DockerContainer.unlink_logfiles",
"header": "['class', 'DockerContainer', '(', 'Container', ')', ':', '___EOS___']",
"index": 170
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Docke",
"r",
"Container_",
"(_",
"Container_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"unlink",
"\\u",
"logfile",
"s_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"=_",
"defaults_",
"._",
"DEF",
"AUL",
"T",
"\\u",
"CRA",
"WL",
"\\u",
"OPTIONS_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"host",
"\\u",
"log",
"\\u",
"basedir_",
"=_",
"options_",
"[_",
"'",
"logc",
"raw",
"ler",
"'_",
"]_",
"[_",
"'",
"host",
"\\u",
"log",
"\\u",
"basedir",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"host",
"\\u",
"log",
"\\u",
"dir_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"logfile",
"s",
"\\u",
"link",
"s",
"\\u",
"dest_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"host",
"\\u",
"log",
"\\u",
"basedir_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"[_",
"'",
"environ",
"ment",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logger_",
"._",
"info_",
"(_",
"'",
"Un",
"-",
"linking",
" ",
"log",
" ",
"files",
" ",
"for",
" ",
"container",
" ",
"%",
"s",
".'_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"self_",
"._",
"short",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shutil_",
"._",
"rmtree_",
"(_",
"'/",
"tmp",
"/'_",
"+_",
"self_",
"._",
"namespace_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"IO",
"Error_",
",_",
"OSE",
"rror_",
")_",
"as_",
"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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shutil_",
"._",
"move_",
"(_",
"host",
"\\u",
"log",
"\\u",
"dir_",
",_",
"'/",
"tmp",
"/'_",
"+_",
"self_",
"._",
"namespace_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"IO",
"Error_",
",_",
"OSE",
"rror_",
")_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"exception_",
"(_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
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
] |
Module is imported with 'import' and 'import from' | marteinn/AtomicPress/atomicpress/ext/importer/__init__.py | [
{
"content": "# -*- coding: utf-8 -*-\n\n\"\"\"\natomicpress.ext.importer\n----------\nThis module handles wordpress imports by exposing the import command.\n\"\"\"\n\nimport re\nimport os\nfrom datetime import datetime\nfrom flask_script import Manager\nfrom unipath import Path\nimport wpparser\nfrom atomicpress.app import db, app, manager\nfrom atomicpress.models import Blog, Author, Category, Tag, Post\nfrom atomicpress.utils.files import generate_image_from_url\n\n\nlogger = app.logger\n\nImporterCommand = Manager(usage='Perform wordpress import')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"atomi",
"cpr",
"ess",
".",
"ext",
".",
"importer",
"\\",
"10",
";",
"----------",
"\\",
"10",
";",
"Thi",
"s",
" ",
"module",
" ",
"handle",
"s",
" ",
"wordpress",
" ",
"import",
"s",
" ",
"by",
" ",
"expos",
"ing",
" ",
"the",
" ",
"import",
" ",
"command",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"datetime_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"fla",
"sk",
"\\u",
"script_",
"import_",
"Manager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"uni",
"path_",
"import_",
"Path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"wp",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"atomi",
"cpr",
"ess_",
"._",
"app_",
"import_",
"db_",
",_",
"app_",
",_",
"manager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"atomi",
"cpr",
"ess_",
"._",
"models_",
"import_",
"Blog",
"_",
",_",
"Author_",
",_",
"Category_",
",_",
"Tag_",
",_",
"Post_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"atomi",
"cpr",
"ess_",
"._",
"utils_",
"._",
"files_",
"import_",
"generat",
"e\\u",
"image",
"\\u",
"from",
"\\u",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logger_",
"=_",
"app_",
"._",
"logger_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"Import",
"er",
"Command_",
"=_",
"Manager_",
"(_",
"usage_",
"=_",
"'",
"Perform",
" ",
"wordpress",
" ",
"import",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | ARM-software/workload-automation/doc/build_instrumentation_method_map.py | [
{
"content": "#!/usr/bin/env python\n# Copyright 2015-2015 ARM Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nimport os\nimport sys\nimport string\nfrom copy import copy\n\nfrom wlauto.core.instrumentation import SIGNAL_MAP, PRIORITY_MAP\nfrom wlauto.utils.doc import format_simple_table\n\n\nCONVINIENCE_ALIASES = ['initialize', 'setup', 'start', 'stop', 'process_workload_result',\n 'update_result', 'teardown', 'finalize']\n\nOUTPUT_TEMPLATE_FILE = os.path.join(os.path.dirname(__file__), 'source', 'instrumentation_method_map.template')\n\n\n\n\n\n\nif __name__ == '__main__':\n generate_instrumentation_method_map(sys.argv[1])\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Copy",
"right",
" ",
"201",
"5",
"-",
"201",
"5",
" ",
"ARM",
" ",
"Limit",
"ed_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"copy_",
"import_",
"copy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"wl",
"auto_",
"._",
"core_",
"._",
"instrument",
"ation_",
"import_",
"SIGN",
"AL",
"\\u",
"MAP_",
",_",
"PRIORITY",
"\\u",
"MAP_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"wl",
"auto_",
"._",
"utils_",
"._",
"doc_",
"import_",
"format\\u",
"simple",
"\\u",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"CONV",
"INI",
"ENCE",
"\\u",
"ALIAS",
"ES_",
"=_",
"[_",
"'",
"initialize",
"'_",
",_",
"'",
"setup",
"'_",
",_",
"'",
"start",
"'_",
",_",
"'",
"stop",
"'_",
",_",
"'",
"process",
"\\u",
"workload",
"\\u",
"result",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"update",
"\\u",
"result",
"'_",
",_",
"'",
"tear",
"down",
"'_",
",_",
"'",
"finalize",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"OUTPU",
"T",
"\\u",
"TEMPL",
"ATE",
"\\u",
"FILE_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"'",
"source",
"'_",
",_",
"'",
"instrument",
"ation",
"\\u",
"method",
"\\u",
"map",
".",
"template",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"generat",
"e\\u",
"instrument",
"ation",
"\\u",
"method",
"\\u",
"map_",
"(_",
"sys_",
"._",
"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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | thedrow/django-natural-query/natural_query/fields.py | [
{
"content": "from django.db.models import DateField, DateTimeField, ForeignKey, OneToOneField\n\nfrom natural_query.query import NaturalQueryDescriptor, DateNaturalQueryDescriptor, DateTimeNaturalQueryDescriptor\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class NaturalQueryField(object):\n\n query_descriptor = NaturalQueryDescriptor",
"metadata": "root.NaturalQueryField",
"header": "['module', '___EOS___']",
"index": 5
},
{
"content": " def __init__(self, name):\n self.name = name",
"metadata": "root.NaturalQueryField.__init__",
"header": "['class', 'NaturalQueryField', '(', 'object', ')', ':', '___EOS___']",
"index": 6
},
{
"content": "class DateNaturalQueryField(DateField, NaturalQueryField):\n query_descriptor = DateNaturalQueryDescriptor",
"metadata": "root.DateNaturalQueryField",
"header": "['module', '___EOS___']",
"index": 12
},
{
"content": "class DateTimeNaturalQueryField(DateTimeField, NaturalQueryField):\n query_descriptor = DateTimeNaturalQueryDescriptor",
"metadata": "root.DateTimeNaturalQueryField",
"header": "['module', '___EOS___']",
"index": 16
},
{
"content": "class ForeignKeyNaturalQueryField(ForeignKey):\n query_descriptor = NaturalQueryDescriptor",
"metadata": "root.ForeignKeyNaturalQueryField",
"header": "['module', '___EOS___']",
"index": 20
},
{
"content": "class OneToOneNaturalQueryField(OneToOneField):\n query_descriptor = NaturalQueryDescriptor",
"metadata": "root.OneToOneNaturalQueryField",
"header": "['module', '___EOS___']",
"index": 24
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"._",
"models_",
"import_",
"Date",
"Field_",
",_",
"Date",
"Time",
"Field_",
",_",
"Fore",
"ign",
"Key_",
",_",
"One",
"To",
"One",
"Field_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"natur",
"al",
"\\u",
"query_",
"._",
"query_",
"import_",
"Nat",
"ural",
"Query",
"Descriptor_",
",_",
"Date",
"Nat",
"ural",
"Query",
"Descriptor_",
",_",
"Date",
"Time",
"Nat",
"ural",
"Query",
"Descriptor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Nat",
"ural",
"Query",
"Field_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"query",
"\\u",
"descriptor_",
"=_",
"Nat",
"ural",
"Query",
"Descriptor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Nat",
"ural",
"Query",
"Field_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Date",
"Nat",
"ural",
"Query",
"Field_",
"(_",
"Date",
"Field_",
",_",
"Nat",
"ural",
"Query",
"Field_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query",
"\\u",
"descriptor_",
"=_",
"Date",
"Nat",
"ural",
"Query",
"Descriptor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Date",
"Time",
"Nat",
"ural",
"Query",
"Field_",
"(_",
"Date",
"Time",
"Field_",
",_",
"Nat",
"ural",
"Query",
"Field_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query",
"\\u",
"descriptor_",
"=_",
"Date",
"Time",
"Nat",
"ural",
"Query",
"Descriptor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Fore",
"ign",
"Key",
"Nat",
"ural",
"Query",
"Field_",
"(_",
"Fore",
"ign",
"Key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query",
"\\u",
"descriptor_",
"=_",
"Nat",
"ural",
"Query",
"Descriptor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"One",
"To",
"One",
"Nat",
"ural",
"Query",
"Field_",
"(_",
"One",
"To",
"One",
"Field_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query",
"\\u",
"descriptor_",
"=_",
"Nat",
"ural",
"Query",
"Descriptor_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
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
] |
Variable defined multiple times | SALib/SALib/SALib/tests/test_morris_util.py | [
{
"content": "def test_scores_from_find_most_distant():\n '''\n Checks whether array of scores from (6 4) is correct.\n\n Data is derived from Saltelli et al. 2008,\n in the solution to exercise 3a, Chapter 3, page 134.\n\n '''\n sample_inputs = setup()\n N = 6\n num_params = 2\n k_choices = 4\n output = find_most_distant(sample_inputs, N, num_params, k_choices)\n expected = np.array([15.022, 13.871, 14.815, 14.582, 16.178, 14.912, 15.055, 16.410,\n 15.685, 16.098, 14.049, 15.146, 14.333, 14.807, 14.825],\n dtype=np.float32)\n\n assert_allclose(output, expected, rtol=1e-1, atol=1e-2)",
"metadata": "root.test_scores_from_find_most_distant",
"header": "['module', '___EOS___']",
"index": 225
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"score",
"s",
"\\u",
"from",
"\\u",
"find",
"\\u",
"most",
"\\u",
"distan",
"t_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Check",
"s",
" ",
"whe",
"ther",
" ",
"array",
" ",
"of",
" ",
"score",
"s",
" ",
"from",
" ",
"(",
"6",
" ",
"4",
")",
" ",
"is",
" ",
"correct",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Data",
" ",
"is",
" ",
"derive",
"d",
" ",
"from",
" ",
"Sal",
"tell",
"i",
" ",
"et",
" ",
"al",
".",
" ",
"2008",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"in",
" ",
"the",
" ",
"solut",
"ion",
" ",
"to",
" ",
"exercise",
" ",
"3a",
",",
" ",
"Chap",
"ter",
" ",
"3",
",",
" ",
"page",
" ",
"134",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sample",
"\\u",
"inputs_",
"=_",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"N_",
"=_",
"6_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"params_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"k",
"\\u",
"choices_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"output_",
"=_",
"find",
"\\u",
"most",
"\\u",
"distan",
"t_",
"(_",
"sample",
"\\u",
"inputs_",
",_",
"N_",
",_",
"num",
"\\u",
"params_",
",_",
"k",
"\\u",
"choices_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"15.",
"022",
"_",
",_",
"13.",
"871",
"_",
",_",
"14.",
"815",
"_",
",_",
"14.",
"582",
"_",
",_",
"16.",
"178_",
",_",
"14.",
"912",
"_",
",_",
"15.",
"055",
"_",
",_",
"16.",
"410",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"15.",
"685",
"_",
",_",
"16.",
"098",
"_",
",_",
"14.0",
"49_",
",_",
"15.",
"146_",
",_",
"14.",
"333_",
",_",
"14.",
"807",
"_",
",_",
"14.",
"825",
"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dtype_",
"=_",
"np_",
"._",
"float32_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"allclose_",
"(_",
"output_",
",_",
"expected_",
",_",
"rtol_",
"=_",
"1e-1",
"_",
",_",
"atol_",
"=_",
"1e-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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | maxpumperla/hyperas/hyperas/optim.py | [
{
"content": "def augmented_names(parts):\n aug_parts = []\n for i, part in enumerate(parts):\n aug_parts.append(\"space['\" + part + \"']\")\n return aug_parts",
"metadata": "root.augmented_names",
"header": "['module', '___EOS___']",
"index": 175
}
] | [] | [] | 0 | 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_",
"augmented",
"\\u",
"names_",
"(_",
"parts_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"aug",
"\\u",
"parts_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
",_",
"part_",
"in_",
"enumerate_",
"(_",
"parts_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"aug",
"\\u",
"parts_",
"._",
"append_",
"(_",
"\"",
"space",
"['",
"\"_",
"+_",
"part_",
"+_",
"\"'",
"]\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"aug",
"\\u",
"parts_",
"\\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
] |
Unnecessary 'else' clause in loop | cloudera/hue/desktop/core/ext-py/guppy-0.1.10/guppy/heapy/Remote.py | [
{
"content": " def connect(self):\n self.socket = socket.socket(self.address_family,\n self.socket_type)\n\twhile not self.isclosed:\n\t try:\n\t\t# print 'connecting'\n\t\tself.socket.connect(self.server_address)\n\t except SystemExit:\n\t\traise\n\t except socket.error:\n\t\tif self.isclosed:\n\t\t raise\n\t\ttime.sleep(2)\n\t else:\n break\n else:\n return\n\n #print 'CONNECTED'\n self.stdout = self.socket.makefile('w', bufsize=0)\n self.stdin = NotiInput(self.socket.makefile('r'), self.stdout)\n self.stderr = sys.stderr\n\n if sys.version_info < (2, 4):\n self.interruptible = 0\n\telse:\n self.start_ki_thread()\n self.interruptible = 1\n\n cmd.Cmd.__init__(self, stdin=self.stdin, stdout=self.stdout)",
"metadata": "root.Annex.connect",
"header": "['class', 'Annex', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']",
"index": 97
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"'",
"else",
"'_",
"clause_",
"in_",
"loop_",
"[SEP]_",
"class_",
"Ann",
"ex_",
"(_",
"cmd_",
"._",
"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_",
"connect_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"socket_",
"=_",
"socket_",
"._",
"socket_",
"(_",
"self_",
"._",
"address",
"\\u",
"family_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"socket",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"not_",
"self_",
"._",
"iscl",
"ose",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
" ",
"'",
"connecti",
"ng",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"socket_",
"._",
"connect_",
"(_",
"self_",
"._",
"server",
"\\u",
"address_",
")_",
"\\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\t",
"\t_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"socket_",
"._",
"error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"self_",
"._",
"iscl",
"ose",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t _",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"print",
" ",
"'",
"CONNECTED",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"stdout_",
"=_",
"self_",
"._",
"socket_",
"._",
"makefile_",
"(_",
"'",
"w",
"'_",
",_",
"bufsize_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"stdin_",
"=_",
"Noti",
"Input_",
"(_",
"self_",
"._",
"socket_",
"._",
"makefile_",
"(_",
"'",
"r",
"'_",
")_",
",_",
"self_",
"._",
"stdout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"stderr_",
"=_",
"sys_",
"._",
"stderr_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"sys_",
"._",
"version",
"\\u",
"info_",
"<_",
"(_",
"2_",
",_",
"4_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"interrupt",
"ible_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"start",
"\\u",
"ki",
"\\u",
"thread_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"interrupt",
"ible_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cmd_",
"._",
"Cmd_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"stdin_",
"=_",
"self_",
"._",
"stdin_",
",_",
"stdout_",
"=_",
"self_",
"._",
"stdout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | kastnerkyle/ift6266h15/convnet.py | [
{
"content": "def conv_layer(input_variable, filter_shape, pool_shape, stride, random_state):\n np_filters = 0.2 * (random_state.rand(\n *filter_shape).astype(theano.config.floatX) - 0.5)\n filters = theano.shared(np_filters)\n np_biases = np.zeros(filter_shape[0]).astype(theano.config.floatX)\n biases = theano.shared(np_biases)\n params = [filters, biases]\n conv = tensor.nnet.conv2d(input_variable, filters, subsample=stride)\n conv += biases.dimshuffle('x', 0, 'x', 'x')\n out = _relu(conv)\n pooled = max_pool_2d(out, pool_shape, ignore_border=True)\n return pooled, params",
"metadata": "root.conv_layer",
"header": "['module', '___EOS___']",
"index": 11
}
] | [] | [] | 0 | 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_",
"conv",
"\\u",
"layer_",
"(_",
"input",
"\\u",
"variable_",
",_",
"filter",
"\\u",
"shape_",
",_",
"pool",
"\\u",
"shape_",
",_",
"stride_",
",_",
"random",
"\\u",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"np",
"\\u",
"filters_",
"=_",
"0.2_",
"*_",
"(_",
"random",
"\\u",
"state_",
"._",
"rand_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"*_",
"filter",
"\\u",
"shape_",
")_",
"._",
"astype_",
"(_",
"theano_",
"._",
"config_",
"._",
"float",
"X_",
")_",
"-_",
"0.5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"filters_",
"=_",
"theano_",
"._",
"shared_",
"(_",
"np",
"\\u",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"np",
"\\u",
"biases_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"filter",
"\\u",
"shape_",
"[_",
"0_",
"]_",
")_",
"._",
"astype_",
"(_",
"theano_",
"._",
"config_",
"._",
"float",
"X_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"biases_",
"=_",
"theano_",
"._",
"shared_",
"(_",
"np",
"\\u",
"biases_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"[_",
"filters_",
",_",
"biases_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conv_",
"=_",
"tensor_",
"._",
"nnet",
"_",
"._",
"conv2d_",
"(_",
"input",
"\\u",
"variable_",
",_",
"filters_",
",_",
"subsample",
"_",
"=_",
"stride_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conv_",
"+=_",
"biases_",
"._",
"dims",
"huff",
"le_",
"(_",
"'",
"x",
"'_",
",_",
"0_",
",_",
"'",
"x",
"'_",
",_",
"'",
"x",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"out_",
"=_",
"\\u",
"relu_",
"(_",
"conv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pooled",
"_",
"=_",
"max",
"\\u",
"pool",
"\\u",
"2d_",
"(_",
"out_",
",_",
"pool",
"\\u",
"shape_",
",_",
"ignore",
"\\u",
"border_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"pooled",
"_",
",_",
"params_",
"\\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
] |
Unused import | OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/cli.py | [
{
"content": "\"\"\"OpenMDAO Command Line Interface stuff.\"\"\"\n\nimport sys\nimport webbrowser\nfrom argparse import ArgumentParser\n\nfrom openmdao.main.plugin import plugin_docs, print_sub_help\nfrom openmdao.main.releaseinfo import __version__\nfrom openmdao.test.testing import read_config, filter_config, run_openmdao_suite\nfrom openmdao.util.fileutil import get_cfg_file\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n openmdao()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def list_testhosts(parser, options, args=None):\n if args:\n print_sub_help(parser, 'list_testhosts')\n return -1\n hostlist, config = read_config(options)\n for host in filter_config(hostlist, config, options):\n plat = config.get(host, 'platform')\n py = config.get(host, 'py')\n print host.ljust(30), plat.ljust(10), py",
"metadata": "root.list_testhosts",
"header": "['module', '___EOS___']",
"index": 13
},
{
"content": "def test_openmdao(parser, options, args):\n # nosetests uses sys.argv for its usage message when the user passes a -h\n # arg, regardless of what args we pass to it, so if we see -h in sys.args,\n # change the first entry in sys.argv to 'openmdao test'. Otherwise, usage\n # message will be 'openmdao [options]' instead of 'openmdao test [options]'\n if '-h' in sys.argv or '--help' in sys.argv:\n sys.argv[0] = 'openmdao test'\n run_openmdao_suite(sys.argv[1:])",
"metadata": "root.test_openmdao",
"header": "['module', '___EOS___']",
"index": 24
},
{
"content": "def openmdao_docs(parser, options, args=None):\n if args:\n print_sub_help(parser, 'docs')\n return -1\n plugin_docs(parser, options, args)",
"metadata": "root.openmdao_docs",
"header": "['module', '___EOS___']",
"index": 34
},
{
"content": "def _get_openmdao_parser():\n \"\"\"Sets up the plugin arg parser and all of its subcommand parsers.\"\"\"\n\n top_parser = ArgumentParser()\n top_parser.add_argument('-v', '--version', action='version',\n version='OpenMDAO %s' % __version__)\n\n subparsers = top_parser.add_subparsers(title='commands')\n\n parser = subparsers.add_parser('list_testhosts',\n help='list hosts in testhosts config file')\n parser.add_argument('-c', '--config', action='store', dest='cfg',\n metavar='CONFIG', default=get_cfg_file(),\n help='Path of config file where info for remote'\n ' testing/building hosts is located.')\n parser.add_argument('--filter', action='append', dest='filters', default=[],\n help='boolean expression to filter hosts')\n parser.add_argument('--host', action='append', dest='hosts', metavar='HOST',\n default=[],\n help='Select host from config file to run on. '\n 'To run on multiple hosts, use multiple --host args.')\n parser.add_argument('--all', action='store_true', dest='allhosts', default=True,\n help='Use all hosts found in testhosts.cfg file.')\n parser.set_defaults(func=list_testhosts)\n\n parser = subparsers.add_parser('docs', help='view the docs')\n parser.add_argument('plugin_dist_name', nargs='?',\n help='name of plugin distribution or class')\n parser.add_argument('-b', '--browser', action='store', type=str,\n dest='browser', choices=webbrowser._browsers.keys(),\n help='browser name')\n parser.set_defaults(func=openmdao_docs)\n\n parser = subparsers.add_parser('test', add_help=False,\n description='run the OpenMDAO test suite')\n parser.add_argument('-v', '--verbose', action='store_true',\n help='display test progress')\n parser.add_argument('--gui', action='store_true',\n help='do GUI functional tests, regardless of default')\n parser.add_argument('--skip-gui', action='store_true',\n help='skip GUI functional tests, regardless of default')\n parser.add_argument('packages', metavar='package', type=str, nargs='*',\n help='package to be tested')\n parser.set_defaults(func=test_openmdao)\n\n # the following subcommands will only be available in a dev build, because\n # openmdao.devtools is not part of a normal OpenMDAO release\n try:\n # these commands will only be available on windows machines if pywin32\n # is available\n from openmdao.devtools.push_docs import push_docs\n from openmdao.devtools.remotetst import test_branch\n from openmdao.devtools.remote_cfg import add_config_options\n\n parser = subparsers.add_parser('test_branch',\n help='run tests on remote machines')\n parser.add_argument('-k', '--keep', action='store_true', dest='keep',\n help=\"Don't delete the temporary build directory.\"\n 'If testing on EC2, stop the instance instead'\n ' of terminating it.')\n parser.add_argument('-f', '--file', action='store', type=str, dest='fname',\n help='Pathname of a tarfile or URL of a git repo. '\n 'Defaults to the current repo.')\n parser.add_argument('-b', '--branch', action='store', type=str, dest='branch',\n help='If file is a git repo, supply branch name here')\n parser.add_argument('--testargs', action='store', type=str,\n dest='testargs', default='',\n help='args to be passed to openmdao test')\n parser.add_argument('-v', '--verbose', action='store_true',\n help='display test progress')\n parser.add_argument('--gui', action='store_true', dest='gui',\n help='do GUI functional tests, regardless of default')\n parser.add_argument('--skip-gui', action='store_true', dest='skip_gui',\n help='skip GUI functional tests, regardless of default')\n parser = add_config_options(parser)\n parser.set_defaults(func=test_branch)\n\n parser = subparsers.add_parser('push_docs', help='push the dev docs up to the server')\n parser.add_argument('host', help='host to push docs to')\n parser.add_argument('-d', '--destination', action='store', type=str,\n dest='docdir', default='downloads',\n help='directory where dev_docs directory will be'\n ' placed')\n parser.add_argument('-n', '--nodocbuild', action='store_true',\n dest='nodocbuild',\n help='Used for testing. The docs will not be'\n ' rebuilt if they already exist.')\n parser.set_defaults(func=push_docs)\n\n except ImportError:\n pass\n\n try:\n from openmdao.devtools.build_docs import build_docs, test_docs\n parser = subparsers.add_parser('build_docs', help='build OpenMDAO docs')\n parser.add_argument('-v', '--version', action='store', type=str,\n dest='version',\n help='the OpenMDAO version')\n parser.set_defaults(func=build_docs)\n\n parser = subparsers.add_parser('test_docs',\n help='run tests on the OpenMDAO docs')\n parser.set_defaults(func=test_docs)\n\n except ImportError:\n pass\n\n try:\n from openmdao.lib.architectures.mdao_test_suite import cli_arch_test_suite\n parser = subparsers.add_parser('test_arch', help='run the MDAO architecture test suite')\n parser.set_defaults(func=cli_arch_test_suite)\n parser.add_argument('-ea', '--exclude_arch', action='store', type=str,\n nargs='+', dest='excl_arch',\n help='Architectures class names to exclude from the'\n ' test run.',\n default=[], metavar='arch_class_name')\n parser.add_argument('-ia', '--include_arch', action='store', type=str,\n nargs='+', dest='inc_arch',\n help='Architectures class names to include in the'\n ' test run.',\n default=[], metavar='arch_class_name')\n parser.add_argument('-ip', '--include_prob', action='store', type=str,\n nargs='+', dest='inc_prob',\n help='OptProblems class names to include in the'\n ' test run.',\n default=[], metavar='prob_class_name')\n parser.add_argument('-ep', '--exclude_prob', action='store', type=str,\n nargs='+', dest='excl_prob',\n help='OptProblems class names to exclude from the'\n ' test run.',\n default=[], metavar='prob_class_name')\n\n except ImportError:\n pass\n\n # case data viewer (i.e. html_post_processor)\n try:\n import openmdao.lib.casehandlers.html_post_processor as viewer\n parser = subparsers.add_parser('view_case_data', help='visualize JSON case data')\n parser.add_argument('json_file', type=str, metavar='json_file',\n help='JSON format case data file')\n parser.set_defaults(func=viewer.run)\n except ImportError:\n pass\n\n return top_parser",
"metadata": "root._get_openmdao_parser",
"header": "['module', '___EOS___']",
"index": 41
},
{
"content": "def openmdao():\n parser = _get_openmdao_parser()\n options, args = parser.parse_known_args()\n\n sys.exit(options.func(parser, options, args))",
"metadata": "root.openmdao",
"header": "['module', '___EOS___']",
"index": 189
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Open",
"MD",
"AO",
" ",
"Command",
" ",
"Line",
" ",
"Interface",
" ",
"stu",
"ff",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"webbrowser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"argparse_",
"import_",
"Arg",
"ument",
"Parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"main_",
"._",
"plugin_",
"import_",
"plugin",
"\\u",
"docs_",
",_",
"print",
"\\u",
"sub\\u",
"help_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"main_",
"._",
"release",
"info_",
"import_",
"\\u\\u",
"version\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"test_",
"._",
"testing_",
"import_",
"read",
"\\u",
"config_",
",_",
"filter",
"\\u",
"config_",
",_",
"run",
"\\u",
"openm",
"dao",
"\\u",
"suite_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"util_",
"._",
"fileu",
"til_",
"import_",
"get",
"\\u",
"cfg",
"\\u",
"file_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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 ",
" _",
"openm",
"dao_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"list",
"\\u",
"testh",
"ost",
"s_",
"(_",
"parser_",
",_",
"options_",
",_",
"args_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print",
"\\u",
"sub\\u",
"help_",
"(_",
"parser_",
",_",
"'",
"list",
"\\u",
"testh",
"ost",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"host",
"list_",
",_",
"config_",
"=_",
"read",
"\\u",
"config_",
"(_",
"options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"host_",
"in_",
"filter",
"\\u",
"config_",
"(_",
"host",
"list_",
",_",
"config_",
",_",
"options_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"plat",
"_",
"=_",
"config_",
"._",
"get_",
"(_",
"host_",
",_",
"'",
"platform",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"py_",
"=_",
"config_",
"._",
"get_",
"(_",
"host_",
",_",
"'",
"py",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"host_",
"._",
"ljust_",
"(_",
"30_",
")_",
",_",
"plat",
"_",
"._",
"ljust_",
"(_",
"10_",
")_",
",_",
"py_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\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",
"openm",
"dao_",
"(_",
"parser_",
",_",
"options_",
",_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"nose",
"tests",
" ",
"use",
"s",
" ",
"sys",
".",
"argv",
" ",
"for",
" ",
"its",
" ",
"usage",
" ",
"message",
" ",
"whe",
"n",
" ",
"the",
" ",
"user",
" ",
"pass",
"es",
" ",
"a",
" ",
"-",
"h_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"arg",
",",
" ",
"rega",
"rd",
"less",
" ",
"of",
" ",
"what",
" ",
"args",
" ",
"we",
" ",
"pass",
" ",
"to",
" ",
"it",
",",
" ",
"so",
" ",
"if",
" ",
"we",
" ",
"see",
" ",
"-",
"h",
" ",
"in",
" ",
"sys",
".",
"args",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"change",
" ",
"the",
" ",
"first",
" ",
"entry",
" ",
"in",
" ",
"sys",
".",
"argv",
" ",
"to",
" ",
"'",
"openm",
"dao",
" ",
"test",
"'.",
" ",
" ",
"Ot",
"her",
"wis",
"e",
",",
" ",
"usage_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"message",
" ",
"will",
" ",
"be",
" ",
"'",
"openm",
"dao",
" ",
"[",
"options",
"]'",
" ",
"inst",
"ead",
" ",
"of",
" ",
"'",
"openm",
"dao",
" ",
"test",
" ",
"[",
"options",
"]'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"'-",
"h",
"'_",
"in_",
"sys_",
"._",
"argv_",
"or_",
"'--",
"help",
"'_",
"in_",
"sys_",
"._",
"argv_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"argv_",
"[_",
"0_",
"]_",
"=_",
"'",
"openm",
"dao",
" ",
"test",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"run",
"\\u",
"openm",
"dao",
"\\u",
"suite_",
"(_",
"sys_",
"._",
"argv_",
"[_",
"1_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"openm",
"dao",
"\\u",
"docs_",
"(_",
"parser_",
",_",
"options_",
",_",
"args_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print",
"\\u",
"sub\\u",
"help_",
"(_",
"parser_",
",_",
"'",
"docs",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"plugin",
"\\u",
"docs_",
"(_",
"parser_",
",_",
"options_",
",_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"openm",
"dao",
"\\u",
"parser_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Set",
"s",
" ",
"up",
" ",
"the",
" ",
"plugin",
" ",
"arg",
" ",
"parser",
" ",
"and",
" ",
"all",
" ",
"of",
" ",
"its",
" ",
"subco",
"mmand",
" ",
"parser",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"top",
"\\u",
"parser_",
"=_",
"Arg",
"ument",
"Parser_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top",
"\\u",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"v",
"'_",
",_",
"'--",
"version",
"'_",
",_",
"action_",
"=_",
"'",
"version",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"'",
"Open",
"MD",
"AO",
" ",
"%",
"s",
"'_",
"%_",
"\\u\\u",
"version\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"subparsers_",
"=_",
"top",
"\\u",
"parser_",
"._",
"add",
"\\u",
"subparsers_",
"(_",
"title_",
"=_",
"'",
"command",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"list",
"\\u",
"testh",
"ost",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"list",
" ",
"host",
"s",
" ",
"in",
" ",
"testh",
"ost",
"s",
" ",
"config",
" ",
"file",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"c",
"'_",
",_",
"'--",
"config",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"dest_",
"=_",
"'",
"cfg",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"'",
"CONFIG",
"'_",
",_",
"default_",
"=_",
"get",
"\\u",
"cfg",
"\\u",
"file_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Path",
" ",
"of",
" ",
"config",
" ",
"file",
" ",
"where",
" ",
"info",
" ",
"for",
" ",
"remote",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"testi",
"ng",
"/",
"buildi",
"ng",
" ",
"host",
"s",
" ",
"is",
" ",
"located",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"filter",
"'_",
",_",
"action_",
"=_",
"'",
"append",
"'_",
",_",
"dest_",
"=_",
"'",
"filter",
"s",
"'_",
",_",
"default_",
"=_",
"[_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"boolean",
" ",
"express",
"ion",
" ",
"to",
" ",
"filter",
" ",
"host",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"host",
"'_",
",_",
"action_",
"=_",
"'",
"append",
"'_",
",_",
"dest_",
"=_",
"'",
"host",
"s",
"'_",
",_",
"metavar_",
"=_",
"'",
"HOST",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"[_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Select",
" ",
"host",
" ",
"from",
" ",
"config",
" ",
"file",
" ",
"to",
" ",
"run",
" ",
"on",
".",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"To",
" ",
"run",
" ",
"on",
" ",
"multiple",
" ",
"host",
"s",
",",
" ",
"use",
" ",
"multiple",
" ",
"--",
"host",
" ",
"args",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"all",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"dest_",
"=_",
"'",
"all",
"host",
"s",
"'_",
",_",
"default_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Us",
"e",
" ",
"all",
" ",
"host",
"s",
" ",
"found",
" ",
"in",
" ",
"testh",
"ost",
"s",
".",
"cfg",
" ",
"file",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"list",
"\\u",
"testh",
"ost",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"docs",
"'_",
",_",
"help_",
"=_",
"'",
"view",
" ",
"the",
" ",
"docs",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'",
"plugin",
"\\u",
"dist",
"\\u",
"name",
"'_",
",_",
"nargs_",
"=_",
"'?'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"name",
" ",
"of",
" ",
"plugin",
" ",
"distribu",
"tion",
" ",
"or",
" ",
"class",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"b",
"'_",
",_",
"'--",
"browse",
"r",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"'",
"browse",
"r",
"'_",
",_",
"choices_",
"=_",
"webbrowser_",
"._",
"\\u",
"browsers",
"_",
"._",
"keys_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"browse",
"r",
" ",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"openm",
"dao",
"\\u",
"docs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"test",
"'_",
",_",
"add",
"\\u",
"help_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"'",
"run",
" ",
"the",
" ",
"Open",
"MD",
"AO",
" ",
"test",
" ",
"suit",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"v",
"'_",
",_",
"'--",
"verbo",
"se",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"display",
" ",
"test",
" ",
"progress",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"gui",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"do",
" ",
"GU",
"I",
" ",
"functional",
" ",
"tests",
",",
" ",
"rega",
"rd",
"less",
" ",
"of",
" ",
"default",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"skip",
"-",
"gui",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"skip",
" ",
"GU",
"I",
" ",
"functional",
" ",
"tests",
",",
" ",
"rega",
"rd",
"less",
" ",
"of",
" ",
"default",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'",
"package",
"s",
"'_",
",_",
"metavar_",
"=_",
"'",
"package",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"nargs_",
"=_",
"'*'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"package",
" ",
"to",
" ",
"be",
" ",
"tested",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"test\\u",
"openm",
"dao_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"follow",
"ing",
" ",
"subcommands",
" ",
"will",
" ",
"only",
" ",
"be",
" ",
"avail",
"able",
" ",
"in",
" ",
"a",
" ",
"dev",
" ",
"build",
",",
" ",
"bec",
"aus",
"e_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"openm",
"dao",
".",
"devt",
"ool",
"s",
" ",
"is",
" ",
"not",
" ",
"part",
" ",
"of",
" ",
"a",
" ",
"normal",
" ",
"Open",
"MD",
"AO",
" ",
"release_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"these",
" ",
"command",
"s",
" ",
"will",
" ",
"only",
" ",
"be",
" ",
"avail",
"able",
" ",
"on",
" ",
"windows",
" ",
"machine",
"s",
" ",
"if",
" ",
"pywi",
"n",
"32_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"is",
" ",
"available_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"openm",
"dao_",
"._",
"devt",
"ools_",
"._",
"push",
"\\u",
"docs_",
"import_",
"push",
"\\u",
"docs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"devt",
"ools_",
"._",
"remote",
"tst_",
"import_",
"test\\u",
"branch_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"devt",
"ools_",
"._",
"remote",
"\\u",
"cfg_",
"import_",
"add",
"\\u",
"config",
"\\u",
"options_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"test\\u",
"branch",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"run",
" ",
"tests",
" ",
"on",
" ",
"remote",
" ",
"machine",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"k",
"'_",
",_",
"'--",
"keep",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"dest_",
"=_",
"'",
"keep",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Don",
"'",
"t",
" ",
"delete",
" ",
"the",
" ",
"temporar",
"y",
" ",
"build",
" ",
"director",
"y",
".\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"If",
" ",
"testi",
"ng",
" ",
"on",
" ",
"EC",
"2",
",",
" ",
"stop",
" ",
"the",
" ",
"instance",
" ",
"inst",
"ead",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"of",
" ",
"termina",
"ting",
" ",
"it",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"f",
"'_",
",_",
"'--",
"file",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"dest_",
"=_",
"'",
"fname",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Path",
"name",
" ",
"of",
" ",
"a",
" ",
"tar",
"file",
" ",
"or",
" ",
"URL",
" ",
"of",
" ",
"a",
" ",
"git",
" ",
"repo",
".",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Default",
"s",
" ",
"to",
" ",
"the",
" ",
"current",
" ",
"repo",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"b",
"'_",
",_",
"'--",
"branch",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"dest_",
"=_",
"'",
"branch",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"If",
" ",
"file",
" ",
"is",
" ",
"a",
" ",
"git",
" ",
"repo",
",",
" ",
"supply",
" ",
"branch",
" ",
"name",
" ",
"here",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"testa",
"rg",
"s",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"'",
"testa",
"rg",
"s",
"'_",
",_",
"default_",
"=_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"args",
" ",
"to",
" ",
"be",
" ",
"pass",
"ed",
" ",
"to",
" ",
"openm",
"dao",
" ",
"test",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"v",
"'_",
",_",
"'--",
"verbo",
"se",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"display",
" ",
"test",
" ",
"progress",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"gui",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"dest_",
"=_",
"'",
"gui",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"do",
" ",
"GU",
"I",
" ",
"functional",
" ",
"tests",
",",
" ",
"rega",
"rd",
"less",
" ",
"of",
" ",
"default",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"skip",
"-",
"gui",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"dest_",
"=_",
"'",
"skip",
"\\u",
"gui",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"skip",
" ",
"GU",
"I",
" ",
"functional",
" ",
"tests",
",",
" ",
"rega",
"rd",
"less",
" ",
"of",
" ",
"default",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"=_",
"add",
"\\u",
"config",
"\\u",
"options_",
"(_",
"parser_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"test\\u",
"branch_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"push",
"\\u",
"docs",
"'_",
",_",
"help_",
"=_",
"'",
"push",
" ",
"the",
" ",
"dev",
" ",
"docs",
" ",
"up",
" ",
"to",
" ",
"the",
" ",
"server",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'",
"host",
"'_",
",_",
"help_",
"=_",
"'",
"host",
" ",
"to",
" ",
"push",
" ",
"docs",
" ",
"to",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"d",
"'_",
",_",
"'--",
"destinat",
"ion",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"'",
"doc",
"dir",
"'_",
",_",
"default_",
"=_",
"'",
"download",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"director",
"y",
" ",
"where",
" ",
"dev",
"\\u",
"docs",
" ",
"director",
"y",
" ",
"will",
" ",
"be",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"place",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"n",
"'_",
",_",
"'--",
"nod",
"oc",
"build",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"'",
"nod",
"oc",
"build",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Us",
"ed",
" ",
"for",
" ",
"testi",
"ng",
".",
" ",
"The",
" ",
"docs",
" ",
"will",
" ",
"not",
" ",
"be",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"rebu",
"ilt",
" ",
"if",
" ",
"the",
"y",
" ",
"alr",
"ead",
"y",
" ",
"exist",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"push",
"\\u",
"docs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"openm",
"dao_",
"._",
"devt",
"ools_",
"._",
"build",
"\\u",
"docs_",
"import_",
"build",
"\\u",
"docs_",
",_",
"test\\u",
"docs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"build",
"\\u",
"docs",
"'_",
",_",
"help_",
"=_",
"'",
"build",
" ",
"Open",
"MD",
"AO",
" ",
"docs",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"v",
"'_",
",_",
"'--",
"version",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"'",
"version",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"the",
" ",
"Open",
"MD",
"AO",
" ",
"version",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"build",
"\\u",
"docs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"test\\u",
"docs",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"run",
" ",
"tests",
" ",
"on",
" ",
"the",
" ",
"Open",
"MD",
"AO",
" ",
"docs",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"test\\u",
"docs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"openm",
"dao_",
"._",
"lib_",
"._",
"architecture",
"s_",
"._",
"mda",
"o",
"\\u",
"test\\u",
"suite_",
"import_",
"cli",
"\\u",
"arch",
"\\u",
"test\\u",
"suite_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"test\\u",
"arch",
"'_",
",_",
"help_",
"=_",
"'",
"run",
" ",
"the",
" ",
"MD",
"AO",
" ",
"architecture",
" ",
"test",
" ",
"suit",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"cli",
"\\u",
"arch",
"\\u",
"test\\u",
"suite_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"ea",
"'_",
",_",
"'--",
"exclu",
"de",
"\\u",
"arch",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"nargs_",
"=_",
"'+'_",
",_",
"dest_",
"=_",
"'",
"excl",
"\\u",
"arch",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Architecture",
"s",
" ",
"class",
" ",
"names",
" ",
"to",
" ",
"exclu",
"de",
" ",
"from",
" ",
"the",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"test",
" ",
"run",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"[_",
"]_",
",_",
"metavar_",
"=_",
"'",
"arch",
"\\u",
"class",
"\\u",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"ia",
"'_",
",_",
"'--",
"include",
"\\u",
"arch",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"nargs_",
"=_",
"'+'_",
",_",
"dest_",
"=_",
"'",
"inc",
"\\u",
"arch",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Architecture",
"s",
" ",
"class",
" ",
"names",
" ",
"to",
" ",
"include",
" ",
"in",
" ",
"the",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"test",
" ",
"run",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"[_",
"]_",
",_",
"metavar_",
"=_",
"'",
"arch",
"\\u",
"class",
"\\u",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"ip",
"'_",
",_",
"'--",
"include",
"\\u",
"prob",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"nargs_",
"=_",
"'+'_",
",_",
"dest_",
"=_",
"'",
"inc",
"\\u",
"prob",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Opt",
"Problems",
" ",
"class",
" ",
"names",
" ",
"to",
" ",
"include",
" ",
"in",
" ",
"the",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"test",
" ",
"run",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"[_",
"]_",
",_",
"metavar_",
"=_",
"'",
"prob",
"\\u",
"class",
"\\u",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'-",
"ep",
"'_",
",_",
"'--",
"exclu",
"de",
"\\u",
"prob",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"nargs_",
"=_",
"'+'_",
",_",
"dest_",
"=_",
"'",
"excl",
"\\u",
"prob",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Opt",
"Problems",
" ",
"class",
" ",
"names",
" ",
"to",
" ",
"exclu",
"de",
" ",
"from",
" ",
"the",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"test",
" ",
"run",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"[_",
"]_",
",_",
"metavar_",
"=_",
"'",
"prob",
"\\u",
"class",
"\\u",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"case",
" ",
"data",
" ",
"viewer",
" ",
"(",
"i",
".",
"e",
".",
" ",
"html",
"\\u",
"post",
"\\u",
"process",
"or",
")_",
"\\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_",
"openm",
"dao_",
"._",
"lib_",
"._",
"case",
"handlers_",
"._",
"html",
"\\u",
"post",
"\\u",
"processor_",
"as_",
"viewer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"=_",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"'",
"view",
"\\u",
"case",
"\\u",
"data",
"'_",
",_",
"help_",
"=_",
"'",
"visualize",
" ",
"JSO",
"N",
" ",
"case",
" ",
"data",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'",
"json",
"\\u",
"file",
"'_",
",_",
"type_",
"=_",
"str_",
",_",
"metavar_",
"=_",
"'",
"json",
"\\u",
"file",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"JSO",
"N",
" ",
"format",
" ",
"case",
" ",
"data",
" ",
"file",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"func_",
"=_",
"viewer_",
"._",
"run_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"top",
"\\u",
"parser_",
"\\u\\u\\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_",
"openm",
"dao_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"\\u",
"get",
"\\u",
"openm",
"dao",
"\\u",
"parser_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"options_",
",_",
"args_",
"=_",
"parser_",
"._",
"parse",
"\\u",
"know",
"n",
"\\u",
"args_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"options_",
"._",
"func_",
"(_",
"parser_",
",_",
"options_",
",_",
"args_",
")_",
")_",
"\\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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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ep.py | [
{
"content": " def test_multiline(self):\n table = [\n ['a', 'b'],\n ['1', 'foo\\nbar']\n ]\n fcr = FilteringCSVReader(iter(table), patterns={'b': re.compile('bar')})\n self.assertEqual(table[0], next(fcr))\n self.assertEqual(table[1], next(fcr))\n try:\n next(fcr)\n self.fail(\"Should be no more rows left.\")\n except StopIteration:\n pass",
"metadata": "root.TestGrep.test_multiline",
"header": "['class', 'TestGrep', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 126
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Test",
"Gre",
"p_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"multiline",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"table_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"a",
"'_",
",_",
"'",
"b",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"1",
"'_",
",_",
"'",
"foo",
"\\\\",
"nba",
"r",
"'_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fc",
"r_",
"=_",
"Filtering",
"CSV",
"Reader_",
"(_",
"iter_",
"(_",
"table_",
")_",
",_",
"patterns_",
"=_",
"{_",
"'",
"b",
"'_",
":_",
"re_",
"._",
"compile_",
"(_",
"'",
"bar",
"'_",
")_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"table_",
"[_",
"0_",
"]_",
",_",
"next_",
"(_",
"fc",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"table_",
"[_",
"1_",
"]_",
",_",
"next_",
"(_",
"fc",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"next_",
"(_",
"fc",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Sho",
"ul",
"d",
" ",
"be",
" ",
"no",
" ",
"more",
" ",
"rows",
" ",
"left",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Sto",
"p",
"Iteration_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | OpenMDAO/OpenMDAO-Framework/openmdao.test/src/openmdao/test/plugins/foo2/setup.py | [
{
"content": "\"\"\"\nA small example plugin\n\"\"\"\nfrom setuptools import setup\n\n__author__ = 'Your Name Here'\n\nsetup(\n name='foo',\n version='1.4',\n description=__doc__,\n author=__author__,\n packages=[],\n py_modules=['foo'],\n entry_points=\"\"\"\n [openmdao.dumbplugins]\n foo.Comp1Plugin = foo:Comp1Plugin\n foo.Comp2Plugin = foo:Comp2Plugin\n \"\"\"\n)\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"A",
" ",
"small",
" ",
"example",
" ",
"plugin",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"setuptools_",
"import_",
"setup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"author\\u\\u_",
"=_",
"'",
"You",
"r",
" ",
"Name",
" ",
"Her",
"e",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"setup_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"foo",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"'",
"1.4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"\\u\\u",
"doc\\u\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author_",
"=_",
"\\u\\u",
"author\\u\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"packages_",
"=_",
"[_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"py",
"\\u",
"modules_",
"=_",
"[_",
"'",
"foo",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"entry",
"\\u",
"points_",
"=_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"[",
"openm",
"dao",
".",
"dumb",
"plugin",
"s",
"]",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"foo",
".",
"Comp",
"1",
"Plug",
"in",
" ",
"=",
" ",
"foo",
":",
"Comp",
"1",
"Plug",
"in",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"foo",
".",
"Comp",
"2",
"Plug",
"in",
" ",
"=",
" ",
"foo",
":",
"Comp",
"2",
"Plug",
"in",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | michaelliao/transwarp/transwarp/cache.py | [
{
"content": " def decr(self, key):\n '''\n Decrease counter. NOTE the memcache does not allow negative number, \n so decr key = 0 will still return 0\n\n Args:\n key: cache key as str.\n\n >>> key = uuid.uuid4().hex\n >>> c = MemcacheClient('localhost:11211')\n >>> c.decr(key)\n 0\n >>> c.decr(key)\n 0\n >>> c.set(key, 100)\n >>> c.decr(key)\n 99\n '''\n r = self._client.decr(key)\n if r is None:\n self._client.set(key, 0)\n r = 0\n return r",
"metadata": "root.MemcacheClient.decr",
"header": "['class', 'MemcacheClient', '(', 'object', ')', ':', '___EOS___']",
"index": 199
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Memcache",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"dec",
"r_",
"(_",
"self_",
",_",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Decre",
"ase",
" ",
"counter",
".",
" ",
"NOTE",
" ",
"the",
" ",
"memc",
"ache",
" ",
"doe",
"s",
" ",
"not",
" ",
"allow",
" ",
"negati",
"ve",
" ",
"number",
",",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"so",
" ",
"dec",
"r",
" ",
"key",
" ",
"=",
" ",
"0",
" ",
"will",
" ",
"still",
" ",
"return",
" ",
"0",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"key",
":",
" ",
"cache",
" ",
"key",
" ",
"as",
" ",
"str",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"key",
" ",
"=",
" ",
"uuid",
".",
"uuid",
"4",
"()",
".",
"hex",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"c",
" ",
"=",
" ",
"Memcache",
"Client",
"('",
"local",
"host",
":",
"1121",
"1",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"c",
".",
"dec",
"r",
"(",
"key",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"0",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"c",
".",
"dec",
"r",
"(",
"key",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"0",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"c",
".",
"set",
"(",
"key",
",",
" ",
"100",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"c",
".",
"dec",
"r",
"(",
"key",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"9",
"9",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"=_",
"self_",
"._",
"\\u",
"client_",
"._",
"dec",
"r_",
"(_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"r_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"client_",
"._",
"set_",
"(_",
"key_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"r_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
First argument to super() is not enclosing class | michaelliao/githubpy/github.py | [
{
"content": " def __init__(self, msg):\n super(ApiAuthError, self).__init__(msg, None, None)",
"metadata": "root.ApiAuthError.__init__",
"header": "['class', 'ApiAuthError', '(', 'ApiError', ')', ':', '___EOS___']",
"index": 299
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"argument_",
"to_",
"super_",
"(_",
")_",
"is_",
"not_",
"encl",
"osin",
"g_",
"class_",
"[SEP]_",
"class_",
"Ap",
"i",
"Auth",
"Error_",
"(_",
"Ap",
"i",
"Error_",
")_",
":_",
"\\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_",
",_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Ap",
"i",
"Auth",
"Error_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"msg_",
",_",
"None_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Modification of parameter with default | VisTrails/VisTrails/contrib/sahm/init.py | [
{
"content": " def compute(self):\n if not (self.has_input(\"csvFileList\") or\n self.has_input(\"addPredictor\")):\n raise ModuleError(self, \"No inputs or CSV file provided\")\n\n output_fname = utils.mknextfile(prefix='PredictorList_', suffix='.csv')\n if (self.has_input(\"csvFileList\") and \n os.path.exists(self.get_input(\"csvFileList\").name)):\n shutil.copy(self.get_input(\"csvFileList\").name, \n output_fname)\n csv_writer = csv.writer(open(output_fname, 'ab'))\n else:\n #create an empty file to start with.\n csv_writer = csv.writer(open(output_fname, 'wb'))\n csv_writer.writerow([\"file\", \"Resampling\", \"Aggregation\"])\n \n if self.has_input(\"addPredictor\"):\n p_list = self.force_get_input_list(\"addPredictor\")\n for p in p_list:\n if p.has_input('resampleMethod'):\n resMethod = p.get_input('resampleMethod')\n else:\n resMethod = \"NearestNeighbor\"\n if p.has_input('aggregationMethod'):\n aggMethod = p.get_input('aggregationMethod')\n else:\n aggMethod = \"Mean\" \n csv_writer.writerow([os.path.normpath(p.name), resMethod, aggMethod])\n\n del csv_writer\n \n output_file = utils.create_file_module(output_fname)\n self.set_output('RastersWithPARCInfoCSV', output_file)",
"metadata": "root.PredictorListFile.compute",
"header": "['class', 'PredictorListFile', '(', 'Module', ')', ':', '___EOS___']",
"index": 323
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Modifica",
"tion_",
"of_",
"parameter_",
"with_",
"default_",
"[SEP]_",
"class_",
"Predictor",
"List",
"File_",
"(_",
"Module_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"compute_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"(_",
"self_",
"._",
"has",
"\\u",
"input_",
"(_",
"\"",
"csv",
"File",
"List",
"\"_",
")_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"has",
"\\u",
"input_",
"(_",
"\"",
"add",
"Predictor",
"\"_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Modul",
"e",
"Error_",
"(_",
"self_",
",_",
"\"",
"No",
" ",
"inputs",
" ",
"or",
" ",
"CSV",
" ",
"file",
" ",
"provided",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"output",
"\\u",
"fname_",
"=_",
"utils_",
"._",
"mk",
"next",
"file_",
"(_",
"prefix_",
"=_",
"'",
"Predictor",
"List",
"\\u'_",
",_",
"suffix_",
"=_",
"'.",
"csv",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"self_",
"._",
"has",
"\\u",
"input_",
"(_",
"\"",
"csv",
"File",
"List",
"\"_",
")_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"self_",
"._",
"get",
"\\u",
"input_",
"(_",
"\"",
"csv",
"File",
"List",
"\"_",
")_",
"._",
"name_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shutil_",
"._",
"copy_",
"(_",
"self_",
"._",
"get",
"\\u",
"input_",
"(_",
"\"",
"csv",
"File",
"List",
"\"_",
")_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"output",
"\\u",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"csv",
"\\u",
"writer_",
"=_",
"csv_",
"._",
"writer_",
"(_",
"open_",
"(_",
"output",
"\\u",
"fname_",
",_",
"'",
"ab",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"create",
" ",
"an",
" ",
"empty",
" ",
"file",
" ",
"to",
" ",
"start",
" ",
"with",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"csv",
"\\u",
"writer_",
"=_",
"csv_",
"._",
"writer_",
"(_",
"open_",
"(_",
"output",
"\\u",
"fname_",
",_",
"'",
"wb",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"csv",
"\\u",
"writer_",
"._",
"writerow_",
"(_",
"[_",
"\"",
"file",
"\"_",
",_",
"\"",
"Res",
"ampling",
"\"_",
",_",
"\"",
"Aggregation",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"has",
"\\u",
"input_",
"(_",
"\"",
"add",
"Predictor",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"p",
"\\u",
"list_",
"=_",
"self_",
"._",
"force",
"\\u",
"get",
"\\u",
"input",
"\\u",
"list_",
"(_",
"\"",
"add",
"Predictor",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"p_",
"in_",
"p",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"p_",
"._",
"has",
"\\u",
"input_",
"(_",
"'",
"resample",
"Meth",
"od",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"res",
"Method_",
"=_",
"p_",
"._",
"get",
"\\u",
"input_",
"(_",
"'",
"resample",
"Meth",
"od",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"res",
"Method_",
"=_",
"\"",
"Near",
"est",
"Neighbor",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"p_",
"._",
"has",
"\\u",
"input_",
"(_",
"'",
"aggregation",
"Meth",
"od",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"agg",
"Method_",
"=_",
"p_",
"._",
"get",
"\\u",
"input_",
"(_",
"'",
"aggregation",
"Meth",
"od",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"agg",
"Method_",
"=_",
"\"",
"Mea",
"n",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"csv",
"\\u",
"writer_",
"._",
"writerow_",
"(_",
"[_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"p_",
"._",
"name_",
")_",
",_",
"res",
"Method_",
",_",
"agg",
"Method_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"csv",
"\\u",
"writer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"output",
"\\u",
"file_",
"=_",
"utils_",
"._",
"create",
"\\u",
"file",
"\\u",
"module_",
"(_",
"output",
"\\u",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"set\\u",
"output_",
"(_",
"'",
"Ras",
"ters",
"With",
"PAR",
"CI",
"nfo",
"CSV",
"'_",
",_",
"output",
"\\u",
"file_",
")_",
"\\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,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variable | deanhiller/databus/webapp/play1.3.x/python/Lib/bsddb/dbobj.py | [
{
"content": " def get(self, *args, **kwargs):\n return apply(self._cobj.get, args, kwargs)",
"metadata": "root.DB.get",
"header": "['class', 'DB', '(', 'MutableMapping', ')', ':', '___EOS___']",
"index": 160
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"DB_",
"(_",
"Mut",
"able",
"Mapping_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"apply_",
"(_",
"self_",
"._",
"\\u",
"cobj",
"_",
"._",
"get_",
",_",
"args_",
",_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unreachable code | jawerty/AlienFeed/alienfeed/alien.py | [
{
"content": "def submission_getter(submission_list, verbose = False):\n submissions = []\n scores = []\n subreddits = set()\n\n for x, submission in enumerate(submission_list):\n submissions.append(submission)\n if verbose:\n scores.append(submission.score)\n subreddits.add(str(submission.subreddit))\n\n if not verbose:\n return submissions\n\n count_width = int(math.log(len(submissions), 10)) + 1\n score_width = len(str(max(scores)))\n\n fmt = {'arrow': ' -> '}\n indent = ' ' * (count_width + len(fmt['arrow']) + score_width + 1)\n\n try:\n _, terminal_width = os.popen('stty size', 'r').read().split()\n terminal_width = int(terminal_width)\n except:\n terminal_width = 80\n\n wrapper = TextWrapper(subsequent_indent = indent, width = terminal_width)\n\n for i, submission in enumerate(submissions):\n fmt['count'] = color.OKGREEN + str(i + 1).rjust(count_width)\n fmt['score'] = color.WARNING + str(submission.score).rjust(score_width)\n fmt['title'] = color.OKBLUE + submission.title\n fmt['tags'] = get_link_types(submission)\n\n if len(subreddits) > 1:\n fmt['title'] += color.SUBTEXT + u' ({0})'.format(submission.subreddit)\n\n wrap = wrapper.wrap(\n u'{count}{arrow}{score} {title} {tags}'.format(**fmt))\n\n for line in wrap:\n print line\n\n return submissions",
"metadata": "root.submission_getter",
"header": "['module', '___EOS___']",
"index": 74
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"subm",
"ission",
"\\u",
"getter_",
"(_",
"subm",
"ission",
"\\u",
"list_",
",_",
"verbose_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"submissions_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scores_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"subred",
"dit",
"s_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"x_",
",_",
"submission_",
"in_",
"enumerate_",
"(_",
"subm",
"ission",
"\\u",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"submissions_",
"._",
"append_",
"(_",
"submission_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"verbose_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"scores_",
"._",
"append_",
"(_",
"submission_",
"._",
"score_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"subred",
"dit",
"s_",
"._",
"add_",
"(_",
"str_",
"(_",
"submission_",
"._",
"subreddit_",
")_",
")_",
"\\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_",
"verbose_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"submissions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"count",
"\\u",
"width_",
"=_",
"int_",
"(_",
"math_",
"._",
"log_",
"(_",
"len_",
"(_",
"submissions_",
")_",
",_",
"10_",
")_",
")_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"score",
"\\u",
"width_",
"=_",
"len_",
"(_",
"str_",
"(_",
"max_",
"(_",
"scores_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fmt_",
"=_",
"{_",
"'",
"arrow",
"'_",
":_",
"'",
" ",
"->",
" ",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"indent_",
"=_",
"'",
" ",
"'_",
"*_",
"(_",
"count",
"\\u",
"width_",
"+_",
"len_",
"(_",
"fmt_",
"[_",
"'",
"arrow",
"'_",
"]_",
")_",
"+_",
"score",
"\\u",
"width_",
"+_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u_",
",_",
"termina",
"l\\u",
"width_",
"=_",
"os_",
"._",
"popen_",
"(_",
"'",
"stt",
"y",
" ",
"size",
"'_",
",_",
"'",
"r",
"'_",
")_",
"._",
"read_",
"(_",
")_",
"._",
"split_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"termina",
"l\\u",
"width_",
"=_",
"int_",
"(_",
"termina",
"l\\u",
"width_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"termina",
"l\\u",
"width_",
"=_",
"80_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"wrapper_",
"=_",
"Text",
"Wrapper_",
"(_",
"subsequen",
"t",
"\\u",
"indent_",
"=_",
"indent_",
",_",
"width_",
"=_",
"termina",
"l\\u",
"width_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"i_",
",_",
"submission_",
"in_",
"enumerate_",
"(_",
"submissions_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fmt_",
"[_",
"'",
"count",
"'_",
"]_",
"=_",
"color_",
"._",
"OK",
"GREEN_",
"+_",
"str_",
"(_",
"i_",
"+_",
"1_",
")_",
"._",
"rjust_",
"(_",
"count",
"\\u",
"width_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fmt_",
"[_",
"'",
"score",
"'_",
"]_",
"=_",
"color_",
"._",
"WARNING_",
"+_",
"str_",
"(_",
"submission_",
"._",
"score_",
")_",
"._",
"rjust_",
"(_",
"score",
"\\u",
"width_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fmt_",
"[_",
"'",
"title",
"'_",
"]_",
"=_",
"color_",
"._",
"OK",
"BLUE_",
"+_",
"submission_",
"._",
"title_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fmt_",
"[_",
"'",
"tags",
"'_",
"]_",
"=_",
"get",
"\\u",
"link",
"\\u",
"types_",
"(_",
"submission_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"subred",
"dit",
"s_",
")_",
">_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fmt_",
"[_",
"'",
"title",
"'_",
"]_",
"+=_",
"color_",
"._",
"SUBT",
"EXT_",
"+_",
"u",
"'",
" ",
"({",
"0",
"})'_",
"._",
"format_",
"(_",
"submission_",
"._",
"subreddit_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"wrap_",
"=_",
"wrapper_",
"._",
"wrap_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'{",
"count",
"}{",
"arrow",
"}{",
"score",
"}",
" ",
"{",
"title",
"}",
" ",
"{",
"tags",
"}'_",
"._",
"format_",
"(_",
"**_",
"fmt_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"line_",
"in_",
"wrap_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"submissions_",
"\\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
] |
Unused local variable | burke-software/django-report-builder/report_builder_demo/demo_second_app/models.py | [
{
"content": "class Bar(models.Model):\n char_field = models.CharField(max_length=50, blank=True)\n\n\n class ReportBuilder:\n extra = ('i_want_char_field',)",
"metadata": "root.Bar",
"header": "['module', '___EOS___']",
"index": 3
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Bar_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"char",
"\\u",
"field_",
"=_",
"models_",
"._",
"Char",
"Field_",
"(_",
"max",
"\\u",
"length_",
"=_",
"50_",
",_",
"blank_",
"=_",
"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\\uDEDENT\\u\\u\\u_",
"class_",
"Report",
"Builder_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"extra_",
"=_",
"(_",
"'",
"i",
"\\u",
"want",
"\\u",
"char",
"\\u",
"field",
"'_",
",_",
")_"
] | [
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
] |
Testing equality to None | NervanaSystems/neon/neon/data/text.py | [
{
"content": " @staticmethod\n def get_vocab(tokens, vocab=None):\n \"\"\"\n Construct vocabulary from the given tokens.\n\n Args:\n tokens (list) : List of tokens.\n\n Returns:\n python.set : A set of unique tokens\n \"\"\"\n # (if vocab is not None, we check that it contains all tokens)\n if vocab is None:\n return set(tokens)\n else:\n vocab = set(vocab)\n assert vocab >= set(tokens), \"the predefined vocab must contain all the tokens\"\n return vocab",
"metadata": "root.Text.get_vocab",
"header": "['class', 'Text', '(', 'NervanaDataIterator', ')', ':', '___EOS___']",
"index": 143
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"class_",
"Text_",
"(_",
"Ne",
"rva",
"na",
"Data",
"Iterator_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"\\u",
"vocab_",
"(_",
"tokens_",
",_",
"vocab_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Construct",
" ",
"vocab",
"ular",
"y",
" ",
"from",
" ",
"the",
" ",
"give",
"n",
" ",
"token",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"token",
"s",
" ",
"(",
"list",
")",
" ",
":",
" ",
"List",
" ",
"of",
" ",
"token",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"python",
".",
"set",
" ",
":",
" ",
"A",
" ",
"set",
" ",
"of",
" ",
"unique",
" ",
"token",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"(",
"if",
" ",
"vocab",
" ",
"is",
" ",
"not",
" ",
"Non",
"e",
",",
" ",
"we",
" ",
"check",
" ",
"tha",
"t",
" ",
"it",
" ",
"contain",
"s",
" ",
"all",
" ",
"token",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"vocab_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"set_",
"(_",
"tokens_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vocab_",
"=_",
"set_",
"(_",
"vocab_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"vocab_",
">=_",
"set_",
"(_",
"tokens_",
")_",
",_",
"\"",
"the",
" ",
"prede",
"fined",
" ",
"vocab",
" ",
"must",
" ",
"contain",
" ",
"all",
" ",
"the",
" ",
"token",
"s",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"vocab_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unnecessary 'else' clause in loop | enthought/traits/traits/trait_numeric.py | [
{
"content": " def validate ( self, object, name, value ):\n \"\"\" Validates that the value is a valid array.\n \"\"\"\n try:\n # Make sure the value is an array:\n type_value = type( value )\n if not isinstance( value, ndarray ):\n if not isinstance( value, SequenceTypes ):\n self.error( object, name, value )\n if self.dtype is not None:\n value = asarray( value, self.dtype )\n else:\n value = asarray( value )\n\n # Make sure the array is of the right type:\n if ((self.dtype is not None) and\n (value.dtype != self.dtype)):\n if self.coerce:\n value = value.astype( self.dtype )\n else:\n # XXX: this also coerces.\n value = asarray( value, self.dtype )\n\n # If no shape requirements, then return the value:\n trait_shape = self.shape\n if trait_shape is None:\n return value\n\n # Else make sure that the value's shape is compatible:\n value_shape = value.shape\n if len( trait_shape ) == len( value_shape ):\n for i, dim in enumerate( value_shape ):\n item = trait_shape[i]\n if item is not None:\n if type( item ) is int:\n if dim != item:\n break\n elif ((dim < item[0]) or\n ((item[1] is not None) and (dim > item[1]))):\n break\n else:\n return value\n except:\n pass\n\n self.error( object, name, value )",
"metadata": "root.AbstractArray.validate",
"header": "['class', 'AbstractArray', '(', 'TraitType', ')', ':', '___EOS___']",
"index": 132
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"'",
"else",
"'_",
"clause_",
"in_",
"loop_",
"[SEP]_",
"class_",
"Abstract",
"Array_",
"(_",
"Trait",
"Type_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"validate_",
"(_",
"self_",
",_",
"object_",
",_",
"name_",
",_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Validate",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"value",
" ",
"is",
" ",
"a",
" ",
"valid",
" ",
"array",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"the",
" ",
"value",
" ",
"is",
" ",
"an",
" ",
"array",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"type",
"\\u",
"value_",
"=_",
"type_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"isinstance_",
"(_",
"value_",
",_",
"ndarray_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"isinstance_",
"(_",
"value_",
",_",
"Sequ",
"ence",
"Types_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"error_",
"(_",
"object_",
",_",
"name_",
",_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"dtype_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"value_",
"=_",
"asarray_",
"(_",
"value_",
",_",
"self_",
"._",
"dtype_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"value_",
"=_",
"asarray_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"the",
" ",
"array",
" ",
"is",
" ",
"of",
" ",
"the",
" ",
"right",
" ",
"type",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"(_",
"(_",
"self_",
"._",
"dtype_",
"is_",
"not_",
"None_",
")_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"value_",
"._",
"dtype_",
"!=_",
"self_",
"._",
"dtype_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"coerce",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"value_",
"=_",
"value_",
"._",
"astype_",
"(_",
"self_",
"._",
"dtype_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
":",
" ",
"this",
" ",
"als",
"o",
" ",
"coerce",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"value_",
"=_",
"asarray_",
"(_",
"value_",
",_",
"self_",
"._",
"dtype_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"no",
" ",
"shape",
" ",
"require",
"ment",
"s",
",",
" ",
"then",
" ",
"return",
" ",
"the",
" ",
"value",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"tra",
"it",
"\\u",
"shape_",
"=_",
"self_",
"._",
"shape_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"tra",
"it",
"\\u",
"shape_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Else",
" ",
"make",
" ",
"sure",
" ",
"tha",
"t",
" ",
"the",
" ",
"value",
"'",
"s",
" ",
"shape",
" ",
"is",
" ",
"compatible",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"value",
"\\u",
"shape_",
"=_",
"value_",
"._",
"shape_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"tra",
"it",
"\\u",
"shape_",
")_",
"==_",
"len_",
"(_",
"value",
"\\u",
"shape_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"i_",
",_",
"dim_",
"in_",
"enumerate_",
"(_",
"value",
"\\u",
"shape_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"item_",
"=_",
"tra",
"it",
"\\u",
"shape_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"item_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"type_",
"(_",
"item_",
")_",
"is_",
"int_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"dim_",
"!=_",
"item_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"(_",
"dim_",
"<_",
"item_",
"[_",
"0_",
"]_",
")_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"(_",
"item_",
"[_",
"1_",
"]_",
"is_",
"not_",
"None_",
")_",
"and_",
"(_",
"dim_",
">_",
"item_",
"[_",
"1_",
"]_",
")_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\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[
{
"content": " def test_min_fresh(self):\n # this test is raced; if running it takes about a second, it might fail\n r = Response()\n r.date = datetime.utcnow() - timedelta(seconds=100)\n r.cache_control.max_age = 200\n f = self.r.response_freshness_seconds(r)\n with a.test_request_context('/foo', headers=(('cache-control', 'min-fresh=50'),)):\n try:\n self.r.verify_response_freshness_or_miss(r, f)\n except CacheMiss:\n self.fail('unexpected CacheMiss on reasonably fresh response')\n with a.test_request_context('/foo', headers=(('cache-control', 'min-fresh=150'),)):\n self.assertRaises(NotFreshEnoughForClient, self.r.verify_response_freshness_or_miss, r, f)",
"metadata": "root.StorageTestCase.test_min_fresh",
"header": "['class', 'StorageTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 186
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Stor",
"age",
"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",
"min",
"\\u",
"fresh",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"this",
" ",
"test",
" ",
"is",
" ",
"race",
"d",
";",
" ",
"if",
" ",
"runn",
"ing",
" ",
"it",
" ",
"take",
"s",
" ",
"abo",
"ut",
" ",
"a",
" ",
"second",
",",
" ",
"it",
" ",
"mig",
"ht",
" ",
"fail_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r_",
"=_",
"Response_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"._",
"date_",
"=_",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"-_",
"timedelta_",
"(_",
"seconds_",
"=_",
"100_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"._",
"cache",
"\\u",
"control_",
"._",
"max",
"\\u",
"age_",
"=_",
"200_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"=_",
"self_",
"._",
"r_",
"._",
"response",
"\\u",
"fresh",
"ness",
"\\u",
"seconds_",
"(_",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"a_",
"._",
"test\\u",
"request",
"\\u",
"context_",
"(_",
"'/",
"foo",
"'_",
",_",
"headers_",
"=_",
"(_",
"(_",
"'",
"cache",
"-",
"control",
"'_",
",_",
"'",
"min",
"-",
"fresh",
"=",
"50",
"'_",
")_",
",_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"r_",
"._",
"verify",
"\\u",
"response",
"\\u",
"fresh",
"ness",
"\\u",
"or",
"\\u",
"miss",
"_",
"(_",
"r_",
",_",
"f_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Cache",
"Miss",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"fail_",
"(_",
"'",
"unexpected",
" ",
"Cache",
"Miss",
" ",
"on",
" ",
"reason",
"abl",
"y",
" ",
"fresh",
" ",
"response",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"a_",
"._",
"test\\u",
"request",
"\\u",
"context_",
"(_",
"'/",
"foo",
"'_",
",_",
"headers_",
"=_",
"(_",
"(_",
"'",
"cache",
"-",
"control",
"'_",
",_",
"'",
"min",
"-",
"fresh",
"=",
"150",
"'_",
")_",
",_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Not",
"Fre",
"sh",
"En",
"ou",
"gh",
"For",
"Client_",
",_",
"self_",
"._",
"r_",
"._",
"verify",
"\\u",
"response",
"\\u",
"fresh",
"ness",
"\\u",
"or",
"\\u",
"miss",
"_",
",_",
"r_",
",_",
"f_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | AppScale/appscale/AppServer/lib/django-1.5/django/forms/widgets.py | [
{
"content": " def render(self, name, value, attrs=None):\n if self.is_localized:\n for widget in self.widgets:\n widget.is_localized = self.is_localized\n # value is a list of values, each corresponding to a widget\n # in self.widgets.\n if not isinstance(value, list):\n value = self.decompress(value)\n output = []\n final_attrs = self.build_attrs(attrs)\n id_ = final_attrs.get('id', None)\n for i, widget in enumerate(self.widgets):\n try:\n widget_value = value[i]\n except IndexError:\n widget_value = None\n if id_:\n final_attrs = dict(final_attrs, id='%s_%s' % (id_, i))\n output.append(widget.render(name + '_%s' % i, widget_value, final_attrs))\n return mark_safe(self.format_output(output))",
"metadata": "root.MultiWidget.render",
"header": "['class', 'MultiWidget', '(', 'Widget', ')', ':', '___EOS___']",
"index": 816
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Multi",
"Widget_",
"(_",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
",_",
"name_",
",_",
"value_",
",_",
"attrs_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"is",
"\\u",
"localized",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"widget_",
"in_",
"self_",
"._",
"widgets_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"widget_",
"._",
"is",
"\\u",
"localized",
"_",
"=_",
"self_",
"._",
"is",
"\\u",
"localized",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"value",
" ",
"is",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"values",
",",
" ",
"each",
" ",
"correspond",
"ing",
" ",
"to",
" ",
"a",
" ",
"widget_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"in",
" ",
"self",
".",
"widget",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"isinstance_",
"(_",
"value_",
",_",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"self_",
"._",
"decompress_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"output_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"final",
"\\u",
"attrs_",
"=_",
"self_",
"._",
"build",
"\\u",
"attrs_",
"(_",
"attrs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"id\\u_",
"=_",
"final",
"\\u",
"attrs_",
"._",
"get_",
"(_",
"'",
"id",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
",_",
"widget_",
"in_",
"enumerate_",
"(_",
"self_",
"._",
"widgets_",
")_",
":_",
"\\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 ",
" _",
"widget",
"\\u",
"value_",
"=_",
"value_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Index",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"widget",
"\\u",
"value_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"id\\u_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"final",
"\\u",
"attrs_",
"=_",
"dict_",
"(_",
"final",
"\\u",
"attrs_",
",_",
"id_",
"=_",
"'%",
"s",
"\\u",
"%",
"s",
"'_",
"%_",
"(_",
"id\\u_",
",_",
"i_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"output_",
"._",
"append_",
"(_",
"widget_",
"._",
"render_",
"(_",
"name_",
"+_",
"'\\u",
"%",
"s",
"'_",
"%_",
"i_",
",_",
"widget",
"\\u",
"value_",
",_",
"final",
"\\u",
"attrs_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"mark",
"\\u",
"safe_",
"(_",
"self_",
"._",
"format\\u",
"output_",
"(_",
"output_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | torchbox/wagtail/wagtail/wagtailsearch/tests/test_related_fields.py | [
{
"content": "from __future__ import absolute_import, unicode_literals\n\nfrom django.test import TestCase\n\nfrom wagtail.tests.search.models import SearchTest, SearchTestChild\nfrom wagtail.tests.testapp.models import Advert, ManyToManyBlogPage\nfrom wagtail.wagtailsearch import index\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestSelectOnQuerySet(TestCase):\n\n\n\n\n\n",
"metadata": "root.TestSelectOnQuerySet",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": " def test_select_on_queryset_with_foreign_key(self):\n fields = index.RelatedFields('page', [\n index.SearchField('title'),\n ])\n\n queryset = fields.select_on_queryset(SearchTestChild.objects.all())\n\n # ForeignKey should be select_related\n self.assertFalse(queryset._prefetch_related_lookups)\n self.assertIn('page', queryset.query.select_related)",
"metadata": "root.TestSelectOnQuerySet.test_select_on_queryset_with_foreign_key",
"header": "['class', 'TestSelectOnQuerySet', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 10
},
{
"content": " def test_select_on_queryset_with_one_to_one(self):\n fields = index.RelatedFields('searchtest_ptr', [\n index.SearchField('title'),\n ])\n\n queryset = fields.select_on_queryset(SearchTestChild.objects.all())\n\n # OneToOneField should be select_related\n self.assertFalse(queryset._prefetch_related_lookups)\n self.assertIn('searchtest_ptr', queryset.query.select_related)",
"metadata": "root.TestSelectOnQuerySet.test_select_on_queryset_with_one_to_one",
"header": "['class', 'TestSelectOnQuerySet', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 21
},
{
"content": " def test_select_on_queryset_with_many_to_many(self):\n fields = index.RelatedFields('adverts', [\n index.SearchField('title'),\n ])\n\n queryset = fields.select_on_queryset(ManyToManyBlogPage.objects.all())\n\n # ManyToManyField should be prefetch_related\n self.assertIn('adverts', queryset._prefetch_related_lookups)\n self.assertFalse(queryset.query.select_related)",
"metadata": "root.TestSelectOnQuerySet.test_select_on_queryset_with_many_to_many",
"header": "['class', 'TestSelectOnQuerySet', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 32
},
{
"content": " def test_select_on_queryset_with_reverse_foreign_key(self):\n fields = index.RelatedFields('categories', [\n index.RelatedFields('category', [\n index.SearchField('name')\n ])\n ])\n\n queryset = fields.select_on_queryset(ManyToManyBlogPage.objects.all())\n\n # reverse ForeignKey should be prefetch_related\n self.assertIn('categories', queryset._prefetch_related_lookups)\n self.assertFalse(queryset.query.select_related)",
"metadata": "root.TestSelectOnQuerySet.test_select_on_queryset_with_reverse_foreign_key",
"header": "['class', 'TestSelectOnQuerySet', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 43
},
{
"content": " def test_select_on_queryset_with_reverse_one_to_one(self):\n fields = index.RelatedFields('searchtestchild', [\n index.SearchField('subtitle'),\n ])\n\n queryset = fields.select_on_queryset(SearchTest.objects.all())\n\n # reverse OneToOneField should be select_related\n self.assertFalse(queryset._prefetch_related_lookups)\n self.assertIn('searchtestchild', queryset.query.select_related)",
"metadata": "root.TestSelectOnQuerySet.test_select_on_queryset_with_reverse_one_to_one",
"header": "['class', 'TestSelectOnQuerySet', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 56
},
{
"content": " def test_select_on_queryset_with_reverse_many_to_many(self):\n fields = index.RelatedFields('manytomanyblogpage', [\n index.SearchField('title'),\n ])\n\n queryset = fields.select_on_queryset(Advert.objects.all())\n\n # reverse ManyToManyField should be prefetch_related\n self.assertIn('manytomanyblogpage', queryset._prefetch_related_lookups)\n self.assertFalse(queryset.query.select_related)",
"metadata": "root.TestSelectOnQuerySet.test_select_on_queryset_with_reverse_many_to_many",
"header": "['class', 'TestSelectOnQuerySet', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 67
},
{
"content": " def test_select_on_queryset_with_taggable_manager(self):\n fields = index.RelatedFields('tags', [\n index.SearchField('name'),\n ])\n\n queryset = fields.select_on_queryset(SearchTestChild.objects.all())\n\n # Tags should be prefetch_related\n self.assertIn('tags', queryset._prefetch_related_lookups)\n self.assertFalse(queryset.query.select_related)",
"metadata": "root.TestSelectOnQuerySet.test_select_on_queryset_with_taggable_manager",
"header": "['class', 'TestSelectOnQuerySet', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 78
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
",_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"test_",
"import_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"wagtail_",
"._",
"tests_",
"._",
"search_",
"._",
"models_",
"import_",
"Sear",
"ch",
"Test_",
",_",
"Sear",
"ch",
"Test",
"Child_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"wagtail_",
"._",
"tests_",
"._",
"testapp_",
"._",
"models_",
"import_",
"Advert",
"_",
",_",
"Many",
"To",
"Many",
"Blog",
"Page_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"wagtail_",
"._",
"wagtail",
"search_",
"import_",
"index_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"select",
"\\u",
"on",
"\\u",
"querys",
"et",
"\\u",
"with",
"\\u",
"foreign",
"\\u",
"key_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"page",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Sear",
"ch",
"Field_",
"(_",
"'",
"title",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queryset_",
"=_",
"fields_",
"._",
"select",
"\\u",
"on",
"\\u",
"queryset_",
"(_",
"Sear",
"ch",
"Test",
"Child_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fore",
"ign",
"Key",
" ",
"shou",
"ld",
" ",
"be",
" ",
"select",
"\\u",
"related_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"queryset_",
"._",
"\\u",
"prefetch",
"\\u",
"relate",
"d\\u",
"lookups",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"page",
"'_",
",_",
"queryset_",
"._",
"query_",
"._",
"select",
"\\u",
"related_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"select",
"\\u",
"on",
"\\u",
"querys",
"et",
"\\u",
"with",
"\\u",
"one",
"\\u",
"to",
"\\u",
"one_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"search",
"test\\u",
"ptr",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Sear",
"ch",
"Field_",
"(_",
"'",
"title",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queryset_",
"=_",
"fields_",
"._",
"select",
"\\u",
"on",
"\\u",
"queryset_",
"(_",
"Sear",
"ch",
"Test",
"Child_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"One",
"To",
"One",
"Field",
" ",
"shou",
"ld",
" ",
"be",
" ",
"select",
"\\u",
"related_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"queryset_",
"._",
"\\u",
"prefetch",
"\\u",
"relate",
"d\\u",
"lookups",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"search",
"test\\u",
"ptr",
"'_",
",_",
"queryset_",
"._",
"query_",
"._",
"select",
"\\u",
"related_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"select",
"\\u",
"on",
"\\u",
"querys",
"et",
"\\u",
"with",
"\\u",
"many",
"\\u",
"to",
"\\u",
"many_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"adver",
"ts",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Sear",
"ch",
"Field_",
"(_",
"'",
"title",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queryset_",
"=_",
"fields_",
"._",
"select",
"\\u",
"on",
"\\u",
"queryset_",
"(_",
"Many",
"To",
"Many",
"Blog",
"Page_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Many",
"To",
"Many",
"Field",
" ",
"shou",
"ld",
" ",
"be",
" ",
"prefetch",
"\\u",
"related_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"adver",
"ts",
"'_",
",_",
"queryset_",
"._",
"\\u",
"prefetch",
"\\u",
"relate",
"d\\u",
"lookups",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"queryset_",
"._",
"query_",
"._",
"select",
"\\u",
"related_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"select",
"\\u",
"on",
"\\u",
"querys",
"et",
"\\u",
"with",
"\\u",
"reverse",
"\\u",
"foreign",
"\\u",
"key_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"categor",
"ies",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"category",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Sear",
"ch",
"Field_",
"(_",
"'",
"name",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queryset_",
"=_",
"fields_",
"._",
"select",
"\\u",
"on",
"\\u",
"queryset_",
"(_",
"Many",
"To",
"Many",
"Blog",
"Page_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"reverse",
" ",
"Fore",
"ign",
"Key",
" ",
"shou",
"ld",
" ",
"be",
" ",
"prefetch",
"\\u",
"related_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"categor",
"ies",
"'_",
",_",
"queryset_",
"._",
"\\u",
"prefetch",
"\\u",
"relate",
"d\\u",
"lookups",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"queryset_",
"._",
"query_",
"._",
"select",
"\\u",
"related_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"select",
"\\u",
"on",
"\\u",
"querys",
"et",
"\\u",
"with",
"\\u",
"reverse",
"\\u",
"one",
"\\u",
"to",
"\\u",
"one_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"search",
"testc",
"hild",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Sear",
"ch",
"Field_",
"(_",
"'",
"subtit",
"le",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queryset_",
"=_",
"fields_",
"._",
"select",
"\\u",
"on",
"\\u",
"queryset_",
"(_",
"Sear",
"ch",
"Test_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"reverse",
" ",
"One",
"To",
"One",
"Field",
" ",
"shou",
"ld",
" ",
"be",
" ",
"select",
"\\u",
"related_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"queryset_",
"._",
"\\u",
"prefetch",
"\\u",
"relate",
"d\\u",
"lookups",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"search",
"testc",
"hild",
"'_",
",_",
"queryset_",
"._",
"query_",
"._",
"select",
"\\u",
"related_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"select",
"\\u",
"on",
"\\u",
"querys",
"et",
"\\u",
"with",
"\\u",
"reverse",
"\\u",
"many",
"\\u",
"to",
"\\u",
"many_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"many",
"toma",
"ny",
"blog",
"page",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Sear",
"ch",
"Field_",
"(_",
"'",
"title",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queryset_",
"=_",
"fields_",
"._",
"select",
"\\u",
"on",
"\\u",
"queryset_",
"(_",
"Advert",
"_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"reverse",
" ",
"Many",
"To",
"Many",
"Field",
" ",
"shou",
"ld",
" ",
"be",
" ",
"prefetch",
"\\u",
"related_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"many",
"toma",
"ny",
"blog",
"page",
"'_",
",_",
"queryset_",
"._",
"\\u",
"prefetch",
"\\u",
"relate",
"d\\u",
"lookups",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"queryset_",
"._",
"query_",
"._",
"select",
"\\u",
"related_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Select",
"On",
"Query",
"Set_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"select",
"\\u",
"on",
"\\u",
"querys",
"et",
"\\u",
"with",
"\\u",
"tagg",
"able",
"\\u",
"manager_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"index_",
"._",
"Rela",
"ted",
"Fields_",
"(_",
"'",
"tags",
"'_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"._",
"Sear",
"ch",
"Field_",
"(_",
"'",
"name",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queryset_",
"=_",
"fields_",
"._",
"select",
"\\u",
"on",
"\\u",
"queryset_",
"(_",
"Sear",
"ch",
"Test",
"Child_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ta",
"gs",
" ",
"shou",
"ld",
" ",
"be",
" ",
"prefetch",
"\\u",
"related_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"tags",
"'_",
",_",
"queryset_",
"._",
"\\u",
"prefetch",
"\\u",
"relate",
"d\\u",
"lookups",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"queryset_",
"._",
"query_",
"._",
"select",
"\\u",
"related_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | adieu/django-mediagenerator/mediagenerator/middleware.py | [
{
"content": "from .settings import DEV_MEDIA_URL, MEDIA_DEV_MODE\n# Only load other dependencies if they're needed\nif MEDIA_DEV_MODE:\n from .utils import _refresh_dev_names, _backend_mapping\n from django.http import HttpResponse, Http404\n from django.utils.cache import patch_cache_control\n from django.utils.http import http_date\n import time\n\nTEXT_MIME_TYPES = (\n 'application/x-javascript',\n 'application/xhtml+xml',\n 'application/xml',\n)\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class MediaMiddleware(object):\n \"\"\"\n Middleware for serving and browser-side caching of media files.\n\n This MUST be your *first* entry in MIDDLEWARE_CLASSES. Otherwise, some\n other middleware might add ETags or otherwise manipulate the caching\n headers which would result in the browser doing unnecessary HTTP\n roundtrips for unchanged media.\n \"\"\"\n\n MAX_AGE = 60 * 60 * 24 * 365\n",
"metadata": "root.MediaMiddleware",
"header": "['module', '___EOS___']",
"index": 15
},
{
"content": " def process_request(self, request):\n if not MEDIA_DEV_MODE:\n return\n\n # We refresh the dev names only once for the whole request, so all\n # media_url() calls are cached.\n _refresh_dev_names()\n\n if not request.path.startswith(DEV_MEDIA_URL):\n return\n\n filename = request.path[len(DEV_MEDIA_URL):]\n\n try:\n backend = _backend_mapping[filename]\n except KeyError:\n raise Http404('The mediagenerator could not find the media file \"%s\"'\n % filename)\n content, mimetype = backend.get_dev_output(filename)\n if not mimetype:\n mimetype = 'application/octet-stream'\n if isinstance(content, unicode):\n content = content.encode('utf-8')\n if mimetype.startswith('text/') or mimetype in TEXT_MIME_TYPES:\n mimetype += '; charset=utf-8'\n response = HttpResponse(content, content_type=mimetype)\n response['Content-Length'] = len(content)\n\n # Cache manifest files MUST NEVER be cached or you'll be unable to update\n # your cached app!!!\n if response['Content-Type'] != 'text/cache-manifest' and \\\n response.status_code == 200:\n patch_cache_control(response, public=True, max_age=self.MAX_AGE)\n response['Expires'] = http_date(time.time() + self.MAX_AGE)\n return response",
"metadata": "root.MediaMiddleware.process_request",
"header": "['class', 'MediaMiddleware', '(', 'object', ')', ':', '___EOS___']",
"index": 27
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"._",
"settings_",
"import_",
"DEV",
"\\u",
"MEDIA",
"\\u",
"URL_",
",_",
"MEDIA",
"\\u",
"DEV",
"\\u",
"MODE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"On",
"ly",
" ",
"load",
" ",
"other",
" ",
"dependen",
"cies",
" ",
"if",
" ",
"the",
"y",
"'",
"re",
" ",
"needed_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"MEDIA",
"\\u",
"DEV",
"\\u",
"MODE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"._",
"utils_",
"import_",
"\\u",
"refre",
"sh",
"\\u",
"dev",
"\\u",
"names_",
",_",
"\\u",
"back",
"end",
"\\u",
"mapping_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"http_",
"import_",
"Http",
"Response_",
",_",
"Http404_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"cache_",
"import_",
"patch",
"\\u",
"cache",
"\\u",
"control_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"http_",
"import_",
"http",
"\\u",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"TEXT",
"\\u",
"MIME",
"\\u",
"TYPES_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"applica",
"tion",
"/",
"x",
"-",
"javascript",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"applica",
"tion",
"/",
"xh",
"tml",
"+",
"xml",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"applica",
"tion",
"/",
"xml",
"'_",
",_",
"\\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_",
"Media",
"Middleware_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Mid",
"dle",
"ware",
" ",
"for",
" ",
"serving",
" ",
"and",
" ",
"browse",
"r",
"-",
"side",
" ",
"caching",
" ",
"of",
" ",
"media",
" ",
"files",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"MUS",
"T",
" ",
"be",
" ",
"your",
" ",
"*",
"first",
"*",
" ",
"entry",
" ",
"in",
" ",
"MIDDLE",
"WARE",
"\\u",
"CLASSE",
"S",
".",
" ",
"Ot",
"her",
"wis",
"e",
",",
" ",
"some",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"other",
" ",
"middle",
"ware",
" ",
"mig",
"ht",
" ",
"add",
" ",
"ET",
"ags",
" ",
"or",
" ",
"other",
"wis",
"e",
" ",
"manipulate",
" ",
"the",
" ",
"caching",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"header",
"s",
" ",
"whi",
"ch",
" ",
"wou",
"ld",
" ",
"result",
" ",
"in",
" ",
"the",
" ",
"browse",
"r",
" ",
"doi",
"ng",
" ",
"unne",
"cess",
"ary",
" ",
"HTTP",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"roundtrip",
"s",
" ",
"for",
" ",
"unchanged",
" ",
"media",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"MAX",
"\\u",
"AGE_",
"=_",
"60_",
"*_",
"60_",
"*_",
"24_",
"*_",
"365_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Media",
"Middleware_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"process",
"\\u",
"request_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"MEDIA",
"\\u",
"DEV",
"\\u",
"MODE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"refre",
"sh",
" ",
"the",
" ",
"dev",
" ",
"names",
" ",
"only",
" ",
"onc",
"e",
" ",
"for",
" ",
"the",
" ",
"whole",
" ",
"request",
",",
" ",
"so",
" ",
"all_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"media",
"\\u",
"url",
"()",
" ",
"calls",
" ",
"are",
" ",
"cache",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u",
"refre",
"sh",
"\\u",
"dev",
"\\u",
"names_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"request_",
"._",
"path_",
"._",
"startswith_",
"(_",
"DEV",
"\\u",
"MEDIA",
"\\u",
"URL_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"filename_",
"=_",
"request_",
"._",
"path_",
"[_",
"len_",
"(_",
"DEV",
"\\u",
"MEDIA",
"\\u",
"URL_",
")_",
":_",
"]_",
"\\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 ",
" _",
"backend_",
"=_",
"\\u",
"back",
"end",
"\\u",
"mapping_",
"[_",
"filename_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Http404_",
"(_",
"'",
"The",
" ",
"media",
"generat",
"or",
" ",
"coul",
"d",
" ",
"not",
" ",
"find",
" ",
"the",
" ",
"media",
" ",
"file",
" ",
"\"%",
"s",
"\"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"content_",
",_",
"mimetype_",
"=_",
"backend_",
"._",
"get",
"\\u",
"dev",
"\\u",
"output_",
"(_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"mimetype_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mimetype_",
"=_",
"'",
"applica",
"tion",
"/",
"oct",
"et",
"-",
"stream",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"content_",
",_",
"unicode_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"content_",
"=_",
"content_",
"._",
"encode_",
"(_",
"'",
"utf",
"-",
"8",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"mimetype_",
"._",
"startswith_",
"(_",
"'",
"text",
"/'_",
")_",
"or_",
"mimetype_",
"in_",
"TEXT",
"\\u",
"MIME",
"\\u",
"TYPES_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mimetype_",
"+=_",
"';",
" ",
"charset",
"=",
"utf",
"-",
"8",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"response_",
"=_",
"Http",
"Response_",
"(_",
"content_",
",_",
"content",
"\\u",
"type_",
"=_",
"mimetype_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"[_",
"'",
"Conten",
"t",
"-",
"Length",
"'_",
"]_",
"=_",
"len_",
"(_",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Cache",
" ",
"manifest",
" ",
"files",
" ",
"MUS",
"T",
" ",
"NE",
"VER",
" ",
"be",
" ",
"cache",
"d",
" ",
"or",
" ",
"you",
"'",
"ll",
" ",
"be",
" ",
"una",
"ble",
" ",
"to",
" ",
"update_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"your",
" ",
"cache",
"d",
" ",
"app",
"!!!",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"response_",
"[_",
"'",
"Conten",
"t",
"-",
"Type",
"'_",
"]_",
"!=_",
"'",
"text",
"/",
"cache",
"-",
"manifest",
"'_",
"and_",
"response_",
"._",
"status",
"\\u",
"code_",
"==_",
"200_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"patch",
"\\u",
"cache",
"\\u",
"control_",
"(_",
"response_",
",_",
"public_",
"=_",
"True_",
",_",
"max",
"\\u",
"age_",
"=_",
"self_",
"._",
"MAX",
"\\u",
"AGE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"[_",
"'",
"Expire",
"s",
"'_",
"]_",
"=_",
"http",
"\\u",
"date_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
"+_",
"self_",
"._",
"MAX",
"\\u",
"AGE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"response_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused local variable | keenlabs/KeenClient-Python/keen/client.py | [
{
"content": " def delete_events(self, event_collection, timeframe=None, timezone=None, filters=None):\n \"\"\" Deletes events.\n\n :param event_collection: string, the event collection from which event are being deleted\n :param timeframe: string or dict, the timeframe in which the events happened\n example: \"previous_7_days\"\n :param timezone: int, the timezone you'd like to use for the timeframe\n and interval in seconds\n :param filters: array of dict, contains the filters you'd like to apply to the data\n example: [{\"property_name\":\"device\", \"operator\":\"eq\", \"property_value\":\"iPhone\"}]\n\n \"\"\"\n params = self.get_params(timeframe=timeframe, timezone=timezone, filters=filters)\n return self.api.delete_events(event_collection, params)",
"metadata": "root.KeenClient.delete_events",
"header": "['class', 'KeenClient', '(', 'object', ')', ':', '___EOS___']",
"index": 161
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Ke",
"en",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"delete",
"\\u",
"events_",
"(_",
"self_",
",_",
"event",
"\\u",
"collection_",
",_",
"timeframe",
"_",
"=_",
"None_",
",_",
"timezone_",
"=_",
"None_",
",_",
"filters_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Delete",
"s",
" ",
"events",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"event",
"\\u",
"collection",
":",
" ",
"string",
",",
" ",
"the",
" ",
"event",
" ",
"collection",
" ",
"from",
" ",
"whi",
"ch",
" ",
"event",
" ",
"are",
" ",
"bei",
"ng",
" ",
"delete",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"timeframe",
":",
" ",
"string",
" ",
"or",
" ",
"dict",
",",
" ",
"the",
" ",
"timeframe",
" ",
"in",
" ",
"whi",
"ch",
" ",
"the",
" ",
"events",
" ",
"happ",
"ened",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"example",
":",
" ",
"\"",
"previ",
"ous",
"\\u",
"7",
"\\u",
"day",
"s",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"timezon",
"e",
":",
" ",
"int",
",",
" ",
"the",
" ",
"timezon",
"e",
" ",
"you",
"'",
"d",
" ",
"like",
" ",
"to",
" ",
"use",
" ",
"for",
" ",
"the",
" ",
"timeframe",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"interval",
" ",
"in",
" ",
"second",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"filter",
"s",
":",
" ",
"array",
" ",
"of",
" ",
"dict",
",",
" ",
"contain",
"s",
" ",
"the",
" ",
"filter",
"s",
" ",
"you",
"'",
"d",
" ",
"like",
" ",
"to",
" ",
"appl",
"y",
" ",
"to",
" ",
"the",
" ",
"data",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"example",
":",
" ",
"[{",
"\"",
"property",
"\\u",
"name",
"\":\"",
"device",
"\",",
" ",
"\"",
"opera",
"tor",
"\":\"",
"eq",
"\",",
" ",
"\"",
"property",
"\\u",
"value",
"\":\"",
"i",
"Phone",
"\"}]",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"self_",
"._",
"get",
"\\u",
"params_",
"(_",
"timeframe",
"_",
"=_",
"timeframe",
"_",
",_",
"timezone_",
"=_",
"timezone_",
",_",
"filters_",
"=_",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"api_",
"._",
"delete",
"\\u",
"events_",
"(_",
"event",
"\\u",
"collection_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Imprecise assert | openstack/python-magnumclient/magnumclient/tests/v1/test_replicationcontrollers_shell.py | [
{
"content": " @mock.patch('magnumclient.v1.replicationcontrollers.'\n 'ReplicationControllerManager.get')\n def test_rc_show_success(self, mock_show):\n self._test_arg_success('rc-show xxx --bay zzz')\n self.assertTrue(mock_show.called)\n self.assertEqual(1, mock_show.call_count)",
"metadata": "root.ShellTest.test_rc_show_success",
"header": "['class', 'ShellTest', '(', 'shell_test_base', '.', 'TestCommandLineArgument', ')', ':', '___EOS___']",
"index": 107
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Shel",
"l",
"Test_",
"(_",
"shell",
"\\u",
"test\\u",
"base_",
"._",
"Test",
"Command",
"Line",
"Argument_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"magn",
"um",
"client",
".",
"v1",
".",
"replication",
"controlle",
"rs",
".'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Replica",
"tion",
"Controlle",
"r",
"Manager",
".",
"get",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"rc",
"\\u",
"show",
"\\u",
"success_",
"(_",
"self_",
",_",
"mock",
"\\u",
"show_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"test\\u",
"arg",
"\\u",
"success_",
"(_",
"'",
"rc",
"-",
"show",
" ",
"xxx",
" ",
"--",
"bay",
" ",
"zzz",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"mock",
"\\u",
"show_",
"._",
"called_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"1_",
",_",
"mock",
"\\u",
"show_",
"._",
"call",
"\\u",
"count_",
")_",
"\\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
] |
Variable defined multiple times | python-openxml/python-docx/docx/oxml/simpletypes.py | [
{
"content": "class ST_BrType(XsdString):\n",
"metadata": "root.ST_BrType",
"header": "['module', '___EOS___']",
"index": 199
}
] | [] | [] | 0 | 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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"ST",
"\\u",
"Br",
"Type_",
"(_",
"Xs",
"d",
"String_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | mne-tools/mne-python/mne/io/kit/coreg.py | [
{
"content": "\"\"\"Coordinate Point Extractor for KIT system\"\"\"\n\n# Author: Teon Brooks <[email protected]>\n#\n# License: BSD (3-clause)\n\nfrom os import SEEK_CUR, path as op\nimport re\nfrom struct import unpack\nimport numpy as np\nfrom .constants import KIT\nfrom ..meas_info import _read_dig_points\nfrom ...externals.six.moves import cPickle as pickle\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def read_mrk(fname):\n \"\"\"Marker Point Extraction in MEG space directly from sqd\n\n Parameters\n ----------\n fname : str\n Absolute path to Marker file.\n File formats allowed: \\*.sqd, \\*.mrk, \\*.txt, \\*.pickled.\n\n Returns\n -------\n mrk_points : numpy.array, shape = (n_points, 3)\n Marker points in MEG space [m].\n \"\"\"\n ext = op.splitext(fname)[-1]\n if ext in ('.sqd', '.mrk'):\n with open(fname, 'rb', buffering=0) as fid:\n fid.seek(KIT.MRK_INFO)\n mrk_offset = unpack('i', fid.read(KIT.INT))[0]\n fid.seek(mrk_offset)\n # skips match_done, meg_to_mri and mri_to_meg\n fid.seek(KIT.INT + (2 * KIT.DOUBLE * 4 ** 2), SEEK_CUR)\n mrk_count = unpack('i', fid.read(KIT.INT))[0]\n pts = []\n for _ in range(mrk_count):\n # skips mri/meg mrk_type and done, mri_marker\n fid.seek(KIT.INT * 4 + (KIT.DOUBLE * 3), SEEK_CUR)\n pts.append(np.fromfile(fid, dtype='d', count=3))\n mrk_points = np.array(pts)\n elif ext == '.txt':\n mrk_points = _read_dig_points(fname)\n elif ext == '.pickled':\n with open(fname, 'rb') as fid:\n food = pickle.load(fid)\n try:\n mrk_points = food['mrk']\n except:\n err = (\"%r does not contain marker points.\" % fname)\n raise ValueError(err)\n else:\n err = ('KIT marker file must be *.sqd, *.txt or *.pickled, '\n 'not *%s.' % ext)\n raise ValueError(err)\n\n # check output\n mrk_points = np.asarray(mrk_points)\n if mrk_points.shape != (5, 3):\n err = (\"%r is no marker file, shape is \"\n \"%s\" % (fname, mrk_points.shape))\n raise ValueError(err)\n return mrk_points",
"metadata": "root.read_mrk",
"header": "['module', '___EOS___']",
"index": 15
},
{
"content": "def read_sns(fname):\n \"\"\"Sensor coordinate extraction in MEG space\n\n Parameters\n ----------\n fname : str\n Absolute path to sensor definition file.\n\n Returns\n -------\n locs : numpy.array, shape = (n_points, 3)\n Sensor coil location.\n \"\"\"\n p = re.compile(r'\\d,[A-Za-z]*,([\\.\\-0-9]+),' +\n r'([\\.\\-0-9]+),([\\.\\-0-9]+),' +\n r'([\\.\\-0-9]+),([\\.\\-0-9]+)')\n with open(fname) as fid:\n locs = np.array(p.findall(fid.read()), dtype=float)\n return locs",
"metadata": "root.read_sns",
"header": "['module', '___EOS___']",
"index": 68
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Coordinat",
"e",
" ",
"Point",
" ",
"Extract",
"or",
" ",
"for",
" ",
"KI",
"T",
" ",
"system",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Author",
":",
" ",
"Te",
"on",
" ",
"Bro",
"oks",
" ",
"<",
"te",
"on",
".",
"bro",
"oks",
"@",
"gma",
"il",
".",
"com",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
":",
" ",
"BS",
"D",
" ",
"(",
"3",
"-",
"clause",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"os_",
"import_",
"SEE",
"K",
"\\u",
"CUR",
"_",
",_",
"path_",
"as_",
"op_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"struct_",
"import_",
"unpack_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"constants_",
"import_",
"KI",
"T_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"meas",
"\\u",
"info_",
"import_",
"\\u",
"read",
"\\u",
"dig",
"\\u",
"points_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"..._",
"externals",
"_",
"._",
"six_",
"._",
"moves_",
"import_",
"c",
"Pickle_",
"as_",
"pickle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"read",
"\\u",
"mr",
"k_",
"(_",
"fname_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Mark",
"er",
" ",
"Point",
" ",
"Extraction",
" ",
"in",
" ",
"ME",
"G",
" ",
"space",
" ",
"direct",
"ly",
" ",
"from",
" ",
"sq",
"d",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fname",
" ",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Abs",
"olute",
" ",
"path",
" ",
"to",
" ",
"Mark",
"er",
" ",
"file",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"File",
" ",
"formats",
" ",
"allow",
"ed",
":",
" ",
"\\\\*",
".",
"sq",
"d",
",",
" ",
"\\\\*",
".",
"mr",
"k",
",",
" ",
"\\\\*",
".",
"txt",
",",
" ",
"\\\\*",
".",
"pickled",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mr",
"k",
"\\u",
"points",
" ",
":",
" ",
"nump",
"y",
".",
"array",
",",
" ",
"shape",
" ",
"=",
" ",
"(",
"n",
"\\u",
"points",
",",
" ",
"3",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Mark",
"er",
" ",
"points",
" ",
"in",
" ",
"ME",
"G",
" ",
"space",
" ",
"[",
"m",
"].",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ext_",
"=_",
"op_",
"._",
"splitext_",
"(_",
"fname_",
")_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"ext_",
"in_",
"(_",
"'.",
"sq",
"d",
"'_",
",_",
"'.",
"mr",
"k",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"open_",
"(_",
"fname_",
",_",
"'",
"rb",
"'_",
",_",
"bufferi",
"ng_",
"=_",
"0_",
")_",
"as_",
"fid_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fid_",
"._",
"seek_",
"(_",
"KI",
"T_",
"._",
"MR",
"K",
"\\u",
"INFO_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mr",
"k",
"\\u",
"offset_",
"=_",
"unpack_",
"(_",
"'",
"i",
"'_",
",_",
"fid_",
"._",
"read_",
"(_",
"KI",
"T_",
"._",
"INT_",
")_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fid_",
"._",
"seek_",
"(_",
"mr",
"k",
"\\u",
"offset_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"skips",
" ",
"match",
"\\u",
"don",
"e",
",",
" ",
"me",
"g",
"\\u",
"to",
"\\u",
"mri",
" ",
"and",
" ",
"mri",
"\\u",
"to",
"\\u",
"me",
"g_",
"\\u\\u\\uNL\\u\\u\\u_",
"fid_",
"._",
"seek_",
"(_",
"KI",
"T_",
"._",
"INT_",
"+_",
"(_",
"2_",
"*_",
"KI",
"T_",
"._",
"DOUBLE_",
"*_",
"4_",
"**_",
"2_",
")_",
",_",
"SEE",
"K",
"\\u",
"CUR",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mr",
"k",
"\\u",
"count_",
"=_",
"unpack_",
"(_",
"'",
"i",
"'_",
",_",
"fid_",
"._",
"read_",
"(_",
"KI",
"T_",
"._",
"INT_",
")_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pts_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"\\u_",
"in_",
"range_",
"(_",
"mr",
"k",
"\\u",
"count_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"skips",
" ",
"mri",
"/",
"me",
"g",
" ",
"mr",
"k",
"\\u",
"type",
" ",
"and",
" ",
"don",
"e",
",",
" ",
"mri",
"\\u",
"marker_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fid_",
"._",
"seek_",
"(_",
"KI",
"T_",
"._",
"INT_",
"*_",
"4_",
"+_",
"(_",
"KI",
"T_",
"._",
"DOUBLE_",
"*_",
"3_",
")_",
",_",
"SEE",
"K",
"\\u",
"CUR",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pts_",
"._",
"append_",
"(_",
"np_",
"._",
"fromfile_",
"(_",
"fid_",
",_",
"dtype_",
"=_",
"'",
"d",
"'_",
",_",
"count_",
"=_",
"3_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mr",
"k",
"\\u",
"points_",
"=_",
"np_",
"._",
"array_",
"(_",
"pts_",
")_",
"\\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_",
"ext_",
"==_",
"'.",
"txt",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mr",
"k",
"\\u",
"points_",
"=_",
"\\u",
"read",
"\\u",
"dig",
"\\u",
"points_",
"(_",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"ext_",
"==_",
"'.",
"pickled",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"open_",
"(_",
"fname_",
",_",
"'",
"rb",
"'_",
")_",
"as_",
"fid_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"food_",
"=_",
"pickle_",
"._",
"load_",
"(_",
"fid_",
")_",
"\\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 ",
" _",
"mr",
"k",
"\\u",
"points_",
"=_",
"food_",
"[_",
"'",
"mr",
"k",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"err_",
"=_",
"(_",
"\"%",
"r",
" ",
"doe",
"s",
" ",
"not",
" ",
"contain",
" ",
"marker",
" ",
"points",
".\"_",
"%_",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Value",
"Error_",
"(_",
"err_",
")_",
"\\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 ",
" _",
"err_",
"=_",
"(_",
"'",
"KI",
"T",
" ",
"marker",
" ",
"file",
" ",
"must",
" ",
"be",
" ",
"*.",
"sq",
"d",
",",
" ",
"*.",
"txt",
" ",
"or",
" ",
"*.",
"pickled",
",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"not",
" ",
"*",
"%",
"s",
".'_",
"%_",
"ext_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Value",
"Error_",
"(_",
"err_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"check",
" ",
"output_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"mr",
"k",
"\\u",
"points_",
"=_",
"np_",
"._",
"asarray_",
"(_",
"mr",
"k",
"\\u",
"points_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mr",
"k",
"\\u",
"points_",
"._",
"shape_",
"!=_",
"(_",
"5_",
",_",
"3_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"err_",
"=_",
"(_",
"\"%",
"r",
" ",
"is",
" ",
"no",
" ",
"marker",
" ",
"file",
",",
" ",
"shape",
" ",
"is",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"s",
"\"_",
"%_",
"(_",
"fname_",
",_",
"mr",
"k",
"\\u",
"points_",
"._",
"shape_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Value",
"Error_",
"(_",
"err_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"mr",
"k",
"\\u",
"points_",
"\\u\\u\\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_",
"read",
"\\u",
"sns_",
"(_",
"fname_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Sen",
"sor",
" ",
"coordinate",
" ",
"extracti",
"on",
" ",
"in",
" ",
"ME",
"G",
" ",
"space",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fname",
" ",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Abs",
"olute",
" ",
"path",
" ",
"to",
" ",
"sensor",
" ",
"definit",
"ion",
" ",
"file",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"locs",
" ",
":",
" ",
"nump",
"y",
".",
"array",
",",
" ",
"shape",
" ",
"=",
" ",
"(",
"n",
"\\u",
"points",
",",
" ",
"3",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sen",
"sor",
" ",
"coil",
" ",
"location",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"=_",
"re_",
"._",
"compile_",
"(_",
"r",
"'\\\\",
"d",
",",
"[",
"A",
"-",
"Za",
"-",
"z",
"]*",
",(",
"[\\\\",
".\\\\",
"-0",
"-",
"9",
"]+)",
",'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'([\\",
"\\",
".\\\\",
"-0",
"-",
"9",
"]+)",
",(",
"[\\\\",
".\\\\",
"-0",
"-",
"9",
"]+)",
",'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'([\\",
"\\",
".\\\\",
"-0",
"-",
"9",
"]+)",
",(",
"[\\\\",
".\\\\",
"-0",
"-",
"9",
"]+)'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"fname_",
")_",
"as_",
"fid_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"locs_",
"=_",
"np_",
"._",
"array_",
"(_",
"p_",
"._",
"findall_",
"(_",
"fid_",
"._",
"read_",
"(_",
")_",
")_",
",_",
"dtype_",
"=_",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"locs_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | GreatFruitOmsk/nativeconfig/nativeconfig/config/memory_config.py | [
{
"content": "class MemoryConfig(BaseConfig):\n \"\"\"\n Store config in in-memory dict.\n \"\"\"\n\n #{ BaseConfig\n\n\n\n\n\n\n\n\n #}",
"metadata": "root.MemoryConfig",
"header": "['module', '___EOS___']",
"index": 5
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Memo",
"ry",
"Config_",
"(_",
"Base",
"Config_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Stor",
"e",
" ",
"config",
" ",
"in",
" ",
"in",
"-",
"memory",
" ",
"dict",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#{",
" ",
"Base",
"Config_",
"\\u\\u\\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_"
] | [
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
] |
Except block handles 'BaseException' | chromium/web-page-replay/httpclient.py | [
{
"content": "def _ScrambleImages(response):\n \"\"\"If the |response| is an image, attempt to scramble it.\n\n Copies |response| if it is modified.\n\n Args:\n response: an ArchivedHttpResponse\n Returns:\n an ArchivedHttpResponse\n \"\"\"\n\n assert Image, '--scramble_images requires the PIL module to be installed.'\n\n content_type = response.get_header('content-type')\n if content_type and content_type.startswith('image/'):\n try:\n image_data = response.response_data[0]\n image_data.decode(encoding='base64')\n im = Image.open(StringIO.StringIO(image_data))\n\n pixel_data = list(im.getdata())\n random.shuffle(pixel_data)\n\n scrambled_image = im.copy()\n scrambled_image.putdata(pixel_data)\n\n output_image_io = StringIO.StringIO()\n scrambled_image.save(output_image_io, im.format)\n output_image_data = output_image_io.getvalue()\n output_image_data.encode(encoding='base64')\n\n response = copy.deepcopy(response)\n response.set_data(output_image_data)\n except Exception:\n pass\n\n return response",
"metadata": "root._ScrambleImages",
"header": "['module', '___EOS___']",
"index": 68
}
] | [] | [] | 0 | 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_",
"\\u",
"Scra",
"mble",
"Images_",
"(_",
"response_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"If",
" ",
"the",
" ",
"|",
"response",
"|",
" ",
"is",
" ",
"an",
" ",
"image",
",",
" ",
"atte",
"mpt",
" ",
"to",
" ",
"scra",
"mble",
" ",
"it",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Copie",
"s",
" ",
"|",
"response",
"|",
" ",
"if",
" ",
"it",
" ",
"is",
" ",
"modifi",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"response",
":",
" ",
"an",
" ",
"Archive",
"d",
"Http",
"Respons",
"e",
"\\",
"10",
";",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"an",
" ",
"Archive",
"d",
"Http",
"Respons",
"e",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"Image_",
",_",
"'--",
"scra",
"mble",
"\\u",
"images",
" ",
"require",
"s",
" ",
"the",
" ",
"PI",
"L",
" ",
"module",
" ",
"to",
" ",
"be",
" ",
"install",
"ed",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
"=_",
"response_",
"._",
"get",
"\\u",
"header_",
"(_",
"'",
"content",
"-",
"type",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"content",
"\\u",
"type_",
"and_",
"content",
"\\u",
"type_",
"._",
"startswith_",
"(_",
"'",
"image",
"/'_",
")_",
":_",
"\\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 ",
" _",
"image",
"\\u",
"data_",
"=_",
"response_",
"._",
"response",
"\\u",
"data_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image",
"\\u",
"data_",
"._",
"decode_",
"(_",
"encoding_",
"=_",
"'",
"base64",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im_",
"=_",
"Image_",
"._",
"open_",
"(_",
"String",
"IO_",
"._",
"String",
"IO_",
"(_",
"image",
"\\u",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pixel",
"\\u",
"data_",
"=_",
"list_",
"(_",
"im_",
"._",
"getdata_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"random_",
"._",
"shuffle_",
"(_",
"pixel",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"scra",
"mble",
"d\\u",
"image_",
"=_",
"im_",
"._",
"copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scra",
"mble",
"d\\u",
"image_",
"._",
"put",
"data_",
"(_",
"pixel",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"output",
"\\u",
"image",
"\\u",
"io_",
"=_",
"String",
"IO_",
"._",
"String",
"IO_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scra",
"mble",
"d\\u",
"image_",
"._",
"save_",
"(_",
"output",
"\\u",
"image",
"\\u",
"io_",
",_",
"im_",
"._",
"format_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"output",
"\\u",
"image",
"\\u",
"data_",
"=_",
"output",
"\\u",
"image",
"\\u",
"io_",
"._",
"getvalue_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"output",
"\\u",
"image",
"\\u",
"data_",
"._",
"encode_",
"(_",
"encoding_",
"=_",
"'",
"base64",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"copy_",
"._",
"deepcopy_",
"(_",
"response_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"._",
"set\\u",
"data_",
"(_",
"output",
"\\u",
"image",
"\\u",
"data_",
")_",
"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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unnecessary pass | infincia/AEServmon/libcloud/drivers/gogrid.py | [
{
"content": " def get_state(self, element):\n try:\n for stanza in element.findall(\"object/attribute\"):\n if stanza.get('name') == \"name\":\n return STATE[stanza.get('name')]\n except:\n pass\n return NodeState.UNKNOWN",
"metadata": "root.GoGridNodeDriver.get_state",
"header": "['class', 'GoGridNodeDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 111
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"pass_",
"[SEP]_",
"class_",
"Go",
"Grid",
"Node",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"state_",
"(_",
"self_",
",_",
"element_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"stanza_",
"in_",
"element_",
"._",
"findall_",
"(_",
"\"",
"object",
"/",
"attribute",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"stanza_",
"._",
"get_",
"(_",
"'",
"name",
"'_",
")_",
"==_",
"\"",
"name",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"STATE_",
"[_",
"stanza_",
"._",
"get_",
"(_",
"'",
"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_",
":_",
"\\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_",
"Node",
"State_",
"._",
"UNKNOWN_",
"\\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
] |
Unused import | nitely/Spirit/spirit/topic/unread/migrations/0002_auto_20150828_2003.py | [
{
"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('spirit_topic_unread', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='topicunread',\n name='user',\n field=models.ForeignKey(related_name='st_topics_unread', to=settings.AUTH_USER_MODEL),\n ),\n ]",
"metadata": "root.Migration",
"header": "['module', '___EOS___']",
"index": 7
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
",_",
"migrations_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Migration_",
"(_",
"migrations_",
"._",
"Migration_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dependencies_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"spir",
"it",
"\\u",
"topic",
"\\u",
"unread",
"'_",
",_",
"'",
"0001",
"\\u",
"initial",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"operations_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"migrations_",
"._",
"Alter",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"model",
"\\u",
"name_",
"=_",
"'",
"topic",
"unread",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"user",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
"=_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"relate",
"d\\u",
"name_",
"=_",
"'",
"st",
"\\u",
"topic",
"s",
"\\u",
"unread",
"'_",
",_",
"to_",
"=_",
"settings_",
"._",
"AUTH",
"\\u",
"USER",
"\\u",
"MODEL_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | davemerwin/blue-channel/external_apps/registration/models.py | [
{
"content": "import datetime\nimport random\nimport re\nimport sha\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.template.loader import render_to_string\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.auth.models import User\nfrom django.contrib.sites.models import Site\n\n\nSHA1_RE = re.compile('^[a-f0-9]{40}$')\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class RegistrationManager(models.Manager):\n \"\"\"\n Custom manager for the ``RegistrationProfile`` model.\n \n The methods defined here provide shortcuts for account creation\n and activation (including generation and emailing of activation\n keys), and for cleaning out expired inactive accounts.\n \n \"\"\"\n \n \n ",
"metadata": "root.RegistrationManager",
"header": "['module', '___EOS___']",
"index": 16
},
{
"content": " def activate_user(self, activation_key):\n \"\"\"\n Validate an activation key and activate the corresponding\n ``User`` if valid.\n \n If the key is valid and has not expired, return the ``User``\n after activating.\n \n If the key is not valid or has expired, return ``False``.\n \n If the key is valid but the ``User`` is already active,\n return ``False``.\n \n To prevent reactivation of an account which has been\n deactivated by site administrators, the activation key is\n reset to the string ``ALREADY_ACTIVATED`` after successful\n activation.\n \n \"\"\"\n # Make sure the key we're trying conforms to the pattern of a\n # SHA1 hash; if it doesn't, no point trying to look it up in\n # the database.\n if SHA1_RE.search(activation_key):\n try:\n profile = self.get(activation_key=activation_key)\n except self.model.DoesNotExist:\n return False\n if not profile.activation_key_expired():\n user = profile.user\n user.is_active = True\n user.save()\n profile.activation_key = \"ALREADY_ACTIVATED\"\n profile.save()\n return user\n return False",
"metadata": "root.RegistrationManager.activate_user",
"header": "['class', 'RegistrationManager', '(', 'models', '.', 'Manager', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def create_inactive_user(self, username, password, email,\n send_email=True, profile_callback=None):\n \"\"\"\n Create a new, inactive ``User``, generates a\n ``RegistrationProfile`` and email its activation key to the\n ``User``, returning the new ``User``.\n \n To disable the email, call with ``send_email=False``.\n \n To enable creation of a custom user profile along with the\n ``User`` (e.g., the model specified in the\n ``AUTH_PROFILE_MODULE`` setting), define a function which\n knows how to create and save an instance of that model with\n appropriate default values, and pass it as the keyword\n argument ``profile_callback``. This function should accept one\n keyword argument:\n\n ``user``\n The ``User`` to relate the profile to.\n \n \"\"\"\n new_user = User.objects.create_user(username, email, password)\n new_user.is_active = False\n new_user.save()\n \n registration_profile = self.create_profile(new_user)\n \n if profile_callback is not None:\n profile_callback(user=new_user)\n \n if send_email:\n from django.core.mail import send_mail\n current_site = Site.objects.get_current()\n \n subject = render_to_string('registration/activation_email_subject.txt',\n { 'site': current_site })\n # Email subject *must not* contain newlines\n subject = ''.join(subject.splitlines())\n \n message = render_to_string('registration/activation_email.txt',\n { 'activation_key': registration_profile.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'site': current_site })\n \n send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [new_user.email])\n return new_user",
"metadata": "root.RegistrationManager.create_inactive_user",
"header": "['class', 'RegistrationManager', '(', 'models', '.', 'Manager', ')', ':', '___EOS___']",
"index": 61
},
{
"content": " def create_profile(self, user):\n \"\"\"\n Create a ``RegistrationProfile`` for a given\n ``User``, and return the ``RegistrationProfile``.\n \n The activation key for the ``RegistrationProfile`` will be a\n SHA1 hash, generated from a combination of the ``User``'s\n username and a random salt.\n \n \"\"\"\n salt = sha.new(str(random.random())).hexdigest()[:5]\n activation_key = sha.new(salt+user.username).hexdigest()\n return self.create(user=user,\n activation_key=activation_key)",
"metadata": "root.RegistrationManager.create_profile",
"header": "['class', 'RegistrationManager', '(', 'models', '.', 'Manager', ')', ':', '___EOS___']",
"index": 108
},
{
"content": " def delete_expired_users(self):\n \"\"\"\n Remove expired instances of ``RegistrationProfile`` and their\n associated ``User``s.\n \n Accounts to be deleted are identified by searching for\n instances of ``RegistrationProfile`` with expired activation\n keys, and then checking to see if their associated ``User``\n instances have the field ``is_active`` set to ``False``; any\n ``User`` who is both inactive and has an expired activation\n key will be deleted.\n \n It is recommended that this method be executed regularly as\n part of your routine site maintenance; this application\n provides a custom management command which will call this\n method, accessible as ``manage.py cleanupregistration``.\n \n Regularly clearing out accounts which have never been\n activated serves two useful purposes:\n \n 1. It alleviates the ocasional need to reset a\n ``RegistrationProfile`` and/or re-send an activation email\n when a user does not receive or does not act upon the\n initial activation email; since the account will be\n deleted, the user will be able to simply re-register and\n receive a new activation key.\n \n 2. It prevents the possibility of a malicious user registering\n one or more accounts and never activating them (thus\n denying the use of those usernames to anyone else); since\n those accounts will be deleted, the usernames will become\n available for use again.\n \n If you have a troublesome ``User`` and wish to disable their\n account while keeping it in the database, simply delete the\n associated ``RegistrationProfile``; an inactive ``User`` which\n does not have an associated ``RegistrationProfile`` will not\n be deleted.\n \n \"\"\"\n for profile in self.all():\n if profile.activation_key_expired():\n user = profile.user\n if not user.is_active:\n user.delete()",
"metadata": "root.RegistrationManager.delete_expired_users",
"header": "['class', 'RegistrationManager', '(', 'models', '.', 'Manager', ')', ':', '___EOS___']",
"index": 123
},
{
"content": "class RegistrationProfile(models.Model):\n \"\"\"\n A simple profile which stores an activation key for use during\n user account registration.\n \n Generally, you will not want to interact directly with instances\n of this model; the provided manager includes methods\n for creating and activating new accounts, as well as for cleaning\n out accounts which have never been activated.\n \n While it is possible to use this model as the value of the\n ``AUTH_PROFILE_MODULE`` setting, it's not recommended that you do\n so. This model's sole purpose is to store data temporarily during\n account registration and activation, and a mechanism for\n automatically creating an instance of a site-specific profile\n model is provided via the ``create_inactive_user`` on\n ``RegistrationManager``.\n \n \"\"\"\n user = models.ForeignKey(User, unique=True, verbose_name=_('user'))\n activation_key = models.CharField(_('activation key'), max_length=40)\n \n objects = RegistrationManager()\n \n class Meta:\n verbose_name = _('registration profile')\n verbose_name_plural = _('registration profiles')\n \n \n activation_key_expired.boolean = True",
"metadata": "root.RegistrationProfile",
"header": "['module', '___EOS___']",
"index": 170
},
{
"content": " def __unicode__(self):\n return u\"Registration information for %s\" % self.user",
"metadata": "root.RegistrationProfile.__unicode__",
"header": "['class', 'RegistrationProfile', '(', 'models', '.', 'Model', ')', ':', '___EOS___']",
"index": 198
},
{
"content": " def activation_key_expired(self):\n \"\"\"\n Determine whether this ``RegistrationProfile``'s activation\n key has expired, returning a boolean -- ``True`` if the key\n has expired.\n \n Key expiration is determined by a two-step process:\n \n 1. If the user has already activated, the key will have been\n reset to the string ``ALREADY_ACTIVATED``. Re-activating is\n not permitted, and so this method returns ``True`` in this\n case.\n\n 2. Otherwise, the date the user signed up is incremented by\n the number of days specified in the setting\n ``ACCOUNT_ACTIVATION_DAYS`` (which should be the number of\n days after signup during which a user is allowed to\n activate their account); if the result is less than or\n equal to the current date, the key has expired and this\n method returns ``True``.\n \n \"\"\"\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == \"ALREADY_ACTIVATED\" or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"metadata": "root.RegistrationProfile.activation_key_expired",
"header": "['class', 'RegistrationProfile', '(', 'models', '.', 'Model', ')', ':', '___EOS___']",
"index": 201
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"random_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sha_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"template_",
"._",
"loader_",
"import_",
"render",
"\\u",
"to",
"\\u",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"translation_",
"import_",
"uge",
"ttext",
"\\u",
"lazy_",
"as_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"._",
"auth_",
"._",
"models_",
"import_",
"User_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"._",
"sites_",
"._",
"models_",
"import_",
"Site_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"SHA",
"1",
"\\u",
"RE_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'",
"^",
"[",
"a",
"-",
"f0",
"-",
"9",
"]{",
"40",
"}$'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Registration",
"Manager_",
"(_",
"models_",
"._",
"Manager_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Custom",
" ",
"manage",
"r",
" ",
"for",
" ",
"the",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"model",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"method",
"s",
" ",
"defin",
"ed",
" ",
"here",
" ",
"provide",
" ",
"shortcut",
"s",
" ",
"for",
" ",
"account",
" ",
"creati",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"activation",
" ",
"(",
"inclu",
"ding",
" ",
"generat",
"ion",
" ",
"and",
" ",
"email",
"ing",
" ",
"of",
" ",
"activation",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"keys",
"),",
" ",
"and",
" ",
"for",
" ",
"clean",
"ing",
" ",
"out",
" ",
"expir",
"ed",
" ",
"inact",
"ive",
" ",
"account",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Registration",
"Manager_",
"(_",
"models_",
"._",
"Manager_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"activat",
"e\\u",
"user_",
"(_",
"self_",
",_",
"activation",
"\\u",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Validate",
" ",
"an",
" ",
"activation",
" ",
"key",
" ",
"and",
" ",
"activat",
"e",
" ",
"the",
" ",
"correspond",
"ing",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"User",
"``",
" ",
"if",
" ",
"valid",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"key",
" ",
"is",
" ",
"valid",
" ",
"and",
" ",
"has",
" ",
"not",
" ",
"expir",
"ed",
",",
" ",
"return",
" ",
"the",
" ",
"``",
"User",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"after",
" ",
"activat",
"ing",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"key",
" ",
"is",
" ",
"not",
" ",
"valid",
" ",
"or",
" ",
"has",
" ",
"expir",
"ed",
",",
" ",
"return",
" ",
"``",
"Fal",
"se",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"key",
" ",
"is",
" ",
"valid",
" ",
"but",
" ",
"the",
" ",
"``",
"User",
"``",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"active",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"return",
" ",
"``",
"Fal",
"se",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"To",
" ",
"prevent",
" ",
"reacti",
"vati",
"on",
" ",
"of",
" ",
"an",
" ",
"account",
" ",
"whi",
"ch",
" ",
"has",
" ",
"bee",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"deactivate",
"d",
" ",
"by",
" ",
"site",
" ",
"administrat",
"ors",
",",
" ",
"the",
" ",
"activation",
" ",
"key",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reset",
" ",
"to",
" ",
"the",
" ",
"string",
" ",
"``",
"ALREADY",
"\\u",
"ACTIVAT",
"ED",
"``",
" ",
"after",
" ",
"success",
"ful",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"activation",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"the",
" ",
"key",
" ",
"we",
"'",
"re",
" ",
"try",
"ing",
" ",
"conform",
"s",
" ",
"to",
" ",
"the",
" ",
"pattern",
" ",
"of",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"SHA",
"1",
" ",
"hash",
";",
" ",
"if",
" ",
"it",
" ",
"doe",
"sn",
"'",
"t",
",",
" ",
"no",
" ",
"point",
" ",
"try",
"ing",
" ",
"to",
" ",
"look",
" ",
"it",
" ",
"up",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"databa",
"se",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"SHA",
"1",
"\\u",
"RE_",
"._",
"search_",
"(_",
"activation",
"\\u",
"key_",
")_",
":_",
"\\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 ",
" _",
"profile_",
"=_",
"self_",
"._",
"get_",
"(_",
"activation",
"\\u",
"key_",
"=_",
"activation",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"self_",
"._",
"model_",
"._",
"Do",
"es",
"Not",
"Exist_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"profile_",
"._",
"activation",
"\\u",
"key",
"\\u",
"expired_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"profile_",
"._",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user_",
"._",
"is",
"\\u",
"active_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"profile_",
"._",
"activation",
"\\u",
"key_",
"=_",
"\"",
"ALREADY",
"\\u",
"ACTIVAT",
"ED",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"profile_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Registration",
"Manager_",
"(_",
"models_",
"._",
"Manager_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"create",
"\\u",
"inact",
"ive",
"\\u",
"user_",
"(_",
"self_",
",_",
"username_",
",_",
"password_",
",_",
"email_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"email_",
"=_",
"True_",
",_",
"profile",
"\\u",
"callback_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"e",
" ",
"a",
" ",
"new",
",",
" ",
"inact",
"ive",
" ",
"``",
"User",
"``",
",",
" ",
"generat",
"es",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"and",
" ",
"email",
" ",
"its",
" ",
"activation",
" ",
"key",
" ",
"to",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"User",
"``",
",",
" ",
"return",
"ing",
" ",
"the",
" ",
"new",
" ",
"``",
"User",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"To",
" ",
"disable",
" ",
"the",
" ",
"email",
",",
" ",
"call",
" ",
"with",
" ",
"``",
"send",
"\\u",
"email",
"=",
"Fal",
"se",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"To",
" ",
"enable",
" ",
"creati",
"on",
" ",
"of",
" ",
"a",
" ",
"custom",
" ",
"user",
" ",
"profile",
" ",
"along",
" ",
"with",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"User",
"``",
" ",
"(",
"e",
".",
"g",
".,",
" ",
"the",
" ",
"model",
" ",
"specified",
" ",
"in",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"AUTH",
"\\u",
"PROFILE",
"\\u",
"MODUL",
"E",
"``",
" ",
"setti",
"ng",
"),",
" ",
"defin",
"e",
" ",
"a",
" ",
"function",
" ",
"whi",
"ch",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"knows",
" ",
"how",
" ",
"to",
" ",
"create",
" ",
"and",
" ",
"save",
" ",
"an",
" ",
"instance",
" ",
"of",
" ",
"tha",
"t",
" ",
"model",
" ",
"with",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"appropr",
"iate",
" ",
"default",
" ",
"values",
",",
" ",
"and",
" ",
"pass",
" ",
"it",
" ",
"as",
" ",
"the",
" ",
"keyw",
"ord",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"argu",
"ment",
" ",
"``",
"profile",
"\\u",
"callback",
"``.",
" ",
"Thi",
"s",
" ",
"function",
" ",
"shou",
"ld",
" ",
"accept",
" ",
"one",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"keyw",
"ord",
" ",
"argu",
"ment",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"user",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"``",
"User",
"``",
" ",
"to",
" ",
"relate",
" ",
"the",
" ",
"profile",
" ",
"to",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"user_",
"=_",
"User_",
"._",
"objects_",
"._",
"create",
"\\u",
"user_",
"(_",
"username_",
",_",
"email_",
",_",
"password_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"user_",
"._",
"is",
"\\u",
"active_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"registration",
"\\u",
"profile_",
"=_",
"self_",
"._",
"create",
"\\u",
"profile_",
"(_",
"new",
"\\u",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"profile",
"\\u",
"callback_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"profile",
"\\u",
"callback_",
"(_",
"user_",
"=_",
"new",
"\\u",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"send",
"\\u",
"email_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"core_",
"._",
"mail_",
"import_",
"send",
"\\u",
"mail_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"current",
"\\u",
"site_",
"=_",
"Site_",
"._",
"objects_",
"._",
"get",
"\\u",
"current_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"subject_",
"=_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"'",
"registration",
"/",
"activation",
"\\u",
"email",
"\\u",
"subject",
".",
"txt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"site",
"'_",
":_",
"current",
"\\u",
"site_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Ema",
"il",
" ",
"subject",
" ",
"*",
"must",
" ",
"not",
"*",
" ",
"contain",
" ",
"newlines_",
"\\u\\u\\uNL\\u\\u\\u_",
"subject_",
"=_",
"''_",
"._",
"join_",
"(_",
"subject_",
"._",
"splitlines_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"message_",
"=_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"'",
"registration",
"/",
"activation",
"\\u",
"email",
".",
"txt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"activation",
"\\u",
"key",
"'_",
":_",
"registration",
"\\u",
"profile_",
"._",
"activation",
"\\u",
"key_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"expir",
"ation",
"\\u",
"day",
"s",
"'_",
":_",
"settings_",
"._",
"ACCOUNT",
"\\u",
"ACTIVAT",
"ION",
"\\u",
"DAYS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"site",
"'_",
":_",
"current",
"\\u",
"site_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"mail_",
"(_",
"subject_",
",_",
"message_",
",_",
"settings_",
"._",
"DEF",
"AUL",
"T",
"\\u",
"FROM",
"\\u",
"EMAIL_",
",_",
"[_",
"new",
"\\u",
"user_",
"._",
"email_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"new",
"\\u",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Registration",
"Manager_",
"(_",
"models_",
"._",
"Manager_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"create",
"\\u",
"profile_",
"(_",
"self_",
",_",
"user_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"e",
" ",
"a",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"for",
" ",
"a",
" ",
"give",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"User",
"``",
",",
" ",
"and",
" ",
"return",
" ",
"the",
" ",
"``",
"Registration",
"Profil",
"e",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"activation",
" ",
"key",
" ",
"for",
" ",
"the",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"will",
" ",
"be",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"SHA",
"1",
" ",
"hash",
",",
" ",
"generat",
"ed",
" ",
"from",
" ",
"a",
" ",
"combinat",
"ion",
" ",
"of",
" ",
"the",
" ",
"``",
"User",
"``",
"'",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"user",
"name",
" ",
"and",
" ",
"a",
" ",
"random",
" ",
"salt",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"salt_",
"=_",
"sha_",
"._",
"new_",
"(_",
"str_",
"(_",
"random_",
"._",
"random_",
"(_",
")_",
")_",
")_",
"._",
"hexdigest_",
"(_",
")_",
"[_",
":_",
"5_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"activation",
"\\u",
"key_",
"=_",
"sha_",
"._",
"new_",
"(_",
"salt_",
"+_",
"user_",
"._",
"username_",
")_",
"._",
"hexdigest_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"create_",
"(_",
"user_",
"=_",
"user_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"activation",
"\\u",
"key_",
"=_",
"activation",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Registration",
"Manager_",
"(_",
"models_",
"._",
"Manager_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"delete",
"\\u",
"expir",
"ed",
"\\u",
"users_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Remove",
" ",
"expir",
"ed",
" ",
"instance",
"s",
" ",
"of",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"and",
" ",
"thei",
"r",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"associate",
"d",
" ",
"``",
"User",
"``",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Account",
"s",
" ",
"to",
" ",
"be",
" ",
"delete",
"d",
" ",
"are",
" ",
"identifi",
"ed",
" ",
"by",
" ",
"search",
"ing",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"instance",
"s",
" ",
"of",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"with",
" ",
"expir",
"ed",
" ",
"activation",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"keys",
",",
" ",
"and",
" ",
"then",
" ",
"checking",
" ",
"to",
" ",
"see",
" ",
"if",
" ",
"thei",
"r",
" ",
"associate",
"d",
" ",
"``",
"User",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"instance",
"s",
" ",
"have",
" ",
"the",
" ",
"field",
" ",
"``",
"is",
"\\u",
"active",
"``",
" ",
"set",
" ",
"to",
" ",
"``",
"Fal",
"se",
"``",
";",
" ",
"any",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"User",
"``",
" ",
"who",
" ",
"is",
" ",
"bot",
"h",
" ",
"inact",
"ive",
" ",
"and",
" ",
"has",
" ",
"an",
" ",
"expir",
"ed",
" ",
"activation",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"key",
" ",
"will",
" ",
"be",
" ",
"delete",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"It",
" ",
"is",
" ",
"recommende",
"d",
" ",
"tha",
"t",
" ",
"this",
" ",
"method",
" ",
"be",
" ",
"executed",
" ",
"regular",
"ly",
" ",
"as",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"part",
" ",
"of",
" ",
"your",
" ",
"routin",
"e",
" ",
"site",
" ",
"maintenance",
";",
" ",
"this",
" ",
"applica",
"tion",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"provide",
"s",
" ",
"a",
" ",
"custom",
" ",
"manage",
"ment",
" ",
"command",
" ",
"whi",
"ch",
" ",
"will",
" ",
"call",
" ",
"this",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
",",
" ",
"accessible",
" ",
"as",
" ",
"``",
"manage",
".",
"py",
" ",
"clean",
"upr",
"egistr",
"ation",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Regula",
"rl",
"y",
" ",
"clear",
"ing",
" ",
"out",
" ",
"account",
"s",
" ",
"whi",
"ch",
" ",
"have",
" ",
"neve",
"r",
" ",
"bee",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"activat",
"ed",
" ",
"serve",
"s",
" ",
"two",
" ",
"usef",
"ul",
" ",
"purpose",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"1",
".",
" ",
"It",
" ",
"alle",
"via",
"tes",
" ",
"the",
" ",
"oca",
"sion",
"al",
" ",
"need",
" ",
"to",
" ",
"reset",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"and",
"/",
"or",
" ",
"re",
"-",
"send",
" ",
"an",
" ",
"activation",
" ",
"email",
"\\",
"10",
";",
" ",
" ",
" ",
"whe",
"n",
" ",
"a",
" ",
"user",
" ",
"doe",
"s",
" ",
"not",
" ",
"receive",
" ",
"or",
" ",
"doe",
"s",
" ",
"not",
" ",
"act",
" ",
"upo",
"n",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
"initial",
" ",
"activation",
" ",
"email",
";",
" ",
"sinc",
"e",
" ",
"the",
" ",
"account",
" ",
"will",
" ",
"be",
"\\",
"10",
";",
" ",
" ",
" ",
"delete",
"d",
",",
" ",
"the",
" ",
"user",
" ",
"will",
" ",
"be",
" ",
"able",
" ",
"to",
" ",
"simp",
"ly",
" ",
"re",
"-",
"register",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
"receive",
" ",
"a",
" ",
"new",
" ",
"activation",
" ",
"key",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"2",
".",
" ",
"It",
" ",
"prevent",
"s",
" ",
"the",
" ",
"possibilit",
"y",
" ",
"of",
" ",
"a",
" ",
"mali",
"cio",
"us",
" ",
"user",
" ",
"register",
"ing",
"\\",
"10",
";",
" ",
" ",
" ",
"one",
" ",
"or",
" ",
"more",
" ",
"account",
"s",
" ",
"and",
" ",
"neve",
"r",
" ",
"activat",
"ing",
" ",
"them",
" ",
"(",
"thu",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
"deny",
"ing",
" ",
"the",
" ",
"use",
" ",
"of",
" ",
"tho",
"se",
" ",
"usernames",
" ",
"to",
" ",
"any",
"one",
" ",
"else",
");",
" ",
"sinc",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
"tho",
"se",
" ",
"account",
"s",
" ",
"will",
" ",
"be",
" ",
"delete",
"d",
",",
" ",
"the",
" ",
"usernames",
" ",
"will",
" ",
"bec",
"ome",
"\\",
"10",
";",
" ",
" ",
" ",
"avail",
"able",
" ",
"for",
" ",
"use",
" ",
"again",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"you",
" ",
"have",
" ",
"a",
" ",
"trouble",
"some",
" ",
"``",
"User",
"``",
" ",
"and",
" ",
"wish",
" ",
"to",
" ",
"disable",
" ",
"thei",
"r",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"account",
" ",
"whi",
"le",
" ",
"keep",
"ing",
" ",
"it",
" ",
"in",
" ",
"the",
" ",
"databa",
"se",
",",
" ",
"simp",
"ly",
" ",
"delete",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"associate",
"d",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
";",
" ",
"an",
" ",
"inact",
"ive",
" ",
"``",
"User",
"``",
" ",
"whi",
"ch",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"doe",
"s",
" ",
"not",
" ",
"have",
" ",
"an",
" ",
"associate",
"d",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
" ",
"will",
" ",
"not",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"be",
" ",
"delete",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"profile_",
"in_",
"self_",
"._",
"all_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"profile_",
"._",
"activation",
"\\u",
"key",
"\\u",
"expired_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"profile_",
"._",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"user_",
"._",
"is",
"\\u",
"active_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"user_",
"._",
"delete_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Registration",
"Profile_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"simple",
" ",
"profile",
" ",
"whi",
"ch",
" ",
"store",
"s",
" ",
"an",
" ",
"activation",
" ",
"key",
" ",
"for",
" ",
"use",
" ",
"dur",
"ing",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"user",
" ",
"account",
" ",
"registration",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"General",
"ly",
",",
" ",
"you",
" ",
"will",
" ",
"not",
" ",
"want",
" ",
"to",
" ",
"interact",
" ",
"direct",
"ly",
" ",
"with",
" ",
"instance",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"of",
" ",
"this",
" ",
"model",
";",
" ",
"the",
" ",
"provided",
" ",
"manage",
"r",
" ",
"include",
"s",
" ",
"method",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"for",
" ",
"creati",
"ng",
" ",
"and",
" ",
"activat",
"ing",
" ",
"new",
" ",
"account",
"s",
",",
" ",
"as",
" ",
"well",
" ",
"as",
" ",
"for",
" ",
"clean",
"ing",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"out",
" ",
"account",
"s",
" ",
"whi",
"ch",
" ",
"have",
" ",
"neve",
"r",
" ",
"bee",
"n",
" ",
"activat",
"ed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whi",
"le",
" ",
"it",
" ",
"is",
" ",
"possib",
"le",
" ",
"to",
" ",
"use",
" ",
"this",
" ",
"model",
" ",
"as",
" ",
"the",
" ",
"value",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"AUTH",
"\\u",
"PROFILE",
"\\u",
"MODUL",
"E",
"``",
" ",
"setti",
"ng",
",",
" ",
"it",
"'",
"s",
" ",
"not",
" ",
"recommende",
"d",
" ",
"tha",
"t",
" ",
"you",
" ",
"do",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"so",
".",
" ",
"Thi",
"s",
" ",
"model",
"'",
"s",
" ",
"sole",
" ",
"purpose",
" ",
"is",
" ",
"to",
" ",
"store",
" ",
"data",
" ",
"temporar",
"il",
"y",
" ",
"dur",
"ing",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"account",
" ",
"registration",
" ",
"and",
" ",
"activation",
",",
" ",
"and",
" ",
"a",
" ",
"mechanism",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"automati",
"call",
"y",
" ",
"creati",
"ng",
" ",
"an",
" ",
"instance",
" ",
"of",
" ",
"a",
" ",
"site",
"-",
"specific",
" ",
"profile",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"model",
" ",
"is",
" ",
"provided",
" ",
"via",
" ",
"the",
" ",
"``",
"create",
"\\u",
"inact",
"ive",
"\\u",
"user",
"``",
" ",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"Registration",
"Manager",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user_",
"=_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"User_",
",_",
"unique_",
"=_",
"True_",
",_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"\\u_",
"(_",
"'",
"user",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"activation",
"\\u",
"key_",
"=_",
"models_",
"._",
"Char",
"Field_",
"(_",
"\\u_",
"(_",
"'",
"activation",
" ",
"key",
"'_",
")_",
",_",
"max",
"\\u",
"length_",
"=_",
"40_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"objects_",
"=_",
"Registration",
"Manager_",
"(_",
")_",
"\\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_",
"(_",
"'",
"registration",
" ",
"profile",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"verbo",
"se",
"\\u",
"name",
"\\u",
"plural_",
"=_",
"\\u_",
"(_",
"'",
"registration",
" ",
"profile",
"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_",
"activation",
"\\u",
"key",
"\\u",
"expired_",
"._",
"boolean_",
"=_",
"True_",
"[SEP]_",
"class_",
"Registration",
"Profile_",
"(_",
"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_",
"u",
"\"",
"Registration",
" ",
"informati",
"on",
" ",
"for",
" ",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Registration",
"Profile_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"activation",
"\\u",
"key",
"\\u",
"expired_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Det",
"erm",
"ine",
" ",
"whe",
"ther",
" ",
"this",
" ",
"``",
"Registration",
"Profil",
"e",
"``",
"'",
"s",
" ",
"activation",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"key",
" ",
"has",
" ",
"expir",
"ed",
",",
" ",
"return",
"ing",
" ",
"a",
" ",
"boolean",
" ",
"--",
" ",
"``",
"Tru",
"e",
"``",
" ",
"if",
" ",
"the",
" ",
"key",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"has",
" ",
"expir",
"ed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Key",
" ",
"expir",
"ation",
" ",
"is",
" ",
"dete",
"rmin",
"ed",
" ",
"by",
" ",
"a",
" ",
"two",
"-",
"step",
" ",
"process",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"1",
".",
" ",
"If",
" ",
"the",
" ",
"user",
" ",
"has",
" ",
"alr",
"ead",
"y",
" ",
"activat",
"ed",
",",
" ",
"the",
" ",
"key",
" ",
"will",
" ",
"have",
" ",
"bee",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
"reset",
" ",
"to",
" ",
"the",
" ",
"string",
" ",
"``",
"ALREADY",
"\\u",
"ACTIVAT",
"ED",
"``.",
" ",
"Re",
"-",
"activat",
"ing",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
"not",
" ",
"permit",
"ted",
",",
" ",
"and",
" ",
"so",
" ",
"this",
" ",
"method",
" ",
"return",
"s",
" ",
"``",
"Tru",
"e",
"``",
" ",
"in",
" ",
"this",
"\\",
"10",
";",
" ",
" ",
" ",
"case",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"2",
".",
" ",
"Ot",
"her",
"wis",
"e",
",",
" ",
"the",
" ",
"date",
" ",
"the",
" ",
"user",
" ",
"sign",
"ed",
" ",
"up",
" ",
"is",
" ",
"increment",
"ed",
" ",
"by",
"\\",
"10",
";",
" ",
" ",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"day",
"s",
" ",
"specified",
" ",
"in",
" ",
"the",
" ",
"setti",
"ng",
"\\",
"10",
";",
" ",
" ",
" ",
"``",
"ACCOUNT",
"\\u",
"ACTIVAT",
"ION",
"\\u",
"DAY",
"S",
"``",
" ",
"(",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"be",
" ",
"the",
" ",
"number",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
"day",
"s",
" ",
"after",
" ",
"signup",
" ",
"dur",
"ing",
" ",
"whi",
"ch",
" ",
"a",
" ",
"user",
" ",
"is",
" ",
"allow",
"ed",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
"activat",
"e",
" ",
"thei",
"r",
" ",
"account",
");",
" ",
"if",
" ",
"the",
" ",
"result",
" ",
"is",
" ",
"less",
" ",
"than",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
"equal",
" ",
"to",
" ",
"the",
" ",
"current",
" ",
"date",
",",
" ",
"the",
" ",
"key",
" ",
"has",
" ",
"expir",
"ed",
" ",
"and",
" ",
"this",
"\\",
"10",
";",
" ",
" ",
" ",
"method",
" ",
"return",
"s",
" ",
"``",
"Tru",
"e",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expir",
"ation",
"\\u",
"date_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"settings_",
"._",
"ACCOUNT",
"\\u",
"ACTIVAT",
"ION",
"\\u",
"DAYS_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"activation",
"\\u",
"key_",
"==_",
"\"",
"ALREADY",
"\\u",
"ACTIVAT",
"ED",
"\"_",
"or_",
"(_",
"self_",
"._",
"user_",
"._",
"date",
"\\u",
"joined_",
"+_",
"expir",
"ation",
"\\u",
"date_",
"<=_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
")_",
"\\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,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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Missing call to `__init__` during object initialization | saltstack/salt/tests/unit/states/network_test.py | [
{
"content": "@skipIf(sys.version_info < (2, 7), 'This needs to be refactored to work with Python 2.6')\n@skipIf(NO_MOCK, NO_MOCK_REASON)\nclass NetworkTestCase(TestCase):\n '''\n Validate the network state\n '''\n\n",
"metadata": "root.NetworkTestCase",
"header": "['module', '___EOS___']",
"index": 60
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Missing",
"_",
"call_",
"to_",
" _",
"`_",
"\\u\\u",
"init\\u\\u_",
"`_",
"dur",
"ing_",
"object_",
"initialization",
"_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"skip",
"If_",
"(_",
"sys_",
"._",
"version",
"\\u",
"info_",
"<_",
"(_",
"2_",
",_",
"7_",
")_",
",_",
"'",
"Thi",
"s",
" ",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"refactor",
"ed",
" ",
"to",
" ",
"work",
" ",
"with",
" ",
"Pyth",
"on",
" ",
"2.6",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"skip",
"If_",
"(_",
"NO",
"\\u",
"MOC",
"K_",
",_",
"NO",
"\\u",
"MOC",
"K",
"\\u",
"REASON",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"class_",
"Network",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Validate",
" ",
"the",
" ",
"network",
" ",
"state",
"\\",
"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_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | kuri65536/python-for-android/python-modules/twisted/twisted/mail/mail.py | [
{
"content": " def getPOP3Factory(self):\n return protocols.POP3Factory(self)",
"metadata": "root.MailService.getPOP3Factory",
"header": "['class', 'MailService', '(', 'service', '.', 'MultiService', ')', ':', '___EOS___']",
"index": 250
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Mail",
"Service_",
"(_",
"service_",
"._",
"Multi",
"Service_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"POP",
"3",
"Factory_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"protocols_",
"._",
"POP",
"3",
"Factory_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | kevin1024/vcrpy/vcr/cassette.py | [
{
"content": " def _load(self):\n try:\n requests, responses = load_cassette(\n self._path,\n serializer=self._serializer\n )\n for request, response in zip(requests, responses):\n self.append(request, response)\n self.dirty = False\n self.rewound = True\n except IOError:\n pass",
"metadata": "root.Cassette._load",
"header": "['class', 'Cassette', '(', 'object', ')', ':', '___EOS___']",
"index": 280
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Cass",
"ette",
"_",
"(_",
"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",
"load_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"requests_",
",_",
"responses_",
"=_",
"load",
"\\u",
"cassette",
"_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"path_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"serializer_",
"=_",
"self_",
"._",
"\\u",
"serializer_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"request_",
",_",
"response_",
"in_",
"zip_",
"(_",
"requests_",
",_",
"responses_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"append_",
"(_",
"request_",
",_",
"response_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"dirty_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"rew",
"ound_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"IO",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Wrong number of arguments in a call | graphite-project/carbon/lib/carbon/conf.py | [
{
"content": " def postOptions(self):\n global settings\n\n program = self.parent.subCommand\n\n # Use provided pidfile (if any) as default for configuration. If it's\n # set to 'twistd.pid', that means no value was provided and the default\n # was used.\n pidfile = self.parent[\"pidfile\"]\n if pidfile.endswith(\"twistd.pid\"):\n pidfile = None\n self[\"pidfile\"] = pidfile\n\n # Enforce a default umask of '022' if none was set.\n if not self.parent.has_key(\"umask\") or self.parent[\"umask\"] is None:\n self.parent[\"umask\"] = 022\n\n # Read extra settings from the configuration file.\n program_settings = read_config(program, self)\n settings.update(program_settings)\n settings[\"program\"] = program\n\n # Normalize and expand paths\n settings[\"STORAGE_DIR\"] = os.path.normpath(os.path.expanduser(settings[\"STORAGE_DIR\"]))\n settings[\"LOCAL_DATA_DIR\"] = os.path.normpath(os.path.expanduser(settings[\"LOCAL_DATA_DIR\"]))\n settings[\"WHITELISTS_DIR\"] = os.path.normpath(os.path.expanduser(settings[\"WHITELISTS_DIR\"]))\n settings[\"PID_DIR\"] = os.path.normpath(os.path.expanduser(settings[\"PID_DIR\"]))\n settings[\"LOG_DIR\"] = os.path.normpath(os.path.expanduser(settings[\"LOG_DIR\"]))\n settings[\"pidfile\"] = os.path.normpath(os.path.expanduser(settings[\"pidfile\"]))\n\n # Set process uid/gid by changing the parent config, if a user was\n # provided in the configuration file.\n if settings.USER:\n self.parent[\"uid\"], self.parent[\"gid\"] = (\n pwd.getpwnam(settings.USER)[2:4])\n\n # Set the pidfile in parent config to the value that was computed by\n # C{read_config}.\n self.parent[\"pidfile\"] = settings[\"pidfile\"]\n\n storage_schemas = join(settings[\"CONF_DIR\"], \"storage-schemas.conf\")\n if not exists(storage_schemas):\n print \"Error: missing required config %s\" % storage_schemas\n sys.exit(1)\n\n # Database-specific settings\n database = settings.DATABASE\n if database not in TimeSeriesDatabase.plugins:\n print \"No database plugin implemented for '%s'\" % database\n raise SystemExit(1)\n\n database_class = TimeSeriesDatabase.plugins[database]\n state.database = database_class(settings)\n\n settings.CACHE_SIZE_LOW_WATERMARK = settings.MAX_CACHE_SIZE * 0.95\n\n if not \"action\" in self:\n self[\"action\"] = \"start\"\n self.handleAction()\n\n # If we are not running in debug mode or non-daemon mode, then log to a\n # directory, otherwise log output will go to stdout. If parent options\n # are set to log to syslog, then use that instead.\n if not self[\"debug\"]:\n if self.parent.get(\"syslog\", None):\n log.logToSyslog(self.parent[\"prefix\"])\n elif not self.parent[\"nodaemon\"]:\n logdir = settings.LOG_DIR\n if not isdir(logdir):\n os.makedirs(logdir)\n if settings.USER:\n # We have not yet switched to the specified user,\n # but that user must be able to create files in this\n # directory.\n os.chown(logdir, self.parent[\"uid\"], self.parent[\"gid\"])\n log.logToDir(logdir)\n\n if self[\"whitelist\"] is None:\n self[\"whitelist\"] = join(settings[\"CONF_DIR\"], \"whitelist.conf\")\n settings[\"whitelist\"] = self[\"whitelist\"]\n\n if self[\"blacklist\"] is None:\n self[\"blacklist\"] = join(settings[\"CONF_DIR\"], \"blacklist.conf\")\n settings[\"blacklist\"] = self[\"blacklist\"]",
"metadata": "root.CarbonCacheOptions.postOptions",
"header": "['class', 'CarbonCacheOptions', '(', 'usage', '.', 'Options', ')', ':', '___EOS___']",
"index": 197
},
{
"content": "def read_config(program, options, **kwargs):\n \"\"\"\n Read settings for 'program' from configuration file specified by\n 'options[\"config\"]', with missing values provided by 'defaults'.\n \"\"\"\n settings = Settings()\n settings.update(defaults)\n\n # Initialize default values if not set yet.\n for name, value in kwargs.items():\n settings.setdefault(name, value)\n\n graphite_root = kwargs.get(\"ROOT_DIR\")\n if graphite_root is None:\n graphite_root = os.environ.get('GRAPHITE_ROOT')\n if graphite_root is None:\n raise CarbonConfigException(\"Either ROOT_DIR or GRAPHITE_ROOT \"\n \"needs to be provided.\")\n\n # Default config directory to root-relative, unless overriden by the\n # 'GRAPHITE_CONF_DIR' environment variable.\n settings.setdefault(\"CONF_DIR\",\n os.environ.get(\"GRAPHITE_CONF_DIR\",\n join(graphite_root, \"conf\")))\n if options[\"config\"] is None:\n options[\"config\"] = join(settings[\"CONF_DIR\"], \"carbon.conf\")\n else:\n # Set 'CONF_DIR' to the parent directory of the 'carbon.conf' config\n # file.\n settings[\"CONF_DIR\"] = dirname(normpath(options[\"config\"]))\n\n # Storage directory can be overriden by the 'GRAPHITE_STORAGE_DIR'\n # environment variable. It defaults to a path relative to GRAPHITE_ROOT\n # for backwards compatibility though.\n settings.setdefault(\"STORAGE_DIR\",\n os.environ.get(\"GRAPHITE_STORAGE_DIR\",\n join(graphite_root, \"storage\")))\n\n # By default, everything is written to subdirectories of the storage dir.\n settings.setdefault(\n \"PID_DIR\", settings[\"STORAGE_DIR\"])\n settings.setdefault(\n \"LOG_DIR\", join(settings[\"STORAGE_DIR\"], \"log\", program))\n settings.setdefault(\n \"LOCAL_DATA_DIR\", join(settings[\"STORAGE_DIR\"], \"whisper\"))\n settings.setdefault(\n \"WHITELISTS_DIR\", join(settings[\"STORAGE_DIR\"], \"lists\"))\n\n # Read configuration options from program-specific section.\n section = program[len(\"carbon-\"):]\n config = options[\"config\"]\n\n if not exists(config):\n raise CarbonConfigException(\"Error: missing required config %r\" % config)\n\n settings.readFrom(config, section)\n settings.setdefault(\"instance\", options[\"instance\"])\n\n # If a specific instance of the program is specified, augment the settings\n # with the instance-specific settings and provide sane defaults for\n # optional settings.\n if options[\"instance\"]:\n settings.readFrom(config,\n \"%s:%s\" % (section, options[\"instance\"]))\n settings[\"pidfile\"] = (\n options[\"pidfile\"] or\n join(settings[\"PID_DIR\"], \"%s-%s.pid\" %\n (program, options[\"instance\"])))\n settings[\"LOG_DIR\"] = (options[\"logdir\"] or\n join(settings[\"LOG_DIR\"],\n \"%s-%s\" % (program ,options[\"instance\"])))\n else:\n settings[\"pidfile\"] = (\n options[\"pidfile\"] or\n join(settings[\"PID_DIR\"], '%s.pid' % program))\n settings[\"LOG_DIR\"] = (options[\"logdir\"] or settings[\"LOG_DIR\"])\n\n return settings",
"metadata": "root.read_config",
"header": "['module', '___EOS___']",
"index": 511
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Wro",
"ng_",
"number_",
"of_",
"arguments_",
"in_",
"a_",
"call_",
"[SEP]_",
"class_",
"Car",
"bon",
"Cache",
"Options_",
"(_",
"usage_",
"._",
"Options_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"post",
"Options_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"program_",
"=_",
"self_",
"._",
"parent_",
"._",
"sub",
"Command_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Us",
"e",
" ",
"provided",
" ",
"pid",
"file",
" ",
"(",
"if",
" ",
"any",
")",
" ",
"as",
" ",
"default",
" ",
"for",
" ",
"configura",
"tion",
".",
" ",
"If",
" ",
"it",
"'",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"set",
" ",
"to",
" ",
"'",
"twist",
"d",
".",
"pid",
"',",
" ",
"tha",
"t",
" ",
"means",
" ",
"no",
" ",
"value",
" ",
"was",
" ",
"provided",
" ",
"and",
" ",
"the",
" ",
"default_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"was",
" ",
"used",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"pidfile_",
"=_",
"self_",
"._",
"parent_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"pidfile_",
"._",
"endswith_",
"(_",
"\"",
"twist",
"d",
".",
"pid",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pidfile_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"=_",
"pidfile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Enf",
"orce",
" ",
"a",
" ",
"default",
" ",
"umask",
" ",
"of",
" ",
"'",
"022",
"'",
" ",
"if",
" ",
"none",
" ",
"was",
" ",
"set",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"parent_",
"._",
"has",
"\\u",
"key_",
"(_",
"\"",
"umask",
"\"_",
")_",
"or_",
"self_",
"._",
"parent_",
"[_",
"\"",
"umask",
"\"_",
"]_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"parent_",
"[_",
"\"",
"umask",
"\"_",
"]_",
"=_",
"0_",
"22_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Read",
" ",
"extra",
" ",
"settings",
" ",
"from",
" ",
"the",
" ",
"configura",
"tion",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"program",
"\\u",
"settings_",
"=_",
"read",
"\\u",
"config_",
"(_",
"program_",
",_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"._",
"update_",
"(_",
"program",
"\\u",
"settings_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"program",
"\"_",
"]_",
"=_",
"program_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Normalize",
" ",
"and",
" ",
"expand",
" ",
"paths_",
"\\u\\u\\uNL\\u\\u\\u_",
"settings_",
"[_",
"\"",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"settings_",
"[_",
"\"",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"LOCAL",
"\\u",
"DATA",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"settings_",
"[_",
"\"",
"LOCAL",
"\\u",
"DATA",
"\\u",
"DIR",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"WHITE",
"LIST",
"S",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"settings_",
"[_",
"\"",
"WHITE",
"LIST",
"S",
"\\u",
"DIR",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"PID",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"settings_",
"[_",
"\"",
"PID",
"\\u",
"DIR",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"LOG",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"settings_",
"[_",
"\"",
"LOG",
"\\u",
"DIR",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"=_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"settings_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"process",
" ",
"uid",
"/",
"gid",
" ",
"by",
" ",
"chang",
"ing",
" ",
"the",
" ",
"parent",
" ",
"config",
",",
" ",
"if",
" ",
"a",
" ",
"user",
" ",
"was",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"provided",
" ",
"in",
" ",
"the",
" ",
"configura",
"tion",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"settings_",
"._",
"USER_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"parent_",
"[_",
"\"",
"uid",
"\"_",
"]_",
",_",
"self_",
"._",
"parent_",
"[_",
"\"",
"gid",
"\"_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"pwd_",
"._",
"getpw",
"nam_",
"(_",
"settings_",
"._",
"USER_",
")_",
"[_",
"2_",
":_",
"4_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"the",
" ",
"pid",
"file",
" ",
"in",
" ",
"parent",
" ",
"config",
" ",
"to",
" ",
"the",
" ",
"value",
" ",
"tha",
"t",
" ",
"was",
" ",
"compute",
"d",
" ",
"by_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"C",
"{",
"read",
"\\u",
"config",
"}.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"parent_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"=_",
"settings_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"storage",
"\\u",
"schemas_",
"=_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"CONF",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"",
"storage",
"-",
"schema",
"s",
".",
"conf",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"exists_",
"(_",
"storage",
"\\u",
"schemas_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"Error",
":",
" ",
"missi",
"ng",
" ",
"require",
"d",
" ",
"config",
" ",
"%",
"s",
"\"_",
"%_",
"storage",
"\\u",
"schemas_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Databa",
"se",
"-",
"specific",
" ",
"settings_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"database_",
"=_",
"settings_",
"._",
"DATABASE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"database_",
"not_",
"in_",
"Time",
"Serie",
"s",
"Database_",
"._",
"plugins_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"No",
" ",
"databa",
"se",
" ",
"plugin",
" ",
"implemented",
" ",
"for",
" ",
"'%",
"s",
"'\"_",
"%_",
"database_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"System",
"Exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"databa",
"se",
"\\u",
"class_",
"=_",
"Time",
"Serie",
"s",
"Database_",
"._",
"plugins_",
"[_",
"database_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"state_",
"._",
"database_",
"=_",
"databa",
"se",
"\\u",
"class_",
"(_",
"settings_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"settings_",
"._",
"CACHE",
"\\u",
"SIZE",
"\\u",
"LOW",
"\\u",
"WAT",
"ERM",
"AR",
"K_",
"=_",
"settings_",
"._",
"MAX",
"\\u",
"CACHE",
"\\u",
"SIZE_",
"*_",
"0.95_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"\"",
"action",
"\"_",
"in_",
"self_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"\"",
"action",
"\"_",
"]_",
"=_",
"\"",
"start",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"handle",
"Action_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"we",
" ",
"are",
" ",
"not",
" ",
"runn",
"ing",
" ",
"in",
" ",
"debug",
" ",
"mode",
" ",
"or",
" ",
"non",
"-",
"daemon",
" ",
"mode",
",",
" ",
"then",
" ",
"log",
" ",
"to",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"director",
"y",
",",
" ",
"other",
"wis",
"e",
" ",
"log",
" ",
"output",
" ",
"will",
" ",
"go",
" ",
"to",
" ",
"stdout",
".",
" ",
"If",
" ",
"parent",
" ",
"options_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"are",
" ",
"set",
" ",
"to",
" ",
"log",
" ",
"to",
" ",
"syslo",
"g",
",",
" ",
"then",
" ",
"use",
" ",
"tha",
"t",
" ",
"inst",
"ead",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"self_",
"[_",
"\"",
"debug",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"parent_",
"._",
"get_",
"(_",
"\"",
"syslo",
"g",
"\"_",
",_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"log",
"To",
"Sys",
"log_",
"(_",
"self_",
"._",
"parent_",
"[_",
"\"",
"prefix",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"not_",
"self_",
"._",
"parent_",
"[_",
"\"",
"nod",
"ae",
"mon",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logdir_",
"=_",
"settings_",
"._",
"LOG",
"\\u",
"DIR_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"isdir_",
"(_",
"logdir_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"os_",
"._",
"makedirs_",
"(_",
"logdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"settings_",
"._",
"USER_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"We",
" ",
"have",
" ",
"not",
" ",
"ye",
"t",
" ",
"switche",
"d",
" ",
"to",
" ",
"the",
" ",
"specified",
" ",
"user",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"but",
" ",
"tha",
"t",
" ",
"user",
" ",
"must",
" ",
"be",
" ",
"able",
" ",
"to",
" ",
"create",
" ",
"files",
" ",
"in",
" ",
"this_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"os_",
"._",
"chown",
"_",
"(_",
"logdir_",
",_",
"self_",
"._",
"parent_",
"[_",
"\"",
"uid",
"\"_",
"]_",
",_",
"self_",
"._",
"parent_",
"[_",
"\"",
"gid",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"log_",
"._",
"log",
"To",
"Dir_",
"(_",
"logdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"[_",
"\"",
"whitelist",
"\"_",
"]_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"\"",
"whitelist",
"\"_",
"]_",
"=_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"CONF",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"",
"whitelist",
".",
"conf",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"settings_",
"[_",
"\"",
"whitelist",
"\"_",
"]_",
"=_",
"self_",
"[_",
"\"",
"whitelist",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"[_",
"\"",
"blacklist",
"\"_",
"]_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"\"",
"blacklist",
"\"_",
"]_",
"=_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"CONF",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"",
"blacklist",
".",
"conf",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"settings_",
"[_",
"\"",
"blacklist",
"\"_",
"]_",
"=_",
"self_",
"[_",
"\"",
"blacklist",
"\"_",
"]_",
"\\u\\u\\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_",
"read",
"\\u",
"config_",
"(_",
"program_",
",_",
"options_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Read",
" ",
"settings",
" ",
"for",
" ",
"'",
"program",
"'",
" ",
"from",
" ",
"configura",
"tion",
" ",
"file",
" ",
"specified",
" ",
"by",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"options",
"[\"",
"config",
"\"]",
"',",
" ",
"with",
" ",
"missi",
"ng",
" ",
"values",
" ",
"provided",
" ",
"by",
" ",
"'",
"default",
"s",
"'.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"=_",
"Settings_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"._",
"update_",
"(_",
"defaults_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Initializ",
"e",
" ",
"default",
" ",
"values",
" ",
"if",
" ",
"not",
" ",
"set",
" ",
"ye",
"t",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"name_",
",_",
"value_",
"in_",
"kwargs_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"settings_",
"._",
"setdefault_",
"(_",
"name_",
",_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"graphite",
"\\u",
"root_",
"=_",
"kwargs_",
"._",
"get_",
"(_",
"\"",
"ROO",
"T",
"\\u",
"DIR",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"graphite",
"\\u",
"root_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"graphite",
"\\u",
"root_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"GRAPHI",
"TE",
"\\u",
"ROO",
"T",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"graphite",
"\\u",
"root_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Car",
"bon",
"Config",
"Exception_",
"(_",
"\"",
"Ei",
"ther",
" ",
"ROO",
"T",
"\\u",
"DIR",
" ",
"or",
" ",
"GRAPHI",
"TE",
"\\u",
"ROO",
"T",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"provided",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Default",
" ",
"config",
" ",
"director",
"y",
" ",
"to",
" ",
"root",
"-",
"relative",
",",
" ",
"unl",
"ess",
" ",
"override",
"n",
" ",
"by",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"'",
"GRAPHI",
"TE",
"\\u",
"CONF",
"\\u",
"DIR",
"'",
" ",
"environ",
"ment",
" ",
"variab",
"le",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"settings_",
"._",
"setdefault_",
"(_",
"\"",
"CONF",
"\\u",
"DIR",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"\"",
"GRAPHI",
"TE",
"\\u",
"CONF",
"\\u",
"DIR",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"join_",
"(_",
"graphite",
"\\u",
"root_",
",_",
"\"",
"conf",
"\"_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"options_",
"[_",
"\"",
"config",
"\"_",
"]_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"options_",
"[_",
"\"",
"config",
"\"_",
"]_",
"=_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"CONF",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"",
"carbon",
".",
"conf",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"'",
"CONF",
"\\u",
"DIR",
"'",
" ",
"to",
" ",
"the",
" ",
"parent",
" ",
"director",
"y",
" ",
"of",
" ",
"the",
" ",
"'",
"carbon",
".",
"conf",
"'",
" ",
"config_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"settings_",
"[_",
"\"",
"CONF",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"dirname_",
"(_",
"normpath_",
"(_",
"options_",
"[_",
"\"",
"config",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Stor",
"age",
" ",
"director",
"y",
" ",
"can",
" ",
"be",
" ",
"override",
"n",
" ",
"by",
" ",
"the",
" ",
"'",
"GRAPHI",
"TE",
"\\u",
"STOR",
"AGE",
"\\u",
"DIR",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"environ",
"ment",
" ",
"variab",
"le",
".",
" ",
"It",
" ",
"default",
"s",
" ",
"to",
" ",
"a",
" ",
"path",
" ",
"relative",
" ",
"to",
" ",
"GRAPHI",
"TE",
"\\u",
"ROOT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"back",
"ward",
"s",
" ",
"compatibility",
" ",
"tho",
"ugh",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"settings_",
"._",
"setdefault_",
"(_",
"\"",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"\"",
"GRAPHI",
"TE",
"\\u",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"join_",
"(_",
"graphite",
"\\u",
"root_",
",_",
"\"",
"storage",
"\"_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"By",
" ",
"default",
",",
" ",
"every",
"thing",
" ",
"is",
" ",
"writt",
"en",
" ",
"to",
" ",
"subdir",
"ector",
"ies",
" ",
"of",
" ",
"the",
" ",
"storage",
" ",
"dir",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"settings_",
"._",
"setdefault_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"PID",
"\\u",
"DIR",
"\"_",
",_",
"settings_",
"[_",
"\"",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"._",
"setdefault_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"LOG",
"\\u",
"DIR",
"\"_",
",_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"",
"log",
"\"_",
",_",
"program_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"._",
"setdefault_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"LOCAL",
"\\u",
"DATA",
"\\u",
"DIR",
"\"_",
",_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"",
"whis",
"per",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"._",
"setdefault_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"WHITE",
"LIST",
"S",
"\\u",
"DIR",
"\"_",
",_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"STOR",
"AGE",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"",
"lists",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Read",
" ",
"configura",
"tion",
" ",
"options",
" ",
"from",
" ",
"program",
"-",
"specific",
" ",
"section",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"section_",
"=_",
"program_",
"[_",
"len_",
"(_",
"\"",
"carbon",
"-\"_",
")_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"config_",
"=_",
"options_",
"[_",
"\"",
"config",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"exists_",
"(_",
"config_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Car",
"bon",
"Config",
"Exception_",
"(_",
"\"",
"Error",
":",
" ",
"missi",
"ng",
" ",
"require",
"d",
" ",
"config",
" ",
"%",
"r",
"\"_",
"%_",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"settings_",
"._",
"read",
"From_",
"(_",
"config_",
",_",
"section_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"._",
"setdefault_",
"(_",
"\"",
"instance",
"\"_",
",_",
"options_",
"[_",
"\"",
"instance",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"a",
" ",
"specific",
" ",
"instance",
" ",
"of",
" ",
"the",
" ",
"program",
" ",
"is",
" ",
"specified",
",",
" ",
"augment",
" ",
"the",
" ",
"settings_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"with",
" ",
"the",
" ",
"instance",
"-",
"specific",
" ",
"settings",
" ",
"and",
" ",
"provide",
" ",
"sane",
" ",
"default",
"s",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"option",
"al",
" ",
"settings",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"options_",
"[_",
"\"",
"instance",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"settings_",
"._",
"read",
"From_",
"(_",
"config_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"s",
":",
"%",
"s",
"\"_",
"%_",
"(_",
"section_",
",_",
"options_",
"[_",
"\"",
"instance",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"PID",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\"%",
"s",
"-%",
"s",
".",
"pid",
"\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"program_",
",_",
"options_",
"[_",
"\"",
"instance",
"\"_",
"]_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"LOG",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"(_",
"options_",
"[_",
"\"",
"logdi",
"r",
"\"_",
"]_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"LOG",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"s",
"-%",
"s",
"\"_",
"%_",
"(_",
"program_",
",_",
"options_",
"[_",
"\"",
"instance",
"\"_",
"]_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"settings_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"[_",
"\"",
"pid",
"file",
"\"_",
"]_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"join_",
"(_",
"settings_",
"[_",
"\"",
"PID",
"\\u",
"DIR",
"\"_",
"]_",
",_",
"'%",
"s",
".",
"pid",
"'_",
"%_",
"program_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"settings_",
"[_",
"\"",
"LOG",
"\\u",
"DIR",
"\"_",
"]_",
"=_",
"(_",
"options_",
"[_",
"\"",
"logdi",
"r",
"\"_",
"]_",
"or_",
"settings_",
"[_",
"\"",
"LOG",
"\\u",
"DIR",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"settings_"
] | [
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,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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Comparison of constants | XiaoMi/minos/supervisor/supervisor/supervisorctl.py | [
{
"content": " def do_fg(self,args=None):\n if not self.ctl.upcheck():\n return\n if not args:\n self.ctl.output('Error: no process name supplied')\n self.help_fg()\n return\n args = args.split()\n if len(args) > 1:\n self.ctl.output('Error: too many process names supplied')\n return\n program = args[0]\n supervisor = self.ctl.get_supervisor()\n try:\n info = supervisor.getProcessInfo(program)\n except xmlrpclib.Fault, msg:\n if msg.faultCode == xmlrpc.Faults.BAD_NAME:\n self.ctl.output('Error: bad process name supplied')\n return\n # for any other fault\n self.ctl.output(str(msg))\n return\n if not info['state'] == states.ProcessStates.RUNNING:\n self.ctl.output('Error: process not running')\n return\n # everything good; continue\n try:\n a = fgthread(program,self.ctl)\n # this thread takes care of\n # the output/error messages\n a.start()\n while True:\n # this takes care of the user input\n inp = raw_input() + '\\n'\n try:\n supervisor.sendProcessStdin(program, inp)\n except xmlrpclib.Fault, msg:\n if msg.faultCode == xmlrpc.Faults.NOT_RUNNING:\n self.ctl.output('Process got killed')\n self.ctl.output('Exiting foreground')\n a.kill()\n return\n info = supervisor.getProcessInfo(program)\n if not info['state'] == states.ProcessStates.RUNNING:\n self.ctl.output('Process got killed')\n self.ctl.output('Exiting foreground')\n a.kill()\n return\n continue\n except (KeyboardInterrupt, EOFError):\n a.kill()\n self.ctl.output('Exiting foreground')\n return",
"metadata": "root.DefaultControllerPlugin.do_fg",
"header": "['class', 'DefaultControllerPlugin', '(', 'ControllerPluginBase', ')', ':', '___EOS___']",
"index": 1051
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"class_",
"Default",
"Controlle",
"r",
"Plugin_",
"(_",
"Controlle",
"r",
"Plug",
"in",
"Base_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"do",
"\\u",
"fg_",
"(_",
"self_",
",_",
"args_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"ctl_",
"._",
"upc",
"heck_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Error",
":",
" ",
"no",
" ",
"process",
" ",
"name",
" ",
"supplie",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"help",
"\\u",
"fg_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"args_",
"=_",
"args_",
"._",
"split_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"args_",
")_",
">_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Error",
":",
" ",
"too",
" ",
"many",
" ",
"process",
" ",
"names",
" ",
"supplie",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"program_",
"=_",
"args_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"supervisor",
"_",
"=_",
"self_",
"._",
"ctl_",
"._",
"get",
"\\u",
"supervisor",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"info_",
"=_",
"supervisor",
"_",
"._",
"get",
"Process",
"Info_",
"(_",
"program_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"xmlrpclib_",
"._",
"Fault_",
",_",
"msg_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"msg_",
"._",
"fault",
"Code_",
"==_",
"xmlrpc",
"_",
"._",
"Fau",
"lts",
"_",
"._",
"BAD",
"\\u",
"NAME_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Error",
":",
" ",
"bad",
" ",
"process",
" ",
"name",
" ",
"supplie",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"for",
" ",
"any",
" ",
"other",
" ",
"fault_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"str_",
"(_",
"msg_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"info_",
"[_",
"'",
"state",
"'_",
"]_",
"==_",
"states_",
"._",
"Process",
"States_",
"._",
"RUNNING_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Error",
":",
" ",
"process",
" ",
"not",
" ",
"runn",
"ing",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"every",
"thing",
" ",
"good",
";",
" ",
"continue_",
"\\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 ",
" _",
"a_",
"=_",
"fg",
"thread_",
"(_",
"program_",
",_",
"self_",
"._",
"ctl_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"this",
" ",
"thread",
" ",
"take",
"s",
" ",
"care",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"output",
"/",
"error",
" ",
"messages_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"this",
" ",
"take",
"s",
" ",
"care",
" ",
"of",
" ",
"the",
" ",
"user",
" ",
"input_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"inp_",
"=_",
"raw",
"\\u",
"input_",
"(_",
")_",
"+_",
"'\\\\",
"n",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"supervisor",
"_",
"._",
"send",
"Process",
"Std",
"in_",
"(_",
"program_",
",_",
"inp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"xmlrpclib_",
"._",
"Fault_",
",_",
"msg_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"msg_",
"._",
"fault",
"Code_",
"==_",
"xmlrpc",
"_",
"._",
"Fau",
"lts",
"_",
"._",
"NOT",
"\\u",
"RUNNING_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Process",
" ",
"got",
" ",
"kille",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Exi",
"ting",
" ",
"fore",
"ground",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"a_",
"._",
"kill_",
"(_",
")_",
"\\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_",
"info_",
"=_",
"supervisor",
"_",
"._",
"get",
"Process",
"Info_",
"(_",
"program_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"info_",
"[_",
"'",
"state",
"'_",
"]_",
"==_",
"states_",
"._",
"Process",
"States_",
"._",
"RUNNING_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Process",
" ",
"got",
" ",
"kille",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Exi",
"ting",
" ",
"fore",
"ground",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"a_",
"._",
"kill_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"Key",
"board",
"Interrupt_",
",_",
"EO",
"FE",
"rror_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"a_",
"._",
"kill_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ctl_",
"._",
"output_",
"(_",
"'",
"Exi",
"ting",
" ",
"fore",
"ground",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Except block handles 'BaseException' | elastic/curator/curator/actions.py | [
{
"content": " def do_action(self):\n \"\"\"\n Run the API call `update_aliases` with the results of `body()`\n \"\"\"\n self.loggit.info('Updating aliases...')\n try:\n self.client.indices.update_aliases(body=self.body())\n except Exception as e:\n report_failure(e)",
"metadata": "root.Alias.do_action",
"header": "['class', 'Alias', '(', 'object', ')', ':', '___EOS___']",
"index": 103
},
{
"content": " def do_action(self):\n \"\"\"\n Close open indices in `index_list.indices`\n \"\"\"\n self.index_list.filter_closed()\n self.index_list.empty_list_check()\n self.loggit.info('Closing selected indices')\n try:\n index_lists = chunk_index_list(self.index_list.indices)\n for l in index_lists:\n # Do sync_flush from SyncFlush object after it's built?\n self.client.indices.flush(\n index=to_csv(l), ignore_unavailable=True)\n self.client.indices.close(\n index=to_csv(l), ignore_unavailable=True)\n except Exception as e:\n report_failure(e)",
"metadata": "root.Close.do_action",
"header": "['class', 'Close', '(', 'object', ')', ':', '___EOS___']",
"index": 202
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Alias_",
"(_",
"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_",
"do",
"\\u",
"action_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Run",
" ",
"the",
" ",
"API",
" ",
"call",
" ",
"`",
"update",
"\\u",
"alias",
"es",
"`",
" ",
"with",
" ",
"the",
" ",
"results",
" ",
"of",
" ",
"`",
"body",
"()`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logg",
"it_",
"._",
"info_",
"(_",
"'",
"Up",
"dati",
"ng",
" ",
"alias",
"es",
"...'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"client_",
"._",
"indices_",
"._",
"update",
"\\u",
"aliases_",
"(_",
"body_",
"=_",
"self_",
"._",
"body_",
"(_",
")_",
")_",
"\\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 ",
" _",
"report",
"\\u",
"failure_",
"(_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Close_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"do",
"\\u",
"action_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Clos",
"e",
" ",
"open",
" ",
"indice",
"s",
" ",
"in",
" ",
"`",
"index",
"\\u",
"list",
".",
"indice",
"s",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"index",
"\\u",
"list_",
"._",
"filter",
"\\u",
"closed_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"index",
"\\u",
"list_",
"._",
"empty",
"\\u",
"list",
"\\u",
"check_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logg",
"it_",
"._",
"info_",
"(_",
"'",
"Clos",
"ing",
" ",
"selecte",
"d",
" ",
"indice",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"index",
"\\u",
"lists_",
"=_",
"chunk",
"\\u",
"index",
"\\u",
"list_",
"(_",
"self_",
"._",
"index",
"\\u",
"list_",
"._",
"indices_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"l_",
"in_",
"index",
"\\u",
"lists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Do",
" ",
"sync",
"\\u",
"flush",
" ",
"from",
" ",
"Sync",
"Flu",
"sh",
" ",
"object",
" ",
"after",
" ",
"it",
"'",
"s",
" ",
"bui",
"lt",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"client_",
"._",
"indices_",
"._",
"flush_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"to",
"\\u",
"csv_",
"(_",
"l_",
")_",
",_",
"ignore",
"\\u",
"unava",
"ilab",
"le_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"client_",
"._",
"indices_",
"._",
"close_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"to",
"\\u",
"csv_",
"(_",
"l_",
")_",
",_",
"ignore",
"\\u",
"unava",
"ilab",
"le_",
"=_",
"True_",
")_",
"\\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 ",
" _",
"report",
"\\u",
"failure_",
"(_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | sdispater/cleo/cleo/questions/__init__.py | [
{
"content": "# -*- coding: utf-8 -*-\n\nfrom .question import Question\nfrom .confirmation_question import ConfirmationQuestion\nfrom .choice_question import ChoiceQuestion\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | 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_",
"from_",
"._",
"question_",
"import_",
"Question_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"confirmation",
"\\u",
"question_",
"import_",
"Confirmation",
"Question_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"choice",
"\\u",
"question_",
"import_",
"Choi",
"ce",
"Question_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | django-oscar/django-oscar/src/oscar/apps/analytics/admin.py | [
{
"content": "from django.contrib import admin\n\nfrom oscar.core.loading import get_model\n\n\n\n\n\n\n\n\nadmin.site.register(get_model('analytics', 'productrecord'),\n ProductRecordAdmin)\nadmin.site.register(get_model('analytics', 'userrecord'), UserRecordAdmin)\nadmin.site.register(get_model('analytics', 'usersearch'))\nadmin.site.register(get_model('analytics', 'userproductview'),\n UserProductViewAdmin)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ProductRecordAdmin(admin.ModelAdmin):\n list_display = ('product', 'num_views', 'num_basket_additions',\n 'num_purchases')",
"metadata": "root.ProductRecordAdmin",
"header": "['module', '___EOS___']",
"index": 5
},
{
"content": "class UserProductViewAdmin(admin.ModelAdmin):\n list_display = ('user', 'product', 'date_created')",
"metadata": "root.UserProductViewAdmin",
"header": "['module', '___EOS___']",
"index": 10
},
{
"content": "class UserRecordAdmin(admin.ModelAdmin):\n list_display = ('user', 'num_product_views', 'num_basket_additions',\n 'num_orders', 'total_spent', 'date_last_order')",
"metadata": "root.UserRecordAdmin",
"header": "['module', '___EOS___']",
"index": 14
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"import_",
"admin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"osc",
"ar_",
"._",
"core_",
"._",
"loading_",
"import_",
"get",
"\\u",
"model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"admin_",
"._",
"site_",
"._",
"register_",
"(_",
"get",
"\\u",
"model_",
"(_",
"'",
"analytics",
"'_",
",_",
"'",
"product",
"record",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Product",
"Record",
"Admin_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin_",
"._",
"site_",
"._",
"register_",
"(_",
"get",
"\\u",
"model_",
"(_",
"'",
"analytics",
"'_",
",_",
"'",
"user",
"record",
"'_",
")_",
",_",
"User",
"Record",
"Admin_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin_",
"._",
"site_",
"._",
"register_",
"(_",
"get",
"\\u",
"model_",
"(_",
"'",
"analytics",
"'_",
",_",
"'",
"users",
"ear",
"ch",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin_",
"._",
"site_",
"._",
"register_",
"(_",
"get",
"\\u",
"model_",
"(_",
"'",
"analytics",
"'_",
",_",
"'",
"userp",
"rod",
"uct",
"view",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"User",
"Product",
"View",
"Admin_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Product",
"Record",
"Admin_",
"(_",
"admin_",
"._",
"Model",
"Admin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"list",
"\\u",
"display_",
"=_",
"(_",
"'",
"product",
"'_",
",_",
"'",
"num",
"\\u",
"views",
"'_",
",_",
"'",
"num",
"\\u",
"basket",
"\\u",
"additions",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"num",
"\\u",
"purchase",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"User",
"Product",
"View",
"Admin_",
"(_",
"admin_",
"._",
"Model",
"Admin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"list",
"\\u",
"display_",
"=_",
"(_",
"'",
"user",
"'_",
",_",
"'",
"product",
"'_",
",_",
"'",
"date",
"\\u",
"created",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"User",
"Record",
"Admin_",
"(_",
"admin_",
"._",
"Model",
"Admin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"list",
"\\u",
"display_",
"=_",
"(_",
"'",
"user",
"'_",
",_",
"'",
"num",
"\\u",
"product",
"\\u",
"views",
"'_",
",_",
"'",
"num",
"\\u",
"basket",
"\\u",
"additions",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"num",
"\\u",
"order",
"s",
"'_",
",_",
"'",
"total",
"\\u",
"spe",
"nt",
"'_",
",_",
"'",
"date",
"\\u",
"last",
"\\u",
"order",
"'_",
")_",
"\\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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Wrong number of arguments in a call | google/grr/grr/lib/artifact_registry.py | [
{
"content": " def ToPrimitiveDict(self):\n \"\"\"Handle dict generation specifically for Artifacts.\"\"\"\n artifact_dict = super(Artifact, self).ToPrimitiveDict()\n\n # ArtifactName is not JSON-serializable, so convert name to string.\n artifact_dict[\"name\"] = utils.SmartStr(self.name)\n\n # Convert proto enum to simple strings so they get rendered in the GUI\n # properly\n for source in artifact_dict[\"sources\"]:\n if \"type\" in source:\n source[\"type\"] = str(source[\"type\"])\n if \"key_value_pairs\" in source[\"attributes\"]:\n outarray = []\n for indict in source[\"attributes\"][\"key_value_pairs\"]:\n outarray.append(dict(indict.items()))\n source[\"attributes\"][\"key_value_pairs\"] = outarray\n\n # Repeated fields that have not been set should return as empty lists.\n for field in self.required_repeated_fields:\n if field not in artifact_dict:\n artifact_dict[field] = []\n return artifact_dict",
"metadata": "root.Artifact.ToPrimitiveDict",
"header": "['class', 'Artifact', '(', 'structs', '.', 'RDFProtoStruct', ')', ':', '___EOS___']",
"index": 527
},
{
"content": " def ToExtendedDict(self):\n artifact_dict = self.ToPrimitiveDict()\n artifact_dict[\"dependencies\"] = list(self.GetArtifactPathDependencies())\n return artifact_dict",
"metadata": "root.Artifact.ToExtendedDict",
"header": "['class', 'Artifact', '(', 'structs', '.', 'RDFProtoStruct', ')', ':', '___EOS___']",
"index": 551
},
{
"content": " def ToPrettyJson(self, extended=False):\n \"\"\"Print in json format but customized for pretty artifact display.\"\"\"\n if extended:\n artifact_dict = self.ToExtendedDict()\n else:\n artifact_dict = self.ToPrimitiveDict()\n\n artifact_json = json.dumps(artifact_dict, indent=2, sort_keys=True,\n separators=(\",\", \": \"))\n # Now tidy up the json for better display. Unfortunately json gives us very\n # little control over output format, so we manually tidy it up given that\n # we have a defined format.\n\n def CompressBraces(name, in_str):\n return re.sub(r\"%s\\\": \\[\\n\\s+(.*)\\n\\s+\" % name,\n \"%s\\\": [ \\\\g<1> \" % name, in_str)\n artifact_json = CompressBraces(\"conditions\", artifact_json)\n artifact_json = CompressBraces(\"urls\", artifact_json)\n artifact_json = CompressBraces(\"labels\", artifact_json)\n artifact_json = CompressBraces(\"supported_os\", artifact_json)\n artifact_json = re.sub(r\"{\\n\\s+\", \"{ \", artifact_json)\n return artifact_json",
"metadata": "root.Artifact.ToPrettyJson",
"header": "['class', 'Artifact', '(', 'structs', '.', 'RDFProtoStruct', ')', ':', '___EOS___']",
"index": 556
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Wro",
"ng_",
"number_",
"of_",
"arguments_",
"in_",
"a_",
"call_",
"[SEP]_",
"class_",
"Artifact",
"_",
"(_",
"structs_",
"._",
"RDF",
"Proto",
"Struct_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"To",
"Primitive",
"Dict_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Handle",
" ",
"dict",
" ",
"generat",
"ion",
" ",
"specifica",
"ll",
"y",
" ",
"for",
" ",
"Artifact",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"artifact",
"\\u",
"dict_",
"=_",
"super_",
"(_",
"Artifact",
"_",
",_",
"self_",
")_",
"._",
"To",
"Primitive",
"Dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Artifact",
"Name",
" ",
"is",
" ",
"not",
" ",
"JSO",
"N",
"-",
"serializable",
",",
" ",
"so",
" ",
"convert",
" ",
"name",
" ",
"to",
" ",
"string",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"artifact",
"\\u",
"dict_",
"[_",
"\"",
"name",
"\"_",
"]_",
"=_",
"utils_",
"._",
"Sma",
"rt",
"Str_",
"(_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Convert",
" ",
"proto",
" ",
"enum",
" ",
"to",
" ",
"simple",
" ",
"string",
"s",
" ",
"so",
" ",
"the",
"y",
" ",
"get",
" ",
"render",
"ed",
" ",
"in",
" ",
"the",
" ",
"GUI_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"proper",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"source_",
"in_",
"artifact",
"\\u",
"dict_",
"[_",
"\"",
"source",
"s",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"\"",
"type",
"\"_",
"in_",
"source_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"source_",
"[_",
"\"",
"type",
"\"_",
"]_",
"=_",
"str_",
"(_",
"source_",
"[_",
"\"",
"type",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\"",
"key",
"\\u",
"value",
"\\u",
"pair",
"s",
"\"_",
"in_",
"source_",
"[_",
"\"",
"attribute",
"s",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"out",
"array_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"indic",
"t_",
"in_",
"source_",
"[_",
"\"",
"attribute",
"s",
"\"_",
"]_",
"[_",
"\"",
"key",
"\\u",
"value",
"\\u",
"pair",
"s",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"out",
"array_",
"._",
"append_",
"(_",
"dict_",
"(_",
"indic",
"t_",
"._",
"items_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"source_",
"[_",
"\"",
"attribute",
"s",
"\"_",
"]_",
"[_",
"\"",
"key",
"\\u",
"value",
"\\u",
"pair",
"s",
"\"_",
"]_",
"=_",
"out",
"array_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Repeat",
"ed",
" ",
"fields",
" ",
"tha",
"t",
" ",
"have",
" ",
"not",
" ",
"bee",
"n",
" ",
"set",
" ",
"shou",
"ld",
" ",
"return",
" ",
"as",
" ",
"empty",
" ",
"lists",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"field_",
"in_",
"self_",
"._",
"require",
"d\\u",
"repeated",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"field_",
"not_",
"in_",
"artifact",
"\\u",
"dict_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"artifact",
"\\u",
"dict_",
"[_",
"field_",
"]_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"artifact",
"\\u",
"dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Artifact",
"_",
"(_",
"structs_",
"._",
"RDF",
"Proto",
"Struct_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"To",
"Extend",
"ed",
"Dict_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"artifact",
"\\u",
"dict_",
"=_",
"self_",
"._",
"To",
"Primitive",
"Dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"artifact",
"\\u",
"dict_",
"[_",
"\"",
"dependen",
"cies",
"\"_",
"]_",
"=_",
"list_",
"(_",
"self_",
"._",
"Get",
"Artifact",
"Path",
"Dependenc",
"ies_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"artifact",
"\\u",
"dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Artifact",
"_",
"(_",
"structs_",
"._",
"RDF",
"Proto",
"Struct_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"To",
"Pret",
"ty",
"Json_",
"(_",
"self_",
",_",
"extended_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Print",
" ",
"in",
" ",
"json",
" ",
"format",
" ",
"but",
" ",
"customize",
"d",
" ",
"for",
" ",
"pretty",
" ",
"artifact",
" ",
"display",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"extended_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"artifact",
"\\u",
"dict_",
"=_",
"self_",
"._",
"To",
"Extend",
"ed",
"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 ",
" _",
"artifact",
"\\u",
"dict_",
"=_",
"self_",
"._",
"To",
"Primitive",
"Dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"artifact",
"\\u",
"json_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"artifact",
"\\u",
"dict_",
",_",
"indent_",
"=_",
"2_",
",_",
"sort",
"\\u",
"keys_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"separators_",
"=_",
"(_",
"\",\"_",
",_",
"\":",
" ",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"No",
"w",
" ",
"tidy",
" ",
"up",
" ",
"the",
" ",
"json",
" ",
"for",
" ",
"bett",
"er",
" ",
"display",
".",
" ",
"Unf",
"ort",
"unat",
"el",
"y",
" ",
"json",
" ",
"give",
"s",
" ",
"us",
" ",
"very",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"litt",
"le",
" ",
"control",
" ",
"over",
" ",
"output",
" ",
"format",
",",
" ",
"so",
" ",
"we",
" ",
"manu",
"ally",
" ",
"tidy",
" ",
"it",
" ",
"up",
" ",
"give",
"n",
" ",
"that_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"we",
" ",
"have",
" ",
"a",
" ",
"defin",
"ed",
" ",
"format",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"Compress",
"Bra",
"ces_",
"(_",
"name_",
",_",
"in",
"\\u",
"str_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"re_",
"._",
"sub_",
"(_",
"r",
"\"%",
"s",
"\\\\\":",
" ",
"\\\\[",
"\\\\",
"n",
"\\\\",
"s",
"+(",
".*)",
"\\\\",
"n",
"\\\\",
"s",
"+\"_",
"%_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"s",
"\\\\\":",
" ",
"[",
" ",
"\\\\\\\\",
"g",
"<",
"1",
">",
" ",
"\"_",
"%_",
"name_",
",_",
"in",
"\\u",
"str_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"artifact",
"\\u",
"json_",
"=_",
"Compress",
"Bra",
"ces_",
"(_",
"\"",
"condition",
"s",
"\"_",
",_",
"artifact",
"\\u",
"json_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"artifact",
"\\u",
"json_",
"=_",
"Compress",
"Bra",
"ces_",
"(_",
"\"",
"urls",
"\"_",
",_",
"artifact",
"\\u",
"json_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"artifact",
"\\u",
"json_",
"=_",
"Compress",
"Bra",
"ces_",
"(_",
"\"",
"labels",
"\"_",
",_",
"artifact",
"\\u",
"json_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"artifact",
"\\u",
"json_",
"=_",
"Compress",
"Bra",
"ces_",
"(_",
"\"",
"support",
"ed",
"\\u",
"os",
"\"_",
",_",
"artifact",
"\\u",
"json_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"artifact",
"\\u",
"json_",
"=_",
"re_",
"._",
"sub_",
"(_",
"r",
"\"{\\\\",
"n",
"\\\\",
"s",
"+\"_",
",_",
"\"{",
" ",
"\"_",
",_",
"artifact",
"\\u",
"json_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"artifact",
"\\u",
"json_",
"\\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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2,
2,
2,
2,
2,
2,
2,
2,
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 | beetbox/beets/beetsplug/badfiles.py | [
{
"content": " def run_command(self, cmd):\n self._log.debug(u\"running command: {}\",\n displayable_path(list2cmdline(cmd)))\n try:\n output = check_output(cmd, stderr=STDOUT)\n errors = 0\n status = 0\n except CalledProcessError as e:\n output = e.output\n errors = 1\n status = e.returncode\n except OSError as e:\n if e.errno == errno.ENOENT:\n ui.print_(u\"command not found: {}\".format(cmd[0]))\n sys.exit(1)\n else:\n raise\n output = output.decode(sys.getfilesystemencoding())\n return status, errors, [line for line in output.split(\"\\n\") if line]",
"metadata": "root.BadFiles.run_command",
"header": "['class', 'BadFiles', '(', 'BeetsPlugin', ')', ':', '___EOS___']",
"index": 32
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Ba",
"d",
"Files_",
"(_",
"Bee",
"ts",
"Plugin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"run",
"\\u",
"command_",
"(_",
"self_",
",_",
"cmd_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"log_",
"._",
"debug_",
"(_",
"u",
"\"",
"runn",
"ing",
" ",
"command",
":",
" ",
"{}\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"display",
"able",
"\\u",
"path_",
"(_",
"list",
"2c",
"mdl",
"ine_",
"(_",
"cmd_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"output_",
"=_",
"check",
"\\u",
"output_",
"(_",
"cmd_",
",_",
"stderr_",
"=_",
"STDOUT_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"errors_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"status_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Call",
"ed",
"Process",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"output_",
"=_",
"e_",
"._",
"output_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"errors_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"status_",
"=_",
"e_",
"._",
"returncode_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"OSE",
"rror_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"e_",
"._",
"errno_",
"==_",
"errno_",
"._",
"ENOENT_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ui_",
"._",
"print\\u_",
"(_",
"u",
"\"",
"command",
" ",
"not",
" ",
"found",
":",
" ",
"{}\"_",
"._",
"format_",
"(_",
"cmd_",
"[_",
"0_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"output_",
"=_",
"output_",
"._",
"decode_",
"(_",
"sys_",
"._",
"getfile",
"system",
"encoding_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"status_",
",_",
"errors_",
",_",
"[_",
"line_",
"for_",
"line_",
"in_",
"output_",
"._",
"split_",
"(_",
"\"\\\\",
"n",
"\"_",
")_",
"if_",
"line_",
"]_",
"\\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
] |
Module is imported with 'import' and 'import from' | akheron/stango/tests/test_server.py | [
{
"content": "from stango import Stango\nfrom stango.files import Files\n\nimport functools\nfrom threading import Thread\nfrom urllib.request import urlopen\nfrom urllib.error import HTTPError\n\nfrom . import StangoTestCase, make_suite, view_value, view_template\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"stan",
"go_",
"import_",
"Stan",
"go_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"stan",
"go_",
"._",
"files_",
"import_",
"Files_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"functools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"threading_",
"import_",
"Thread_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"urllib_",
"._",
"request_",
"import_",
"urlopen_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"urllib_",
"._",
"error_",
"import_",
"HTTP",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"import_",
"Stan",
"go",
"Test",
"Case_",
",_",
"make",
"\\u",
"suite_",
",_",
"view",
"\\u",
"value_",
",_",
"view",
"\\u",
"template_",
"\\u\\u\\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_"
] | [
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
] |
Unused import | openstack/python-congressclient/congressclient/osc/v1/policy.py | [
{
"content": "# Copyright 2012-2013 OpenStack, LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"Policy action implemenations\"\"\"\n\nimport sys\n\nfrom cliff import command\nfrom cliff import lister\nfrom cliff import show\nfrom keystoneclient import exceptions\nfrom oslo_log import log as logging\nfrom oslo_serialization import jsonutils\nimport six\n\nfrom congressclient.common import utils\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def _format_rule(rule):\n \"\"\"Break up rule string so it fits on screen.\"\"\"\n\n rule_split = jsonutils.dumps(rule).split(\":-\")\n formatted_string = rule_split[0] + \":-\\n\"\n for rule in rule_split[1].split(\"), \"):\n formatted_string += rule + '\\n'\n return formatted_string",
"metadata": "root._format_rule",
"header": "['module', '___EOS___']",
"index": 29
},
{
"content": "def get_rule_id_from_name(client, parsed_args):\n results = client.list_policy_rules(parsed_args.policy_name)['results']\n rule_id = None\n for result in results:\n if result.get('name') == parsed_args.rule_id:\n if rule_id is None:\n rule_id = result.get('id')\n else:\n raise exceptions.Conflict(\n \"[Multiple rules with same name: %s]\" %\n parsed_args.rule_id)\n if rule_id is None:\n raise exceptions.NotFound(\n \"[No rule found with name: %s]\" % parsed_args.rule_id)\n return rule_id",
"metadata": "root.get_rule_id_from_name",
"header": "['module', '___EOS___']",
"index": 39
},
{
"content": "class CreatePolicyRule(show.ShowOne):\n \"\"\"Create a policy rule.\"\"\"\n\n log = logging.getLogger(__name__ + '.CreatePolicyRule')\n\n",
"metadata": "root.CreatePolicyRule",
"header": "['module', '___EOS___']",
"index": 56
},
{
"content": " def get_parser(self, prog_name):\n parser = super(CreatePolicyRule, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar=\"<policy-name>\",\n help=\"Name or identifier of the policy\")\n parser.add_argument(\n 'rule',\n metavar=\"<rule>\",\n help=\"Policy rule\")\n parser.add_argument(\n '--name', dest=\"rule_name\",\n help=\"Name of the policy rule\")\n parser.add_argument(\n '--comment', dest=\"comment\",\n help=\"Comment about policy rule\")\n return parser",
"metadata": "root.CreatePolicyRule.get_parser",
"header": "['class', 'CreatePolicyRule', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 61
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n body = {'rule': parsed_args.rule}\n if parsed_args.rule_name:\n body['name'] = parsed_args.rule_name\n if parsed_args.comment:\n body['comment'] = parsed_args.comment\n data = client.create_policy_rule(parsed_args.policy_name, body)\n return zip(*sorted(six.iteritems(data)))",
"metadata": "root.CreatePolicyRule.take_action",
"header": "['class', 'CreatePolicyRule', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 79
},
{
"content": "class DeletePolicyRule(command.Command):\n \"\"\"Delete a policy rule.\"\"\"\n\n log = logging.getLogger(__name__ + '.DeletePolicyRule')\n\n",
"metadata": "root.DeletePolicyRule",
"header": "['module', '___EOS___']",
"index": 91
},
{
"content": " def get_parser(self, prog_name):\n parser = super(DeletePolicyRule, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar=\"<policy-name>\",\n help=\"Name of the policy to delete\")\n parser.add_argument(\n 'rule_id',\n metavar=\"<rule-id/rule-name>\",\n help=\"ID/Name of the policy rule to delete\")\n return parser",
"metadata": "root.DeletePolicyRule.get_parser",
"header": "['class', 'DeletePolicyRule', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 96
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n results = client.list_policy_rules(parsed_args.policy_name)\n rule_id = utils.get_resource_id_from_name(\n parsed_args.rule_id, results)\n client.delete_policy_rule(parsed_args.policy_name, rule_id)",
"metadata": "root.DeletePolicyRule.take_action",
"header": "['class', 'DeletePolicyRule', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 108
},
{
"content": "class ListPolicyRules(command.Command):\n \"\"\"List policy rules.\"\"\"\n\n log = logging.getLogger(__name__ + '.ListPolicyRules')\n\n",
"metadata": "root.ListPolicyRules",
"header": "['module', '___EOS___']",
"index": 117
},
{
"content": " def get_parser(self, prog_name):\n parser = super(ListPolicyRules, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar=\"<policy-name>\",\n help=\"Name of the policy\")\n return parser",
"metadata": "root.ListPolicyRules.get_parser",
"header": "['class', 'ListPolicyRules', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 122
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n results = client.list_policy_rules(parsed_args.policy_name)['results']\n for result in results:\n print(\"// ID: %s\" % str(result['id']))\n print(\"// Name: %s\" % str(result.get('name')))\n if result['comment'] != \"None\" and result['comment']:\n print(\"// %s\" % str(result['comment']))\n print(result['rule'])\n print('')\n return 0",
"metadata": "root.ListPolicyRules.take_action",
"header": "['class', 'ListPolicyRules', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 130
},
{
"content": "class SimulatePolicy(command.Command):\n \"\"\"Show the result of simulation.\"\"\"\n\n log = logging.getLogger(__name__ + '.SimulatePolicy')\n\n",
"metadata": "root.SimulatePolicy",
"header": "['module', '___EOS___']",
"index": 144
},
{
"content": " def get_parser(self, prog_name):\n parser = super(SimulatePolicy, self).get_parser(prog_name)\n parser.add_argument(\n 'policy',\n metavar=\"<policy>\",\n help=\"Name of the policy\")\n parser.add_argument(\n 'query',\n metavar=\"<query>\",\n help=\"String representing query (policy rule or literal)\")\n parser.add_argument(\n 'sequence',\n metavar=\"<sequence>\",\n help=\"String representing sequence of updates/actions\")\n parser.add_argument(\n 'action_policy',\n metavar=\"<action_policy>\",\n help=\"Name of the policy with actions\",\n default=None)\n parser.add_argument(\n '--delta',\n action='store_true',\n default=False,\n help=\"Return difference in query caused by update sequence\")\n parser.add_argument(\n '--trace',\n action='store_true',\n default=False,\n help=\"Include trace describing computation\")\n return parser",
"metadata": "root.SimulatePolicy.get_parser",
"header": "['class', 'SimulatePolicy', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 149
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n args = {}\n args['query'] = parsed_args.query\n args['sequence'] = parsed_args.sequence\n if parsed_args.action_policy is not None:\n args['action_policy'] = parsed_args.action_policy\n if parsed_args.delta:\n args['delta'] = parsed_args.delta\n if parsed_args.trace:\n args['trace'] = parsed_args.trace\n\n body = {'query': parsed_args.query,\n 'sequence': parsed_args.sequence,\n 'action_policy': parsed_args.action_policy}\n\n results = client.execute_policy_action(\n policy_name=parsed_args.policy,\n action=\"simulate\",\n trace=parsed_args.trace,\n delta=parsed_args.delta,\n body=body)\n for result in results['result']:\n print(result)\n if 'trace' in results:\n print (results['trace'])\n return 0",
"metadata": "root.SimulatePolicy.take_action",
"header": "['class', 'SimulatePolicy', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 180
},
{
"content": "class ListPolicyTables(lister.Lister):\n \"\"\"List policy tables.\"\"\"\n\n log = logging.getLogger(__name__ + '.ListPolicyTables')\n\n",
"metadata": "root.ListPolicyTables",
"header": "['module', '___EOS___']",
"index": 210
},
{
"content": " def get_parser(self, prog_name):\n parser = super(ListPolicyTables, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar=\"<policy-name>\",\n help=\"Name of the policy\")\n return parser",
"metadata": "root.ListPolicyTables.get_parser",
"header": "['class', 'ListPolicyTables', '(', 'lister', '.', 'Lister', ')', ':', '___EOS___']",
"index": 215
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n data = client.list_policy_tables(parsed_args.policy_name)['results']\n columns = ['id']\n formatters = {'PolicyTables': utils.format_list}\n return (columns,\n (utils.get_dict_properties(s, columns,\n formatters=formatters)\n for s in data))",
"metadata": "root.ListPolicyTables.take_action",
"header": "['class', 'ListPolicyTables', '(', 'lister', '.', 'Lister', ')', ':', '___EOS___']",
"index": 223
},
{
"content": "class ListPolicy(lister.Lister):\n \"\"\"List Policy.\"\"\"\n\n log = logging.getLogger(__name__ + '.ListPolicy')\n\n",
"metadata": "root.ListPolicy",
"header": "['module', '___EOS___']",
"index": 235
},
{
"content": " def get_parser(self, prog_name):\n parser = super(ListPolicy, self).get_parser(prog_name)\n return parser",
"metadata": "root.ListPolicy.get_parser",
"header": "['class', 'ListPolicy', '(', 'lister', '.', 'Lister', ')', ':', '___EOS___']",
"index": 240
},
{
"content": " def take_action(self, parsed_args):\n client = self.app.client_manager.congressclient\n data = client.list_policy()['results']\n columns = ['id', 'name', 'owner_id', 'kind', 'description']\n formatters = {'Policies': utils.format_list}\n return (columns,\n (utils.get_dict_properties(s, columns,\n formatters=formatters)\n for s in data))",
"metadata": "root.ListPolicy.take_action",
"header": "['class', 'ListPolicy', '(', 'lister', '.', 'Lister', ')', ':', '___EOS___']",
"index": 244
},
{
"content": "class CreatePolicy(show.ShowOne):\n \"\"\"Create a policy.\"\"\"\n\n log = logging.getLogger(__name__ + '.CreatePolicy')\n\n",
"metadata": "root.CreatePolicy",
"header": "['module', '___EOS___']",
"index": 255
},
{
"content": " def get_parser(self, prog_name):\n parser = super(CreatePolicy, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar=\"<policy_name>\",\n help=\"Name of the policy\")\n parser.add_argument(\n '--description',\n metavar=\"<description>\",\n help=\"Policy description\")\n parser.add_argument(\n '--abbreviation',\n metavar=\"<abbreviation>\",\n help=\"Policy abbreviation (used in traces). The length of the \"\n \"string must be equal to or less than 5 characters. Defaults \"\n \"to the first five characters of policy_name if not set.\")\n parser.add_argument(\n '--kind',\n metavar=\"<kind>\",\n choices=['nonrecursive', 'database', 'action', 'materialized'],\n help=\"Kind of policy: \"\n \"{nonrecursive, database, action, materialized}\")\n return parser",
"metadata": "root.CreatePolicy.get_parser",
"header": "['class', 'CreatePolicy', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 260
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n body = {'name': parsed_args.policy_name,\n 'description': parsed_args.description,\n 'abbreviation': parsed_args.abbreviation,\n 'kind': parsed_args.kind}\n data = client.create_policy(body)\n return zip(*sorted(six.iteritems(data)))",
"metadata": "root.CreatePolicy.take_action",
"header": "['class', 'CreatePolicy', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 284
},
{
"content": "class DeletePolicy(command.Command):\n \"\"\"Delete a policy.\"\"\"\n\n log = logging.getLogger(__name__ + '.DeletePolicy')\n\n",
"metadata": "root.DeletePolicy",
"header": "['module', '___EOS___']",
"index": 295
},
{
"content": " def get_parser(self, prog_name):\n parser = super(DeletePolicy, self).get_parser(prog_name)\n parser.add_argument(\n 'policy',\n metavar=\"<policy>\",\n help=\"ID or name of the policy to delete\")\n return parser",
"metadata": "root.DeletePolicy.get_parser",
"header": "['class', 'DeletePolicy', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 300
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n\n client.delete_policy(parsed_args.policy)",
"metadata": "root.DeletePolicy.take_action",
"header": "['class', 'DeletePolicy', '(', 'command', '.', 'Command', ')', ':', '___EOS___']",
"index": 308
},
{
"content": "class ListPolicyRows(lister.Lister):\n \"\"\"List policy rows.\"\"\"\n\n log = logging.getLogger(__name__ + '.ListPolicyRows')\n\n",
"metadata": "root.ListPolicyRows",
"header": "['module', '___EOS___']",
"index": 315
},
{
"content": " def get_parser(self, prog_name):\n parser = super(ListPolicyRows, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar=\"<policy-name>\",\n help=\"Name of the policy to show\")\n parser.add_argument(\n 'table',\n metavar=\"<table>\",\n help=\"Table to get the policy rows from\")\n parser.add_argument(\n '--trace',\n action='store_true',\n default=False,\n help=\"Display explanation of result\")\n return parser",
"metadata": "root.ListPolicyRows.get_parser",
"header": "['class', 'ListPolicyRows', '(', 'lister', '.', 'Lister', ')', ':', '___EOS___']",
"index": 320
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n answer = client.list_policy_rows(parsed_args.policy_name,\n parsed_args.table,\n parsed_args.trace)\n\n if 'trace' in answer:\n sys.stdout.write(answer['trace'] + '\\n')\n results = answer['results']\n columns = []\n if results:\n columns = ['Col%s' % (i)\n for i in range(0, len(results[0]['data']))]\n self.log.debug(\"Columns: \" + str(columns))\n return (columns, (x['data'] for x in results))",
"metadata": "root.ListPolicyRows.take_action",
"header": "['class', 'ListPolicyRows', '(', 'lister', '.', 'Lister', ')', ':', '___EOS___']",
"index": 337
},
{
"content": "class ShowPolicyRule(show.ShowOne):\n \"\"\"Show a policy rule.\"\"\"\n\n log = logging.getLogger(__name__ + '.ShowPolicyRule')\n\n",
"metadata": "root.ShowPolicyRule",
"header": "['module', '___EOS___']",
"index": 355
},
{
"content": " def get_parser(self, prog_name):\n parser = super(ShowPolicyRule, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar=\"<policy-name>\",\n help=\"Name or identifier of the policy\")\n parser.add_argument(\n 'rule_id',\n metavar=\"<rule-id/rule-name>\",\n help=\"Policy rule id or rule name\")\n\n return parser",
"metadata": "root.ShowPolicyRule.get_parser",
"header": "['class', 'ShowPolicyRule', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 360
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n results = client.list_policy_rules(parsed_args.policy_name)\n rule_id = utils.get_resource_id_from_name(\n parsed_args.rule_id, results)\n data = client.show_policy_rule(parsed_args.policy_name, rule_id)\n return zip(*sorted(six.iteritems(data)))",
"metadata": "root.ShowPolicyRule.take_action",
"header": "['class', 'ShowPolicyRule', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 373
},
{
"content": "class ShowPolicyTable(show.ShowOne):\n \"\"\"Show policy table properties.\"\"\"\n\n log = logging.getLogger(__name__ + '.ShowPolicyTable')\n\n",
"metadata": "root.ShowPolicyTable",
"header": "['module', '___EOS___']",
"index": 383
},
{
"content": " def get_parser(self, prog_name):\n parser = super(ShowPolicyTable, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar='<policy-name>',\n help=\"Name of policy\")\n parser.add_argument(\n 'table_id',\n metavar='<table-id>',\n help=\"Table id\")\n\n return parser",
"metadata": "root.ShowPolicyTable.get_parser",
"header": "['class', 'ShowPolicyTable', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 388
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n data = client.show_policy_table(parsed_args.policy_name,\n parsed_args.table_id)\n return zip(*sorted(six.iteritems(data)))",
"metadata": "root.ShowPolicyTable.take_action",
"header": "['class', 'ShowPolicyTable', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 401
},
{
"content": "class ShowPolicy(show.ShowOne):\n \"\"\"Show policy properties.\"\"\"\n\n log = logging.getLogger(__name__ + '.ShowPolicy')\n\n",
"metadata": "root.ShowPolicy",
"header": "['module', '___EOS___']",
"index": 409
},
{
"content": " def get_parser(self, prog_name):\n parser = super(ShowPolicy, self).get_parser(prog_name)\n parser.add_argument(\n 'policy_name',\n metavar='<policy-name>',\n help=\"Name of policy\")\n\n return parser",
"metadata": "root.ShowPolicy.get_parser",
"header": "['class', 'ShowPolicy', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 414
},
{
"content": " def take_action(self, parsed_args):\n self.log.debug('take_action(%s)' % parsed_args)\n client = self.app.client_manager.congressclient\n results = client.list_policy()\n policy_id = utils.get_resource_id_from_name(\n parsed_args.policy_name, results)\n data = client.show_policy(policy_id)\n return zip(*sorted(six.iteritems(data)))",
"metadata": "root.ShowPolicy.take_action",
"header": "['class', 'ShowPolicy', '(', 'show', '.', 'ShowOne', ')', ':', '___EOS___']",
"index": 423
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
" ",
" ",
"Copy",
"right",
" ",
"2012",
"-",
"2013",
" ",
"Open",
"Stack",
",",
" ",
"LLC",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Polic",
"y",
" ",
"action",
" ",
"impl",
"eme",
"nati",
"ons",
"\"\"\"_",
"\\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_",
"cli",
"ff_",
"import_",
"command_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cli",
"ff_",
"import_",
"liste",
"r_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cli",
"ff_",
"import_",
"show_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"keystone",
"client_",
"import_",
"exceptions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"oslo",
"\\u",
"log_",
"import_",
"log_",
"as_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"oslo",
"\\u",
"serialization_",
"import_",
"jsonutils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"six_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"congr",
"ess",
"client_",
"._",
"common_",
"import_",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"format\\u",
"rule_",
"(_",
"rule_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Break",
" ",
"up",
" ",
"rule",
" ",
"string",
" ",
"so",
" ",
"it",
" ",
"fits",
" ",
"on",
" ",
"screen",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rule",
"\\u",
"split_",
"=_",
"jsonutils_",
"._",
"dumps_",
"(_",
"rule_",
")_",
"._",
"split_",
"(_",
"\":",
"-\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"format",
"ted",
"\\u",
"string_",
"=_",
"rule",
"\\u",
"split_",
"[_",
"0_",
"]_",
"+_",
"\":",
"-\\\\",
"n",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"rule_",
"in_",
"rule",
"\\u",
"split_",
"[_",
"1_",
"]_",
"._",
"split_",
"(_",
"\")",
",",
" ",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"format",
"ted",
"\\u",
"string_",
"+=_",
"rule_",
"+_",
"'\\\\",
"n",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"format",
"ted",
"\\u",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"rule",
"\\u",
"id",
"\\u",
"from",
"\\u",
"name_",
"(_",
"client_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"results_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy",
"\\u",
"rules_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
")_",
"[_",
"'",
"results",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rule",
"\\u",
"id_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"result_",
"in_",
"results_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"result_",
"._",
"get_",
"(_",
"'",
"name",
"'_",
")_",
"==_",
"parsed",
"\\u",
"args_",
"._",
"rule",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"rule",
"\\u",
"id_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rule",
"\\u",
"id_",
"=_",
"result_",
"._",
"get_",
"(_",
"'",
"id",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"exceptions_",
"._",
"Conflict_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"[",
"Multipl",
"e",
" ",
"rule",
"s",
" ",
"with",
" ",
"same",
" ",
"name",
":",
" ",
"%",
"s",
"]\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"parsed",
"\\u",
"args_",
"._",
"rule",
"\\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_",
"if_",
"rule",
"\\u",
"id_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"exceptions_",
"._",
"Not",
"Found_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"[",
"No",
" ",
"rule",
" ",
"found",
" ",
"with",
" ",
"name",
":",
" ",
"%",
"s",
"]\"_",
"%_",
"parsed",
"\\u",
"args_",
"._",
"rule",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"rule",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Creat",
"e",
"Polic",
"y",
"Rule_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"e",
" ",
"a",
" ",
"policy",
" ",
"rule",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Creat",
"e",
"Polic",
"y",
"Rule",
"'_",
")_",
"\\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_",
"Creat",
"e",
"Polic",
"y",
"Rule_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Creat",
"e",
"Polic",
"y",
"Rule_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"or",
" ",
"identifi",
"er",
" ",
"of",
" ",
"the",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rule",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"rule",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Polic",
"y",
" ",
"rule",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"name",
"'_",
",_",
"dest_",
"=_",
"\"",
"rule",
"\\u",
"name",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
" ",
"rule",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"comment",
"'_",
",_",
"dest_",
"=_",
"\"",
"comment",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Comme",
"nt",
" ",
"abo",
"ut",
" ",
"policy",
" ",
"rule",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Creat",
"e",
"Polic",
"y",
"Rule_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"{_",
"'",
"rule",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"rule_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"parsed",
"\\u",
"args_",
"._",
"rule",
"\\u",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"[_",
"'",
"name",
"'_",
"]_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"rule",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"parsed",
"\\u",
"args_",
"._",
"comment_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"[_",
"'",
"comment",
"'_",
"]_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"comment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
"=_",
"client_",
"._",
"create",
"\\u",
"policy",
"\\u",
"rule_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
",_",
"body_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zip_",
"(_",
"*_",
"sorted_",
"(_",
"six_",
"._",
"iteritems_",
"(_",
"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_",
"Delete",
"Polic",
"y",
"Rule_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Delete",
" ",
"a",
" ",
"policy",
" ",
"rule",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Delete",
"Polic",
"y",
"Rule",
"'_",
")_",
"\\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_",
"Delete",
"Polic",
"y",
"Rule_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Delete",
"Polic",
"y",
"Rule_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
" ",
"to",
" ",
"delete",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rule",
"\\u",
"id",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"rule",
"-",
"id",
"/",
"rule",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"ID",
"/",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
" ",
"rule",
" ",
"to",
" ",
"delete",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Delete",
"Polic",
"y",
"Rule_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy",
"\\u",
"rules_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rule",
"\\u",
"id_",
"=_",
"utils_",
"._",
"get",
"\\u",
"resource",
"\\u",
"id",
"\\u",
"from",
"\\u",
"name_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"parsed",
"\\u",
"args_",
"._",
"rule",
"\\u",
"id_",
",_",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"delete",
"\\u",
"policy",
"\\u",
"rule_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
",_",
"rule",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"List",
"Polic",
"y",
"Rules_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"List",
" ",
"policy",
" ",
"rule",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"List",
"Polic",
"y",
"Rule",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"List",
"Polic",
"y",
"Rules_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"List",
"Polic",
"y",
"Rules_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"List",
"Polic",
"y",
"Rules_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy",
"\\u",
"rules_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
")_",
"[_",
"'",
"results",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"result_",
"in_",
"results_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"//",
" ",
"ID",
":",
" ",
"%",
"s",
"\"_",
"%_",
"str_",
"(_",
"result_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"\"//",
" ",
"Name",
":",
" ",
"%",
"s",
"\"_",
"%_",
"str_",
"(_",
"result_",
"._",
"get_",
"(_",
"'",
"name",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"result_",
"[_",
"'",
"comment",
"'_",
"]_",
"!=_",
"\"",
"Non",
"e",
"\"_",
"and_",
"result_",
"[_",
"'",
"comment",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"//",
" ",
"%",
"s",
"\"_",
"%_",
"str_",
"(_",
"result_",
"[_",
"'",
"comment",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"print_",
"(_",
"result_",
"[_",
"'",
"rule",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Simulate",
"Policy_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Show",
" ",
"the",
" ",
"result",
" ",
"of",
" ",
"simulati",
"on",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Simulate",
"Polic",
"y",
"'_",
")_",
"\\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_",
"Simulate",
"Policy_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Simulate",
"Policy_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"query",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"query",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"String",
" ",
"represent",
"ing",
" ",
"query",
" ",
"(",
"policy",
" ",
"rule",
" ",
"or",
" ",
"literal",
")\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sequence",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"sequence",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"String",
" ",
"represent",
"ing",
" ",
"sequence",
" ",
"of",
" ",
"update",
"s",
"/",
"action",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"action",
"\\u",
"policy",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"action",
"\\u",
"policy",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
" ",
"with",
" ",
"action",
"s",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"delta",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Return",
" ",
"difference",
" ",
"in",
" ",
"query",
" ",
"caus",
"ed",
" ",
"by",
" ",
"update",
" ",
"sequence",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"trace",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Include",
" ",
"trace",
" ",
"descri",
"bing",
" ",
"computation",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Simulate",
"Policy_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"[_",
"'",
"query",
"'_",
"]_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"query_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"[_",
"'",
"sequence",
"'_",
"]_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"sequence_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"parsed",
"\\u",
"args_",
"._",
"action",
"\\u",
"policy_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"[_",
"'",
"action",
"\\u",
"policy",
"'_",
"]_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"action",
"\\u",
"policy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"parsed",
"\\u",
"args_",
"._",
"delta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"[_",
"'",
"delta",
"'_",
"]_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"delta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"parsed",
"\\u",
"args_",
"._",
"trace_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"[_",
"'",
"trace",
"'_",
"]_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"trace_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"body_",
"=_",
"{_",
"'",
"query",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"query_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sequence",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"sequence_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"action",
"\\u",
"policy",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"action",
"\\u",
"policy_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"results_",
"=_",
"client_",
"._",
"execute",
"\\u",
"policy",
"\\u",
"action_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"policy",
"\\u",
"name_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"policy_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"action_",
"=_",
"\"",
"simulat",
"e",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"trace_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"trace_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"delta_",
"=_",
"parsed",
"\\u",
"args_",
"._",
"delta_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"body_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"result_",
"in_",
"results_",
"[_",
"'",
"result",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"trace",
"'_",
"in_",
"results_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"results_",
"[_",
"'",
"trace",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"List",
"Polic",
"y",
"Tables_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"List",
" ",
"policy",
" ",
"tables",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"List",
"Polic",
"y",
"Table",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"List",
"Polic",
"y",
"Tables_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"List",
"Polic",
"y",
"Tables_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"List",
"Polic",
"y",
"Tables_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy",
"\\u",
"tables_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
")_",
"[_",
"'",
"results",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"columns_",
"=_",
"[_",
"'",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"formatters_",
"=_",
"{_",
"'",
"Polic",
"y",
"Table",
"s",
"'_",
":_",
"utils_",
"._",
"format\\u",
"list_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"utils_",
"._",
"get",
"\\u",
"dict",
"\\u",
"properties_",
"(_",
"s_",
",_",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"formatters_",
"=_",
"formatters_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"s_",
"in_",
"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_",
"List",
"Policy_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"List",
" ",
"Polic",
"y",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"List",
"Polic",
"y",
"'_",
")_",
"\\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_",
"List",
"Policy_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"List",
"Policy_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"List",
"Policy_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy_",
"(_",
")_",
"[_",
"'",
"results",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"columns_",
"=_",
"[_",
"'",
"id",
"'_",
",_",
"'",
"name",
"'_",
",_",
"'",
"owner",
"\\u",
"id",
"'_",
",_",
"'",
"kind",
"'_",
",_",
"'",
"description",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"formatters_",
"=_",
"{_",
"'",
"Polic",
"ies",
"'_",
":_",
"utils_",
"._",
"format\\u",
"list_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"utils_",
"._",
"get",
"\\u",
"dict",
"\\u",
"properties_",
"(_",
"s_",
",_",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"formatters_",
"=_",
"formatters_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"s_",
"in_",
"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_",
"Creat",
"e",
"Policy_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"e",
" ",
"a",
" ",
"policy",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Creat",
"e",
"Polic",
"y",
"'_",
")_",
"\\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_",
"Creat",
"e",
"Policy_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Creat",
"e",
"Policy_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
"\\u",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"description",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"description",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Polic",
"y",
" ",
"description",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"abbreviation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"abbreviation",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Polic",
"y",
" ",
"abbreviation",
" ",
"(",
"used",
" ",
"in",
" ",
"trace",
"s",
").",
" ",
"The",
" ",
"length",
" ",
"of",
" ",
"the",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"string",
" ",
"must",
" ",
"be",
" ",
"equal",
" ",
"to",
" ",
"or",
" ",
"less",
" ",
"than",
" ",
"5",
" ",
"character",
"s",
".",
" ",
"Default",
"s",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"to",
" ",
"the",
" ",
"first",
" ",
"five",
" ",
"character",
"s",
" ",
"of",
" ",
"policy",
"\\u",
"name",
" ",
"if",
" ",
"not",
" ",
"set",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"kind",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"kind",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"choices_",
"=_",
"[_",
"'",
"non",
"recurs",
"ive",
"'_",
",_",
"'",
"databa",
"se",
"'_",
",_",
"'",
"action",
"'_",
",_",
"'",
"material",
"ize",
"d",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Kin",
"d",
" ",
"of",
" ",
"policy",
":",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"{",
"non",
"recurs",
"ive",
",",
" ",
"databa",
"se",
",",
" ",
"action",
",",
" ",
"material",
"ize",
"d",
"}\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Creat",
"e",
"Policy_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"{_",
"'",
"name",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"description",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"description_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"abbreviation",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"abbreviation",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"kind",
"'_",
":_",
"parsed",
"\\u",
"args_",
"._",
"kind_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"client_",
"._",
"create",
"\\u",
"policy_",
"(_",
"body_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zip_",
"(_",
"*_",
"sorted_",
"(_",
"six_",
"._",
"iteritems_",
"(_",
"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_",
"Delete",
"Policy_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Delete",
" ",
"a",
" ",
"policy",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Delete",
"Polic",
"y",
"'_",
")_",
"\\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_",
"Delete",
"Policy_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Delete",
"Policy_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"ID",
" ",
"or",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"policy",
" ",
"to",
" ",
"delete",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Delete",
"Policy_",
"(_",
"command_",
"._",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"client_",
"._",
"delete",
"\\u",
"policy_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"List",
"Polic",
"y",
"Rows_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"List",
" ",
"policy",
" ",
"rows",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"List",
"Polic",
"y",
"Row",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"List",
"Polic",
"y",
"Rows_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"List",
"Polic",
"y",
"Rows_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"the",
" ",
"policy",
" ",
"to",
" ",
"show",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"table",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"table",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Table",
" ",
"to",
" ",
"get",
" ",
"the",
" ",
"policy",
" ",
"rows",
" ",
"from",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"trace",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Display",
" ",
"expl",
"anat",
"ion",
" ",
"of",
" ",
"result",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"List",
"Polic",
"y",
"Rows_",
"(_",
"liste",
"r_",
"._",
"Liste",
"r_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"answer_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy",
"\\u",
"rows_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parsed",
"\\u",
"args_",
"._",
"table_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parsed",
"\\u",
"args_",
"._",
"trace_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"trace",
"'_",
"in_",
"answer_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"stdout_",
"._",
"write_",
"(_",
"answer_",
"[_",
"'",
"trace",
"'_",
"]_",
"+_",
"'\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"results_",
"=_",
"answer_",
"[_",
"'",
"results",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"columns_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"results_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"columns_",
"=_",
"[_",
"'",
"Col",
"%",
"s",
"'_",
"%_",
"(_",
"i_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"0_",
",_",
"len_",
"(_",
"results_",
"[_",
"0_",
"]_",
"[_",
"'",
"data",
"'_",
"]_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"\"",
"Colum",
"ns",
":",
" ",
"\"_",
"+_",
"str_",
"(_",
"columns_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"columns_",
",_",
"(_",
"x_",
"[_",
"'",
"data",
"'_",
"]_",
"for_",
"x_",
"in_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Show",
"Polic",
"y",
"Rule_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Show",
" ",
"a",
" ",
"policy",
" ",
"rule",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Show",
"Polic",
"y",
"Rule",
"'_",
")_",
"\\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_",
"Show",
"Polic",
"y",
"Rule_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Show",
"Polic",
"y",
"Rule_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"policy",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"or",
" ",
"identifi",
"er",
" ",
"of",
" ",
"the",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rule",
"\\u",
"id",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"\"<",
"rule",
"-",
"id",
"/",
"rule",
"-",
"name",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Polic",
"y",
" ",
"rule",
" ",
"id",
" ",
"or",
" ",
"rule",
" ",
"name",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Show",
"Polic",
"y",
"Rule_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy",
"\\u",
"rules_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rule",
"\\u",
"id_",
"=_",
"utils_",
"._",
"get",
"\\u",
"resource",
"\\u",
"id",
"\\u",
"from",
"\\u",
"name_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"parsed",
"\\u",
"args_",
"._",
"rule",
"\\u",
"id_",
",_",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"client_",
"._",
"show",
"\\u",
"policy",
"\\u",
"rule_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
",_",
"rule",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zip_",
"(_",
"*_",
"sorted_",
"(_",
"six_",
"._",
"iteritems_",
"(_",
"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_",
"Show",
"Polic",
"y",
"Table_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Show",
" ",
"policy",
" ",
"table",
" ",
"proper",
"ties",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Show",
"Polic",
"y",
"Table",
"'_",
")_",
"\\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_",
"Show",
"Polic",
"y",
"Table_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Show",
"Polic",
"y",
"Table_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"'<",
"policy",
"-",
"name",
">'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"table",
"\\u",
"id",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"'<",
"table",
"-",
"id",
">'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Table",
" ",
"id",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Show",
"Polic",
"y",
"Table_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"client_",
"._",
"show",
"\\u",
"policy",
"\\u",
"table_",
"(_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parsed",
"\\u",
"args_",
"._",
"table",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zip_",
"(_",
"*_",
"sorted_",
"(_",
"six_",
"._",
"iteritems_",
"(_",
"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_",
"Show",
"Policy_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Show",
" ",
"policy",
" ",
"proper",
"ties",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
"+_",
"'.",
"Show",
"Polic",
"y",
"'_",
")_",
"\\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_",
"Show",
"Policy_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"parser_",
"(_",
"self_",
",_",
"prog",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"super_",
"(_",
"Show",
"Policy_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"parser_",
"(_",
"prog",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"policy",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"metavar_",
"=_",
"'<",
"policy",
"-",
"name",
">'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Name",
" ",
"of",
" ",
"policy",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Show",
"Policy_",
"(_",
"show_",
"._",
"Show",
"One_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"take",
"\\u",
"action",
"(%",
"s",
")'_",
"%_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"self_",
"._",
"app_",
"._",
"client",
"\\u",
"manager_",
"._",
"congr",
"ess",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"client_",
"._",
"list",
"\\u",
"policy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"policy",
"\\u",
"id_",
"=_",
"utils_",
"._",
"get",
"\\u",
"resource",
"\\u",
"id",
"\\u",
"from",
"\\u",
"name_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"parsed",
"\\u",
"args_",
"._",
"policy",
"\\u",
"name_",
",_",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"client_",
"._",
"show",
"\\u",
"policy_",
"(_",
"policy",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zip_",
"(_",
"*_",
"sorted_",
"(_",
"six_",
"._",
"iteritems_",
"(_",
"data_",
")_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
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
] |
Import of deprecated module | ardekantur/pyglet/contrib/layout/layout/locator.py | [
{
"content": "#!/usr/bin/env python\n\n'''Locator classes for retrieving streams from local or net resources.\nTypically take a URI and return a stream. Can be initialised with some\ndata such as a base URI.\n'''\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id: $'\n\nimport urlparse\nimport urllib2\nimport os.path\nimport warnings\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Import_",
"of_",
"deprecated_",
"module_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"Locator",
" ",
"classe",
"s",
" ",
"for",
" ",
"retrie",
"ving",
" ",
"stream",
"s",
" ",
"from",
" ",
"local",
" ",
"or",
" ",
"net",
" ",
"resource",
"s",
".",
"\\",
"10",
";",
"Typical",
"ly",
" ",
"take",
" ",
"a",
" ",
"URI",
" ",
"and",
" ",
"return",
" ",
"a",
" ",
"stream",
".",
" ",
" ",
"Can",
" ",
"be",
" ",
"initialise",
"d",
" ",
"with",
" ",
"some",
"\\",
"10",
";",
"data",
" ",
"suc",
"h",
" ",
"as",
" ",
"a",
" ",
"base",
" ",
"URI",
".",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"docformat",
"\\u\\u_",
"=_",
"'",
"restructur",
"edt",
"ext",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u",
"version\\u\\u_",
"=_",
"'$",
"Id",
":",
" ",
"$'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"urlparse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"urllib2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"._",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"warnings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | diefenbach/django-lfs/lfs/criteria/base.py | [
{
"content": " def save_criteria(self, request):\n \"\"\"\n Saves all passed criteria (via request.POST) to the object.\n \"\"\"\n # First we delete all existing criteria objects for the given object.\n for co in self.get_criteria():\n co.delete()\n\n # Then we add all passed criteria to the object.\n for key, model in request.POST.items():\n if key.startswith(\"type\"):\n try:\n id = key.split(\"-\")[1]\n except KeyError:\n continue\n\n # Get the values for the criterion\n operator = request.POST.get(\"operator-%s\" % id)\n position = request.POST.get(\"position-%s\" % id)\n\n criterion_class = import_symbol(model)\n criterion = criterion_class.objects.create(content=self, operator=operator, position=position)\n\n if criterion.get_value_type() == criterion.MULTIPLE_SELECT:\n value = request.POST.getlist(\"value-%s\" % id)\n else:\n value = request.POST.get(\"value-%s\" % id)\n\n criterion.update(value)",
"metadata": "root.Criteria.save_criteria",
"header": "['class', 'Criteria', '(', 'object', ')', ':', '___EOS___']",
"index": 34
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Criteria",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"save",
"\\u",
"criteria_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Save",
"s",
" ",
"all",
" ",
"pass",
"ed",
" ",
"crite",
"ria",
" ",
"(",
"via",
" ",
"request",
".",
"POST",
")",
" ",
"to",
" ",
"the",
" ",
"object",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Fi",
"rst",
" ",
"we",
" ",
"delete",
" ",
"all",
" ",
"exist",
"ing",
" ",
"crite",
"ria",
" ",
"object",
"s",
" ",
"for",
" ",
"the",
" ",
"give",
"n",
" ",
"object",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"co_",
"in_",
"self_",
"._",
"get",
"\\u",
"criteria_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"co_",
"._",
"delete_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
"n",
" ",
"we",
" ",
"add",
" ",
"all",
" ",
"pass",
"ed",
" ",
"crite",
"ria",
" ",
"to",
" ",
"the",
" ",
"object",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"key_",
",_",
"model_",
"in_",
"request_",
"._",
"POST_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"key_",
"._",
"startswith_",
"(_",
"\"",
"type",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"id_",
"=_",
"key_",
"._",
"split_",
"(_",
"\"-\"_",
")_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"the",
" ",
"values",
" ",
"for",
" ",
"the",
" ",
"criterion_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"operator_",
"=_",
"request_",
"._",
"POST_",
"._",
"get_",
"(_",
"\"",
"opera",
"tor",
"-%",
"s",
"\"_",
"%_",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"position_",
"=_",
"request_",
"._",
"POST_",
"._",
"get_",
"(_",
"\"",
"position",
"-%",
"s",
"\"_",
"%_",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"criterio",
"n",
"\\u",
"class_",
"=_",
"import",
"\\u",
"symbol_",
"(_",
"model_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"criterion_",
"=_",
"criterio",
"n",
"\\u",
"class_",
"._",
"objects_",
"._",
"create_",
"(_",
"content_",
"=_",
"self_",
",_",
"operator_",
"=_",
"operator_",
",_",
"position_",
"=_",
"position_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"criterion_",
"._",
"get",
"\\u",
"value",
"\\u",
"type_",
"(_",
")_",
"==_",
"criterion_",
"._",
"MULTIPLE",
"\\u",
"SELECT",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"value_",
"=_",
"request_",
"._",
"POST_",
"._",
"getlist_",
"(_",
"\"",
"value",
"-%",
"s",
"\"_",
"%_",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Duplicate key in dict literal | ofa/connect/open_connect/context_processors/connect_processor.py | [
{
"content": "def connect_processor(request):\n \"\"\"Connect context processor configured to send simple information\"\"\"\n context = {'brand_title': settings.BRAND_TITLE}\n user = request.user\n\n context['USE_MINIFY'] = settings.USE_MINIFY\n context['icon_prefix'] = settings.ICON_PREFIX\n\n if user.is_authenticated():\n context['nav_items'] = [\n {'label': 'Messages',\n 'link': reverse('threads'), 'class': 'threads'},\n {'label': 'Explore', 'link': reverse('explore')},\n {'label': 'Resources', 'link': reverse('resources')},\n\n ]\n\n context['nav2_items'] = [\n {'label': 'My Profile',\n 'link': reverse('user_profile')},\n {'label': 'Manage My Account',\n 'link': reverse('update_user', args=(user.uuid,))},\n {'label': 'Logout', 'link': reverse('logout')},\n ]\n\n admin_items = []\n # This will need to be changed to find if a user is a moderator\n # once we start allowing non-staff moderators\n if user.can_moderate:\n admin_items.append({\n 'label': 'Message Moderation',\n 'link': reverse('mod_admin')\n })\n admin_items.append({\n 'label': 'Flag Moderation Log',\n 'link': reverse('flag_log')\n })\n admin_items.append({\n 'label': 'Group Moderation',\n 'link': reverse('moderate_requests')\n })\n if user.has_perm('media.can_access_admin_gallery'):\n admin_items.append(\n {'label': 'Admin Gallery', 'link': reverse('admin_gallery')}\n )\n if user.has_perm('media.can_access_popular_urls'):\n admin_items.append(\n {'label': 'Popular URLs', 'link': reverse('url_popularity')}\n )\n if user.has_perm('accounts.add_invite'):\n admin_items.append(\n {'label': 'Invites', 'link': reverse('invites')}\n )\n if user.has_perm('groups.change_category') and user.is_staff:\n admin_items.append(\n {'label': 'Category Admin',\n 'link': reverse('admin:groups_category_changelist')}\n )\n if user.has_perm('accounts.can_view_user_report'):\n admin_items.append({\n 'label': 'User Report', 'link': reverse('users_report')\n })\n if user.has_perm('accounts.can_view_group_report'):\n admin_items.append({\n 'label': 'Group Report', 'link': reverse('groups_report')\n })\n if user.has_perm('taggit.add_tag'):\n admin_items.append(\n {'label': 'Tag Admin',\n 'link': reverse('admin:taggit_tag_changelist')}\n )\n\n if admin_items:\n context['nav_items'].insert(\n -1,\n {'label': 'Admin', 'link': '#', 'menu': admin_items}\n )\n\n else:\n login_url = settings.LOGIN_URL\n\n context['nav_items'] = []\n context['nav2_items'] = [{\n 'label': 'Login',\n 'link': login_url\n }]\n context['login_url'] = login_url\n\n return context",
"metadata": "root.connect_processor",
"header": "['module', '___EOS___']",
"index": 5
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Duplicate",
"_",
"key_",
"in_",
"dict_",
"literal_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"connect",
"\\u",
"processor_",
"(_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Connect",
" ",
"context",
" ",
"process",
"or",
" ",
"configur",
"ed",
" ",
"to",
" ",
"send",
" ",
"simple",
" ",
"informati",
"on",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"=_",
"{_",
"'",
"brand",
"\\u",
"title",
"'_",
":_",
"settings_",
"._",
"BRA",
"ND",
"\\u",
"TITLE_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user_",
"=_",
"request_",
"._",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"context_",
"[_",
"'",
"USE",
"\\u",
"MINI",
"FY",
"'_",
"]_",
"=_",
"settings_",
"._",
"USE",
"\\u",
"MINI",
"FY",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"[_",
"'",
"icon",
"\\u",
"prefix",
"'_",
"]_",
"=_",
"settings_",
"._",
"ICON",
"\\u",
"PREFIX_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"user_",
"._",
"is",
"\\u",
"authenticated_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"nav",
"\\u",
"items",
"'_",
"]_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Messag",
"es",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"thread",
"s",
"'_",
")_",
",_",
"'",
"class",
"'_",
":_",
"'",
"thread",
"s",
"'_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Explo",
"re",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"explore",
"'_",
")_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Reso",
"urc",
"es",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"resource",
"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_",
"context_",
"[_",
"'",
"nav",
"2",
"\\u",
"items",
"'_",
"]_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"My",
" ",
"Profil",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"user",
"\\u",
"profile",
"'_",
")_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Manage",
" ",
"My",
" ",
"Account",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"update",
"\\u",
"user",
"'_",
",_",
"args_",
"=_",
"(_",
"user_",
"._",
"uuid_",
",_",
")_",
")_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Logo",
"ut",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"logo",
"ut",
"'_",
")_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"admin",
"\\u",
"items_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"will",
" ",
"need",
" ",
"to",
" ",
"be",
" ",
"change",
"d",
" ",
"to",
" ",
"find",
" ",
"if",
" ",
"a",
" ",
"user",
" ",
"is",
" ",
"a",
" ",
"moderator",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"onc",
"e",
" ",
"we",
" ",
"start",
" ",
"allow",
"ing",
" ",
"non",
"-",
"sta",
"ff",
" ",
"moderator",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"user_",
"._",
"can",
"\\u",
"moderate",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"label",
"'_",
":_",
"'",
"Messag",
"e",
" ",
"Modera",
"tion",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"mod",
"\\u",
"admin",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"label",
"'_",
":_",
"'",
"Fla",
"g",
" ",
"Modera",
"tion",
" ",
"Log",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"flag",
"\\u",
"log",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"label",
"'_",
":_",
"'",
"Group",
" ",
"Modera",
"tion",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"moderate",
"\\u",
"request",
"s",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"media",
".",
"can",
"\\u",
"access",
"\\u",
"admin",
"\\u",
"gallery",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Admi",
"n",
" ",
"Gallery",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"admin",
"\\u",
"gallery",
"'_",
")_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"media",
".",
"can",
"\\u",
"access",
"\\u",
"popular",
"\\u",
"urls",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Popula",
"r",
" ",
"URL",
"s",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"url",
"\\u",
"popular",
"it",
"y",
"'_",
")_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"account",
"s",
".",
"add",
"\\u",
"invite",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Invite",
"s",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"invite",
"s",
"'_",
")_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"group",
"s",
".",
"change",
"\\u",
"category",
"'_",
")_",
"and_",
"user_",
"._",
"is",
"\\u",
"staff_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Cate",
"gory",
" ",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"admin",
":",
"group",
"s",
"\\u",
"category",
"\\u",
"changeli",
"st",
"'_",
")_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"account",
"s",
".",
"can",
"\\u",
"view",
"\\u",
"user",
"\\u",
"report",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"label",
"'_",
":_",
"'",
"User",
" ",
"Report",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"users",
"\\u",
"report",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"account",
"s",
".",
"can",
"\\u",
"view",
"\\u",
"group",
"\\u",
"report",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"label",
"'_",
":_",
"'",
"Group",
" ",
"Report",
"'_",
",_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"group",
"s",
"\\u",
"report",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"tagg",
"it",
".",
"add",
"\\u",
"tag",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"admin",
"\\u",
"items_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Ta",
"g",
" ",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"reverse_",
"(_",
"'",
"admin",
":",
"tagg",
"it",
"\\u",
"tag",
"\\u",
"changeli",
"st",
"'_",
")_",
"}_",
"\\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_",
"admin",
"\\u",
"items_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"nav",
"\\u",
"items",
"'_",
"]_",
"._",
"insert_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"-_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"label",
"'_",
":_",
"'",
"Admi",
"n",
"'_",
",_",
"'",
"link",
"'_",
":_",
"'#'_",
",_",
"'",
"menu",
"'_",
":_",
"admin",
"\\u",
"items_",
"}_",
"\\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_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"login",
"\\u",
"url_",
"=_",
"settings_",
"._",
"LOGIN",
"\\u",
"URL_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"context_",
"[_",
"'",
"nav",
"\\u",
"items",
"'_",
"]_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"[_",
"'",
"nav",
"2",
"\\u",
"items",
"'_",
"]_",
"=_",
"[_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"label",
"'_",
":_",
"'",
"Logi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"link",
"'_",
":_",
"login",
"\\u",
"url_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"[_",
"'",
"login",
"\\u",
"url",
"'_",
"]_",
"=_",
"login",
"\\u",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"context_"
] | [
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,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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | baseblack/ReproWeb/3rdParty/python/fapws/contrib/sessions.py | [
{
"content": " def getid(self):\n return self.sessiondb.get('sessionid')",
"metadata": "root.Session.getid",
"header": "['class', 'Session', ':', '___EOS___']",
"index": 114
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Session_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"geti",
"d_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"session",
"db_",
"._",
"get_",
"(_",
"'",
"sessionid",
"'_",
")_",
"\\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
] |
Unused local variable | OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_replace2.py | [
{
"content": " def test_replace2(self):\n top = set_as_top(Simulation())\n top.replace('preproc', ScalingPreProc())\n top.replace('postproc', ScalingPostProc())\n top.replace('driver', SLSQPdriver())\n top.replace('comp', Assembly())\n top._setup()",
"metadata": "root.Replace2TestCase.test_replace2",
"header": "['class', 'Replace2TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 10
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Replace",
"2",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"replace",
"2_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"top_",
"=_",
"set\\u",
"as",
"\\u",
"top_",
"(_",
"Simulation_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top_",
"._",
"replace_",
"(_",
"'",
"preproc",
"'_",
",_",
"Sca",
"ling",
"Pre",
"Proc_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top_",
"._",
"replace_",
"(_",
"'",
"postp",
"roc",
"'_",
",_",
"Sca",
"ling",
"Post",
"Proc_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top_",
"._",
"replace_",
"(_",
"'",
"driver",
"'_",
",_",
"SL",
"SQ",
"Pd",
"river",
"_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top_",
"._",
"replace_",
"(_",
"'",
"comp",
"'_",
",_",
"Asse",
"mbly",
"_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top_",
"._",
"\\u",
"setup_",
"(_",
")_",
"\\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
] |
Unused import | matrix-org/synapse/tests/rest/client/v2_alpha/__init__.py | [
{
"content": "# -*- coding: utf-8 -*-\n# Copyright 2015, 2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom tests import unittest\n\nfrom mock import Mock\n\nfrom ....utils import MockHttpResource, setup_test_homeserver\n\nfrom synapse.types import UserID\n\nfrom twisted.internet import defer\n\n\nPATH_PREFIX = \"/_matrix/client/v2_alpha\"\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class V2AlphaRestTestCase(unittest.TestCase):\n # Consumer must define\n # USER_ID = <some string>\n # TO_REGISTER = [<list of REST servlets to register>]\n\n",
"metadata": "root.V2AlphaRestTestCase",
"header": "['module', '___EOS___']",
"index": 29
},
{
"content": " @defer.inlineCallbacks\n def setUp(self):\n self.mock_resource = MockHttpResource(prefix=PATH_PREFIX)\n\n hs = yield setup_test_homeserver(\n datastore=self.make_datastore_mock(),\n http_client=None,\n resource_for_client=self.mock_resource,\n resource_for_federation=self.mock_resource,\n )\n\n def get_user_by_access_token(token=None, allow_guest=False):\n return {\n \"user\": UserID.from_string(self.USER_ID),\n \"token_id\": 1,\n \"is_guest\": False,\n }\n hs.get_auth().get_user_by_access_token = get_user_by_access_token\n\n for r in self.TO_REGISTER:\n r.register_servlets(hs, self.mock_resource)",
"metadata": "root.V2AlphaRestTestCase.setUp",
"header": "['class', 'V2AlphaRestTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# Consumer must define', '___NL___', '# USER_ID = <some string>', '___NL___', '# TO_REGISTER = [<list of REST servlets to register>]', '___NL___', '___EOS___']",
"index": 34
},
{
"content": " def make_datastore_mock(self):\n store = Mock(spec=[\n \"insert_client_ip\",\n ])\n store.get_app_service_by_token = Mock(return_value=None)\n return store",
"metadata": "root.V2AlphaRestTestCase.make_datastore_mock",
"header": "['class', 'V2AlphaRestTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# Consumer must define', '___NL___', '# USER_ID = <some string>', '___NL___', '# TO_REGISTER = [<list of REST servlets to register>]', '___NL___', '___EOS___']",
"index": 56
}
] | [] | [] | 0 | 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",
" ",
"201",
"5",
",",
" ",
"2016",
" ",
"Open",
"Market",
" ",
"Lt",
"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_",
"from_",
"tests_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"mock_",
"import_",
"Mock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"..._",
"._",
"utils_",
"import_",
"Moc",
"k",
"Http",
"Resource_",
",_",
"setup",
"\\u",
"test\\u",
"home",
"server_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"synapse_",
"._",
"types_",
"import_",
"User",
"ID_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"twisted_",
"._",
"internet_",
"import_",
"defer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"PATH",
"\\u",
"PREFIX_",
"=_",
"\"/",
"\\u",
"matrix",
"/",
"client",
"/",
"v2",
"\\u",
"alpha",
"\"_",
"\\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_",
"V2",
"Al",
"pha",
"Rest",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Consume",
"r",
" ",
"must",
" ",
"define_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"USER",
"\\u",
"ID",
" ",
"=",
" ",
"<",
"some",
" ",
"string",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"TO",
"\\u",
"REGISTER",
" ",
"=",
" ",
"[",
"<",
"list",
" ",
"of",
" ",
"REST",
" ",
"serv",
"lets",
" ",
"to",
" ",
"register",
">]",
"_",
"\\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_",
"V2",
"Al",
"pha",
"Rest",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Consume",
"r",
" ",
"must",
" ",
"define_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"USER",
"\\u",
"ID",
" ",
"=",
" ",
"<",
"some",
" ",
"string",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"TO",
"\\u",
"REGISTER",
" ",
"=",
" ",
"[",
"<",
"list",
" ",
"of",
" ",
"REST",
" ",
"serv",
"lets",
" ",
"to",
" ",
"register",
">]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"defer_",
"._",
"inline",
"Callbacks_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"mock",
"\\u",
"resource_",
"=_",
"Moc",
"k",
"Http",
"Resource_",
"(_",
"prefix_",
"=_",
"PATH",
"\\u",
"PREFIX_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"hs_",
"=_",
"yield_",
"setup",
"\\u",
"test\\u",
"home",
"server_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"datastore_",
"=_",
"self_",
"._",
"make",
"\\u",
"datast",
"ore",
"\\u",
"mock_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"client_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"resource",
"\\u",
"for",
"\\u",
"client_",
"=_",
"self_",
"._",
"mock",
"\\u",
"resource_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"resource",
"\\u",
"for",
"\\u",
"federation",
"_",
"=_",
"self_",
"._",
"mock",
"\\u",
"resource_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"user",
"\\u",
"by",
"\\u",
"access",
"\\u",
"token_",
"(_",
"token_",
"=_",
"None_",
",_",
"allow",
"\\u",
"guest_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"user",
"\"_",
":_",
"User",
"ID_",
"._",
"from",
"\\u",
"string_",
"(_",
"self_",
"._",
"USER",
"\\u",
"ID_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"token",
"\\u",
"id",
"\"_",
":_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"is",
"\\u",
"guest",
"\"_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"hs_",
"._",
"get",
"\\u",
"auth_",
"(_",
")_",
"._",
"get",
"\\u",
"user",
"\\u",
"by",
"\\u",
"access",
"\\u",
"token_",
"=_",
"get",
"\\u",
"user",
"\\u",
"by",
"\\u",
"access",
"\\u",
"token_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"r_",
"in_",
"self_",
"._",
"TO",
"\\u",
"REGISTER",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r_",
"._",
"register",
"\\u",
"serv",
"lets",
"_",
"(_",
"hs_",
",_",
"self_",
"._",
"mock",
"\\u",
"resource_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"V2",
"Al",
"pha",
"Rest",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Consume",
"r",
" ",
"must",
" ",
"define_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"USER",
"\\u",
"ID",
" ",
"=",
" ",
"<",
"some",
" ",
"string",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"TO",
"\\u",
"REGISTER",
" ",
"=",
" ",
"[",
"<",
"list",
" ",
"of",
" ",
"REST",
" ",
"serv",
"lets",
" ",
"to",
" ",
"register",
">]",
"_",
"\\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_",
"make",
"\\u",
"datast",
"ore",
"\\u",
"mock_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"store_",
"=_",
"Mock_",
"(_",
"spec_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"insert",
"\\u",
"client",
"\\u",
"ip",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"store_",
"._",
"get",
"\\u",
"app",
"\\u",
"service",
"\\u",
"by",
"\\u",
"token_",
"=_",
"Mock_",
"(_",
"return",
"\\u",
"value_",
"=_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"store_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Except block handles 'BaseException' | fp7-ofelia/ocf/ofam/src/src/foam/api/jsonrpc.py | [
{
"content": " def __init__ (self, key, logger, app):\n self._log = KeyAdapter(key, logger)\n self._app = app\n\n for k in dir(self):\n try:\n val = getattr(self, k)\n (path, methods) = val.route\n except TypeError:\n continue\n except AttributeError:\n continue\n\n try:\n app.add_url_rule(path, path.replace(\"/\", \"_\"), val, methods=methods)\n self._log.debug(\"Added route for: %s with method <%s>\" % (path, k))\n except Exception, e:\n self._log.exception(\"Adding URL Rule\")\n continue",
"metadata": "root.Dispatcher.__init__",
"header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']",
"index": 11
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Dispatcher_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"key_",
",_",
"logger_",
",_",
"app_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"log_",
"=_",
"Key",
"Adapter_",
"(_",
"key_",
",_",
"logger_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"app_",
"=_",
"app_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"k_",
"in_",
"dir_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"val_",
"=_",
"getattr_",
"(_",
"self_",
",_",
"k_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"path_",
",_",
"methods_",
")_",
"=_",
"val_",
"._",
"route_",
"\\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 ",
" _",
"continue_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"add",
"\\u",
"url",
"\\u",
"rule_",
"(_",
"path_",
",_",
"path_",
"._",
"replace_",
"(_",
"\"/\"_",
",_",
"\"\\u\"_",
")_",
",_",
"val_",
",_",
"methods_",
"=_",
"methods_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"log_",
"._",
"debug_",
"(_",
"\"",
"Added",
" ",
"route",
" ",
"for",
":",
" ",
"%",
"s",
" ",
"with",
" ",
"method",
" ",
"<",
"%",
"s",
">\"_",
"%_",
"(_",
"path_",
",_",
"k_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"log_",
"._",
"exception_",
"(_",
"\"",
"Add",
"ing",
" ",
"URL",
" ",
"Rule",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"continue_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Imprecise assert | MongoEngine/mongoengine/tests/all_warnings/__init__.py | [
{
"content": " def test_document_collection_syntax_warning(self):\n\n class NonAbstractBase(Document):\n meta = {'allow_inheritance': True}\n\n class InheritedDocumentFailTest(NonAbstractBase):\n meta = {'collection': 'fail'}\n\n warning = self.warning_list[0]\n self.assertEqual(SyntaxWarning, warning[\"category\"])\n self.assertEqual('non_abstract_base',\n InheritedDocumentFailTest._get_collection_name())",
"metadata": "root.AllWarnings.test_document_collection_syntax_warning",
"header": "['class', 'AllWarnings', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 32
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"All",
"Warnings",
"_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"document",
"\\u",
"collection",
"\\u",
"synta",
"x",
"\\u",
"warning_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"class_",
"Non",
"Abstract",
"Base_",
"(_",
"Document_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"meta_",
"=_",
"{_",
"'",
"allow",
"\\u",
"inherita",
"nce",
"'_",
":_",
"True_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Inherit",
"ed",
"Document",
"Fail",
"Test_",
"(_",
"Non",
"Abstract",
"Base_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"meta_",
"=_",
"{_",
"'",
"collection",
"'_",
":_",
"'",
"fail",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"warning_",
"=_",
"self_",
"._",
"warn",
"ing",
"\\u",
"list_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"Syntax",
"Warning_",
",_",
"warning_",
"[_",
"\"",
"category",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"non",
"\\u",
"abstract",
"\\u",
"base",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Inherit",
"ed",
"Document",
"Fail",
"Test_",
"._",
"\\u",
"get",
"\\u",
"collection",
"\\u",
"name_",
"(_",
")_",
")_"
] | [
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
] |
Unused import | stepank/pyws/examples/_django/manage.py | [
{
"content": "#!/usr/bin/env python\n\nimport os\nimport sys\n\nsys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nimport django\n\nif django.VERSION[:2] <= (1, 5):\n\n from django.core.management import execute_manager\n\n try:\n #noinspection PyUnresolvedReferences\n import settings # Assumed to be in the same directory.\n except ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)\n sys.exit(1)\n\n if __name__ == \"__main__\":\n execute_manager(settings)\n\nelse:\n\n if __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"_django.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sys_",
"._",
"path_",
"._",
"append_",
"(_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"'..'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"django_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"django_",
"._",
"VERSION_",
"[_",
":_",
"2_",
"]_",
"<=_",
"(_",
"1_",
",_",
"5_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"core_",
"._",
"management_",
"import_",
"execute",
"\\u",
"manager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"noin",
"spect",
"ion",
" ",
"Py",
"Unre",
"solved",
"Reference",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"settings_",
"#",
" ",
"Assume",
"d",
" ",
"to",
" ",
"be",
" ",
"in",
" ",
"the",
" ",
"same",
" ",
"director",
"y",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"stderr_",
"._",
"write_",
"(_",
"\"",
"Error",
":",
" ",
"Can",
"'",
"t",
" ",
"find",
" ",
"the",
" ",
"file",
" ",
"'",
"settings",
".",
"py",
"'",
" ",
"in",
" ",
"the",
" ",
"director",
"y",
" ",
"contain",
"ing",
" ",
"%",
"r",
".",
" ",
"It",
" ",
"appear",
"s",
" ",
"you",
"'",
"ve",
" ",
"customize",
"d",
" ",
"thing",
"s",
".\\\\",
"n",
"You",
"'",
"ll",
" ",
"have",
" ",
"to",
" ",
"run",
" ",
"django",
"-",
"admin",
".",
"py",
",",
" ",
"passi",
"ng",
" ",
"it",
" ",
"your",
" ",
"settings",
" ",
"module",
".\\\\",
"n",
"(",
"If",
" ",
"the",
" ",
"file",
" ",
"settings",
".",
"py",
" ",
"doe",
"s",
" ",
"inde",
"ed",
" ",
"exist",
",",
" ",
"it",
"'",
"s",
" ",
"caus",
"ing",
" ",
"an",
" ",
"Import",
"Error",
" ",
"some",
"how",
".)",
"\\\\",
"n",
"\"_",
"%_",
"\\u\\u",
"file\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"execute",
"\\u",
"manager_",
"(_",
"settings_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\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 ",
" _",
"os_",
"._",
"environ_",
"._",
"setdefault_",
"(_",
"\"",
"DJANGO",
"\\u",
"SETTING",
"S",
"\\u",
"MODUL",
"E",
"\"_",
",_",
"\"\\u",
"django",
".",
"settings",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"management_",
"import_",
"execute",
"\\u",
"from",
"\\u",
"command",
"\\u",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"execute",
"\\u",
"from",
"\\u",
"command",
"\\u",
"line_",
"(_",
"sys_",
"._",
"argv_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
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
] |
Unreachable code | Impactstory/total-impact-core/test/unit_tests/test_collection.py | [
{
"content": " def test_calc_table_internals(self):\n # from http://www.milefoot.com/math/stat/ci-medians.htm\n response = collection.calc_confidence_interval_table(9, 0.80, [50])\n assert_equals(response[\"range_sum\"][50], 0.8203125)\n assert_equals(response[\"limits\"][50], (3,7))\n\n # from https://onlinecourses.science.psu.edu/stat414/book/export/html/231\n response = collection.calc_confidence_interval_table(9, 0.90, [50])\n assert_equals(response[\"range_sum\"][50], 0.9609375)\n assert_equals(response[\"limits\"][50], (2,8))\n\n # from https://onlinecourses.science.psu.edu/stat414/book/export/html/231\n response = collection.calc_confidence_interval_table(14, 0.90, [50])\n assert_equals(response[\"range_sum\"][50], 0.942626953125)\n assert_equals(response[\"limits\"][50], (4,11))",
"metadata": "root.TestCollection.test_calc_table_internals",
"header": "['class', 'TestCollection', '(', ')', ':', '___EOS___']",
"index": 368
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Test",
"Collection_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"calc",
"\\u",
"table",
"\\u",
"internals",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"from",
" ",
"http",
"://",
"www",
".",
"mile",
"foot",
".",
"com",
"/",
"math",
"/",
"stat",
"/",
"ci",
"-",
"median",
"s",
".",
"ht",
"m_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"collection_",
"._",
"calc",
"\\u",
"confidence",
"\\u",
"interval",
"\\u",
"table_",
"(_",
"9_",
",_",
"0.80",
"_",
",_",
"[_",
"50_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equals_",
"(_",
"response_",
"[_",
"\"",
"range",
"\\u",
"sum",
"\"_",
"]_",
"[_",
"50_",
"]_",
",_",
"0.82",
"031",
"25_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equals_",
"(_",
"response_",
"[_",
"\"",
"limit",
"s",
"\"_",
"]_",
"[_",
"50_",
"]_",
",_",
"(_",
"3_",
",_",
"7_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"https",
"://",
"onli",
"nec",
"ours",
"es",
".",
"scie",
"nce",
".",
"psu",
".",
"edu",
"/",
"stat",
"414",
"/",
"book",
"/",
"export",
"/",
"html",
"/",
"231_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"collection_",
"._",
"calc",
"\\u",
"confidence",
"\\u",
"interval",
"\\u",
"table_",
"(_",
"9_",
",_",
"0.90",
"_",
",_",
"[_",
"50_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equals_",
"(_",
"response_",
"[_",
"\"",
"range",
"\\u",
"sum",
"\"_",
"]_",
"[_",
"50_",
"]_",
",_",
"0.96",
"093",
"75_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equals_",
"(_",
"response_",
"[_",
"\"",
"limit",
"s",
"\"_",
"]_",
"[_",
"50_",
"]_",
",_",
"(_",
"2_",
",_",
"8_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"https",
"://",
"onli",
"nec",
"ours",
"es",
".",
"scie",
"nce",
".",
"psu",
".",
"edu",
"/",
"stat",
"414",
"/",
"book",
"/",
"export",
"/",
"html",
"/",
"231_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"collection_",
"._",
"calc",
"\\u",
"confidence",
"\\u",
"interval",
"\\u",
"table_",
"(_",
"14_",
",_",
"0.90",
"_",
",_",
"[_",
"50_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equals_",
"(_",
"response_",
"[_",
"\"",
"range",
"\\u",
"sum",
"\"_",
"]_",
"[_",
"50_",
"]_",
",_",
"0.94",
"262",
"695",
"312",
"5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equals_",
"(_",
"response_",
"[_",
"\"",
"limit",
"s",
"\"_",
"]_",
"[_",
"50_",
"]_",
",_",
"(_",
"4_",
",_",
"11_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | spulec/moto/tests/helpers.py | [
{
"content": "from __future__ import unicode_literals\nimport boto\nfrom nose.plugins.skip import SkipTest\nimport six\n\n\n\n\n# Note: See https://github.com/spulec/moto/issues/201 for why this is a separate method.\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def version_tuple(v):\n return tuple(map(int, (v.split(\".\"))))",
"metadata": "root.version_tuple",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": "def skip_test():\n raise SkipTest",
"metadata": "root.skip_test",
"header": "['module', '___EOS___']",
"index": 11
},
{
"content": "class requires_boto_gte(object):\n \"\"\"Decorator for requiring boto version greater than or equal to 'version'\"\"\"\n",
"metadata": "root.requires_boto_gte",
"header": "['module', '___EOS___']",
"index": 15
},
{
"content": " def __init__(self, version):\n self.version = version",
"metadata": "root.requires_boto_gte.__init__",
"header": "['class', 'requires_boto_gte', '(', 'object', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " def __call__(self, test):\n boto_version = version_tuple(boto.__version__)\n required = version_tuple(self.version)\n if boto_version >= required:\n return test\n return skip_test",
"metadata": "root.requires_boto_gte.__call__",
"header": "['class', 'requires_boto_gte', '(', 'object', ')', ':', '___EOS___']",
"index": 20
},
{
"content": "class disable_on_py3(object):",
"metadata": "root.disable_on_py3",
"header": "['module', '___EOS___']",
"index": 28
},
{
"content": " def __call__(self, test):\n if not six.PY3:\n return test\n return skip_test",
"metadata": "root.disable_on_py3.__call__",
"header": "['class', 'disable_on_py3', '(', 'object', ')', ':', '___EOS___']",
"index": 29
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"boto_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nose_",
"._",
"plugins_",
"._",
"skip_",
"import_",
"Ski",
"p",
"Test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"six_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
":",
" ",
"See",
" ",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"spu",
"lec",
"/",
"moto",
"/",
"issue",
"s",
"/",
"201",
" ",
"for",
" ",
"wh",
"y",
" ",
"this",
" ",
"is",
" ",
"a",
" ",
"separate",
" ",
"method",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"version",
"\\u",
"tuple_",
"(_",
"v_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"tuple_",
"(_",
"map_",
"(_",
"int_",
",_",
"(_",
"v_",
"._",
"split_",
"(_",
"\".\"_",
")_",
")_",
")_",
")_",
"\\u\\u\\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_",
"skip",
"\\u",
"test_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Ski",
"p",
"Test_",
"\\u\\u\\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_",
"require",
"s",
"\\u",
"boto",
"\\u",
"gte_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Decorat",
"or",
" ",
"for",
" ",
"requi",
"ring",
" ",
"boto",
" ",
"version",
" ",
"great",
"er",
" ",
"than",
" ",
"or",
" ",
"equal",
" ",
"to",
" ",
"'",
"version",
"'\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"require",
"s",
"\\u",
"boto",
"\\u",
"gte_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"version_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"version_",
"=_",
"version_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"require",
"s",
"\\u",
"boto",
"\\u",
"gte_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"test_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"boto",
"\\u",
"version_",
"=_",
"version",
"\\u",
"tuple_",
"(_",
"boto_",
"._",
"\\u\\u",
"version\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"required_",
"=_",
"version",
"\\u",
"tuple_",
"(_",
"self_",
"._",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"boto",
"\\u",
"version_",
">=_",
"required_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"skip",
"\\u",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"disable",
"\\u",
"on",
"\\u",
"py3",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"disable",
"\\u",
"on",
"\\u",
"py3",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | pastpages/storytracker/setup.py | [
{
"content": "import sys\nfrom setuptools import setup\n\ninstall_requires = [\n 'six>=1.7.2',\n 'python-dateutil>=2.2',\n 'requests>=2.3.0',\n 'htmlmin>=0.1.5',\n 'pytz>=2014.4',\n 'beautifulsoup4>=4.3.2',\n 'storysniffer>=0.0.3',\n 'selenium>=2.42.1',\n 'Pillow>=2.6.0',\n 'latimes-calculate>=0.3.0',\n 'Jinja2>=2.7.3',\n]\n\nif sys.version_info < (3,):\n install_requires.append('unicodecsv>=0.9.4')\n\nsetup(\n name='storytracker',\n version='1.0.1',\n description='Tools for tracking stories for news homepages',\n author='Ben Welsh',\n author_email='[email protected]',\n url='https://github.com/pastpages/storytracker',\n license='MIT',\n packages=('storytracker',),\n include_package_data=True,\n zip_safe=False,\n scripts=(\n 'bin/storytracker-archive',\n 'bin/storytracker-get',\n 'bin/storytracker-links2csv',\n ),\n install_requires=install_requires,\n)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"setuptools_",
"import_",
"setup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"install",
"\\u",
"requires_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"si",
"x",
">=",
"1.7",
".2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"python",
"-",
"date",
"util",
">=",
"2.2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"request",
"s",
">=",
"2.3",
".0",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"html",
"min",
">=",
"0.",
"1.5",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pyt",
"z",
">=",
"2014",
".4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"beautif",
"uls",
"oup",
"4",
">=",
"4.3",
".2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"stor",
"ys",
"nif",
"fer",
">=",
"0.",
"0.",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sele",
"niu",
"m",
">=",
"2.4",
"2.1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Pil",
"low",
">=",
"2.6",
".0",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"lat",
"imes",
"-",
"calcul",
"ate",
">=",
"0.",
"3.0",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Jin",
"ja",
"2",
">=",
"2.7",
".3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"sys_",
"._",
"version",
"\\u",
"info_",
"<_",
"(_",
"3_",
",_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"install",
"\\u",
"requires_",
"._",
"append_",
"(_",
"'",
"unicode",
"csv",
">=",
"0.",
"9.4",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"setup_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"stor",
"ytr",
"acke",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"'",
"1.0",
".1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"'",
"Tool",
"s",
" ",
"for",
" ",
"track",
"ing",
" ",
"stories",
" ",
"for",
" ",
"news",
" ",
"home",
"page",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author_",
"=_",
"'",
"Ben",
" ",
"Wel",
"sh",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author",
"\\u",
"email_",
"=_",
"'",
"ben",
".",
"wel",
"sh",
"@",
"gma",
"il",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"past",
"page",
"s",
"/",
"stor",
"ytr",
"acke",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"license_",
"=_",
"'",
"MIT",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"packages_",
"=_",
"(_",
"'",
"stor",
"ytr",
"acke",
"r",
"'_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"include",
"\\u",
"package",
"\\u",
"data_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"zip",
"\\u",
"safe_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"scripts_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bin",
"/",
"stor",
"ytr",
"acke",
"r",
"-",
"archive",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bin",
"/",
"stor",
"ytr",
"acke",
"r",
"-",
"get",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bin",
"/",
"stor",
"ytr",
"acke",
"r",
"-",
"link",
"s2",
"csv",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"install",
"\\u",
"requires_",
"=_",
"install",
"\\u",
"requires_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | cloudaice/simple-data/misc/virtenv/share/doc/pycurl/examples/retriever-multi.py | [
{
"content": "#! /usr/bin/env python\n# -*- coding: iso-8859-1 -*-\n# vi:ts=4:et\n# $Id$\n\n#\n# Usage: python retriever-multi.py <file with URLs to fetch> [<# of\n# concurrent connections>]\n#\n\nimport sys\nimport pycurl\n\n# We should ignore SIGPIPE when using pycurl.NOSIGNAL - see\n# the libcurl tutorial for more info.\ntry:\n import signal\n from signal import SIGPIPE, SIG_IGN\n signal.signal(signal.SIGPIPE, signal.SIG_IGN)\nexcept ImportError:\n pass\n\n\n# Get args\nnum_conn = 10\ntry:\n if sys.argv[1] == \"-\":\n urls = sys.stdin.readlines()\n else:\n urls = open(sys.argv[1]).readlines()\n if len(sys.argv) >= 3:\n num_conn = int(sys.argv[2])\nexcept:\n print(\"Usage: %s <file with URLs to fetch> [<# of concurrent connections>]\" % sys.argv[0])\n raise SystemExit\n\n\n# Make a queue with (url, filename) tuples\nqueue = []\nfor url in urls:\n url = url.strip()\n if not url or url[0] == \"#\":\n continue\n filename = \"doc_%03d.dat\" % (len(queue) + 1)\n queue.append((url, filename))\n\n\n# Check args\nassert queue, \"no URLs given\"\nnum_urls = len(queue)\nnum_conn = min(num_conn, num_urls)\nassert 1 <= num_conn <= 10000, \"invalid number of concurrent connections\"\nprint(\"PycURL %s (compiled against 0x%x)\" % (pycurl.version, pycurl.COMPILE_LIBCURL_VERSION_NUM))\nprint(\"----- Getting\", num_urls, \"URLs using\", num_conn, \"connections -----\")\n\n\n# Pre-allocate a list of curl objects\nm = pycurl.CurlMulti()\nm.handles = []\nfor i in range(num_conn):\n c = pycurl.Curl()\n c.fp = None\n c.setopt(pycurl.FOLLOWLOCATION, 1)\n c.setopt(pycurl.MAXREDIRS, 5)\n c.setopt(pycurl.CONNECTTIMEOUT, 30)\n c.setopt(pycurl.TIMEOUT, 300)\n c.setopt(pycurl.NOSIGNAL, 1)\n m.handles.append(c)\n\n\n# Main loop\nfreelist = m.handles[:]\nnum_processed = 0\nwhile num_processed < num_urls:\n # If there is an url to process and a free curl object, add to multi stack\n while queue and freelist:\n url, filename = queue.pop(0)\n c = freelist.pop()\n c.fp = open(filename, \"wb\")\n c.setopt(pycurl.URL, url)\n c.setopt(pycurl.WRITEDATA, c.fp)\n m.add_handle(c)\n # store some info\n c.filename = filename\n c.url = url\n # Run the internal curl state machine for the multi stack\n while 1:\n ret, num_handles = m.perform()\n if ret != pycurl.E_CALL_MULTI_PERFORM:\n break\n # Check for curl objects which have terminated, and add them to the freelist\n while 1:\n num_q, ok_list, err_list = m.info_read()\n for c in ok_list:\n c.fp.close()\n c.fp = None\n m.remove_handle(c)\n print(\"Success:\", c.filename, c.url, c.getinfo(pycurl.EFFECTIVE_URL))\n freelist.append(c)\n for c, errno, errmsg in err_list:\n c.fp.close()\n c.fp = None\n m.remove_handle(c)\n print(\"Failed: \", c.filename, c.url, errno, errmsg)\n freelist.append(c)\n num_processed = num_processed + len(ok_list) + len(err_list)\n if num_q == 0:\n break\n # Currently no more I/O is pending, could do something in the meantime\n # (display a progress bar, etc.).\n # We just call select() to sleep until some more data is available.\n m.select(1.0)\n\n\n# Cleanup\nfor c in m.handles:\n if c.fp is not None:\n c.fp.close()\n c.fp = None\n c.close()\nm.close()\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
" ",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"iso",
"-",
"8859",
"-1",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"vi",
":",
"ts",
"=",
"4",
":",
"et_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"$",
"Id",
"$",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Us",
"age",
":",
" ",
"python",
" ",
"retrieve",
"r",
"-",
"multi",
".",
"py",
" ",
"<",
"file",
" ",
"with",
" ",
"URL",
"s",
" ",
"to",
" ",
"fetch",
">",
" ",
"[",
"<",
"#",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"concurrent",
" ",
"connections",
">]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pycurl_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"shou",
"ld",
" ",
"ignore",
" ",
"SIG",
"PIPE",
" ",
"whe",
"n",
" ",
"usi",
"ng",
" ",
"pyc",
"url",
".",
"NOS",
"IGN",
"AL",
" ",
"-",
" ",
"see",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"libc",
"url",
" ",
"tutorial",
" ",
"for",
" ",
"more",
" ",
"info",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"signal_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"signal_",
"import_",
"SIG",
"PIPE_",
",_",
"SIG",
"\\u",
"IGN",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"signal_",
"._",
"signal_",
"(_",
"signal_",
"._",
"SIG",
"PIPE_",
",_",
"signal_",
"._",
"SIG",
"\\u",
"IGN",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"args_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"num",
"\\u",
"conn_",
"=_",
"10_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"sys_",
"._",
"argv_",
"[_",
"1_",
"]_",
"==_",
"\"-\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"urls_",
"=_",
"sys_",
"._",
"stdin_",
"._",
"readlines_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"urls_",
"=_",
"open_",
"(_",
"sys_",
"._",
"argv_",
"[_",
"1_",
"]_",
")_",
"._",
"readlines_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"len_",
"(_",
"sys_",
"._",
"argv_",
")_",
">=_",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"num",
"\\u",
"conn_",
"=_",
"int_",
"(_",
"sys_",
"._",
"argv_",
"[_",
"2_",
"]_",
")_",
"\\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_",
"(_",
"\"",
"Us",
"age",
":",
" ",
"%",
"s",
" ",
"<",
"file",
" ",
"with",
" ",
"URL",
"s",
" ",
"to",
" ",
"fetch",
">",
" ",
"[",
"<",
"#",
" ",
"of",
" ",
"concurrent",
" ",
"connections",
">]",
"\"_",
"%_",
"sys_",
"._",
"argv_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"System",
"Exit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"a",
" ",
"queue",
" ",
"with",
" ",
"(",
"url",
",",
" ",
"filename",
")",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"queue_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"url_",
"in_",
"urls_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"url_",
"=_",
"url_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"url_",
"or_",
"url_",
"[_",
"0_",
"]_",
"==_",
"\"#\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"filename_",
"=_",
"\"",
"doc",
"\\u",
"%",
"03",
"d",
".",
"dat",
"\"_",
"%_",
"(_",
"len_",
"(_",
"queue_",
")_",
"+_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"queue_",
"._",
"append_",
"(_",
"(_",
"url_",
",_",
"filename_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"args_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"queue_",
",_",
"\"",
"no",
" ",
"URL",
"s",
" ",
"give",
"n",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"urls_",
"=_",
"len_",
"(_",
"queue_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"conn_",
"=_",
"min_",
"(_",
"num",
"\\u",
"conn_",
",_",
"num",
"\\u",
"urls_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"1_",
"<=_",
"num",
"\\u",
"conn_",
"<=_",
"10000_",
",_",
"\"",
"invalid",
" ",
"number",
" ",
"of",
" ",
"concurrent",
" ",
"connections",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"\"",
"Py",
"c",
"URL",
" ",
"%",
"s",
" ",
"(",
"compile",
"d",
" ",
"against",
" ",
"0",
"x",
"%",
"x",
")\"_",
"%_",
"(_",
"pycurl_",
"._",
"version_",
",_",
"pycurl_",
"._",
"COMPIL",
"E",
"\\u",
"LIB",
"CUR",
"L",
"\\u",
"VERSI",
"ON",
"\\u",
"NUM_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"\"----",
"-",
" ",
"Get",
"ting",
"\"_",
",_",
"num",
"\\u",
"urls_",
",_",
"\"",
"URL",
"s",
" ",
"usi",
"ng",
"\"_",
",_",
"num",
"\\u",
"conn_",
",_",
"\"",
"connections",
" ",
"-----",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pre",
"-",
"allocate",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"curl",
" ",
"objects_",
"\\u\\u\\uNL\\u\\u\\u_",
"m_",
"=_",
"pycurl_",
"._",
"Curl",
"Multi",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"._",
"handles_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"num",
"\\u",
"conn_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"pycurl_",
"._",
"Curl",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"fp_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"setopt_",
"(_",
"pycurl_",
"._",
"FOL",
"LOW",
"LOCATION_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"setopt_",
"(_",
"pycurl_",
"._",
"MAX",
"RED",
"IR",
"S_",
",_",
"5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"setopt_",
"(_",
"pycurl_",
"._",
"CONNECT",
"TIMEOUT_",
",_",
"30_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"setopt_",
"(_",
"pycurl_",
"._",
"TIMEOUT_",
",_",
"300_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"setopt_",
"(_",
"pycurl_",
"._",
"NOS",
"IGN",
"AL_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"._",
"handles_",
"._",
"append_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Main",
" ",
"loop_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"free",
"list_",
"=_",
"m_",
"._",
"handles_",
"[_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"processed_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"num",
"\\u",
"processed_",
"<_",
"num",
"\\u",
"urls_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"there",
" ",
"is",
" ",
"an",
" ",
"url",
" ",
"to",
" ",
"process",
" ",
"and",
" ",
"a",
" ",
"free",
" ",
"curl",
" ",
"object",
",",
" ",
"add",
" ",
"to",
" ",
"multi",
" ",
"stack_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"queue_",
"and_",
"free",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"url_",
",_",
"filename_",
"=_",
"queue_",
"._",
"pop_",
"(_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"free",
"list_",
"._",
"pop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"fp_",
"=_",
"open_",
"(_",
"filename_",
",_",
"\"",
"wb",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"setopt_",
"(_",
"pycurl_",
"._",
"URL_",
",_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"setopt_",
"(_",
"pycurl_",
"._",
"WRITE",
"DATA_",
",_",
"c_",
"._",
"fp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"._",
"add",
"\\u",
"handle_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"store",
" ",
"some",
" ",
"info_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"filename_",
"=_",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"url_",
"=_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Run",
" ",
"the",
" ",
"internal",
" ",
"curl",
" ",
"state",
" ",
"machine",
" ",
"for",
" ",
"the",
" ",
"multi",
" ",
"stack_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"while_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
",_",
"num",
"\\u",
"handles_",
"=_",
"m_",
"._",
"perform_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"ret_",
"!=_",
"pycurl_",
"._",
"E",
"\\u",
"CALL",
"\\u",
"MULTI",
"\\u",
"PERF",
"ORM",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"for",
" ",
"curl",
" ",
"object",
"s",
" ",
"whi",
"ch",
" ",
"have",
" ",
"terminate",
"d",
",",
" ",
"and",
" ",
"add",
" ",
"them",
" ",
"to",
" ",
"the",
" ",
"free",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"while_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"num",
"\\u",
"q_",
",_",
"ok",
"\\u",
"list_",
",_",
"err",
"\\u",
"list_",
"=_",
"m_",
"._",
"info",
"\\u",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"c_",
"in_",
"ok",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"._",
"fp_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"fp_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"._",
"remove",
"\\u",
"handle_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"\"",
"Success",
":\"_",
",_",
"c_",
"._",
"filename_",
",_",
"c_",
"._",
"url_",
",_",
"c_",
"._",
"getin",
"fo_",
"(_",
"pycurl_",
"._",
"EFFECT",
"IV",
"E",
"\\u",
"URL_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"free",
"list_",
"._",
"append_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"c_",
",_",
"errno_",
",_",
"errmsg_",
"in_",
"err",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"._",
"fp_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"fp_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"._",
"remove",
"\\u",
"handle_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"\"",
"Fail",
"ed",
":",
" ",
"\"_",
",_",
"c_",
"._",
"filename_",
",_",
"c_",
"._",
"url_",
",_",
"errno_",
",_",
"errmsg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"free",
"list_",
"._",
"append_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"num",
"\\u",
"processed_",
"=_",
"num",
"\\u",
"processed_",
"+_",
"len_",
"(_",
"ok",
"\\u",
"list_",
")_",
"+_",
"len_",
"(_",
"err",
"\\u",
"list_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"num",
"\\u",
"q_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Curr",
"ent",
"ly",
" ",
"no",
" ",
"more",
" ",
"I",
"/",
"O",
" ",
"is",
" ",
"pend",
"ing",
",",
" ",
"coul",
"d",
" ",
"do",
" ",
"somet",
"hing",
" ",
"in",
" ",
"the",
" ",
"mean",
"time_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"display",
" ",
"a",
" ",
"progress",
" ",
"bar",
",",
" ",
"etc",
".)",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"just",
" ",
"call",
" ",
"select",
"()",
" ",
"to",
" ",
"sleep",
" ",
"unti",
"l",
" ",
"some",
" ",
"more",
" ",
"data",
" ",
"is",
" ",
"avail",
"able",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"m_",
"._",
"select_",
"(_",
"1.0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Cleanup_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"c_",
"in_",
"m_",
"._",
"handles_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"c_",
"._",
"fp_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"._",
"fp_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"fp_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"c_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"m_",
"._",
"close_",
"(_",
")_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Insecure temporary file | mikr/xcodeprojer/xcodeprojer.py | [
{
"content": "def print_diff(a, b, difftype='unified', filename=None, fp=None):\n\n def write_tempfile(data, **kwargs):\n fd, path = tempfile.mkstemp(**kwargs)\n try:\n os.write(fd, bytestr(data))\n finally:\n os.close(fd)\n return path\n\n if difftype == 'unified':\n print_unified_diff(a, b, fromfile=filename, tofile='', n=3, fp=fp)\n elif difftype == 'html':\n htmldiffer = difflib.HtmlDiff(tabsize=4)\n html = htmldiffer.make_file(unilines(a), unilines(b),\n fromdesc=filename,\n todesc='',\n context=True, numlines=2)\n htmlfilename = write_tempfile(html, suffix='.html', prefix=timestamp())\n reporterror('\\nopen \"%s\"' % htmlfilename, fp=fp)\n elif difftype == 'opendiff':\n outfilename = write_tempfile(b, suffix='.pbxproj', prefix=timestamp())\n reporterror('\\nopendiff \"%s\" \"%s\"' % (filename, outfilename), fp=fp)\n else:\n raise ValueError(\"Unknown difftype: '%s'\" % difftype)",
"metadata": "root.print_diff",
"header": "['module', '___EOS___']",
"index": 1663
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Inse",
"cure",
"_",
"temporar",
"y_",
"file_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"print",
"\\u",
"diff_",
"(_",
"a_",
",_",
"b_",
",_",
"diff",
"type_",
"=_",
"'",
"unifie",
"d",
"'_",
",_",
"filename_",
"=_",
"None_",
",_",
"fp_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"write",
"\\u",
"tempfile_",
"(_",
"data_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fd_",
",_",
"path_",
"=_",
"tempfile_",
"._",
"mkstemp_",
"(_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"write_",
"(_",
"fd_",
",_",
"bytestr",
"_",
"(_",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"finally_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"close_",
"(_",
"fd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"diff",
"type_",
"==_",
"'",
"unifie",
"d",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print",
"\\u",
"unifie",
"d\\u",
"diff_",
"(_",
"a_",
",_",
"b_",
",_",
"fromfile_",
"=_",
"filename_",
",_",
"tofi",
"le_",
"=_",
"''_",
",_",
"n_",
"=_",
"3_",
",_",
"fp_",
"=_",
"fp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"diff",
"type_",
"==_",
"'",
"html",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"html",
"differ",
"_",
"=_",
"difflib",
"_",
"._",
"Ht",
"ml",
"Diff_",
"(_",
"tabs",
"ize_",
"=_",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"html_",
"=_",
"html",
"differ",
"_",
"._",
"make",
"\\u",
"file_",
"(_",
"uni",
"lines_",
"(_",
"a_",
")_",
",_",
"uni",
"lines_",
"(_",
"b_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"from",
"desc_",
"=_",
"filename_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"tod",
"esc_",
"=_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"context_",
"=_",
"True_",
",_",
"num",
"lines_",
"=_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"html",
"filename_",
"=_",
"write",
"\\u",
"tempfile_",
"(_",
"html_",
",_",
"suffix_",
"=_",
"'.",
"html",
"'_",
",_",
"prefix_",
"=_",
"timestamp_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reporter",
"ror_",
"(_",
"'\\\\",
"nop",
"en",
" ",
"\"%",
"s",
"\"'_",
"%_",
"html",
"filename_",
",_",
"fp_",
"=_",
"fp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"diff",
"type_",
"==_",
"'",
"opend",
"iff",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"outfilename",
"_",
"=_",
"write",
"\\u",
"tempfile_",
"(_",
"b_",
",_",
"suffix_",
"=_",
"'.",
"pb",
"xpr",
"oj",
"'_",
",_",
"prefix_",
"=_",
"timestamp_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reporter",
"ror_",
"(_",
"'\\\\",
"nop",
"endi",
"ff",
" ",
"\"%",
"s",
"\"",
" ",
"\"%",
"s",
"\"'_",
"%_",
"(_",
"filename_",
",_",
"outfilename",
"_",
")_",
",_",
"fp_",
"=_",
"fp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Un",
"know",
"n",
" ",
"diff",
"type",
":",
" ",
"'%",
"s",
"'\"_",
"%_",
"diff",
"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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unnecessary pass | cloudera/hue/apps/beeswax/src/beeswax/hive_site.py | [
{
"content": "class MalformedHiveSiteException(Exception):\n \"\"\"Parsing error class used internally\"\"\"\n pass",
"metadata": "root.MalformedHiveSiteException",
"header": "['module', '___EOS___']",
"index": 59
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"pass_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Mal",
"formed",
"Hi",
"ve",
"Site",
"Exception_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Pars",
"ing",
" ",
"error",
" ",
"class",
" ",
"used",
" ",
"internal",
"ly",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | celery/kombu/kombu/async/aws/connection.py | [
{
"content": " def request(self, method, path, body=None, headers=None):\n self.path = path\n self.method = method\n if body is not None:\n try:\n read = body.read\n except AttributeError:\n self.body = body\n else:\n self.body = read()\n if headers is not None:\n self.headers.extend(list(items(headers)))",
"metadata": "root.AsyncHTTPConnection.request",
"header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']",
"index": 97
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Async",
"HTTP",
"Connection_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"request_",
"(_",
"self_",
",_",
"method_",
",_",
"path_",
",_",
"body_",
"=_",
"None_",
",_",
"headers_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"path_",
"=_",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"method_",
"=_",
"method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"body_",
"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 ",
" _",
"read_",
"=_",
"body_",
"._",
"read_",
"\\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 ",
" _",
"self_",
"._",
"body_",
"=_",
"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 ",
" _",
"self_",
"._",
"body_",
"=_",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"headers_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"headers_",
"._",
"extend_",
"(_",
"list_",
"(_",
"items_",
"(_",
"headers_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | openstack/fuel-web/nailgun/nailgun/extensions/network_manager/validators/ip_addr.py | [
{
"content": " @classmethod\n def validate_create(cls, data, cluster):\n if isinstance(data, six.string_types):\n data = cls.validate_json(data)\n\n cls.validate_schema(data, ip_addr.VIP_CREATE_SCHEMA)\n\n if data.get('is_user_defined') is False:\n raise errors.InvalidData(\n \"'is_user_defined' flag must be set to true for \"\n \"manually created VIPs\"\n )\n\n cls._check_vip_name(data, cluster)\n\n network_id = data[\"network\"]\n network_db = objects.NetworkGroup.get_by_uid(network_id)\n\n if network_db is None:\n raise errors.InvalidData(\n \"Network group with id {0} is not found\"\n .format(data['network'])\n )\n\n if network_db.nodegroup is None:\n raise errors.InvalidData(\n \"Network group with id {0} is not currently assigned to any \"\n \"nodegroup\".format(network_db.id)\n )\n\n if network_db.nodegroup.cluster_id != cluster.id:\n raise errors.InvalidData(\n \"VIP cannot be created \"\n \"as there is no network with id {0} assigned to any \"\n \"of nodegroups of cluster with id {1}\"\n .format(network_id, cluster.id)\n )\n\n ip_db = objects.IPAddrCollection.get_all_by_addr(data['ip_addr'])\\\n .first()\n if ip_db is not None:\n raise errors.InvalidData(\n \"VIP cannot be created as ip address {0} is already in use\"\n .format(data['ip_addr'])\n )\n\n return data",
"metadata": "root.IPAddrValidator.validate_create",
"header": "['class', 'IPAddrValidator', '(', 'BasicValidator', ')', ':', '___EOS___']",
"index": 51
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"IPA",
"ddr",
"Validator_",
"(_",
"Basic",
"Validator_",
")_",
":_",
"\\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_",
"validat",
"e\\u",
"create_",
"(_",
"cls_",
",_",
"data_",
",_",
"cluster_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"data_",
",_",
"six_",
"._",
"string",
"\\u",
"types_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"cls_",
"._",
"validat",
"e\\u",
"json_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cls_",
"._",
"validat",
"e\\u",
"schema_",
"(_",
"data_",
",_",
"ip",
"\\u",
"addr_",
"._",
"VI",
"P",
"\\u",
"CREATE",
"\\u",
"SCHEMA_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"data_",
"._",
"get_",
"(_",
"'",
"is",
"\\u",
"user",
"\\u",
"defin",
"ed",
"'_",
")_",
"is_",
"False_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"errors_",
"._",
"Inva",
"lid",
"Data_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"'",
"is",
"\\u",
"user",
"\\u",
"defin",
"ed",
"'",
" ",
"flag",
" ",
"must",
" ",
"be",
" ",
"set",
" ",
"to",
" ",
"true",
" ",
"for",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"manu",
"ally",
" ",
"created",
" ",
"VI",
"Ps",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cls_",
"._",
"\\u",
"check",
"\\u",
"vip",
"\\u",
"name_",
"(_",
"data_",
",_",
"cluster_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"network",
"\\u",
"id_",
"=_",
"data_",
"[_",
"\"",
"network",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"network",
"\\u",
"db_",
"=_",
"objects_",
"._",
"Network",
"Group_",
"._",
"get",
"\\u",
"by",
"\\u",
"uid_",
"(_",
"network",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"network",
"\\u",
"db_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"errors_",
"._",
"Inva",
"lid",
"Data_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Network",
" ",
"group",
" ",
"with",
" ",
"id",
" ",
"{",
"0",
"}",
" ",
"is",
" ",
"not",
" ",
"found",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"data_",
"[_",
"'",
"network",
"'_",
"]_",
")_",
"\\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_",
"network",
"\\u",
"db_",
"._",
"node",
"group_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"errors_",
"._",
"Inva",
"lid",
"Data_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Network",
" ",
"group",
" ",
"with",
" ",
"id",
" ",
"{",
"0",
"}",
" ",
"is",
" ",
"not",
" ",
"currentl",
"y",
" ",
"assign",
"ed",
" ",
"to",
" ",
"any",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"node",
"group",
"\"_",
"._",
"format_",
"(_",
"network",
"\\u",
"db_",
"._",
"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_",
"if_",
"network",
"\\u",
"db_",
"._",
"node",
"group_",
"._",
"cluster",
"\\u",
"id_",
"!=_",
"cluster_",
"._",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"errors_",
"._",
"Inva",
"lid",
"Data_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"VI",
"P",
" ",
"cann",
"ot",
" ",
"be",
" ",
"created",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"as",
" ",
"there",
" ",
"is",
" ",
"no",
" ",
"network",
" ",
"with",
" ",
"id",
" ",
"{",
"0",
"}",
" ",
"assign",
"ed",
" ",
"to",
" ",
"any",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"of",
" ",
"node",
"group",
"s",
" ",
"of",
" ",
"cluster",
" ",
"with",
" ",
"id",
" ",
"{",
"1",
"}\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"network",
"\\u",
"id_",
",_",
"cluster_",
"._",
"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_",
"ip",
"\\u",
"db_",
"=_",
"objects_",
"._",
"IPA",
"ddr",
"Collection_",
"._",
"get",
"\\u",
"all",
"\\u",
"by",
"\\u",
"addr_",
"(_",
"data_",
"[_",
"'",
"ip",
"\\u",
"addr",
"'_",
"]_",
")_",
"._",
"first_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"ip",
"\\u",
"db_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"errors_",
"._",
"Inva",
"lid",
"Data_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"VI",
"P",
" ",
"cann",
"ot",
" ",
"be",
" ",
"created",
" ",
"as",
" ",
"ip",
" ",
"address",
" ",
"{",
"0",
"}",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"in",
" ",
"use",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"data_",
"[_",
"'",
"ip",
"\\u",
"addr",
"'_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | dimagi/commcare-hq/corehq/apps/accounting/emails.py | [
{
"content": "def send_subscription_change_alert(domain, new_subscription, old_subscription, internal_change):\n\n billing_account = (\n new_subscription.account if new_subscription else\n old_subscription.account if old_subscription else None\n )\n # this can be None, though usually this will be initiated\n # by an http request\n request = get_request()\n email_context = {\n 'domain': domain,\n 'domain_url': get_default_domain_url(domain),\n 'old_plan': old_subscription.plan_version if old_subscription else None,\n 'new_plan': new_subscription.plan_version if new_subscription else None,\n 'old_subscription': old_subscription,\n 'new_subscription': new_subscription,\n 'billing_account': billing_account,\n 'username': request.couch_user.username if getattr(request, 'couch_user', None) else None,\n 'referer': request.META.get('HTTP_REFERER') if request else None,\n }\n email_subject = \"{env}Subscription Change Alert: {domain} from {old_plan} to {new_plan}\".format(\n env=(\"[{}] \".format(settings.SERVER_ENVIRONMENT.upper())\n if settings.SERVER_ENVIRONMENT == \"staging\" else \"\"),\n domain=email_context['domain'],\n old_plan=email_context['old_plan'],\n new_plan=email_context['new_plan'],\n )\n\n sub_change_email_address = (settings.INTERNAL_SUBSCRIPTION_CHANGE_EMAIL\n if internal_change else settings.SUBSCRIPTION_CHANGE_EMAIL)\n\n send_html_email_async.delay(\n email_subject,\n sub_change_email_address,\n render_to_string('accounting/subscription_change_email.html', email_context),\n text_content=render_to_string('accounting/subscription_change_email.txt', email_context),\n )",
"metadata": "root.send_subscription_change_alert",
"header": "['module', '___EOS___']",
"index": 7
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"send",
"\\u",
"subscript",
"ion",
"\\u",
"change",
"\\u",
"alert_",
"(_",
"domain_",
",_",
"new",
"\\u",
"subscription_",
",_",
"old",
"\\u",
"subscription_",
",_",
"internal",
"\\u",
"change_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bill",
"ing",
"\\u",
"account_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"subscription_",
"._",
"account_",
"if_",
"new",
"\\u",
"subscription_",
"else_",
"\\u\\u\\uNL\\u\\u\\u_",
"old",
"\\u",
"subscription_",
"._",
"account_",
"if_",
"old",
"\\u",
"subscription_",
"else_",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"this",
" ",
"can",
" ",
"be",
" ",
"Non",
"e",
",",
" ",
"tho",
"ugh",
" ",
"usual",
"ly",
" ",
"this",
" ",
"will",
" ",
"be",
" ",
"initiate",
"d_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"by",
" ",
"an",
" ",
"http",
" ",
"request_",
"\\u\\u\\uNL\\u\\u\\u_",
"request_",
"=_",
"get",
"\\u",
"request_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"email",
"\\u",
"context_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"domain",
"'_",
":_",
"domain_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"domain",
"\\u",
"url",
"'_",
":_",
"get",
"\\u",
"default",
"\\u",
"domain",
"\\u",
"url_",
"(_",
"domain_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"old",
"\\u",
"plan",
"'_",
":_",
"old",
"\\u",
"subscription_",
"._",
"plan",
"\\u",
"version_",
"if_",
"old",
"\\u",
"subscription_",
"else_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"new",
"\\u",
"plan",
"'_",
":_",
"new",
"\\u",
"subscription_",
"._",
"plan",
"\\u",
"version_",
"if_",
"new",
"\\u",
"subscription_",
"else_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"old",
"\\u",
"subscript",
"ion",
"'_",
":_",
"old",
"\\u",
"subscription_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"new",
"\\u",
"subscript",
"ion",
"'_",
":_",
"new",
"\\u",
"subscription_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bill",
"ing",
"\\u",
"account",
"'_",
":_",
"bill",
"ing",
"\\u",
"account_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"request_",
"._",
"couch",
"\\u",
"user_",
"._",
"username_",
"if_",
"getattr_",
"(_",
"request_",
",_",
"'",
"couch",
"\\u",
"user",
"'_",
",_",
"None_",
")_",
"else_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"refere",
"r",
"'_",
":_",
"request_",
"._",
"META_",
"._",
"get_",
"(_",
"'",
"HTTP",
"\\u",
"REFE",
"RER",
"'_",
")_",
"if_",
"request_",
"else_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"email",
"\\u",
"subject_",
"=_",
"\"{",
"env",
"}",
"Subscription",
" ",
"Change",
" ",
"Alert",
":",
" ",
"{",
"domain",
"}",
" ",
"from",
" ",
"{",
"old",
"\\u",
"plan",
"}",
" ",
"to",
" ",
"{",
"new",
"\\u",
"plan",
"}\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"env_",
"=_",
"(_",
"\"[{",
"}]",
" ",
"\"_",
"._",
"format_",
"(_",
"settings_",
"._",
"SERVER",
"\\u",
"ENVIRONMENT",
"_",
"._",
"upper_",
"(_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"settings_",
"._",
"SERVER",
"\\u",
"ENVIRONMENT",
"_",
"==_",
"\"",
"staging",
"\"_",
"else_",
"\"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"domain_",
"=_",
"email",
"\\u",
"context_",
"[_",
"'",
"domain",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"old",
"\\u",
"plan_",
"=_",
"email",
"\\u",
"context_",
"[_",
"'",
"old",
"\\u",
"plan",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"plan_",
"=_",
"email",
"\\u",
"context_",
"[_",
"'",
"new",
"\\u",
"plan",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sub\\u",
"change",
"\\u",
"email",
"\\u",
"address_",
"=_",
"(_",
"settings_",
"._",
"INTERN",
"AL",
"\\u",
"SUBSCRI",
"PTION",
"\\u",
"CHANGE",
"\\u",
"EMAIL_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"internal",
"\\u",
"change_",
"else_",
"settings_",
"._",
"SUBSCRI",
"PTION",
"\\u",
"CHANGE",
"\\u",
"EMAIL_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"html",
"\\u",
"email",
"\\u",
"async_",
"._",
"delay_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"email",
"\\u",
"subject_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sub\\u",
"change",
"\\u",
"email",
"\\u",
"address_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"'",
"accounti",
"ng",
"/",
"subscript",
"ion",
"\\u",
"change",
"\\u",
"email",
".",
"html",
"'_",
",_",
"email",
"\\u",
"context_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"text",
"\\u",
"content_",
"=_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"'",
"accounti",
"ng",
"/",
"subscript",
"ion",
"\\u",
"change",
"\\u",
"email",
".",
"txt",
"'_",
",_",
"email",
"\\u",
"context_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | django-extensions/django-extensions/django_extensions/management/commands/runserver_plus.py | [
{
"content": "class Command(BaseCommand):\n help = \"Starts a lightweight Web server for development.\"\n args = '[optional port number, or ipaddr:port]'\n\n # Validation is called explicitly each time the server is reloaded.\n requires_system_checks = False\n\n\n",
"metadata": "root.Command",
"header": "['module', '___EOS___']",
"index": 50
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Command_",
"(_",
"Base",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"help_",
"=_",
"\"",
"Start",
"s",
" ",
"a",
" ",
"light",
"weight",
" ",
"Web",
" ",
"server",
" ",
"for",
" ",
"develop",
"ment",
".\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"'[",
"option",
"al",
" ",
"port",
" ",
"number",
",",
" ",
"or",
" ",
"ipadd",
"r",
":",
"port",
"]'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Validat",
"ion",
" ",
"is",
" ",
"call",
"ed",
" ",
"explicit",
"ly",
" ",
"each",
" ",
"time",
" ",
"the",
" ",
"server",
" ",
"is",
" ",
"reloade",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"require",
"s",
"\\u",
"system",
"\\u",
"checks_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_"
] | [
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
] |
Unused import | gkmngrgn/radpress/demo/demo/urls.py | [
{
"content": "from django.conf import settings\nfrom django.conf.urls import patterns, include\nfrom django.conf.urls.static import static\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns(\n '',\n\n (r'^admin/doc/', include('django.contrib.admindocs.urls')),\n (r'^admin/', include(admin.site.urls)),\n (r'^', include('radpress.urls'))\n) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"._",
"urls_",
"import_",
"patterns_",
",_",
"include_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"._",
"urls_",
"._",
"static_",
"import_",
"static_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"import_",
"admin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin_",
"._",
"autodiscover",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"urlpatterns_",
"=_",
"patterns_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"r",
"'",
"^",
"admin",
"/",
"doc",
"/'_",
",_",
"include_",
"(_",
"'",
"django",
".",
"contrib",
".",
"admin",
"docs",
".",
"urls",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"r",
"'",
"^",
"admin",
"/'_",
",_",
"include_",
"(_",
"admin_",
"._",
"site_",
"._",
"urls_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"r",
"'",
"^",
"'_",
",_",
"include_",
"(_",
"'",
"rad",
"press",
".",
"urls",
"'_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"+_",
"static_",
"(_",
"settings_",
"._",
"MEDIA",
"\\u",
"URL_",
",_",
"document",
"\\u",
"root_",
"=_",
"settings_",
"._",
"MEDIA",
"\\u",
"ROOT_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | saltstack/salt/salt/modules/beacons.py | [
{
"content": "def enable_beacon(name, **kwargs):\n '''\n Enable beacon on the minion\n\n :name: Name of the beacon to enable.\n :return: Boolean and status message on success or failure of enable.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' beacons.enable_beacon ps\n '''\n\n ret = {'comment': [],\n 'result': True}\n\n if not name:\n ret['comment'] = 'Beacon name is required.'\n ret['result'] = False\n return ret\n\n if 'test' in kwargs and kwargs['test']:\n ret['comment'] = 'Beacon {0} would be enabled.'.format(name)\n else:\n _beacons = list_(return_yaml=False)\n if name not in _beacons:\n ret['comment'] = 'Beacon {0} is not currently configured.'.format(name)\n ret['result'] = False\n return ret\n\n try:\n eventer = salt.utils.event.get_event('minion', opts=__opts__)\n res = __salt__['event.fire']({'func': 'enable_beacon', 'name': name}, 'manage_beacons')\n if res:\n event_ret = eventer.get_event(tag='/salt/minion/minion_beacon_enabled_complete', wait=30)\n if event_ret and event_ret['complete']:\n beacons = event_ret['beacons']\n beacon_config_dict = _get_beacon_config_dict(beacons[name])\n\n if 'enabled' in beacon_config_dict and beacon_config_dict['enabled']:\n ret['result'] = True\n ret['comment'] = 'Enabled beacon {0} on minion.'.format(name)\n else:\n ret['result'] = False\n ret['comment'] = 'Failed to enable beacon {0} on minion.'.format(name)\n return ret\n except KeyError:\n # Effectively a no-op, since we can't really return without an event system\n ret['comment'] = 'Event module not available. Beacon enable job failed.'\n return ret",
"metadata": "root.enable_beacon",
"header": "['module', '___EOS___']",
"index": 387
}
] | [] | [] | 0 | 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_",
"enable",
"\\u",
"beacon",
"_",
"(_",
"name_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Enable",
" ",
"beacon",
" ",
"on",
" ",
"the",
" ",
"minion",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"name",
":",
" ",
" ",
" ",
" ",
" ",
" ",
"Name",
" ",
"of",
" ",
"the",
" ",
"beacon",
" ",
"to",
" ",
"enable",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
" ",
" ",
" ",
"Boo",
"lean",
" ",
"and",
" ",
"status",
" ",
"message",
" ",
"on",
" ",
"success",
" ",
"or",
" ",
"fail",
"ure",
" ",
"of",
" ",
"enable",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"CLI",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"code",
"-",
"block",
"::",
" ",
"bash",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"salt",
" ",
"'*",
"'",
" ",
"beacon",
"s",
".",
"enable",
"\\u",
"beacon",
" ",
"ps",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ret_",
"=_",
"{_",
"'",
"comment",
"'_",
":_",
"[_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"result",
"'_",
":_",
"True_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"[_",
"'",
"comment",
"'_",
"]_",
"=_",
"'",
"Bea",
"con",
" ",
"name",
" ",
"is",
" ",
"require",
"d",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"[_",
"'",
"result",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"ret_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"test",
"'_",
"in_",
"kwargs_",
"and_",
"kwargs_",
"[_",
"'",
"test",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"[_",
"'",
"comment",
"'_",
"]_",
"=_",
"'",
"Bea",
"con",
" ",
"{",
"0",
"}",
" ",
"wou",
"ld",
" ",
"be",
" ",
"enable",
"d",
".'_",
"._",
"format_",
"(_",
"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 ",
" _",
"\\u",
"beacon",
"s_",
"=_",
"list\\u_",
"(_",
"return",
"\\u",
"yaml_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"name_",
"not_",
"in_",
"\\u",
"beacon",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"[_",
"'",
"comment",
"'_",
"]_",
"=_",
"'",
"Bea",
"con",
" ",
"{",
"0",
"}",
" ",
"is",
" ",
"not",
" ",
"currentl",
"y",
" ",
"configur",
"ed",
".'_",
"._",
"format_",
"(_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"[_",
"'",
"result",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"ret_",
"\\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",
"er_",
"=_",
"salt_",
"._",
"utils_",
"._",
"event_",
"._",
"get",
"\\u",
"event_",
"(_",
"'",
"minion",
"'_",
",_",
"opts_",
"=_",
"\\u\\u",
"opts",
"\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"res_",
"=_",
"\\u\\u",
"salt\\u\\u_",
"[_",
"'",
"event",
".",
"fire",
"'_",
"]_",
"(_",
"{_",
"'",
"func",
"'_",
":_",
"'",
"enable",
"\\u",
"beacon",
"'_",
",_",
"'",
"name",
"'_",
":_",
"name_",
"}_",
",_",
"'",
"manage",
"\\u",
"beacon",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"res_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event",
"\\u",
"ret_",
"=_",
"event",
"er_",
"._",
"get",
"\\u",
"event_",
"(_",
"tag_",
"=_",
"'/",
"salt",
"/",
"minion",
"/",
"minion",
"\\u",
"beacon",
"\\u",
"enable",
"d\\u",
"complete",
"'_",
",_",
"wait_",
"=_",
"30_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"event",
"\\u",
"ret_",
"and_",
"event",
"\\u",
"ret_",
"[_",
"'",
"complete",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"beacon",
"s_",
"=_",
"event",
"\\u",
"ret_",
"[_",
"'",
"beacon",
"s",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"beacon",
"\\u",
"config",
"\\u",
"dict_",
"=_",
"\\u",
"get",
"\\u",
"beacon",
"\\u",
"config",
"\\u",
"dict_",
"(_",
"beacon",
"s_",
"[_",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"enable",
"d",
"'_",
"in_",
"beacon",
"\\u",
"config",
"\\u",
"dict_",
"and_",
"beacon",
"\\u",
"config",
"\\u",
"dict_",
"[_",
"'",
"enable",
"d",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"ret_",
"[_",
"'",
"result",
"'_",
"]_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"[_",
"'",
"comment",
"'_",
"]_",
"=_",
"'",
"Enable",
"d",
" ",
"beacon",
" ",
"{",
"0",
"}",
" ",
"on",
" ",
"minion",
".'_",
"._",
"format_",
"(_",
"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 ",
" ",
" _",
"ret_",
"[_",
"'",
"result",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"[_",
"'",
"comment",
"'_",
"]_",
"=_",
"'",
"Fail",
"ed",
" ",
"to",
" ",
"enable",
" ",
"beacon",
" ",
"{",
"0",
"}",
" ",
"on",
" ",
"minion",
".'_",
"._",
"format_",
"(_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"ret_",
"\\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_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Effe",
"ctive",
"ly",
" ",
"a",
" ",
"no",
"-",
"op",
",",
" ",
"sinc",
"e",
" ",
"we",
" ",
"can",
"'",
"t",
" ",
"reall",
"y",
" ",
"return",
" ",
"with",
"out",
" ",
"an",
" ",
"event",
" ",
"system_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"[_",
"'",
"comment",
"'_",
"]_",
"=_",
"'",
"Event",
" ",
"module",
" ",
"not",
" ",
"avail",
"able",
".",
" ",
"Bea",
"con",
" ",
"enable",
" ",
"job",
" ",
"fail",
"ed",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\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
] |
Unused local variable | ceph/ceph-deploy/ceph_deploy/exc.py | [
{
"content": " def __str__(self):\n doc = self.__doc__.strip()\n return ': '.join([doc] + [str(a) for a in self.args])",
"metadata": "root.DeployError.__str__",
"header": "['class', 'DeployError', '(', 'Exception', ')', ':', '___EOS___']",
"index": 5
},
{
"content": " def __str__(self):\n return self.message",
"metadata": "root.ClusterNameError.__str__",
"header": "['class', 'ClusterNameError', '(', 'DeployError', ')', ':', '___EOS___']",
"index": 106
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Deploy",
"Error_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"str\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"doc_",
"=_",
"self_",
"._",
"\\u\\u",
"doc\\u\\u_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"':",
" ",
"'_",
"._",
"join_",
"(_",
"[_",
"doc_",
"]_",
"+_",
"[_",
"str_",
"(_",
"a_",
")_",
"for_",
"a_",
"in_",
"self_",
"._",
"args_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cluster",
"Name",
"Error_",
"(_",
"Deploy",
"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_",
"self_",
"._",
"message_",
"\\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,
4,
2,
2,
2,
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 | denizalti/concoord/concoord/clientproxy.py | [
{
"content": " def reconfigure(self):\n if not self.trynewbootstrap():\n raise ConnectionError(\"Cannot connect to any bootstrap\")",
"metadata": "root.ClientProxy.reconfigure",
"header": "['class', 'ClientProxy', '(', ')', ':', '___EOS___']",
"index": 155
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Client",
"Proxy_",
"(_",
")_",
":_",
"\\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_",
"reconfigur",
"e_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"try",
"newb",
"oot",
"stra",
"p_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Connect",
"ion",
"Error_",
"(_",
"\"",
"Cann",
"ot",
" ",
"connect",
" ",
"to",
" ",
"any",
" ",
"boots",
"trap",
"\"_",
")_",
"\\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
] |
Unused import | openstack/rack/rack/netconf.py | [
{
"content": "# Copyright (c) 2014 ITOCHU Techno-Solutions Corporation.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport socket\n\nfrom oslo.config import cfg\n\nfrom rack import utils\n\nCONF = cfg.CONF\n\n\n\n\nnetconf_opts = [\n cfg.StrOpt('my_ip',\n default=_get_my_ip(),\n help='IP address of this host'),\n cfg.StrOpt('host',\n default=socket.gethostname(),\n help='Name of this node. This can be an opaque identifier. '\n 'It is not necessarily a hostname, FQDN, or IP address. '\n 'However, the node name must be valid within '\n 'an AMQP key, and if using ZeroMQ, a valid '\n 'hostname, FQDN, or IP address'),\n cfg.BoolOpt('use_ipv6',\n default=False,\n help='Use IPv6'),\n]\n\nCONF.register_opts(netconf_opts)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def _get_my_ip():\n \"\"\"Returns the actual ip of the local machine.\n\n This code figures out what source address would be used if some traffic\n were to be sent out to some well known address on the Internet. In this\n case, a Google DNS server is used, but the specific address does not\n matter much. No traffic is actually sent.\n \"\"\"\n try:\n csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n csock.connect(('8.8.8.8', 80))\n (addr, port) = csock.getsockname()\n csock.close()\n return addr\n except socket.error:\n return utils.get_my_ipv4_address()",
"metadata": "root._get_my_ip",
"header": "['module', '___EOS___']",
"index": 23
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2014",
" ",
"IT",
"OC",
"HU",
" ",
"Techno",
"-",
"Solut",
"ion",
"s",
" ",
"Cor",
"porat",
"ion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"socket_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"oslo",
"_",
"._",
"config_",
"import_",
"cfg_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"rack_",
"import_",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"CONF_",
"=_",
"cfg_",
"._",
"CONF_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"netconf",
"\\u",
"opts_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"cfg_",
"._",
"Str",
"Opt_",
"(_",
"'",
"my",
"\\u",
"ip",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"\\u",
"get",
"\\u",
"my",
"\\u",
"ip_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"IP",
" ",
"address",
" ",
"of",
" ",
"this",
" ",
"host",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cfg_",
"._",
"Str",
"Opt_",
"(_",
"'",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"socket_",
"._",
"gethostname_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Name",
" ",
"of",
" ",
"this",
" ",
"node",
".",
" ",
" ",
"Thi",
"s",
" ",
"can",
" ",
"be",
" ",
"an",
" ",
"opaque",
" ",
"identifi",
"er",
".",
" ",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"It",
" ",
"is",
" ",
"not",
" ",
"necessar",
"il",
"y",
" ",
"a",
" ",
"host",
"name",
",",
" ",
"FQ",
"DN",
",",
" ",
"or",
" ",
"IP",
" ",
"address",
".",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Ho",
"we",
"ver",
",",
" ",
"the",
" ",
"node",
" ",
"name",
" ",
"must",
" ",
"be",
" ",
"valid",
" ",
"within",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"an",
" ",
"AMQ",
"P",
" ",
"key",
",",
" ",
"and",
" ",
"if",
" ",
"usi",
"ng",
" ",
"Zero",
"MQ",
",",
" ",
"a",
" ",
"valid",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"name",
",",
" ",
"FQ",
"DN",
",",
" ",
"or",
" ",
"IP",
" ",
"address",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cfg_",
"._",
"Boo",
"l",
"Opt_",
"(_",
"'",
"use",
"\\u",
"ipv",
"6",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Us",
"e",
" ",
"IP",
"v6",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"CONF_",
"._",
"register",
"\\u",
"opts_",
"(_",
"netconf",
"\\u",
"opts_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"my",
"\\u",
"ip_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"the",
" ",
"actual",
" ",
"ip",
" ",
"of",
" ",
"the",
" ",
"local",
" ",
"machine",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"code",
" ",
"figure",
"s",
" ",
"out",
" ",
"what",
" ",
"source",
" ",
"address",
" ",
"wou",
"ld",
" ",
"be",
" ",
"used",
" ",
"if",
" ",
"some",
" ",
"traffic",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"wer",
"e",
" ",
"to",
" ",
"be",
" ",
"sent",
" ",
"out",
" ",
"to",
" ",
"some",
" ",
"well",
" ",
"know",
"n",
" ",
"address",
" ",
"on",
" ",
"the",
" ",
"Intern",
"et",
".",
" ",
"In",
" ",
"this",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"case",
",",
" ",
"a",
" ",
"Goo",
"gle",
" ",
"DNS",
" ",
"server",
" ",
"is",
" ",
"used",
",",
" ",
"but",
" ",
"the",
" ",
"specific",
" ",
"address",
" ",
"doe",
"s",
" ",
"not",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"matte",
"r",
" ",
"muc",
"h",
".",
" ",
" ",
"No",
" ",
"traffic",
" ",
"is",
" ",
"actual",
"ly",
" ",
"sent",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cs",
"ock_",
"=_",
"socket_",
"._",
"socket_",
"(_",
"socket_",
"._",
"AF",
"\\u",
"INET_",
",_",
"socket_",
"._",
"SOCK",
"\\u",
"DGRAM_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cs",
"ock_",
"._",
"connect_",
"(_",
"(_",
"'",
"8.8",
".8",
".8",
"'_",
",_",
"80_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"addr_",
",_",
"port_",
")_",
"=_",
"cs",
"ock_",
"._",
"getsockname",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cs",
"ock_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"addr_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"socket_",
"._",
"error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"utils_",
"._",
"get",
"\\u",
"my",
"\\u",
"ipv",
"4",
"\\u",
"address_",
"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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | enthought/traits/traits/tests/test_rich_compare.py | [
{
"content": " def test_rich_different_object(self):\n rich = RichCompare()\n rich.on_trait_change(self.bar_changed, 'bar')\n\n self.reset_change_tracker()\n\n default_value = rich.bar\n rich.bar = self.a\n self.check_tracker(rich, 'bar', default_value, self.a, 1)\n\n rich.bar = self.different_from_a\n self.check_tracker(rich, 'bar', self.a, self.different_from_a, 2)\n return",
"metadata": "root.RichCompareTests.test_rich_different_object",
"header": "['class', 'RichCompareTests', ':', '___EOS___']",
"index": 117
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Rich",
"Compare",
"Tests_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"rich",
"\\u",
"different",
"\\u",
"object_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rich",
"_",
"=_",
"Rich",
"Compare",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rich",
"_",
"._",
"on",
"\\u",
"tra",
"it",
"\\u",
"change_",
"(_",
"self_",
"._",
"bar",
"\\u",
"changed_",
",_",
"'",
"bar",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"reset",
"\\u",
"change",
"\\u",
"tracker_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"default",
"\\u",
"value_",
"=_",
"rich",
"_",
"._",
"bar_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rich",
"_",
"._",
"bar_",
"=_",
"self_",
"._",
"a_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"check",
"\\u",
"tracker_",
"(_",
"rich",
"_",
",_",
"'",
"bar",
"'_",
",_",
"default",
"\\u",
"value_",
",_",
"self_",
"._",
"a_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rich",
"_",
"._",
"bar_",
"=_",
"self_",
"._",
"different",
"\\u",
"from",
"\\u",
"a_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"check",
"\\u",
"tracker_",
"(_",
"rich",
"_",
",_",
"'",
"bar",
"'_",
",_",
"self_",
"._",
"a_",
",_",
"self_",
"._",
"different",
"\\u",
"from",
"\\u",
"a_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | apache/libcloud/libcloud/test/dns/test_route53.py | [
{
"content": " def test_get_record(self):\n record = self.driver.get_record(zone_id='47234',\n record_id='CNAME:wibble')\n self.assertEqual(record.name, 'wibble')\n self.assertEqual(record.type, RecordType.CNAME)\n self.assertEqual(record.data, 't.com')",
"metadata": "root.Route53Tests.test_get_record",
"header": "['class', 'Route53Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 84
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Route",
"5",
"3",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"record_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"record_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"record_",
"(_",
"zone",
"\\u",
"id_",
"=_",
"'",
"472",
"3",
"4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"record",
"\\u",
"id_",
"=_",
"'",
"CNA",
"ME",
":",
"wi",
"bble",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"record_",
"._",
"name_",
",_",
"'",
"wi",
"bble",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"record_",
"._",
"type_",
",_",
"Record",
"Type_",
"._",
"CNA",
"ME_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"record_",
"._",
"data_",
",_",
"'",
"t",
".",
"com",
"'_",
")_",
"\\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
] |
Except block handles 'BaseException' | tethysplatform/tethys/tethys_portal/forms.py | [
{
"content": " def clean_username(self):\n # Since User.username is unique, this check is redundant,\n # but it sets a nicer error message than the ORM. See #13147.\n username = self.cleaned_data[\"username\"]\n try:\n User._default_manager.get(username=username)\n except User.DoesNotExist:\n return username\n raise forms.ValidationError(\n self.error_messages['duplicate_username'],\n code='duplicate_username',\n )",
"metadata": "root.RegisterForm.clean_username",
"header": "['class', 'RegisterForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']",
"index": 68
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Register",
"Form_",
"(_",
"forms_",
"._",
"Model",
"Form_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"clean",
"\\u",
"username_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Sin",
"ce",
" ",
"User",
".",
"user",
"name",
" ",
"is",
" ",
"unique",
",",
" ",
"this",
" ",
"check",
" ",
"is",
" ",
"redundant",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"but",
" ",
"it",
" ",
"sets",
" ",
"a",
" ",
"nice",
"r",
" ",
"error",
" ",
"message",
" ",
"than",
" ",
"the",
" ",
"ORM",
".",
" ",
"See",
" ",
"#",
"131",
"47.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"username_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"\"",
"user",
"name",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"User_",
"._",
"\\u",
"default",
"\\u",
"manager_",
"._",
"get_",
"(_",
"username_",
"=_",
"username_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"User_",
"._",
"Do",
"es",
"Not",
"Exist_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"username_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"raise_",
"forms_",
"._",
"Validat",
"ion",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"error",
"\\u",
"messages_",
"[_",
"'",
"duplicat",
"e\\u",
"user",
"name",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"code_",
"=_",
"'",
"duplicat",
"e\\u",
"user",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | openstack/solum/solum/tests/api/controllers/v1/test_sensor.py | [
{
"content": " def test_sensor_put_not_found(self, handler_mock, resp_mock, request_mock):\n json_update = {'name': 'hb42', 'value': '0'}\n request_mock.body = json.dumps(json_update)\n request_mock.content_type = 'application/json'\n handler_update = handler_mock.return_value.update\n handler_update.side_effect = exception.ResourceNotFound(\n name='sensor', sensor_id='test_id')\n controller.SensorController('test_id').put()\n handler_update.assert_called_with('test_id', json_update)\n self.assertEqual(404, resp_mock.status)",
"metadata": "root.TestSensorController.test_sensor_put_not_found",
"header": "['class', 'TestSensorController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 123
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Test",
"Sen",
"sor",
"Controller_",
"(_",
"base_",
"._",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"sensor",
"\\u",
"put",
"\\u",
"not",
"\\u",
"found_",
"(_",
"self_",
",_",
"handler",
"\\u",
"mock_",
",_",
"resp",
"\\u",
"mock_",
",_",
"request",
"\\u",
"mock_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"json",
"\\u",
"update_",
"=_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"hb",
"4",
"2",
"'_",
",_",
"'",
"value",
"'_",
":_",
"'",
"0",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"request",
"\\u",
"mock_",
"._",
"body_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"json",
"\\u",
"update_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"request",
"\\u",
"mock_",
"._",
"content",
"\\u",
"type_",
"=_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"handler",
"\\u",
"update_",
"=_",
"handler",
"\\u",
"mock_",
"._",
"return",
"\\u",
"value_",
"._",
"update_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"handler",
"\\u",
"update_",
"._",
"side",
"\\u",
"effect_",
"=_",
"exception_",
"._",
"Reso",
"urc",
"e",
"Not",
"Found_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"sensor",
"'_",
",_",
"sensor",
"\\u",
"id_",
"=_",
"'",
"test\\u",
"id",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"controller_",
"._",
"Sen",
"sor",
"Controller_",
"(_",
"'",
"test\\u",
"id",
"'_",
")_",
"._",
"put_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"handler",
"\\u",
"update_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"with_",
"(_",
"'",
"test\\u",
"id",
"'_",
",_",
"json",
"\\u",
"update_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"404_",
",_",
"resp",
"\\u",
"mock_",
"._",
"status_",
")_",
"\\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
] |
Testing equality to None | kivy/kivy/kivy/utils.py | [
{
"content": " def _get_platform(self):\n if self._platform_android is None:\n # ANDROID_ARGUMENT and ANDROID_PRIVATE are 2 environment variables\n # from python-for-android project\n self._platform_android = 'ANDROID_ARGUMENT' in environ\n\n if self._platform_ios is None:\n self._platform_ios = (environ.get('KIVY_BUILD', '') == 'ios')\n\n # On android, _sys_platform return 'linux2', so prefer to check the\n # import of Android module than trying to rely on _sys_platform.\n if self._platform_android is True:\n return 'android'\n elif self._platform_ios is True:\n return 'ios'\n elif _sys_platform in ('win32', 'cygwin'):\n return 'win'\n elif _sys_platform == 'darwin':\n return 'macosx'\n elif _sys_platform[:5] == 'linux':\n return 'linux'\n elif _sys_platform.startswith('freebsd'):\n return 'linux'\n return 'unknown'",
"metadata": "root.Platform._get_platform",
"header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']",
"index": 444
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"class_",
"Platform_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"refactor",
"ed",
" ",
"to",
" ",
"class",
" ",
"to",
" ",
"allow",
" ",
"module",
" ",
"function",
" ",
"to",
" ",
"be",
" ",
"replaced",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"with",
" ",
"module",
" ",
"variable_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"platform_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"\\u",
"platform",
"\\u",
"android",
"_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"ANDROID",
"\\u",
"ARGUMENT",
" ",
"and",
" ",
"ANDROID",
"\\u",
"PRIVATE",
" ",
"are",
" ",
"2",
" ",
"environ",
"ment",
" ",
"variables_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"python",
"-",
"for",
"-",
"android",
" ",
"project_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"platform",
"\\u",
"android",
"_",
"=_",
"'",
"ANDROID",
"\\u",
"ARGUMENT",
"'_",
"in_",
"environ_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"platform",
"\\u",
"ios_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"platform",
"\\u",
"ios_",
"=_",
"(_",
"environ_",
"._",
"get_",
"(_",
"'",
"KI",
"VY",
"\\u",
"BUILD",
"'_",
",_",
"''_",
")_",
"==_",
"'",
"ios",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"On",
" ",
"android",
",",
" ",
"\\u",
"sys",
"\\u",
"platform",
" ",
"return",
" ",
"'",
"linux",
"2",
"',",
" ",
"so",
" ",
"prefer",
" ",
"to",
" ",
"check",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"import",
" ",
"of",
" ",
"And",
"roid",
" ",
"module",
" ",
"than",
" ",
"try",
"ing",
" ",
"to",
" ",
"rely",
" ",
"on",
" ",
"\\u",
"sys",
"\\u",
"platform",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"platform",
"\\u",
"android",
"_",
"is_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"android",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"\\u",
"platform",
"\\u",
"ios_",
"is_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"ios",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"\\u",
"sys",
"\\u",
"platform_",
"in_",
"(_",
"'",
"win32",
"'_",
",_",
"'",
"cyg",
"win",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"win",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"\\u",
"sys",
"\\u",
"platform_",
"==_",
"'",
"dar",
"win",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"macos",
"x",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"\\u",
"sys",
"\\u",
"platform_",
"[_",
":_",
"5_",
"]_",
"==_",
"'",
"linux",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"linux",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"\\u",
"sys",
"\\u",
"platform_",
"._",
"startswith_",
"(_",
"'",
"freeb",
"sd",
"'_",
")_",
":_",
"\\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
] |
Except block handles 'BaseException' | cloudify-cosmo/cloudify-manager/rest-service/manager_rest/test/test_attributes.py | [
{
"content": " def test_missing_target(self):\n payload = {\n 'node3': {'get_attribute': ['TARGET', 'key3']},\n }\n try:\n self.client.evaluate.functions(self.id_, {}, payload)\n self.fail()\n except FunctionsEvaluationError as e:\n self.assertIn('TARGET is missing', e.message)",
"metadata": "root.AttributesTestCase.test_missing_target",
"header": "['class', 'AttributesTestCase', '(', 'base_test', '.', 'BaseServerTestCase', ')', ':', '___EOS___']",
"index": 97
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Attribute",
"s",
"Test",
"Case_",
"(_",
"base",
"\\u",
"test_",
"._",
"Base",
"Server",
"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",
"missi",
"ng",
"\\u",
"target_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"payload_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"node",
"3",
"'_",
":_",
"{_",
"'",
"get",
"\\u",
"attribute",
"'_",
":_",
"[_",
"'",
"TARGET",
"'_",
",_",
"'",
"key",
"3",
"'_",
"]_",
"}_",
",_",
"\\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 ",
" _",
"self_",
"._",
"client_",
"._",
"evaluate_",
"._",
"functions_",
"(_",
"self_",
"._",
"id\\u_",
",_",
"{_",
"}_",
",_",
"payload_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Function",
"s",
"Evaluati",
"on",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"In_",
"(_",
"'",
"TARGET",
" ",
"is",
" ",
"missi",
"ng",
"'_",
",_",
"e_",
"._",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Module is imported with 'import' and 'import from' | wcong/ants/ants/crawl/crawl.py | [
{
"content": "__author__ = 'wcong'\n\nfrom twisted.internet import reactor\n\nimport engine\nfrom ants.crawl import scheduler\n\n\n'''\ncrawl server and client\n'''\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u",
"author\\u\\u_",
"=_",
"'",
"wco",
"ng",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"twisted_",
"._",
"internet_",
"import_",
"reactor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"engine_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ants_",
"._",
"crawl",
"_",
"import_",
"scheduler_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"\\",
"10",
";",
"crawl",
" ",
"server",
" ",
"and",
" ",
"client",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\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
] |
Comparison of constants | blaze/blaze/blaze/compute/tests/test_numpy_compute.py | [
{
"content": "def test_by():\n expr = by(t.amount > 0, count=t.id.count())\n result = compute(expr, x)\n assert set(map(tuple, into(list, result))) == set([(False, 2), (True, 3)])",
"metadata": "root.test_by",
"header": "['module', '___EOS___']",
"index": 221
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"by_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expr_",
"=_",
"by_",
"(_",
"t_",
"._",
"amount_",
">_",
"0_",
",_",
"count_",
"=_",
"t_",
"._",
"id_",
"._",
"count_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"compute_",
"(_",
"expr_",
",_",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"set_",
"(_",
"map_",
"(_",
"tuple_",
",_",
"into_",
"(_",
"list_",
",_",
"result_",
")_",
")_",
")_",
"==_",
"set_",
"(_",
"[_",
"(_",
"False_",
",_",
"2_",
")_",
",_",
"(_",
"True_",
",_",
"3_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | girder/girder/plugins/geospatial/server/geospatial.py | [
{
"content": " @access.public\n @describeRoute(\n Description('Search for items that are entirely within either a GeoJSON'\n ' polygon or a circular region.')\n .param('field', 'Name of field containing GeoJSON on which to search.',\n required=True)\n .param('geometry', 'Search query condition as a GeoJSON polygon.',\n required=False)\n .param('center', 'Center of search radius as a GeoJSON point.',\n required=False)\n .param('radius', 'Search radius in meters.', required=False,\n dataType='number')\n .param('limit', 'Result set size limit (default=50).', required=False,\n dataType='integer')\n .param('offset', 'Offset into result set (default=0).', required=False,\n dataType='integer')\n .errorResponse()\n .notes(\"Either parameter 'geometry' or both parameters 'center' \"\n \" and 'radius' are required.\")\n )\n def within(self, params):\n \"\"\"\n Search for items that are entirely within either a GeoJSON polygon or a\n circular region. Either parameter 'geometry' or both parameters 'center'\n and 'radius' are required.\n\n :param params: parameters to the API call, including 'field' and either\n 'geometry' or both 'center' and 'radius'.\n :type params: dict[str, unknown]\n :returns: filtered fields of the matching items with geospatial data\n appended to the 'geo' field of each item.\n :rtype: list[dict[str, unknown]]\n :raise RestException: on malformed API call.\n \"\"\"\n self.requireParams(('field',), params)\n\n if 'geometry' in params:\n try:\n geometry = bson.json_util.loads(params['geometry'])\n GeoJSON.to_instance(geometry, strict=True)\n\n if geometry['type'] != 'Polygon':\n raise ValueError\n except (TypeError, ValueError):\n raise RestException(\"Invalid GeoJSON passed as 'geometry'\"\n \" parameter.\")\n\n condition = {\n '$geometry': geometry\n }\n\n elif 'center' in params and 'radius' in params:\n try:\n radius = float(params['radius']) / self._RADIUS_OF_EARTH\n\n if radius < 0.0:\n raise ValueError\n except ValueError:\n raise RestException(\"Parameter 'radius' must be a number.\")\n\n try:\n center = bson.json_util.loads(params['center'])\n GeoJSON.to_instance(center, strict=True)\n\n if center['type'] != 'Point':\n raise ValueError\n except (TypeError, ValueError):\n raise RestException(\"Invalid GeoJSON passed as 'center'\"\n \" parameter.\")\n\n condition = {\n '$centerSphere': [center['coordinates'], radius]\n }\n\n else:\n raise RestException(\"Either parameter 'geometry' or both parameters\"\n \" 'center' and 'radius' are required.\")\n\n if params['field'][:3] == '%s.' % GEOSPATIAL_FIELD:\n field = params['field'].strip()\n else:\n field = '%s.%s' % (GEOSPATIAL_FIELD, params['field'].strip())\n\n limit, offset, sort = self.getPagingParameters(params, 'lowerName')\n\n query = {\n field: {\n '$geoWithin': condition\n }\n }\n\n return self._find(query, limit, offset, sort)",
"metadata": "root.GeospatialItem.within",
"header": "['class', 'GeospatialItem', '(', 'Resource', ')', ':', '___EOS___']",
"index": 327
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Geos",
"pati",
"al",
"Item_",
"(_",
"Resource_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"access_",
"._",
"public_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"descri",
"be",
"Route_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Description_",
"(_",
"'",
"Sear",
"ch",
" ",
"for",
" ",
"items",
" ",
"tha",
"t",
" ",
"are",
" ",
"entire",
"ly",
" ",
"within",
" ",
"eit",
"her",
" ",
"a",
" ",
"Geo",
"JSO",
"N",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"poly",
"gon",
" ",
"or",
" ",
"a",
" ",
"circular",
" ",
"region",
".'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"param_",
"(_",
"'",
"field",
"'_",
",_",
"'",
"Name",
" ",
"of",
" ",
"field",
" ",
"contain",
"ing",
" ",
"Geo",
"JSO",
"N",
" ",
"on",
" ",
"whi",
"ch",
" ",
"to",
" ",
"search",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"True_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"param_",
"(_",
"'",
"geom",
"etry",
"'_",
",_",
"'",
"Sear",
"ch",
" ",
"query",
" ",
"condition",
" ",
"as",
" ",
"a",
" ",
"Geo",
"JSO",
"N",
" ",
"poly",
"gon",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"param_",
"(_",
"'",
"center",
"'_",
",_",
"'",
"Center",
" ",
"of",
" ",
"search",
" ",
"radi",
"us",
" ",
"as",
" ",
"a",
" ",
"Geo",
"JSO",
"N",
" ",
"point",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"param_",
"(_",
"'",
"radi",
"us",
"'_",
",_",
"'",
"Sear",
"ch",
" ",
"radi",
"us",
" ",
"in",
" ",
"mete",
"rs",
".'_",
",_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data",
"Type_",
"=_",
"'",
"number",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"param_",
"(_",
"'",
"limit",
"'_",
",_",
"'",
"Result",
" ",
"set",
" ",
"size",
" ",
"limit",
" ",
"(",
"default",
"=",
"50",
").'_",
",_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data",
"Type_",
"=_",
"'",
"integ",
"er",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"param_",
"(_",
"'",
"offset",
"'_",
",_",
"'",
"Off",
"set",
" ",
"int",
"o",
" ",
"result",
" ",
"set",
" ",
"(",
"default",
"=",
"0",
").'_",
",_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data",
"Type_",
"=_",
"'",
"integ",
"er",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"error",
"Response_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"notes_",
"(_",
"\"",
"Ei",
"ther",
" ",
"parameter",
" ",
"'",
"geom",
"etry",
"'",
" ",
"or",
" ",
"bot",
"h",
" ",
"parameter",
"s",
" ",
"'",
"center",
"'",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"and",
" ",
"'",
"radi",
"us",
"'",
" ",
"are",
" ",
"require",
"d",
".\"_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"within",
"_",
"(_",
"self_",
",_",
"params_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sear",
"ch",
" ",
"for",
" ",
"items",
" ",
"tha",
"t",
" ",
"are",
" ",
"entire",
"ly",
" ",
"within",
" ",
"eit",
"her",
" ",
"a",
" ",
"Geo",
"JSO",
"N",
" ",
"poly",
"gon",
" ",
"or",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"circular",
" ",
"region",
".",
" ",
"Ei",
"ther",
" ",
"parameter",
" ",
"'",
"geom",
"etry",
"'",
" ",
"or",
" ",
"bot",
"h",
" ",
"parameter",
"s",
" ",
"'",
"center",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"'",
"radi",
"us",
"'",
" ",
"are",
" ",
"require",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"params",
":",
" ",
"parameter",
"s",
" ",
"to",
" ",
"the",
" ",
"API",
" ",
"call",
",",
" ",
"inclu",
"ding",
" ",
"'",
"field",
"'",
" ",
"and",
" ",
"eit",
"her",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"'",
"geom",
"etry",
"'",
" ",
"or",
" ",
"bot",
"h",
" ",
"'",
"center",
"'",
" ",
"and",
" ",
"'",
"radi",
"us",
"'.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"params",
":",
" ",
"dict",
"[",
"str",
",",
" ",
"unknown",
"]",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
"s",
":",
" ",
"filter",
"ed",
" ",
"fields",
" ",
"of",
" ",
"the",
" ",
"matchi",
"ng",
" ",
"items",
" ",
"with",
" ",
"geos",
"pati",
"al",
" ",
"data",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"append",
"ed",
" ",
"to",
" ",
"the",
" ",
"'",
"geo",
"'",
" ",
"field",
" ",
"of",
" ",
"each",
" ",
"item",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"rty",
"pe",
":",
" ",
"list",
"[",
"dict",
"[",
"str",
",",
" ",
"unknown",
"]]",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"raise",
" ",
"Rest",
"Except",
"ion",
":",
" ",
"on",
" ",
"mal",
"formed",
" ",
"API",
" ",
"call",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"require",
"Params_",
"(_",
"(_",
"'",
"field",
"'_",
",_",
")_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"geom",
"etry",
"'_",
"in_",
"params_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"geometry_",
"=_",
"bson_",
"._",
"json",
"\\u",
"util_",
"._",
"loads_",
"(_",
"params_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Geo",
"JSON_",
"._",
"to",
"\\u",
"instance_",
"(_",
"geometry_",
",_",
"strict_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"geometry_",
"[_",
"'",
"type",
"'_",
"]_",
"!=_",
"'",
"Polygon",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Value",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"Type",
"Error_",
",_",
"Value",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Rest",
"Exception_",
"(_",
"\"",
"Inva",
"lid",
" ",
"Geo",
"JSO",
"N",
" ",
"pass",
"ed",
" ",
"as",
" ",
"'",
"geom",
"etry",
"'\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"parameter",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"condition_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"geom",
"etry",
"'_",
":_",
"geometry_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"'",
"center",
"'_",
"in_",
"params_",
"and_",
"'",
"radi",
"us",
"'_",
"in_",
"params_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"radius_",
"=_",
"float_",
"(_",
"params_",
"[_",
"'",
"radi",
"us",
"'_",
"]_",
")_",
"/_",
"self_",
"._",
"\\u",
"RADIUS",
"\\u",
"OF",
"\\u",
"EAR",
"TH_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"radius_",
"<_",
"0.0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Value",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Rest",
"Exception_",
"(_",
"\"",
"Parameter",
" ",
"'",
"radi",
"us",
"'",
" ",
"must",
" ",
"be",
" ",
"a",
" ",
"number",
".\"_",
")_",
"\\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 ",
" _",
"center_",
"=_",
"bson_",
"._",
"json",
"\\u",
"util_",
"._",
"loads_",
"(_",
"params_",
"[_",
"'",
"center",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Geo",
"JSON_",
"._",
"to",
"\\u",
"instance_",
"(_",
"center_",
",_",
"strict_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"center_",
"[_",
"'",
"type",
"'_",
"]_",
"!=_",
"'",
"Point",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Value",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"Type",
"Error_",
",_",
"Value",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Rest",
"Exception_",
"(_",
"\"",
"Inva",
"lid",
" ",
"Geo",
"JSO",
"N",
" ",
"pass",
"ed",
" ",
"as",
" ",
"'",
"center",
"'\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"parameter",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"condition_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"center",
"Sphere",
"'_",
":_",
"[_",
"center_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
",_",
"radius_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Rest",
"Exception_",
"(_",
"\"",
"Ei",
"ther",
" ",
"parameter",
" ",
"'",
"geom",
"etry",
"'",
" ",
"or",
" ",
"bot",
"h",
" ",
"parameter",
"s",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"'",
"center",
"'",
" ",
"and",
" ",
"'",
"radi",
"us",
"'",
" ",
"are",
" ",
"require",
"d",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"params_",
"[_",
"'",
"field",
"'_",
"]_",
"[_",
":_",
"3_",
"]_",
"==_",
"'%",
"s",
".'_",
"%_",
"GEO",
"SPA",
"TI",
"AL",
"\\u",
"FIELD_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"params_",
"[_",
"'",
"field",
"'_",
"]_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"'%",
"s",
".",
"%",
"s",
"'_",
"%_",
"(_",
"GEO",
"SPA",
"TI",
"AL",
"\\u",
"FIELD_",
",_",
"params_",
"[_",
"'",
"field",
"'_",
"]_",
"._",
"strip_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"limit_",
",_",
"offset_",
",_",
"sort_",
"=_",
"self_",
"._",
"get",
"Pag",
"ing",
"Parameters_",
"(_",
"params_",
",_",
"'",
"lower",
"Name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"query_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"geo",
"With",
"in",
"'_",
":_",
"condition_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"find_",
"(_",
"query_",
",_",
"limit_",
",_",
"offset_",
",_",
"sort_",
")_",
"\\u\\u\\uNEWLINE\\u\\u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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Constant in conditional expression or statement | docker/docker-py/docker/client.py | [
{
"content": " def __init__(self, base_url=None, version=None,\n timeout=constants.DEFAULT_TIMEOUT_SECONDS, tls=False):\n super(Client, self).__init__()\n\n if tls and not base_url:\n raise errors.TLSParameterError(\n 'If using TLS, the base_url argument must be provided.'\n )\n\n self.base_url = base_url\n self.timeout = timeout\n\n self._auth_configs = auth.load_config()\n\n base_url = utils.parse_host(base_url, sys.platform, tls=bool(tls))\n if base_url.startswith('http+unix://'):\n self._custom_adapter = unixconn.UnixAdapter(base_url, timeout)\n self.mount('http+docker://', self._custom_adapter)\n self.base_url = 'http+docker://localunixsocket'\n else:\n # Use SSLAdapter for the ability to specify SSL version\n if isinstance(tls, TLSConfig):\n tls.configure_client(self)\n elif tls:\n self._custom_adapter = ssladapter.SSLAdapter()\n self.mount('https://', self._custom_adapter)\n self.base_url = base_url\n\n # version detection needs to be after unix adapter mounting\n if version is None:\n self._version = constants.DEFAULT_DOCKER_API_VERSION\n elif isinstance(version, six.string_types):\n if version.lower() == 'auto':\n self._version = self._retrieve_server_version()\n else:\n self._version = version\n else:\n raise errors.DockerException(\n 'Version parameter must be a string or None. Found {0}'.format(\n type(version).__name__\n )\n )",
"metadata": "root.Client.__init__",
"header": "['class', 'Client', '(', '___NL___', 'requests', '.', 'Session', ',', '___NL___', 'api', '.', 'BuildApiMixin', ',', '___NL___', 'api', '.', 'ContainerApiMixin', ',', '___NL___', 'api', '.', 'DaemonApiMixin', ',', '___NL___', 'api', '.', 'ExecApiMixin', ',', '___NL___', 'api', '.', 'ImageApiMixin', ',', '___NL___', 'api', '.', 'VolumeApiMixin', ',', '___NL___', 'api', '.', 'NetworkApiMixin', ')', ':', '___EOS___']",
"index": 47
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Constant_",
"in_",
"conditional",
"_",
"expression_",
"or_",
"statement_",
"[SEP]_",
"class_",
"Client_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"requests_",
"._",
"Session_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"Build",
"Ap",
"i",
"Mixin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"Containe",
"r",
"Ap",
"i",
"Mixin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"Da",
"emo",
"n",
"Ap",
"i",
"Mixin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"Exe",
"c",
"Ap",
"i",
"Mixin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"Image",
"Ap",
"i",
"Mixin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"Volume",
"Ap",
"i",
"Mixin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"Network",
"Ap",
"i",
"Mixin_",
")_",
":_",
"\\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_",
",_",
"base",
"\\u",
"url_",
"=_",
"None_",
",_",
"version_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"timeout_",
"=_",
"constants_",
"._",
"DEF",
"AUL",
"T",
"\\u",
"TIME",
"OUT",
"\\u",
"SECONDS_",
",_",
"tls_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Client_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"tls_",
"and_",
"not_",
"base",
"\\u",
"url_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"errors_",
"._",
"TLS",
"Parameter",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"If",
" ",
"usi",
"ng",
" ",
"TLS",
",",
" ",
"the",
" ",
"base",
"\\u",
"url",
" ",
"argu",
"ment",
" ",
"must",
" ",
"be",
" ",
"provided",
".'_",
"\\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_",
"._",
"base",
"\\u",
"url_",
"=_",
"base",
"\\u",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"timeout_",
"=_",
"timeout_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"auth",
"\\u",
"configs_",
"=_",
"auth_",
"._",
"load",
"\\u",
"config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"base",
"\\u",
"url_",
"=_",
"utils_",
"._",
"parse",
"\\u",
"host_",
"(_",
"base",
"\\u",
"url_",
",_",
"sys_",
"._",
"platform_",
",_",
"tls_",
"=_",
"bool_",
"(_",
"tls_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"base",
"\\u",
"url_",
"._",
"startswith_",
"(_",
"'",
"http",
"+",
"unix",
"://'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"custom",
"\\u",
"adapter_",
"=_",
"unix",
"conn_",
"._",
"Uni",
"x",
"Adapter_",
"(_",
"base",
"\\u",
"url_",
",_",
"timeout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"mount_",
"(_",
"'",
"http",
"+",
"docker",
"://'_",
",_",
"self_",
"._",
"\\u",
"custom",
"\\u",
"adapter_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"base",
"\\u",
"url_",
"=_",
"'",
"http",
"+",
"docker",
"://",
"local",
"unix",
"socket",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Us",
"e",
" ",
"SS",
"LA",
"dap",
"ter",
" ",
"for",
" ",
"the",
" ",
"abilit",
"y",
" ",
"to",
" ",
"speci",
"fy",
" ",
"SS",
"L",
" ",
"version_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"tls_",
",_",
"TLS",
"Config_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tls_",
"._",
"configur",
"e\\u",
"client_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"tls_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"custom",
"\\u",
"adapter_",
"=_",
"ssl",
"adapter_",
"._",
"SS",
"LA",
"dap",
"ter_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"mount_",
"(_",
"'",
"https",
"://'_",
",_",
"self_",
"._",
"\\u",
"custom",
"\\u",
"adapter_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"base",
"\\u",
"url_",
"=_",
"base",
"\\u",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"version",
" ",
"detect",
"ion",
" ",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"after",
" ",
"unix",
" ",
"adapter",
" ",
"mount",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"version_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"version_",
"=_",
"constants_",
"._",
"DEF",
"AUL",
"T",
"\\u",
"DOCKER",
"\\u",
"API",
"\\u",
"VERSION_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"version_",
",_",
"six_",
"._",
"string",
"\\u",
"types_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"version_",
"._",
"lower_",
"(_",
")_",
"==_",
"'",
"auto",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"version_",
"=_",
"self_",
"._",
"\\u",
"retrieve",
"\\u",
"server",
"\\u",
"version_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"version_",
"=_",
"version_",
"\\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_",
"errors_",
"._",
"Docke",
"r",
"Exception_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Version",
" ",
"parameter",
" ",
"must",
" ",
"be",
" ",
"a",
" ",
"string",
" ",
"or",
" ",
"Non",
"e",
".",
" ",
"Foun",
"d",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"type_",
"(_",
"version_",
")_",
"._",
"\\u\\u",
"name\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Except block handles 'BaseException' | funkybob/django-nap/nap/serialiser/base.py | [
{
"content": " def object_inflate(self, data, instance=None, **kwargs):\n objdata = {}\n errors = defaultdict(list)\n for name, method in self._field_inflaters:\n try:\n method(\n name,\n data=data,\n obj=objdata,\n instance=instance,\n **kwargs\n )\n except ValidationError as exc:\n errors[name].append(exc)\n for name, method in self._custom_inflaters:\n try:\n objdata[name] = method(\n data=data,\n obj=objdata,\n instance=instance,\n **kwargs\n )\n except ValidationError as exc:\n errors[name].append(exc)\n if errors:\n raise ValidationError(errors)\n return self.restore_object(objdata, instance=instance, **kwargs)",
"metadata": "root.Serialiser.object_inflate",
"header": "['class', 'Serialiser', '(', 'with_metaclass', '(', 'MetaSerialiser', ',', 'object', ')', ')', ':', '___EOS___']",
"index": 85
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Seriali",
"ser_",
"(_",
"with",
"\\u",
"metaclass_",
"(_",
"Meta",
"Seriali",
"ser_",
",_",
"object_",
")_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"object\\u",
"infla",
"te_",
"(_",
"self_",
",_",
"data_",
",_",
"instance_",
"=_",
"None_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"objd",
"ata_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"errors_",
"=_",
"defaultdict_",
"(_",
"list_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"name_",
",_",
"method_",
"in_",
"self_",
"._",
"\\u",
"field",
"\\u",
"infla",
"ters_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"method_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"data_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"obj_",
"=_",
"objd",
"ata_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"instance_",
"=_",
"instance_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"kwargs_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Validat",
"ion",
"Error_",
"as_",
"exc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"errors_",
"[_",
"name_",
"]_",
"._",
"append_",
"(_",
"exc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"name_",
",_",
"method_",
"in_",
"self_",
"._",
"\\u",
"custom",
"\\u",
"infla",
"ters_",
":_",
"\\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 ",
" _",
"objd",
"ata_",
"[_",
"name_",
"]_",
"=_",
"method_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"data_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"obj_",
"=_",
"objd",
"ata_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"instance_",
"=_",
"instance_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"kwargs_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Validat",
"ion",
"Error_",
"as_",
"exc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"errors_",
"[_",
"name_",
"]_",
"._",
"append_",
"(_",
"exc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"errors_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Validat",
"ion",
"Error_",
"(_",
"errors_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"restore",
"\\u",
"object_",
"(_",
"objd",
"ata_",
",_",
"instance_",
"=_",
"instance_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | bokeh/bokeh/tests/compat/lc_dashed.py | [
{
"content": "from matplotlib.collections import LineCollection\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom bokeh import mpl\nfrom bokeh.plotting import output_file, show\n\n# In order to efficiently plot many lines in a single set of axes,\n# add the lines all at once. Here is a simple example showing how it is done.\n\nN = 50\nx = np.arange(N)\n\n# Here are many sets of y to plot vs x\nys = [x + i for i in x]\n\ncolors = ['#ff0000', '#008000', '#0000ff', '#00bfbf', '#bfbf00', '#bf00bf', '#000000']\n\nline_segments = LineCollection([list(zip(x, y)) for y in ys],\n color=colors,\n linewidth=(0.5, 1, 1.5, 2),\n linestyle='dashed')\n\nax = plt.axes()\nax.add_collection(line_segments)\nax.set_title('Line Collection with dashed colors')\n\noutput_file(\"lc_dashed.html\", title=\"lc_dashed.py example\")\n\nshow(mpl.to_bokeh())\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"matplotlib_",
"._",
"collections_",
"import_",
"Line",
"Collection_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"matplotlib_",
"._",
"pyplot_",
"as_",
"plt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"bokeh",
"_",
"import_",
"mpl_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bokeh",
"_",
"._",
"plotting_",
"import_",
"output",
"\\u",
"file_",
",_",
"show_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
" ",
"order",
" ",
"to",
" ",
"efficien",
"tl",
"y",
" ",
"plot",
" ",
"many",
" ",
"lines",
" ",
"in",
" ",
"a",
" ",
"single",
" ",
"set",
" ",
"of",
" ",
"axes",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"the",
" ",
"lines",
" ",
"all",
" ",
"at",
" ",
"onc",
"e",
".",
" ",
"Her",
"e",
" ",
"is",
" ",
"a",
" ",
"simple",
" ",
"example",
" ",
"showin",
"g",
" ",
"how",
" ",
"it",
" ",
"is",
" ",
"don",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"N_",
"=_",
"50_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"=_",
"np_",
"._",
"arange_",
"(_",
"N_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Her",
"e",
" ",
"are",
" ",
"many",
" ",
"sets",
" ",
"of",
" ",
"y",
" ",
"to",
" ",
"plot",
" ",
"vs",
" ",
"x_",
"\\u\\u\\uNL\\u\\u\\u_",
"ys_",
"=_",
"[_",
"x_",
"+_",
"i_",
"for_",
"i_",
"in_",
"x_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"colors_",
"=_",
"[_",
"'#",
"ff",
"0000",
"'_",
",_",
"'#",
"0080",
"00",
"'_",
",_",
"'#",
"0000",
"ff",
"'_",
",_",
"'#",
"00",
"bf",
"bf",
"'_",
",_",
"'#",
"bf",
"bf",
"00",
"'_",
",_",
"'#",
"bf",
"00",
"bf",
"'_",
",_",
"'#",
"000000",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"line",
"\\u",
"segments_",
"=_",
"Line",
"Collection_",
"(_",
"[_",
"list_",
"(_",
"zip_",
"(_",
"x_",
",_",
"y_",
")_",
")_",
"for_",
"y_",
"in_",
"ys_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"color_",
"=_",
"colors_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"linewidth_",
"=_",
"(_",
"0.5_",
",_",
"1_",
",_",
"1.5_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"linestyle_",
"=_",
"'",
"dashed",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ax_",
"=_",
"plt_",
"._",
"axes_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ax_",
"._",
"add",
"\\u",
"collection_",
"(_",
"line",
"\\u",
"segments_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ax_",
"._",
"set\\u",
"title_",
"(_",
"'",
"Line",
" ",
"Collecti",
"on",
" ",
"with",
" ",
"dashed",
" ",
"colors",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"output",
"\\u",
"file_",
"(_",
"\"",
"lc",
"\\u",
"dashed",
".",
"html",
"\"_",
",_",
"title_",
"=_",
"\"",
"lc",
"\\u",
"dashed",
".",
"py",
" ",
"example",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"show_",
"(_",
"mpl_",
"._",
"to",
"\\u",
"bokeh",
"_",
"(_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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/xml/dom/xmlbuilder.py | [
{
"content": " def _get_opener(self):\n try:\n return self._opener\n except AttributeError:\n self._opener = self._create_opener()\n return self._opener",
"metadata": "root.DOMEntityResolver._get_opener",
"header": "['class', 'DOMEntityResolver', '(', 'object', ')', ':', '___EOS___']",
"index": 236
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"DOM",
"Entit",
"y",
"Resolver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"opener_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"opener_",
"\\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 ",
" _",
"self_",
"._",
"\\u",
"opener_",
"=_",
"self_",
"._",
"\\u",
"create",
"\\u",
"opener_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"opener_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | programa-stic/barf-project/barf/tests/arch/x86/test_x86translator.py | [
{
"content": " def test_cmovnb(self):\n asm = [\"cmovnb eax, ebx\"]\n\n ctx_init = self.__init_context()\n\n x86_ctx_out, reil_ctx_out = self.__run_code(asm, 0xdeadbeef, ctx_init)\n\n cmp_result = self.__compare_contexts(ctx_init, x86_ctx_out, reil_ctx_out)\n\n if not cmp_result:\n self.__save_failing_context(ctx_init)\n\n self.assertTrue(cmp_result, self.__print_contexts(ctx_init, x86_ctx_out, reil_ctx_out))",
"metadata": "root.X86TranslationTests.test_cmovnb",
"header": "['class', 'X86TranslationTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 873
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"X",
"86",
"Translat",
"ion",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"cmo",
"vn",
"b_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"asm_",
"=_",
"[_",
"\"",
"cmo",
"vn",
"b",
" ",
"eax",
",",
" ",
"eb",
"x",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ctx",
"\\u",
"init_",
"=_",
"self_",
"._",
"\\u\\u",
"init",
"\\u",
"context_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"x8",
"6",
"\\u",
"ctx",
"\\u",
"out_",
",_",
"rei",
"l\\u",
"ctx",
"\\u",
"out_",
"=_",
"self_",
"._",
"\\u\\u",
"run",
"\\u",
"code_",
"(_",
"asm_",
",_",
"0xd",
"ead",
"beef",
"_",
",_",
"ctx",
"\\u",
"init_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"cmp",
"\\u",
"result_",
"=_",
"self_",
"._",
"\\u\\u",
"compare",
"\\u",
"contexts_",
"(_",
"ctx",
"\\u",
"init_",
",_",
"x8",
"6",
"\\u",
"ctx",
"\\u",
"out_",
",_",
"rei",
"l\\u",
"ctx",
"\\u",
"out_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"cmp",
"\\u",
"result_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"save",
"\\u",
"faili",
"ng",
"\\u",
"context_",
"(_",
"ctx",
"\\u",
"init_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"cmp",
"\\u",
"result_",
",_",
"self_",
"._",
"\\u\\u",
"print",
"\\u",
"contexts_",
"(_",
"ctx",
"\\u",
"init_",
",_",
"x8",
"6",
"\\u",
"ctx",
"\\u",
"out_",
",_",
"rei",
"l\\u",
"ctx",
"\\u",
"out_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | OpenMDAO/OpenMDAO-Framework/contrib/m4/examples/mid_fidelity_example.py | [
{
"content": "\"\"\"\nSimple M4 variable fidelity example.\n\nRuns a DOE on a MidFidelity component instance.\nNote that the MidFidelity component performs its correction calculations\non the first execution, then on subsequent executions the corrected result\nis directly calculated.\n\"\"\"\n\nfrom openmdao.main.api import Assembly\nfrom openmdao.main.datatypes.api import Float\n\nfrom m4.doe import DOE\nfrom m4.mid_fidelity import MidFidelity \nfrom m4.dummy_components import Model_A2d, Model_B2d\n\n\n\n\n\n\nif __name__ == '__main__': # pragma no cover\n top = MyModel()\n top.run()\n# top.check_save_load() # Note: requires correct pythonV.R\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class MyModel(Assembly):\n \"\"\" Simple M4 variable fidelity example. \"\"\"\n\n",
"metadata": "root.MyModel",
"header": "['module', '___EOS___']",
"index": 17
},
{
"content": " def configure(self):\n\n # Specify DOE.\n doe = self.add('M4_DOE', DOE())\n\n # The model is an M4 variable fidelity component.\n doe.model = self.add('VarFi', VarFi())\n\n doe.design_variables = [('x', 0., 5.), ('y', 0., 5.)]\n doe.response_variables = [('z1'), ('z2')]\n doe.type = 'rand_lhs'\n doe.n_samples = 200",
"metadata": "root.MyModel.configure",
"header": "['class', 'MyModel', '(', 'Assembly', ')', ':', '___EOS___']",
"index": 20
},
{
"content": " def execute(self):\n \"\"\" Run model and print results. \"\"\"\n super(MyModel, self).execute()\n for i, case in enumerate(self.M4_DOE.outerator):\n print 'CASE %d:' % (i+1)\n for name, index, value in case.inputs:\n print ' input:', name, index, value\n if case.msg:\n print ' FAILED: %s' % case.msg\n else:\n for name, index, value in case.outputs:\n print ' output:', name, index, value",
"metadata": "root.MyModel.execute",
"header": "['class', 'MyModel', '(', 'Assembly', ')', ':', '___EOS___']",
"index": 33
},
{
"content": "class VarFi(MidFidelity):\n \"\"\" Example variable fidelity component. \"\"\"\n\n # Inputs.\n x = Float(value=0., low=0., high=5., iotype='in', desc='X input value.')\n y = Float(default_value=0., low=0., high=5., units='m', iotype='in',\n desc='Y input value.')\n\n # Outputs.\n z1 = Float(0., iotype='out', desc='exp(x) + exp(y)')\n z2 = Float(0., iotype='out',\n desc='10.0*(x-2.0)**2 + 10.0*(y-1.5)**2 + 10.0')\n ",
"metadata": "root.VarFi",
"header": "['module', '___EOS___']",
"index": 47
},
{
"content": " def __init__(self):\n super(VarFi, self).__init__()\n\n # Inputs.\n self.rs_type = 'rbf'\n self.n_samples = 20\n self.tolerance = 1.0e20\n self.correction_function = 2 # additive(gamma)\n self.w_h = 0.2\n self.accuracy_test_type = 2 # additional-points\n\n # High and low fidelity models.\n self.set_hifi_model(Model_A2d())\n self.set_lofi_model(Model_B2d())\n\n # Mappings are (mid, low, high).\n self.add_input_mapping('x', 'x', 'x')\n self.add_input_mapping('y', 'y', 'y')\n self.add_output_mapping('z1', 'z', 'z1')\n self.add_output_mapping('z2', 'z', 'z2')",
"metadata": "root.VarFi.__init__",
"header": "['class', 'VarFi', '(', 'MidFidelity', ')', ':', '___EOS___']",
"index": 60
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Simple",
" ",
"M",
"4",
" ",
"variab",
"le",
" ",
"fid",
"elit",
"y",
" ",
"example",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Run",
"s",
" ",
"a",
" ",
"DO",
"E",
" ",
"on",
" ",
"a",
" ",
"Mid",
"Fi",
"deli",
"ty",
" ",
"component",
" ",
"instance",
".",
"\\",
"10",
";",
"Not",
"e",
" ",
"tha",
"t",
" ",
"the",
" ",
"Mid",
"Fi",
"deli",
"ty",
" ",
"component",
" ",
"perform",
"s",
" ",
"its",
" ",
"correcti",
"on",
" ",
"calculati",
"ons",
"\\",
"10",
";",
"on",
" ",
"the",
" ",
"first",
" ",
"executi",
"on",
",",
" ",
"then",
" ",
"on",
" ",
"subsequen",
"t",
" ",
"executions",
" ",
"the",
" ",
"corrected",
" ",
"result",
"\\",
"10",
";",
"is",
" ",
"direct",
"ly",
" ",
"calculated",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"main_",
"._",
"api_",
"import_",
"Asse",
"mbly",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openm",
"dao_",
"._",
"main_",
"._",
"datatypes_",
"._",
"api_",
"import_",
"Float_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"m4",
"_",
"._",
"doe",
"_",
"import_",
"DO",
"E_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"m4",
"_",
"._",
"mid",
"\\u",
"fid",
"elit",
"y_",
"import_",
"Mid",
"Fi",
"deli",
"ty_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"m4",
"_",
"._",
"dummy",
"\\u",
"components_",
"import_",
"Model",
"\\u",
"A2",
"d_",
",_",
"Model",
"\\u",
"B2",
"d_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"#",
" ",
"pragma",
" ",
"no",
" ",
"cover_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"top_",
"=_",
"My",
"Model_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top_",
"._",
"run_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"top",
".",
"check",
"\\u",
"save",
"\\u",
"load",
"()",
" ",
" ",
"#",
" ",
"Not",
"e",
":",
" ",
"require",
"s",
" ",
"correct",
" ",
"python",
"V",
".",
"R_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"My",
"Model_",
"(_",
"Asse",
"mbly",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Simple",
" ",
"M",
"4",
" ",
"variab",
"le",
" ",
"fid",
"elit",
"y",
" ",
"example",
".",
" ",
" ",
"\"\"\"_",
"\\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_",
"My",
"Model_",
"(_",
"Asse",
"mbly",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"configure_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Speci",
"fy",
" ",
"DO",
"E",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"doe",
"_",
"=_",
"self_",
"._",
"add_",
"(_",
"'",
"M",
"4",
"\\u",
"DO",
"E",
"'_",
",_",
"DO",
"E_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"model",
" ",
"is",
" ",
"an",
" ",
"M",
"4",
" ",
"variab",
"le",
" ",
"fid",
"elit",
"y",
" ",
"component",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"doe",
"_",
"._",
"model_",
"=_",
"self_",
"._",
"add_",
"(_",
"'",
"Var",
"Fi",
"'_",
",_",
"Var",
"Fi",
"_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"doe",
"_",
"._",
"design",
"\\u",
"variables_",
"=_",
"[_",
"(_",
"'",
"x",
"'_",
",_",
"0._",
",_",
"5._",
")_",
",_",
"(_",
"'",
"y",
"'_",
",_",
"0._",
",_",
"5._",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doe",
"_",
"._",
"response",
"\\u",
"variables_",
"=_",
"[_",
"(_",
"'",
"z",
"1",
"'_",
")_",
",_",
"(_",
"'",
"z",
"2",
"'_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doe",
"_",
"._",
"type_",
"=_",
"'",
"rand",
"\\u",
"lh",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doe",
"_",
"._",
"n",
"\\u",
"samples_",
"=_",
"200_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"My",
"Model_",
"(_",
"Asse",
"mbly",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"execute_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Run",
" ",
"model",
" ",
"and",
" ",
"print",
" ",
"results",
".",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"super_",
"(_",
"My",
"Model_",
",_",
"self_",
")_",
"._",
"execute_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
",_",
"case_",
"in_",
"enumerate_",
"(_",
"self_",
"._",
"M",
"4",
"\\u",
"DO",
"E_",
"._",
"outer",
"ator_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"CASE",
" ",
"%",
"d",
":'_",
"%_",
"(_",
"i_",
"+_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"name_",
",_",
"index_",
",_",
"value_",
"in_",
"case_",
"._",
"inputs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
" ",
" ",
" ",
" ",
"input",
":'_",
",_",
"name_",
",_",
"index_",
",_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"case_",
"._",
"msg_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
" ",
" ",
" ",
" ",
"FAIL",
"ED",
":",
" ",
"%",
"s",
"'_",
"%_",
"case_",
"._",
"msg_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"name_",
",_",
"index_",
",_",
"value_",
"in_",
"case_",
"._",
"outputs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"print_",
"'",
" ",
" ",
" ",
" ",
"output",
":'_",
",_",
"name_",
",_",
"index_",
",_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Var",
"Fi",
"_",
"(_",
"Mid",
"Fi",
"deli",
"ty_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Exam",
"ple",
" ",
"variab",
"le",
" ",
"fid",
"elit",
"y",
" ",
"component",
".",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Inp",
"uts",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"=_",
"Float_",
"(_",
"value_",
"=_",
"0._",
",_",
"low_",
"=_",
"0._",
",_",
"high_",
"=_",
"5._",
",_",
"iot",
"ype_",
"=_",
"'",
"in",
"'_",
",_",
"desc_",
"=_",
"'",
"X",
" ",
"input",
" ",
"value",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y_",
"=_",
"Float_",
"(_",
"default",
"\\u",
"value_",
"=_",
"0._",
",_",
"low_",
"=_",
"0._",
",_",
"high_",
"=_",
"5._",
",_",
"units_",
"=_",
"'",
"m",
"'_",
",_",
"iot",
"ype_",
"=_",
"'",
"in",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"desc_",
"=_",
"'",
"Y",
" ",
"input",
" ",
"value",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Output",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"z1_",
"=_",
"Float_",
"(_",
"0._",
",_",
"iot",
"ype_",
"=_",
"'",
"out",
"'_",
",_",
"desc_",
"=_",
"'",
"exp",
"(",
"x",
")",
" ",
"+",
" ",
"exp",
"(",
"y",
")'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"z2_",
"=_",
"Float_",
"(_",
"0._",
",_",
"iot",
"ype_",
"=_",
"'",
"out",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"desc_",
"=_",
"'",
"10.",
"0",
"*(",
"x",
"-",
"2.0",
")**",
"2",
" ",
"+",
" ",
"10.",
"0",
"*(",
"y",
"-1",
".5",
")**",
"2",
" ",
"+",
" ",
"10.",
"0",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Var",
"Fi",
"_",
"(_",
"Mid",
"Fi",
"deli",
"ty_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Var",
"Fi",
"_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Inp",
"uts",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"rs",
"\\u",
"type_",
"=_",
"'",
"rbf",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"n",
"\\u",
"samples_",
"=_",
"20_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"tolerance_",
"=_",
"1.0",
"e2",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"correcti",
"on",
"\\u",
"function_",
"=_",
"2_",
"#",
" ",
"additi",
"ve",
"(",
"gamma",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"w",
"\\u",
"h_",
"=_",
"0.2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"accu",
"rac",
"y",
"\\u",
"test\\u",
"type_",
"=_",
"2_",
"#",
" ",
"addition",
"al",
"-",
"points_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Hig",
"h",
" ",
"and",
" ",
"low",
" ",
"fid",
"elit",
"y",
" ",
"model",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"set\\u",
"hi",
"fi",
"\\u",
"model_",
"(_",
"Model",
"\\u",
"A2",
"d_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"set\\u",
"lof",
"i",
"\\u",
"model_",
"(_",
"Model",
"\\u",
"B2",
"d_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Mappings",
" ",
"are",
" ",
"(",
"mid",
",",
" ",
"low",
",",
" ",
"high",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"add",
"\\u",
"input",
"\\u",
"mapping_",
"(_",
"'",
"x",
"'_",
",_",
"'",
"x",
"'_",
",_",
"'",
"x",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"add",
"\\u",
"input",
"\\u",
"mapping_",
"(_",
"'",
"y",
"'_",
",_",
"'",
"y",
"'_",
",_",
"'",
"y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"add",
"\\u",
"output",
"\\u",
"mapping_",
"(_",
"'",
"z",
"1",
"'_",
",_",
"'",
"z",
"'_",
",_",
"'",
"z",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"add",
"\\u",
"output",
"\\u",
"mapping_",
"(_",
"'",
"z",
"2",
"'_",
",_",
"'",
"z",
"'_",
",_",
"'",
"z",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unnecessary pass | mingchen/django-cas-ng/django_cas_ng/__init__.py | [
{
"content": "\"\"\"Django CAS 1.0/2.0 authentication backend\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\n__all__ = []\n\n_DEFAULTS = {\n 'CAS_ADMIN_PREFIX': None,\n 'CAS_CREATE_USER': True,\n 'CAS_EXTRA_LOGIN_PARAMS': None,\n 'CAS_RENEW': False,\n 'CAS_IGNORE_REFERER': False,\n 'CAS_LOGOUT_COMPLETELY': True,\n 'CAS_FORCE_CHANGE_USERNAME_CASE': None,\n 'CAS_REDIRECT_URL': '/',\n 'CAS_RETRY_LOGIN': False,\n 'CAS_SERVER_URL': None,\n 'CAS_VERSION': '2',\n 'CAS_USERNAME_ATTRIBUTE': 'uid',\n 'CAS_PROXY_CALLBACK': None,\n 'CAS_LOGIN_MSG': _(\"Login succeeded. Welcome, %s.\"),\n 'CAS_LOGGED_MSG': _(\"You are logged in as %s.\"),\n}\n\nfor key, value in list(_DEFAULTS.items()):\n try:\n getattr(settings, key)\n except AttributeError:\n setattr(settings, key, value)\n # Suppress errors from DJANGO_SETTINGS_MODULE not being set\n except ImportError:\n pass\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"pass_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Dj",
"ang",
"o",
" ",
"CAS",
" ",
"1.0",
"/",
"2.0",
" ",
"authenticat",
"ion",
" ",
"back",
"end",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"translation_",
"import_",
"uge",
"ttext",
"\\u",
"lazy_",
"as_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"DEFAULTS_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"ADM",
"IN",
"\\u",
"PREF",
"IX",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"CREATE",
"\\u",
"USER",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"EXTRA",
"\\u",
"LOGIN",
"\\u",
"PARAM",
"S",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"REN",
"EW",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"IGNORE",
"\\u",
"REFE",
"RER",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"LOGO",
"UT\\u",
"COMPLET",
"EL",
"Y",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"FORCE",
"\\u",
"CHANGE",
"\\u",
"USER",
"NAME",
"\\u",
"CASE",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"REDIRECT",
"\\u",
"URL",
"'_",
":_",
"'/'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"RETRY",
"\\u",
"LOGIN",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"SERVER",
"\\u",
"URL",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"VERSI",
"ON",
"'_",
":_",
"'",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"USER",
"NAME",
"\\u",
"ATTRIBUTE",
"'_",
":_",
"'",
"uid",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"PROX",
"Y",
"\\u",
"CALL",
"BACK",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"LOGIN",
"\\u",
"MS",
"G",
"'_",
":_",
"\\u_",
"(_",
"\"",
"Logi",
"n",
" ",
"succe",
"eded",
".",
" ",
"Wel",
"come",
",",
" ",
"%",
"s",
".\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CAS",
"\\u",
"LOGGE",
"D",
"\\u",
"MS",
"G",
"'_",
":_",
"\\u_",
"(_",
"\"",
"You",
" ",
"are",
" ",
"logged",
" ",
"in",
" ",
"as",
" ",
"%",
"s",
".\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"key_",
",_",
"value_",
"in_",
"list_",
"(_",
"\\u",
"DEFAULTS_",
"._",
"items_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"getattr_",
"(_",
"settings_",
",_",
"key_",
")_",
"\\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 ",
" _",
"setattr_",
"(_",
"settings_",
",_",
"key_",
",_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Suppress",
" ",
"error",
"s",
" ",
"from",
" ",
"DJANGO",
"\\u",
"SETTING",
"S",
"\\u",
"MODUL",
"E",
" ",
"not",
" ",
"bei",
"ng",
" ",
"set_",
"\\u\\u\\uNL\\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_",
"\\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,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right (C) 2009 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n\"\"\"AtomPubClient provides CRUD ops. in line with the Atom Publishing Protocol.\n\n\"\"\"\n\n__author__ = '[email protected] (Jeff Scudder)'\n\n\nimport atom.http_core\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Error(Exception):\n pass",
"metadata": "root.Error",
"header": "['module', '___EOS___']",
"index": 27
},
{
"content": "class MissingHost(Error):\n pass",
"metadata": "root.MissingHost",
"header": "['module', '___EOS___']",
"index": 31
},
{
"content": "class AtomPubClient(object):\n host = None\n auth_token = None\n ssl = False # Whether to force all requests over https\n xoauth_requestor_id = None\n\n\n\n Request = request\n\n\n Get = get\n\n\n Post = post\n\n\n Put = put\n\n\n Delete = delete\n\n\n ModifyRequest = modify_request",
"metadata": "root.AtomPubClient",
"header": "['module', '___EOS___']",
"index": 35
},
{
"content": " def __init__(self, http_client=None, host=None, auth_token=None, source=None,\n xoauth_requestor_id=None, **kwargs):\n \"\"\"Creates a new AtomPubClient instance.\n\n Args:\n source: The name of your application.\n http_client: An object capable of performing HTTP requests through a\n request method. This object is used to perform the request\n when the AtomPubClient's request method is called. Used to\n allow HTTP requests to be directed to a mock server, or use\n an alternate library instead of the default of httplib to\n make HTTP requests.\n host: str The default host name to use if a host is not specified in the\n requested URI.\n auth_token: An object which sets the HTTP Authorization header when its\n modify_request method is called.\n \"\"\"\n self.http_client = http_client or atom.http_core.ProxiedHttpClient()\n if host is not None:\n self.host = host\n if auth_token is not None:\n self.auth_token = auth_token\n self.xoauth_requestor_id = xoauth_requestor_id\n self.source = source",
"metadata": "root.AtomPubClient.__init__",
"header": "['class', 'AtomPubClient', '(', 'object', ')', ':', '___EOS___']",
"index": 41
},
{
"content": " def request(self, method=None, uri=None, auth_token=None,\n http_request=None, **kwargs):\n \"\"\"Performs an HTTP request to the server indicated.\n\n Uses the http_client instance to make the request.\n\n Args:\n method: The HTTP method as a string, usually one of 'GET', 'POST',\n 'PUT', or 'DELETE'\n uri: The URI desired as a string or atom.http_core.Uri.\n http_request:\n auth_token: An authorization token object whose modify_request method\n sets the HTTP Authorization header.\n\n Returns:\n The results of calling self.http_client.request. With the default\n http_client, this is an HTTP response object.\n \"\"\"\n # Modify the request based on the AtomPubClient settings and parameters\n # passed in to the request.\n http_request = self.modify_request(http_request)\n if isinstance(uri, str):\n uri = atom.http_core.Uri.parse_uri(uri)\n if uri is not None:\n uri.modify_request(http_request)\n if isinstance(method, str):\n http_request.method = method\n # Any unrecognized arguments are assumed to be capable of modifying the\n # HTTP request.\n for name, value in kwargs.items():\n if value is not None:\n value.modify_request(http_request)\n # Default to an http request if the protocol scheme is not set.\n if http_request.uri.scheme is None:\n http_request.uri.scheme = 'http'\n # Override scheme. Force requests over https.\n if self.ssl:\n http_request.uri.scheme = 'https'\n if http_request.uri.path is None:\n http_request.uri.path = '/'\n # Add the Authorization header at the very end. The Authorization header\n # value may need to be calculated using information in the request.\n if auth_token:\n auth_token.modify_request(http_request)\n elif self.auth_token:\n self.auth_token.modify_request(http_request)\n # Check to make sure there is a host in the http_request.\n if http_request.uri.host is None:\n raise MissingHost('No host provided in request %s %s' % (\n http_request.method, str(http_request.uri)))\n # Perform the fully specified request using the http_client instance.\n # Sends the request to the server and returns the server's response.\n return self.http_client.request(http_request)",
"metadata": "root.AtomPubClient.request",
"header": "['class', 'AtomPubClient', '(', 'object', ')', ':', '___EOS___']",
"index": 66
},
{
"content": " def get(self, uri=None, auth_token=None, http_request=None, **kwargs):\n \"\"\"Performs a request using the GET method, returns an HTTP response.\"\"\"\n return self.request(method='GET', uri=uri, auth_token=auth_token,\n http_request=http_request, **kwargs)",
"metadata": "root.AtomPubClient.get",
"header": "['class', 'AtomPubClient', '(', 'object', ')', ':', '___EOS___']",
"index": 122
},
{
"content": " def post(self, uri=None, data=None, auth_token=None, http_request=None,\n **kwargs):\n \"\"\"Sends data using the POST method, returns an HTTP response.\"\"\"\n return self.request(method='POST', uri=uri, auth_token=auth_token,\n http_request=http_request, data=data, **kwargs)",
"metadata": "root.AtomPubClient.post",
"header": "['class', 'AtomPubClient', '(', 'object', ')', ':', '___EOS___']",
"index": 129
},
{
"content": " def put(self, uri=None, data=None, auth_token=None, http_request=None,\n **kwargs):\n \"\"\"Sends data using the PUT method, returns an HTTP response.\"\"\"\n return self.request(method='PUT', uri=uri, auth_token=auth_token,\n http_request=http_request, data=data, **kwargs)",
"metadata": "root.AtomPubClient.put",
"header": "['class', 'AtomPubClient', '(', 'object', ')', ':', '___EOS___']",
"index": 137
},
{
"content": " def delete(self, uri=None, auth_token=None, http_request=None, **kwargs):\n \"\"\"Performs a request using the DELETE method, returns an HTTP response.\"\"\"\n return self.request(method='DELETE', uri=uri, auth_token=auth_token,\n http_request=http_request, **kwargs)",
"metadata": "root.AtomPubClient.delete",
"header": "['class', 'AtomPubClient', '(', 'object', ')', ':', '___EOS___']",
"index": 145
},
{
"content": " def modify_request(self, http_request):\n \"\"\"Changes the HTTP request before sending it to the server.\n\n Sets the User-Agent HTTP header and fills in the HTTP host portion\n of the URL if one was not included in the request (for this it uses\n the self.host member if one is set). This method is called in\n self.request.\n\n Args:\n http_request: An atom.http_core.HttpRequest() (optional) If one is\n not provided, a new HttpRequest is instantiated.\n\n Returns:\n An atom.http_core.HttpRequest() with the User-Agent header set and\n if this client has a value in its host member, the host in the request\n URL is set.\n \"\"\"\n if http_request is None:\n http_request = atom.http_core.HttpRequest()\n\n if self.host is not None and http_request.uri.host is None:\n http_request.uri.host = self.host\n\n if self.xoauth_requestor_id is not None:\n http_request.uri.query['xoauth_requestor_id'] = self.xoauth_requestor_id\n\n # Set the user agent header for logging purposes.\n if self.source:\n http_request.headers['User-Agent'] = '%s gdata-py/2.0.16' % self.source\n else:\n http_request.headers['User-Agent'] = 'gdata-py/2.0.16'\n\n return http_request",
"metadata": "root.AtomPubClient.modify_request",
"header": "['class', 'AtomPubClient', '(', 'object', ')', ':', '___EOS___']",
"index": 152
},
{
"content": "class CustomHeaders(object):\n \"\"\"Add custom headers to an http_request.\n\n Usage:\n >>> custom_headers = atom.client.CustomHeaders(header1='value1',\n header2='value2')\n >>> client.get(uri, custom_headers=custom_headers)\n \"\"\"\n\n",
"metadata": "root.CustomHeaders",
"header": "['module', '___EOS___']",
"index": 189
},
{
"content": " def __init__(self, **kwargs):\n \"\"\"Creates a CustomHeaders instance.\n\n Initialize the headers dictionary with the arguments list.\n \"\"\"\n self.headers = kwargs",
"metadata": "root.CustomHeaders.__init__",
"header": "['class', 'CustomHeaders', '(', 'object', ')', ':', '___EOS___']",
"index": 198
},
{
"content": " def modify_request(self, http_request):\n \"\"\"Changes the HTTP request before sending it to the server.\n\n Adds the custom headers to the HTTP request.\n\n Args:\n http_request: An atom.http_core.HttpRequest().\n\n Returns:\n An atom.http_core.HttpRequest() with the added custom headers.\n \"\"\"\n\n for name, value in self.headers.items():\n if value is not None:\n http_request.headers[name] = value\n return http_request",
"metadata": "root.CustomHeaders.modify_request",
"header": "['class', 'CustomHeaders', '(', 'object', ')', ':', '___EOS___']",
"index": 205
}
] | [] | [] | 0 | 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",
")",
" ",
"200",
"9",
" ",
"Goo",
"gle",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Atom",
"Pub",
"Client",
" ",
"provide",
"s",
" ",
"CRUD",
" ",
"ops",
".",
" ",
"in",
" ",
"line",
" ",
"with",
" ",
"the",
" ",
"Atom",
" ",
"Publish",
"ing",
" ",
"Proto",
"col",
".",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"author\\u\\u_",
"=_",
"'",
"j",
".",
"s",
"@",
"google",
".",
"com",
" ",
"(",
"Je",
"ff",
" ",
"Sc",
"ud",
"der",
")'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"atom_",
"._",
"http",
"\\u",
"core_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Error_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Missing",
"Host_",
"(_",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"host_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"auth",
"\\u",
"token_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ssl_",
"=_",
"False_",
"#",
" ",
"Whe",
"ther",
" ",
"to",
" ",
"force",
" ",
"all",
" ",
"request",
"s",
" ",
"over",
" ",
"https_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xo",
"auth",
"\\u",
"requestor",
"\\u",
"id_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Request_",
"=_",
"request_",
"\\u\\u\\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_",
"Get_",
"=_",
"get_",
"\\u\\u\\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_",
"=_",
"post_",
"\\u\\u\\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_",
"Put",
"_",
"=_",
"put_",
"\\u\\u\\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_",
"Delete_",
"=_",
"delete_",
"\\u\\u\\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_",
"Modif",
"y",
"Request_",
"=_",
"modif",
"y",
"\\u",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"http",
"\\u",
"client_",
"=_",
"None_",
",_",
"host_",
"=_",
"None_",
",_",
"auth",
"\\u",
"token_",
"=_",
"None_",
",_",
"source_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"xo",
"auth",
"\\u",
"requestor",
"\\u",
"id_",
"=_",
"None_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"es",
" ",
"a",
" ",
"new",
" ",
"Atom",
"Pub",
"Client",
" ",
"instance",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"source",
":",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"your",
" ",
"applica",
"tion",
".",
"\\",
"10",
";",
" ",
" ",
"http",
"\\u",
"client",
":",
" ",
"An",
" ",
"object",
" ",
"capable",
" ",
"of",
" ",
"perform",
"ing",
" ",
"HTTP",
" ",
"request",
"s",
" ",
"through",
" ",
"a",
"\\",
"10",
";",
" ",
"request",
" ",
"method",
".",
" ",
"Thi",
"s",
" ",
"object",
" ",
"is",
" ",
"used",
" ",
"to",
" ",
"perform",
" ",
"the",
" ",
"request",
"\\",
"10",
";",
" ",
"whe",
"n",
" ",
"the",
" ",
"Atom",
"Pub",
"Client",
"'",
"s",
" ",
"request",
" ",
"method",
" ",
"is",
" ",
"call",
"ed",
".",
" ",
"Us",
"ed",
" ",
"to",
"\\",
"10",
";",
" ",
"allow",
" ",
"HTTP",
" ",
"request",
"s",
" ",
"to",
" ",
"be",
" ",
"direct",
"ed",
" ",
"to",
" ",
"a",
" ",
"mock",
" ",
"server",
",",
" ",
"or",
" ",
"use",
"\\",
"10",
";",
" ",
"an",
" ",
"alternat",
"e",
" ",
"librar",
"y",
" ",
"inst",
"ead",
" ",
"of",
" ",
"the",
" ",
"default",
" ",
"of",
" ",
"http",
"lib",
" ",
"to",
"\\",
"10",
";",
" ",
"make",
" ",
"HTTP",
" ",
"request",
"s",
".",
"\\",
"10",
";",
" ",
" ",
"host",
":",
" ",
"str",
" ",
"The",
" ",
"default",
" ",
"host",
" ",
"name",
" ",
"to",
" ",
"use",
" ",
"if",
" ",
"a",
" ",
"host",
" ",
"is",
" ",
"not",
" ",
"specified",
" ",
"in",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"request",
"ed",
" ",
"URI",
".",
"\\",
"10",
";",
" ",
" ",
"auth",
"\\u",
"token",
":",
" ",
"An",
" ",
"object",
" ",
"whi",
"ch",
" ",
"sets",
" ",
"the",
" ",
"HTTP",
" ",
"Authoriz",
"ation",
" ",
"header",
" ",
"whe",
"n",
" ",
"its",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"modif",
"y",
"\\u",
"request",
" ",
"method",
" ",
"is",
" ",
"call",
"ed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"http",
"\\u",
"client_",
"=_",
"http",
"\\u",
"client_",
"or_",
"atom_",
"._",
"http",
"\\u",
"core_",
"._",
"Proxi",
"ed",
"Http",
"Client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"host_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"host_",
"=_",
"host_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"auth",
"\\u",
"token_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"auth",
"\\u",
"token_",
"=_",
"auth",
"\\u",
"token_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"xo",
"auth",
"\\u",
"requestor",
"\\u",
"id_",
"=_",
"xo",
"auth",
"\\u",
"requestor",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"source_",
"=_",
"source_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"request_",
"(_",
"self_",
",_",
"method_",
"=_",
"None_",
",_",
"uri_",
"=_",
"None_",
",_",
"auth",
"\\u",
"token_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"request_",
"=_",
"None_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Perform",
"s",
" ",
"an",
" ",
"HTTP",
" ",
"request",
" ",
"to",
" ",
"the",
" ",
"server",
" ",
"indicat",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Us",
"es",
" ",
"the",
" ",
"http",
"\\u",
"client",
" ",
"instance",
" ",
"to",
" ",
"make",
" ",
"the",
" ",
"request",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"method",
":",
" ",
"The",
" ",
"HTTP",
" ",
"method",
" ",
"as",
" ",
"a",
" ",
"string",
",",
" ",
"usual",
"ly",
" ",
"one",
" ",
"of",
" ",
"'",
"GET",
"',",
" ",
"'",
"POST",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"'",
"PU",
"T",
"',",
" ",
"or",
" ",
"'",
"DELET",
"E",
"'",
"\\",
"10",
";",
" ",
" ",
"uri",
":",
" ",
"The",
" ",
"URI",
" ",
"desi",
"red",
" ",
"as",
" ",
"a",
" ",
"string",
" ",
"or",
" ",
"atom",
".",
"http",
"\\u",
"core",
".",
"Ur",
"i",
".",
"\\",
"10",
";",
" ",
" ",
"http",
"\\u",
"request",
":",
"\\",
"10",
";",
" ",
" ",
"auth",
"\\u",
"token",
":",
" ",
"An",
" ",
"authoriz",
"ation",
" ",
"token",
" ",
"object",
" ",
"who",
"se",
" ",
"modif",
"y",
"\\u",
"request",
" ",
"method",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"sets",
" ",
"the",
" ",
"HTTP",
" ",
"Authoriz",
"ation",
" ",
"header",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"The",
" ",
"results",
" ",
"of",
" ",
"calling",
" ",
"self",
".",
"http",
"\\u",
"client",
".",
"request",
".",
" ",
"With",
" ",
"the",
" ",
"default",
"\\",
"10",
";",
" ",
" ",
"http",
"\\u",
"client",
",",
" ",
"this",
" ",
"is",
" ",
"an",
" ",
"HTTP",
" ",
"response",
" ",
"object",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Modif",
"y",
" ",
"the",
" ",
"request",
" ",
"based",
" ",
"on",
" ",
"the",
" ",
"Atom",
"Pub",
"Client",
" ",
"settings",
" ",
"and",
" ",
"parameters_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pass",
"ed",
" ",
"in",
" ",
"to",
" ",
"the",
" ",
"request",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"request_",
"=_",
"self_",
"._",
"modif",
"y",
"\\u",
"request_",
"(_",
"http",
"\\u",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"uri_",
",_",
"str_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"uri_",
"=_",
"atom_",
"._",
"http",
"\\u",
"core_",
"._",
"Uri_",
"._",
"parse",
"\\u",
"uri_",
"(_",
"uri_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"uri_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"uri_",
"._",
"modif",
"y",
"\\u",
"request_",
"(_",
"http",
"\\u",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"method_",
",_",
"str_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"._",
"method_",
"=_",
"method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Any",
" ",
"unre",
"cogni",
"zed",
" ",
"argu",
"ment",
"s",
" ",
"are",
" ",
"assume",
"d",
" ",
"to",
" ",
"be",
" ",
"capable",
" ",
"of",
" ",
"modif",
"ying",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"HTTP",
" ",
"request",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"name_",
",_",
"value_",
"in_",
"kwargs_",
"._",
"items_",
"(_",
")_",
":_",
"\\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 ",
" _",
"value_",
"._",
"modif",
"y",
"\\u",
"request_",
"(_",
"http",
"\\u",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Default",
" ",
"to",
" ",
"an",
" ",
"http",
" ",
"request",
" ",
"if",
" ",
"the",
" ",
"protoc",
"ol",
" ",
"sche",
"me",
" ",
"is",
" ",
"not",
" ",
"set",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"scheme_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"scheme_",
"=_",
"'",
"http",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Override",
" ",
"sche",
"me",
".",
" ",
"Force",
" ",
"request",
"s",
" ",
"over",
" ",
"https",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"ssl_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"scheme_",
"=_",
"'",
"https",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"path_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"path_",
"=_",
"'/'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"the",
" ",
"Authoriz",
"ation",
" ",
"header",
" ",
"at",
" ",
"the",
" ",
"very",
" ",
"end",
".",
" ",
"The",
" ",
"Authoriz",
"ation",
" ",
"header_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"value",
" ",
"may",
" ",
"need",
" ",
"to",
" ",
"be",
" ",
"calculated",
" ",
"usi",
"ng",
" ",
"informati",
"on",
" ",
"in",
" ",
"the",
" ",
"request",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"auth",
"\\u",
"token_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"auth",
"\\u",
"token_",
"._",
"modif",
"y",
"\\u",
"request_",
"(_",
"http",
"\\u",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"auth",
"\\u",
"token_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"auth",
"\\u",
"token_",
"._",
"modif",
"y",
"\\u",
"request_",
"(_",
"http",
"\\u",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"to",
" ",
"make",
" ",
"sure",
" ",
"there",
" ",
"is",
" ",
"a",
" ",
"host",
" ",
"in",
" ",
"the",
" ",
"http",
"\\u",
"request",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"host_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Missing",
"Host_",
"(_",
"'",
"No",
" ",
"host",
" ",
"provided",
" ",
"in",
" ",
"request",
" ",
"%",
"s",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"request_",
"._",
"method_",
",_",
"str_",
"(_",
"http",
"\\u",
"request_",
"._",
"uri_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Perform",
" ",
"the",
" ",
"full",
"y",
" ",
"specified",
" ",
"request",
" ",
"usi",
"ng",
" ",
"the",
" ",
"http",
"\\u",
"client",
" ",
"instance",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Sen",
"ds",
" ",
"the",
" ",
"request",
" ",
"to",
" ",
"the",
" ",
"server",
" ",
"and",
" ",
"return",
"s",
" ",
"the",
" ",
"server",
"'",
"s",
" ",
"response",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"http",
"\\u",
"client_",
"._",
"request_",
"(_",
"http",
"\\u",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get_",
"(_",
"self_",
",_",
"uri_",
"=_",
"None_",
",_",
"auth",
"\\u",
"token_",
"=_",
"None_",
",_",
"http",
"\\u",
"request_",
"=_",
"None_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Perform",
"s",
" ",
"a",
" ",
"request",
" ",
"usi",
"ng",
" ",
"the",
" ",
"GET",
" ",
"method",
",",
" ",
"return",
"s",
" ",
"an",
" ",
"HTTP",
" ",
"response",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"request_",
"(_",
"method_",
"=_",
"'",
"GET",
"'_",
",_",
"uri_",
"=_",
"uri_",
",_",
"auth",
"\\u",
"token_",
"=_",
"auth",
"\\u",
"token_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"request_",
"=_",
"http",
"\\u",
"request_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"post_",
"(_",
"self_",
",_",
"uri_",
"=_",
"None_",
",_",
"data_",
"=_",
"None_",
",_",
"auth",
"\\u",
"token_",
"=_",
"None_",
",_",
"http",
"\\u",
"request_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Sen",
"ds",
" ",
"data",
" ",
"usi",
"ng",
" ",
"the",
" ",
"POST",
" ",
"method",
",",
" ",
"return",
"s",
" ",
"an",
" ",
"HTTP",
" ",
"response",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"request_",
"(_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"uri_",
"=_",
"uri_",
",_",
"auth",
"\\u",
"token_",
"=_",
"auth",
"\\u",
"token_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"request_",
"=_",
"http",
"\\u",
"request_",
",_",
"data_",
"=_",
"data_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"put_",
"(_",
"self_",
",_",
"uri_",
"=_",
"None_",
",_",
"data_",
"=_",
"None_",
",_",
"auth",
"\\u",
"token_",
"=_",
"None_",
",_",
"http",
"\\u",
"request_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Sen",
"ds",
" ",
"data",
" ",
"usi",
"ng",
" ",
"the",
" ",
"PU",
"T",
" ",
"method",
",",
" ",
"return",
"s",
" ",
"an",
" ",
"HTTP",
" ",
"response",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"request_",
"(_",
"method_",
"=_",
"'",
"PU",
"T",
"'_",
",_",
"uri_",
"=_",
"uri_",
",_",
"auth",
"\\u",
"token_",
"=_",
"auth",
"\\u",
"token_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"request_",
"=_",
"http",
"\\u",
"request_",
",_",
"data_",
"=_",
"data_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"delete_",
"(_",
"self_",
",_",
"uri_",
"=_",
"None_",
",_",
"auth",
"\\u",
"token_",
"=_",
"None_",
",_",
"http",
"\\u",
"request_",
"=_",
"None_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Perform",
"s",
" ",
"a",
" ",
"request",
" ",
"usi",
"ng",
" ",
"the",
" ",
"DELET",
"E",
" ",
"method",
",",
" ",
"return",
"s",
" ",
"an",
" ",
"HTTP",
" ",
"response",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"request_",
"(_",
"method_",
"=_",
"'",
"DELET",
"E",
"'_",
",_",
"uri_",
"=_",
"uri_",
",_",
"auth",
"\\u",
"token_",
"=_",
"auth",
"\\u",
"token_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"request_",
"=_",
"http",
"\\u",
"request_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atom",
"Pub",
"Client_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"modif",
"y",
"\\u",
"request_",
"(_",
"self_",
",_",
"http",
"\\u",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Change",
"s",
" ",
"the",
" ",
"HTTP",
" ",
"request",
" ",
"bef",
"ore",
" ",
"sendin",
"g",
" ",
"it",
" ",
"to",
" ",
"the",
" ",
"server",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Set",
"s",
" ",
"the",
" ",
"User",
"-",
"Agent",
" ",
"HTTP",
" ",
"header",
" ",
"and",
" ",
"fills",
" ",
"in",
" ",
"the",
" ",
"HTTP",
" ",
"host",
" ",
"porti",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"of",
" ",
"the",
" ",
"URL",
" ",
"if",
" ",
"one",
" ",
"was",
" ",
"not",
" ",
"include",
"d",
" ",
"in",
" ",
"the",
" ",
"request",
" ",
"(",
"for",
" ",
"this",
" ",
"it",
" ",
"use",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"self",
".",
"host",
" ",
"member",
" ",
"if",
" ",
"one",
" ",
"is",
" ",
"set",
").",
" ",
"Thi",
"s",
" ",
"method",
" ",
"is",
" ",
"call",
"ed",
" ",
"in",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"self",
".",
"request",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"http",
"\\u",
"request",
":",
" ",
"An",
" ",
"atom",
".",
"http",
"\\u",
"core",
".",
"Http",
"Request",
"()",
" ",
"(",
"option",
"al",
")",
" ",
"If",
" ",
"one",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
"not",
" ",
"provided",
",",
" ",
"a",
" ",
"new",
" ",
"Http",
"Request",
" ",
"is",
" ",
"instantiate",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"An",
" ",
"atom",
".",
"http",
"\\u",
"core",
".",
"Http",
"Request",
"()",
" ",
"with",
" ",
"the",
" ",
"User",
"-",
"Agent",
" ",
"header",
" ",
"set",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
"if",
" ",
"this",
" ",
"client",
" ",
"has",
" ",
"a",
" ",
"value",
" ",
"in",
" ",
"its",
" ",
"host",
" ",
"member",
",",
" ",
"the",
" ",
"host",
" ",
"in",
" ",
"the",
" ",
"request",
"\\",
"10",
";",
" ",
" ",
"URL",
" ",
"is",
" ",
"set",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"http",
"\\u",
"request_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"=_",
"atom_",
"._",
"http",
"\\u",
"core_",
"._",
"Http",
"Request_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"host_",
"is_",
"not_",
"None_",
"and_",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"host_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"host_",
"=_",
"self_",
"._",
"host_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"xo",
"auth",
"\\u",
"requestor",
"\\u",
"id_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"._",
"uri_",
"._",
"query_",
"[_",
"'",
"xo",
"auth",
"\\u",
"requestor",
"\\u",
"id",
"'_",
"]_",
"=_",
"self_",
"._",
"xo",
"auth",
"\\u",
"requestor",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"the",
" ",
"user",
" ",
"agent",
" ",
"header",
" ",
"for",
" ",
"logg",
"ing",
" ",
"purpose",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"source_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http",
"\\u",
"request_",
"._",
"headers_",
"[_",
"'",
"User",
"-",
"Agent",
"'_",
"]_",
"=_",
"'%",
"s",
" ",
"gdat",
"a",
"-",
"py",
"/",
"2.0",
".1",
"6",
"'_",
"%_",
"self_",
"._",
"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 ",
" _",
"http",
"\\u",
"request_",
"._",
"headers_",
"[_",
"'",
"User",
"-",
"Agent",
"'_",
"]_",
"=_",
"'",
"gdat",
"a",
"-",
"py",
"/",
"2.0",
".1",
"6",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"http",
"\\u",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Custom",
"Headers_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Add",
" ",
"custom",
" ",
"header",
"s",
" ",
"to",
" ",
"an",
" ",
"http",
"\\u",
"request",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Us",
"age",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"custom",
"\\u",
"header",
"s",
" ",
"=",
" ",
"atom",
".",
"client",
".",
"Custom",
"Head",
"ers",
"(",
"header",
"1",
"='",
"value",
"1",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"header",
"2",
"='",
"value",
"2",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"client",
".",
"get",
"(",
"uri",
",",
" ",
"custom",
"\\u",
"header",
"s",
"=",
"custom",
"\\u",
"header",
"s",
")",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Custom",
"Headers_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"es",
" ",
"a",
" ",
"Custom",
"Head",
"ers",
" ",
"instance",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Initializ",
"e",
" ",
"the",
" ",
"header",
"s",
" ",
"dictionar",
"y",
" ",
"with",
" ",
"the",
" ",
"argu",
"ment",
"s",
" ",
"list",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"headers_",
"=_",
"kwargs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Custom",
"Headers_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"modif",
"y",
"\\u",
"request_",
"(_",
"self_",
",_",
"http",
"\\u",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Change",
"s",
" ",
"the",
" ",
"HTTP",
" ",
"request",
" ",
"bef",
"ore",
" ",
"sendin",
"g",
" ",
"it",
" ",
"to",
" ",
"the",
" ",
"server",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Add",
"s",
" ",
"the",
" ",
"custom",
" ",
"header",
"s",
" ",
"to",
" ",
"the",
" ",
"HTTP",
" ",
"request",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"http",
"\\u",
"request",
":",
" ",
"An",
" ",
"atom",
".",
"http",
"\\u",
"core",
".",
"Http",
"Request",
"()",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"An",
" ",
"atom",
".",
"http",
"\\u",
"core",
".",
"Http",
"Request",
"()",
" ",
"with",
" ",
"the",
" ",
"adde",
"d",
" ",
"custom",
" ",
"header",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"name_",
",_",
"value_",
"in_",
"self_",
"._",
"headers_",
"._",
"items_",
"(_",
")_",
":_",
"\\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 ",
" _",
"http",
"\\u",
"request_",
"._",
"headers_",
"[_",
"name_",
"]_",
"=_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"http",
"\\u",
"request_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom calaccess_raw.admin.base import BaseAdmin\nfrom calaccess_raw.admin.campaign import (\n CvrSoCdAdmin,\n Cvr2SoCdAdmin,\n CvrCampaignDisclosureCdAdmin,\n Cvr2CampaignDisclosureCdAdmin,\n RcptCdAdmin,\n Cvr3VerificationInfoCdAdmin,\n LoanCdAdmin,\n S401CdAdmin,\n ExpnCdAdmin,\n F495P2CdAdmin,\n DebtCdAdmin,\n S496CdAdmin,\n SpltCdAdmin,\n S497CdAdmin,\n F501502CdAdmin,\n S498CdAdmin,\n)\nfrom calaccess_raw.admin.lobbying import (\n CvrRegistrationCdAdmin,\n Cvr2RegistrationCdAdmin,\n CvrLobbyDisclosureCdAdmin,\n Cvr2LobbyDisclosureCdAdmin,\n LobbyAmendmentsCdAdmin,\n F690P2CdAdmin,\n LattCdAdmin,\n LexpCdAdmin,\n LccmCdAdmin,\n LothCdAdmin,\n LempCdAdmin,\n LpayCdAdmin,\n)\nfrom calaccess_raw.admin.common import (\n FilernameCdAdmin,\n FilerFilingsCdAdmin,\n FilingsCdAdmin,\n SmryCdAdmin,\n CvrE530CdAdmin,\n TextMemoCdAdmin,\n)\nfrom calaccess_raw.admin.other import (\n AcronymsCdAdmin,\n AddressCdAdmin,\n BallotMeasuresCdAdmin,\n EfsFilingLogCdAdmin,\n FilersCdAdmin,\n FilerAcronymsCdAdmin,\n FilerAddressCdAdmin,\n FilerEthicsClassCdAdmin,\n FilerInterestsCdAdmin,\n FilerLinksCdAdmin,\n FilerStatusTypesCdAdmin,\n FilerToFilerTypeCdAdmin,\n FilerTypesCdAdmin,\n FilerXrefCdAdmin,\n FilingPeriodCdAdmin,\n GroupTypesCdAdmin,\n HeaderCdAdmin,\n HdrCdAdmin,\n ImageLinksCdAdmin,\n LegislativeSessionsCdAdmin,\n LobbyingChgLogCdAdmin,\n LobbyistContributions1CdAdmin,\n LobbyistContributions2CdAdmin,\n LobbyistContributions3CdAdmin,\n LobbyistEmployer1CdAdmin,\n LobbyistEmployer2CdAdmin,\n LobbyistEmployer3CdAdmin,\n LobbyistEmployerFirms1CdAdmin,\n LobbyistEmployerFirms2CdAdmin,\n LobbyistEmpLobbyist1CdAdmin,\n LobbyistEmpLobbyist2CdAdmin,\n LobbyistFirm1CdAdmin,\n LobbyistFirm2CdAdmin,\n LobbyistFirm3CdAdmin,\n LobbyistFirmEmployer1CdAdmin,\n LobbyistFirmEmployer2CdAdmin,\n LobbyistFirmLobbyist1CdAdmin,\n LobbyistFirmLobbyist2CdAdmin,\n LookupCodeAdmin,\n NamesCdAdmin,\n ReceivedFilingsCdAdmin,\n ReportsCdAdmin,\n)\n\nfrom calaccess_raw.admin.tracking import (\n RawDataVersionAdmin,\n RawDataFileAdmin,\n RawDataCommandAdmin\n)\n\n__all__ = [\n 'BaseAdmin',\n 'CvrSoCdAdmin',\n 'Cvr2SoCdAdmin',\n 'CvrCampaignDisclosureCdAdmin',\n 'Cvr2CampaignDisclosureCdAdmin',\n 'RcptCdAdmin',\n 'Cvr3VerificationInfoCdAdmin',\n 'LoanCdAdmin',\n 'S401CdAdmin',\n 'ExpnCdAdmin',\n 'F495P2CdAdmin',\n 'DebtCdAdmin',\n 'S496CdAdmin',\n 'SpltCdAdmin',\n 'S497CdAdmin',\n 'F501502CdAdmin',\n 'S498CdAdmin',\n 'CvrRegistrationCdAdmin',\n 'Cvr2RegistrationCdAdmin',\n 'CvrLobbyDisclosureCdAdmin',\n 'Cvr2LobbyDisclosureCdAdmin',\n 'LobbyAmendmentsCdAdmin',\n 'F690P2CdAdmin',\n 'LattCdAdmin',\n 'LexpCdAdmin',\n 'LccmCdAdmin',\n 'LothCdAdmin',\n 'LempCdAdmin',\n 'LpayCdAdmin',\n 'FilerFilingsCdAdmin',\n 'FilingsCdAdmin',\n 'SmryCdAdmin',\n 'CvrE530CdAdmin',\n 'TextMemoCdAdmin',\n 'AcronymsCdAdmin',\n 'AddressCdAdmin',\n 'BallotMeasuresCdAdmin',\n 'EfsFilingLogCdAdmin',\n 'FilernameCdAdmin',\n 'FilersCdAdmin',\n 'FilerAcronymsCdAdmin',\n 'FilerAddressCdAdmin',\n 'FilerEthicsClassCdAdmin',\n 'FilerInterestsCdAdmin',\n 'FilerLinksCdAdmin',\n 'FilerStatusTypesCdAdmin',\n 'FilerToFilerTypeCdAdmin',\n 'FilerTypesCdAdmin',\n 'FilerXrefCdAdmin',\n 'FilingPeriodCdAdmin',\n 'GroupTypesCdAdmin',\n 'HeaderCdAdmin',\n 'HdrCdAdmin',\n 'ImageLinksCdAdmin',\n 'LegislativeSessionsCdAdmin',\n 'LobbyingChgLogCdAdmin',\n 'LobbyistContributions1CdAdmin',\n 'LobbyistContributions2CdAdmin',\n 'LobbyistContributions3CdAdmin',\n 'LobbyistEmployer1CdAdmin',\n 'LobbyistEmployer2CdAdmin',\n 'LobbyistEmployer3CdAdmin',\n 'LobbyistEmployerFirms1CdAdmin',\n 'LobbyistEmployerFirms2CdAdmin',\n 'LobbyistEmpLobbyist1CdAdmin',\n 'LobbyistEmpLobbyist2CdAdmin',\n 'LobbyistFirm1CdAdmin',\n 'LobbyistFirm2CdAdmin',\n 'LobbyistFirm3CdAdmin',\n 'LobbyistFirmEmployer1CdAdmin',\n 'LobbyistFirmEmployer2CdAdmin',\n 'LobbyistFirmLobbyist1CdAdmin',\n 'LobbyistFirmLobbyist2CdAdmin',\n 'LookupCodeAdmin',\n 'NamesCdAdmin',\n 'ReceivedFilingsCdAdmin',\n 'ReportsCdAdmin',\n 'RawDataVersionAdmin',\n 'RawDataFileAdmin',\n 'RawDataCommandAdmin',\n]\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"cala",
"ccess",
"\\u",
"raw_",
"._",
"admin_",
"._",
"base_",
"import_",
"Base",
"Admin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cala",
"ccess",
"\\u",
"raw_",
"._",
"admin_",
"._",
"campaign_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r",
"So",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r2",
"So",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r",
"Camp",
"aig",
"n",
"Disc",
"los",
"ure",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r2",
"Camp",
"aig",
"n",
"Disc",
"los",
"ure",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Rc",
"pt",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r3",
"Veri",
"fication",
"Info",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Loa",
"n",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S4",
"01",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Exp",
"n",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"F4",
"9",
"5",
"P2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Deb",
"t",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S4",
"96",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Spl",
"t",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S4",
"9",
"7",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"F5",
"015",
"02",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S4",
"98",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cala",
"ccess",
"\\u",
"raw_",
"._",
"admin_",
"._",
"lobby",
"ing_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r",
"Registration",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r2",
"Registration",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r",
"Lo",
"bby",
"Disc",
"los",
"ure",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r2",
"Lo",
"bby",
"Disc",
"los",
"ure",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"Ame",
"ndm",
"ents",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"F6",
"90",
"P2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lat",
"t",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lex",
"p",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lc",
"cm",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lot",
"h",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lem",
"p",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lp",
"ay",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cala",
"ccess",
"\\u",
"raw_",
"._",
"admin_",
"._",
"common_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"rnam",
"e",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Fil",
"ings",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Fil",
"ings",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Sm",
"ry",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cv",
"r",
"E5",
"30",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Text",
"Memo",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cala",
"ccess",
"\\u",
"raw_",
"._",
"admin_",
"._",
"other_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Acr",
"ony",
"ms",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Address",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ball",
"ot",
"Measure",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ef",
"s",
"Fil",
"ing",
"Log",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"rs",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Acr",
"ony",
"ms",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Address",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Eth",
"ics",
"Class",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Interest",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Link",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Status",
"Type",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"To",
"File",
"r",
"Type",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Type",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"File",
"r",
"Xr",
"ef",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Fil",
"ing",
"Period",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Group",
"Type",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Head",
"er",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Hdr",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Image",
"Link",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Legi",
"slat",
"ive",
"Sess",
"ion",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ing",
"Ch",
"g",
"Log",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Contribution",
"s1",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Contribution",
"s2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Contribution",
"s3",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Employe",
"r1",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Employe",
"r2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Employe",
"r3",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Employe",
"r",
"Firm",
"s1",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Employe",
"r",
"Firm",
"s2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Emp",
"Lo",
"bby",
"ist",
"1",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Emp",
"Lo",
"bby",
"ist",
"2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Firm",
"1",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Firm",
"2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Firm",
"3",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Firm",
"Employe",
"r1",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Firm",
"Employe",
"r2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Firm",
"Lo",
"bby",
"ist",
"1",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lo",
"bby",
"ist",
"Firm",
"Lo",
"bby",
"ist",
"2",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Look",
"up",
"Code",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Names",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Receive",
"d",
"Fil",
"ings",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Report",
"s",
"Cd",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"cala",
"ccess",
"\\u",
"raw_",
"._",
"admin_",
"._",
"tracking_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ra",
"w",
"Data",
"Version",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ra",
"w",
"Data",
"File",
"Admin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ra",
"w",
"Data",
"Command",
"Admin_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Base",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r",
"So",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r2",
"So",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r",
"Camp",
"aig",
"n",
"Disc",
"los",
"ure",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r2",
"Camp",
"aig",
"n",
"Disc",
"los",
"ure",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Rc",
"pt",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r3",
"Veri",
"fication",
"Info",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Loa",
"n",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"S4",
"01",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Exp",
"n",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"F4",
"9",
"5",
"P2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Deb",
"t",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"S4",
"96",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Spl",
"t",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"S4",
"9",
"7",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"F5",
"015",
"02",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"S4",
"98",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r",
"Registration",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r2",
"Registration",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r",
"Lo",
"bby",
"Disc",
"los",
"ure",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r2",
"Lo",
"bby",
"Disc",
"los",
"ure",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"Ame",
"ndm",
"ents",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"F6",
"90",
"P2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lat",
"t",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lex",
"p",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lc",
"cm",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lot",
"h",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lem",
"p",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lp",
"ay",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Fil",
"ings",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Fil",
"ings",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Sm",
"ry",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Cv",
"r",
"E5",
"30",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Text",
"Memo",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Acr",
"ony",
"ms",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Address",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Ball",
"ot",
"Measure",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Ef",
"s",
"Fil",
"ing",
"Log",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"rnam",
"e",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"rs",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Acr",
"ony",
"ms",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Address",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Eth",
"ics",
"Class",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Interest",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Link",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Status",
"Type",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"To",
"File",
"r",
"Type",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Type",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"File",
"r",
"Xr",
"ef",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Fil",
"ing",
"Period",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Group",
"Type",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Head",
"er",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Hdr",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Image",
"Link",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Legi",
"slat",
"ive",
"Sess",
"ion",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ing",
"Ch",
"g",
"Log",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Contribution",
"s1",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Contribution",
"s2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Contribution",
"s3",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Employe",
"r1",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Employe",
"r2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Employe",
"r3",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Employe",
"r",
"Firm",
"s1",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Employe",
"r",
"Firm",
"s2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Emp",
"Lo",
"bby",
"ist",
"1",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Emp",
"Lo",
"bby",
"ist",
"2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Firm",
"1",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Firm",
"2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Firm",
"3",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Firm",
"Employe",
"r1",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Firm",
"Employe",
"r2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Firm",
"Lo",
"bby",
"ist",
"1",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lo",
"bby",
"ist",
"Firm",
"Lo",
"bby",
"ist",
"2",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Look",
"up",
"Code",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Names",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Receive",
"d",
"Fil",
"ings",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Report",
"s",
"Cd",
"Admi",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Ra",
"w",
"Data",
"Version",
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adata": "root.BaseWindow.heading_subtitle",
"header": "['class', 'BaseWindow', '(', 'wx', '.', 'Frame', ')', ':', '___EOS___']",
"index": 71
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Base",
"Window_",
"(_",
"wx_",
"._",
"Frame_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"heading",
"\\u",
"subtitle_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"head",
"\\u",
"panel_",
"._",
"subtitle_",
"\\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
] |
Unused local variable | fp7-ofelia/ocf/expedient/src/python/expedient/common/permissions/models.py | [
{
"content": " def give_to(self, receiver, giver=None, can_delegate=False):\n \"\"\"\n Give permission ownership to an object. This method also checks that\n the action is allowed (the C{giver} can actually give the permission\n to C{receiver}).\n \n @param receiver: The permittee receiving the permission. If not a\n L{Permittee} instance, one will be created (if not found).\n @type receiver: L{Permittee} or C{Model} instance.\n @keyword giver: The permission owner giving the permission. If not a\n L{Permittee} instance, one will be created (if not found).\n Defaults to C{None}.\n @type giver: L{Permittee} or C{Model} instance.\n @keyword can_delegate: Can the receiver in turn give the permission\n out? Default is False.\n @type can_delegate: L{bool}\n @return: The new C{PermissionOwnership} instance.\n \"\"\"\n # Is someone delegating the permission?\n if giver:\n giver = Permittee.objects.get_as_permittee(giver)\n\n # check that the giver can give ownership\n can_give = Permittee.objects.filter_for_obj_permission(\n# self, can_delegate=True).filter(\n # No need to find for some one that CAN actually delegate...\n # Permissions already take care of this.\n self, can_delegate=False).filter(\n id=giver.id).count() > 0\n \n if not can_give:\n raise PermissionCannotBeDelegated(\n giver, self.permission.name)\n \n receiver = Permittee.objects.get_as_permittee(receiver)\n \n # All is good get or create the permission.\n po, created = PermissionOwnership.objects.get_or_create(\n obj_permission=self,\n permittee=receiver,\n defaults=dict(can_delegate=can_delegate),\n )\n \n # Don't change the can_delegate option if the permission was already\n # created unless if it's to enable it. We don't want people\n # taking each other's delegation capabilities (e.g. from owner)\n if po.can_delegate != can_delegate and (created or \\\n (not created and can_delegate)):\n po.can_delegate = can_delegate\n po.save()\n \n return po",
"metadata": "root.ObjectPermission.give_to",
"header": "['class', 'ObjectPermission', '(', 'models', '.', 'Model', ')', ':', '___EOS___']",
"index": 109
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Object",
"Permission_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"give",
"\\u",
"to_",
"(_",
"self_",
",_",
"receiver_",
",_",
"give",
"r_",
"=_",
"None_",
",_",
"can",
"\\u",
"delegate_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Give",
" ",
"permissi",
"on",
" ",
"owner",
"ship",
" ",
"to",
" ",
"an",
" ",
"object",
".",
" ",
"Thi",
"s",
" ",
"method",
" ",
"als",
"o",
" ",
"checks",
" ",
"tha",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"action",
" ",
"is",
" ",
"allow",
"ed",
" ",
"(",
"the",
" ",
"C",
"{",
"give",
"r",
"}",
" ",
"can",
" ",
"actual",
"ly",
" ",
"give",
" ",
"the",
" ",
"permissi",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"C",
"{",
"receive",
"r",
"}).",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"receive",
"r",
":",
" ",
"The",
" ",
"permit",
"tee",
" ",
"receiv",
"ing",
" ",
"the",
" ",
"permissi",
"on",
".",
" ",
"If",
" ",
"not",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"L",
"{",
"Permi",
"tte",
"e",
"}",
" ",
"instance",
",",
" ",
"one",
" ",
"will",
" ",
"be",
" ",
"created",
" ",
"(",
"if",
" ",
"not",
" ",
"found",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"receive",
"r",
":",
" ",
"L",
"{",
"Permi",
"tte",
"e",
"}",
" ",
"or",
" ",
"C",
"{",
"Model",
"}",
" ",
"instance",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"keyw",
"ord",
" ",
"give",
"r",
":",
" ",
"The",
" ",
"permissi",
"on",
" ",
"owner",
" ",
"gi",
"ving",
" ",
"the",
" ",
"permissi",
"on",
".",
" ",
"If",
" ",
"not",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"L",
"{",
"Permi",
"tte",
"e",
"}",
" ",
"instance",
",",
" ",
"one",
" ",
"will",
" ",
"be",
" ",
"created",
" ",
"(",
"if",
" ",
"not",
" ",
"found",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Default",
"s",
" ",
"to",
" ",
"C",
"{",
"Non",
"e",
"}.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"give",
"r",
":",
" ",
"L",
"{",
"Permi",
"tte",
"e",
"}",
" ",
"or",
" ",
"C",
"{",
"Model",
"}",
" ",
"instance",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"keyw",
"ord",
" ",
"can",
"\\u",
"delegate",
":",
" ",
"Can",
" ",
"the",
" ",
"receive",
"r",
" ",
"in",
" ",
"turn",
" ",
"give",
" ",
"the",
" ",
"permissi",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"out",
"?",
" ",
"Default",
" ",
"is",
" ",
"Fal",
"se",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"can",
"\\u",
"delegate",
":",
" ",
"L",
"{",
"bool",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"return",
":",
" ",
"The",
" ",
"new",
" ",
"C",
"{",
"Permi",
"ssion",
"Owne",
"rshi",
"p",
"}",
" ",
"instance",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Is",
" ",
"some",
"one",
" ",
"delegat",
"ing",
" ",
"the",
" ",
"permissi",
"on",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"give",
"r_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"give",
"r_",
"=_",
"Permi",
"tte",
"e_",
"._",
"objects_",
"._",
"get",
"\\u",
"as",
"\\u",
"permit",
"tee",
"_",
"(_",
"give",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"check",
" ",
"tha",
"t",
" ",
"the",
" ",
"give",
"r",
" ",
"can",
" ",
"give",
" ",
"ownership_",
"\\u\\u\\uNL\\u\\u\\u_",
"can",
"\\u",
"give",
"_",
"=_",
"Permi",
"tte",
"e_",
"._",
"objects_",
"._",
"filter",
"\\u",
"for",
"\\u",
"obj",
"\\u",
"permission_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"self",
",",
" ",
"can",
"\\u",
"delegate",
"=",
"Tru",
"e",
").",
"filter",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"No",
" ",
"need",
" ",
"to",
" ",
"find",
" ",
"for",
" ",
"some",
" ",
"one",
" ",
"tha",
"t",
" ",
"CAN",
" ",
"actual",
"ly",
" ",
"delegate",
"..._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Permi",
"ssion",
"s",
" ",
"alr",
"ead",
"y",
" ",
"take",
" ",
"care",
" ",
"of",
" ",
"this",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
",_",
"can",
"\\u",
"delegate_",
"=_",
"False_",
")_",
"._",
"filter_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"id_",
"=_",
"give",
"r_",
"._",
"id_",
")_",
"._",
"count_",
"(_",
")_",
">_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"can",
"\\u",
"give",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Permi",
"ssion",
"Cann",
"ot",
"Be",
"Delegate",
"d_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"give",
"r_",
",_",
"self_",
"._",
"permission_",
"._",
"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_",
"receiver_",
"=_",
"Permi",
"tte",
"e_",
"._",
"objects_",
"._",
"get",
"\\u",
"as",
"\\u",
"permit",
"tee",
"_",
"(_",
"receiver_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"is",
" ",
"good",
" ",
"get",
" ",
"or",
" ",
"create",
" ",
"the",
" ",
"permissi",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"po_",
",_",
"created_",
"=_",
"Permi",
"ssion",
"Owne",
"rshi",
"p_",
"._",
"objects_",
"._",
"get",
"\\u",
"or",
"\\u",
"create_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"obj",
"\\u",
"permission_",
"=_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"permit",
"tee",
"_",
"=_",
"receiver_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"defaults_",
"=_",
"dict_",
"(_",
"can",
"\\u",
"delegate_",
"=_",
"can",
"\\u",
"delegate_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"change",
" ",
"the",
" ",
"can",
"\\u",
"delegate",
" ",
"option",
" ",
"if",
" ",
"the",
" ",
"permissi",
"on",
" ",
"was",
" ",
"alr",
"ead",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"created",
" ",
"unl",
"ess",
" ",
"if",
" ",
"it",
"'",
"s",
" ",
"to",
" ",
"enable",
" ",
"it",
".",
" ",
"We",
" ",
"don",
"'",
"t",
" ",
"want",
" ",
"people_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"tak",
"ing",
" ",
"each",
" ",
"other",
"'",
"s",
" ",
"delegat",
"ion",
" ",
"capab",
"ilities",
" ",
"(",
"e",
".",
"g",
".",
" ",
"from",
" ",
"owner",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"po_",
"._",
"can",
"\\u",
"delegate_",
"!=_",
"can",
"\\u",
"delegate_",
"and_",
"(_",
"created_",
"or_",
"(_",
"not_",
"created_",
"and_",
"can",
"\\u",
"delegate_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"po_",
"._",
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | idlesign/django-sitecats/setup.py | [
{
"content": "import os\nfrom setuptools import setup\nfrom sitecats import VERSION\n\n\nPATH_BASE = os.path.dirname(__file__)\n\n\nf = open(os.path.join(PATH_BASE, 'README.rst'))\nREADME = f.read()\nf.close()\n\nsetup(\n name='django-sitecats',\n version='.'.join(map(str, VERSION)),\n url='https://github.com/idlesign/django-sitecats',\n\n description='Django reusable application for content categorization.',\n long_description=README,\n license='BSD 3-Clause License',\n\n author='Igor `idle sign` Starikov',\n author_email='[email protected]',\n\n packages=['sitecats'],\n install_requires=['django-etc'],\n include_package_data=True,\n zip_safe=False,\n\n classifiers=[\n # As in https://pypi.python.org/pypi?:action=list_classifiers\n 'Development Status :: 4 - Beta',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5',\n 'License :: OSI Approved :: BSD License'\n ],\n)\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"setuptools_",
"import_",
"setup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"site",
"cats_",
"import_",
"VERSION_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"PATH",
"\\u",
"BASE_",
"=_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"f_",
"=_",
"open_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"PATH",
"\\u",
"BASE_",
",_",
"'",
"READ",
"ME",
".",
"rst",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"READ",
"ME_",
"=_",
"f_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"setup_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"django",
"-",
"site",
"cat",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"'.'_",
"._",
"join_",
"(_",
"map_",
"(_",
"str_",
",_",
"VERSION_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"idle",
"sign",
"/",
"django",
"-",
"site",
"cat",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"'",
"Dj",
"ang",
"o",
" ",
"reus",
"able",
" ",
"applica",
"tion",
" ",
"for",
" ",
"content",
" ",
"categoriz",
"ation",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"long",
"\\u",
"description_",
"=_",
"READ",
"ME_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"license_",
"=_",
"'",
"BS",
"D",
" ",
"3",
"-",
"Cla",
"use",
" ",
"License",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"author_",
"=_",
"'",
"Ig",
"or",
" ",
"`",
"idle",
" ",
"sign",
"`",
" ",
"Star",
"iko",
"v",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author",
"\\u",
"email_",
"=_",
"'",
"idle",
"sign",
"@",
"yan",
"dex",
".",
"ru",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"packages_",
"=_",
"[_",
"'",
"site",
"cat",
"s",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"install",
"\\u",
"requires_",
"=_",
"[_",
"'",
"django",
"-",
"etc",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"include",
"\\u",
"package",
"\\u",
"data_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"zip",
"\\u",
"safe_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"classifiers_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"As",
" ",
"in",
" ",
"https",
"://",
"pypi",
".",
"python",
".",
"org",
"/",
"pypi",
"?:",
"action",
"=",
"list",
"\\u",
"classifiers_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Dev",
"elo",
"pme",
"nt",
" ",
"Status",
" ",
"::",
" ",
"4",
" ",
"-",
" ",
"Beta",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Opera",
"ting",
" ",
"System",
" ",
"::",
" ",
"OS",
" ",
"Inde",
"pend",
"ent",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"2.7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"3.3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"3.4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"3.5",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"License",
" ",
"::",
" ",
"OSI",
" ",
"Appro",
"ved",
" ",
"::",
" ",
"BS",
"D",
" ",
"License",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | kobotoolbox/kobocat/onadata/apps/logger/management/commands/update_xform_uuids.py | [
{
"content": "class Command(BaseCommand):\n help = ugettext_lazy(\n \"Use a csv file with username, id_string and new_uuid to set new uuids\"\n )\n option_list = BaseCommand.option_list + (\n make_option('-f', '--file',\n help=ugettext_lazy(\"Path to csv file\")),)\n",
"metadata": "root.Command",
"header": "['module', '___EOS___']",
"index": 13
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Command_",
"(_",
"Base",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"help_",
"=_",
"uge",
"ttext",
"\\u",
"lazy_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Us",
"e",
" ",
"a",
" ",
"csv",
" ",
"file",
" ",
"with",
" ",
"user",
"name",
",",
" ",
"id",
"\\u",
"string",
" ",
"and",
" ",
"new",
"\\u",
"uuid",
" ",
"to",
" ",
"set",
" ",
"new",
" ",
"uuids",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"option",
"\\u",
"list_",
"=_",
"Base",
"Command_",
"._",
"option",
"\\u",
"list_",
"+_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"make",
"\\u",
"option_",
"(_",
"'-",
"f",
"'_",
",_",
"'--",
"file",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"uge",
"ttext",
"\\u",
"lazy_",
"(_",
"\"",
"Path",
" ",
"to",
" ",
"csv",
" ",
"file",
"\"_",
")_",
")_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | corydolphin/flask-cors/examples/blueprints_based_example.py | [
{
"content": "\"\"\"\nFlask-Cors example\n===================\nThis is a tiny Flask Application demonstrating Flask-Cors, making it simple\nto add cross origin support to your flask app!\n\n:copyright: (C) 2013 by Cory Dolphin.\n:license: MIT/X11, see LICENSE for more details.\n\"\"\"\nfrom flask import Flask, jsonify, Blueprint\nimport logging\ntry:\n from flask.ext.cors import CORS # The typical way to import flask-cors\nexcept ImportError:\n # Path hack allows examples to be run without installation.\n import os\n parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n os.sys.path.insert(0, parentdir)\n\n from flask.ext.cors import CORS\n\n\napi_v1 = Blueprint('API_v1', __name__)\n\nCORS(api_v1) # enable CORS on the API_v1 blue print\n\n\n\n\npublic_routes = Blueprint('public', __name__)\n\n\n\nlogging.basicConfig(level=logging.INFO)\napp = Flask('FlaskCorsBlueprintBasedExample')\napp.register_blueprint(api_v1)\napp.register_blueprint(public_routes)\n\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "@api_v1.route(\"/api/v1/users/\")\ndef list_users():\n '''\n Since the path matches the regular expression r'/api/*', this resource\n automatically has CORS headers set. The expected result is as follows:\n\n $ curl --include -X GET http://127.0.0.1:5000/api/v1/users/ \\\n --header Origin:www.examplesite.com\n HTTP/1.0 200 OK\n Access-Control-Allow-Headers: Content-Type\n Access-Control-Allow-Origin: *\n Content-Length: 21\n Content-Type: application/json\n Date: Sat, 09 Aug 2014 00:26:41 GMT\n Server: Werkzeug/0.9.4 Python/2.7.8\n\n {\n \"success\": true\n }\n\n '''\n return jsonify(user=\"joe\")",
"metadata": "root.list_users",
"header": "['module', '___EOS___']",
"index": 26
},
{
"content": "@api_v1.route(\"/api/v1/users/create\", methods=['POST'])\ndef create_user():\n '''\n Since the path matches the regular expression r'/api/*', this resource\n automatically has CORS headers set.\n\n Browsers will first make a preflight request to verify that the resource\n allows cross-origin POSTs with a JSON Content-Type, which can be simulated\n as:\n $ curl --include -X OPTIONS http://127.0.0.1:5000/api/v1/users/create \\\n --header Access-Control-Request-Method:POST \\\n --header Access-Control-Request-Headers:Content-Type \\\n --header Origin:www.examplesite.com\n >> HTTP/1.0 200 OK\n Content-Type: text/html; charset=utf-8\n Allow: POST, OPTIONS\n Access-Control-Allow-Origin: *\n Access-Control-Allow-Headers: Content-Type\n Access-Control-Allow-Methods: DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT\n Content-Length: 0\n Server: Werkzeug/0.9.6 Python/2.7.9\n Date: Sat, 31 Jan 2015 22:25:22 GMT\n\n\n $ curl --include -X POST http://127.0.0.1:5000/api/v1/users/create \\\n --header Content-Type:application/json \\\n --header Origin:www.examplesite.com\n\n\n >> HTTP/1.0 200 OK\n Content-Type: application/json\n Content-Length: 21\n Access-Control-Allow-Origin: *\n Server: Werkzeug/0.9.6 Python/2.7.9\n Date: Sat, 31 Jan 2015 22:25:04 GMT\n\n {\n \"success\": true\n }\n\n '''\n return jsonify(success=True)",
"metadata": "root.create_user",
"header": "['module', '___EOS___']",
"index": 50
},
{
"content": "@public_routes.route(\"/\")\ndef helloWorld():\n '''\n Since the path '/' does not match the regular expression r'/api/*',\n this route does not have CORS headers set.\n '''\n return '''<h1>Hello CORS!</h1> Read about my spec at the\n<a href=\"http://www.w3.org/TR/cors/\">W3</a> Or, checkout my documentation\non <a href=\"https://github.com/corydolphin/flask-cors\">Github</a>'''",
"metadata": "root.helloWorld",
"header": "['module', '___EOS___']",
"index": 95
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Fla",
"sk",
"-",
"Cor",
"s",
" ",
"example",
"\\",
"10",
";",
"==============",
"=====",
"\\",
"10",
";",
"Thi",
"s",
" ",
"is",
" ",
"a",
" ",
"tiny",
" ",
"Fla",
"sk",
" ",
"Applica",
"tion",
" ",
"demonstrat",
"ing",
" ",
"Fla",
"sk",
"-",
"Cor",
"s",
",",
" ",
"mak",
"ing",
" ",
"it",
" ",
"simple",
"\\",
"10",
";",
"to",
" ",
"add",
" ",
"cross",
" ",
"orig",
"in",
" ",
"support",
" ",
"to",
" ",
"your",
" ",
"fla",
"sk",
" ",
"app",
"!",
"\\",
"10",
";",
"\\",
"10",
";",
":",
"copyr",
"ight",
":",
" ",
"(",
"C",
")",
" ",
"2013",
" ",
"by",
" ",
"Cor",
"y",
" ",
"Dol",
"phin",
".",
"\\",
"10",
";",
":",
"license",
":",
" ",
" ",
" ",
"MIT",
"/",
"X1",
"1",
",",
" ",
"see",
" ",
"LICENSE",
" ",
"for",
" ",
"more",
" ",
"deta",
"il",
"s",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"flask_",
"import_",
"Flask_",
",_",
"jsonify_",
",_",
"Blueprint_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"flask_",
"._",
"ext_",
"._",
"cors",
"_",
"import_",
"CORS",
"_",
"#",
" ",
"The",
" ",
"typical",
" ",
"way",
" ",
"to",
" ",
"import",
" ",
"fla",
"sk",
"-",
"cors",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Path",
" ",
"hack",
" ",
"allow",
"s",
" ",
"example",
"s",
" ",
"to",
" ",
"be",
" ",
"run",
" ",
"with",
"out",
" ",
"installation",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parent",
"dir_",
"=_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"sys_",
"._",
"path_",
"._",
"insert_",
"(_",
"0_",
",_",
"parent",
"dir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"flask_",
"._",
"ext_",
"._",
"cors",
"_",
"import_",
"CORS",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"api",
"\\u",
"v1_",
"=_",
"Blueprint_",
"(_",
"'",
"API",
"\\u",
"v1",
"'_",
",_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"CORS",
"_",
"(_",
"api",
"\\u",
"v1_",
")_",
"#",
" ",
"enable",
" ",
"CORS",
" ",
"on",
" ",
"the",
" ",
"API",
"\\u",
"v1",
" ",
"blue",
" ",
"print_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"public",
"\\u",
"routes_",
"=_",
"Blueprint_",
"(_",
"'",
"public",
"'_",
",_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\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_",
"logging_",
"._",
"basic",
"Config_",
"(_",
"level_",
"=_",
"logging_",
"._",
"INFO_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"=_",
"Flask_",
"(_",
"'",
"Fla",
"sk",
"Cor",
"s",
"Blue",
"print",
"Base",
"d",
"Exam",
"ple",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"register",
"\\u",
"blueprint_",
"(_",
"api",
"\\u",
"v1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"register",
"\\u",
"blueprint_",
"(_",
"public",
"\\u",
"routes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"run_",
"(_",
"debug_",
"=_",
"True_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"api",
"\\u",
"v1_",
"._",
"route_",
"(_",
"\"/",
"api",
"/",
"v1",
"/",
"users",
"/\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"list",
"\\u",
"users_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sin",
"ce",
" ",
"the",
" ",
"path",
" ",
"matche",
"s",
" ",
"the",
" ",
"regular",
" ",
"express",
"ion",
" ",
"r",
"'/",
"api",
"/*",
"',",
" ",
"this",
" ",
"resource",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"automati",
"call",
"y",
" ",
"has",
" ",
"CORS",
" ",
"header",
"s",
" ",
"set",
".",
" ",
"The",
" ",
"expected",
" ",
"result",
" ",
"is",
" ",
"as",
" ",
"follow",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"$",
" ",
"curl",
" ",
"--",
"include",
" ",
"-",
"X",
" ",
"GET",
" ",
"http",
"://",
"127",
".0",
".0",
".1",
":",
"5000",
"/",
"api",
"/",
"v1",
"/",
"users",
"/",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--",
"header",
" ",
"Orig",
"in",
":",
"www",
".",
"example",
"site",
".",
"com",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"HTTP",
"/",
"1.0",
" ",
"200",
" ",
"OK",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Access",
"-",
"Control",
"-",
"All",
"ow",
"-",
"Head",
"ers",
":",
" ",
"Conten",
"t",
"-",
"Type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Access",
"-",
"Control",
"-",
"All",
"ow",
"-",
"Orig",
"in",
":",
" ",
"*",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Conten",
"t",
"-",
"Length",
":",
" ",
"21",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Conten",
"t",
"-",
"Type",
":",
" ",
"applica",
"tion",
"/",
"json",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Date",
":",
" ",
"Sat",
",",
" ",
"09",
" ",
"Au",
"g",
" ",
"2014",
" ",
"00",
":",
"2",
"6",
":",
"4",
"1",
" ",
"GM",
"T",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Server",
":",
" ",
"Wer",
"kz",
"eu",
"g",
"/",
"0.",
"9.4",
" ",
"Pyth",
"on",
"/",
"2.7",
".8",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"success",
"\":",
" ",
"true",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"}",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"jsonify_",
"(_",
"user_",
"=_",
"\"",
"jo",
"e",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"api",
"\\u",
"v1_",
"._",
"route_",
"(_",
"\"/",
"api",
"/",
"v1",
"/",
"users",
"/",
"create",
"\"_",
",_",
"methods_",
"=_",
"[_",
"'",
"POST",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"create",
"\\u",
"user_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sin",
"ce",
" ",
"the",
" ",
"path",
" ",
"matche",
"s",
" ",
"the",
" ",
"regular",
" ",
"express",
"ion",
" ",
"r",
"'/",
"api",
"/*",
"',",
" ",
"this",
" ",
"resource",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"automati",
"call",
"y",
" ",
"has",
" ",
"CORS",
" ",
"header",
"s",
" ",
"set",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Brows",
"ers",
" ",
"will",
" ",
"first",
" ",
"make",
" ",
"a",
" ",
"pref",
"light",
" ",
"request",
" ",
"to",
" ",
"verify",
" ",
"tha",
"t",
" ",
"the",
" ",
"resource",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"allow",
"s",
" ",
"cross",
"-",
"orig",
"in",
" ",
"POST",
"s",
" ",
"with",
" ",
"a",
" ",
"JSO",
"N",
" ",
"Conten",
"t",
"-",
"Type",
",",
" ",
"whi",
"ch",
" ",
"can",
" ",
"be",
" ",
"simulat",
"ed",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"as",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"$",
" ",
"curl",
" ",
"--",
"include",
" ",
"-",
"X",
" ",
"OPTION",
"S",
" ",
"http",
"://",
"127",
".0",
".0",
".1",
":",
"5000",
"/",
"api",
"/",
"v1",
"/",
"users",
"/",
"create",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--",
"header",
" ",
"Access",
"-",
"Control",
"-",
"Request",
"-",
"Meth",
"od",
":",
"POST",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--",
"header",
" ",
"Access",
"-",
"Control",
"-",
"Request",
"-",
"Head",
"ers",
":",
"Conten",
"t",
"-",
"Type",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--",
"header",
" ",
"Orig",
"in",
":",
"www",
".",
"example",
"site",
".",
"com",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>",
" ",
"HTTP",
"/",
"1.0",
" ",
"200",
" ",
"OK",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Conten",
"t",
"-",
"Type",
":",
" ",
"text",
"/",
"html",
";",
" ",
"charset",
"=",
"utf",
"-",
"8",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"All",
"ow",
":",
" ",
"POST",
",",
" ",
"OPTION",
"S",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Access",
"-",
"Control",
"-",
"All",
"ow",
"-",
"Orig",
"in",
":",
" ",
"*",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Access",
"-",
"Control",
"-",
"All",
"ow",
"-",
"Head",
"ers",
":",
" ",
"Conten",
"t",
"-",
"Type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Access",
"-",
"Control",
"-",
"All",
"ow",
"-",
"Meth",
"ods",
":",
" ",
"DELET",
"E",
",",
" ",
"GET",
",",
" ",
"HEAD",
",",
" ",
"OPTION",
"S",
",",
" ",
"PATCH",
",",
" ",
"POST",
",",
" ",
"PU",
"T",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Conten",
"t",
"-",
"Length",
":",
" ",
"0",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Server",
":",
" ",
"Wer",
"kz",
"eu",
"g",
"/",
"0.",
"9.6",
" ",
"Pyth",
"on",
"/",
"2.7",
".9",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Date",
":",
" ",
"Sat",
",",
" ",
"3",
"1",
" ",
"Jan",
" ",
"201",
"5",
" ",
"2",
"2",
":",
"25",
":",
"2",
"2",
" ",
"GM",
"T",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"$",
" ",
"curl",
" ",
"--",
"include",
" ",
"-",
"X",
" ",
"POST",
" ",
"http",
"://",
"127",
".0",
".0",
".1",
":",
"5000",
"/",
"api",
"/",
"v1",
"/",
"users",
"/",
"create",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--",
"header",
" ",
"Conten",
"t",
"-",
"Type",
":",
"applica",
"tion",
"/",
"json",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--",
"header",
" ",
"Orig",
"in",
":",
"www",
".",
"example",
"site",
".",
"com",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>",
" ",
"HTTP",
"/",
"1.0",
" ",
"200",
" ",
"OK",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Conten",
"t",
"-",
"Type",
":",
" ",
"applica",
"tion",
"/",
"json",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Conten",
"t",
"-",
"Length",
":",
" ",
"21",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Access",
"-",
"Control",
"-",
"All",
"ow",
"-",
"Orig",
"in",
":",
" ",
"*",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Server",
":",
" ",
"Wer",
"kz",
"eu",
"g",
"/",
"0.",
"9.6",
" ",
"Pyth",
"on",
"/",
"2.7",
".9",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Date",
":",
" ",
"Sat",
",",
" ",
"3",
"1",
" ",
"Jan",
" ",
"201",
"5",
" ",
"2",
"2",
":",
"25",
":",
"04",
" ",
"GM",
"T",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{",
"\\",
"10",
";",
" ",
" ",
"\"",
"success",
"\":",
" ",
"true",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"}",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"jsonify_",
"(_",
"success_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"public",
"\\u",
"routes_",
"._",
"route_",
"(_",
"\"/\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"hell",
"o",
"World_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sin",
"ce",
" ",
"the",
" ",
"path",
" ",
"'/'",
" ",
"doe",
"s",
" ",
"not",
" ",
"match",
" ",
"the",
" ",
"regular",
" ",
"express",
"ion",
" ",
"r",
"'/",
"api",
"/*",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"this",
" ",
"route",
" ",
"doe",
"s",
" ",
"not",
" ",
"have",
" ",
"CORS",
" ",
"header",
"s",
" ",
"set",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"'''",
"<",
"h1",
">",
"Hell",
"o",
" ",
"CORS",
"!<",
"/",
"h1",
">",
" ",
"Read",
" ",
"abo",
"ut",
" ",
"my",
" ",
"spec",
" ",
"at",
" ",
"the",
"\\",
"10",
";<",
"a",
" ",
"href",
"=\"",
"http",
"://",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"cors",
"/\"",
">",
"W3",
"</",
"a",
">",
" ",
"Or",
",",
" ",
"check",
"out",
" ",
"my",
" ",
"documentation",
"\\",
"10",
";",
"on",
" ",
"<",
"a",
" ",
"href",
"=\"",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"cor",
"ydo",
"lph",
"in",
"/",
"fla",
"sk",
"-",
"cors",
"\">",
"Git",
"hub",
"</",
"a",
">'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Comparison using is when operands support `__eq__` | phaethon/scapy/scapy/fields.py | [
{
"content": "## This file is part of Scapy\n## See http://www.secdev.org/projects/scapy for more informations\n## Copyright (C) Philippe Biondi <[email protected]>\n## This program is published under a GPLv2 license\n\n\"\"\"\nFields: basic data structures that make up parts of packets.\n\"\"\"\n\nimport struct,copy,socket\nfrom .config import conf\nfrom .volatile import *\nfrom .data import *\nfrom .utils import *\nfrom .base_classes import BasePacket,Gen,Net\n\n\n############\n## Fields ##\n############\n\n \n\n\n\n \n\n\n\n \n\n \n\n\n\n\n\n \n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Little endian long field\n\n# Little endian fixed length field\n\n\n\n \n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": " def any2i(self, pkt, val):\n if val is None:\n return val\n ival = int(val)\n fract = int( (val-ival) * 2**self.frac_bits )\n return (ival << self.frac_bits) | fract",
"metadata": "root.FixedPointField.any2i",
"header": "['class', 'FixedPointField', '(', 'BitField', ')', ':', '___EOS___']",
"index": 933
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Compari",
"son_",
"using_",
"is_",
"when_",
"operands_",
"support_",
" _",
"`_",
"\\u\\u",
"eq\\u\\u_",
"`_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"##",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"part",
" ",
"of",
" ",
"Sca",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"See",
" ",
"http",
"://",
"www",
".",
"sec",
"dev",
".",
"org",
"/",
"project",
"s",
"/",
"scap",
"y",
" ",
"for",
" ",
"more",
" ",
"informations",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"Phil",
"ipp",
"e",
" ",
"Bio",
"ndi",
" ",
"<",
"phil",
"@",
"sec",
"dev",
".",
"org",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Thi",
"s",
" ",
"program",
" ",
"is",
" ",
"publi",
"shed",
" ",
"under",
" ",
"a",
" ",
"GP",
"Lv",
"2",
" ",
"license_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Field",
"s",
":",
" ",
"basic",
" ",
"data",
" ",
"structure",
"s",
" ",
"tha",
"t",
" ",
"make",
" ",
"up",
" ",
"part",
"s",
" ",
"of",
" ",
"packet",
"s",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"struct_",
",_",
"copy_",
",_",
"socket_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"config_",
"import_",
"conf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"volatile",
"_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"data_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"utils_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"base",
"\\u",
"classes_",
"import_",
"Base",
"Packet_",
",_",
"Gen_",
",_",
"Net_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Field",
"s",
" ",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\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\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Litt",
"le",
" ",
"endian",
" ",
"long",
" ",
"field_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Litt",
"le",
" ",
"endian",
" ",
"fixed",
" ",
"length",
" ",
"field_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"class_",
"Fix",
"ed",
"Point",
"Field_",
"(_",
"Bit",
"Field_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"any",
"2i",
"_",
"(_",
"self_",
",_",
"pkt_",
",_",
"val_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"val_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ival",
"_",
"=_",
"int_",
"(_",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fract",
"_",
"=_",
"int_",
"(_",
"(_",
"val_",
"-_",
"ival",
"_",
")_",
"*_",
"2_",
"**_",
"self_",
"._",
"frac",
"\\u",
"bits_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"ival",
"_",
"<<_",
"self_",
"._",
"frac",
"\\u",
"bits_",
")_",
"|_",
"fract",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | coreemu/core/daemon/core/emane/nodes.py | [
{
"content": " def buildnemxmlfiles(self, emane):\n ''' Let the configured model build the necessary nem, mac, and phy\n XMLs.\n '''\n if self.model is None:\n return\n # build XML for overall network (EmaneNode) configs\n self.model.buildnemxmlfiles(emane, ifc=None)\n # build XML for specific interface (NEM) configs\n need_virtual = False\n need_raw = False\n vtype = \"virtual\"\n rtype = \"raw\"\n for netif in self.netifs():\n self.model.buildnemxmlfiles(emane, netif)\n if \"virtual\" in netif.transport_type:\n need_virtual = True\n vtype = netif.transport_type\n else:\n need_raw = True\n rtype = netif.transport_type\n # build transport XML files depending on type of interfaces involved\n if need_virtual:\n self.buildtransportxml(emane, vtype)\n if need_raw:\n self.buildtransportxml(emane, rtype)",
"metadata": "root.EmaneNode.buildnemxmlfiles",
"header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']",
"index": 140
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Ema",
"ne",
"Node_",
"(_",
"Ema",
"ne",
"Net_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"build",
"nem",
"xmlfile",
"s_",
"(_",
"self_",
",_",
"eman",
"e_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
" ",
"Let",
" ",
"the",
" ",
"configur",
"ed",
" ",
"model",
" ",
"build",
" ",
"the",
" ",
"necessar",
"y",
" ",
"nem",
",",
" ",
"mac",
",",
" ",
"and",
" ",
"phy",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"XML",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"model_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"build",
" ",
"XML",
" ",
"for",
" ",
"over",
"all",
" ",
"network",
" ",
"(",
"Ema",
"ne",
"Node",
")",
" ",
"configs_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"model_",
"._",
"build",
"nem",
"xmlfile",
"s_",
"(_",
"eman",
"e_",
",_",
"ifc",
"_",
"=_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"build",
" ",
"XML",
" ",
"for",
" ",
"specific",
" ",
"interface",
" ",
"(",
"NE",
"M",
")",
" ",
"configs_",
"\\u\\u\\uNL\\u\\u\\u_",
"need",
"\\u",
"virtual_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"need",
"\\u",
"raw_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"vtype_",
"=_",
"\"",
"virtual",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rtype_",
"=_",
"\"",
"raw",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"neti",
"f_",
"in_",
"self_",
"._",
"neti",
"fs_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"model_",
"._",
"build",
"nem",
"xmlfile",
"s_",
"(_",
"eman",
"e_",
",_",
"neti",
"f_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\"",
"virtual",
"\"_",
"in_",
"neti",
"f_",
"._",
"transport",
"\\u",
"type_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"need",
"\\u",
"virtual_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"vtype_",
"=_",
"neti",
"f_",
"._",
"transport",
"\\u",
"type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"need",
"\\u",
"raw_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rtype_",
"=_",
"neti",
"f_",
"._",
"transport",
"\\u",
"type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"build",
" ",
"transport",
" ",
"XML",
" ",
"files",
" ",
"depend",
"ing",
" ",
"on",
" ",
"type",
" ",
"of",
" ",
"interface",
"s",
" ",
"involved",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"need",
"\\u",
"virtual_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"build",
"transport",
"xml_",
"(_",
"eman",
"e_",
",_",
"vtype_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"need",
"\\u",
"raw_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"build",
"transport",
"xml_",
"(_",
"eman",
"e_",
",_",
"rtype_",
")_",
"\\u\\u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/blob/_deserialization.py | [
{
"content": "def _convert_xml_to_containers(response):\n '''\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <EnumerationResults ServiceEndpoint=\"https://myaccount.blob.core.windows.net\">\n <Prefix>string-value</Prefix>\n <Marker>string-value</Marker>\n <MaxResults>int-value</MaxResults>\n <Containers>\n <Container>\n <Name>container-name</Name>\n <Properties>\n <Last-Modified>date/time-value</Last-Modified>\n <Etag>etag</Etag>\n <LeaseStatus>locked | unlocked</LeaseStatus>\n <LeaseState>available | leased | expired | breaking | broken</LeaseState>\n <LeaseDuration>infinite | fixed</LeaseDuration> \n </Properties>\n <Metadata>\n <metadata-name>value</metadata-name>\n </Metadata>\n </Container>\n </Containers>\n <NextMarker>marker-value</NextMarker>\n </EnumerationResults>\n '''\n if response is None or response.body is None:\n return response\n\n containers = _list()\n list_element = ETree.fromstring(response.body)\n \n # Set next marker\n setattr(containers, 'next_marker', list_element.findtext('NextMarker'))\n\n containers_element = list_element.find('Containers')\n\n for container_element in containers_element.findall('Container'):\n # Name element\n container = Container()\n container.name = container_element.findtext('Name')\n\n # Metadata\n metadata_root_element = container_element.find('Metadata')\n if metadata_root_element is not None:\n container.metadata = dict()\n for metadata_element in metadata_root_element:\n container.metadata[metadata_element.tag] = metadata_element.text\n\n # Properties\n properties_element = container_element.find('Properties')\n container.properties.etag = properties_element.findtext('Etag')\n container.properties.last_modified = parser.parse(properties_element.findtext('Last-Modified'))\n container.properties.lease_status = properties_element.findtext('LeaseStatus')\n container.properties.lease_state = properties_element.findtext('LeaseState')\n container.properties.lease_duration = properties_element.findtext('LeaseDuration')\n \n # Add container to list\n containers.append(container)\n\n return containers",
"metadata": "root._convert_xml_to_containers",
"header": "['module', '___EOS___']",
"index": 138
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"convert",
"\\u",
"xml",
"\\u",
"to",
"\\u",
"containers_",
"(_",
"response_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"?",
"xml",
" ",
"version",
"=\"",
"1.0",
"\"",
" ",
"encoding",
"=\"",
"utf",
"-",
"8",
"\"?",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"Enum",
"eratio",
"n",
"Result",
"s",
" ",
"Service",
"End",
"point",
"=\"",
"https",
"://",
"mya",
"ccount",
".",
"blob",
".",
"core",
".",
"windows",
".",
"net",
"\">",
"\\",
"10",
";",
" ",
" ",
"<",
"Pref",
"ix",
">",
"string",
"-",
"value",
"</",
"Pref",
"ix",
">",
"\\",
"10",
";",
" ",
" ",
"<",
"Mark",
"er",
">",
"string",
"-",
"value",
"</",
"Mark",
"er",
">",
"\\",
"10",
";",
" ",
" ",
"<",
"Max",
"Result",
"s",
">",
"int",
"-",
"value",
"</",
"Max",
"Result",
"s",
">",
"\\",
"10",
";",
" ",
" ",
"<",
"Containers",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"Containe",
"r",
">",
"\\",
"10",
";",
" ",
" ",
"<",
"Name",
">",
"container",
"-",
"name",
"</",
"Name",
">",
"\\",
"10",
";",
" ",
" ",
"<",
"Proper",
"ties",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"Las",
"t",
"-",
"Modifie",
"d",
">",
"date",
"/",
"time",
"-",
"value",
"</",
"Las",
"t",
"-",
"Modifie",
"d",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"Eta",
"g",
">",
"eta",
"g",
"</",
"Eta",
"g",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"Leas",
"e",
"Status",
">",
"lock",
"ed",
" ",
"|",
" ",
"unlocked",
"</",
"Leas",
"e",
"Status",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"Leas",
"e",
"State",
">",
"avail",
"able",
" ",
"|",
" ",
"lease",
"d",
" ",
"|",
" ",
"expir",
"ed",
" ",
"|",
" ",
"break",
"ing",
" ",
"|",
" ",
"broken",
"</",
"Leas",
"e",
"State",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"Leas",
"e",
"Dur",
"ation",
">",
"infini",
"te",
" ",
"|",
" ",
"fixed",
"</",
"Leas",
"e",
"Dur",
"ation",
">",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
"</",
"Proper",
"ties",
">",
"\\",
"10",
";",
" ",
" ",
"<",
"Meta",
"data",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"metadata",
"-",
"name",
">",
"value",
"</",
"metadata",
"-",
"name",
">",
"\\",
"10",
";",
" ",
" ",
"</",
"Meta",
"data",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"Containe",
"r",
">",
"\\",
"10",
";",
" ",
" ",
"</",
"Containers",
">",
"\\",
"10",
";",
" ",
" ",
"<",
"Ne",
"xt",
"Mark",
"er",
">",
"marker",
"-",
"value",
"</",
"Ne",
"xt",
"Mark",
"er",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"Enum",
"eratio",
"n",
"Result",
"s",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"response_",
"is_",
"None_",
"or_",
"response_",
"._",
"body_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"containers_",
"=_",
"\\u",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"list",
"\\u",
"element_",
"=_",
"ET",
"ree_",
"._",
"fromstring_",
"(_",
"response_",
"._",
"body_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"next",
" ",
"marker_",
"\\u\\u\\uNL\\u\\u\\u_",
"setattr_",
"(_",
"containers_",
",_",
"'",
"next",
"\\u",
"marker",
"'_",
",_",
"list",
"\\u",
"element_",
"._",
"findtext_",
"(_",
"'",
"Ne",
"xt",
"Mark",
"er",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"container",
"s",
"\\u",
"element_",
"=_",
"list",
"\\u",
"element_",
"._",
"find_",
"(_",
"'",
"Containers",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"container",
"\\u",
"element_",
"in_",
"container",
"s",
"\\u",
"element_",
"._",
"findall_",
"(_",
"'",
"Containe",
"r",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Name",
" ",
"element_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"container_",
"=_",
"Container_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"container_",
"._",
"name_",
"=_",
"container",
"\\u",
"element_",
"._",
"findtext_",
"(_",
"'",
"Name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Metadata_",
"\\u\\u\\uNL\\u\\u\\u_",
"metadata",
"\\u",
"root",
"\\u",
"element_",
"=_",
"container",
"\\u",
"element_",
"._",
"find_",
"(_",
"'",
"Meta",
"data",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"metadata",
"\\u",
"root",
"\\u",
"element_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"container_",
"._",
"metadata_",
"=_",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"metadata",
"\\u",
"element_",
"in_",
"metadata",
"\\u",
"root",
"\\u",
"element_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"container_",
"._",
"metadata_",
"[_",
"metadata",
"\\u",
"element_",
"._",
"tag_",
"]_",
"=_",
"metadata",
"\\u",
"element_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Properties_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"proper",
"ties",
"\\u",
"element_",
"=_",
"container",
"\\u",
"element_",
"._",
"find_",
"(_",
"'",
"Proper",
"ties",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"container_",
"._",
"properties_",
"._",
"etag_",
"=_",
"proper",
"ties",
"\\u",
"element_",
"._",
"findtext_",
"(_",
"'",
"Eta",
"g",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"container_",
"._",
"properties_",
"._",
"last",
"\\u",
"modified_",
"=_",
"parser_",
"._",
"parse_",
"(_",
"proper",
"ties",
"\\u",
"element_",
"._",
"findtext_",
"(_",
"'",
"Las",
"t",
"-",
"Modifie",
"d",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"container_",
"._",
"properties_",
"._",
"lease",
"\\u",
"status_",
"=_",
"proper",
"ties",
"\\u",
"element_",
"._",
"findtext_",
"(_",
"'",
"Leas",
"e",
"Status",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"container_",
"._",
"properties_",
"._",
"lease",
"\\u",
"state_",
"=_",
"proper",
"ties",
"\\u",
"element_",
"._",
"findtext_",
"(_",
"'",
"Leas",
"e",
"State",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"container_",
"._",
"properties_",
"._",
"lease",
"\\u",
"duration_",
"=_",
"proper",
"ties",
"\\u",
"element_",
"._",
"findtext_",
"(_",
"'",
"Leas",
"e",
"Dur",
"ation",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"container",
" ",
"to",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"containers_",
"._",
"append_",
"(_",
"container_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"containers_",
"\\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,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | keithadavidson/ansible-mezzanine/someapiproject/apitestapp/views.py | [
{
"content": "from django.http import HttpResponse\nfrom django.views.decorators.csrf import csrf_exempt\nfrom rest_framework.renderers import JSONRenderer\nfrom rest_framework.parsers import JSONParser\nfrom apitestapp.models import Snippet\nfrom apitestapp.serializers import SnippetSerializer\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class JSONResponse(HttpResponse):\n \"\"\"\n An HttpResponse that renders its content into JSON.\n \"\"\"",
"metadata": "root.JSONResponse",
"header": "['module', '___EOS___']",
"index": 7
},
{
"content": " def __init__(self, data, **kwargs):\n content = JSONRenderer().render(data)\n kwargs['content_type'] = 'application/json'\n super(JSONResponse, self).__init__(content, **kwargs)",
"metadata": "root.JSONResponse.__init__",
"header": "['class', 'JSONResponse', '(', 'HttpResponse', ')', ':', '___EOS___']",
"index": 11
},
{
"content": "@csrf_exempt\ndef snippet_list(request):\n \"\"\"\n List all code snippets, or create a new snippet.\n \"\"\"\n if request.method == 'GET':\n snippets = Snippet.objects.all()\n serializer = SnippetSerializer(snippets, many=True)\n return JSONResponse(serializer.data)\n\n elif request.method == 'POST':\n data = JSONParser().parse(request)\n serializer = SnippetSerializer(data=data)\n if serializer.is_valid():\n serializer.save()\n return JSONResponse(serializer.data, status=201)\n return JSONResponse(serializer.errors, status=400)",
"metadata": "root.snippet_list",
"header": "['module', '___EOS___']",
"index": 16
},
{
"content": "@csrf_exempt\ndef snippet_detail(request, pk):\n \"\"\"\n Retrieve, update or delete a code snippet.\n \"\"\"\n try:\n snippet = Snippet.objects.get(pk=pk)\n except Snippet.DoesNotExist:\n return HttpResponse(status=404)\n\n if request.method == 'GET':\n serializer = SnippetSerializer(snippet)\n return JSONResponse(serializer.data)\n\n elif request.method == 'PUT':\n data = JSONParser().parse(request)\n serializer = SnippetSerializer(snippet, data=data)\n if serializer.is_valid():\n serializer.save()\n return JSONResponse(serializer.data)\n return JSONResponse(serializer.errors, status=400)\n\n elif request.method == 'DELETE':\n snippet.delete()\n return HttpResponse(status=204)",
"metadata": "root.snippet_detail",
"header": "['module', '___EOS___']",
"index": 34
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"http_",
"import_",
"Http",
"Response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"views_",
"._",
"decorators_",
"._",
"csrf_",
"import_",
"csr",
"f",
"\\u",
"exempt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rest",
"\\u",
"framework_",
"._",
"renderers_",
"import_",
"JSONR",
"ender",
"er_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rest",
"\\u",
"framework_",
"._",
"parsers_",
"import_",
"JSO",
"NP",
"arser",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"api",
"testapp_",
"._",
"models_",
"import_",
"Snippet",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"api",
"testapp_",
"._",
"serializers_",
"import_",
"Snippet",
"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_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"Http",
"Response_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"Http",
"Respons",
"e",
" ",
"tha",
"t",
" ",
"render",
"s",
" ",
"its",
" ",
"content",
" ",
"int",
"o",
" ",
"JSO",
"N",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"Http",
"Response_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"data_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"content_",
"=_",
"JSONR",
"ender",
"er_",
"(_",
")_",
"._",
"render_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"[_",
"'",
"content",
"\\u",
"type",
"'_",
"]_",
"=_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"super_",
"(_",
"JSONR",
"esp",
"ons",
"e_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"content_",
",_",
"**_",
"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_",
"@_",
"csr",
"f",
"\\u",
"exempt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"snippet",
"\\u",
"list_",
"(_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"List",
" ",
"all",
" ",
"code",
" ",
"snippet",
"s",
",",
" ",
"or",
" ",
"create",
" ",
"a",
" ",
"new",
" ",
"snippet",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"request_",
"._",
"method_",
"==_",
"'",
"GET",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"snippets_",
"=_",
"Snippet",
"_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"serializer_",
"=_",
"Snippet",
"Serializer_",
"(_",
"snippets_",
",_",
"many_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"serializer_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"request_",
"._",
"method_",
"==_",
"'",
"POST",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"JSO",
"NP",
"arser",
"_",
"(_",
")_",
"._",
"parse_",
"(_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"serializer_",
"=_",
"Snippet",
"Serializer_",
"(_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"serializer_",
"._",
"is",
"\\u",
"valid_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"serializer_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"serializer_",
"._",
"data_",
",_",
"status_",
"=_",
"201_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"serializer_",
"._",
"errors_",
",_",
"status_",
"=_",
"400_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"csr",
"f",
"\\u",
"exempt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"snippet",
"\\u",
"detail_",
"(_",
"request_",
",_",
"pk_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Retrieve",
",",
" ",
"update",
" ",
"or",
" ",
"delete",
" ",
"a",
" ",
"code",
" ",
"snippet",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"snippet_",
"=_",
"Snippet",
"_",
"._",
"objects_",
"._",
"get_",
"(_",
"pk_",
"=_",
"pk_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Snippet",
"_",
"._",
"Do",
"es",
"Not",
"Exist_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Http",
"Response_",
"(_",
"status_",
"=_",
"404_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"request_",
"._",
"method_",
"==_",
"'",
"GET",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"serializer_",
"=_",
"Snippet",
"Serializer_",
"(_",
"snippet_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"serializer_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"request_",
"._",
"method_",
"==_",
"'",
"PU",
"T",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"JSO",
"NP",
"arser",
"_",
"(_",
")_",
"._",
"parse_",
"(_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"serializer_",
"=_",
"Snippet",
"Serializer_",
"(_",
"snippet_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"serializer_",
"._",
"is",
"\\u",
"valid_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"serializer_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"serializer_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"JSONR",
"esp",
"ons",
"e_",
"(_",
"serializer_",
"._",
"errors_",
",_",
"status_",
"=_",
"400_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"request_",
"._",
"method_",
"==_",
"'",
"DELET",
"E",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"snippet_",
"._",
"delete_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Http",
"Response_",
"(_",
"status_",
"=_",
"204_",
")_"
] | [
4,
4,
4,
4,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | mvillalba/python-ant/src/ant/core/event.py | [
{
"content": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (c) 2011, Martín Raúl Villalba\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\n# deal in the Software without restriction, including without limitation the\n# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n# sell 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\n# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n# IN THE SOFTWARE.\n#\n##############################################################################\n\n#\n# Beware s/he who enters: uncommented, non unit-tested,\n# don't-fix-it-if-it-ain't-broken kind of threaded code ahead.\n#\n\nMAX_ACK_QUEUE = 25\nMAX_MSG_QUEUE = 25\n\nimport thread\nimport time\n\nfrom ant.core.constants import *\nfrom ant.core.message import Message, ChannelEventMessage\nfrom ant.core.exceptions import MessageError\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"more_",
"than_",
"once_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2011",
",",
" ",
"Mart",
"\\",
"237",
";",
"n",
" ",
"Ra",
"\\",
"250",
";",
"l",
" ",
"Vill",
"alb",
"a_",
"\\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_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"deal",
" ",
"in",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"with",
"out",
" ",
"restriction",
",",
" ",
"inclu",
"ding",
" ",
"with",
"out",
" ",
"limit",
"ation",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"rights",
" ",
"to",
" ",
"use",
",",
" ",
"copy",
",",
" ",
"modif",
"y",
",",
" ",
"merge",
",",
" ",
"publi",
"sh",
",",
" ",
"distribute",
",",
" ",
"subli",
"cens",
"e",
",",
" ",
"and",
"/",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"sell",
" ",
"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_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FROM",
",",
" ",
"OUT",
" ",
"OF",
" ",
"OR",
" ",
"IN",
" ",
"CONNECTION",
" ",
"WITH",
" ",
"THE",
" ",
"SOFT",
"WARE",
" ",
"OR",
" ",
"THE",
" ",
"USE",
" ",
"OR",
" ",
"OTHER",
" ",
"DEA",
"LING",
"S_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"IN",
" ",
"THE",
" ",
"SOFT",
"WARE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Be",
"ware",
" ",
"s",
"/",
"he",
" ",
"who",
" ",
"enter",
"s",
":",
" ",
"uncomm",
"ente",
"d",
",",
" ",
"non",
" ",
"unit",
"-",
"tested",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"don",
"'",
"t",
"-",
"fix",
"-",
"it",
"-",
"if",
"-",
"it",
"-",
"ain",
"'",
"t",
"-",
"broken",
" ",
"kind",
" ",
"of",
" ",
"threaded",
" ",
"code",
" ",
"ahe",
"ad",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"MAX",
"\\u",
"AC",
"K",
"\\u",
"QUEUE",
"_",
"=_",
"25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"MAX",
"\\u",
"MS",
"G",
"\\u",
"QUEUE",
"_",
"=_",
"25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"thread_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ant_",
"._",
"core_",
"._",
"constants_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ant_",
"._",
"core_",
"._",
"message_",
"import_",
"Message_",
",_",
"Chan",
"nel",
"Event",
"Message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ant_",
"._",
"core_",
"._",
"exceptions_",
"import_",
"Messag",
"e",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\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
] |
Unused import | nickjj/build-a-saas-app-with-flask/catwatch/blueprints/billing/models/coupon.py | [
{
"content": "import datetime\nfrom collections import OrderedDict\nfrom string import maketrans\nfrom os import urandom\nfrom binascii import hexlify\n\nimport pytz\nfrom sqlalchemy import or_, and_\n\nfrom sqlalchemy.ext.hybrid import hybrid_property\n\nfrom catwatch.lib.util_sqlalchemy import ResourceMixin, AwareDateTime\nfrom catwatch.lib.money import cents_to_dollars, dollars_to_cents\nfrom catwatch.extensions import db\nfrom catwatch.blueprints.billing.gateways.stripecom import \\\n Coupon as PaymentCoupon\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Coupon(ResourceMixin, db.Model):\n DURATION = OrderedDict([\n ('forever', 'Forever'),\n ('once', 'Once'),\n ('repeating', 'Repeating')\n ])\n\n __tablename__ = 'coupons'\n id = db.Column(db.Integer, primary_key=True)\n\n # Coupon details.\n code = db.Column(db.String(32), index=True, unique=True)\n duration = db.Column(db.Enum(*DURATION, name='duration_types'),\n index=True, nullable=False, server_default='forever')\n amount_off = db.Column(db.Integer())\n percent_off = db.Column(db.Integer())\n currency = db.Column(db.String(8))\n duration_in_months = db.Column(db.Integer())\n max_redemptions = db.Column(db.Integer(), index=True)\n redeem_by = db.Column(AwareDateTime(), index=True)\n times_redeemed = db.Column(db.Integer(), index=True,\n nullable=False, default=0)\n valid = db.Column(db.Boolean(), nullable=False, server_default='1')\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.Coupon",
"header": "['module', '___EOS___']",
"index": 18
},
{
"content": " def __init__(self, **kwargs):\n if self.code:\n self.code = self.code.upper()\n else:\n self.code = Coupon.random_coupon_code()\n\n # Call Flask-SQLAlchemy's constructor.\n super(Coupon, self).__init__(**kwargs)",
"metadata": "root.Coupon.__init__",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 42
},
{
"content": " @hybrid_property\n def redeemable(self):\n \"\"\"\n Return coupons that are still redeemable. Coupons will become invalid\n once they run out on save. We want to explicitly do a date check to\n avoid having to hit Stripe's API to get back potentially valid codes.\n\n :return: SQLAlchemy query object\n \"\"\"\n is_redeemable = or_(self.redeem_by.is_(None),\n self.redeem_by >= datetime.datetime.now(pytz.utc))\n\n return and_(self.valid, is_redeemable)",
"metadata": "root.Coupon.redeemable",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 51
},
{
"content": " @classmethod\n def search(cls, query):\n \"\"\"\n Search a resource by 1 or more fields.\n\n :param query: Search query\n :type query: str\n :return: SQLAlchemy filter\n \"\"\"\n if not query:\n return ''\n\n search_query = '%{0}%'.format(query)\n\n return or_(Coupon.code.ilike(search_query))",
"metadata": "root.Coupon.search",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 65
},
{
"content": " @classmethod\n def random_coupon_code(cls):\n \"\"\"\n Create a human readable random coupon code.\n\n Inspired by:\n http://stackoverflow.com/a/22333563\n\n :return: str\n \"\"\"\n random_string = hexlify(urandom(20))\n long_code = random_string.translate(maketrans('0123456789abcdefghij',\n '234679QWERTYUPADFGHX'))\n\n short_code = '{0}-{1}-{2}'.format(long_code[0:4],\n long_code[5:9],\n long_code[10:14])\n\n return short_code",
"metadata": "root.Coupon.random_coupon_code",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 81
},
{
"content": " @classmethod\n def expire_old_coupons(cls, compare_datetime=None):\n \"\"\"\n Invalidate coupons that are past their redeem date.\n\n :param compare_datetime: Time to compare at\n :type compare_datetime: date\n :return: The result of updating the records\n \"\"\"\n if compare_datetime is None:\n compare_datetime = datetime.datetime.now(pytz.utc)\n\n condition = Coupon.redeem_by <= compare_datetime\n Coupon.query.filter(condition) \\\n .update({Coupon.valid: not Coupon.valid})\n\n return db.session.commit()",
"metadata": "root.Coupon.expire_old_coupons",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 101
},
{
"content": " @classmethod\n def create(cls, params):\n \"\"\"\n Return whether or not the coupon was created successfully.\n\n :return: bool\n \"\"\"\n payment_params = params\n\n payment_params['code'] = payment_params['code'].upper()\n\n if payment_params.get('amount_off'):\n payment_params['amount_off'] = \\\n dollars_to_cents(payment_params['amount_off'])\n\n PaymentCoupon.create(**payment_params)\n\n if 'id' in payment_params:\n payment_params['code'] = payment_params['id']\n del payment_params['id']\n\n if 'redeem_by' in payment_params:\n if payment_params.get('redeem_by') is not None:\n params['redeem_by'] = payment_params.get('redeem_by').replace(\n tzinfo=pytz.UTC)\n\n coupon = Coupon(**payment_params)\n\n db.session.add(coupon)\n db.session.commit()\n\n return True",
"metadata": "root.Coupon.create",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 119
},
{
"content": " @classmethod\n def bulk_delete(cls, ids):\n \"\"\"\n Override the general bulk_delete method because we need to delete them\n one at a time while also deleting them on Stripe.\n\n :param ids: List of ids to be deleted\n :type ids: list\n :return: int\n \"\"\"\n delete_count = 0\n\n for id in ids:\n coupon = Coupon.query.get(id)\n\n if coupon is None:\n continue\n\n # Delete on Stripe.\n stripe_response = PaymentCoupon.delete(coupon.code)\n\n # If successful, delete it locally.\n if stripe_response.get('deleted'):\n coupon.delete()\n delete_count += 1\n\n return delete_count",
"metadata": "root.Coupon.bulk_delete",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 152
},
{
"content": " @classmethod\n def find_by_code(cls, code):\n \"\"\"\n Find a coupon by its code.\n\n :param code: Coupon code to find\n :type code: str\n :return: Coupon instance\n \"\"\"\n formatted_code = code.upper()\n coupon = Coupon.query.filter(Coupon.redeemable,\n Coupon.code == formatted_code).first()\n\n return coupon",
"metadata": "root.Coupon.find_by_code",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 180
},
{
"content": " def redeem(self):\n \"\"\"\n Update the redeem stats for this coupon.\n\n :return: Result of saving the record\n \"\"\"\n self.times_redeemed += 1\n\n if self.max_redemptions:\n if self.times_redeemed >= self.max_redemptions:\n self.valid = False\n\n return db.session.commit()",
"metadata": "root.Coupon.redeem",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 195
},
{
"content": " def serialize(self):\n \"\"\"\n Return JSON fields to render the coupon code status.\n\n :return: dict\n \"\"\"\n params = {\n 'duration': self.duration,\n 'duration_in_months': self.duration_in_months,\n }\n\n if self.amount_off:\n params['amount_off'] = cents_to_dollars(self.amount_off)\n\n if self.percent_off:\n params['percent_off'] = self.percent_off,\n\n return params",
"metadata": "root.Coupon.serialize",
"header": "['class', 'Coupon', '(', 'ResourceMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']",
"index": 209
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"collections_",
"import_",
"Order",
"ed",
"Dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"string_",
"import_",
"maket",
"rans_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"os_",
"import_",
"urandom_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"binascii_",
"import_",
"hexlify_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"pytz_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sqlalchemy_",
"import_",
"or\\u_",
",_",
"and\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"sqlalchemy_",
"._",
"ext_",
"._",
"hybrid",
"_",
"import_",
"hybrid",
"\\u",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"cat",
"watch_",
"._",
"lib_",
"._",
"util",
"\\u",
"sqlalchemy_",
"import_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"Awa",
"re",
"Date",
"Time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cat",
"watch_",
"._",
"lib_",
"._",
"money_",
"import_",
"cent",
"s",
"\\u",
"to",
"\\u",
"dollar",
"s_",
",_",
"dollar",
"s",
"\\u",
"to",
"\\u",
"cent",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cat",
"watch_",
"._",
"extensions_",
"import_",
"db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cat",
"watch_",
"._",
"blueprints",
"_",
"._",
"bill",
"ing_",
"._",
"gateway",
"s_",
"._",
"strip",
"ecom",
"_",
"import_",
"Coup",
"on_",
"as_",
"Payment",
"Coup",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"DURATION",
"_",
"=_",
"Order",
"ed",
"Dict_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"forever",
"'_",
",_",
"'",
"Fore",
"ver",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"onc",
"e",
"'_",
",_",
"'",
"On",
"ce",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"repeatin",
"g",
"'_",
",_",
"'",
"Repeat",
"ing",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"tablename\\u\\u_",
"=_",
"'",
"coupon",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"id_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Integer_",
",_",
"primary",
"\\u",
"key_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Coup",
"on",
" ",
"deta",
"il",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"code_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"String_",
"(_",
"32_",
")_",
",_",
"index_",
"=_",
"True_",
",_",
"unique_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"duration_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Enum_",
"(_",
"*_",
"DURATION",
"_",
",_",
"name_",
"=_",
"'",
"duration",
"\\u",
"types",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"True_",
",_",
"nullable_",
"=_",
"False_",
",_",
"server",
"\\u",
"default_",
"=_",
"'",
"forever",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"amo",
"unt",
"\\u",
"off_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Integer_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"percent",
"\\u",
"off_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Integer_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"currency_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"String_",
"(_",
"8_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"duration",
"\\u",
"in",
"\\u",
"months_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Integer_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"max",
"\\u",
"rede",
"mption",
"s_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Integer_",
"(_",
")_",
",_",
"index_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rede",
"em",
"\\u",
"by_",
"=_",
"db_",
"._",
"Column_",
"(_",
"Awa",
"re",
"Date",
"Time_",
"(_",
")_",
",_",
"index_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"times",
"\\u",
"rede",
"eme",
"d_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Integer_",
"(_",
")_",
",_",
"index_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"nullable_",
"=_",
"False_",
",_",
"default_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"valid_",
"=_",
"db_",
"._",
"Column_",
"(_",
"db_",
"._",
"Boolean_",
"(_",
")_",
",_",
"nullable_",
"=_",
"False_",
",_",
"server",
"\\u",
"default_",
"=_",
"'",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"code_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"code_",
"=_",
"self_",
"._",
"code_",
"._",
"upper_",
"(_",
")_",
"\\u\\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_",
"._",
"code_",
"=_",
"Coup",
"on_",
"._",
"random",
"\\u",
"coupon",
"\\u",
"code_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Call",
" ",
"Fla",
"sk",
"-",
"SQL",
"Al",
"chem",
"y",
"'",
"s",
" ",
"construct",
"or",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"super_",
"(_",
"Coup",
"on_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"hybrid",
"\\u",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"rede",
"ema",
"ble_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"coupon",
"s",
" ",
"tha",
"t",
" ",
"are",
" ",
"still",
" ",
"rede",
"ema",
"ble",
".",
" ",
"Coup",
"ons",
" ",
"will",
" ",
"bec",
"ome",
" ",
"invalid",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"onc",
"e",
" ",
"the",
"y",
" ",
"run",
" ",
"out",
" ",
"on",
" ",
"save",
".",
" ",
"We",
" ",
"want",
" ",
"to",
" ",
"explicit",
"ly",
" ",
"do",
" ",
"a",
" ",
"date",
" ",
"check",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"avoid",
" ",
"hav",
"ing",
" ",
"to",
" ",
"hit",
" ",
"Strip",
"e",
"'",
"s",
" ",
"API",
" ",
"to",
" ",
"get",
" ",
"back",
" ",
"potenti",
"ally",
" ",
"valid",
" ",
"codes",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"SQL",
"Al",
"chem",
"y",
" ",
"query",
" ",
"object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"is",
"\\u",
"rede",
"ema",
"ble_",
"=_",
"or\\u_",
"(_",
"self_",
"._",
"rede",
"em",
"\\u",
"by_",
"._",
"is\\u_",
"(_",
"None_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"rede",
"em",
"\\u",
"by_",
">=_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
"pytz_",
"._",
"utc_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"and\\u_",
"(_",
"self_",
"._",
"valid_",
",_",
"is",
"\\u",
"rede",
"ema",
"ble_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\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_",
"search_",
"(_",
"cls_",
",_",
"query_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sear",
"ch",
" ",
"a",
" ",
"resource",
" ",
"by",
" ",
"1",
" ",
"or",
" ",
"more",
" ",
"fields",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"query",
":",
" ",
"Sear",
"ch",
" ",
"query",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"query",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"SQL",
"Al",
"chem",
"y",
" ",
"filter",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"query_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"search",
"\\u",
"query_",
"=_",
"'%",
"{",
"0",
"}%",
"'_",
"._",
"format_",
"(_",
"query_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"or\\u_",
"(_",
"Coup",
"on_",
"._",
"code_",
"._",
"ili",
"ke_",
"(_",
"search",
"\\u",
"query_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\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_",
"random",
"\\u",
"coupon",
"\\u",
"code_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"e",
" ",
"a",
" ",
"human",
" ",
"reada",
"ble",
" ",
"random",
" ",
"coupon",
" ",
"code",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ins",
"pir",
"ed",
" ",
"by",
":",
"\\",
"10",
";",
" ",
" ",
"http",
"://",
"stack",
"overflow",
".",
"com",
"/",
"a",
"/",
"223",
"335",
"6",
"3",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"random",
"\\u",
"string_",
"=_",
"hexlify_",
"(_",
"urandom_",
"(_",
"20_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"long",
"\\u",
"code_",
"=_",
"random",
"\\u",
"string_",
"._",
"translate_",
"(_",
"maket",
"rans_",
"(_",
"'",
"0123456",
"789",
"abcdefg",
"hij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"234",
"679",
"QW",
"ERT",
"YU",
"PAD",
"FG",
"HX",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"short",
"\\u",
"code_",
"=_",
"'{",
"0",
"}-",
"{",
"1",
"}-",
"{",
"2",
"}'_",
"._",
"format_",
"(_",
"long",
"\\u",
"code_",
"[_",
"0_",
":_",
"4_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"long",
"\\u",
"code_",
"[_",
"5_",
":_",
"9_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"long",
"\\u",
"code_",
"[_",
"10_",
":_",
"14_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"short",
"\\u",
"code_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\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_",
"expir",
"e\\u",
"old",
"\\u",
"coupon",
"s_",
"(_",
"cls_",
",_",
"compare",
"\\u",
"datetime_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Inva",
"lida",
"te",
" ",
"coupon",
"s",
" ",
"tha",
"t",
" ",
"are",
" ",
"past",
" ",
"thei",
"r",
" ",
"rede",
"em",
" ",
"date",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"compare",
"\\u",
"datetime",
":",
" ",
"Time",
" ",
"to",
" ",
"compare",
" ",
"at",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"compare",
"\\u",
"datetime",
":",
" ",
"date",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"The",
" ",
"result",
" ",
"of",
" ",
"updat",
"ing",
" ",
"the",
" ",
"record",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"compare",
"\\u",
"datetime_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"compare",
"\\u",
"datetime_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
"pytz_",
"._",
"utc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"condition_",
"=_",
"Coup",
"on_",
"._",
"rede",
"em",
"\\u",
"by_",
"<=_",
"compare",
"\\u",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Coup",
"on_",
"._",
"query_",
"._",
"filter_",
"(_",
"condition_",
")_",
"._",
"update_",
"(_",
"{_",
"Coup",
"on_",
"._",
"valid_",
":_",
"not_",
"Coup",
"on_",
"._",
"valid_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"db_",
"._",
"session_",
"._",
"commit_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\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_",
"create_",
"(_",
"cls_",
",_",
"params_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"the",
" ",
"coupon",
" ",
"was",
" ",
"created",
" ",
"success",
"full",
"y",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pay",
"ment",
"\\u",
"params_",
"=_",
"params_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pay",
"ment",
"\\u",
"params_",
"[_",
"'",
"code",
"'_",
"]_",
"=_",
"pay",
"ment",
"\\u",
"params_",
"[_",
"'",
"code",
"'_",
"]_",
"._",
"upper_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"pay",
"ment",
"\\u",
"params_",
"._",
"get_",
"(_",
"'",
"amo",
"unt",
"\\u",
"off",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pay",
"ment",
"\\u",
"params_",
"[_",
"'",
"amo",
"unt",
"\\u",
"off",
"'_",
"]_",
"=_",
"dollar",
"s",
"\\u",
"to",
"\\u",
"cent",
"s_",
"(_",
"pay",
"ment",
"\\u",
"params_",
"[_",
"'",
"amo",
"unt",
"\\u",
"off",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Payment",
"Coup",
"on_",
"._",
"create_",
"(_",
"**_",
"pay",
"ment",
"\\u",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"id",
"'_",
"in_",
"pay",
"ment",
"\\u",
"params_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pay",
"ment",
"\\u",
"params_",
"[_",
"'",
"code",
"'_",
"]_",
"=_",
"pay",
"ment",
"\\u",
"params_",
"[_",
"'",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"pay",
"ment",
"\\u",
"params_",
"[_",
"'",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"rede",
"em",
"\\u",
"by",
"'_",
"in_",
"pay",
"ment",
"\\u",
"params_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"pay",
"ment",
"\\u",
"params_",
"._",
"get_",
"(_",
"'",
"rede",
"em",
"\\u",
"by",
"'_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"rede",
"em",
"\\u",
"by",
"'_",
"]_",
"=_",
"pay",
"ment",
"\\u",
"params_",
"._",
"get_",
"(_",
"'",
"rede",
"em",
"\\u",
"by",
"'_",
")_",
"._",
"replace_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"tzinfo_",
"=_",
"pytz_",
"._",
"UTC_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"coupon",
"_",
"=_",
"Coup",
"on_",
"(_",
"**_",
"pay",
"ment",
"\\u",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"session_",
"._",
"add_",
"(_",
"coupon",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db_",
"._",
"session_",
"._",
"commit_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\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_",
"bul",
"k",
"\\u",
"delete_",
"(_",
"cls_",
",_",
"ids_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Override",
" ",
"the",
" ",
"genera",
"l",
" ",
"bul",
"k",
"\\u",
"delete",
" ",
"method",
" ",
"bec",
"aus",
"e",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"delete",
" ",
"them",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"one",
" ",
"at",
" ",
"a",
" ",
"time",
" ",
"whi",
"le",
" ",
"als",
"o",
" ",
"delet",
"ing",
" ",
"them",
" ",
"on",
" ",
"Strip",
"e",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"ids",
":",
" ",
"List",
" ",
"of",
" ",
"ids",
" ",
"to",
" ",
"be",
" ",
"delete",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"ids",
":",
" ",
"list",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"delete",
"\\u",
"count_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"id_",
"in_",
"ids_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"coupon",
"_",
"=_",
"Coup",
"on_",
"._",
"query_",
"._",
"get_",
"(_",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"coupon",
"_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Delete",
" ",
"on",
" ",
"Strip",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"strip",
"e\\u",
"response_",
"=_",
"Payment",
"Coup",
"on_",
"._",
"delete_",
"(_",
"coupon",
"_",
"._",
"code_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"success",
"ful",
",",
" ",
"delete",
" ",
"it",
" ",
"local",
"ly",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"strip",
"e\\u",
"response_",
"._",
"get_",
"(_",
"'",
"delete",
"d",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"coupon",
"_",
"._",
"delete_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"delete",
"\\u",
"count_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"delete",
"\\u",
"count_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\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",
"by",
"\\u",
"code_",
"(_",
"cls_",
",_",
"code_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Fin",
"d",
" ",
"a",
" ",
"coupon",
" ",
"by",
" ",
"its",
" ",
"code",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"code",
":",
" ",
"Coup",
"on",
" ",
"code",
" ",
"to",
" ",
"find",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"code",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"Coup",
"on",
" ",
"instance",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"format",
"ted",
"\\u",
"code_",
"=_",
"code_",
"._",
"upper_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"coupon",
"_",
"=_",
"Coup",
"on_",
"._",
"query_",
"._",
"filter_",
"(_",
"Coup",
"on_",
"._",
"rede",
"ema",
"ble_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Coup",
"on_",
"._",
"code_",
"==_",
"format",
"ted",
"\\u",
"code_",
")_",
"._",
"first_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"coupon",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"rede",
"em_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Update",
" ",
"the",
" ",
"rede",
"em",
" ",
"stats",
" ",
"for",
" ",
"this",
" ",
"coupon",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"Result",
" ",
"of",
" ",
"saving",
" ",
"the",
" ",
"record",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"times",
"\\u",
"rede",
"eme",
"d_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"max",
"\\u",
"rede",
"mption",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"times",
"\\u",
"rede",
"eme",
"d_",
">=_",
"self_",
"._",
"max",
"\\u",
"rede",
"mption",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"valid_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"db_",
"._",
"session_",
"._",
"commit_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Coup",
"on_",
"(_",
"Reso",
"urc",
"e",
"Mixin_",
",_",
"db_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"serialize_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"JSO",
"N",
" ",
"fields",
" ",
"to",
" ",
"render",
" ",
"the",
" ",
"coupon",
" ",
"code",
" ",
"status",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"dict",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"duration",
"'_",
":_",
"self_",
"._",
"duration_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"duration",
"\\u",
"in",
"\\u",
"month",
"s",
"'_",
":_",
"self_",
"._",
"duration",
"\\u",
"in",
"\\u",
"months_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"amo",
"unt",
"\\u",
"off_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"amo",
"unt",
"\\u",
"off",
"'_",
"]_",
"=_",
"cent",
"s",
"\\u",
"to",
"\\u",
"dollar",
"s_",
"(_",
"self_",
"._",
"amo",
"unt",
"\\u",
"off_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"percent",
"\\u",
"off_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"percent",
"\\u",
"off",
"'_",
"]_",
"=_",
"self_",
"._",
"percent",
"\\u",
"off_",
",_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"params_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unnecessary 'else' clause in loop | MartinPaulEve/PlotSummary/interactive.py | [
{
"content": " def color_diff_suffix(self, a, b, highlight='red'):\n \"\"\"Colorize the differing suffix between two strings.\"\"\"\n a, b = unicode(a), unicode(b)\n if not self.gv.settings.get_setting('color', self) == 'True':\n return a, b\n\n # Fast path.\n if a == b:\n return a, b\n\n # Find the longest common prefix.\n first_diff = None\n for i in range(min(len(a), len(b))):\n if a[i] != b[i]:\n first_diff = i\n break\n else:\n first_diff = min(len(a), len(b))\n\n # Colorize from the first difference on.\n return a[:first_diff] + self.colorize(highlight, a[first_diff:]), \\\n b[:first_diff] + self.colorize(highlight, b[first_diff:])",
"metadata": "root.Interactive.color_diff_suffix",
"header": "['class', 'Interactive', '(', 'Debuggable', ')', ':', '___EOS___']",
"index": 359
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"'",
"else",
"'_",
"clause_",
"in_",
"loop_",
"[SEP]_",
"class_",
"Interact",
"ive_",
"(_",
"Deb",
"ugg",
"able_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"color",
"\\u",
"diff",
"\\u",
"suffix_",
"(_",
"self_",
",_",
"a_",
",_",
"b_",
",_",
"highlight_",
"=_",
"'",
"red",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Color",
"ize",
" ",
"the",
" ",
"differ",
"ing",
" ",
"suff",
"ix",
" ",
"bet",
"ween",
" ",
"two",
" ",
"string",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"a_",
",_",
"b_",
"=_",
"unicode_",
"(_",
"a_",
")_",
",_",
"unicode_",
"(_",
"b_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"gv_",
"._",
"settings_",
"._",
"get",
"\\u",
"setting_",
"(_",
"'",
"color",
"'_",
",_",
"self_",
")_",
"==_",
"'",
"Tru",
"e",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"a_",
",_",
"b_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fast",
" ",
"path",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"a_",
"==_",
"b_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"a_",
",_",
"b_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"the",
" ",
"long",
"est",
" ",
"common",
" ",
"prefix",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"first",
"\\u",
"diff_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"min_",
"(_",
"len_",
"(_",
"a_",
")_",
",_",
"len_",
"(_",
"b_",
")_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"a_",
"[_",
"i_",
"]_",
"!=_",
"b_",
"[_",
"i_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"first",
"\\u",
"diff_",
"=_",
"i_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"first",
"\\u",
"diff_",
"=_",
"min_",
"(_",
"len_",
"(_",
"a_",
")_",
",_",
"len_",
"(_",
"b_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Color",
"ize",
" ",
"from",
" ",
"the",
" ",
"first",
" ",
"difference",
" ",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"a_",
"[_",
":_",
"first",
"\\u",
"diff_",
"]_",
"+_",
"self_",
"._",
"colorize_",
"(_",
"highlight_",
",_",
"a_",
"[_",
"first",
"\\u",
"diff_",
":_",
"]_",
")_",
",_",
"b_",
"[_",
":_",
"first",
"\\u",
"diff_",
"]_",
"+_",
"self_",
"._",
"colorize_",
"(_",
"highlight_",
",_",
"b_",
"[_",
"first",
"\\u",
"diff_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | openstack/networking-cisco/setup.py | [
{
"content": "# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT\nimport setuptools\n\n# In python < 2.7.4, a lazy loading of package `pbr` will break\n# setuptools if some other modules registered functions in `atexit`.\n# solution from: http://bugs.python.org/issue15881#msg170215\ntry:\n import multiprocessing # noqa\nexcept ImportError:\n pass\n\nsetuptools.setup(\n setup_requires=['pbr'],\n pbr=True)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2013",
" ",
"He",
"wle",
"tt",
"-",
"Packa",
"rd",
" ",
"Dev",
"elo",
"pme",
"nt",
" ",
"Compa",
"ny",
",",
" ",
"L",
".",
"P",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"THIS",
" ",
"FILE",
" ",
"IS",
" ",
"MANAGE",
"D",
" ",
"BY",
" ",
"THE",
" ",
"GLOB",
"AL",
" ",
"REQUIRE",
"MENT",
"S",
" ",
"REPO",
" ",
"-",
" ",
"DO",
" ",
"NOT",
" ",
"EDIT",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"setuptools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
" ",
"python",
" ",
"<",
" ",
"2.7",
".4",
",",
" ",
"a",
" ",
"lazy",
" ",
"load",
"ing",
" ",
"of",
" ",
"package",
" ",
"`",
"pb",
"r",
"`",
" ",
"will",
" ",
"break_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"setup",
"tool",
"s",
" ",
"if",
" ",
"some",
" ",
"other",
" ",
"module",
"s",
" ",
"register",
"ed",
" ",
"function",
"s",
" ",
"in",
" ",
"`",
"ate",
"xit",
"`.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"solut",
"ion",
" ",
"from",
":",
" ",
"http",
"://",
"bug",
"s",
".",
"python",
".",
"org",
"/",
"issue",
"158",
"8",
"1",
"#",
"msg",
"170",
"215_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"multiprocessing_",
"#",
" ",
"no",
"qa_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"setuptools_",
"._",
"setup_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"setup",
"\\u",
"requires_",
"=_",
"[_",
"'",
"pb",
"r",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pb",
"r_",
"=_",
"True_",
")_"
] | [
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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