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'
nfvlabs/openmano/openmano/test/test_osconnector.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n##\n# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.\n# This file is part of openmano\n# All Rights Reserved.\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# For those usages not covered by the Apache License, Version 2.0 please\n# contact with: nfvlabs@tid.es\n##\n\n'''\ntest_osconnector.py makes a test over osconnector.py (openstack connector)\ncredentiasl must be provided with environment bash variables or arguments\n'''\n__author__=\"Alfonso Tierno, Gerardo Garcia\"\n__date__ =\"$22-jun-2014 11:19:29$\"\n\n\nimport os\nimport sys\nimport getopt\n#import yaml\n#from jsonschema import validate as js_v, exceptions as js_e\n\n#load osconnector, insert openmano directory in the path\nr=sys.argv[0].rfind('/')\nif r<0:\n osconnector_path=\"..\"\nelse:\n osconnector_path=sys.argv[0][:r+1]+\"..\"\nsys.path.insert(0, osconnector_path)\n#sys.path.insert(0, '/home/atierno/workspace/openmano/openmano')\nimport osconnector\n\nversion=\"0.1\"\n\n\n\nif __name__==\"__main__\":\n global myvim\n global rollback_list\n #print \"(c) Copyright Telefonica\"\n rollback_list=[]\n try:\n opts, args = getopt.getopt(sys.argv[1:], \"hv:u:U:p:t:i:\",\n [\"username=\", \"help\", \"version=\", \"password=\", \"tenant=\", \"url=\",\"skip-admin-tests\",'image='])\n except getopt.GetoptError, err:\n # print help information and exit:\n print \"Error:\", err # will print something like \"option -a not recognized\"\n usage()\n sys.exit(2)\n \n creds = {}\n creds['version'] = os.environ.get('OS_VERSION', '2')\n creds['username'] = os.environ.get('OS_USERNAME')\n creds['password'] = os.environ.get('OS_PASSWORD')\n creds['auth_url'] = os.environ.get('OS_AUTH_URL')\n creds['tenant_name'] = os.environ.get('OS_TENANT_NAME')\n skip_admin_tests=False\n image_path=\"http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img\"\n for o, a in opts:\n if o in (\"-h\", \"--help\"):\n usage()\n sys.exit()\n elif o in (\"-v\", \"--version\"):\n creds['version']=a\n elif o in (\"-u\", \"--username\"):\n creds['username']=a\n elif o in (\"-p\", \"--password\"):\n creds['password']=a\n elif o in (\"-U\", \"--auth_url\"):\n creds['auth_url']=a\n elif o in (\"-t\", \"--tenant_name\"):\n creds['tenant_name']=a\n elif o in (\"-i\", \"--image\"):\n image_path=a\n elif o==\"--skip-admin-tests\":\n skip_admin_tests=True\n else:\n assert False, \"Unhandled option\"\n \n if creds['auth_url']==None:\n print \"you must provide openstack url with -U or bash OS_AUTH_URL\"\n sys.exit()\n print \"creds:\", creds\n \n\n try:\n print 'load osconnector class'.ljust(50),\n sys.stdout.flush()\n try:\n myvim=osconnector.osconnector(uuid=None, name='test-openstack', tenant=creds['tenant_name'], \n url=creds['auth_url'], url_admin=None,\n user=creds['username'], passwd=creds['password'],\n debug = False, config={'network_vlan_ranges':'physnet_sriov'} )\n print \" Ok\"\n except Exception, e:\n print \" Fail\"\n print str(type(e))[6:-1] + \": \"+ str(e) \n exit(-1)\n \n if not skip_admin_tests:\n tenant_name=\"tos-tenant\"\n print (\"creating new tenant '%s'\" % tenant_name).ljust(50),\n sys.stdout.flush()\n result,new_tenant=myvim.new_tenant(tenant_name, \"test tenant_description, trying a long description to get the limit. 2 trying a long description to get the limit. 3. trying a long description to get the limit.\")\n if result<0:\n print \" Fail\"\n print \" you can skip tenant creation with param'--skip-admin-tests'\"\n print \" VIM response:\", new_tenant\n exit(-1)\n else:\n print \" Ok\", new_tenant\n rollback_list.append((\"tenant\",tenant_name,new_tenant))\n\n user_name=\"tos-user\"\n print (\"creating new user '%s'\" % user_name).ljust(50),\n sys.stdout.flush()\n result,new_user=myvim.new_user(user_name, user_name, tenant_id=new_tenant)\n if result<0:\n print \" Fail\"\n print \" VIM response:\", new_user\n exit(-1)\n else:\n print \" Ok\", new_user\n rollback_list.append((\"user\",user_name,new_user))\n \n name=\"tos-fl1\"\n print (\"creating new flavor '%s'\"%name).ljust(50),\n sys.stdout.flush()\n flavor={}\n flavor['name']=name\n result,new_flavor1=myvim.new_tenant_flavor(flavor, True)\n if result<0:\n print \" Fail\"\n print \" VIM response:\", new_flavor1\n exit(-1)\n else:\n print \" Ok\", new_flavor1\n rollback_list.append((\"flavor\",name,new_flavor1))\n \n name=\"tos-cirros\"\n print (\"creating new image '%s'\"%name).ljust(50),\n sys.stdout.flush()\n image={}\n image['name']=name\n image['location']=image_path #\"/home/atierno/cirros-0.3.3-x86_64-disk.img\"\n result,new_image1=myvim.new_tenant_image(image)\n if result<0:\n print \" Fail\"\n print \" VIM response:\", new_image1\n exit(-1)\n else:\n print \" Ok\", new_image1\n rollback_list.append((\"image\",name, new_image1))\n\n if not skip_admin_tests:\n try:\n print 'changing credentials to new tenant'.ljust(50),\n sys.stdout.flush()\n myvim['tenant'] =tenant_name\n myvim['user']=user_name\n myvim['passwd']=user_name\n print \" Ok\"\n rollback_list.append((\"creds\", \"tenant\", creds[\"tenant_name\"]))\n rollback_list.append((\"creds\", \"user\", creds[\"username\"]))\n rollback_list.append((\"creds\", \"passwd\", creds[\"password\"]))\n except Exception, e:\n print \" Fail\"\n print \" Error setting osconnector to new tenant:\", str(type(e))[6:-1] + \": \"+ str(e)\n exit(-1)\n\n name=\"tos-net-bridge\"\n print (\"creating new net '%s'\"%name).ljust(50),\n sys.stdout.flush()\n result,new_net1=myvim.new_tenant_network(name, \"bridge\")\n if result<0:\n print \" Fail\"\n print \" VIM response:\", new_net1\n exit(-1)\n else:\n print \" Ok\", new_net1\n rollback_list.append((\"network\",name, new_net1))\n\n name=\"tos-vm-cloud\"\n print (\"creating new VM '%s'\"%name).ljust(50),\n sys.stdout.flush()\n result,new_vm1=myvim.new_tenant_vminstance(name, \"vm-cloud-description\", False,new_image1,new_flavor1,\n [{\"net_id\":new_net1, \"type\":\"virtio\"}] )\n if result<0:\n print \" Fail\"\n print \" VIM response:\", new_vm1\n exit(-1)\n else:\n print \" Ok\", new_vm1\n rollback_list.append((\"vm\",name, new_vm1))\n\n \n print 'DONE Ok'\n print \"Type ENTER to delete items\"\n raw_input('> ') \n exit() \n \n except KeyboardInterrupt:\n print \" Canceled!\"\n except SystemExit:\n pass\n if len(rollback_list):\n delete_items()\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", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Tele", "f", "\\", "243", ";", "nic", "a", " ", "Invest", "iga", "ci", "\\", "243", ";", "n", " ", "y", " ", "Des", "arr", "oll", "o", ",", " ", "S", ".", "A", ".", "U", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "openm", "ano", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "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_", "#", " ", "For", " ", "tho", "se", " ", "usage", "s", " ", "not", " ", "covered", " ", "by", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "plea", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contact", " ", "with", ":", " ", "nf", "vla", "bs", "@", "tid", ".", "es_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "test\\u", "osco", "nnect", "or", ".", "py", " ", "make", "s", " ", "a", " ", "test", " ", "over", " ", "osco", "nnect", "or", ".", "py", " ", "(", "openst", "ack", " ", "connect", "or", ")", "\\", "10", ";", "cred", "enti", "asl", " ", "must", " ", "be", " ", "provided", " ", "with", " ", "environ", "ment", " ", "bash", " ", "variab", "les", " ", "or", " ", "argu", "ment", "s", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Al", "fon", "so", " ", "Tier", "no", ",", " ", "Ger", "ard", "o", " ", "Gar", "cia", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "date\\u\\u_", "=_", "\"$", "2", "2", "-", "jun", "-", "2014", " ", "11", ":", "1", "9", ":", "2", "9", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "import", " ", "yaml_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "jsonschema", " ", "import", " ", "validat", "e", " ", "as", " ", "js", "\\u", "v", ",", " ", "exception", "s", " ", "as", " ", "js", "\\u", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "load", " ", "osco", "nnect", "or", ",", " ", "insert", " ", "openm", "ano", " ", "director", "y", " ", "in", " ", "the", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "sys_", "._", "argv_", "[_", "0_", "]_", "._", "rfind_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "osco", "nnect", "or", "\\u", "path_", "=_", "\"..\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "osco", "nnect", "or", "\\u", "path_", "=_", "sys_", "._", "argv_", "[_", "0_", "]_", "[_", ":_", "r_", "+_", "1_", "]_", "+_", "\"..\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "osco", "nnect", "or", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "'/", "home", "/", "ati", "ern", "o", "/", "works", "pace", "/", "openm", "ano", "/", "openm", "ano", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "osco", "nnect", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\"", "0.", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "myv", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "rollback", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"(", "c", ")", " ", "Copy", "right", " ", "Tele", "fon", "ica", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "\"", "hv", ":", "u", ":", "U", ":", "p", ":", "t", ":", "i", ":\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "user", "name", "=\"_", ",_", "\"", "help", "\"_", ",_", "\"", "version", "=\"_", ",_", "\"", "password", "=\"_", ",_", "\"", "tenan", "t", "=\"_", ",_", "\"", "url", "=\"_", ",_", "\"", "skip", "-", "admin", "-", "tests", "\"_", ",_", "'", "image", "='_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "help", " ", "informati", "on", " ", "and", " ", "exit", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", ":\"_", ",_", "err_", "#", " ", "will", " ", "print", " ", "somet", "hing", " ", "like", " ", "\"", "option", " ", "-", "a", " ", "not", " ", "recognize", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "creds_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "[_", "'", "version", "'_", "]_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "VERSI", "ON", "'_", ",_", "'", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "[_", "'", "user", "name", "'_", "]_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "USER", "NAME", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "[_", "'", "password", "'_", "]_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "PASS", "WORD", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "[_", "'", "auth", "\\u", "url", "'_", "]_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "AUTH", "\\u", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "[_", "'", "tenan", "t", "\\u", "name", "'_", "]_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "TENANT", "\\u", "NAME", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip", "\\u", "admin", "\\u", "tests_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "path_", "=_", "\"", "http", "://", "download", ".", "cir", "ros", "-", "cloud", ".", "net", "/", "0.", "3.3", "/", "cir", "ros", "-0", ".3", ".3", "-", "x8", "6", "\\u", "64", "-", "disk", ".", "img", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "in_", "(_", "\"-", "h", "\"_", ",_", "\"--", "help", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "v", "\"_", ",_", "\"--", "version", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "[_", "'", "version", "'_", "]_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "u", "\"_", ",_", "\"--", "user", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "[_", "'", "user", "name", "'_", "]_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "p", "\"_", ",_", "\"--", "password", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "[_", "'", "password", "'_", "]_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "U", "\"_", ",_", "\"--", "auth", "\\u", "url", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "[_", "'", "auth", "\\u", "url", "'_", "]_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "t", "\"_", ",_", "\"--", "tenan", "t", "\\u", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "[_", "'", "tenan", "t", "\\u", "name", "'_", "]_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "i", "\"_", ",_", "\"--", "image", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "path_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "\"--", "skip", "-", "admin", "-", "tests", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip", "\\u", "admin", "\\u", "tests_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "\"", "Unh", "andle", "d", " ", "option", "\"_", "\\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_", "creds_", "[_", "'", "auth", "\\u", "url", "'_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "you", " ", "must", " ", "provide", " ", "openst", "ack", " ", "url", " ", "with", " ", "-", "U", " ", "or", " ", "bash", " ", "OS", "\\u", "AUTH", "\\u", "URL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "creds", ":\"_", ",_", "creds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "load", " ", "osco", "nnect", "or", " ", "class", "'_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myv", "im_", "=_", "osco", "nnect", "or_", "._", "osco", "nnect", "or_", "(_", "uuid_", "=_", "None_", ",_", "name_", "=_", "'", "test", "-", "openst", "ack", "'_", ",_", "tenant_", "=_", "creds_", "[_", "'", "tenan", "t", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "creds_", "[_", "'", "auth", "\\u", "url", "'_", "]_", ",_", "url", "\\u", "admin_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "creds_", "[_", "'", "user", "name", "'_", "]_", ",_", "passwd_", "=_", "creds_", "[_", "'", "password", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "False_", ",_", "config_", "=_", "{_", "'", "network", "\\u", "vlan", "\\u", "ranges", "'_", ":_", "'", "phys", "net", "\\u", "sri", "ov", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Ok", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "str_", "(_", "type_", "(_", "e_", ")_", ")_", "[_", "6_", ":_", "-_", "1_", "]_", "+_", "\":", " ", "\"_", "+_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "skip", "\\u", "admin", "\\u", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tenan", "t", "\\u", "name_", "=_", "\"", "tos", "-", "tenan", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "creati", "ng", " ", "new", " ", "tenan", "t", " ", "'%", "s", "'\"_", "%_", "tenan", "t", "\\u", "name_", ")_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "new", "\\u", "tenant_", "=_", "myv", "im_", "._", "new", "\\u", "tenant_", "(_", "tenan", "t", "\\u", "name_", ",_", "\"", "test", " ", "tenan", "t", "\\u", "description", ",", " ", "try", "ing", " ", "a", " ", "long", " ", "description", " ", "to", " ", "get", " ", "the", " ", "limit", ".", " ", "2", " ", "try", "ing", " ", "a", " ", "long", " ", "description", " ", "to", " ", "get", " ", "the", " ", "limit", ".", " ", "3", ".", " ", "try", "ing", " ", "a", " ", "long", " ", "description", " ", "to", " ", "get", " ", "the", " ", "limit", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "you", " ", "can", " ", "skip", " ", "tenan", "t", " ", "creati", "on", " ", "with", " ", "param", "'--", "skip", "-", "admin", "-", "tests", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "VI", "M", " ", "response", ":\"_", ",_", "new", "\\u", "tenant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 ", " _", "print_", "\"", " ", "Ok", "\"_", ",_", "new", "\\u", "tenant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "tenan", "t", "\"_", ",_", "tenan", "t", "\\u", "name_", ",_", "new", "\\u", "tenant_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "name_", "=_", "\"", "tos", "-", "user", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "creati", "ng", " ", "new", " ", "user", " ", "'%", "s", "'\"_", "%_", "user", "\\u", "name_", ")_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "new", "\\u", "user_", "=_", "myv", "im_", "._", "new", "\\u", "user_", "(_", "user", "\\u", "name_", ",_", "user", "\\u", "name_", ",_", "tenan", "t", "\\u", "id_", "=_", "new", "\\u", "tenant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "VI", "M", " ", "response", ":\"_", ",_", "new", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 ", " _", "print_", "\"", " ", "Ok", "\"_", ",_", "new", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "user", "\"_", ",_", "user", "\\u", "name_", ",_", "new", "\\u", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "\"", "tos", "-", "fl", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "creati", "ng", " ", "new", " ", "flavor", " ", "'%", "s", "'\"_", "%_", "name_", ")_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "[_", "'", "name", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "new", "\\u", "flavor", "1_", "=_", "myv", "im_", "._", "new", "\\u", "tenan", "t", "\\u", "flavor_", "(_", "flavor_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "VI", "M", " ", "response", ":\"_", ",_", "new", "\\u", "flavor", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 ", " _", "print_", "\"", " ", "Ok", "\"_", ",_", "new", "\\u", "flavor", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "flavor", "\"_", ",_", "name_", ",_", "new", "\\u", "flavor", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "\"", "tos", "-", "cir", "ros", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "creati", "ng", " ", "new", " ", "image", " ", "'%", "s", "'\"_", "%_", "name_", ")_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "[_", "'", "name", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "[_", "'", "location", "'_", "]_", "=_", "image", "\\u", "path_", "#\"", "/", "home", "/", "ati", "ern", "o", "/", "cir", "ros", "-0", ".3", ".3", "-", "x8", "6", "\\u", "64", "-", "disk", ".", "img", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "new", "\\u", "image1", "_", "=_", "myv", "im_", "._", "new", "\\u", "tenan", "t", "\\u", "image_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "VI", "M", " ", "response", ":\"_", ",_", "new", "\\u", "image1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 ", " _", "print_", "\"", " ", "Ok", "\"_", ",_", "new", "\\u", "image1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "image", "\"_", ",_", "name_", ",_", "new", "\\u", "image1", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "skip", "\\u", "admin", "\\u", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "chang", "ing", " ", "cred", "ential", "s", " ", "to", " ", "new", " ", "tenan", "t", "'_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myv", "im_", "[_", "'", "tenan", "t", "'_", "]_", "=_", "tenan", "t", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myv", "im_", "[_", "'", "user", "'_", "]_", "=_", "user", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myv", "im_", "[_", "'", "passw", "d", "'_", "]_", "=_", "user", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Ok", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "creds", "\"_", ",_", "\"", "tenan", "t", "\"_", ",_", "creds_", "[_", "\"", "tenan", "t", "\\u", "name", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "creds", "\"_", ",_", "\"", "user", "\"_", ",_", "creds_", "[_", "\"", "user", "name", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "creds", "\"_", ",_", "\"", "passw", "d", "\"_", ",_", "creds_", "[_", "\"", "password", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Error", " ", "setti", "ng", " ", "osco", "nnect", "or", " ", "to", " ", "new", " ", "tenan", "t", ":\"_", ",_", "str_", "(_", "type_", "(_", "e_", ")_", ")_", "[_", "6_", ":_", "-_", "1_", "]_", "+_", "\":", " ", "\"_", "+_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "-_", "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_", "name_", "=_", "\"", "tos", "-", "net", "-", "bridge", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "creati", "ng", " ", "new", " ", "net", " ", "'%", "s", "'\"_", "%_", "name_", ")_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "new", "\\u", "net", "1_", "=_", "myv", "im_", "._", "new", "\\u", "tenan", "t", "\\u", "network_", "(_", "name_", ",_", "\"", "bridge", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "VI", "M", " ", "response", ":\"_", ",_", "new", "\\u", "net", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 ", " _", "print_", "\"", " ", "Ok", "\"_", ",_", "new", "\\u", "net", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "network", "\"_", ",_", "name_", ",_", "new", "\\u", "net", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "\"", "tos", "-", "vm", "-", "cloud", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "creati", "ng", " ", "new", " ", "VM", " ", "'%", "s", "'\"_", "%_", "name_", ")_", "._", "ljust_", "(_", "50_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "new", "\\u", "vm", "1_", "=_", "myv", "im_", "._", "new", "\\u", "tenan", "t", "\\u", "vmin", "stance", "_", "(_", "name_", ",_", "\"", "vm", "-", "cloud", "-", "description", "\"_", ",_", "False_", ",_", "new", "\\u", "image1", "_", ",_", "new", "\\u", "flavor", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "\"", "net", "\\u", "id", "\"_", ":_", "new", "\\u", "net", "1_", ",_", "\"", "type", "\"_", ":_", "\"", "virt", "io", "\"_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Fail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "VI", "M", " ", "response", ":\"_", ",_", "new", "\\u", "vm", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 ", " _", "print_", "\"", " ", "Ok", "\"_", ",_", "new", "\\u", "vm", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "list_", "._", "append_", "(_", "(_", "\"", "vm", "\"_", ",_", "name_", ",_", "new", "\\u", "vm", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "DON", "E", " ", " ", "Ok", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Type", " ", "ENT", "ER", " ", "to", " ", "delete", " ", "items", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "input_", "(_", "'>", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "Cancel", "ed", "!\"_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "rollback", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "\\u", "items_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused import
kayhayen/Nuitka/misc/make-pypi-upload.py
[ { "content": "#!/usr/bin/env PYTHONUNBUFFERED=1 python\n# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com\n#\n# Part of \"Nuitka\", an optimizing Python compiler that is compatible and\n# integrates with CPython, but also works on its own.\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\"\"\" Make PyPI upload of Nuitka, and check success of it. \"\"\"\n\nfrom __future__ import print_function\n\nimport os\nimport subprocess\nimport time\nimport xmlrpclib\n\nnuitka_version = subprocess.check_output(\n \"./bin/nuitka --version\", shell = True\n).strip()\nbranch_name = subprocess.check_output(\n \"git name-rev --name-only HEAD\".split()\n).strip()\n\nassert branch_name == \"master\", branch_name\nassert \"pre\" not in nuitka_version and \"rc\" not in nuitka_version\n\n# Need to remove the contents from the Rest, or else PyPI will not render\n# it. Stupid but true.\ncontents = open(\"README.rst\", \"rb\").read()\ncontents = contents.replace(b\".. contents::\", b\"\")\nopen(\"README.rst\", \"wb\").write(contents)\ncontents = open(\"README.rst\", \"rb\").read()\nassert b\".. contents\" not in contents\n\nprint(\"Creating documentation.\")\nassert 0 == os.system(\"misc/make-doc.py\")\nprint(\"Creating source distribution and uploading it.\")\nassert 0 == os.system(\"python setup.py sdist upload\")\n\nfor _i in range(60):\n # Wait some time for PyPI to catch up with us. Without delay\n # the old version will still appear. Since this is running\n # in a Buildbot, we need not be optimal.\n time.sleep(5*60)\n\n pypi = xmlrpclib.ServerProxy(\"http://pypi.python.org/pypi\")\n pypi_versions = pypi.package_releases(\"Nuitka\")\n\n assert len(pypi_versions) == 1, pypi_versions\n if nuitka_version == pypi_versions[0]:\n break\n\n print(\"Version check failed:\", nuitka_version, pypi_versions)\n\nprint(\"Uploaded OK:\", pypi_versions[0])\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", "UN", "BUFF", "ERE", "D", "=", "1", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2016", ",", " ", "Ka", "y", " ", "Ha", "yen", ",", " ", "mail", "to", ":", "ka", "y", ".", "hay", "en", "@", "gma", "il", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Part", " ", "of", " ", "\"", "Nu", "itk", "a", "\",", " ", "an", " ", "optim", "izi", "ng", " ", "Pyth", "on", " ", "compiler", " ", "tha", "t", " ", "is", " ", "compatible", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrate", "s", " ", "with", " ", "CP", "yth", "on", ",", " ", "but", " ", "als", "o", " ", "works", " ", "on", " ", "its", " ", "own", "._", "\\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_", "\"\"\"", " ", "Make", " ", "Py", "PI", " ", "upload", " ", "of", " ", "Nu", "itk", "a", ",", " ", "and", " ", "check", " ", "success", " ", "of", " ", "it", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xmlrpclib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nu", "itk", "a", "\\u", "version_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"./", "bin", "/", "nu", "itk", "a", " ", "--", "version", "\"_", ",_", "shell_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch", "\\u", "name_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "git", " ", "name", "-", "rev", " ", "--", "name", "-", "only", " ", "HEAD", "\"_", "._", "split_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "branch", "\\u", "name_", "==_", "\"", "master", "\"_", ",_", "branch", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "pre", "\"_", "not_", "in_", "nu", "itk", "a", "\\u", "version_", "and_", "\"", "rc", "\"_", "not_", "in_", "nu", "itk", "a", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "remove", " ", "the", " ", "content", "s", " ", "from", " ", "the", " ", "Rest", ",", " ", "or", " ", "else", " ", "Py", "PI", " ", "will", " ", "not", " ", "render_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", ".", " ", "Stu", "pid", " ", "but", " ", "true", "._", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "open_", "(_", "\"", "READ", "ME", ".", "rst", "\"_", ",_", "\"", "rb", "\"_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "contents_", "._", "replace_", "(_", "b", "\"..", " ", "content", "s", "::", "\"_", ",_", "b", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "\"", "READ", "ME", ".", "rst", "\"_", ",_", "\"", "wb", "\"_", ")_", "._", "write_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "open_", "(_", "\"", "READ", "ME", ".", "rst", "\"_", ",_", "\"", "rb", "\"_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "b", "\"..", " ", "content", "s", "\"_", "not_", "in_", "contents_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Creat", "ing", " ", "documentation", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "==_", "os_", "._", "system_", "(_", "\"", "misc", "/", "make", "-", "doc", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Creat", "ing", " ", "source", " ", "distribu", "tion", " ", "and", " ", "upload", "ing", " ", "it", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "==_", "os_", "._", "system_", "(_", "\"", "python", " ", "setup", ".", "py", " ", "sdist", " ", "upload", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "i_", "in_", "range_", "(_", "60_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wait", " ", "some", " ", "time", " ", "for", " ", "Py", "PI", " ", "to", " ", "catch", " ", "up", " ", "with", " ", "us", ".", " ", "With", "out", " ", "delay_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "old", " ", "version", " ", "will", " ", "still", " ", "appear", ".", " ", "Sin", "ce", " ", "this", " ", "is", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "a", " ", "Build", "bot", ",", " ", "we", " ", "need", " ", "not", " ", "be", " ", "optim", "al", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "5_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pypi", "_", "=_", "xmlrpclib_", "._", "Server", "Proxy_", "(_", "\"", "http", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pypi", "\\u", "versions_", "=_", "pypi", "_", "._", "package", "\\u", "releases_", "(_", "\"", "Nu", "itk", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "pypi", "\\u", "versions_", ")_", "==_", "1_", ",_", "pypi", "\\u", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nu", "itk", "a", "\\u", "version_", "==_", "pypi", "\\u", "versions_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Version", " ", "check", " ", "fail", "ed", ":\"_", ",_", "nu", "itk", "a", "\\u", "version_", ",_", "pypi", "\\u", "versions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Upload", "ed", " ", "OK", ":\"_", ",_", "pypi", "\\u", "versions_", "[_", "0_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
gamechanger/schemer/schemer/validators.py
[ { "content": "import re\nfrom pprint import pformat\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 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pformat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 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 ]
Unused import
openshift/openshift-ansible/inventory/openstack/hosts/nova.py
[ { "content": "#!/usr/bin/env python2\n\n# pylint: skip-file\n\n# (c) 2012, Marco Vito Moscaritolo <marco@agavee.com>\n#\n# This file is part of Ansible,\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Ansible is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with Ansible. If not, see <http://www.gnu.org/licenses/>.\n\nimport sys\nimport re\nimport os\nimport ConfigParser\nfrom novaclient import client as nova_client\n\ntry:\n import json\nexcept ImportError:\n import simplejson as json\n\n###################################################\n# executed with no parameters, return the list of\n# all groups and hosts\n\nNOVA_CONFIG_FILES = [os.path.join(os.path.dirname(os.path.realpath(__file__)), \"nova.ini\"),\n os.path.expanduser(os.environ.get('ANSIBLE_CONFIG', \"~/nova.ini\")),\n \"/etc/ansible/nova.ini\"]\n\nNOVA_DEFAULTS = {\n 'auth_system': None,\n 'region_name': None,\n 'service_type': 'compute',\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\nconfig = nova_load_config_file()\nif not config:\n sys.exit('Unable to find configfile in %s' % ', '.join(NOVA_CONFIG_FILES))\n\n# Load up connections info based on config and then environment\n# variables\nusername = (get_fallback(config, 'username') or\n os.environ.get('OS_USERNAME', None))\napi_key = (get_fallback(config, 'api_key') or\n os.environ.get('OS_PASSWORD', None))\nauth_url = (get_fallback(config, 'auth_url') or\n os.environ.get('OS_AUTH_URL', None))\nproject_id = (get_fallback(config, 'project_id') or\n os.environ.get('OS_TENANT_NAME', None))\nregion_name = (get_fallback(config, 'region_name') or\n os.environ.get('OS_REGION_NAME', None))\nauth_system = (get_fallback(config, 'auth_system') or\n os.environ.get('OS_AUTH_SYSTEM', None))\n\n# Determine what type of IP is preferred to return\nprefer_private = False\ntry:\n prefer_private = config.getboolean('openstack', 'prefer_private')\nexcept ConfigParser.NoOptionError:\n pass\n\nclient = nova_client.Client(\n version=config.get('openstack', 'version'),\n username=username,\n api_key=api_key,\n auth_url=auth_url,\n region_name=region_name,\n project_id=project_id,\n auth_system=auth_system,\n service_type=config.get('openstack', 'service_type'),\n)\n\n# Default or added list option\nif (len(sys.argv) == 2 and sys.argv[1] == '--list') or len(sys.argv) == 1:\n groups = {'_meta': {'hostvars': {}}}\n # Cycle on servers\n for server in client.servers.list():\n access_ip = get_ips(server)\n\n # Push to name group of 1\n push(groups, server.name, access_ip)\n\n # Run through each metadata item and add instance to it\n for key, value in server.metadata.iteritems():\n composed_key = to_safe('tag_{0}_{1}'.format(key, value))\n push(groups, composed_key, access_ip)\n\n # Do special handling of group for backwards compat\n # inventory groups\n group = server.metadata['group'] if 'group' in server.metadata else 'undefined'\n push(groups, group, access_ip)\n\n # Add vars to _meta key for performance optimization in\n # Ansible 1.3+\n groups['_meta']['hostvars'][access_ip] = get_metadata(server)\n\n # Return server list\n print(json.dumps(groups, sort_keys=True, indent=2))\n sys.exit(0)\n\n#####################################################\n# executed with a hostname as a parameter, return the\n# variables for that host\n\nelif len(sys.argv) == 3 and (sys.argv[1] == '--host'):\n results = {}\n ips = []\n for server in client.servers.list():\n if sys.argv[2] in (get_ips(server) or []):\n results = get_metadata(server)\n print(json.dumps(results, sort_keys=True, indent=2))\n sys.exit(0)\n\nelse:\n print \"usage: --list ..OR.. --host <hostname>\"\n sys.exit(1)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def nova_load_config_file():\n p = ConfigParser.SafeConfigParser(NOVA_DEFAULTS)\n\n for path in NOVA_CONFIG_FILES:\n if os.path.exists(path):\n p.read(path)\n return p\n\n return None", "metadata": "root.nova_load_config_file", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def get_fallback(config, value, section=\"openstack\"):\n \"\"\"\n Get value from config object and return the value\n or false\n \"\"\"\n try:\n return config.get(section, value)\n except ConfigParser.NoOptionError:\n return False", "metadata": "root.get_fallback", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def push(data, key, element):\n \"\"\"\n Assist in items to a dictionary of lists\n \"\"\"\n if (not element) or (not key):\n return\n\n if key in data:\n data[key].append(element)\n else:\n data[key] = [element]", "metadata": "root.push", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def to_safe(word):\n '''\n Converts 'bad' characters in a string to underscores so they can\n be used as Ansible groups\n '''\n return re.sub(r\"[^A-Za-z0-9\\-]\", \"_\", word)", "metadata": "root.to_safe", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def get_ips(server, access_ip=True):\n \"\"\"\n Returns a list of the server's IPs, or the preferred\n access IP\n \"\"\"\n private = []\n public = []\n address_list = []\n # Iterate through each servers network(s), get addresses and get type\n addresses = getattr(server, 'addresses', {})\n if len(addresses) > 0:\n for network in addresses.itervalues():\n for address in network:\n if address.get('OS-EXT-IPS:type', False) == 'fixed':\n private.append(address['addr'])\n elif address.get('OS-EXT-IPS:type', False) == 'floating':\n public.append(address['addr'])\n\n if not access_ip:\n address_list.append(server.accessIPv4)\n address_list.extend(private)\n address_list.extend(public)\n return address_list\n\n access_ip = None\n # Append group to list\n if server.accessIPv4:\n access_ip = server.accessIPv4\n if (not access_ip) and public and not (private and prefer_private):\n access_ip = public[0]\n if private and not access_ip:\n access_ip = private[0]\n\n return access_ip", "metadata": "root.get_ips", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def get_metadata(server):\n \"\"\"Returns dictionary of all host metadata\"\"\"\n get_ips(server, False)\n results = {}\n for key in vars(server):\n # Extract value\n value = getattr(server, key)\n\n # Generate sanitized key\n key = 'os_' + re.sub(r\"[^A-Za-z0-9\\-]\", \"_\", key).lower()\n\n # Att value to instance result (exclude manager class)\n #TODO: maybe use value.__class__ or similar inside of key_name\n if key != 'os_manager':\n results[key] = value\n return results", "metadata": "root.get_metadata", "header": "['module', '___EOS___']", "index": 126 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "skip", "-", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "c", ")", " ", "2012", ",", " ", "Marc", "o", " ", "Vit", "o", " ", "Mos", "car", "ito", "lo", " ", "<", "marc", "o", "@", "aga", "ve", "e", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Ans", "ibl", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ans", "ibl", "e", " ", "is", " ", "free", " ", "software", ":", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modify_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ",", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ans", "ibl", "e", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "along", " ", "with", " ", "Ans", "ibl", "e", ".", " ", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "novaclient", "_", "import_", "client_", "as_", "nova", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "executed", " ", "with", " ", "no", " ", "parameter", "s", ",", " ", "return", " ", "the", " ", "list", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "group", "s", " ", "and", " ", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NOV", "A", "\\u", "CONFIG", "\\u", "FILES_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "\"", "nova", ".", "ini", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "expanduser_", "(_", "os_", "._", "environ_", "._", "get_", "(_", "'", "ANSI", "BL", "E", "\\u", "CONFIG", "'_", ",_", "\"~/", "nova", ".", "ini", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "etc", "/", "ansi", "ble", "/", "nova", ".", "ini", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NOV", "A", "\\u", "DEFAULTS_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "system", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "region", "\\u", "name", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "\\u", "type", "'_", ":_", "'", "compute", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "config_", "=_", "nova", "\\u", "load", "\\u", "config", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "'", "Una", "ble", " ", "to", " ", "find", " ", "configf", "ile", " ", "in", " ", "%", "s", "'_", "%_", "',", " ", "'_", "._", "join_", "(_", "NOV", "A", "\\u", "CONFIG", "\\u", "FILES_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "up", " ", "connections", " ", "info", " ", "based", " ", "on", " ", "config", " ", "and", " ", "then", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "username_", "=_", "(_", "get", "\\u", "fallback_", "(_", "config_", ",_", "'", "user", "name", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "USER", "NAME", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "key_", "=_", "(_", "get", "\\u", "fallback_", "(_", "config_", ",_", "'", "api", "\\u", "key", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "PASS", "WORD", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "url_", "=_", "(_", "get", "\\u", "fallback_", "(_", "config_", ",_", "'", "auth", "\\u", "url", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "AUTH", "\\u", "URL", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "id_", "=_", "(_", "get", "\\u", "fallback_", "(_", "config_", ",_", "'", "project", "\\u", "id", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "TENANT", "\\u", "NAME", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "name_", "=_", "(_", "get", "\\u", "fallback_", "(_", "config_", ",_", "'", "region", "\\u", "name", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "REGION", "\\u", "NAME", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "system_", "=_", "(_", "get", "\\u", "fallback_", "(_", "config_", ",_", "'", "auth", "\\u", "system", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OS", "\\u", "AUTH", "\\u", "SYSTEM", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "what", " ", "type", " ", "of", " ", "IP", " ", "is", " ", "prefer", "red", " ", "to", " ", "return_", "\\u\\u\\uNL\\u\\u\\u_", "prefer", "\\u", "private_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefer", "\\u", "private_", "=_", "config_", "._", "getboolean_", "(_", "'", "openst", "ack", "'_", ",_", "'", "prefer", "\\u", "private", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Parser_", "._", "No", "Optio", "n", "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_", "client_", "=_", "nova", "\\u", "client_", "._", "Client_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "config_", "._", "get_", "(_", "'", "openst", "ack", "'_", ",_", "'", "version", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "key_", "=_", "api", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "url_", "=_", "auth", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "name_", "=_", "region", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "id_", "=_", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "system_", "=_", "auth", "\\u", "system_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "type_", "=_", "config_", "._", "get_", "(_", "'", "openst", "ack", "'_", ",_", "'", "service", "\\u", "type", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "or", " ", "adde", "d", " ", "list", " ", "option_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "2_", "and_", "sys_", "._", "argv_", "[_", "1_", "]_", "==_", "'--", "list", "'_", ")_", "or_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "groups_", "=_", "{_", "'\\u", "meta", "'_", ":_", "{_", "'", "host", "vars", "'_", ":_", "{_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cycle", " ", "on", " ", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "server_", "in_", "client_", "._", "servers_", "._", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "access", "\\u", "ip_", "=_", "get", "\\u", "ips_", "(_", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Push", " ", "to", " ", "name", " ", "group", " ", "of", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "push_", "(_", "groups_", ",_", "server_", "._", "name_", ",_", "access", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "through", " ", "each", " ", "metadata", " ", "item", " ", "and", " ", "add", " ", "instance", " ", "to", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "server_", "._", "metadata_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compose", "d\\u", "key_", "=_", "to", "\\u", "safe_", "(_", "'", "tag", "\\u{", "0", "}\\u", "{", "1", "}'_", "._", "format_", "(_", "key_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push_", "(_", "groups_", ",_", "compose", "d\\u", "key_", ",_", "access", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "special", " ", "handling", " ", "of", " ", "group", " ", "for", " ", "back", "ward", "s", " ", "compat_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inventor", "y", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group_", "=_", "server_", "._", "metadata_", "[_", "'", "group", "'_", "]_", "if_", "'", "group", "'_", "in_", "server_", "._", "metadata_", "else_", "'", "undefined", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push_", "(_", "groups_", ",_", "group_", ",_", "access", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "vars", " ", "to", " ", "\\u", "meta", " ", "key", " ", "for", " ", "perform", "anc", "e", " ", "optimization", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ans", "ibl", "e", " ", "1.3", "+_", "\\u\\u\\uNL\\u\\u\\u_", "groups_", "[_", "'\\u", "meta", "'_", "]_", "[_", "'", "host", "vars", "'_", "]_", "[_", "access", "\\u", "ip_", "]_", "=_", "get", "\\u", "metadata_", "(_", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "server", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "json_", "._", "dumps_", "(_", "groups_", ",_", "sort", "\\u", "keys_", "=_", "True_", ",_", "indent_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "executed", " ", "with", " ", "a", " ", "host", "name", " ", "as", " ", "a", " ", "parameter", ",", " ", "return", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "les", " ", "for", " ", "tha", "t", " ", "host_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "3_", "and_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", "==_", "'--", "host", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ips_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "server_", "in_", "client_", "._", "servers_", "._", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "argv_", "[_", "2_", "]_", "in_", "(_", "get", "\\u", "ips_", "(_", "server_", ")_", "or_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "get", "\\u", "metadata_", "(_", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "json_", "._", "dumps_", "(_", "results_", ",_", "sort", "\\u", "keys_", "=_", "True_", ",_", "indent_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\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 ", " _", "print_", "\"", "usage", ":", " ", "--", "list", " ", " ", "..", "OR", "..", " ", "--", "host", " ", "<", "host", "name", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "nova", "\\u", "load", "\\u", "config", "\\u", "file_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Config", "Parser_", "._", "Safe", "Config", "Parser_", "(_", "NOV", "A", "\\u", "DEFAULTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "path_", "in_", "NOV", "A", "\\u", "CONFIG", "\\u", "FILES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "._", "read_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "p_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "fallback_", "(_", "config_", ",_", "value_", ",_", "section_", "=_", "\"", "openst", "ack", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "value", " ", "from", " ", "config", " ", "object", " ", "and", " ", "return", " ", "the", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "config_", "._", "get_", "(_", "section_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Parser_", "._", "No", "Optio", "n", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push_", "(_", "data_", ",_", "key_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Assi", "st", " ", "in", " ", "items", " ", "to", " ", "a", " ", "dictionar", "y", " ", "of", " ", "lists", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "element_", ")_", "or_", "(_", "not_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "key_", "]_", "._", "append_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "key_", "]_", "=_", "[_", "element_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "safe_", "(_", "word_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "'", "bad", "'", " ", "character", "s", " ", "in", " ", "a", " ", "string", " ", "to", " ", "underscore", "s", " ", "so", " ", "the", "y", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "used", " ", "as", " ", "Ans", "ibl", "e", " ", "group", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "r", "\"[", "^", "A", "-", "Za", "-", "z", "0", "-", "9", "\\\\-]", "\"_", ",_", "\"\\u\"_", ",_", "word_", ")_", "\\u\\u\\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", "ips_", "(_", "server_", ",_", "access", "\\u", "ip_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "the", " ", "server", "'", "s", " ", "IP", "s", ",", " ", "or", " ", "the", " ", "prefer", "red", "\\", "10", ";", " ", " ", " ", " ", "access", " ", "IP", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "private_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "public_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "through", " ", "each", " ", "server", "s", " ", "network", "(", "s", "),", " ", "get", " ", "addresse", "s", " ", "and", " ", "get", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "addresses_", "=_", "getattr_", "(_", "server_", ",_", "'", "addresse", "s", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "addresses_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "network_", "in_", "addresses_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "address_", "in_", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "address_", "._", "get_", "(_", "'", "OS", "-", "EXT", "-", "IPS", ":", "type", "'_", ",_", "False_", ")_", "==_", "'", "fixed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "private_", "._", "append_", "(_", "address_", "[_", "'", "addr", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "address_", "._", "get_", "(_", "'", "OS", "-", "EXT", "-", "IPS", ":", "type", "'_", ",_", "False_", ")_", "==_", "'", "float", "ing", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "public_", "._", "append_", "(_", "address_", "[_", "'", "addr", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "access", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address", "\\u", "list_", "._", "append_", "(_", "server_", "._", "access", "IP", "v4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "list_", "._", "extend_", "(_", "private_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "list_", "._", "extend_", "(_", "public_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "address", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "access", "\\u", "ip_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Append", " ", "group", " ", "to", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "server_", "._", "access", "IP", "v4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "access", "\\u", "ip_", "=_", "server_", "._", "access", "IP", "v4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "access", "\\u", "ip_", ")_", "and_", "public_", "and_", "not_", "(_", "private_", "and_", "prefer", "\\u", "private_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "access", "\\u", "ip_", "=_", "public_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "private_", "and_", "not_", "access", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "access", "\\u", "ip_", "=_", "private_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "access", "\\u", "ip_", "\\u\\u\\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", "metadata_", "(_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "dictionar", "y", " ", "of", " ", "all", " ", "host", " ", "metadata", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "ips_", "(_", "server_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "vars_", "(_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "server_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "sanitized", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "'", "os", "\\u'_", "+_", "re_", "._", "sub_", "(_", "r", "\"[", "^", "A", "-", "Za", "-", "z", "0", "-", "9", "\\\\-]", "\"_", ",_", "\"\\u\"_", ",_", "key_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Att", " ", "value", " ", "to", " ", "instance", " ", "result", " ", "(", "exclu", "de", " ", "manage", "r", " ", "class", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "may", "be", " ", "use", " ", "value", ".\\u", "\\u", "class", "\\u\\u", " ", "or", " ", "similar", " ", "insi", "de", " ", "of", " ", "key", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "key_", "!=_", "'", "os", "\\u", "manage", "r", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ReactiveX/RxPY/rx/concurrency/mainloopscheduler/ioloopscheduler.py
[ { "content": " def schedule(self, action, state=None):\n \"\"\"Schedules an action to be executed.\"\"\"\n\n scheduler = self\n disposable = SingleAssignmentDisposable()\n disposed = [False]\n\n def interval():\n if not disposed[0]:\n disposable.disposable = action(scheduler, state)\n\n self.loop.add_callback(interval)\n\n def dispose():\n # nonlocal\n disposed[0] = True\n\n return CompositeDisposable(disposable, Disposable(dispose))", "metadata": "root.IOLoopScheduler.schedule", "header": "['class', 'IOLoopScheduler', '(', 'Scheduler', ')', ':', '___EOS___']", "index": 18 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "IO", "Loop", "Scheduler_", "(_", "Scheduler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "schedule_", "(_", "self_", ",_", "action_", ",_", "state_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Schedule", "s", " ", "an", " ", "action", " ", "to", " ", "be", " ", "executed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scheduler_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispo", "sab", "le_", "=_", "Sing", "le", "Assign", "ment", "Dispo", "sab", "le_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "[_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "interval_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "dispose", "d_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dispo", "sab", "le_", "._", "dispo", "sab", "le_", "=_", "action_", "(_", "scheduler_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "loop_", "._", "add", "\\u", "callback_", "(_", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dispose", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "nonlocal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dispose", "d_", "[_", "0_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Composit", "e", "Dispo", "sab", "le_", "(_", "dispo", "sab", "le_", ",_", "Dispo", "sab", "le_", "(_", "dispose", "_", ")_", ")_", "\\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 ]
Unused import
saltstack/salt/tests/unit/grains/core_test.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Erik Johnson <erik@saltstack.com>`\n'''\n\n# Import Python libs\nfrom __future__ import absolute_import\nimport os\nimport platform\n\n# Import Salt Testing Libs\nfrom salttesting import TestCase, skipIf\nfrom salttesting.helpers import ensure_in_syspath\nfrom salttesting.mock import (\n MagicMock,\n patch,\n NO_MOCK,\n NO_MOCK_REASON\n)\n\nensure_in_syspath('../../')\n\n# Import Salt Libs\nimport salt.utils\nfrom salt.grains import core\n\n# Globals\ncore.__salt__ = {}\n\n\n\n\nif __name__ == '__main__':\n from integration import run_tests\n run_tests(CoreGrainsTestCase, needs_daemon=False)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@skipIf(NO_MOCK, NO_MOCK_REASON)\nclass CoreGrainsTestCase(TestCase):\n '''\n Test cases for core grains\n '''", "metadata": "root.CoreGrainsTestCase", "header": "['module', '___EOS___']", "index": 30 }, { "content": " @skipIf(not salt.utils.is_linux(), 'System is not Linux')\n def test_gnu_slash_linux_in_os_name(self):\n '''\n Test to return a list of all enabled services\n '''\n _path_exists_map = {\n '/proc/1/cmdline': False\n }\n _path_isfile_map = {}\n _cmd_run_map = {\n 'dpkg --print-architecture': 'amd64'\n }\n\n path_exists_mock = MagicMock(side_effect=lambda x: _path_exists_map[x])\n path_isfile_mock = MagicMock(\n side_effect=lambda x: _path_isfile_map.get(x, False)\n )\n cmd_run_mock = MagicMock(\n side_effect=lambda x: _cmd_run_map[x]\n )\n empty_mock = MagicMock(return_value={})\n\n orig_import = __import__\n\n def _import_mock(name, *args):\n if name == 'lsb_release':\n raise ImportError('No module named lsb_release')\n return orig_import(name, *args)\n\n # Skip the first if statement\n with patch.object(salt.utils, 'is_proxy',\n MagicMock(return_value=False)):\n # Skip the selinux/systemd stuff (not pertinent)\n with patch.object(core, '_linux_bin_exists',\n MagicMock(return_value=False)):\n # Skip the init grain compilation (not pertinent)\n with patch.object(os.path, 'exists', path_exists_mock):\n # Ensure that lsb_release fails to import\n with patch('__builtin__.__import__',\n side_effect=_import_mock):\n # Skip all the /etc/*-release stuff (not pertinent)\n with patch.object(os.path, 'isfile', path_isfile_mock):\n # Mock platform.linux_distribution to give us the\n # OS name that we want.\n distro_mock = MagicMock(\n return_value=('Debian GNU/Linux', '8.3', '')\n )\n with patch.object(\n platform,\n 'linux_distribution',\n distro_mock):\n # Make a bunch of functions return empty dicts,\n # we don't care about these grains for the\n # purposes of this test.\n with patch.object(\n core,\n '_linux_cpudata',\n empty_mock):\n with patch.object(\n core,\n '_linux_gpu_data',\n empty_mock):\n with patch.object(\n core,\n '_memdata',\n empty_mock):\n with patch.object(\n core,\n '_hw_data',\n empty_mock):\n with patch.object(\n core,\n '_virtual',\n empty_mock):\n with patch.object(\n core,\n '_ps',\n empty_mock):\n # Mock the osarch\n with patch.dict(\n core.__salt__,\n {'cmd.run': cmd_run_mock}):\n os_grains = core.os_data()\n\n self.assertEqual(os_grains.get('os_family'), 'Debian')", "metadata": "root.CoreGrainsTestCase.test_gnu_slash_linux_in_os_name", "header": "['class', 'CoreGrainsTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 35 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", ":", "code", "author", ":", " ", ":", "email", ":`", "Eri", "k", " ", "Joh", "nso", "n", " ", "<", "eri", "k", "@", "salt", "stack", ".", "com", ">`", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Pyth", "on", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Sal", "t", " ", "Test", "ing", " ", "Lib", "s_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "salt", "testing_", "import_", "Test", "Case_", ",_", "skip", "If_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt", "testing_", "._", "helpers_", "import_", "ensure", "\\u", "in", "\\u", "sysp", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt", "testing_", "._", "mock_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Mag", "ic", "Mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "patch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NO", "\\u", "MOC", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NO", "\\u", "MOC", "K", "\\u", "REASON", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ensure", "\\u", "in", "\\u", "sysp", "ath_", "(_", "'../../", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Sal", "t", " ", "Lib", "s_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "salt_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt_", "._", "grains", "_", "import_", "core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "core_", "._", "\\u\\u", "salt\\u\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "from_", "integration_", "import_", "run", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "tests_", "(_", "Core", "Gra", "ins", "Test", "Case_", ",_", "need", "s", "\\u", "daemon_", "=_", "False_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "skip", "If_", "(_", "NO", "\\u", "MOC", "K_", ",_", "NO", "\\u", "MOC", "K", "\\u", "REASON", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Core", "Gra", "ins", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "case", "s", " ", "for", " ", "core", " ", "grains", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "Gra", "ins", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "skip", "If_", "(_", "not_", "salt_", "._", "utils_", "._", "is", "\\u", "linux_", "(_", ")_", ",_", "'", "System", " ", "is", " ", "not", " ", "Lin", "ux", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "gnu", "\\u", "slash", "\\u", "linux", "\\u", "in", "\\u", "os", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "to", " ", "return", " ", "a", " ", "list", " ", "of", " ", "all", " ", "enable", "d", " ", "service", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "path", "\\u", "exist", "s", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "proc", "/", "1", "/", "cmdli", "ne", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "path", "\\u", "isfi", "le", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "cmd", "\\u", "run", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dpkg", " ", "--", "print", "-", "architecture", "'_", ":_", "'", "am", "d6", "4", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path", "\\u", "exist", "s", "\\u", "mock_", "=_", "Mag", "ic", "Mock_", "(_", "side", "\\u", "effect_", "=_", "lambda_", "x_", ":_", "\\u", "path", "\\u", "exist", "s", "\\u", "map_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "isfi", "le", "\\u", "mock_", "=_", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "side", "\\u", "effect_", "=_", "lambda_", "x_", ":_", "\\u", "path", "\\u", "isfi", "le", "\\u", "map_", "._", "get_", "(_", "x_", ",_", "False_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "run", "\\u", "mock_", "=_", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "side", "\\u", "effect_", "=_", "lambda_", "x_", ":_", "\\u", "cmd", "\\u", "run", "\\u", "map_", "[_", "x_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty", "\\u", "mock_", "=_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "\\u", "import_", "=_", "\\u\\u", "import\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "import", "\\u", "mock_", "(_", "name_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "'", "lsb", "\\u", "release", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Import", "Error_", "(_", "'", "No", " ", "module", " ", "named", " ", "lsb", "\\u", "release", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "orig", "\\u", "import_", "(_", "name_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ski", "p", " ", "the", " ", "first", " ", "if", " ", "statement_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "salt_", "._", "utils_", ",_", "'", "is", "\\u", "proxy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "the", " ", "selinux", "/", "system", "d", " ", "stu", "ff", " ", "(", "not", " ", "pert", "inen", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "patch_", "._", "object_", "(_", "core_", ",_", "'\\u", "linux", "\\u", "bin", "\\u", "exist", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "the", " ", "init", " ", "grain", " ", "compilation", " ", "(", "not", " ", "pert", "inen", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "patch_", "._", "object_", "(_", "os_", "._", "path_", ",_", "'", "exist", "s", "'_", ",_", "path", "\\u", "exist", "s", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "lsb", "\\u", "release", " ", "fail", "s", " ", "to", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "with_", "patch_", "(_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u", ".\\u", "\\u", "import", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side", "\\u", "effect_", "=_", "\\u", "import", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "all", " ", "the", " ", "/", "etc", "/*", "-", "release", " ", "stu", "ff", " ", "(", "not", " ", "pert", "inen", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "with_", "patch_", "._", "object_", "(_", "os_", "._", "path_", ",_", "'", "isfi", "le", "'_", ",_", "path", "\\u", "isfi", "le", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Moc", "k", " ", "platform", ".", "linux", "\\u", "distribu", "tion", " ", "to", " ", "give", " ", "us", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OS", " ", "name", " ", "tha", "t", " ", "we", " ", "want", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "distr", "o", "\\u", "mock_", "=_", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "(_", "'", "Deb", "ian", " ", "GN", "U", "/", "Lin", "ux", "'_", ",_", "'", "8.3", "'_", ",_", "''_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "linux", "\\u", "distribu", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distr", "o", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "bunch", " ", "of", " ", "function", "s", " ", "return", " ", "empty", " ", "dict", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "care", " ", "abo", "ut", " ", "these", " ", "grains", " ", "for", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "purpose", "s", " ", "of", " ", "this", " ", "test", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "with_", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "core_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "linux", "\\u", "cpu", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "with_", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "core_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "linux", "\\u", "gpu", "\\u", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "with_", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "core_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "mem", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "with_", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "core_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "hw", "\\u", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "with_", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "core_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "virtual", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "with_", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "core_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "ps", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Moc", "k", " ", "the", " ", "osa", "rch", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "with_", "patch_", "._", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "core_", "._", "\\u\\u", "salt\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "cmd", ".", "run", "'_", ":_", "cmd", "\\u", "run", "\\u", "mock_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " ", " _", "os", "\\u", "grains", "_", "=_", "core_", "._", "os", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "os", "\\u", "grains", "_", "._", "get_", "(_", "'", "os", "\\u", "famil", "y", "'_", ")_", ",_", "'", "Deb", "ian", "'_", ")_", "\\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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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 ]
Unused import
PyHDI/veriloggen/tests/extension/seq_/hook/seq_hook.py
[ { "content": "from __future__ import absolute_import\nfrom __future__ import print_function\nimport sys\nimport os\n\n# the next line can be removed after installation\nsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))))\n\nfrom veriloggen import *\n\n\nif __name__ == '__main__':\n led = mkLed()\n # to_verilog() method is immuatable.\n # Hooked methods are called for the copied object to keep the internal state.\n dummy = led.to_verilog()\n verilog = led.to_verilog()\n print(verilog)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def mkLed():\n m = Module('blinkled')\n width = m.Parameter('WIDTH', 8)\n clk = m.Input('CLK')\n rst = m.Input('RST')\n led = m.OutputReg('LED', width, initval=0)\n count = m.Reg('count', 32, initval=0)\n \n seq = Seq(m, 'seq', clk, rst)\n\n seq.add( count.inc(), cond=(count<1024-1) )\n seq.add( count(0), cond=(count>=1024-1) )\n seq.add( led.inc(), cond=(count>=1024-1) ) \n \n #seq.make_always()\n # make_alway() is called when to_veirlog() is called.\n m.add_hook(seq.make_always, args=(), kwargs={})\n \n return m", "metadata": "root.mkLed", "header": "['module', '___EOS___']", "index": 10 } ]
[]
[]
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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "next", " ", "line", " ", "can", " ", "be", " ", "remove", "d", " ", "after", " ", "installation", "_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "veri", "logg", "en_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "led_", "=_", "mk", "Led", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "to", "\\u", "veri", "log", "()", " ", "method", " ", "is", " ", "imm", "uat", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hook", "ed", " ", "method", "s", " ", "are", " ", "call", "ed", " ", "for", " ", "the", " ", "copie", "d", " ", "object", " ", "to", " ", "keep", " ", "the", " ", "internal", " ", "state", "._", "\\u\\u\\uNL\\u\\u\\u_", "dummy_", "=_", "led_", "._", "to", "\\u", "veri", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "veri", "log_", "=_", "led_", "._", "to", "\\u", "veri", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "veri", "log_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mk", "Led", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "Module_", "(_", "'", "blink", "led", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "m_", "._", "Parameter_", "(_", "'", "WID", "TH", "'_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clk_", "=_", "m_", "._", "Input_", "(_", "'", "CLK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rst_", "=_", "m_", "._", "Input_", "(_", "'", "RST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "led_", "=_", "m_", "._", "Output", "Reg_", "(_", "'", "LED", "'_", ",_", "width_", ",_", "init", "val_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "m_", "._", "Reg_", "(_", "'", "count", "'_", ",_", "32_", ",_", "init", "val_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seq_", "=_", "Seq_", "(_", "m_", ",_", "'", "seq", "'_", ",_", "clk_", ",_", "rst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seq_", "._", "add_", "(_", "count_", "._", "inc_", "(_", ")_", ",_", "cond_", "=_", "(_", "count_", "<_", "1024_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "._", "add_", "(_", "count_", "(_", "0_", ")_", ",_", "cond_", "=_", "(_", "count_", ">=_", "1024_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "._", "add_", "(_", "led_", "._", "inc_", "(_", ")_", ",_", "cond_", "=_", "(_", "count_", ">=_", "1024_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "seq", ".", "make", "\\u", "alw", "ay", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", "\\u", "alw", "ay", "()", " ", "is", " ", "call", "ed", " ", "whe", "n", " ", "to", "\\u", "vei", "rlo", "g", "()", " ", "is", " ", "call", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "add", "\\u", "hook_", "(_", "seq_", "._", "make", "\\u", "alw", "ays_", ",_", "args_", "=_", "(_", ")_", ",_", "kwargs_", "=_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unused local variable
django-bmf/django-bmf/djangobmf/contrib/position/tests.py
[ { "content": " def test_cleans(self):\n \"\"\"\n \"\"\"", "metadata": "root.PositionModuleTests.test_cleans", "header": "['class', 'PositionModuleTests', '(', 'ModuleMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 67 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Position", "Modul", "e", "Tests_", "(_", "Modul", "e", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clean", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
adieu/django-nonrel/django/forms/fields.py
[ { "content": " def __init__(self, path, match=None, recursive=False, required=True,\n widget=None, label=None, initial=None, help_text=None,\n *args, **kwargs):\n self.path, self.match, self.recursive = path, match, recursive\n super(FilePathField, self).__init__(choices=(), required=required,\n widget=widget, label=label, initial=initial, help_text=help_text,\n *args, **kwargs)\n\n if self.required:\n self.choices = []\n else:\n self.choices = [(\"\", \"---------\")]\n\n if self.match is not None:\n self.match_re = re.compile(self.match)\n\n if recursive:\n for root, dirs, files in sorted(os.walk(self.path)):\n for f in files:\n if self.match is None or self.match_re.search(f):\n f = os.path.join(root, f)\n self.choices.append((f, f.replace(path, \"\", 1)))\n else:\n try:\n for f in sorted(os.listdir(self.path)):\n full_file = os.path.join(self.path, f)\n if os.path.isfile(full_file) and (self.match is None or self.match_re.search(f)):\n self.choices.append((full_file, f))\n except OSError:\n pass\n\n self.widget.choices = self.choices", "metadata": "root.FilePathField.__init__", "header": "['class', 'FilePathField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 880 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "File", "Path", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\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_", ",_", "path_", ",_", "match_", "=_", "None_", ",_", "recursive_", "=_", "False_", ",_", "required_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "initial_", "=_", "None_", ",_", "help", "\\u", "text_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", ",_", "self_", "._", "match_", ",_", "self_", "._", "recursive_", "=_", "path_", ",_", "match_", ",_", "recursive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "File", "Path", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "choices_", "=_", "(_", ")_", ",_", "required_", "=_", "required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "widget_", ",_", "label_", "=_", "label_", ",_", "initial_", "=_", "initial_", ",_", "help", "\\u", "text_", "=_", "help", "\\u", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "choices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "choices_", "=_", "[_", "(_", "\"\"_", ",_", "\"-------", "--\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "match", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "self_", "._", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "recursive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "root_", ",_", "dirs_", ",_", "files_", "in_", "sorted_", "(_", "os_", "._", "walk_", "(_", "self_", "._", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "choices_", "._", "append_", "(_", "(_", "f_", ",_", "f_", "._", "replace_", "(_", "path_", ",_", "\"\"_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "sorted_", "(_", "os_", "._", "listdir_", "(_", "self_", "._", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "full", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "full", "\\u", "file_", ")_", "and_", "(_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "choices_", "._", "append_", "(_", "(_", "full", "\\u", "file_", ",_", "f_", ")_", ")_", "\\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_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "widget_", "._", "choices_", "=_", "self_", "._", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pantsbuild/pants/src/python/pants/core_tasks/deferred_sources_mapper.py
[ { "content": "# coding=utf-8\n# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import (absolute_import, division, generators, nested_scopes, print_function,\n unicode_literals, with_statement)\n\nimport logging\n\nfrom pants.build_graph.address_lookup_error import AddressLookupError\nfrom pants.source.payload_fields import DeferredSourcesField\nfrom pants.task.task import Task\n\n\nlogger = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DeferredSourcesMapper(Task):\n \"\"\"Map DeferredSourcesFields to files that produce the product 'unpacked_archives'.\n\n If you want a task to be able to map sources like this, make it require the 'deferred_sources'\n product.\n \"\"\"\n\n class SourcesTargetLookupError(AddressLookupError):\n \"\"\"Raised when the referenced target cannot be found in the build graph\"\"\"\n pass\n\n class NoUnpackedSourcesError(AddressLookupError):\n \"\"\"Raised when there are no files found unpacked from the archive\"\"\"\n pass\n\n\n", "metadata": "root.DeferredSourcesMapper", "header": "['module', '___EOS___']", "index": 17 }, { "content": " @classmethod\n def product_types(cls):\n \"\"\"\n Declare product produced by this task\n\n deferred_sources does not have any data associated with it. Downstream tasks can\n depend on it just make sure that this task completes first.\n :return:\n \"\"\"\n return ['deferred_sources']", "metadata": "root.DeferredSourcesMapper.product_types", "header": "['class', 'DeferredSourcesMapper', '(', 'Task', ')', ':', '___EOS___']", "index": 32 }, { "content": " @classmethod\n def prepare(cls, options, round_manager):\n round_manager.require_data('unpacked_archives')", "metadata": "root.DeferredSourcesMapper.prepare", "header": "['class', 'DeferredSourcesMapper', '(', 'Task', ')', ':', '___EOS___']", "index": 43 }, { "content": " def execute(self):\n deferred_sources_fields = []\n def find_deferred_sources_fields(target):\n for name, payload_field in target.payload.fields:\n if isinstance(payload_field, DeferredSourcesField):\n deferred_sources_fields.append((target, name, payload_field))\n addresses = [target.address for target in self.context.targets()]\n self.context.build_graph.walk_transitive_dependency_graph(addresses,\n find_deferred_sources_fields)\n\n unpacked_sources = self.context.products.get_data('unpacked_archives')\n for (target, name, payload_field) in deferred_sources_fields:\n sources_target = self.context.build_graph.get_target(payload_field.address)\n if not sources_target:\n raise self.SourcesTargetLookupError(\n \"Couldn't find {sources_spec} referenced from {target} field {name} in build graph\"\n .format(sources_spec=payload_field.address.spec, target=target.address.spec, name=name))\n if not sources_target in unpacked_sources:\n raise self.NoUnpackedSourcesError(\n \"Target {sources_spec} referenced from {target} field {name} did not unpack any sources\"\n .format(spec=sources_target.address.spec, target=target.address.spec, name=name))\n sources, rel_unpack_dir = unpacked_sources[sources_target]\n # We have no idea if rel_unpack_dir matches any of our source root patterns, so\n # we explicitly register it here.\n self.context.source_roots.add_source_root(rel_unpack_dir)\n payload_field.populate(sources, rel_unpack_dir)", "metadata": "root.DeferredSourcesMapper.execute", "header": "['class', 'DeferredSourcesMapper', '(', 'Task', ')', ':', '___EOS___']", "index": 47 } ]
[]
[]
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", " ", "2014", " ", "Pant", "s", " ", "project", " ", "contributor", "s", " ", "(", "see", " ", "CONTRIB", "UTO", "RS", ".", "md", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "see", " ", "LICENSE", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "(_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "generators_", ",_", "nest", "ed", "\\u", "scopes_", ",_", "print", "\\u", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode", "\\u", "literals_", ",_", "with", "\\u", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pants_", "._", "build", "\\u", "graph_", "._", "address", "\\u", "look", "up", "\\u", "error_", "import_", "Address", "Look", "up", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pants_", "._", "source_", "._", "payload", "\\u", "fields_", "import_", "Defe", "rre", "d", "Sou", "rce", "s", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pants_", "._", "task_", "._", "task_", "import_", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Defe", "rre", "d", "Sou", "rce", "s", "Mapper_", "(_", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Map", " ", "Defe", "rre", "d", "Sou", "rce", "s", "Field", "s", " ", "to", " ", "files", " ", "tha", "t", " ", "produce", " ", "the", " ", "product", " ", "'", "unpacked", "\\u", "archives", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "you", " ", "want", " ", "a", " ", "task", " ", "to", " ", "be", " ", "able", " ", "to", " ", "map", " ", "source", "s", " ", "like", " ", "this", ",", " ", "make", " ", "it", " ", "require", " ", "the", " ", "'", "defer", "red", "\\u", "source", "s", "'", "\\", "10", ";", " ", " ", "product", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Sou", "rce", "s", "Target", "Look", "up", "Error_", "(_", "Address", "Look", "up", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Rai", "sed", " ", "whe", "n", " ", "the", " ", "referenced", " ", "target", " ", "cann", "ot", " ", "be", " ", "found", " ", "in", " ", "the", " ", "build", " ", "graph", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "No", "Unpack", "ed", "Sou", "rce", "s", "Error_", "(_", "Address", "Look", "up", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Rai", "sed", " ", "whe", "n", " ", "there", " ", "are", " ", "no", " ", "files", " ", "found", " ", "unpacked", " ", "from", " ", "the", " ", "archive", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Defe", "rre", "d", "Sou", "rce", "s", "Mapper_", "(_", "Task_", ")_", ":_", "\\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_", "product", "\\u", "types_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Declar", "e", " ", "product", " ", "produce", "d", " ", "by", " ", "this", " ", "task", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "defer", "red", "\\u", "source", "s", " ", "doe", "s", " ", "not", " ", "have", " ", "any", " ", "data", " ", "associate", "d", " ", "with", " ", "it", ".", " ", "Down", "stream", " ", "task", "s", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "depend", " ", "on", " ", "it", " ", "just", " ", "make", " ", "sure", " ", "tha", "t", " ", "this", " ", "task", " ", "complete", "s", " ", "first", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "'", "defer", "red", "\\u", "source", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Defe", "rre", "d", "Sou", "rce", "s", "Mapper_", "(_", "Task_", ")_", ":_", "\\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_", "prepare_", "(_", "cls_", ",_", "options_", ",_", "round", "\\u", "manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "round", "\\u", "manager_", "._", "require", "\\u", "data_", "(_", "'", "unpacked", "\\u", "archives", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Defe", "rre", "d", "Sou", "rce", "s", "Mapper_", "(_", "Task_", ")_", ":_", "\\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 ", " _", "defer", "red", "\\u", "source", "s", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "defer", "red", "\\u", "source", "s", "\\u", "fields_", "(_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "payload", "\\u", "field_", "in_", "target_", "._", "payload_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "payload", "\\u", "field_", ",_", "Defe", "rre", "d", "Sou", "rce", "s", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defer", "red", "\\u", "source", "s", "\\u", "fields_", "._", "append_", "(_", "(_", "target_", ",_", "name_", ",_", "payload", "\\u", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "addresses_", "=_", "[_", "target_", "._", "address_", "for_", "target_", "in_", "self_", "._", "context_", "._", "targets_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "._", "build", "\\u", "graph_", "._", "walk", "\\u", "transiti", "ve", "\\u", "dependen", "cy", "\\u", "graph_", "(_", "addresses_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "find", "\\u", "defer", "red", "\\u", "source", "s", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unpacked", "\\u", "sources_", "=_", "self_", "._", "context_", "._", "products_", "._", "get", "\\u", "data_", "(_", "'", "unpacked", "\\u", "archives", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "target_", ",_", "name_", ",_", "payload", "\\u", "field_", ")_", "in_", "defer", "red", "\\u", "source", "s", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "s", "\\u", "target_", "=_", "self_", "._", "context_", "._", "build", "\\u", "graph_", "._", "get", "\\u", "target_", "(_", "payload", "\\u", "field_", "._", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "source", "s", "\\u", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "Sou", "rce", "s", "Target", "Look", "up", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", "n", "'", "t", " ", "find", " ", "{", "source", "s", "\\u", "spec", "}", " ", "referenced", " ", "from", " ", "{", "target", "}", " ", "field", " ", "{", "name", "}", " ", "in", " ", "build", " ", "graph", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "source", "s", "\\u", "spec_", "=_", "payload", "\\u", "field_", "._", "address_", "._", "spec_", ",_", "target_", "=_", "target_", "._", "address_", "._", "spec_", ",_", "name_", "=_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "source", "s", "\\u", "target_", "in_", "unpacked", "\\u", "sources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "No", "Unpack", "ed", "Sou", "rce", "s", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Target", " ", "{", "source", "s", "\\u", "spec", "}", " ", "referenced", " ", "from", " ", "{", "target", "}", " ", "field", " ", "{", "name", "}", " ", "did", " ", "not", " ", "unpack", " ", "any", " ", "source", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "spec_", "=_", "source", "s", "\\u", "target_", "._", "address_", "._", "spec_", ",_", "target_", "=_", "target_", "._", "address_", "._", "spec_", ",_", "name_", "=_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sources_", ",_", "rel", "\\u", "unpack", "\\u", "dir_", "=_", "unpacked", "\\u", "sources_", "[_", "source", "s", "\\u", "target_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "no", " ", "idea", " ", "if", " ", "rel", "\\u", "unpack", "\\u", "dir", " ", "matche", "s", " ", "any", " ", "of", " ", "our", " ", "source", " ", "root", " ", "pattern", "s", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "explicit", "ly", " ", "register", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", "._", "source", "\\u", "roots_", "._", "add", "\\u", "source", "\\u", "root_", "(_", "rel", "\\u", "unpack", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload", "\\u", "field_", "._", "populate_", "(_", "sources_", ",_", "rel", "\\u", "unpack", "\\u", "dir_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Unused import
skoczen/django-seo-js/django_seo_js/backends/prerender.py
[ { "content": "from django_seo_js import settings\nfrom base import SEOBackendBase, RequestsBasedBackend\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PrerenderIO(SEOBackendBase, RequestsBasedBackend):\n \"\"\"Implements the backend for prerender.io\"\"\"\n BASE_URL = \"https://service.prerender.io/\"\n RECACHE_URL = \"https://api.prerender.io/recache\"\n\n\n\n", "metadata": "root.PrerenderIO", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def __init__(self, *args, **kwargs):\n super(SEOBackendBase, self).__init__(*args, **kwargs)\n self.token = self._get_token()", "metadata": "root.PrerenderIO.__init__", "header": "['class', 'PrerenderIO', '(', 'SEOBackendBase', ',', 'RequestsBasedBackend', ')', ':', '___EOS___']", "index": 9 }, { "content": " def _get_token(self):\n if settings.PRERENDER_TOKEN is None:\n raise ValueError(\"Missing SEO_JS_PRERENDER_TOKEN in settings.\")\n return settings.PRERENDER_TOKEN", "metadata": "root.PrerenderIO._get_token", "header": "['class', 'PrerenderIO', '(', 'SEOBackendBase', ',', 'RequestsBasedBackend', ')', ':', '___EOS___']", "index": 13 }, { "content": " def get_response_for_url(self, url):\n \"\"\"\n Accepts a fully-qualified url.\n Returns an HttpResponse, passing through all headers and the status code.\n \"\"\"\n\n if not url or \"//\" not in url:\n raise ValueError(\"Missing or invalid url: %s\" % url)\n\n render_url = self.BASE_URL + url\n headers = {\n 'X-Prerender-Token': self.token,\n }\n r = self.session.get(render_url, headers=headers, allow_redirects=False)\n assert r.status_code < 500\n\n return self.build_django_response_from_requests_response(r)", "metadata": "root.PrerenderIO.get_response_for_url", "header": "['class', 'PrerenderIO', '(', 'SEOBackendBase', ',', 'RequestsBasedBackend', ')', ':', '___EOS___']", "index": 18 }, { "content": " def update_url(self, url=None, regex=None):\n \"\"\"\n Accepts a fully-qualified url, or regex.\n Returns True if successful, False if not successful.\n \"\"\"\n\n if not url and not regex:\n raise ValueError(\"Neither a url or regex was provided to update_url.\")\n\n headers = {\n 'X-Prerender-Token': self.token,\n 'Content-Type': 'application/json',\n }\n data = {\n 'prerenderToken': settings.PRERENDER_TOKEN,\n }\n if url:\n data[\"url\"] = url\n if regex:\n data[\"regex\"] = regex\n\n r = self.session.post(self.RECACHE_URL, headers=headers, data=data)\n return r.status_code < 500", "metadata": "root.PrerenderIO.update_url", "header": "['class', 'PrerenderIO', '(', 'SEOBackendBase', ',', 'RequestsBasedBackend', ')', ':', '___EOS___']", "index": 36 }, { "content": "class PrerenderHosted(PrerenderIO):\n \"\"\"Implements the backend for an arbitrary prerender service\n specified in settings.SEO_JS_PRERENDER_URL\"\"\"\n\n\n", "metadata": "root.PrerenderHosted", "header": "['module', '___EOS___']", "index": 61 }, { "content": " def __init__(self, *args, **kwargs):\n super(SEOBackendBase, self).__init__(*args, **kwargs)\n self.token = \"\"\n if not settings.PRERENDER_URL:\n raise ValueError(\"Missing SEO_JS_PRERENDER_URL in settings.\")\n if not settings.PRERENDER_RECACHE_URL:\n raise ValueError(\"Missing SEO_JS_PRERENDER_RECACHE_URL in settings.\")\n\n self.BASE_URL = settings.PRERENDER_URL\n self.RECACHE_URL = settings.PRERENDER_RECACHE_URL", "metadata": "root.PrerenderHosted.__init__", "header": "['class', 'PrerenderHosted', '(', 'PrerenderIO', ')', ':', '___EOS___']", "index": 65 }, { "content": " def _get_token(self):\n pass", "metadata": "root.PrerenderHosted._get_token", "header": "['class', 'PrerenderHosted', '(', 'PrerenderIO', ')', ':', '___EOS___']", "index": 76 }, { "content": " def update_url(self, url=None):\n \"\"\"\n Accepts a fully-qualified url.\n Returns True if successful, False if not successful.\n \"\"\"\n if not url:\n raise ValueError(\"Neither a url or regex was provided to update_url.\")\n post_url = \"%s%s\" % (self.BASE_URL, url)\n r = self.session.post(post_url)\n return int(r.status_code) < 500", "metadata": "root.PrerenderHosted.update_url", "header": "['class', 'PrerenderHosted', '(', 'PrerenderIO', ')', ':', '___EOS___']", "index": 79 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django", "\\u", "se", "o", "\\u", "js_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "base_", "import_", "SE", "OB", "acke", "nd", "Base_", ",_", "Request", "s", "Base", "d", "Backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Pre", "render", "IO_", "(_", "SE", "OB", "acke", "nd", "Base_", ",_", "Request", "s", "Base", "d", "Backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Impl", "ement", "s", " ", "the", " ", "back", "end", " ", "for", " ", "prere", "nder", ".", "io", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "URL_", "=_", "\"", "https", "://", "service", ".", "prere", "nder", ".", "io", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECA", "CHE", "\\u", "URL_", "=_", "\"", "https", "://", "api", ".", "prere", "nder", ".", "io", "/", "reca", "che", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Pre", "render", "IO_", "(_", "SE", "OB", "acke", "nd", "Base_", ",_", "Request", "s", "Base", "d", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "SE", "OB", "acke", "nd", "Base_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "token_", "=_", "self_", "._", "\\u", "get", "\\u", "token_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pre", "render", "IO_", "(_", "SE", "OB", "acke", "nd", "Base_", ",_", "Request", "s", "Base", "d", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "settings_", "._", "PRE", "RENDER", "\\u", "TOKEN_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Missing", " ", "SE", "O", "\\u", "JS", "\\u", "PRE", "RENDER", "\\u", "TOKEN", " ", "in", " ", "settings", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "settings_", "._", "PRE", "RENDER", "\\u", "TOKEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pre", "render", "IO_", "(_", "SE", "OB", "acke", "nd", "Base_", ",_", "Request", "s", "Base", "d", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "response", "\\u", "for", "\\u", "url_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Accept", "s", " ", "a", " ", "full", "y", "-", "qualified", " ", "url", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "Http", "Respons", "e", ",", " ", "passi", "ng", " ", "through", " ", "all", " ", "header", "s", " ", "and", " ", "the", " ", "status", " ", "code", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "url_", "or_", "\"//", "\"_", "not_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Missing", " ", "or", " ", "invalid", " ", "url", ":", " ", "%", "s", "\"_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "render", "\\u", "url_", "=_", "self_", "._", "BASE", "\\u", "URL_", "+_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Pre", "render", "-", "Token", "'_", ":_", "self_", "._", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "self_", "._", "session_", "._", "get_", "(_", "render", "\\u", "url_", ",_", "headers_", "=_", "headers_", ",_", "allow", "\\u", "redirects_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "._", "status", "\\u", "code_", "<_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "build", "\\u", "django", "\\u", "response", "\\u", "from", "\\u", "request", "s", "\\u", "response_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pre", "render", "IO_", "(_", "SE", "OB", "acke", "nd", "Base_", ",_", "Request", "s", "Base", "d", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "url_", "(_", "self_", ",_", "url_", "=_", "None_", ",_", "regex_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Accept", "s", " ", "a", " ", "full", "y", "-", "qualified", " ", "url", ",", " ", "or", " ", "regex", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "success", "ful", ",", " ", "Fal", "se", " ", "if", " ", "not", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "url_", "and_", "not_", "regex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Nei", "ther", " ", "a", " ", "url", " ", "or", " ", "regex", " ", "was", " ", "provided", " ", "to", " ", "update", "\\u", "url", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Pre", "render", "-", "Token", "'_", ":_", "self_", "._", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prere", "nder", "Token", "'_", ":_", "settings_", "._", "PRE", "RENDER", "\\u", "TOKEN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "\"", "url", "\"_", "]_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "regex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "\"", "regex", "\"_", "]_", "=_", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "=_", "self_", "._", "session_", "._", "post_", "(_", "self_", "._", "RECA", "CHE", "\\u", "URL_", ",_", "headers_", "=_", "headers_", ",_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "r_", "._", "status", "\\u", "code_", "<_", "500_", "\\u\\u\\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_", "Pre", "render", "Hoste", "d_", "(_", "Pre", "render", "IO_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Impl", "ement", "s", " ", "the", " ", "back", "end", " ", "for", " ", "an", " ", "arbitra", "ry", " ", "prere", "nder", " ", "service", "\\", "10", ";", " ", " ", " ", "specified", " ", "in", " ", "settings", ".", "SE", "O", "\\u", "JS", "\\u", "PRE", "RENDER", "\\u", "URL", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Pre", "render", "Hoste", "d_", "(_", "Pre", "render", "IO_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "SE", "OB", "acke", "nd", "Base_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "token_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "settings_", "._", "PRE", "RENDER", "\\u", "URL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Missing", " ", "SE", "O", "\\u", "JS", "\\u", "PRE", "RENDER", "\\u", "URL", " ", "in", " ", "settings", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "settings_", "._", "PRE", "RENDER", "\\u", "RECA", "CHE", "\\u", "URL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Missing", " ", "SE", "O", "\\u", "JS", "\\u", "PRE", "RENDER", "\\u", "RECA", "CHE", "\\u", "URL", " ", "in", " ", "settings", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "BASE", "\\u", "URL_", "=_", "settings_", "._", "PRE", "RENDER", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "RECA", "CHE", "\\u", "URL_", "=_", "settings_", "._", "PRE", "RENDER", "\\u", "RECA", "CHE", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pre", "render", "Hoste", "d_", "(_", "Pre", "render", "IO_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pre", "render", "Hoste", "d_", "(_", "Pre", "render", "IO_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "url_", "(_", "self_", ",_", "url_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Accept", "s", " ", "a", " ", "full", "y", "-", "qualified", " ", "url", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "success", "ful", ",", " ", "Fal", "se", " ", "if", " ", "not", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Nei", "ther", " ", "a", " ", "url", " ", "or", " ", "regex", " ", "was", " ", "provided", " ", "to", " ", "update", "\\u", "url", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "post", "\\u", "url_", "=_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "self_", "._", "BASE", "\\u", "URL_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "self_", "._", "session_", "._", "post_", "(_", "post", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "r_", "._", "status", "\\u", "code_", ")_", "<_", "500_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 4, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
realestate-com-au/harpoon/harpoon/dockerpty/pty.py
[ { "content": " def resize(self, size=None):\n \"\"\"\n Resize the container's PTY.\n\n If `size` is not None, it must be a tuple of (height,width), otherwise\n it will be determined by the size of the current TTY.\n \"\"\"\n\n if not self.israw():\n return\n\n size = size or tty.size(self.stdout)\n\n if size is not None:\n rows, cols = size\n try:\n self.client.resize(self.container, height=rows, width=cols)\n except IOError: # Container already exited\n pass", "metadata": "root.PseudoTerminal.resize", "header": "['class', 'PseudoTerminal', '(', 'object', ')', ':', '___EOS___']", "index": 201 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Pse", "udo", "Terminal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resize_", "(_", "self_", ",_", "size_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Resize", " ", "the", " ", "container", "'", "s", " ", "PT", "Y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "size", "`", " ", "is", " ", "not", " ", "Non", "e", ",", " ", "it", " ", "must", " ", "be", " ", "a", " ", "tuple", " ", "of", " ", "(", "height", ",", "widt", "h", "),", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "will", " ", "be", " ", "dete", "rmin", "ed", " ", "by", " ", "the", " ", "size", " ", "of", " ", "the", " ", "current", " ", "TTY", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "isr", "aw_", "(_", ")_", ":_", "\\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_", "size_", "=_", "size_", "or_", "tty_", "._", "size_", "(_", "self_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "size_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", ",_", "cols_", "=_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "client_", "._", "resize_", "(_", "self_", "._", "container_", ",_", "height_", "=_", "rows_", ",_", "width_", "=_", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "#", " ", "Containe", "r", " ", "alr", "ead", "y", " ", "exit", "ed_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
aldryn/aldryn-newsblog/aldryn_newsblog/south_migrations/0027_rename_plugins_to_include_appname.py
[ { "content": " def backwards(self, orm):\n rename_tables_new_to_old(db)\n\n # Renaming model 'TagsPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogtagsplugin', u'aldryn_newsblog_tagsplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogtagsplugin').update(model='tagsplugin')\n\n # Renaming model 'AuthorsPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogauthorsplugin', u'aldryn_newsblog_authorsplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogauthorsplugin').update(model='authorsplugin')\n\n # Renaming model 'CategoriesPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogcategoriesplugin', u'aldryn_newsblog_categoriesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogcategoriesplugin').update(model='categoriesplugin')\n\n # Renaming model 'FeaturedArticlesPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogfeaturedarticlesplugin', u'aldryn_newsblog_featuredarticlesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogfeaturedarticlesplugin').update(model='featuredarticlesplugin')\n\n # Rename latest_articles -> latest_entries\n db.rename_column('aldryn_newsblog_newsbloglatestarticlesplugin', 'latest_articles', 'latest_entries')\n # Renaming model 'LatestEntriesPlugin'\n db.rename_table(u'aldryn_newsblog_newsbloglatestarticlesplugin', u'aldryn_newsblog_latestentriesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsbloglatestarticlesplugin').update(model='latestentriesplugin')\n\n # Renaming model 'RelatedPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogrelatedplugin', u'aldryn_newsblog_relatedplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogrelatedplugin').update(model='relatedplugin')\n\n # Renaming model 'ArchivePlugin'\n db.rename_table(u'aldryn_newsblog_newsblogarchiveplugin', u'aldryn_newsblog_archiveplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogarchiveplugin').update(model='archiveplugin')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 57 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rename", "\\u", "tables", "\\u", "new", "\\u", "to", "\\u", "old_", "(_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Ta", "gs", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "tags", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "tags", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "tags", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "tags", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Author", "s", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "author", "splu", "gin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "author", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "author", "splu", "gin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "author", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Categori", "es", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "categor", "ies", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "categor", "ies", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "categor", "ies", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "categor", "ies", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Feature", "d", "Artic", "les", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rename", " ", "late", "st", "\\u", "article", "s", " ", "->", " ", "late", "st", "\\u", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "column_", "(_", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ",_", "'", "late", "st", "\\u", "article", "s", "'_", ",_", "'", "late", "st", "\\u", "entri", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Late", "st", "Entr", "ies", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "late", "sten", "trie", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "late", "sten", "trie", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Rela", "ted", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "relate", "dp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "relate", "dp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "relate", "dp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "relate", "dp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Archive", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "archive", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "archive", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "archive", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "archive", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
mogui/pyorient/pyorient/messages/connection.py
[ { "content": " @need_connected\n def prepare(self, params=None):\n\n if isinstance( params, tuple ) or isinstance( params, list ):\n try:\n self._user = params[0]\n self._pass = params[1]\n except IndexError:\n # Use default for non existent indexes\n pass\n self._append( (FIELD_STRINGS, [self._user, self._pass]) )\n return super( ShutdownMessage, self ).prepare()", "metadata": "root.ShutdownMessage.prepare", "header": "['class', 'ShutdownMessage', '(', 'BaseMessage', ')', ':', '___EOS___']", "index": 103 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Shut", "down", "Message_", "(_", "Base", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "need", "\\u", "connected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "prepare_", "(_", "self_", ",_", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "params_", ",_", "tuple_", ")_", "or_", "isinstance_", "(_", "params_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "user_", "=_", "params_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pass_", "=_", "params_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "default", " ", "for", " ", "non", " ", "existen", "t", " ", "indexes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "append_", "(_", "(_", "FIE", "LD", "\\u", "STRING", "S_", ",_", "[_", "self_", "._", "\\u", "user_", ",_", "self_", "._", "\\u", "pass_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Shut", "down", "Message_", ",_", "self_", ")_", "._", "prepare_", "(_", ")_", "\\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 ]
Testing equality to None
gratipay/gratipay.com/gratipay/security/authentication.py
[ { "content": "def add_auth_to_response(response, request=None, user=ANON):\n if request is None:\n return # early parsing must've failed\n if request.line.uri.startswith('/assets/'):\n return # assets never get auth headers\n\n if SESSION in request.headers.cookie:\n if not user.ANON:\n user.keep_signed_in(response.headers.cookie)", "metadata": "root.add_auth_to_response", "header": "['module', '___EOS___']", "index": 79 } ]
[]
[]
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_", "add", "\\u", "auth", "\\u", "to", "\\u", "response_", "(_", "response_", ",_", "request_", "=_", "None_", ",_", "user_", "=_", "ANON", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "#", " ", "ear", "ly", " ", "pars", "ing", " ", "must", "'", "ve", " ", "failed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "line_", "._", "uri_", "._", "startswith_", "(_", "'/", "asset", "s", "/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "#", " ", "asset", "s", " ", "neve", "r", " ", "get", " ", "auth", " ", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "SESSION_", "in_", "request_", "._", "headers_", "._", "cookie_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "user_", "._", "ANON", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "._", "keep", "\\u", "sign", "ed", "\\u", "in_", "(_", "response_", "._", "headers_", "._", "cookie_", ")_" ]
[ 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 ]
`__init__` method calls overridden method
open-cloud/xos/xos/core/admin.py
[ { "content": "class XOSTabularInline(admin.TabularInline):\n\n\n\n\n\n\n\n selflink.allow_tags = True\n selflink.short_description = \"Details\"\n\n\n\n backend_status_icon.short_description = \"\"", "metadata": "root.XOSTabularInline", "header": "['module', '___EOS___']", "index": 327 }, { "content": " def __init__(self, *args, **kwargs):\n super(XOSTabularInline, self).__init__(*args, **kwargs)\n\n # InlineModelAdmin as no get_fields() method, so in order to add\n # the selflink field, we override __init__ to modify self.fields and\n # self.readonly_fields.\n\n self.setup_selflink()", "metadata": "root.XOSTabularInline.__init__", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 329 }, { "content": " @property\n def selflink_model(self):\n if hasattr(self, \"selflink_fieldname\"):\n \"\"\" self.selflink_model can be defined to punch through a relation\n to its target object. For example, in SliceNetworkInline, set\n selflink_model = \"network\", and the URL will lead to the Network\n object instead of trying to bring up a change view of the\n SliceNetwork object.\n \"\"\"\n return getattr(self.model, self.selflink_fieldname).field.rel.to\n else:\n return self.model", "metadata": "root.XOSTabularInline.selflink_model", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 338 }, { "content": " @property\n def selflink_reverse_path(self):\n return \"admin:%s_change\" % (self.selflink_model._meta.db_table)", "metadata": "root.XOSTabularInline.selflink_reverse_path", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 351 }, { "content": " def get_change_url(self, id):\n \"\"\" Get the URL to a change form in the admin for this model \"\"\"\n reverse_path = self.selflink_reverse_path # \"admin:%s_change\" % (self.selflink_model._meta.db_table)\n try:\n url = reverse(reverse_path, args=(id,))\n except NoReverseMatch:\n return None\n\n return url", "metadata": "root.XOSTabularInline.get_change_url", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 355 }, { "content": " def setup_selflink(self):\n url = self.get_change_url(0)\n\n # We don't have an admin for this object, so don't create the\n # selflink.\n if (url == None):\n return\n\n # Since we need to add \"selflink\" to the field list, we need to create\n # self.fields if it is None.\n if (self.fields is None):\n self.fields = []\n for f in self.model._meta.fields:\n if f.editable and f.name != \"id\":\n self.fields.append(f.name)\n\n self.fields = tuple(self.fields) + (\"selflink\", )\n\n if self.readonly_fields is None:\n self.readonly_fields = ()\n\n self.readonly_fields = tuple(self.readonly_fields) + (\"selflink\", )", "metadata": "root.XOSTabularInline.setup_selflink", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 365 }, { "content": " def selflink(self, obj):\n if hasattr(self, \"selflink_fieldname\"):\n obj = getattr(obj, self.selflink_fieldname)\n\n if obj.id:\n url = self.get_change_url(obj.id)\n return \"<a href='%s'>Details</a>\" % str(url)\n else:\n return \"Not present\"", "metadata": "root.XOSTabularInline.selflink", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 388 }, { "content": " def has_add_permission(self, request):\n return not request.user.isReadOnlyUser()", "metadata": "root.XOSTabularInline.has_add_permission", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 401 }, { "content": " def get_readonly_fields(self, request, obj=None):\n readonly_fields = list(self.readonly_fields)[:]\n if request.user.isReadOnlyUser():\n for field in self.fields:\n if not field in readonly_fields:\n readonly_fields.append(field)\n return readonly_fields", "metadata": "root.XOSTabularInline.get_readonly_fields", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 404 }, { "content": " def backend_status_icon(self, obj):\n return mark_safe(backend_icon(obj))", "metadata": "root.XOSTabularInline.backend_status_icon", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 412 }, { "content": "class ReservationInline(XOSTabularInline):\n model = Reservation\n extra = 0\n suit_classes = 'suit-tab suit-tab-reservations'\n", "metadata": "root.ReservationInline", "header": "['module', '___EOS___']", "index": 435 }, { "content": " def queryset(self, request):\n return Reservation.select_by_user(request.user)", "metadata": "root.ReservationInline.queryset", "header": "['class', 'ReservationInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 440 }, { "content": "class InstanceInline(XOSTabularInline):\n model = Instance\n fields = ['backend_status_icon', 'all_ips_string', 'instance_id',\n 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node']\n extra = 0\n max_num = 0\n readonly_fields = ['backend_status_icon', 'all_ips_string', 'instance_id',\n 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node']\n suit_classes = 'suit-tab suit-tab-instances'\n\n", "metadata": "root.InstanceInline", "header": "['module', '___EOS___']", "index": 454 }, { "content": " def queryset(self, request):\n return Instance.select_by_user(request.user)", "metadata": "root.InstanceInline.queryset", "header": "['class', 'InstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 464 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n if db_field.name == 'deployment':\n kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(\n sitedeployments__nodes__isnull=False).distinct()\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_deployment_changed(this);\"})\n if db_field.name == 'flavor':\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_flavor_changed(this);\"})\n\n field = super(InstanceInline, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n return field", "metadata": "root.InstanceInline.formfield_for_foreignkey", "header": "['class', 'InstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 467 }, { "content": "class CordInstanceInline(XOSTabularInline):\n model = Instance\n fields = ['backend_status_icon', 'all_ips_string', 'instance_id',\n 'instance_name', 'slice', 'flavor', 'image', 'node']\n extra = 0\n readonly_fields = ['backend_status_icon',\n 'all_ips_string', 'instance_id', 'instance_name']\n suit_classes = 'suit-tab suit-tab-instances'\n\n", "metadata": "root.CordInstanceInline", "header": "['module', '___EOS___']", "index": 483 }, { "content": " def queryset(self, request):\n return Instance.select_by_user(request.user)", "metadata": "root.CordInstanceInline.queryset", "header": "['class', 'CordInstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 492 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n if db_field.name == 'deployment':\n\n kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(\n sitedeployments__nodes__isnull=False).distinct()\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_deployment_changed(this);\"})\n if db_field.name == 'flavor':\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_flavor_changed(this);\"})\n\n field = super(CordInstanceInline, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n return field", "metadata": "root.CordInstanceInline.formfield_for_foreignkey", "header": "['class', 'CordInstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 495 }, { "content": "class SiteInline(XOSTabularInline):\n model = Site\n extra = 0\n suit_classes = 'suit-tab suit-tab-sites'\n", "metadata": "root.SiteInline", "header": "['module', '___EOS___']", "index": 512 }, { "content": " def queryset(self, request):\n return Site.select_by_user(request.user)", "metadata": "root.SiteInline.queryset", "header": "['class', 'SiteInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 517 }, { "content": "class SiteHostsNodesInline(SiteInline):\n", "metadata": "root.SiteHostsNodesInline", "header": "['module', '___EOS___']", "index": 521 }, { "content": " def queryset(self, request):\n return Site.select_by_user(request.user).filter(hosts_nodes=True)", "metadata": "root.SiteHostsNodesInline.queryset", "header": "['class', 'SiteHostsNodesInline', '(', 'SiteInline', ')', ':', '___EOS___']", "index": 523 }, { "content": "class SiteHostsUsersInline(SiteInline):\n", "metadata": "root.SiteHostsUsersInline", "header": "['module', '___EOS___']", "index": 527 }, { "content": " def queryset(self, request):\n return Site.select_by_user(request.user).filter(hosts_users=True)", "metadata": "root.SiteHostsUsersInline.queryset", "header": "['class', 'SiteHostsUsersInline', '(', 'SiteInline', ')', ':', '___EOS___']", "index": 529 }, { "content": "class UserInline(XOSTabularInline):\n model = User\n fields = ['backend_status_icon', 'email', 'firstname', 'lastname']\n readonly_fields = ('backend_status_icon', )\n extra = 0\n suit_classes = 'suit-tab suit-tab-users'\n", "metadata": "root.UserInline", "header": "['module', '___EOS___']", "index": 533 }, { "content": " def queryset(self, request):\n return User.select_by_user(request.user)", "metadata": "root.UserInline.queryset", "header": "['class', 'UserInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 540 }, { "content": "class SliceInline(XOSTabularInline):\n model = Slice\n fields = ['backend_status_icon', 'name', 'site', 'serviceClass', 'service']\n readonly_fields = ('backend_status_icon', )\n extra = 0\n suit_classes = 'suit-tab suit-tab-slices'\n", "metadata": "root.SliceInline", "header": "['module', '___EOS___']", "index": 544 }, { "content": " def queryset(self, request):\n return Slice.select_by_user(request.user)", "metadata": "root.SliceInline.queryset", "header": "['class', 'SliceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 551 }, { "content": "class NodeInline(XOSTabularInline):\n model = Node\n extra = 0\n suit_classes = 'suit-tab suit-tab-nodes'\n fields = ['backend_status_icon', 'name', 'site_deployment']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.NodeInline", "header": "['module', '___EOS___']", "index": 555 }, { "content": "class DeploymentPrivilegeInline(XOSTabularInline):\n model = DeploymentPrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-deploymentprivileges'\n fields = ['backend_status_icon', 'user', 'role', 'deployment']\n readonly_fields = ('backend_status_icon', )\n", "metadata": "root.DeploymentPrivilegeInline", "header": "['module', '___EOS___']", "index": 563 }, { "content": " def queryset(self, request):\n return DeploymentPrivilege.select_by_user(request.user)", "metadata": "root.DeploymentPrivilegeInline.queryset", "header": "['class', 'DeploymentPrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 570 }, { "content": "class ControllerSiteInline(XOSTabularInline):\n model = ControllerSite\n extra = 0\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['controller', 'site', 'tenant_id']", "metadata": "root.ControllerSiteInline", "header": "['module', '___EOS___']", "index": 574 }, { "content": "class SitePrivilegeInline(XOSTabularInline):\n model = SitePrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-siteprivileges'\n fields = ['backend_status_icon', 'user', 'site', 'role']\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.SitePrivilegeInline", "header": "['module', '___EOS___']", "index": 581 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n kwargs['queryset'] = Site.select_by_user(request.user)\n\n if db_field.name == 'user':\n kwargs['queryset'] = User.select_by_user(request.user)\n return super(SitePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SitePrivilegeInline.formfield_for_foreignkey", "header": "['class', 'SitePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 588 }, { "content": " def queryset(self, request):\n return SitePrivilege.select_by_user(request.user)", "metadata": "root.SitePrivilegeInline.queryset", "header": "['class', 'SitePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 596 }, { "content": "class ServicePrivilegeInline(XOSTabularInline):\n model = ServicePrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-serviceprivileges'\n fields = ['backend_status_icon', 'user', 'service', 'role']\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.ServicePrivilegeInline", "header": "['module', '___EOS___']", "index": 600 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'service':\n kwargs['queryset'] = Service.select_by_user(request.user)\n if db_field.name == 'user':\n kwargs['queryset'] = User.select_by_user(request.user)\n return super(ServicePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.ServicePrivilegeInline.formfield_for_foreignkey", "header": "['class', 'ServicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 607 }, { "content": " def queryset(self, request):\n return ServicePrivilege.select_by_user(request.user)", "metadata": "root.ServicePrivilegeInline.queryset", "header": "['class', 'ServicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 614 }, { "content": "class SiteDeploymentInline(XOSTabularInline):\n model = SiteDeployment\n extra = 0\n suit_classes = 'suit-tab suit-tab-sitedeployments'\n fields = ['backend_status_icon', 'deployment', 'site', 'controller']\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.SiteDeploymentInline", "header": "['module', '___EOS___']", "index": 618 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n kwargs['queryset'] = Site.select_by_user(request.user)\n\n if db_field.name == 'deployment':\n kwargs['queryset'] = Deployment.select_by_user(request.user)\n\n if db_field.name == 'controller':\n if len(resolve(request.path).args) > 0:\n kwargs['queryset'] = Controller.select_by_user(request.user).filter(\n deployment__id=int(resolve(request.path).args[0]))\n\n return super(SiteDeploymentInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SiteDeploymentInline.formfield_for_foreignkey", "header": "['class', 'SiteDeploymentInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 625 }, { "content": " def queryset(self, request):\n return SiteDeployment.select_by_user(request.user)", "metadata": "root.SiteDeploymentInline.queryset", "header": "['class', 'SiteDeploymentInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 639 }, { "content": "class SlicePrivilegeInline(XOSTabularInline):\n model = SlicePrivilege\n suit_classes = 'suit-tab suit-tab-sliceprivileges'\n extra = 0\n fields = ('backend_status_icon', 'user', 'slice', 'role')\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.SlicePrivilegeInline", "header": "['module', '___EOS___']", "index": 643 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'slice':\n kwargs['queryset'] = Slice.select_by_user(request.user)\n if db_field.name == 'user':\n # all users are available to be granted SlicePrivilege\n kwargs['queryset'] = User.objects.all()\n\n return super(SlicePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SlicePrivilegeInline.formfield_for_foreignkey", "header": "['class', 'SlicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 650 }, { "content": " def queryset(self, request):\n return SlicePrivilege.select_by_user(request.user)", "metadata": "root.SlicePrivilegeInline.queryset", "header": "['class', 'SlicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 659 }, { "content": "class SliceNetworkInline(XOSTabularInline):\n model = Network.slices.through\n selflink_fieldname = \"network\"\n extra = 0\n verbose_name = \"Network Connection\"\n verbose_name_plural = \"Network Connections\"\n suit_classes = 'suit-tab suit-tab-slicenetworks'\n fields = ['backend_status_icon', 'network']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.SliceNetworkInline", "header": "['module', '___EOS___']", "index": 663 }, { "content": "class ImageDeploymentsInline(XOSTabularInline):\n model = ImageDeployments\n extra = 0\n verbose_name = \"Image Deployments\"\n verbose_name_plural = \"Image Deployments\"\n suit_classes = 'suit-tab suit-tab-imagedeployments'\n fields = ['backend_status_icon', 'image', 'deployment']\n readonly_fields = ['backend_status_icon']", "metadata": "root.ImageDeploymentsInline", "header": "['module', '___EOS___']", "index": 674 }, { "content": "class ControllerImagesInline(XOSTabularInline):\n model = ControllerImages\n extra = 0\n verbose_name = \"Controller Images\"\n verbose_name_plural = \"Controller Images\"\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['backend_status_icon', 'image', 'controller', 'glance_image_id']\n readonly_fields = ['backend_status_icon', 'glance_image_id']", "metadata": "root.ControllerImagesInline", "header": "['module', '___EOS___']", "index": 684 }, { "content": "class SiteAssocInline(XOSTabularInline):\n model = Site.deployments.through\n extra = 0\n suit_classes = 'suit-tab suit-tab-sites'", "metadata": "root.SiteAssocInline", "header": "['module', '___EOS___']", "index": 809 }, { "content": "class TenantAttrAsTabInline(XOSTabularInline):\n model = TenantAttribute\n fields = ['name', 'value']\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantattrs'", "metadata": "root.TenantAttrAsTabInline", "header": "['module', '___EOS___']", "index": 926 }, { "content": "class TenantRootTenantInline(XOSTabularInline):\n model = Tenant\n fields = ['provider_service', 'subscriber_root']\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantroots'\n fk_name = 'subscriber_root'\n verbose_name = 'subscribed tenant'\n verbose_name_plural = 'subscribed tenants'\n\n # def queryset(self, request):\n # qs = super(TenantRootTenantInline, self).queryset(request)\n # return qs.filter(kind=\"coarse\")", "metadata": "root.TenantRootTenantInline", "header": "['module', '___EOS___']", "index": 938 }, { "content": "class TenantRootPrivilegeInline(XOSTabularInline):\n model = TenantRootPrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantrootprivileges'\n fields = ['backend_status_icon', 'user', 'role', 'tenant_root']\n readonly_fields = ('backend_status_icon', )\n", "metadata": "root.TenantRootPrivilegeInline", "header": "['module', '___EOS___']", "index": 952 }, { "content": " def queryset(self, request):\n return TenantRootPrivilege.select_by_user(request.user)", "metadata": "root.TenantRootPrivilegeInline.queryset", "header": "['class', 'TenantRootPrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 959 }, { "content": "class TenantPrivilegeInline(XOSTabularInline):\n \"\"\"Inline for adding a TenantPrivilege to a Tenant.\"\"\"\n model = TenantPrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantprivileges'\n fields = ['backend_status_icon', 'user', 'role', 'tenant']\n readonly_fields = ('backend_status_icon', )\n", "metadata": "root.TenantPrivilegeInline", "header": "['module', '___EOS___']", "index": 985 }, { "content": " def queryset(self, request):\n return TenantPrivilege.select_by_user(request.user)", "metadata": "root.TenantPrivilegeInline.queryset", "header": "['class', 'TenantPrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 993 }, { "content": "class ProviderTenantInline(XOSTabularInline):\n model = CoarseTenant\n fields = ['provider_service', 'subscriber_service', 'connect_method']\n extra = 0\n suit_classes = 'suit-tab suit-tab-servicetenants'\n fk_name = 'provider_service'\n verbose_name = 'provided tenant'\n verbose_name_plural = 'provided tenants'\n", "metadata": "root.ProviderTenantInline", "header": "['module', '___EOS___']", "index": 997 }, { "content": " def queryset(self, request):\n qs = super(ProviderTenantInline, self).queryset(request)\n return qs.filter(kind=\"coarse\")", "metadata": "root.ProviderTenantInline.queryset", "header": "['class', 'ProviderTenantInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1006 }, { "content": "class SubscriberTenantInline(XOSTabularInline):\n model = CoarseTenant\n fields = ['provider_service', 'subscriber_service', 'connect_method']\n extra = 0\n suit_classes = 'suit-tab suit-tab-servicetenants'\n fk_name = 'subscriber_service'\n verbose_name = 'subscribed tenant'\n verbose_name_plural = 'subscribed tenants'\n", "metadata": "root.SubscriberTenantInline", "header": "['module', '___EOS___']", "index": 1011 }, { "content": " def queryset(self, request):\n qs = super(SubscriberTenantInline, self).queryset(request)\n return qs.filter(kind=\"coarse\")", "metadata": "root.SubscriberTenantInline.queryset", "header": "['class', 'SubscriberTenantInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1020 }, { "content": "class ServiceAttrAsTabInline(XOSTabularInline):\n model = ServiceAttribute\n fields = ['name', 'value']\n extra = 0\n suit_classes = 'suit-tab suit-tab-serviceattrs'", "metadata": "root.ServiceAttrAsTabInline", "header": "['module', '___EOS___']", "index": 1025 }, { "content": "class SiteNodeInline(XOSTabularInline):\n model = Node\n fields = ['name', 'site_deployment']\n extra = 0\n suit_classes = 'suit-tab suit-tab-nodes'\n", "metadata": "root.SiteNodeInline", "header": "['module', '___EOS___']", "index": 1054 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n # only display site deployments associated with this site\n if db_field.name == 'site_deployment':\n kwargs['queryset'] = SiteDeployment.objects.filter(\n site__id=int(request.path.split('/')[-2]))\n\n return super(SiteNodeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SiteNodeInline.formfield_for_foreignkey", "header": "['class', 'SiteNodeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1060 }, { "content": "class ControllerSliceInline(XOSTabularInline):\n model = ControllerSlice\n extra = 0\n verbose_name = \"Controller Slices\"\n verbose_name_plural = \"Controller Slices\"\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['backend_status_icon', 'controller', 'tenant_id']\n readonly_fields = ('backend_status_icon', 'controller')", "metadata": "root.ControllerSliceInline", "header": "['module', '___EOS___']", "index": 1213 }, { "content": "class InstancePortInline(XOSTabularInline):\n fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']\n readonly_fields = (\"backend_status_icon\", \"ip\", \"mac\")\n model = Port\n #selflink_fieldname = \"network\"\n extra = 0\n verbose_name_plural = \"Ports\"\n verbose_name = \"Port\"\n suit_classes = 'suit-tab suit-tab-ports'", "metadata": "root.InstancePortInline", "header": "['module', '___EOS___']", "index": 1504 }, { "content": "class UserDashboardViewInline(XOSTabularInline):\n model = UserDashboardView\n extra = 0\n suit_classes = 'suit-tab suit-tab-dashboards'\n fields = ['user', 'dashboardView', 'order']", "metadata": "root.UserDashboardViewInline", "header": "['module', '___EOS___']", "index": 1719 }, { "content": "class ControllerUserInline(XOSTabularInline):\n model = ControllerUser\n extra = 0\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['controller', 'user', 'kuser_id']", "metadata": "root.ControllerUserInline", "header": "['module', '___EOS___']", "index": 1726 }, { "content": "class ControllerDashboardViewInline(XOSTabularInline):\n model = ControllerDashboardView\n extra = 0\n fields = [\"controller\", \"url\"]\n suit_classes = 'suit-tab suit-tab-controllers'", "metadata": "root.ControllerDashboardViewInline", "header": "['module', '___EOS___']", "index": 1828 }, { "content": "class ServiceResourceInline(XOSTabularInline):\n model = ServiceResource\n extra = 0", "metadata": "root.ServiceResourceInline", "header": "['module', '___EOS___']", "index": 1848 }, { "content": "class ReservedResourceInline(XOSTabularInline):\n model = ReservedResource\n extra = 0\n suit_classes = 'suit-tab suit-tab-reservedresources'\n\n", "metadata": "root.ReservedResourceInline", "header": "['module', '___EOS___']", "index": 1863 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n field = super(ReservedResourceInline, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n if db_field.name == 'resource':\n # restrict resources to those that the slice's service class allows\n if request._slice is not None:\n field.queryset = field.queryset.filter(\n serviceClass=request._slice.serviceClass, calendarReservable=True)\n if len(field.queryset) > 0:\n field.initial = field.queryset.all()[0]\n else:\n field.queryset = field.queryset.none()\n elif db_field.name == 'instance':\n # restrict instances to those that belong to the slice\n if request._slice is not None:\n field.queryset = field.queryset.filter(slice=request._slice)\n else:\n field.queryset = field.queryset.none()\n\n return field", "metadata": "root.ReservedResourceInline.formfield_for_foreignkey", "header": "['class', 'ReservedResourceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1868 }, { "content": " def queryset(self, request):\n return ReservedResource.select_by_user(request.user)", "metadata": "root.ReservedResourceInline.queryset", "header": "['class', 'ReservedResourceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1890 }, { "content": "class RouterInline(XOSTabularInline):\n model = Router.networks.through\n extra = 0\n verbose_name_plural = \"Routers\"\n verbose_name = \"Router\"\n suit_classes = 'suit-tab suit-tab-routers'", "metadata": "root.RouterInline", "header": "['module', '___EOS___']", "index": 2031 }, { "content": "class NetworkPortInline(XOSTabularInline):\n fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']\n readonly_fields = (\"backend_status_icon\", \"ip\", \"mac\")\n model = Port\n #selflink_fieldname = \"instance\"\n extra = 0\n verbose_name_plural = \"Ports\"\n verbose_name = \"Port\"\n suit_classes = 'suit-tab suit-tab-ports'", "metadata": "root.NetworkPortInline", "header": "['module', '___EOS___']", "index": 2049 }, { "content": "class NetworkSlicesInline(XOSTabularInline):\n model = NetworkSlice\n selflink_fieldname = \"slice\"\n extra = 0\n verbose_name_plural = \"Slices\"\n verbose_name = \"Slice\"\n suit_classes = 'suit-tab suit-tab-networkslices'\n fields = ['backend_status_icon', 'network', 'slice']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.NetworkSlicesInline", "header": "['module', '___EOS___']", "index": 2060 }, { "content": "class ControllerNetworkInline(XOSTabularInline):\n model = ControllerNetwork\n extra = 0\n verbose_name_plural = \"Controller Networks\"\n verbose_name = \"Controller Network\"\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['backend_status_icon', 'controller',\n 'net_id', 'subnet_id', 'subnet']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.ControllerNetworkInline", "header": "['module', '___EOS___']", "index": 2071 }, { "content": "class InvoiceChargeInline(XOSTabularInline):\n model = Charge\n extra = 0\n verbose_name_plural = \"Charges\"\n verbose_name = \"Charge\"\n exclude = ['account']\n fields = [\"date\", \"kind\", \"state\", \"object\",\n \"coreHours\", \"dollar_amount\", \"slice\"]\n readonly_fields = [\"date\", \"kind\", \"state\",\n \"object\", \"coreHours\", \"dollar_amount\", \"slice\"]\n can_delete = False\n max_num = 0\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.InvoiceChargeInline", "header": "['module', '___EOS___']", "index": 2205 }, { "content": "class InvoiceInline(XOSTabularInline):\n model = Invoice\n extra = 0\n verbose_name_plural = \"Invoices\"\n verbose_name = \"Invoice\"\n fields = [\"date\", \"dollar_amount\"]\n readonly_fields = [\"date\", \"dollar_amount\"]\n suit_classes = 'suit-tab suit-tab-accountinvoice'\n can_delete = False\n max_num = 0\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.InvoiceInline", "header": "['module', '___EOS___']", "index": 2232 }, { "content": "class PendingChargeInline(XOSTabularInline):\n model = Charge\n extra = 0\n verbose_name_plural = \"Charges\"\n verbose_name = \"Charge\"\n exclude = [\"invoice\"]\n fields = [\"date\", \"kind\", \"state\", \"object\",\n \"coreHours\", \"dollar_amount\", \"slice\"]\n readonly_fields = [\"date\", \"kind\", \"state\",\n \"object\", \"coreHours\", \"dollar_amount\", \"slice\"]\n suit_classes = 'suit-tab suit-tab-accountpendingcharges'\n can_delete = False\n max_num = 0\n\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.PendingChargeInline", "header": "['module', '___EOS___']", "index": 2246 }, { "content": " def queryset(self, request):\n qs = super(PendingChargeInline, self).queryset(request)\n qs = qs.filter(state=\"pending\")\n return qs", "metadata": "root.PendingChargeInline.queryset", "header": "['class', 'PendingChargeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 2260 }, { "content": "class PaymentInline(XOSTabularInline):\n model = Payment\n extra = 1\n verbose_name_plural = \"Payments\"\n verbose_name = \"Payment\"\n fields = [\"date\", \"dollar_amount\"]\n readonly_fields = [\"date\", \"dollar_amount\"]\n suit_classes = 'suit-tab suit-tab-accountpayments'\n can_delete = False\n max_num = 0\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.PaymentInline", "header": "['module', '___EOS___']", "index": 2268 } ]
[]
[]
0
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "self", "link_", "._", "allow", "\\u", "tags_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "link_", "._", "short", "\\u", "description_", "=_", "\"", "Det", "ail", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "back", "end", "\\u", "status", "\\u", "icon_", "._", "short", "\\u", "description_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "XO", "ST", "abu", "lar", "Inline_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", "line", "Model", "Admi", "n", " ", "as", " ", "no", " ", "get", "\\u", "fields", "()", " ", "method", ",", " ", "so", " ", "in", " ", "order", " ", "to", " ", "add_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "self", "link", " ", "field", ",", " ", "we", " ", "override", " ", "\\u\\u", "init", "\\u\\u", " ", "to", " ", "modif", "y", " ", "self", ".", "fields", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "read", "only", "\\u", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "self", "link_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\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_", "self", "link", "\\u", "model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "\"", "self", "link", "\\u", "field", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "self", ".", "self", "link", "\\u", "model", " ", "can", " ", "be", " ", "defin", "ed", " ", "to", " ", "punc", "h", " ", "through", " ", "a", " ", "relation", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "its", " ", "target", " ", "object", ".", " ", "For", " ", "example", ",", " ", "in", " ", "Slice", "Network", "In", "line", ",", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "self", "link", "\\u", "model", " ", "=", " ", "\"", "network", "\",", " ", "and", " ", "the", " ", "URL", " ", "will", " ", "lead", " ", "to", " ", "the", " ", "Network", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "inst", "ead", " ", "of", " ", "try", "ing", " ", "to", " ", "bring", " ", "up", " ", "a", " ", "change", " ", "view", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Slice", "Network", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "getattr_", "(_", "self_", "._", "model_", ",_", "self_", "._", "self", "link", "\\u", "fieldname_", ")_", "._", "field_", "._", "rel_", "._", "to_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "self", "link", "\\u", "reverse", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "admin", ":", "%", "s", "\\u", "change", "\"_", "%_", "(_", "self_", "._", "self", "link", "\\u", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "change", "\\u", "url_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "URL", " ", "to", " ", "a", " ", "change", " ", "form", " ", "in", " ", "the", " ", "admin", " ", "for", " ", "this", " ", "model", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reverse", "\\u", "path_", "=_", "self_", "._", "self", "link", "\\u", "reverse", "\\u", "path_", "#", " ", "\"", "admin", ":", "%", "s", "\\u", "change", "\"", " ", "%", " ", "(", "self", ".", "self", "link", "\\u", "model", ".\\u", "meta", ".", "db", "\\u", "table", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "reverse", "\\u", "path_", ",_", "args_", "=_", "(_", "id_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Revers", "e", "Match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "self", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "self_", "._", "get", "\\u", "change", "\\u", "url_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "have", " ", "an", " ", "admin", " ", "for", " ", "this", " ", "object", ",", " ", "so", " ", "don", "'", "t", " ", "create", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", "link", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "url_", "==_", "None_", ")_", ":_", "\\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_", "#", " ", "Sin", "ce", " ", "we", " ", "need", " ", "to", " ", "add", " ", "\"", "self", "link", "\"", " ", "to", " ", "the", " ", "field", " ", "list", ",", " ", "we", " ", "need", " ", "to", " ", "create_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "fields", " ", "if", " ", "it", " ", "is", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "fields_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "editable_", "and_", "f_", "._", "name_", "!=_", "\"", "id", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fields_", "._", "append_", "(_", "f_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "=_", "tuple_", "(_", "self_", "._", "fields_", ")_", "+_", "(_", "\"", "self", "link", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "read", "only", "\\u", "fields_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "fields_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "read", "only", "\\u", "fields_", "=_", "tuple_", "(_", "self_", "._", "read", "only", "\\u", "fields_", ")_", "+_", "(_", "\"", "self", "link", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "self", "link_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "\"", "self", "link", "\\u", "field", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "obj_", ",_", "self_", "._", "self", "link", "\\u", "fieldname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "self_", "._", "get", "\\u", "change", "\\u", "url_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"<", "a", " ", "href", "='", "%", "s", "'>", "Det", "ail", "s", "</", "a", ">\"_", "%_", "str_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Not", " ", "presen", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "has", "\\u", "add", "\\u", "permission_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "read", "only", "\\u", "fields_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "only", "\\u", "fields_", "=_", "list_", "(_", "self_", "._", "read", "only", "\\u", "fields_", ")_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "self_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "field_", "in_", "read", "only", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "read", "only", "\\u", "fields_", "._", "append_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "read", "only", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "back", "end", "\\u", "status", "\\u", "icon_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mark", "\\u", "safe_", "(_", "back", "end", "\\u", "icon_", "(_", "obj_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reserva", "tion", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Reserva", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "reserva", "tion", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Reserva", "tion_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ",_", "'", "slice", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ",_", "'", "slice", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "instance", "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_", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Instance_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "acl_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "deployments", "\\u\\u", "nodes", "\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "deploy", "ment", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "flavor", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "flavor", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "Insta", "nce", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Cor", "d", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ",_", "'", "slice", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "'", "instance", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "instance", "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_", "Cor", "d", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Instance_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "acl_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "deployments", "\\u\\u", "nodes", "\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "deploy", "ment", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "flavor", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "flavor", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "Cor", "d", "Insta", "nce", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "field_", "\\u\\u\\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_", "Site", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "sites", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Host", "s", "Node", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Host", "s", "Node", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "host", "s", "\\u", "nodes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Host", "s", "User", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Host", "s", "User", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "host", "s", "\\u", "users_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "email", "'_", ",_", "'", "first", "name", "'_", ",_", "'", "last", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "users", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Slice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "'_", ",_", "'", "service", "Class", "'_", ",_", "'", "service", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "slice", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Node", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "nodes", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "\\u", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\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_", "Deployment", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Deployment", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "deploy", "ment", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "role", "'_", ",_", "'", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Deployment", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Deployment", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Controlle", "r", "Site", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "controlle", "r", "'_", ",_", "'", "site", "'_", ",_", "'", "tenan", "t", "\\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_", "Site", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "site", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "site", "'_", ",_", "'", "role", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Site", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Site", "Privilege", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Service", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Service", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "service", "'_", ",_", "'", "role", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Service", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "service", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Service_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Service", "Privilege", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Service", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Deployment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site", "Deployment", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "site", "deployments", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "site", "'_", ",_", "'", "controlle", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Site", "Deployment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "controlle", "r", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "resolve_", "(_", "request_", "._", "path_", ")_", "._", "args_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Controller_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "ment", "\\u\\u", "id_", "=_", "int_", "(_", "resolve_", "(_", "request_", "._", "path_", ")_", "._", "args_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Site", "Deployment", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Deployment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Slice", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Slice", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "slice", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "slice", "'_", ",_", "'", "role", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Slice", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "slice", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "all", " ", "users", " ", "are", " ", "avail", "able", " ", "to", " ", "be", " ", "grant", "ed", " ", "Slice", "Privilege", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "User_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Slice", "Privilege", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Slice", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Slice", "Network", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Network_", "._", "slices_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "link", "\\u", "fieldname_", "=_", "\"", "network", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Network", " ", "Connect", "ion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Network", " ", "Connect", "ion", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "slice", "network", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\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_", "Image", "Deployment", "s", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Image", "Deployment", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Image", " ", "Deployment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Image", " ", "Deployment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "image", "deployments", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "image", "'_", ",_", "'", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", "]_", "\\u\\u\\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_", "Controlle", "r", "Image", "s", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Controlle", "r", " ", "Image", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Controlle", "r", " ", "Image", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "image", "'_", ",_", "'", "controlle", "r", "'_", ",_", "'", "gla", "nce", "\\u", "image", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "gla", "nce", "\\u", "image", "\\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_", "Site", "Assoc", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site_", "._", "deployments", "_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "sites", "'_", "\\u\\u\\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_", "Ten", "ant", "Attr", "As", "Tab", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant", "Attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tat", "tr", "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_", "Ten", "ant", "Roo", "t", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "subscribe", "r", "\\u", "root", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tro", "ots", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fk", "\\u", "name_", "=_", "'", "subscribe", "r", "\\u", "root", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "'", "subscribed", " ", "tenan", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "'", "subscribed", " ", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "querys", "et", "(", "self", ",", " ", "request", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "qs", " ", "=", " ", "super", "(", "Ten", "ant", "Roo", "t", "Ten", "ant", "In", "line", ",", " ", "self", ").", "querys", "et", "(", "request", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "qs", ".", "filter", "(", "kind", "=\"", "coarse", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ten", "ant", "Roo", "t", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant", "Roo", "t", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tro", "otp", "riv", "ile", "ges", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "role", "'_", ",_", "'", "tenan", "t", "\\u", "root", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ten", "ant", "Roo", "t", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ten", "ant", "Roo", "t", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ten", "ant", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "In", "line", " ", "for", " ", "addin", "g", " ", "a", " ", "Ten", "ant", "Privilege", " ", "to", " ", "a", " ", "Ten", "ant", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Ten", "ant", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tpr", "ivi", "leg", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "role", "'_", ",_", "'", "tenan", "t", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ten", "ant", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ten", "ant", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Provider", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Coa", "rse", "Ten", "ant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "subscribe", "r", "\\u", "service", "'_", ",_", "'", "connect", "\\u", "method", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fk", "\\u", "name_", "=_", "'", "provide", "r", "\\u", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "'", "provided", " ", "tenan", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "'", "provided", " ", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Provider", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "super_", "(_", "Provider", "Ten", "ant", "Inline_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "filter_", "(_", "kind_", "=_", "\"", "coarse", "\"_", ")_", "\\u\\u\\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_", "Subscrib", "er", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Coa", "rse", "Ten", "ant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "subscribe", "r", "\\u", "service", "'_", ",_", "'", "connect", "\\u", "method", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fk", "\\u", "name_", "=_", "'", "subscribe", "r", "\\u", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "'", "subscribed", " ", "tenan", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "'", "subscribed", " ", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subscrib", "er", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "super_", "(_", "Subscrib", "er", "Ten", "ant", "Inline_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "filter_", "(_", "kind_", "=_", "\"", "coarse", "\"_", ")_", "\\u\\u\\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_", "Service", "Attr", "As", "Tab", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Service", "Attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "attr", "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_", "Site", "Node", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "site", "\\u", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "nodes", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Node", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "display", " ", "site", " ", "deployments", " ", "associate", "d", " ", "with", " ", "this", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "\\u", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site", "Deployment", "_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "\\u\\u", "id_", "=_", "int_", "(_", "request_", "._", "path_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Site", "Node", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Controlle", "r", "Slice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Controlle", "r", " ", "Slice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Controlle", "r", " ", "Slice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "controlle", "r", "'_", ",_", "'", "tenan", "t", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "controlle", "r", "'_", ")_", "\\u\\u\\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_", "Insta", "nce", "Port", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", ",_", "'", "instance", "'_", ",_", "'", "ip", "'_", ",_", "'", "mac", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "ip", "\"_", ",_", "\"", "mac", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", "link", "\\u", "field", "name", " ", "=", " ", "\"", "network", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Port", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Port", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "port", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Dash", "board", "View", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User", "Dash", "board", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "dashboards", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "user", "'_", ",_", "'", "dash", "board", "View", "'_", ",_", "'", "order", "'_", "]_", "\\u\\u\\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_", "Controlle", "r", "User", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "controlle", "r", "'_", ",_", "'", "user", "'_", ",_", "'", "kus", "er", "\\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_", "Controlle", "r", "Dash", "board", "View", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Dash", "board", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "controlle", "r", "\"_", ",_", "\"", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "controlle", "rs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Service", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Service", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "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_", "class_", "Reserve", "d", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Reserve", "d", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "reserve", "dre", "source", "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_", "Reserve", "d", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "super_", "(_", "Reserve", "d", "Reso", "urc", "e", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "resource", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "restrict", " ", "resource", "s", " ", "to", " ", "tho", "se", " ", "tha", "t", " ", "the", " ", "slice", "'", "s", " ", "service", " ", "class", " ", "allow", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "\\u", "slice_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "Class_", "=_", "request_", "._", "\\u", "slice_", "._", "service", "Class_", ",_", "calendar", "Reserva", "ble_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "field_", "._", "queryset_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field_", "._", "initial_", "=_", "field_", "._", "queryset_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\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 ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "none_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "db", "\\u", "field_", "._", "name_", "==_", "'", "instance", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "restrict", " ", "instance", "s", " ", "to", " ", "tho", "se", " ", "tha", "t", " ", "belo", "ng", " ", "to", " ", "the", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "\\u", "slice_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "filter_", "(_", "slice_", "=_", "request_", "._", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "none_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserve", "d", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Reserve", "d", "Resource_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Route", "r", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Router_", "._", "networks_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Route", "rs", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Route", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "router", "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_", "Network", "Port", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", ",_", "'", "instance", "'_", ",_", "'", "ip", "'_", ",_", "'", "mac", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "ip", "\"_", ",_", "\"", "mac", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", "link", "\\u", "field", "name", " ", "=", " ", "\"", "instance", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Port", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Port", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "port", "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_", "Network", "Slice", "s", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Network", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "link", "\\u", "fieldname_", "=_", "\"", "slice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Slice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Slice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "network", "slice", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", ",_", "'", "slice", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\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_", "Controlle", "r", "Network", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Controlle", "r", " ", "Network", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Controlle", "r", " ", "Network", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "controlle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "net", "\\u", "id", "'_", ",_", "'", "subnet", "\\u", "id", "'_", ",_", "'", "subnet", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\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_", "Invoice", "Charge", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Charge", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Charge", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Charge", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "[_", "'", "account", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\"", "object", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "\"_", ",_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\u\\u\\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_", "Invoice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Invoice", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Invoice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Invoice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "accounti", "nv", "oi", "ce", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\u\\u\\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_", "Pend", "ing", "Charge", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Charge", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Charge", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Charge", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "[_", "\"", "invoic", "e", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\"", "object", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "\"_", ",_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "account", "pend", "ing", "charge", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pend", "ing", "Charge", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "super_", "(_", "Pend", "ing", "Charge", "Inline_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "qs_", "._", "filter_", "(_", "state_", "=_", "\"", "pend", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "\\u\\u\\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_", "Payment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Payment", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Payment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Payment", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "account", "payments", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First argument to super() is not enclosing class
treeio/treeio/treeio/sales/forms.py
[ { "content": " def __init__(self, user, *args, **kwargs):\n super(LeadForm, self).__init__(*args, **kwargs)\n\n self.fields['contact'].queryset = Object.filter_permitted(\n user, Contact.objects)\n self.fields['contact'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('identities_ajax_contact_lookup')})\n self.fields['contact'].widget.attrs.update(\n {'popuplink': reverse('identities_contact_add')})\n self.fields['contact'].label = _(\"Contact\")\n\n self.fields['source'].queryset = Object.filter_permitted(\n user, SaleSource.objects.filter(active=True))\n self.fields['source'].label = _(\"Source\")\n self.fields['products_interested'].queryset = Object.filter_permitted(\n user, Product.objects)\n self.fields['products_interested'].help_text = \"\"\n self.fields['products_interested'].widget.attrs.update(\n {'popuplink': reverse('sales_product_add')})\n self.fields['products_interested'].label = _(\"Products interested\")\n\n self.fields['assigned'].help_text = \"\"\n self.fields['assigned'].label = _(\"Assigned to\")\n self.fields['assigned'].widget.attrs.update({'class': 'multicomplete',\n 'callback': reverse('identities_ajax_user_lookup')})\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_product')[0]\n self.fields['products_interested'].initial = [long(conf.value)]\n except:\n pass\n\n self.fields['status'].queryset = Object.filter_permitted(\n user, SaleStatus.objects.filter(use_leads=True))\n self.fields['status'].label = _(\"Status\")\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_lead_status')[0]\n self.fields['status'].initial = long(conf.value)\n except:\n pass\n\n self.fields['contact_method'].label = _(\"Contact method\")\n self.fields['details'].label = _(\"Details\")", "metadata": "root.LeadForm.__init__", "header": "['class', 'LeadForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 878 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Lead", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Lead", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Contact_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "contact", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "contact", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Sal", "e", "Source_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Product_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "sales", "\\u", "product", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Product", "s", " ", "interest", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Assign", "ed", " ", "to", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "multico", "mplet", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "user", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "product", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "initial_", "=_", "[_", "long_", "(_", "conf_", "._", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "leads", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Status", "\"_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "lead", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "initial_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "\\u", "method", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "deta", "il", "s", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Det", "ail", "s", "\"_", ")_", "\\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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ane()\n\t\tgroup = GafferScene.Group()\n\t\tgroup[\"in\"][0].setInput( sphere[\"out\"] )\n\t\tgroup[\"in\"][1].setInput( plane[\"out\"] )\n\n\t\tplane2 = GafferScene.Plane()\n\t\tplane2[\"divisions\"].setValue( IECore.V2i( 99, 99 ) ) # 10000 instances\n\n\t\tinstancer = GafferScene.Instancer()\n\t\tinstancer[\"in\"].setInput( plane2[\"out\"] )\n\t\tinstancer[\"parent\"].setValue( \"/plane\" )\n\t\tinstancer[\"instance\"].setInput( group[\"out\"] )\n\n\t\tfilter = GafferScene.PathFilter()\n\t\tfilter[\"paths\"].setValue( IECore.StringVectorData( [ \"/plane/instances/*1/group/plane\" ] ) )\n\n\t\tmatchingPaths = GafferScene.PathMatcher()\n\t\tGafferScene.matchingPaths( filter, instancer[\"out\"], matchingPaths )\n\n\t\tself.assertEqual( len( matchingPaths.paths() ), 1000 )\n\t\tself.assertEqual( matchingPaths.match( \"/plane/instances/1/group/plane\" ), GafferScene.Filter.Result.ExactMatch )\n\t\tself.assertEqual( matchingPaths.match( \"/plane/instances/1121/group/plane\" ), GafferScene.Filter.Result.ExactMatch )\n\t\tself.assertEqual( matchingPaths.match( \"/plane/instances/1121/group/sphere\" ), GafferScene.Filter.Result.NoMatch )", "metadata": "root.SceneAlgoTest.test", "header": "['class', 'SceneAlgoTest', '(', 'GafferSceneTest', '.', 'SceneTestCase', ')', ':', '___EOS___']", "index": 45 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Scen", "e", "Algo", "Test_", "(_", "Ga", "ffer", "Scen", "e", "Test_", "._", "Scen", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "sphere_", "=_", "Ga", "ffer", "Scene_", "._", "Sphere", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane_", "=_", "Ga", "ffer", "Scene_", "._", "Plane_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "Ga", "ffer", "Scene_", "._", "Group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "[_", "\"", "in", "\"_", "]_", "[_", "0_", "]_", "._", "set", "Input_", "(_", "sphere_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "[_", "\"", "in", "\"_", "]_", "[_", "1_", "]_", "._", "set", "Input_", "(_", "plane_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "2_", "=_", "Ga", "ffer", "Scene_", "._", "Plane_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "2_", "[_", "\"", "divisions", "\"_", "]_", "._", "set", "Value_", "(_", "IE", "Core_", "._", "V2", "i_", "(_", "99_", ",_", "99_", ")_", ")_", "#", " ", "10000", " ", "instances_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "r_", "=_", "Ga", "ffer", "Scene_", "._", "Insta", "nce", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "r_", "[_", "\"", "in", "\"_", "]_", "._", "set", "Input_", "(_", "plane", "2_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "r_", "[_", "\"", "parent", "\"_", "]_", "._", "set", "Value_", "(_", "\"/", "plane", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "r_", "[_", "\"", "instance", "\"_", "]_", "._", "set", "Input_", "(_", "group_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filter_", "=_", "Ga", "ffer", "Scene_", "._", "Path", "Filter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter_", "[_", "\"", "path", "s", "\"_", "]_", "._", "set", "Value_", "(_", "IE", "Core_", "._", "String", "Vector", "Data_", "(_", "[_", "\"/", "plane", "/", "instance", "s", "/*", "1", "/", "group", "/", "plane", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "matchi", "ng", "Paths_", "=_", "Ga", "ffer", "Scene_", "._", "Path", "Matcher_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ga", "ffer", "Scene_", "._", "matchi", "ng", "Paths_", "(_", "filter_", ",_", "instance", "r_", "[_", "\"", "out", "\"_", "]_", ",_", "matchi", "ng", "Paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "matchi", "ng", "Paths_", "._", "paths_", "(_", ")_", ")_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "matchi", "ng", "Paths_", "._", "match_", "(_", "\"/", "plane", "/", "instance", "s", "/", "1", "/", "group", "/", "plane", "\"_", ")_", ",_", "Ga", "ffer", "Scene_", "._", "Filter_", "._", "Result_", "._", "Exa", "ct", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "matchi", "ng", "Paths_", "._", "match_", "(_", "\"/", "plane", "/", "instance", "s", "/", "1121", "/", "group", "/", "plane", "\"_", ")_", ",_", "Ga", "ffer", "Scene_", "._", "Filter_", "._", "Result_", "._", "Exa", "ct", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "matchi", "ng", "Paths_", "._", "match_", "(_", "\"/", "plane", "/", "instance", "s", "/", "1121", "/", "group", "/", "sphere", "\"_", ")_", ",_", "Ga", "ffer", "Scene_", "._", "Filter_", "._", "Result_", "._", "No", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ooici/pyon/pyon/core/governance/policy/test/test_policy_decision.py
[ { "content": " def test_resource_policies(self):\n gc = Mock()\n resource_id = 'resource_key'\n pdpm = PolicyDecisionPointManager(gc)\n # see that the PDP for resource is empty\n self.assertEqual(pdpm.get_resource_pdp(resource_id), pdpm.empty_pdp)\n\n pdpm.load_resource_policy_rules(resource_id, self.permit_ION_MANAGER_rule )\n\n # see that the PDP for resource is not empty anymore\n self.assertNotEqual(pdpm.get_resource_pdp(resource_id), pdpm.empty_pdp)\n\n # check request without a resource_id raises NotFound error\n invocation = MagicMock()\n invocation.message_annotations = {}\n with self.assertRaises(NotFound) as chk_res:\n pdpm.check_resource_request_policies(invocation, None)\n self.assertIn(chk_res.exception.message, 'The resource_id is not set')\n\n # (really Not Applicable, because of the inelegant hack of a policy we are setting up our pdp with)\n mock_header = Mock()\n\n def get_header_value(key, default):\n return invocation.headers.get(key, default)\n mock_header.side_effect = get_header_value\n invocation.get_header_value = mock_header\n mock_args = Mock()\n\n class MockProcess(Mock):\n def check_test_value(self, process, message, headers):\n if message['argument1'] > 3:\n return False, 'The value of argument1 is larger than 3'\n return True, ''\n\n mock_process = MockProcess()\n mock_process.org_governance_name = 'org_name'\n invocation.args = {'process': mock_process}\n\n def get_arg_value(key, default):\n return invocation.args.get(key, default)\n mock_args.side_effect = get_arg_value\n invocation.get_arg_value = mock_args\n\n # check that, because actor does not have ION_MANAGER role, policy evaluates to a denial\n\n invocation.message_annotations = {}\n invocation.message = {'argument1': 0}\n invocation.headers = {'op': 'op', 'process': mock_process, 'request': 'request', 'ion-actor-id': 'ion-actor-id', 'receiver': 'resource-registry',\n 'sender-type': 'sender-type', 'sender-service': 'sender-service', 'ion-actor-roles': {'org_name': ['ion-actor-roles']}}\n\n invocation.get_message_sender.return_value = ['Unknown','Unknown']\n\n gc.system_root_org_name = 'sys_org_name'\n\n response = pdpm.check_resource_request_policies(invocation, resource_id)\n self.assertEqual(response.value, \"NotApplicable\")\n\n # check that policy evaluates to Permit because actor has ION_MANAGER role\n invocation.headers = {'op': 'op', 'process': mock_process, 'request': 'request', 'ion-actor-id': 'ion-actor-id', 'receiver': 'resource-registry',\n 'sender-type': 'sender-type', 'sender-service': 'sender-service', 'ion-actor-roles': {'sys_org_name': ['ION_MANAGER']}}\n invocation.message_annotations = {}\n response = pdpm.check_resource_request_policies(invocation, resource_id)\n self.assertEqual(response.value, \"Permit\")\n\n\n pdpm.load_resource_policy_rules(resource_id, self.deny_message_parameter_rule)\n\n invocation.message = {'argument1': 0}\n invocation.headers = {'op': 'op', 'process': mock_process, 'request': 'request', 'ion-actor-id': 'ion-actor-id', 'receiver': 'resource-registry',\n 'sender-type': 'sender-type', 'sender-service': 'sender-service', 'ion-actor-roles': {'sys_org_name': ['ION_MANAGER']}}\n invocation.message_annotations = {}\n response = pdpm.check_resource_request_policies(invocation, resource_id)\n self.assertEqual(response.value, \"Deny\")\n self.assertEqual(invocation.message_annotations.has_key('POLICY_STATUS_REASON'), True)\n self.assertEqual(invocation.message_annotations['POLICY_STATUS_REASON'],'The value of argument1 is less than or equal to 3')\n\n invocation.message = {'argument1': 5}\n invocation.headers = {'op': 'op', 'process': mock_process, 'request': 'request', 'ion-actor-id': 'ion-actor-id', 'receiver': 'resource-registry',\n 'sender-type': 'sender-type', 'sender-service': 'sender-service', 'ion-actor-roles': {'sys_org_name': ['ION_MANAGER']}}\n invocation.message_annotations = {}\n response = pdpm.check_resource_request_policies(invocation, resource_id)\n self.assertEqual(response.value, \"Permit\")\n self.assertEqual(invocation.message_annotations.has_key('POLICY_STATUS_REASON'), False)\n\n\n pdpm.load_resource_policy_rules(resource_id, self.deny_message_parameter_function_rule)\n\n invocation.message = {'argument1': 0}\n invocation.headers = {'op': 'op', 'process': mock_process, 'request': 'request', 'ion-actor-id': 'ion-actor-id', 'receiver': 'resource-registry',\n 'sender-type': 'sender-type', 'sender-service': 'sender-service', 'ion-actor-roles': {'sys_org_name': ['ION_MANAGER']}}\n invocation.message_annotations = {}\n response = pdpm.check_resource_request_policies(invocation, resource_id)\n self.assertEqual(response.value, \"Permit\")\n self.assertEqual(invocation.message_annotations.has_key('POLICY_STATUS_REASON'), False)\n\n invocation.message = {'argument1': 5}\n invocation.headers = {'op': 'op', 'process': mock_process, 'request': 'request', 'ion-actor-id': 'ion-actor-id', 'receiver': 'resource-registry',\n 'sender-type': 'sender-type', 'sender-service': 'sender-service', 'ion-actor-roles': {'sys_org_name': ['ION_MANAGER']}}\n invocation.message_annotations = {}\n response = pdpm.check_resource_request_policies(invocation, resource_id)\n self.assertEqual(invocation.message_annotations.has_key('POLICY_STATUS_REASON'), True)\n self.assertEqual(invocation.message_annotations['POLICY_STATUS_REASON'],'The value of argument1 is larger than 3')", "metadata": "root.PolicyDecisionUnitTest.test_resource_policies", "header": "['class', 'PolicyDecisionUnitTest', '(', 'PyonTestCase', ')', ':', '___EOS___']", "index": 122 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Polic", "y", "Deci", "sion", "Unit", "Test_", "(_", "Py", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "resource", "\\u", "policies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gc_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "id_", "=_", "'", "resource", "\\u", "key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd", "pm_", "=_", "Polic", "y", "Deci", "sion", "Point", "Manager_", "(_", "gc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "tha", "t", " ", "the", " ", "PD", "P", " ", "for", " ", "resource", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pd", "pm_", "._", "get", "\\u", "resource", "\\u", "pd", "p_", "(_", "resource", "\\u", "id_", ")_", ",_", "pd", "pm_", "._", "empty", "\\u", "pd", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pd", "pm_", "._", "load", "\\u", "resource", "\\u", "policy", "\\u", "rules_", "(_", "resource", "\\u", "id_", ",_", "self_", "._", "permit", "\\u", "ION", "\\u", "MANAGER", "\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "tha", "t", " ", "the", " ", "PD", "P", " ", "for", " ", "resource", " ", "is", " ", "not", " ", "empty", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "pd", "pm_", "._", "get", "\\u", "resource", "\\u", "pd", "p_", "(_", "resource", "\\u", "id_", ")_", ",_", "pd", "pm_", "._", "empty", "\\u", "pd", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "request", " ", "with", "out", " ", "a", " ", "resource", "\\u", "id", " ", "raise", "s", " ", "Not", "Foun", "d", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "message", "\\u", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Not", "Found_", ")_", "as_", "chk", "\\u", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pd", "pm_", "._", "check", "\\u", "resource", "\\u", "request", "\\u", "policies_", "(_", "invocation", "_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "chk", "\\u", "res_", "._", "exception_", "._", "message_", ",_", "'", "The", " ", "resource", "\\u", "id", " ", "is", " ", "not", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "reall", "y", " ", "Not", " ", "Applica", "ble", ",", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "ine", "lega", "nt", " ", "hack", " ", "of", " ", "a", " ", "policy", " ", "we", " ", "are", " ", "setti", "ng", " ", "up", " ", "our", " ", "pd", "p", " ", "with", ")_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "header_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "header", "\\u", "value_", "(_", "key_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "invocation", "_", "._", "headers_", "._", "get_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mock", "\\u", "header_", "._", "side", "\\u", "effect_", "=_", "get", "\\u", "header", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "get", "\\u", "header", "\\u", "value_", "=_", "mock", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "args_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Moc", "k", "Process_", "(_", "Mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "check", "\\u", "test\\u", "value_", "(_", "self_", ",_", "process_", ",_", "message_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "message_", "[_", "'", "argu", "ment", "1", "'_", "]_", ">_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", ",_", "'", "The", " ", "value", " ", "of", " ", "argu", "ment", "1", " ", "is", " ", "large", "r", " ", "than", " ", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mock", "\\u", "process_", "=_", "Moc", "k", "Process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "org", "\\u", "govern", "anc", "e\\u", "name_", "=_", "'", "org", "\\u", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "args_", "=_", "{_", "'", "process", "'_", ":_", "mock", "\\u", "process_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "arg", "\\u", "value_", "(_", "key_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "invocation", "_", "._", "args_", "._", "get_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mock", "\\u", "args_", "._", "side", "\\u", "effect_", "=_", "get", "\\u", "arg", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "get", "\\u", "arg", "\\u", "value_", "=_", "mock", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", ",", " ", "bec", "aus", "e", " ", "actor", " ", "doe", "s", " ", "not", " ", "have", " ", "ION", "\\u", "MANAGER", " ", "role", ",", " ", "policy", " ", "evaluate", "s", " ", "to", " ", "a", " ", "deni", "al_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "._", "message", "\\u", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "message_", "=_", "{_", "'", "argu", "ment", "1", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "headers_", "=_", "{_", "'", "op", "'_", ":_", "'", "op", "'_", ",_", "'", "process", "'_", ":_", "mock", "\\u", "process_", ",_", "'", "request", "'_", ":_", "'", "request", "'_", ",_", "'", "ion", "-", "actor", "-", "id", "'_", ":_", "'", "ion", "-", "actor", "-", "id", "'_", ",_", "'", "receive", "r", "'_", ":_", "'", "resource", "-", "registr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "-", "type", "'_", ":_", "'", "sender", "-", "type", "'_", ",_", "'", "sender", "-", "service", "'_", ":_", "'", "sender", "-", "service", "'_", ",_", "'", "ion", "-", "actor", "-", "role", "s", "'_", ":_", "{_", "'", "org", "\\u", "name", "'_", ":_", "[_", "'", "ion", "-", "actor", "-", "role", "s", "'_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "._", "get", "\\u", "message", "\\u", "sender_", "._", "return", "\\u", "value_", "=_", "[_", "'", "Un", "know", "n", "'_", ",_", "'", "Un", "know", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gc_", "._", "system", "\\u", "root", "\\u", "org", "\\u", "name_", "=_", "'", "sys", "\\u", "org", "\\u", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "pd", "pm_", "._", "check", "\\u", "resource", "\\u", "request", "\\u", "policies_", "(_", "invocation", "_", ",_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "value_", ",_", "\"", "Not", "Applica", "ble", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "policy", " ", "evaluate", "s", " ", "to", " ", "Permi", "t", " ", "bec", "aus", "e", " ", "actor", " ", "has", " ", "ION", "\\u", "MANAGER", " ", "role_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "._", "headers_", "=_", "{_", "'", "op", "'_", ":_", "'", "op", "'_", ",_", "'", "process", "'_", ":_", "mock", "\\u", "process_", ",_", "'", "request", "'_", ":_", "'", "request", "'_", ",_", "'", "ion", "-", "actor", "-", "id", "'_", ":_", "'", "ion", "-", "actor", "-", "id", "'_", ",_", "'", "receive", "r", "'_", ":_", "'", "resource", "-", "registr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "-", "type", "'_", ":_", "'", "sender", "-", "type", "'_", ",_", "'", "sender", "-", "service", "'_", ":_", "'", "sender", "-", "service", "'_", ",_", "'", "ion", "-", "actor", "-", "role", "s", "'_", ":_", "{_", "'", "sys", "\\u", "org", "\\u", "name", "'_", ":_", "[_", "'", "ION", "\\u", "MANAGER", "'_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "message", "\\u", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "pd", "pm_", "._", "check", "\\u", "resource", "\\u", "request", "\\u", "policies_", "(_", "invocation", "_", ",_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "value_", ",_", "\"", "Permi", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pd", "pm_", "._", "load", "\\u", "resource", "\\u", "policy", "\\u", "rules_", "(_", "resource", "\\u", "id_", ",_", "self_", "._", "deny", "\\u", "message", "\\u", "parameter", "\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "._", "message_", "=_", "{_", "'", "argu", "ment", "1", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "headers_", "=_", "{_", "'", "op", "'_", ":_", "'", "op", "'_", ",_", "'", "process", "'_", ":_", "mock", "\\u", "process_", ",_", "'", "request", "'_", ":_", "'", "request", "'_", ",_", "'", "ion", "-", "actor", "-", "id", "'_", ":_", "'", "ion", "-", "actor", "-", "id", "'_", ",_", "'", "receive", "r", "'_", ":_", "'", "resource", "-", "registr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "-", "type", "'_", ":_", "'", "sender", "-", "type", "'_", ",_", "'", "sender", "-", "service", "'_", ":_", "'", "sender", "-", "service", "'_", ",_", "'", "ion", "-", "actor", "-", "role", "s", "'_", ":_", "{_", "'", "sys", "\\u", "org", "\\u", "name", "'_", ":_", "[_", "'", "ION", "\\u", "MANAGER", "'_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "message", "\\u", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "pd", "pm_", "._", "check", "\\u", "resource", "\\u", "request", "\\u", "policies_", "(_", "invocation", "_", ",_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "value_", ",_", "\"", "Den", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "invocation", "_", "._", "message", "\\u", "annotations_", "._", "has", "\\u", "key_", "(_", "'", "POLICY", "\\u", "STATUS", "\\u", "REASON", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "invocation", "_", "._", "message", "\\u", "annotations_", "[_", "'", "POLICY", "\\u", "STATUS", "\\u", "REASON", "'_", "]_", ",_", "'", "The", " ", "value", " ", "of", " ", "argu", "ment", "1", " ", "is", " ", "less", " ", "than", " ", "or", " ", "equal", " ", "to", " ", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "._", "message_", "=_", "{_", "'", "argu", "ment", "1", "'_", ":_", "5_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "headers_", "=_", "{_", "'", "op", "'_", ":_", "'", "op", "'_", ",_", "'", "process", "'_", ":_", "mock", "\\u", "process_", ",_", "'", "request", "'_", ":_", "'", "request", "'_", ",_", "'", "ion", "-", "actor", "-", "id", "'_", ":_", "'", "ion", "-", "actor", "-", "id", "'_", ",_", "'", "receive", "r", "'_", ":_", "'", "resource", "-", "registr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "-", "type", "'_", ":_", "'", "sender", "-", "type", "'_", ",_", "'", "sender", "-", "service", "'_", ":_", "'", "sender", "-", "service", "'_", ",_", "'", "ion", "-", "actor", "-", "role", "s", "'_", ":_", "{_", "'", "sys", "\\u", "org", "\\u", "name", "'_", ":_", "[_", "'", "ION", "\\u", "MANAGER", "'_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "message", "\\u", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "pd", "pm_", "._", "check", "\\u", "resource", "\\u", "request", "\\u", "policies_", "(_", "invocation", "_", ",_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "value_", ",_", "\"", "Permi", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "invocation", "_", "._", "message", "\\u", "annotations_", "._", "has", "\\u", "key_", "(_", "'", "POLICY", "\\u", "STATUS", "\\u", "REASON", "'_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pd", "pm_", "._", "load", "\\u", "resource", "\\u", "policy", "\\u", "rules_", "(_", "resource", "\\u", "id_", ",_", "self_", "._", "deny", "\\u", "message", "\\u", "parameter", "\\u", "function", "\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "._", "message_", "=_", "{_", "'", "argu", "ment", "1", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "headers_", "=_", "{_", "'", "op", "'_", ":_", "'", "op", "'_", ",_", "'", "process", "'_", ":_", "mock", "\\u", "process_", ",_", "'", "request", "'_", ":_", "'", "request", "'_", ",_", "'", "ion", "-", "actor", "-", "id", "'_", ":_", "'", "ion", "-", "actor", "-", "id", "'_", ",_", "'", "receive", "r", "'_", ":_", "'", "resource", "-", "registr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "-", "type", "'_", ":_", "'", "sender", "-", "type", "'_", ",_", "'", "sender", "-", "service", "'_", ":_", "'", "sender", "-", "service", "'_", ",_", "'", "ion", "-", "actor", "-", "role", "s", "'_", ":_", "{_", "'", "sys", "\\u", "org", "\\u", "name", "'_", ":_", "[_", "'", "ION", "\\u", "MANAGER", "'_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "message", "\\u", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "pd", "pm_", "._", "check", "\\u", "resource", "\\u", "request", "\\u", "policies_", "(_", "invocation", "_", ",_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "value_", ",_", "\"", "Permi", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "invocation", "_", "._", "message", "\\u", "annotations_", "._", "has", "\\u", "key_", "(_", "'", "POLICY", "\\u", "STATUS", "\\u", "REASON", "'_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invocation", "_", "._", "message_", "=_", "{_", "'", "argu", "ment", "1", "'_", ":_", "5_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "headers_", "=_", "{_", "'", "op", "'_", ":_", "'", "op", "'_", ",_", "'", "process", "'_", ":_", "mock", "\\u", "process_", ",_", "'", "request", "'_", ":_", "'", "request", "'_", ",_", "'", "ion", "-", "actor", "-", "id", "'_", ":_", "'", "ion", "-", "actor", "-", "id", "'_", ",_", "'", "receive", "r", "'_", ":_", "'", "resource", "-", "registr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "-", "type", "'_", ":_", "'", "sender", "-", "type", "'_", ",_", "'", "sender", "-", "service", "'_", ":_", "'", "sender", "-", "service", "'_", ",_", "'", "ion", "-", "actor", "-", "role", "s", "'_", ":_", "{_", "'", "sys", "\\u", "org", "\\u", "name", "'_", ":_", "[_", "'", "ION", "\\u", "MANAGER", "'_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invocation", "_", "._", "message", "\\u", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "pd", "pm_", "._", "check", "\\u", "resource", "\\u", "request", "\\u", "policies_", "(_", "invocation", "_", ",_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "invocation", "_", "._", "message", "\\u", "annotations_", "._", "has", "\\u", "key_", "(_", "'", "POLICY", "\\u", "STATUS", "\\u", "REASON", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "invocation", "_", "._", "message", "\\u", "annotations_", "[_", "'", "POLICY", "\\u", "STATUS", "\\u", "REASON", "'_", "]_", ",_", "'", "The", " ", "value", " ", "of", " ", "argu", "ment", "1", " ", "is", " ", "large", "r", " ", "than", " ", "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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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 ]
Unused local variable
kennethreitz/tablib/tablib/packages/xlwt3/Style.py
[ { "content": " def _add_style(self, style):\n num_format_str = style.num_format_str\n if num_format_str in self._num_formats:\n num_format_idx = self._num_formats[num_format_str]\n else:\n num_format_idx = (\n FIRST_USER_DEFINED_NUM_FORMAT_IDX\n + len(self._num_formats)\n - len(StyleCollection._std_num_fmt_list)\n )\n self._num_formats[num_format_str] = num_format_idx\n\n font = style.font\n if font in self._font_id2x:\n font_idx = self._font_id2x[font]\n self.stats[0] += 1\n elif self.style_compression:\n search_key = font._search_key()\n font_idx = self._font_val2x.get(search_key)\n if font_idx is not None:\n self._font_id2x[font] = font_idx\n self.stats[1] += 1\n else:\n font_idx = len(self._font_x2id) + 1 # Why plus 1? Font 4 is missing\n self._font_id2x[font] = font_idx\n self._font_val2x[search_key] = font_idx\n self._font_x2id[font_idx] = font\n self.stats[2] += 1\n else:\n font_idx = len(self._font_id2x) + 1\n self._font_id2x[font] = font_idx\n self.stats[2] += 1\n\n gof = (style.alignment, style.borders, style.pattern, style.protection)\n xf = (font_idx, num_format_idx) + gof\n if xf in self._xf_id2x:\n xf_index = self._xf_id2x[xf]\n self.stats[3] += 1\n elif self.style_compression == 2:\n xf_key = (font_idx, num_format_idx) + tuple([obj._search_key() for obj in gof])\n xf_index = self._xf_val2x.get(xf_key)\n if xf_index is not None:\n self._xf_id2x[xf] = xf_index\n self.stats[4] += 1\n else:\n xf_index = 0x10 + len(self._xf_x2id)\n self._xf_id2x[xf] = xf_index\n self._xf_val2x[xf_key] = xf_index\n self._xf_x2id[xf_index] = xf\n self.stats[5] += 1\n else:\n xf_index = 0x10 + len(self._xf_id2x)\n self._xf_id2x[xf] = xf_index\n self.stats[5] += 1\n\n if xf_index >= 0xFFF:\n # 12 bits allowed, 0xFFF is a sentinel value\n raise ValueError(\"More than 4094 XFs (styles)\")\n\n return xf, xf_index", "metadata": "root.StyleCollection._add_style", "header": "['class', 'StyleCollection', '(', 'object', ')', ':', '___EOS___']", "index": 92 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Style", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "add", "\\u", "style_", "(_", "self_", ",_", "style_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "format\\u", "str_", "=_", "style_", "._", "num", "\\u", "format\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "format\\u", "str_", "in_", "self_", "._", "\\u", "num", "\\u", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "format\\u", "idx_", "=_", "self_", "._", "\\u", "num", "\\u", "formats_", "[_", "num", "\\u", "format\\u", "str_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "format\\u", "idx_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FIR", "ST", "\\u", "USER", "\\u", "DEFINE", "D", "\\u", "NUM", "\\u", "FORMAT", "\\u", "IDX", "_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "len_", "(_", "self_", "._", "\\u", "num", "\\u", "formats_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "len_", "(_", "Style", "Collection_", "._", "\\u", "std", "\\u", "num", "\\u", "fmt", "\\u", "list_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "num", "\\u", "formats_", "[_", "num", "\\u", "format\\u", "str_", "]_", "=_", "num", "\\u", "format\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "font_", "=_", "style_", "._", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "font_", "in_", "self_", "._", "\\u", "font", "\\u", "id2", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "\\u", "idx_", "=_", "self_", "._", "\\u", "font", "\\u", "id2", "x_", "[_", "font_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "style", "\\u", "compression_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "key_", "=_", "font_", "._", "\\u", "search", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "font", "\\u", "idx_", "=_", "self_", "._", "\\u", "font", "\\u", "val", "2x", "_", "._", "get_", "(_", "search", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "font", "\\u", "idx_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "font", "\\u", "id2", "x_", "[_", "font_", "]_", "=_", "font", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "1_", "]_", "+=_", "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 ", " _", "font", "\\u", "idx_", "=_", "len_", "(_", "self_", "._", "\\u", "font", "\\u", "x2", "id_", ")_", "+_", "1_", "#", " ", "Wh", "y", " ", "plus", " ", "1", "?", " ", "Font", " ", "4", " ", "is", " ", "missing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "font", "\\u", "id2", "x_", "[_", "font_", "]_", "=_", "font", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "font", "\\u", "val", "2x", "_", "[_", "search", "\\u", "key_", "]_", "=_", "font", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "font", "\\u", "x2", "id_", "[_", "font", "\\u", "idx_", "]_", "=_", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "2_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "\\u", "idx_", "=_", "len_", "(_", "self_", "._", "\\u", "font", "\\u", "id2", "x_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "font", "\\u", "id2", "x_", "[_", "font_", "]_", "=_", "font", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "2_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gof", "_", "=_", "(_", "style_", "._", "alignment_", ",_", "style_", "._", "borders_", ",_", "style_", "._", "pattern_", ",_", "style_", "._", "protection", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "(_", "font", "\\u", "idx_", ",_", "num", "\\u", "format\\u", "idx_", ")_", "+_", "gof", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xf_", "in_", "self_", "._", "\\u", "xf", "\\u", "id2", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xf", "\\u", "index_", "=_", "self_", "._", "\\u", "xf", "\\u", "id2", "x_", "[_", "xf_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "3_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "style", "\\u", "compression_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xf", "\\u", "key_", "=_", "(_", "font", "\\u", "idx_", ",_", "num", "\\u", "format\\u", "idx_", ")_", "+_", "tuple_", "(_", "[_", "obj_", "._", "\\u", "search", "\\u", "key_", "(_", ")_", "for_", "obj_", "in_", "gof", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf", "\\u", "index_", "=_", "self_", "._", "\\u", "xf", "\\u", "val", "2x", "_", "._", "get_", "(_", "xf", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xf", "\\u", "index_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "xf", "\\u", "id2", "x_", "[_", "xf_", "]_", "=_", "xf", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "4_", "]_", "+=_", "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 ", " _", "xf", "\\u", "index_", "=_", "0x10_", "+_", "len_", "(_", "self_", "._", "\\u", "xf", "\\u", "x2", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "xf", "\\u", "id2", "x_", "[_", "xf_", "]_", "=_", "xf", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "xf", "\\u", "val", "2x", "_", "[_", "xf", "\\u", "key_", "]_", "=_", "xf", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "xf", "\\u", "x2", "id_", "[_", "xf", "\\u", "index_", "]_", "=_", "xf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "5_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xf", "\\u", "index_", "=_", "0x10_", "+_", "len_", "(_", "self_", "._", "\\u", "xf", "\\u", "id2", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "xf", "\\u", "id2", "x_", "[_", "xf_", "]_", "=_", "xf", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "[_", "5_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xf", "\\u", "index_", ">=_", "0xFF", "F_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", "2", " ", "bits", " ", "allow", "ed", ",", " ", "0xFF", "F", " ", "is", " ", "a", " ", "sentinel", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Mor", "e", " ", "than", " ", "409", "4", " ", "XF", "s", " ", "(", "style", "s", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xf_", ",_", "xf", "\\u", "index_", "\\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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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 ]
Unused import
mathcamp/pypicloud/pypicloud/access/config.py
[ { "content": "\"\"\" Backend that reads access control rules from config file \"\"\"\nimport logging\nfrom collections import defaultdict\nfrom pyramid.security import Everyone, Authenticated\nfrom pyramid.settings import aslist, asbool\n\nfrom .base import IAccessBackend\n\n\nLOG = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConfigAccessBackend(IAccessBackend):\n\n \"\"\" Access Backend that uses values set in the config file \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ConfigAccessBackend", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, request=None, settings=None, admins=None,\n group_map=None, user_groups=None, **kwargs):\n super(ConfigAccessBackend, self).__init__(request, **kwargs)\n self._settings = settings\n self.admins = admins\n self.group_map = group_map\n self.user_groups = user_groups", "metadata": "root.ConfigAccessBackend.__init__", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 16 }, { "content": " @classmethod\n def configure(cls, settings):\n kwargs = super(ConfigAccessBackend, cls).configure(settings)\n if asbool(settings.get('auth.zero_security_mode', False)):\n LOG.warn(\"Using deprecated option 'auth.zero_security_mode' \"\n \"(replaced by 'pypi.default_read' and \"\n \"'pypi.default_write'\")\n kwargs['default_read'] = [Everyone]\n kwargs['default_write'] = [Authenticated]\n kwargs['settings'] = settings\n kwargs['admins'] = aslist(settings.get('auth.admins', []))\n user_groups = defaultdict(list)\n group_map = {}\n\n # Build dict that maps users to list of groups\n for key, value in settings.iteritems():\n if not key.startswith('group.'):\n continue\n group_name = key[len('group.'):]\n members = aslist(value)\n group_map[group_name] = members\n for member in members:\n user_groups[member].append(group_name)\n kwargs['group_map'] = group_map\n kwargs['user_groups'] = user_groups\n return kwargs", "metadata": "root.ConfigAccessBackend.configure", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 24 }, { "content": " def _get_password_hash(self, username):\n key = \"user.%s\" % username\n return self._settings.get(key)", "metadata": "root.ConfigAccessBackend._get_password_hash", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 51 }, { "content": " def groups(self, username=None):\n if username is None:\n return self.group_map.keys()\n else:\n return self.user_groups[username]", "metadata": "root.ConfigAccessBackend.groups", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 55 }, { "content": " def group_members(self, group):\n return self.group_map.get(group, [])", "metadata": "root.ConfigAccessBackend.group_members", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 61 }, { "content": " def is_admin(self, username):\n return username in self.admins", "metadata": "root.ConfigAccessBackend.is_admin", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 64 }, { "content": " @staticmethod\n def _perms_from_short(value):\n \"\"\" Convert a 'r' or 'rw' specification to a list of permissions \"\"\"\n value = value or ''\n perms = []\n if 'r' in value:\n perms.append('read')\n if 'w' in value:\n perms.append('write')\n return perms", "metadata": "root.ConfigAccessBackend._perms_from_short", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 67 }, { "content": " def group_permissions(self, package, group=None):\n if group is not None:\n key = 'package.%s.group.%s' % (package, group)\n return self._perms_from_short(self._settings.get(key))\n perms = {}\n group_prefix = 'package.%s.group.' % package\n for key, value in self._settings.iteritems():\n if not key.startswith(group_prefix):\n continue\n group = key[len(group_prefix):]\n perms[group] = self._perms_from_short(value)\n return perms", "metadata": "root.ConfigAccessBackend.group_permissions", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 78 }, { "content": " def user_permissions(self, package, username=None):\n if username is not None:\n key = 'package.%s.user.%s' % (package, username)\n return self._perms_from_short(self._settings.get(key))\n perms = {}\n user_prefix = 'package.%s.user.' % package\n for key, value in self._settings.iteritems():\n if not key.startswith(user_prefix):\n continue\n user = key[len(user_prefix):]\n perms[user] = self._perms_from_short(value)\n return perms", "metadata": "root.ConfigAccessBackend.user_permissions", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 91 }, { "content": " def user_data(self, username=None):\n if username is not None:\n return {\n 'username': username,\n 'admin': self.is_admin(username),\n 'groups': self.groups(username),\n }\n users = []\n user_prefix = 'user.'\n for key in self._settings:\n if not key.startswith(user_prefix):\n continue\n username = key[len(user_prefix):]\n users.append({\n 'username': username,\n 'admin': self.is_admin(username)\n })\n return users", "metadata": "root.ConfigAccessBackend.user_data", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 104 }, { "content": " def user_package_permissions(self, username):\n perms = []\n for key, value in self._settings.iteritems():\n pieces = key.split('.')\n if (len(pieces) != 4 or pieces[0] != 'package' or\n pieces[2] != 'user'):\n continue\n package, user = pieces[1], pieces[3]\n if user == username:\n perms.append({\n 'package': package,\n 'permissions': self._perms_from_short(value),\n\n })\n return perms", "metadata": "root.ConfigAccessBackend.user_package_permissions", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 123 }, { "content": " def group_package_permissions(self, group):\n perms = []\n for key, value in self._settings.iteritems():\n pieces = key.split('.')\n if (len(pieces) != 4 or pieces[0] != 'package' or\n pieces[2] != 'group'):\n continue\n package, groupname = pieces[1], pieces[3]\n if group == groupname:\n perms.append({\n 'package': package,\n 'permissions': self._perms_from_short(value),\n\n })\n return perms", "metadata": "root.ConfigAccessBackend.group_package_permissions", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 139 }, { "content": " def load(self, data):\n lines = []\n admins = []\n for user in data['users']:\n lines.append('user.{username} = {password}'.format(**user))\n if user.get('admin'):\n admins.append(user['username'])\n\n if admins:\n lines.append('auth.admins =')\n for admin in admins:\n lines.append(' {0}'.format(admin))\n\n for group, members in data['groups'].iteritems():\n lines.append('group.{0} ='.format(group))\n for member in members:\n lines.append(' {0}'.format(member))\n\n def encode_permissions(perms):\n \"\"\" Encode a permissions list as the r/rw specification \"\"\"\n ret = ''\n if 'read' in perms:\n ret += 'r'\n if 'write' in perms:\n ret += 'w'\n return ret\n\n for package, groups in data['packages']['groups'].iteritems():\n for group, permissions in groups.iteritems():\n lines.append('package.{0}.group.{1} = {2}'\n .format(package, group,\n encode_permissions(permissions)))\n\n for package, users in data['packages']['users'].iteritems():\n for user, permissions in users.iteritems():\n lines.append('package.{0}.user.{1} = {2}'\n .format(package, user,\n encode_permissions(permissions)))\n\n return '\\n'.join(lines)", "metadata": "root.ConfigAccessBackend.load", "header": "['class', 'ConfigAccessBackend', '(', 'IAccessBackend', ')', ':', '___EOS___']", "index": 155 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "Back", "end", " ", "tha", "t", " ", "reads", " ", "access", " ", "control", " ", "rule", "s", " ", "from", " ", "config", " ", "file", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyramid_", "._", "security_", "import_", "Every", "one_", ",_", "Authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyramid_", "._", "settings_", "import_", "asl", "ist_", ",_", "as", "bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "base_", "import_", "IA", "ccess", "Backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Access", " ", "Back", "end", " ", "tha", "t", " ", "use", "s", " ", "values", " ", "set", " ", "in", " ", "the", " ", "config", " ", "file", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "request_", "=_", "None_", ",_", "settings_", "=_", "None_", ",_", "admins_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "map_", "=_", "None_", ",_", "user", "\\u", "groups_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Config", "Access", "Backend_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "settings_", "=_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "admins_", "=_", "admins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "group", "\\u", "map_", "=_", "group", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "\\u", "groups_", "=_", "user", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\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_", "configure_", "(_", "cls_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "super_", "(_", "Config", "Access", "Backend_", ",_", "cls_", ")_", "._", "configure_", "(_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "bool_", "(_", "settings_", "._", "get_", "(_", "'", "auth", ".", "zero", "\\u", "security", "\\u", "mode", "'_", ",_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warn_", "(_", "\"", "Us", "ing", " ", "depre", "cated", " ", "option", " ", "'", "auth", ".", "zero", "\\u", "security", "\\u", "mode", "'", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "replaced", " ", "by", " ", "'", "pypi", ".", "default", "\\u", "read", "'", " ", "and", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "pypi", ".", "default", "\\u", "write", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "default", "\\u", "read", "'_", "]_", "=_", "[_", "Every", "one_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "default", "\\u", "write", "'_", "]_", "=_", "[_", "Authenticated_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "settings", "'_", "]_", "=_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "admin", "s", "'_", "]_", "=_", "asl", "ist_", "(_", "settings_", "._", "get_", "(_", "'", "auth", ".", "admin", "s", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "groups_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "dict", " ", "tha", "t", " ", "maps", " ", "users", " ", "to", " ", "list", " ", "of", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "settings_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "key_", "._", "startswith_", "(_", "'", "group", ".'_", ")_", ":_", "\\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_", "group", "\\u", "name_", "=_", "key_", "[_", "len_", "(_", "'", "group", ".'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "members_", "=_", "asl", "ist_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "map_", "[_", "group", "\\u", "name_", "]_", "=_", "members_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "member_", "in_", "members_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "groups_", "[_", "member_", "]_", "._", "append_", "(_", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "group", "\\u", "map", "'_", "]_", "=_", "group", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "user", "\\u", "group", "s", "'_", "]_", "=_", "user", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "password", "\\u", "hash_", "(_", "self_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "\"", "user", ".", "%", "s", "\"_", "%_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "settings_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "groups_", "(_", "self_", ",_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "username_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "group", "\\u", "map_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "user", "\\u", "groups_", "[_", "username_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\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_", "group", "\\u", "members_", "(_", "self_", ",_", "group_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "group", "\\u", "map_", "._", "get_", "(_", "group_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "admin_", "(_", "self_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "username_", "in_", "self_", "._", "admins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "perm", "s", "\\u", "from", "\\u", "short_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Convert", " ", "a", " ", "'", "r", "'", " ", "or", " ", "'", "rw", "'", " ", "specifica", "tion", " ", "to", " ", "a", " ", "list", " ", "of", " ", "permissi", "ons", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "value_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "r", "'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "._", "append_", "(_", "'", "read", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "w", "'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "._", "append_", "(_", "'", "write", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "perms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "group", "\\u", "permissions_", "(_", "self_", ",_", "package_", ",_", "group_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'", "package", ".", "%", "s", ".", "group", ".", "%", "s", "'_", "%_", "(_", "package_", ",_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "perm", "s", "\\u", "from", "\\u", "short_", "(_", "self_", "._", "\\u", "settings_", "._", "get_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "perms_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "prefix_", "=_", "'", "package", ".", "%", "s", ".", "group", ".'_", "%_", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u", "settings_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "key_", "._", "startswith_", "(_", "group", "\\u", "prefix_", ")_", ":_", "\\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_", "group_", "=_", "key_", "[_", "len_", "(_", "group", "\\u", "prefix_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perms_", "[_", "group_", "]_", "=_", "self_", "._", "\\u", "perm", "s", "\\u", "from", "\\u", "short_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "perms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "permissions_", "(_", "self_", ",_", "package_", ",_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "username_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'", "package", ".", "%", "s", ".", "user", ".", "%", "s", "'_", "%_", "(_", "package_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "perm", "s", "\\u", "from", "\\u", "short_", "(_", "self_", "._", "\\u", "settings_", "._", "get_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "perms_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "prefix_", "=_", "'", "package", ".", "%", "s", ".", "user", ".'_", "%_", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u", "settings_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "key_", "._", "startswith_", "(_", "user", "\\u", "prefix_", ")_", ":_", "\\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_", "user_", "=_", "key_", "[_", "len_", "(_", "user", "\\u", "prefix_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perms_", "[_", "user_", "]_", "=_", "self_", "._", "\\u", "perm", "s", "\\u", "from", "\\u", "short_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "perms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "data_", "(_", "self_", ",_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "username_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "'_", ":_", "self_", "._", "is", "\\u", "admin_", "(_", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "self_", "._", "groups_", "(_", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "prefix_", "=_", "'", "user", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "\\u", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "key_", "._", "startswith_", "(_", "user", "\\u", "prefix_", ")_", ":_", "\\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_", "username_", "=_", "key_", "[_", "len_", "(_", "user", "\\u", "prefix_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "'_", ":_", "self_", "._", "is", "\\u", "admin_", "(_", "username_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "package", "\\u", "permissions_", "(_", "self_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u", "settings_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pieces_", "=_", "key_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "pieces_", ")_", "!=_", "4_", "or_", "pieces_", "[_", "0_", "]_", "!=_", "'", "package", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "pieces_", "[_", "2_", "]_", "!=_", "'", "user", "'_", ")_", ":_", "\\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_", "package_", ",_", "user_", "=_", "pieces_", "[_", "1_", "]_", ",_", "pieces_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "==_", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "package", "'_", ":_", "package_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "self_", "._", "\\u", "perm", "s", "\\u", "from", "\\u", "short_", "(_", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "perms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "group", "\\u", "package", "\\u", "permissions_", "(_", "self_", ",_", "group_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u", "settings_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pieces_", "=_", "key_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "pieces_", ")_", "!=_", "4_", "or_", "pieces_", "[_", "0_", "]_", "!=_", "'", "package", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "pieces_", "[_", "2_", "]_", "!=_", "'", "group", "'_", ")_", ":_", "\\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_", "package_", ",_", "groupname_", "=_", "pieces_", "[_", "1_", "]_", ",_", "pieces_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "group_", "==_", "groupname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "package", "'_", ":_", "package_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "self_", "._", "\\u", "perm", "s", "\\u", "from", "\\u", "short_", "(_", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "perms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Access", "Backend_", "(_", "IA", "ccess", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admins_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "data_", "[_", "'", "users", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", "user", ".", "{", "user", "name", "}", " ", "=", " ", "{", "password", "}'_", "._", "format_", "(_", "**_", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "._", "get_", "(_", "'", "admin", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admins_", "._", "append_", "(_", "user_", "[_", "'", "user", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "admins_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", "auth", ".", "admin", "s", " ", "='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "admin_", "in_", "admins_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", " ", " ", " ", " ", "{", "0", "}'_", "._", "format_", "(_", "admin_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "group_", ",_", "members_", "in_", "data_", "[_", "'", "group", "s", "'_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", "group", ".", "{", "0", "}", " ", "='_", "._", "format_", "(_", "group_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "member_", "in_", "members_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", " ", " ", " ", " ", "{", "0", "}'_", "._", "format_", "(_", "member_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode", "\\u", "permissions_", "(_", "perms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Encode", " ", "a", " ", "permissi", "ons", " ", "list", " ", "as", " ", "the", " ", "r", "/", "rw", " ", "specifica", "tion", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "read", "'_", "in_", "perms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "+=_", "'", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "write", "'_", "in_", "perms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "+=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "package_", ",_", "groups_", "in_", "data_", "[_", "'", "package", "s", "'_", "]_", "[_", "'", "group", "s", "'_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "group_", ",_", "permissions_", "in_", "groups_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", "package", ".", "{", "0", "}.", "group", ".", "{", "1", "}", " ", "=", " ", "{", "2", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "package_", ",_", "group_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encode", "\\u", "permissions_", "(_", "permissions_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "package_", ",_", "users_", "in_", "data_", "[_", "'", "package", "s", "'_", "]_", "[_", "'", "users", "'_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "user_", ",_", "permissions_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", "package", ".", "{", "0", "}.", "user", ".", "{", "1", "}", " ", "=", " ", "{", "2", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "package_", ",_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encode", "\\u", "permissions_", "(_", "permissions_", ")_", ")_", ")_", "\\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_", "'\\\\", "n", "'_", "._", "join_", "(_", "lines_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
scipy/scipy/scipy/optimize/_differentialevolution.py
[ { "content": "\"\"\"\ndifferential_evolution: The differential evolution global optimization algorithm\nAdded by Andrew Nelson 2014\n\"\"\"\nfrom __future__ import division, print_function, absolute_import\nimport numpy as np\nfrom scipy.optimize import OptimizeResult, minimize\nfrom scipy.optimize.optimize import _status_message\nimport numbers\n\n__all__ = ['differential_evolution']\n\n_MACHEPS = np.finfo(np.float64).eps\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def differential_evolution(func, bounds, args=(), strategy='best1bin',\n maxiter=1000, popsize=15, tol=0.01,\n mutation=(0.5, 1), recombination=0.7, seed=None,\n callback=None, disp=False, polish=True,\n init='latinhypercube'):\n \"\"\"Finds the global minimum of a multivariate function.\n Differential Evolution is stochastic in nature (does not use gradient\n methods) to find the minimium, and can search large areas of candidate\n space, but often requires larger numbers of function evaluations than\n conventional gradient based techniques.\n\n The algorithm is due to Storn and Price [1]_.\n\n Parameters\n ----------\n func : callable\n The objective function to be minimized. Must be in the form\n ``f(x, *args)``, where ``x`` is the argument in the form of a 1-D array\n and ``args`` is a tuple of any additional fixed parameters needed to\n completely specify the function.\n bounds : sequence\n Bounds for variables. ``(min, max)`` pairs for each element in ``x``,\n defining the lower and upper bounds for the optimizing argument of\n `func`. It is required to have ``len(bounds) == len(x)``.\n ``len(bounds)`` is used to determine the number of parameters in ``x``.\n args : tuple, optional\n Any additional fixed parameters needed to\n completely specify the objective function.\n strategy : str, optional\n The differential evolution strategy to use. Should be one of:\n\n - 'best1bin'\n - 'best1exp'\n - 'rand1exp'\n - 'randtobest1exp'\n - 'best2exp'\n - 'rand2exp'\n - 'randtobest1bin'\n - 'best2bin'\n - 'rand2bin'\n - 'rand1bin'\n\n The default is 'best1bin'.\n maxiter : int, optional\n The maximum number of generations over which the entire population is\n evolved. The maximum number of function evaluations (with no polishing)\n is: ``(maxiter + 1) * popsize * len(x)``\n popsize : int, optional\n A multiplier for setting the total population size. The population has\n ``popsize * len(x)`` individuals.\n tol : float, optional\n When the mean of the population energies, multiplied by tol,\n divided by the standard deviation of the population energies\n is greater than 1 the solving process terminates:\n ``convergence = mean(pop) * tol / stdev(pop) > 1``\n mutation : float or tuple(float, float), optional\n The mutation constant. In the literature this is also known as\n differential weight, being denoted by F.\n If specified as a float it should be in the range [0, 2].\n If specified as a tuple ``(min, max)`` dithering is employed. Dithering\n randomly changes the mutation constant on a generation by generation\n basis. The mutation constant for that generation is taken from\n ``U[min, max)``. Dithering can help speed convergence significantly.\n Increasing the mutation constant increases the search radius, but will\n slow down convergence.\n recombination : float, optional\n The recombination constant, should be in the range [0, 1]. In the\n literature this is also known as the crossover probability, being\n denoted by CR. Increasing this value allows a larger number of mutants\n to progress into the next generation, but at the risk of population\n stability.\n seed : int or `np.random.RandomState`, optional\n If `seed` is not specified the `np.RandomState` singleton is used.\n If `seed` is an int, a new `np.random.RandomState` instance is used,\n seeded with seed.\n If `seed` is already a `np.random.RandomState instance`, then that\n `np.random.RandomState` instance is used.\n Specify `seed` for repeatable minimizations.\n disp : bool, optional\n Display status messages\n callback : callable, `callback(xk, convergence=val)`, optional\n A function to follow the progress of the minimization. ``xk`` is\n the current value of ``x0``. ``val`` represents the fractional\n value of the population convergence. When ``val`` is greater than one\n the function halts. If callback returns `True`, then the minimization\n is halted (any polishing is still carried out).\n polish : bool, optional\n If True (default), then `scipy.optimize.minimize` with the `L-BFGS-B`\n method is used to polish the best population member at the end, which\n can improve the minimization slightly.\n init : string, optional\n Specify how the population initialization is performed. Should be\n one of:\n\n - 'latinhypercube'\n - 'random'\n\n The default is 'latinhypercube'. Latin Hypercube sampling tries to\n maximize coverage of the available parameter space. 'random' initializes\n the population randomly - this has the drawback that clustering can\n occur, preventing the whole of parameter space being covered.\n\n Returns\n -------\n res : OptimizeResult\n The optimization result represented as a `OptimizeResult` object.\n Important attributes are: ``x`` the solution array, ``success`` a\n Boolean flag indicating if the optimizer exited successfully and\n ``message`` which describes the cause of the termination. See\n `OptimizeResult` for a description of other attributes. If `polish`\n was employed, and a lower minimum was obtained by the polishing, then\n OptimizeResult also contains the ``jac`` attribute.\n\n Notes\n -----\n Differential evolution is a stochastic population based method that is\n useful for global optimization problems. At each pass through the population\n the algorithm mutates each candidate solution by mixing with other candidate\n solutions to create a trial candidate. There are several strategies [2]_ for\n creating trial candidates, which suit some problems more than others. The\n 'best1bin' strategy is a good starting point for many systems. In this\n strategy two members of the population are randomly chosen. Their difference\n is used to mutate the best member (the `best` in `best1bin`), :math:`b_0`,\n so far:\n\n .. math::\n\n b' = b_0 + mutation * (population[rand0] - population[rand1])\n\n A trial vector is then constructed. Starting with a randomly chosen 'i'th\n parameter the trial is sequentially filled (in modulo) with parameters from\n `b'` or the original candidate. The choice of whether to use `b'` or the\n original candidate is made with a binomial distribution (the 'bin' in\n 'best1bin') - a random number in [0, 1) is generated. If this number is\n less than the `recombination` constant then the parameter is loaded from\n `b'`, otherwise it is loaded from the original candidate. The final\n parameter is always loaded from `b'`. Once the trial candidate is built\n its fitness is assessed. If the trial is better than the original candidate\n then it takes its place. If it is also better than the best overall\n candidate it also replaces that.\n To improve your chances of finding a global minimum use higher `popsize`\n values, with higher `mutation` and (dithering), but lower `recombination`\n values. This has the effect of widening the search radius, but slowing\n convergence.\n\n .. versionadded:: 0.15.0\n\n Examples\n --------\n Let us consider the problem of minimizing the Rosenbrock function. This\n function is implemented in `rosen` in `scipy.optimize`.\n\n >>> from scipy.optimize import rosen, differential_evolution\n >>> bounds = [(0,2), (0, 2), (0, 2), (0, 2), (0, 2)]\n >>> result = differential_evolution(rosen, bounds)\n >>> result.x, result.fun\n (array([1., 1., 1., 1., 1.]), 1.9216496320061384e-19)\n\n Next find the minimum of the Ackley function\n (http://en.wikipedia.org/wiki/Test_functions_for_optimization).\n\n >>> from scipy.optimize import differential_evolution\n >>> import numpy as np\n >>> def ackley(x):\n ... arg1 = -0.2 * np.sqrt(0.5 * (x[0] ** 2 + x[1] ** 2))\n ... arg2 = 0.5 * (np.cos(2. * np.pi * x[0]) + np.cos(2. * np.pi * x[1]))\n ... return -20. * np.exp(arg1) - np.exp(arg2) + 20. + np.e\n >>> bounds = [(-5, 5), (-5, 5)]\n >>> result = differential_evolution(ackley, bounds)\n >>> result.x, result.fun\n (array([ 0., 0.]), 4.4408920985006262e-16)\n\n References\n ----------\n .. [1] Storn, R and Price, K, Differential Evolution - a Simple and\n Efficient Heuristic for Global Optimization over Continuous Spaces,\n Journal of Global Optimization, 1997, 11, 341 - 359.\n .. [2] http://www1.icsi.berkeley.edu/~storn/code.html\n .. [3] http://en.wikipedia.org/wiki/Differential_evolution\n \"\"\"\n\n solver = DifferentialEvolutionSolver(func, bounds, args=args,\n strategy=strategy, maxiter=maxiter,\n popsize=popsize, tol=tol,\n mutation=mutation,\n recombination=recombination,\n seed=seed, polish=polish,\n callback=callback,\n disp=disp,\n init=init)\n return solver.solve()", "metadata": "root.differential_evolution", "header": "['module', '___EOS___']", "index": 15 }, { "content": "class DifferentialEvolutionSolver(object):\n\n \"\"\"This class implements the differential evolution solver\n\n Parameters\n ----------\n func : callable\n The objective function to be minimized. Must be in the form\n ``f(x, *args)``, where ``x`` is the argument in the form of a 1-D array\n and ``args`` is a tuple of any additional fixed parameters needed to\n completely specify the function.\n bounds : sequence\n Bounds for variables. ``(min, max)`` pairs for each element in ``x``,\n defining the lower and upper bounds for the optimizing argument of\n `func`. It is required to have ``len(bounds) == len(x)``.\n ``len(bounds)`` is used to determine the number of parameters in ``x``.\n args : tuple, optional\n Any additional fixed parameters needed to\n completely specify the objective function.\n strategy : str, optional\n The differential evolution strategy to use. Should be one of:\n\n - 'best1bin'\n - 'best1exp'\n - 'rand1exp'\n - 'randtobest1exp'\n - 'best2exp'\n - 'rand2exp'\n - 'randtobest1bin'\n - 'best2bin'\n - 'rand2bin'\n - 'rand1bin'\n\n The default is 'best1bin'\n\n maxiter : int, optional\n The maximum number of generations over which the entire population is\n evolved. The maximum number of function evaluations (with no polishing)\n is: ``(maxiter + 1) * popsize * len(x)``\n popsize : int, optional\n A multiplier for setting the total population size. The population has\n ``popsize * len(x)`` individuals.\n tol : float, optional\n When the mean of the population energies, multiplied by tol,\n divided by the standard deviation of the population energies\n is greater than 1 the solving process terminates:\n ``convergence = mean(pop) * tol / stdev(pop) > 1``\n mutation : float or tuple(float, float), optional\n The mutation constant. In the literature this is also known as\n differential weight, being denoted by F.\n If specified as a float it should be in the range [0, 2].\n If specified as a tuple ``(min, max)`` dithering is employed. Dithering\n randomly changes the mutation constant on a generation by generation\n basis. The mutation constant for that generation is taken from\n U[min, max). Dithering can help speed convergence significantly.\n Increasing the mutation constant increases the search radius, but will\n slow down convergence.\n recombination : float, optional\n The recombination constant, should be in the range [0, 1]. In the\n literature this is also known as the crossover probability, being\n denoted by CR. Increasing this value allows a larger number of mutants\n to progress into the next generation, but at the risk of population\n stability.\n seed : int or `np.random.RandomState`, optional\n If `seed` is not specified the `np.random.RandomState` singleton is\n used.\n If `seed` is an int, a new `np.random.RandomState` instance is used,\n seeded with `seed`.\n If `seed` is already a `np.random.RandomState` instance, then that\n `np.random.RandomState` instance is used.\n Specify `seed` for repeatable minimizations.\n disp : bool, optional\n Display status messages\n callback : callable, `callback(xk, convergence=val)`, optional\n A function to follow the progress of the minimization. ``xk`` is\n the current value of ``x0``. ``val`` represents the fractional\n value of the population convergence. When ``val`` is greater than one\n the function halts. If callback returns `True`, then the minimization\n is halted (any polishing is still carried out).\n polish : bool, optional\n If True, then `scipy.optimize.minimize` with the `L-BFGS-B` method\n is used to polish the best population member at the end. This requires\n a few more function evaluations.\n maxfun : int, optional\n Set the maximum number of function evaluations. However, it probably\n makes more sense to set `maxiter` instead.\n init : string, optional\n Specify which type of population initialization is performed. Should be\n one of:\n\n - 'latinhypercube'\n - 'random'\n \"\"\"\n\n # Dispatch of mutation strategy method (binomial or exponential).\n _binomial = {'best1bin': '_best1',\n 'randtobest1bin': '_randtobest1',\n 'best2bin': '_best2',\n 'rand2bin': '_rand2',\n 'rand1bin': '_rand1'}\n _exponential = {'best1exp': '_best1',\n 'rand1exp': '_rand1',\n 'randtobest1exp': '_randtobest1',\n 'best2exp': '_best2',\n 'rand2exp': '_rand2'}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.DifferentialEvolutionSolver", "header": "['module', '___EOS___']", "index": 208 }, { "content": " def __init__(self, func, bounds, args=(),\n strategy='best1bin', maxiter=1000, popsize=15,\n tol=0.01, mutation=(0.5, 1), recombination=0.7, seed=None,\n maxfun=np.inf, callback=None, disp=False, polish=True,\n init='latinhypercube'):\n\n if strategy in self._binomial:\n self.mutation_func = getattr(self, self._binomial[strategy])\n elif strategy in self._exponential:\n self.mutation_func = getattr(self, self._exponential[strategy])\n else:\n raise ValueError(\"Please select a valid mutation strategy\")\n self.strategy = strategy\n\n self.callback = callback\n self.polish = polish\n self.tol = tol\n\n # Mutation constant should be in [0, 2). If specified as a sequence\n # then dithering is performed.\n self.scale = mutation\n if (not np.all(np.isfinite(mutation)) or\n np.any(np.array(mutation) >= 2) or\n np.any(np.array(mutation) < 0)):\n raise ValueError('The mutation constant must be a float in '\n 'U[0, 2), or specified as a tuple(min, max)'\n ' where min < max and min, max are in U[0, 2).')\n\n self.dither = None\n if hasattr(mutation, '__iter__') and len(mutation) > 1:\n self.dither = [mutation[0], mutation[1]]\n self.dither.sort()\n\n self.cross_over_probability = recombination\n\n self.func = func\n self.args = args\n\n # convert tuple of lower and upper bounds to limits\n # [(low_0, high_0), ..., (low_n, high_n]\n # -> [[low_0, ..., low_n], [high_0, ..., high_n]]\n self.limits = np.array(bounds, dtype='float').T\n if (np.size(self.limits, 0) != 2 or not\n np.all(np.isfinite(self.limits))):\n raise ValueError('bounds should be a sequence containing '\n 'real valued (min, max) pairs for each value'\n ' in x')\n\n if maxiter is None: # the default used to be None\n maxiter = 1000\n self.maxiter = maxiter\n if maxfun is None: # the default used to be None\n maxfun = np.inf\n self.maxfun = maxfun\n\n # population is scaled to between [0, 1].\n # We have to scale between parameter <-> population\n # save these arguments for _scale_parameter and\n # _unscale_parameter. This is an optimization\n self.__scale_arg1 = 0.5 * (self.limits[0] + self.limits[1])\n self.__scale_arg2 = np.fabs(self.limits[0] - self.limits[1])\n\n self.parameter_count = np.size(self.limits, 1)\n\n self.random_number_generator = _make_random_gen(seed)\n\n # default population initialization is a latin hypercube design, but\n # there are other population initializations possible.\n self.num_population_members = popsize * self.parameter_count\n\n self.population_shape = (self.num_population_members,\n self.parameter_count)\n\n self._nfev = 0\n if init == 'latinhypercube':\n self.init_population_lhs()\n elif init == 'random':\n self.init_population_random()\n else:\n raise ValueError(\"The population initialization method must be one\"\n \"of 'latinhypercube' or 'random'\")\n\n self.disp = disp", "metadata": "root.DifferentialEvolutionSolver.__init__", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 314 }, { "content": " def init_population_lhs(self):\n \"\"\"\n Initializes the population with Latin Hypercube Sampling.\n Latin Hypercube Sampling ensures that each parameter is uniformly\n sampled over its range.\n \"\"\"\n rng = self.random_number_generator\n\n # Each parameter range needs to be sampled uniformly. The scaled\n # parameter range ([0, 1)) needs to be split into\n # `self.num_population_members` segments, each of which has the following\n # size:\n segsize = 1.0 / self.num_population_members\n\n # Within each segment we sample from a uniform random distribution.\n # We need to do this sampling for each parameter.\n samples = (segsize * rng.random_sample(self.population_shape)\n\n # Offset each segment to cover the entire parameter range [0, 1)\n + np.linspace(0., 1., self.num_population_members,\n endpoint=False)[:, np.newaxis])\n\n # Create an array for population of candidate solutions.\n self.population = np.zeros_like(samples)\n\n # Initialize population of candidate solutions by permutation of the\n # random samples.\n for j in range(self.parameter_count):\n order = rng.permutation(range(self.num_population_members))\n self.population[:, j] = samples[order, j]\n\n # reset population energies\n self.population_energies = (np.ones(self.num_population_members) *\n np.inf)\n\n # reset number of function evaluations counter\n self._nfev = 0", "metadata": "root.DifferentialEvolutionSolver.init_population_lhs", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 398 }, { "content": " def init_population_random(self):\n \"\"\"\n Initialises the population at random. This type of initialization\n can possess clustering, Latin Hypercube sampling is generally better.\n \"\"\"\n rng = self.random_number_generator\n self.population = rng.random_sample(self.population_shape)\n\n # reset population energies\n self.population_energies = (np.ones(self.num_population_members) *\n np.inf)\n\n # reset number of function evaluations counter\n self._nfev = 0", "metadata": "root.DifferentialEvolutionSolver.init_population_random", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 436 }, { "content": " @property\n def x(self):\n \"\"\"\n The best solution from the solver\n\n Returns\n -------\n x : ndarray\n The best solution from the solver.\n \"\"\"\n return self._scale_parameters(self.population[0])", "metadata": "root.DifferentialEvolutionSolver.x", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 451 }, { "content": " @property\n def convergence(self):\n \"\"\"\n The standard deviation of the population energies divided by their\n mean.\n \"\"\"\n return (np.std(self.population_energies) /\n np.abs(np.mean(self.population_energies) + _MACHEPS))", "metadata": "root.DifferentialEvolutionSolver.convergence", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 463 }, { "content": " def solve(self):\n \"\"\"\n Runs the DifferentialEvolutionSolver.\n\n Returns\n -------\n res : OptimizeResult\n The optimization result represented as a ``OptimizeResult`` object.\n Important attributes are: ``x`` the solution array, ``success`` a\n Boolean flag indicating if the optimizer exited successfully and\n ``message`` which describes the cause of the termination. See\n `OptimizeResult` for a description of other attributes. If `polish`\n was employed, and a lower minimum was obtained by the polishing,\n then OptimizeResult also contains the ``jac`` attribute.\n \"\"\"\n nit, warning_flag = 0, False\n status_message = _status_message['success']\n\n # The population may have just been initialized (all entries are\n # np.inf). If it has you have to calculate the initial energies.\n # Although this is also done in the evolve generator it's possible\n # that someone can set maxiter=0, at which point we still want the\n # initial energies to be calculated (the following loop isn't run).\n if np.all(np.isinf(self.population_energies)):\n self._calculate_population_energies()\n\n # do the optimisation.\n for nit in range(1, self.maxiter + 1):\n # evolve the population by a generation\n try:\n next(self)\n except StopIteration:\n warning_flag = True\n status_message = _status_message['maxfev']\n break\n\n if self.disp:\n print(\"differential_evolution step %d: f(x)= %g\"\n % (nit,\n self.population_energies[0]))\n\n # stop when the fractional s.d. of the population is less than tol\n # of the mean energy\n convergence = self.convergence\n\n if (self.callback and\n self.callback(self._scale_parameters(self.population[0]),\n convergence=self.tol / convergence) is True):\n\n warning_flag = True\n status_message = ('callback function requested stop early '\n 'by returning True')\n break\n\n if convergence < self.tol or warning_flag:\n break\n\n else:\n status_message = _status_message['maxiter']\n warning_flag = True\n\n DE_result = OptimizeResult(\n x=self.x,\n fun=self.population_energies[0],\n nfev=self._nfev,\n nit=nit,\n message=status_message,\n success=(warning_flag is not True))\n\n if self.polish:\n result = minimize(self.func,\n np.copy(DE_result.x),\n method='L-BFGS-B',\n bounds=self.limits.T,\n args=self.args)\n\n self._nfev += result.nfev\n DE_result.nfev = self._nfev\n\n if result.fun < DE_result.fun:\n DE_result.fun = result.fun\n DE_result.x = result.x\n DE_result.jac = result.jac\n # to keep internal state consistent\n self.population_energies[0] = result.fun\n self.population[0] = self._unscale_parameters(result.x)\n\n return DE_result", "metadata": "root.DifferentialEvolutionSolver.solve", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 472 }, { "content": " def _calculate_population_energies(self):\n \"\"\"\n Calculate the energies of all the population members at the same time.\n Puts the best member in first place. Useful if the population has just\n been initialised.\n \"\"\"\n for index, candidate in enumerate(self.population):\n if self._nfev > self.maxfun:\n break\n\n parameters = self._scale_parameters(candidate)\n self.population_energies[index] = self.func(parameters,\n *self.args)\n self._nfev += 1\n\n minval = np.argmin(self.population_energies)\n\n # put the lowest energy into the best solution position.\n lowest_energy = self.population_energies[minval]\n self.population_energies[minval] = self.population_energies[0]\n self.population_energies[0] = lowest_energy\n\n self.population[[0, minval], :] = self.population[[minval, 0], :]", "metadata": "root.DifferentialEvolutionSolver._calculate_population_energies", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 561 }, { "content": " def __iter__(self):\n return self", "metadata": "root.DifferentialEvolutionSolver.__iter__", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 585 }, { "content": " def __next__(self):\n \"\"\"\n Evolve the population by a single generation\n\n Returns\n -------\n x : ndarray\n The best solution from the solver.\n fun : float\n Value of objective function obtained from the best solution.\n \"\"\"\n # the population may have just been initialized (all entries are\n # np.inf). If it has you have to calculate the initial energies\n if np.all(np.isinf(self.population_energies)):\n self._calculate_population_energies()\n\n if self.dither is not None:\n self.scale = (self.random_number_generator.rand()\n * (self.dither[1] - self.dither[0]) + self.dither[0])\n\n for candidate in range(self.num_population_members):\n if self._nfev > self.maxfun:\n raise StopIteration\n\n # create a trial solution\n trial = self._mutate(candidate)\n\n # ensuring that it's in the range [0, 1)\n self._ensure_constraint(trial)\n\n # scale from [0, 1) to the actual parameter value\n parameters = self._scale_parameters(trial)\n\n # determine the energy of the objective function\n energy = self.func(parameters, *self.args)\n self._nfev += 1\n\n # if the energy of the trial candidate is lower than the\n # original population member then replace it\n if energy < self.population_energies[candidate]:\n self.population[candidate] = trial\n self.population_energies[candidate] = energy\n\n # if the trial candidate also has a lower energy than the\n # best solution then replace that as well\n if energy < self.population_energies[0]:\n self.population_energies[0] = energy\n self.population[0] = trial\n\n return self.x, self.population_energies[0]", "metadata": "root.DifferentialEvolutionSolver.__next__", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 588 }, { "content": " def next(self):\n \"\"\"\n Evolve the population by a single generation\n\n Returns\n -------\n x : ndarray\n The best solution from the solver.\n fun : float\n Value of objective function obtained from the best solution.\n \"\"\"\n # next() is required for compatibility with Python2.7.\n return self.__next__()", "metadata": "root.DifferentialEvolutionSolver.next", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 639 }, { "content": " def _scale_parameters(self, trial):\n \"\"\"\n scale from a number between 0 and 1 to parameters.\n \"\"\"\n return self.__scale_arg1 + (trial - 0.5) * self.__scale_arg2", "metadata": "root.DifferentialEvolutionSolver._scale_parameters", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 653 }, { "content": " def _unscale_parameters(self, parameters):\n \"\"\"\n scale from parameters to a number between 0 and 1.\n \"\"\"\n return (parameters - self.__scale_arg1) / self.__scale_arg2 + 0.5", "metadata": "root.DifferentialEvolutionSolver._unscale_parameters", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 659 }, { "content": " def _ensure_constraint(self, trial):\n \"\"\"\n make sure the parameters lie between the limits\n \"\"\"\n for index, param in enumerate(trial):\n if param > 1 or param < 0:\n trial[index] = self.random_number_generator.rand()", "metadata": "root.DifferentialEvolutionSolver._ensure_constraint", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 665 }, { "content": " def _mutate(self, candidate):\n \"\"\"\n create a trial vector based on a mutation strategy\n \"\"\"\n trial = np.copy(self.population[candidate])\n\n rng = self.random_number_generator\n\n fill_point = rng.randint(0, self.parameter_count)\n\n if (self.strategy == 'randtobest1exp' or\n self.strategy == 'randtobest1bin'):\n bprime = self.mutation_func(candidate,\n self._select_samples(candidate, 5))\n else:\n bprime = self.mutation_func(self._select_samples(candidate, 5))\n\n if self.strategy in self._binomial:\n crossovers = rng.rand(self.parameter_count)\n crossovers = crossovers < self.cross_over_probability\n # the last one is always from the bprime vector for binomial\n # If you fill in modulo with a loop you have to set the last one to\n # true. If you don't use a loop then you can have any random entry\n # be True.\n crossovers[fill_point] = True\n trial = np.where(crossovers, bprime, trial)\n return trial\n\n elif self.strategy in self._exponential:\n i = 0\n while (i < self.parameter_count and\n rng.rand() < self.cross_over_probability):\n\n trial[fill_point] = bprime[fill_point]\n fill_point = (fill_point + 1) % self.parameter_count\n i += 1\n\n return trial", "metadata": "root.DifferentialEvolutionSolver._mutate", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 673 }, { "content": " def _best1(self, samples):\n \"\"\"\n best1bin, best1exp\n \"\"\"\n r0, r1 = samples[:2]\n return (self.population[0] + self.scale *\n (self.population[r0] - self.population[r1]))", "metadata": "root.DifferentialEvolutionSolver._best1", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 712 }, { "content": " def _rand1(self, samples):\n \"\"\"\n rand1bin, rand1exp\n \"\"\"\n r0, r1, r2 = samples[:3]\n return (self.population[r0] + self.scale *\n (self.population[r1] - self.population[r2]))", "metadata": "root.DifferentialEvolutionSolver._rand1", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 720 }, { "content": " def _randtobest1(self, candidate, samples):\n \"\"\"\n randtobest1bin, randtobest1exp\n \"\"\"\n r0, r1 = samples[:2]\n bprime = np.copy(self.population[candidate])\n bprime += self.scale * (self.population[0] - bprime)\n bprime += self.scale * (self.population[r0] -\n self.population[r1])\n return bprime", "metadata": "root.DifferentialEvolutionSolver._randtobest1", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 728 }, { "content": " def _best2(self, samples):\n \"\"\"\n best2bin, best2exp\n \"\"\"\n r0, r1, r2, r3 = samples[:4]\n bprime = (self.population[0] + self.scale *\n (self.population[r0] + self.population[r1] -\n self.population[r2] - self.population[r3]))\n\n return bprime", "metadata": "root.DifferentialEvolutionSolver._best2", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 739 }, { "content": " def _rand2(self, samples):\n \"\"\"\n rand2bin, rand2exp\n \"\"\"\n r0, r1, r2, r3, r4 = samples\n bprime = (self.population[r0] + self.scale *\n (self.population[r1] + self.population[r2] -\n self.population[r3] - self.population[r4]))\n\n return bprime", "metadata": "root.DifferentialEvolutionSolver._rand2", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 750 }, { "content": " def _select_samples(self, candidate, number_samples):\n \"\"\"\n obtain random integers from range(self.num_population_members),\n without replacement. You can't have the original candidate either.\n \"\"\"\n idxs = list(range(self.num_population_members))\n idxs.remove(candidate)\n self.random_number_generator.shuffle(idxs)\n idxs = idxs[:number_samples]\n return idxs", "metadata": "root.DifferentialEvolutionSolver._select_samples", "header": "['class', 'DifferentialEvolutionSolver', '(', 'object', ')', ':', '___EOS___']", "index": 761 }, { "content": "def _make_random_gen(seed):\n \"\"\"Turn seed into a np.random.RandomState instance\n\n If seed is None, return the RandomState singleton used by np.random.\n If seed is an int, return a new RandomState instance seeded with seed.\n If seed is already a RandomState instance, return it.\n Otherwise raise ValueError.\n \"\"\"\n if seed is None or seed is np.random:\n return np.random.mtrand._rand\n if isinstance(seed, (numbers.Integral, np.integer)):\n return np.random.RandomState(seed)\n if isinstance(seed, np.random.RandomState):\n return seed\n raise ValueError('%r cannot be used to seed a numpy.random.RandomState'\n ' instance' % seed)", "metadata": "root._make_random_gen", "header": "['module', '___EOS___']", "index": 773 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "differential", "\\u", "evolution", ":", " ", "The", " ", "differential", " ", "evolution", " ", "global", " ", "optimization", " ", "algo", "rit", "hm", "\\", "10", ";", "Added", " ", "by", " ", "Andre", "w", " ", "Ne", "lso", "n", " ", "2014", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", ",_", "print", "\\u", "function_", ",_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "optimize_", "import_", "Optimize", "Result_", ",_", "minimize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "optimize_", "._", "optimize_", "import_", "\\u", "status", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numbers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "differential", "\\u", "evolution", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "MAC", "HE", "PS_", "=_", "np_", "._", "finfo", "_", "(_", "np_", "._", "float64_", ")_", "._", "eps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "differential", "\\u", "evolution", "_", "(_", "func_", ",_", "bounds_", ",_", "args_", "=_", "(_", ")_", ",_", "strategy_", "=_", "'", "best", "1b", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maxiter_", "=_", "1000_", ",_", "pops", "ize_", "=_", "15_", ",_", "tol_", "=_", "0.01_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mutation_", "=_", "(_", "0.5_", ",_", "1_", ")_", ",_", "recom", "bin", "ation_", "=_", "0.7_", ",_", "seed_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "None_", ",_", "disp_", "=_", "False_", ",_", "polis", "h_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init_", "=_", "'", "latin", "hyper", "cube", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "ds", " ", "the", " ", "global", " ", "minim", "um", " ", "of", " ", "a", " ", "multivariate", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "Different", "ial", " ", "Evol", "uti", "on", " ", "is", " ", "stochastic", " ", "in", " ", "natur", "e", " ", "(", "doe", "s", " ", "not", " ", "use", " ", "gradi", "ent", "\\", "10", ";", " ", " ", " ", " ", "method", "s", ")", " ", "to", " ", "find", " ", "the", " ", "minim", "ium", ",", " ", "and", " ", "can", " ", "search", " ", "large", " ", "area", "s", " ", "of", " ", "candidate", "\\", "10", ";", " ", " ", " ", " ", "space", ",", " ", "but", " ", "oft", "en", " ", "require", "s", " ", "large", "r", " ", "numbers", " ", "of", " ", "function", " ", "evaluations", " ", "than", "\\", "10", ";", " ", " ", " ", " ", "convention", "al", " ", "gradi", "ent", " ", "based", " ", "technique", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "algo", "rit", "hm", " ", "is", " ", "due", " ", "to", " ", "Stor", "n", " ", "and", " ", "Price", " ", "[", "1", "]\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "func", " ", ":", " ", "calla", "ble", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "objecti", "ve", " ", "function", " ", "to", " ", "be", " ", "minimize", "d", ".", " ", " ", "Mus", "t", " ", "be", " ", "in", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "``", "f", "(", "x", ",", " ", "*", "args", ")`", "`", ",", " ", "where", " ", "``", "x", "``", " ", "is", " ", "the", " ", "argu", "ment", " ", "in", " ", "the", " ", "form", " ", "of", " ", "a", " ", "1", "-", "D", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "``", "args", "``", " ", "is", " ", "a", " ", " ", "tuple", " ", "of", " ", "any", " ", "addition", "al", " ", "fixed", " ", "parameter", "s", " ", "need", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "complete", "ly", " ", "speci", "fy", " ", "the", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "bound", "s", " ", ":", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "Bound", "s", " ", "for", " ", "variab", "les", ".", " ", " ", "``", "(", "min", ",", " ", "max", ")`", "`", " ", "pair", "s", " ", "for", " ", "each", " ", "element", " ", "in", " ", "``", "x", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "defini", "ng", " ", "the", " ", "lower", " ", "and", " ", "upper", " ", "bound", "s", " ", "for", " ", "the", " ", "optim", "izi", "ng", " ", "argu", "ment", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "`", "func", "`.", " ", "It", " ", "is", " ", "require", "d", " ", "to", " ", "have", " ", "``", "len", "(", "bound", "s", ")", " ", "==", " ", "len", "(", "x", ")``.", "\\", "10", ";", " ", " ", " ", " ", "``", "len", "(", "bound", "s", ")`", "`", " ", "is", " ", "used", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "number", " ", "of", " ", "parameter", "s", " ", "in", " ", "``", "x", "``.", "\\", "10", ";", " ", " ", " ", " ", "args", " ", ":", " ", "tuple", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "fixed", " ", "parameter", "s", " ", "need", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "complete", "ly", " ", "speci", "fy", " ", "the", " ", "objecti", "ve", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "strat", "eg", "y", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "differential", " ", "evolution", " ", "strat", "eg", "y", " ", "to", " ", "use", ".", " ", "Sho", "ul", "d", " ", "be", " ", "one", " ", "of", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "1b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "1e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "1e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "tob", "est", "1e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "2e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "2e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "tob", "est", "1b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "2b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "2b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "1b", "in", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "is", " ", "'", "best", "1b", "in", "'.", "\\", "10", ";", " ", " ", " ", " ", "maxi", "ter", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "maxim", "um", " ", "number", " ", "of", " ", "generations", " ", "over", " ", "whi", "ch", " ", "the", " ", "entire", " ", "popul", "ation", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "evolve", "d", ".", " ", "The", " ", "maxim", "um", " ", "number", " ", "of", " ", "function", " ", "evaluations", " ", "(", "with", " ", "no", " ", "polis", "hing", ")", "\\", "10", ";", " ", " ", " ", " ", "is", ":", " ", "``", "(", "maxi", "ter", " ", "+", " ", "1", ")", " ", "*", " ", "pops", "ize", " ", "*", " ", "len", "(", "x", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "pops", "ize", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "multiplie", "r", " ", "for", " ", "setti", "ng", " ", "the", " ", "total", " ", "popul", "ation", " ", "size", ".", " ", " ", "The", " ", "popul", "ation", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "``", "pops", "ize", " ", "*", " ", "len", "(", "x", ")`", "`", " ", "individual", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "tol", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "mean", " ", "of", " ", "the", " ", "popul", "ation", " ", "energ", "ies", ",", " ", "multiplie", "d", " ", "by", " ", "tol", ",", "\\", "10", ";", " ", " ", " ", " ", "divide", "d", " ", "by", " ", "the", " ", "standard", " ", "deviation", " ", "of", " ", "the", " ", "popul", "ation", " ", "energ", "ies", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "great", "er", " ", "than", " ", "1", " ", "the", " ", "solv", "ing", " ", "process", " ", "terminate", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "``", "convergence", " ", "=", " ", "mean", "(", "pop", ")", " ", "*", " ", "tol", " ", "/", " ", "stdev", "(", "pop", ")", " ", ">", " ", "1", "``", "\\", "10", ";", " ", " ", " ", " ", "mutat", "ion", " ", ":", " ", "float", " ", "or", " ", "tuple", "(", "float", ",", " ", "float", "),", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "mutat", "ion", " ", "constant", ".", " ", "In", " ", "the", " ", "litera", "ture", " ", "this", " ", "is", " ", "als", "o", " ", "know", "n", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "differential", " ", "weight", ",", " ", "bei", "ng", " ", "denote", "d", " ", "by", " ", "F", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "specified", " ", "as", " ", "a", " ", "float", " ", "it", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "range", " ", "[", "0", ",", " ", "2", "].", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "specified", " ", "as", " ", "a", " ", "tuple", " ", "``", "(", "min", ",", " ", "max", ")`", "`", " ", "dit", "heri", "ng", " ", "is", " ", "employ", "ed", ".", " ", "Di", "ther", "ing", "\\", "10", ";", " ", " ", " ", " ", "random", "ly", " ", "change", "s", " ", "the", " ", "mutat", "ion", " ", "constant", " ", "on", " ", "a", " ", "generat", "ion", " ", "by", " ", "generat", "ion", "\\", "10", ";", " ", " ", " ", " ", "basi", "s", ".", " ", "The", " ", "mutat", "ion", " ", "constant", " ", "for", " ", "tha", "t", " ", "generat", "ion", " ", "is", " ", "take", "n", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "``", "U", "[", "min", ",", " ", "max", ")``.", " ", "Di", "ther", "ing", " ", "can", " ", "help", " ", "speed", " ", "convergence", " ", "significant", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "Inc", "rea", "sing", " ", "the", " ", "mutat", "ion", " ", "constant", " ", "increase", "s", " ", "the", " ", "search", " ", "radi", "us", ",", " ", "but", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "slow", " ", "down", " ", "convergence", ".", "\\", "10", ";", " ", " ", " ", " ", "recom", "bin", "ation", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "recom", "bin", "ation", " ", "constant", ",", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "range", " ", "[", "0", ",", " ", "1", "].", " ", "In", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "litera", "ture", " ", "this", " ", "is", " ", "als", "o", " ", "know", "n", " ", "as", " ", "the", " ", "crossover", " ", "probabilit", "y", ",", " ", "bei", "ng", "\\", "10", ";", " ", " ", " ", " ", "denote", "d", " ", "by", " ", "CR", ".", " ", "Inc", "rea", "sing", " ", "this", " ", "value", " ", "allow", "s", " ", "a", " ", "large", "r", " ", "number", " ", "of", " ", "mutant", "s", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "progress", " ", "int", "o", " ", "the", " ", "next", " ", "generat", "ion", ",", " ", "but", " ", "at", " ", "the", " ", "risk", " ", "of", " ", "popul", "ation", "\\", "10", ";", " ", " ", " ", " ", "stability", ".", "\\", "10", ";", " ", " ", " ", " ", "seed", " ", ":", " ", "int", " ", "or", " ", "`", "np", ".", "random", ".", "Random", "State", "`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "seed", "`", " ", "is", " ", "not", " ", "specified", " ", "the", " ", "`", "np", ".", "Random", "State", "`", " ", "singleton", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "seed", "`", " ", "is", " ", "an", " ", "int", ",", " ", "a", " ", "new", " ", "`", "np", ".", "random", ".", "Random", "State", "`", " ", "instance", " ", "is", " ", "used", ",", "\\", "10", ";", " ", " ", " ", " ", "seede", "d", " ", "with", " ", "seed", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "seed", "`", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "`", "np", ".", "random", ".", "Random", "State", " ", "instance", "`", ",", " ", "then", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "`", "np", ".", "random", ".", "Random", "State", "`", " ", "instance", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "Speci", "fy", " ", "`", "seed", "`", " ", "for", " ", "repeat", "able", " ", "minim", "izatio", "ns", ".", "\\", "10", ";", " ", " ", " ", " ", "disp", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "status", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "callback", " ", ":", " ", "calla", "ble", ",", " ", "`", "callback", "(", "xk", ",", " ", "convergence", "=", "val", ")`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "function", " ", "to", " ", "follow", " ", "the", " ", "progress", " ", "of", " ", "the", " ", "minim", "izatio", "n", ".", " ", "``", "xk", "``", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "current", " ", "value", " ", "of", " ", "``", "x0", "``.", " ", "``", "val", "``", " ", "represent", "s", " ", "the", " ", "fractional", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "of", " ", "the", " ", "popul", "ation", " ", "convergence", ".", " ", " ", "Whe", "n", " ", "``", "val", "``", " ", "is", " ", "great", "er", " ", "than", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "function", " ", "halt", "s", ".", " ", "If", " ", "callback", " ", "return", "s", " ", "`", "Tru", "e", "`", ",", " ", "then", " ", "the", " ", "minim", "izatio", "n", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "halt", "ed", " ", "(", "any", " ", "polis", "hing", " ", "is", " ", "still", " ", "carri", "ed", " ", "out", ").", "\\", "10", ";", " ", " ", " ", " ", "polis", "h", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", " ", "(", "default", "),", " ", "then", " ", "`", "sci", "py", ".", "optimize", ".", "minimize", "`", " ", "with", " ", "the", " ", "`", "L", "-", "BF", "GS", "-", "B", "`", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "is", " ", "used", " ", "to", " ", "polis", "h", " ", "the", " ", "best", " ", "popul", "ation", " ", "member", " ", "at", " ", "the", " ", "end", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "improve", " ", "the", " ", "minim", "izatio", "n", " ", "slight", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "init", " ", ":", " ", "string", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Speci", "fy", " ", "how", " ", "the", " ", "popul", "ation", " ", "initialization", " ", "is", " ", "perform", "ed", ".", " ", "Sho", "ul", "d", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "of", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "latin", "hyper", "cube", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "random", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "is", " ", "'", "latin", "hyper", "cube", "'.", " ", "Lat", "in", " ", "Hyper", "cube", " ", "samp", "ling", " ", "trie", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "maximize", " ", "covera", "ge", " ", "of", " ", "the", " ", "avail", "able", " ", "parameter", " ", "space", ".", " ", "'", "random", "'", " ", "initialize", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "popul", "ation", " ", "random", "ly", " ", "-", " ", "this", " ", "has", " ", "the", " ", "draw", "back", " ", "tha", "t", " ", "clusteri", "ng", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "occur", ",", " ", "prevent", "ing", " ", "the", " ", "whole", " ", "of", " ", "parameter", " ", "space", " ", "bei", "ng", " ", "covered", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "res", " ", ":", " ", "Optimize", "Result", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "optimization", " ", "result", " ", "represent", "ed", " ", "as", " ", "a", " ", "`", "Optimize", "Result", "`", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Importa", "nt", " ", "attribute", "s", " ", "are", ":", " ", "``", "x", "``", " ", "the", " ", "solut", "ion", " ", "array", ",", " ", "``", "success", "``", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "Boo", "lean", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "the", " ", "optimize", "r", " ", "exit", "ed", " ", "success", "full", "y", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "``", "message", "``", " ", "whi", "ch", " ", "descri", "bes", " ", "the", " ", "caus", "e", " ", "of", " ", "the", " ", "termination", ".", " ", "See", "\\", "10", ";", " ", " ", " ", " ", "`", "Optimize", "Result", "`", " ", "for", " ", "a", " ", "description", " ", "of", " ", "other", " ", "attribute", "s", ".", " ", " ", "If", " ", "`", "polis", "h", "`", "\\", "10", ";", " ", " ", " ", " ", "was", " ", "employ", "ed", ",", " ", "and", " ", "a", " ", "lower", " ", "minim", "um", " ", "was", " ", "obtain", "ed", " ", "by", " ", "the", " ", "polis", "hing", ",", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "Optimize", "Result", " ", "als", "o", " ", "contain", "s", " ", "the", " ", "``", "jac", "``", " ", "attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Different", "ial", " ", "evolution", " ", "is", " ", "a", " ", "stochastic", " ", "popul", "ation", " ", "based", " ", "method", " ", "tha", "t", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "usef", "ul", " ", "for", " ", "global", " ", "optimization", " ", "problem", "s", ".", " ", "At", " ", "each", " ", "pass", " ", "through", " ", "the", " ", "popul", "ation", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "algo", "rit", "hm", " ", "mutate", "s", " ", "each", " ", "candidate", " ", "solut", "ion", " ", "by", " ", "mixing", " ", "with", " ", "other", " ", "candidate", "\\", "10", ";", " ", " ", " ", " ", "solut", "ion", "s", " ", "to", " ", "create", " ", "a", " ", "tria", "l", " ", "candidate", ".", " ", "There", " ", "are", " ", "sever", "al", " ", "strategi", "es", " ", "[", "2", "]\\u", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "creati", "ng", " ", "tria", "l", " ", "candidate", "s", ",", " ", "whi", "ch", " ", "suit", " ", "some", " ", "problem", "s", " ", "more", " ", "than", " ", "other", "s", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "'", "best", "1b", "in", "'", " ", "strat", "eg", "y", " ", "is", " ", "a", " ", "good", " ", "startin", "g", " ", "point", " ", "for", " ", "many", " ", "system", "s", ".", " ", "In", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "strat", "eg", "y", " ", "two", " ", "member", "s", " ", "of", " ", "the", " ", "popul", "ation", " ", "are", " ", "random", "ly", " ", "chosen", ".", " ", "The", "ir", " ", "difference", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "used", " ", "to", " ", "mutate", " ", "the", " ", "best", " ", "member", " ", "(", "the", " ", "`", "best", "`", " ", "in", " ", "`", "best", "1b", "in", "`)", ",", " ", ":", "math", ":`", "b", "\\u", "0", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "far", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "b", "'", " ", "=", " ", "b", "\\u", "0", " ", "+", " ", "mutat", "ion", " ", "*", " ", "(", "popul", "ation", "[", "rand", "0", "]", " ", "-", " ", "popul", "ation", "[", "rand", "1", "])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "tria", "l", " ", "vector", " ", "is", " ", "then", " ", "construct", "ed", ".", " ", "Start", "ing", " ", "with", " ", "a", " ", "random", "ly", " ", "chosen", " ", "'", "i", "'", "th", "\\", "10", ";", " ", " ", " ", " ", "parameter", " ", "the", " ", "tria", "l", " ", "is", " ", "sequential", "ly", " ", "filled", " ", "(", "in", " ", "modulo", ")", " ", "with", " ", "parameter", "s", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "`", "b", "'`", " ", "or", " ", "the", " ", "original", " ", "candidate", ".", " ", "The", " ", "choice", " ", "of", " ", "whe", "ther", " ", "to", " ", "use", " ", "`", "b", "'`", " ", "or", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "original", " ", "candidate", " ", "is", " ", "made", " ", "with", " ", "a", " ", "binomial", " ", "distribu", "tion", " ", "(", "the", " ", "'", "bin", "'", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "'", "best", "1b", "in", "')", " ", "-", " ", "a", " ", "random", " ", "number", " ", "in", " ", "[", "0", ",", " ", "1", ")", " ", "is", " ", "generat", "ed", ".", " ", " ", "If", " ", "this", " ", "number", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "less", " ", "than", " ", "the", " ", "`", "recom", "bin", "ation", "`", " ", "constant", " ", "then", " ", "the", " ", "parameter", " ", "is", " ", "load", "ed", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "`", "b", "'`", ",", " ", "other", "wis", "e", " ", "it", " ", "is", " ", "load", "ed", " ", "from", " ", "the", " ", "original", " ", "candidate", ".", " ", " ", "The", " ", "final", "\\", "10", ";", " ", " ", " ", " ", "parameter", " ", "is", " ", "alw", "ay", "s", " ", "load", "ed", " ", "from", " ", "`", "b", "'`", ".", " ", " ", "On", "ce", " ", "the", " ", "tria", "l", " ", "candidate", " ", "is", " ", "bui", "lt", "\\", "10", ";", " ", " ", " ", " ", "its", " ", "fitness", " ", "is", " ", "assess", "ed", ".", " ", "If", " ", "the", " ", "tria", "l", " ", "is", " ", "bett", "er", " ", "than", " ", "the", " ", "original", " ", "candidate", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "it", " ", "take", "s", " ", "its", " ", "place", ".", " ", "If", " ", "it", " ", "is", " ", "als", "o", " ", "bett", "er", " ", "than", " ", "the", " ", "best", " ", "over", "all", "\\", "10", ";", " ", " ", " ", " ", "candidate", " ", "it", " ", "als", "o", " ", "replace", "s", " ", "tha", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "improve", " ", "your", " ", "chan", "ces", " ", "of", " ", "finding", " ", "a", " ", "global", " ", "minim", "um", " ", "use", " ", "higher", " ", "`", "pops", "ize", "`", "\\", "10", ";", " ", " ", " ", " ", "values", ",", " ", "with", " ", "higher", " ", "`", "mutat", "ion", "`", " ", "and", " ", "(", "dit", "heri", "ng", "),", " ", "but", " ", "lower", " ", "`", "recom", "bin", "ation", "`", "\\", "10", ";", " ", " ", " ", " ", "values", ".", " ", "Thi", "s", " ", "has", " ", "the", " ", "effect", " ", "of", " ", "wide", "ning", " ", "the", " ", "search", " ", "radi", "us", ",", " ", "but", " ", "slow", "ing", "\\", "10", ";", " ", " ", " ", " ", "convergence", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "0.15", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "Let", " ", "us", " ", "consider", " ", "the", " ", "problem", " ", "of", " ", "minim", "izi", "ng", " ", "the", " ", "Rose", "nbr", "ock", " ", "function", ".", " ", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "is", " ", "implemented", " ", "in", " ", "`", "rose", "n", "`", " ", "in", " ", "`", "sci", "py", ".", "optimize", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "sci", "py", ".", "optimize", " ", "import", " ", "rose", "n", ",", " ", "differential", "\\u", "evolution", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "bound", "s", " ", "=", " ", "[(", "0", ",", "2", "),", " ", "(", "0", ",", " ", "2", "),", " ", "(", "0", ",", " ", "2", "),", " ", "(", "0", ",", " ", "2", "),", " ", "(", "0", ",", " ", "2", ")]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "result", " ", "=", " ", "differential", "\\u", "evolution", "(", "rose", "n", ",", " ", "bound", "s", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "result", ".", "x", ",", " ", "result", ".", "fun", "\\", "10", ";", " ", " ", " ", " ", "(", "array", "([", "1", ".,", " ", "1", ".,", " ", "1", ".,", " ", "1", ".,", " ", "1", ".]", "),", " ", "1.9", "216", "496", "3200", "613", "84", "e-1", "9", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ne", "xt", " ", "find", " ", "the", " ", "minim", "um", " ", "of", " ", "the", " ", "Ack", "ley", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "(", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Test", "\\u", "function", "s", "\\u", "for", "\\u", "optimization", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "sci", "py", ".", "optimize", " ", "import", " ", "differential", "\\u", "evolution", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "nump", "y", " ", "as", " ", "np", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "def", " ", "ack", "ley", "(", "x", "):", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "arg", "1", " ", "=", " ", "-0", ".2", " ", "*", " ", "np", ".", "sqrt", "(", "0.", "5", " ", "*", " ", "(", "x", "[", "0", "]", " ", "**", " ", "2", " ", "+", " ", "x", "[", "1", "]", " ", "**", " ", "2", "))\\", "10", ";", " ", " ", " ", " ", "...", " ", "arg", "2", " ", "=", " ", "0.", "5", " ", "*", " ", "(", "np", ".", "cos", "(", "2", ".", " ", "*", " ", "np", ".", "pi", " ", "*", " ", "x", "[", "0", "])", " ", "+", " ", "np", ".", "cos", "(", "2", ".", " ", "*", " ", "np", ".", "pi", " ", "*", " ", "x", "[", "1", "]))", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "return", " ", "-", "20.", " ", "*", " ", "np", ".", "exp", "(", "arg", "1", ")", " ", "-", " ", "np", ".", "exp", "(", "arg", "2", ")", " ", "+", " ", "20.", " ", "+", " ", "np", ".", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "bound", "s", " ", "=", " ", "[(", "-", "5", ",", " ", "5", "),", " ", "(-", "5", ",", " ", "5", ")]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "result", " ", "=", " ", "differential", "\\u", "evolution", "(", "ack", "ley", ",", " ", "bound", "s", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "result", ".", "x", ",", " ", "result", ".", "fun", "\\", "10", ";", " ", " ", " ", " ", "(", "array", "([", " ", "0.", ",", " ", " ", "0.", "])", ",", " ", "4.4", "408", "920", "985", "006", "262", "e-1", "6", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "1", "]", " ", "Stor", "n", ",", " ", "R", " ", "and", " ", "Price", ",", " ", "K", ",", " ", "Different", "ial", " ", "Evol", "uti", "on", " ", "-", " ", "a", " ", "Simple", " ", "and", "\\", "10", ";", " ", " ", " ", "Efficien", "t", " ", "He", "uris", "tic", " ", "for", " ", "Global", " ", "Optim", "izatio", "n", " ", "over", " ", "Continu", "ous", " ", "Spaces", ",", "\\", "10", ";", " ", " ", " ", "Journ", "al", " ", "of", " ", "Global", " ", "Optim", "izatio", "n", ",", " ", "1997", ",", " ", "11", ",", " ", "341", " ", "-", " ", "359", ".", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "2", "]", " ", "http", "://", "www", "1", ".", "ics", "i", ".", "ber", "kel", "ey", ".", "edu", "/", "~", "stor", "n", "/", "code", ".", "html", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "3", "]", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Different", "ial", "\\u", "evolution", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "solver_", "=_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "func_", ",_", "bounds_", ",_", "args_", "=_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strategy_", "=_", "strategy_", ",_", "maxiter_", "=_", "maxiter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pops", "ize_", "=_", "pops", "ize_", ",_", "tol_", "=_", "tol_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mutation_", "=_", "mutation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recom", "bin", "ation_", "=_", "recom", "bin", "ation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seed_", "=_", "seed_", ",_", "polis", "h_", "=_", "polis", "h_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disp_", "=_", "disp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init_", "=_", "init_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "solver_", "._", "solve_", "(_", ")_", "\\u\\u\\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_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "class", " ", "implement", "s", " ", "the", " ", "differential", " ", "evolution", " ", "solve", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "func", " ", ":", " ", "calla", "ble", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "objecti", "ve", " ", "function", " ", "to", " ", "be", " ", "minimize", "d", ".", " ", " ", "Mus", "t", " ", "be", " ", "in", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "``", "f", "(", "x", ",", " ", "*", "args", ")`", "`", ",", " ", "where", " ", "``", "x", "``", " ", "is", " ", "the", " ", "argu", "ment", " ", "in", " ", "the", " ", "form", " ", "of", " ", "a", " ", "1", "-", "D", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "``", "args", "``", " ", "is", " ", "a", " ", " ", "tuple", " ", "of", " ", "any", " ", "addition", "al", " ", "fixed", " ", "parameter", "s", " ", "need", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "complete", "ly", " ", "speci", "fy", " ", "the", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "bound", "s", " ", ":", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "Bound", "s", " ", "for", " ", "variab", "les", ".", " ", " ", "``", "(", "min", ",", " ", "max", ")`", "`", " ", "pair", "s", " ", "for", " ", "each", " ", "element", " ", "in", " ", "``", "x", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "defini", "ng", " ", "the", " ", "lower", " ", "and", " ", "upper", " ", "bound", "s", " ", "for", " ", "the", " ", "optim", "izi", "ng", " ", "argu", "ment", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "`", "func", "`.", " ", "It", " ", "is", " ", "require", "d", " ", "to", " ", "have", " ", "``", "len", "(", "bound", "s", ")", " ", "==", " ", "len", "(", "x", ")``.", "\\", "10", ";", " ", " ", " ", " ", "``", "len", "(", "bound", "s", ")`", "`", " ", "is", " ", "used", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "number", " ", "of", " ", "parameter", "s", " ", "in", " ", "``", "x", "``.", "\\", "10", ";", " ", " ", " ", " ", "args", " ", ":", " ", "tuple", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "fixed", " ", "parameter", "s", " ", "need", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "complete", "ly", " ", "speci", "fy", " ", "the", " ", "objecti", "ve", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "strat", "eg", "y", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "differential", " ", "evolution", " ", "strat", "eg", "y", " ", "to", " ", "use", ".", " ", "Sho", "ul", "d", " ", "be", " ", "one", " ", "of", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "1b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "1e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "1e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "tob", "est", "1e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "2e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "2e", "xp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "tob", "est", "1b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "best", "2b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "2b", "in", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "rand", "1b", "in", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "is", " ", "'", "best", "1b", "in", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "maxi", "ter", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "maxim", "um", " ", "number", " ", "of", " ", "generations", " ", "over", " ", "whi", "ch", " ", "the", " ", "entire", " ", "popul", "ation", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "evolve", "d", ".", " ", "The", " ", "maxim", "um", " ", "number", " ", "of", " ", "function", " ", "evaluations", " ", "(", "with", " ", "no", " ", "polis", "hing", ")", "\\", "10", ";", " ", " ", " ", " ", "is", ":", " ", "``", "(", "maxi", "ter", " ", "+", " ", "1", ")", " ", "*", " ", "pops", "ize", " ", "*", " ", "len", "(", "x", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "pops", "ize", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "multiplie", "r", " ", "for", " ", "setti", "ng", " ", "the", " ", "total", " ", "popul", "ation", " ", "size", ".", " ", " ", "The", " ", "popul", "ation", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "``", "pops", "ize", " ", "*", " ", "len", "(", "x", ")`", "`", " ", "individual", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "tol", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "mean", " ", "of", " ", "the", " ", "popul", "ation", " ", "energ", "ies", ",", " ", "multiplie", "d", " ", "by", " ", "tol", ",", "\\", "10", ";", " ", " ", " ", " ", "divide", "d", " ", "by", " ", "the", " ", "standard", " ", "deviation", " ", "of", " ", "the", " ", "popul", "ation", " ", "energ", "ies", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "great", "er", " ", "than", " ", "1", " ", "the", " ", "solv", "ing", " ", "process", " ", "terminate", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "``", "convergence", " ", "=", " ", "mean", "(", "pop", ")", " ", "*", " ", "tol", " ", "/", " ", "stdev", "(", "pop", ")", " ", ">", " ", "1", "``", "\\", "10", ";", " ", " ", " ", " ", "mutat", "ion", " ", ":", " ", "float", " ", "or", " ", "tuple", "(", "float", ",", " ", "float", "),", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "mutat", "ion", " ", "constant", ".", " ", "In", " ", "the", " ", "litera", "ture", " ", "this", " ", "is", " ", "als", "o", " ", "know", "n", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "differential", " ", "weight", ",", " ", "bei", "ng", " ", "denote", "d", " ", "by", " ", "F", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "specified", " ", "as", " ", "a", " ", "float", " ", "it", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "range", " ", "[", "0", ",", " ", "2", "].", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "specified", " ", "as", " ", "a", " ", "tuple", " ", "``", "(", "min", ",", " ", "max", ")`", "`", " ", "dit", "heri", "ng", " ", "is", " ", "employ", "ed", ".", " ", "Di", "ther", "ing", "\\", "10", ";", " ", " ", " ", " ", "random", "ly", " ", "change", "s", " ", "the", " ", "mutat", "ion", " ", "constant", " ", "on", " ", "a", " ", "generat", "ion", " ", "by", " ", "generat", "ion", "\\", "10", ";", " ", " ", " ", " ", "basi", "s", ".", " ", "The", " ", "mutat", "ion", " ", "constant", " ", "for", " ", "tha", "t", " ", "generat", "ion", " ", "is", " ", "take", "n", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "U", "[", "min", ",", " ", "max", ").", " ", "Di", "ther", "ing", " ", "can", " ", "help", " ", "speed", " ", "convergence", " ", "significant", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "Inc", "rea", "sing", " ", "the", " ", "mutat", "ion", " ", "constant", " ", "increase", "s", " ", "the", " ", "search", " ", "radi", "us", ",", " ", "but", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "slow", " ", "down", " ", "convergence", ".", "\\", "10", ";", " ", " ", " ", " ", "recom", "bin", "ation", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "recom", "bin", "ation", " ", "constant", ",", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "range", " ", "[", "0", ",", " ", "1", "].", " ", "In", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "litera", "ture", " ", "this", " ", "is", " ", "als", "o", " ", "know", "n", " ", "as", " ", "the", " ", "crossover", " ", "probabilit", "y", ",", " ", "bei", "ng", "\\", "10", ";", " ", " ", " ", " ", "denote", "d", " ", "by", " ", "CR", ".", " ", "Inc", "rea", "sing", " ", "this", " ", "value", " ", "allow", "s", " ", "a", " ", "large", "r", " ", "number", " ", "of", " ", "mutant", "s", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "progress", " ", "int", "o", " ", "the", " ", "next", " ", "generat", "ion", ",", " ", "but", " ", "at", " ", "the", " ", "risk", " ", "of", " ", "popul", "ation", "\\", "10", ";", " ", " ", " ", " ", "stability", ".", "\\", "10", ";", " ", " ", " ", " ", "seed", " ", ":", " ", "int", " ", "or", " ", "`", "np", ".", "random", ".", "Random", "State", "`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "seed", "`", " ", "is", " ", "not", " ", "specified", " ", "the", " ", "`", "np", ".", "random", ".", "Random", "State", "`", " ", "singleton", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "seed", "`", " ", "is", " ", "an", " ", "int", ",", " ", "a", " ", "new", " ", "`", "np", ".", "random", ".", "Random", "State", "`", " ", "instance", " ", "is", " ", "used", ",", "\\", "10", ";", " ", " ", " ", " ", "seede", "d", " ", "with", " ", "`", "seed", "`.", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "seed", "`", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "`", "np", ".", "random", ".", "Random", "State", "`", " ", "instance", ",", " ", "then", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "`", "np", ".", "random", ".", "Random", "State", "`", " ", "instance", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "Speci", "fy", " ", "`", "seed", "`", " ", "for", " ", "repeat", "able", " ", "minim", "izatio", "ns", ".", "\\", "10", ";", " ", " ", " ", " ", "disp", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "status", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "callback", " ", ":", " ", "calla", "ble", ",", " ", "`", "callback", "(", "xk", ",", " ", "convergence", "=", "val", ")`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "function", " ", "to", " ", "follow", " ", "the", " ", "progress", " ", "of", " ", "the", " ", "minim", "izatio", "n", ".", " ", "``", "xk", "``", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "current", " ", "value", " ", "of", " ", "``", "x0", "``.", " ", "``", "val", "``", " ", "represent", "s", " ", "the", " ", "fractional", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "of", " ", "the", " ", "popul", "ation", " ", "convergence", ".", " ", " ", "Whe", "n", " ", "``", "val", "``", " ", "is", " ", "great", "er", " ", "than", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "function", " ", "halt", "s", ".", " ", "If", " ", "callback", " ", "return", "s", " ", "`", "Tru", "e", "`", ",", " ", "then", " ", "the", " ", "minim", "izatio", "n", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "halt", "ed", " ", "(", "any", " ", "polis", "hing", " ", "is", " ", "still", " ", "carri", "ed", " ", "out", ").", "\\", "10", ";", " ", " ", " ", " ", "polis", "h", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "then", " ", "`", "sci", "py", ".", "optimize", ".", "minimize", "`", " ", "with", " ", "the", " ", "`", "L", "-", "BF", "GS", "-", "B", "`", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "used", " ", "to", " ", "polis", "h", " ", "the", " ", "best", " ", "popul", "ation", " ", "member", " ", "at", " ", "the", " ", "end", ".", " ", "Thi", "s", " ", "require", "s", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "few", " ", "more", " ", "function", " ", "evaluations", ".", "\\", "10", ";", " ", " ", " ", " ", "maxf", "un", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "function", " ", "evaluations", ".", " ", "Ho", "we", "ver", ",", " ", "it", " ", "probab", "ly", "\\", "10", ";", " ", " ", " ", " ", "make", "s", " ", "more", " ", "sense", " ", "to", " ", "set", " ", "`", "maxi", "ter", "`", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "init", " ", ":", " ", "string", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Speci", "fy", " ", "whi", "ch", " ", "type", " ", "of", " ", "popul", "ation", " ", "initialization", " ", "is", " ", "perform", "ed", ".", " ", "Sho", "ul", "d", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "of", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "latin", "hyper", "cube", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "random", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dispa", "tch", " ", "of", " ", "mutat", "ion", " ", "strat", "eg", "y", " ", "method", " ", "(", "binomial", " ", "or", " ", "exponential", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "binomial", "_", "=_", "{_", "'", "best", "1b", "in", "'_", ":_", "'\\u", "best", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rand", "tob", "est", "1b", "in", "'_", ":_", "'\\u", "rand", "tob", "est", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "best", "2b", "in", "'_", ":_", "'\\u", "best", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rand", "2b", "in", "'_", ":_", "'\\u", "rand", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rand", "1b", "in", "'_", ":_", "'\\u", "rand", "1", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "exponential", "_", "=_", "{_", "'", "best", "1e", "xp", "'_", ":_", "'\\u", "best", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rand", "1e", "xp", "'_", ":_", "'\\u", "rand", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rand", "tob", "est", "1e", "xp", "'_", ":_", "'\\u", "rand", "tob", "est", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "best", "2e", "xp", "'_", ":_", "'\\u", "best", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rand", "2e", "xp", "'_", ":_", "'\\u", "rand", "2", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "func_", ",_", "bounds_", ",_", "args_", "=_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strategy_", "=_", "'", "best", "1b", "in", "'_", ",_", "maxiter_", "=_", "1000_", ",_", "pops", "ize_", "=_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "0.01_", ",_", "mutation_", "=_", "(_", "0.5_", ",_", "1_", ")_", ",_", "recom", "bin", "ation_", "=_", "0.7_", ",_", "seed_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maxf", "un_", "=_", "np_", "._", "inf_", ",_", "callback_", "=_", "None_", ",_", "disp_", "=_", "False_", ",_", "polis", "h_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init_", "=_", "'", "latin", "hyper", "cube", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "strategy_", "in_", "self_", "._", "\\u", "binomial", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mutat", "ion", "\\u", "func_", "=_", "getattr_", "(_", "self_", ",_", "self_", "._", "\\u", "binomial", "_", "[_", "strategy_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "strategy_", "in_", "self_", "._", "\\u", "exponential", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mutat", "ion", "\\u", "func_", "=_", "getattr_", "(_", "self_", ",_", "self_", "._", "\\u", "exponential", "_", "[_", "strategy_", "]_", ")_", "\\u\\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_", "(_", "\"", "Ple", "ase", " ", "select", " ", "a", " ", "valid", " ", "mutat", "ion", " ", "strat", "eg", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "strategy_", "=_", "strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "callback_", "=_", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "polis", "h_", "=_", "polis", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tol_", "=_", "tol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mutation", " ", "constant", " ", "shou", "ld", " ", "be", " ", "in", " ", "[", "0", ",", " ", "2", ").", " ", "If", " ", "specified", " ", "as", " ", "a", " ", "sequence_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "dit", "heri", "ng", " ", "is", " ", "perform", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "scale_", "=_", "mutation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "np_", "._", "all_", "(_", "np_", "._", "isfinite_", "(_", "mutation_", ")_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "any_", "(_", "np_", "._", "array_", "(_", "mutation_", ")_", ">=_", "2_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "any_", "(_", "np_", "._", "array_", "(_", "mutation_", ")_", "<_", "0_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "The", " ", "mutat", "ion", " ", "constant", " ", "must", " ", "be", " ", "a", " ", "float", " ", "in", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "U", "[", "0", ",", " ", "2", "),", " ", "or", " ", "specified", " ", "as", " ", "a", " ", "tuple", "(", "min", ",", " ", "max", ")'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "where", " ", "min", " ", "<", " ", "max", " ", "and", " ", "min", ",", " ", "max", " ", "are", " ", "in", " ", "U", "[", "0", ",", " ", "2", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dit", "her_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "mutation_", ",_", "'\\u", "\\u", "iter", "\\u\\u'_", ")_", "and_", "len_", "(_", "mutation_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dit", "her_", "=_", "[_", "mutation_", "[_", "0_", "]_", ",_", "mutation_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dit", "her_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cross", "\\u", "over", "\\u", "probability_", "=_", "recom", "bin", "ation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "func_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "tuple", " ", "of", " ", "lower", " ", "and", " ", "upper", " ", "bound", "s", " ", "to", " ", "limits_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[(", "low", "\\u", "0", ",", " ", "high", "\\u", "0", "),", " ", "...", ",", " ", "(", "low", "\\u", "n", ",", " ", "high", "\\u", "n", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "->", " ", "[[", "low", "\\u", "0", ",", " ", "...", ",", " ", "low", "\\u", "n", "],", " ", "[", "high", "\\u", "0", ",", " ", "...", ",", " ", "high", "\\u", "n", "]]", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "limits_", "=_", "np_", "._", "array_", "(_", "bounds_", ",_", "dtype_", "=_", "'", "float", "'_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "np_", "._", "size_", "(_", "self_", "._", "limits_", ",_", "0_", ")_", "!=_", "2_", "or_", "not_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "all_", "(_", "np_", "._", "isfinite_", "(_", "self_", "._", "limits_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "bound", "s", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "contain", "ing", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "real", " ", "valued", " ", "(", "min", ",", " ", "max", ")", " ", "pair", "s", " ", "for", " ", "each", " ", "value", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "in", " ", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "maxiter_", "is_", "None_", ":_", "#", " ", "the", " ", "default", " ", "used", " ", "to", " ", "be", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxiter_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "maxiter_", "=_", "maxiter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "maxf", "un_", "is_", "None_", ":_", "#", " ", "the", " ", "default", " ", "used", " ", "to", " ", "be", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxf", "un_", "=_", "np_", "._", "inf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "maxf", "un_", "=_", "maxf", "un_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "popul", "ation", " ", "is", " ", "scale", "d", " ", "to", " ", "bet", "ween", " ", "[", "0", ",", " ", "1", "].", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "to", " ", "scale", " ", "bet", "ween", " ", "parameter", " ", "<-", ">", " ", "population_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "these", " ", "argu", "ment", "s", " ", "for", " ", "\\u", "scale", "\\u", "parameter", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "unsc", "ale", "\\u", "parameter", ".", " ", "Thi", "s", " ", "is", " ", "an", " ", "optimization", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "scale", "\\u", "arg1_", "=_", "0.5_", "*_", "(_", "self_", "._", "limits_", "[_", "0_", "]_", "+_", "self_", "._", "limits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "scale", "\\u", "arg2_", "=_", "np_", "._", "fabs_", "(_", "self_", "._", "limits_", "[_", "0_", "]_", "-_", "self_", "._", "limits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parameter", "\\u", "count_", "=_", "np_", "._", "size_", "(_", "self_", "._", "limits_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "random", "\\u", "number", "\\u", "generator_", "=_", "\\u", "make", "\\u", "random", "\\u", "gen_", "(_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "popul", "ation", " ", "initialization", " ", "is", " ", "a", " ", "latin", " ", "hyper", "cube", " ", "design", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "are", " ", "other", " ", "popul", "ation", " ", "initialization", "s", " ", "possib", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", "=_", "pops", "ize_", "*_", "self_", "._", "parameter", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "shape_", "=_", "(_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parameter", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "nfe", "v_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "init_", "==_", "'", "latin", "hyper", "cube", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "popul", "ation", "\\u", "lhs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "init_", "==_", "'", "random", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "popul", "ation", "\\u", "random_", "(_", ")_", "\\u\\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_", "(_", "\"", "The", " ", "popul", "ation", " ", "initialization", " ", "method", " ", "must", " ", "be", " ", "one", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "of", " ", "'", "latin", "hyper", "cube", "'", " ", "or", " ", "'", "random", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "disp_", "=_", "disp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "popul", "ation", "\\u", "lhs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "es", " ", "the", " ", "popul", "ation", " ", "with", " ", "Lat", "in", " ", "Hyper", "cube", " ", "Sampl", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "Lat", "in", " ", "Hyper", "cube", " ", "Sampl", "ing", " ", "ensure", "s", " ", "tha", "t", " ", "each", " ", "parameter", " ", "is", " ", "uniform", "ly", "\\", "10", ";", " ", " ", " ", " ", "sample", "d", " ", "over", " ", "its", " ", "range", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rng_", "=_", "self_", "._", "random", "\\u", "number", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ea", "ch", " ", "parameter", " ", "range", " ", "need", "s", " ", "to", " ", "be", " ", "sample", "d", " ", "uniform", "ly", ".", " ", "The", " ", "scaled_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameter", " ", "range", " ", "([", "0", ",", " ", "1", "))", " ", "need", "s", " ", "to", " ", "be", " ", "split", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "self", ".", "num", "\\u", "popul", "ation", "\\u", "member", "s", "`", " ", "segments", ",", " ", "each", " ", "of", " ", "whi", "ch", " ", "has", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "size", ":_", "\\u\\u\\uNL\\u\\u\\u_", "seg", "size_", "=_", "1.0_", "/_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "With", "in", " ", "each", " ", "segment", " ", "we", " ", "sample", " ", "from", " ", "a", " ", "uniform", " ", "random", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "do", " ", "this", " ", "samp", "ling", " ", "for", " ", "each", " ", "parameter", "._", "\\u\\u\\uNL\\u\\u\\u_", "samples_", "=_", "(_", "seg", "size_", "*_", "rng_", "._", "random", "\\u", "sample_", "(_", "self_", "._", "popul", "ation", "\\u", "shape_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Off", "set", " ", "each", " ", "segment", " ", "to", " ", "cover", " ", "the", " ", "entire", " ", "parameter", " ", "range", " ", "[", "0", ",", " ", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "np_", "._", "linspace_", "(_", "0._", ",_", "1._", ",_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint_", "=_", "False_", ")_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "array", " ", "for", " ", "popul", "ation", " ", "of", " ", "candidate", " ", "solut", "ion", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "population_", "=_", "np_", "._", "zero", "s", "\\u", "like_", "(_", "samples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "popul", "ation", " ", "of", " ", "candidate", " ", "solut", "ion", "s", " ", "by", " ", "permutation", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "random", " ", "samples", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "self_", "._", "parameter", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "rng_", "._", "permutation_", "(_", "range_", "(_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "population_", "[_", ":_", ",_", "j_", "]_", "=_", "samples_", "[_", "order_", ",_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "popul", "ation", " ", "energies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "=_", "(_", "np_", "._", "ones_", "(_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", ")_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "number", " ", "of", " ", "function", " ", "evaluations", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "nfe", "v_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "popul", "ation", "\\u", "random_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initialise", "s", " ", "the", " ", "popul", "ation", " ", "at", " ", "random", ".", " ", " ", "Thi", "s", " ", "type", " ", "of", " ", "initialization", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "poss", "ess", " ", "clusteri", "ng", ",", " ", "Lat", "in", " ", "Hyper", "cube", " ", "samp", "ling", " ", "is", " ", "genera", "ll", "y", " ", "bett", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rng_", "=_", "self_", "._", "random", "\\u", "number", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "population_", "=_", "rng_", "._", "random", "\\u", "sample_", "(_", "self_", "._", "popul", "ation", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "popul", "ation", " ", "energies_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "=_", "(_", "np_", "._", "ones_", "(_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", ")_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "number", " ", "of", " ", "function", " ", "evaluations", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "nfe", "v_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "best", " ", "solut", "ion", " ", "from", " ", "the", " ", "solve", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "x", " ", ":", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "best", " ", "solut", "ion", " ", "from", " ", "the", " ", "solve", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "scale", "\\u", "parameters_", "(_", "self_", "._", "population_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "convergence", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "standard", " ", "deviation", " ", "of", " ", "the", " ", "popul", "ation", " ", "energ", "ies", " ", "divide", "d", " ", "by", " ", "thei", "r", "\\", "10", ";", " ", " ", " ", " ", "mean", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "np_", "._", "std_", "(_", "self_", "._", "popul", "ation", "\\u", "energies_", ")_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "abs_", "(_", "np_", "._", "mean_", "(_", "self_", "._", "popul", "ation", "\\u", "energies_", ")_", "+_", "\\u", "MAC", "HE", "PS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "solve_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "Different", "ial", "Evol", "uti", "on", "Solve", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "res", " ", ":", " ", "Optimize", "Result", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "optimization", " ", "result", " ", "represent", "ed", " ", "as", " ", "a", " ", "``", "Optimize", "Result", "``", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "Importa", "nt", " ", "attribute", "s", " ", "are", ":", " ", "``", "x", "``", " ", "the", " ", "solut", "ion", " ", "array", ",", " ", "``", "success", "``", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "Boo", "lean", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "the", " ", "optimize", "r", " ", "exit", "ed", " ", "success", "full", "y", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "``", "message", "``", " ", "whi", "ch", " ", "descri", "bes", " ", "the", " ", "caus", "e", " ", "of", " ", "the", " ", "termination", ".", " ", "See", "\\", "10", ";", " ", " ", " ", " ", "`", "Optimize", "Result", "`", " ", "for", " ", "a", " ", "description", " ", "of", " ", "other", " ", "attribute", "s", ".", " ", " ", "If", " ", "`", "polis", "h", "`", "\\", "10", ";", " ", " ", " ", " ", "was", " ", "employ", "ed", ",", " ", "and", " ", "a", " ", "lower", " ", "minim", "um", " ", "was", " ", "obtain", "ed", " ", "by", " ", "the", " ", "polis", "hing", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "Optimize", "Result", " ", "als", "o", " ", "contain", "s", " ", "the", " ", "``", "jac", "``", " ", "attribute", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nit_", ",_", "warn", "ing", "\\u", "flag_", "=_", "0_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "message_", "=_", "\\u", "status", "\\u", "message_", "[_", "'", "success", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "popul", "ation", " ", "may", " ", "have", " ", "just", " ", "bee", "n", " ", "initialize", "d", " ", "(", "all", " ", "entri", "es", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "np", ".", "inf", ").", " ", "If", " ", "it", " ", "has", " ", "you", " ", "have", " ", "to", " ", "calcul", "ate", " ", "the", " ", "initial", " ", "energ", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Alt", "hou", "gh", " ", "this", " ", "is", " ", "als", "o", " ", "don", "e", " ", "in", " ", "the", " ", "evolve", " ", "generat", "or", " ", "it", "'", "s", " ", "possible_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "some", "one", " ", "can", " ", "set", " ", "maxi", "ter", "=", "0", ",", " ", "at", " ", "whi", "ch", " ", "point", " ", "we", " ", "still", " ", "want", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "initial", " ", "energ", "ies", " ", "to", " ", "be", " ", "calculated", " ", "(", "the", " ", "follow", "ing", " ", "loop", " ", "isn", "'", "t", " ", "run", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "all_", "(_", "np_", "._", "isinf", "_", "(_", "self_", "._", "popul", "ation", "\\u", "energies_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "calcul", "ate", "\\u", "popul", "ation", "\\u", "energies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "the", " ", "optimis", "ation", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "nit_", "in_", "range_", "(_", "1_", ",_", "self_", "._", "maxiter_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "evolve", " ", "the", " ", "popul", "ation", " ", "by", " ", "a", " ", "generation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "(_", "self_", ")_", "\\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 ", " _", "warn", "ing", "\\u", "flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "message_", "=_", "\\u", "status", "\\u", "message_", "[_", "'", "maxf", "ev", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "disp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "differential", "\\u", "evolution", " ", "step", " ", "%", "d", ":", " ", "f", "(", "x", ")=", " ", "%", "g", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "nit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stop", " ", "whe", "n", " ", "the", " ", "fractional", " ", "s", ".", "d", ".", " ", "of", " ", "the", " ", "popul", "ation", " ", "is", " ", "less", " ", "than", " ", "tol_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "mean", " ", "energy_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "convergence", "_", "=_", "self_", "._", "convergence", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "callback_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "callback_", "(_", "self_", "._", "\\u", "scale", "\\u", "parameters_", "(_", "self_", "._", "population_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "convergence", "_", "=_", "self_", "._", "tol_", "/_", "convergence", "_", ")_", "is_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warn", "ing", "\\u", "flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "message_", "=_", "(_", "'", "callback", " ", "function", " ", "request", "ed", " ", "stop", " ", "ear", "ly", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "by", " ", "return", "ing", " ", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "convergence", "_", "<_", "self_", "._", "tol_", "or_", "warn", "ing", "\\u", "flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "message_", "=_", "\\u", "status", "\\u", "message_", "[_", "'", "maxi", "ter", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "ing", "\\u", "flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DE", "\\u", "result_", "=_", "Optimize", "Result_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "self_", "._", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fun_", "=_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nfe", "v_", "=_", "self_", "._", "\\u", "nfe", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nit_", "=_", "nit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "status", "\\u", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "success_", "=_", "(_", "warn", "ing", "\\u", "flag_", "is_", "not_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "polis", "h_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "minimize_", "(_", "self_", "._", "func_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "copy_", "(_", "DE", "\\u", "result_", "._", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "L", "-", "BF", "GS", "-", "B", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bounds_", "=_", "self_", "._", "limits_", "._", "T_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "self_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "nfe", "v_", "+=_", "result_", "._", "nfe", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DE", "\\u", "result_", "._", "nfe", "v_", "=_", "self_", "._", "\\u", "nfe", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", "._", "fun_", "<_", "DE", "\\u", "result_", "._", "fun_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DE", "\\u", "result_", "._", "fun_", "=_", "result_", "._", "fun_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DE", "\\u", "result_", "._", "x_", "=_", "result_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DE", "\\u", "result_", "._", "jac_", "=_", "result_", "._", "jac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "to", " ", "keep", " ", "internal", " ", "state", " ", "consistent", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", "=_", "result_", "._", "fun_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "population_", "[_", "0_", "]_", "=_", "self_", "._", "\\u", "unsc", "ale", "\\u", "parameters_", "(_", "result_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "DE", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "calcul", "ate", "\\u", "popul", "ation", "\\u", "energies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "e", " ", "the", " ", "energ", "ies", " ", "of", " ", "all", " ", "the", " ", "popul", "ation", " ", "member", "s", " ", "at", " ", "the", " ", "same", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "Put", "s", " ", "the", " ", "best", " ", "member", " ", "in", " ", "first", " ", "place", ".", " ", "Us", "efu", "l", " ", "if", " ", "the", " ", "popul", "ation", " ", "has", " ", "just", "\\", "10", ";", " ", " ", " ", " ", "bee", "n", " ", "initialise", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "candidate_", "in_", "enumerate_", "(_", "self_", "._", "population_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "nfe", "v_", ">_", "self_", "._", "maxf", "un_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parameters_", "=_", "self_", "._", "\\u", "scale", "\\u", "parameters_", "(_", "candidate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "index_", "]_", "=_", "self_", "._", "func_", "(_", "parameters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "self_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "nfe", "v_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "minval_", "=_", "np_", "._", "argmin_", "(_", "self_", "._", "popul", "ation", "\\u", "energies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "put", " ", "the", " ", "lowe", "st", " ", "energ", "y", " ", "int", "o", " ", "the", " ", "best", " ", "solut", "ion", " ", "position", "._", "\\u\\u\\uNL\\u\\u\\u_", "lowe", "st", "\\u", "energy_", "=_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "minval_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "minval_", "]_", "=_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", "=_", "lowe", "st", "\\u", "energy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "population_", "[_", "[_", "0_", ",_", "minval_", "]_", ",_", ":_", "]_", "=_", "self_", "._", "population_", "[_", "[_", "minval_", ",_", "0_", "]_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "next\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Evol", "ve", " ", "the", " ", "popul", "ation", " ", "by", " ", "a", " ", "single", " ", "generat", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "x", " ", ":", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "best", " ", "solut", "ion", " ", "from", " ", "the", " ", "solve", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "fun", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Value", " ", "of", " ", "objecti", "ve", " ", "function", " ", "obtain", "ed", " ", "from", " ", "the", " ", "best", " ", "solut", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "popul", "ation", " ", "may", " ", "have", " ", "just", " ", "bee", "n", " ", "initialize", "d", " ", "(", "all", " ", "entri", "es", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "np", ".", "inf", ").", " ", "If", " ", "it", " ", "has", " ", "you", " ", "have", " ", "to", " ", "calcul", "ate", " ", "the", " ", "initial", " ", "energies_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "all_", "(_", "np_", "._", "isinf", "_", "(_", "self_", "._", "popul", "ation", "\\u", "energies_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "calcul", "ate", "\\u", "popul", "ation", "\\u", "energies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "dit", "her_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scale_", "=_", "(_", "self_", "._", "random", "\\u", "number", "\\u", "generator_", "._", "rand_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "(_", "self_", "._", "dit", "her_", "[_", "1_", "]_", "-_", "self_", "._", "dit", "her_", "[_", "0_", "]_", ")_", "+_", "self_", "._", "dit", "her_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "candidate_", "in_", "range_", "(_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "nfe", "v_", ">_", "self_", "._", "maxf", "un_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "tria", "l", " ", "solution_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trial_", "=_", "self_", "._", "\\u", "mutate_", "(_", "candidate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ens", "uri", "ng", " ", "tha", "t", " ", "it", "'", "s", " ", "in", " ", "the", " ", "range", " ", "[", "0", ",", " ", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ensure", "\\u", "constraint_", "(_", "trial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scale", " ", "from", " ", "[", "0", ",", " ", "1", ")", " ", "to", " ", "the", " ", "actual", " ", "parameter", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "self_", "._", "\\u", "scale", "\\u", "parameters_", "(_", "trial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "the", " ", "energ", "y", " ", "of", " ", "the", " ", "objecti", "ve", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "energy_", "=_", "self_", "._", "func_", "(_", "parameters_", ",_", "*_", "self_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "nfe", "v_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "energ", "y", " ", "of", " ", "the", " ", "tria", "l", " ", "candidate", " ", "is", " ", "lower", " ", "than", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "original", " ", "popul", "ation", " ", "member", " ", "then", " ", "replace", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "energy_", "<_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "candidate_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "population_", "[_", "candidate_", "]_", "=_", "trial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "candidate_", "]_", "=_", "energy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "tria", "l", " ", "candidate", " ", "als", "o", " ", "has", " ", "a", " ", "lower", " ", "energ", "y", " ", "than", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "best", " ", "solut", "ion", " ", "then", " ", "replace", " ", "tha", "t", " ", "as", " ", "well_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "energy_", "<_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", "=_", "energy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "population_", "[_", "0_", "]_", "=_", "trial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "x_", ",_", "self_", "._", "popul", "ation", "\\u", "energies_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Evol", "ve", " ", "the", " ", "popul", "ation", " ", "by", " ", "a", " ", "single", " ", "generat", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "x", " ", ":", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "best", " ", "solut", "ion", " ", "from", " ", "the", " ", "solve", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "fun", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Value", " ", "of", " ", "objecti", "ve", " ", "function", " ", "obtain", "ed", " ", "from", " ", "the", " ", "best", " ", "solut", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "next", "()", " ", "is", " ", "require", "d", " ", "for", " ", "compatibility", " ", "with", " ", "Pyth", "on2", ".7", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "next\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "scale", "\\u", "parameters_", "(_", "self_", ",_", "trial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "scale", " ", "from", " ", "a", " ", "number", " ", "bet", "ween", " ", "0", " ", "and", " ", "1", " ", "to", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "scale", "\\u", "arg1_", "+_", "(_", "trial_", "-_", "0.5_", ")_", "*_", "self_", "._", "\\u\\u", "scale", "\\u", "arg2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "unsc", "ale", "\\u", "parameters_", "(_", "self_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "scale", " ", "from", " ", "parameter", "s", " ", "to", " ", "a", " ", "number", " ", "bet", "ween", " ", "0", " ", "and", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "parameters_", "-_", "self_", "._", "\\u\\u", "scale", "\\u", "arg1_", ")_", "/_", "self_", "._", "\\u\\u", "scale", "\\u", "arg2_", "+_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ensure", "\\u", "constraint_", "(_", "self_", ",_", "trial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "make", " ", "sure", " ", "the", " ", "parameter", "s", " ", "lie", " ", "bet", "ween", " ", "the", " ", "limit", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "param_", "in_", "enumerate_", "(_", "trial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "param_", ">_", "1_", "or_", "param_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trial_", "[_", "index_", "]_", "=_", "self_", "._", "random", "\\u", "number", "\\u", "generator_", "._", "rand_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "mutate_", "(_", "self_", ",_", "candidate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "a", " ", "tria", "l", " ", "vector", " ", "based", " ", "on", " ", "a", " ", "mutat", "ion", " ", "strat", "eg", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trial_", "=_", "np_", "._", "copy_", "(_", "self_", "._", "population_", "[_", "candidate_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", "=_", "self_", "._", "random", "\\u", "number", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fill", "\\u", "point_", "=_", "rng_", "._", "randint_", "(_", "0_", ",_", "self_", "._", "parameter", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "strategy_", "==_", "'", "rand", "tob", "est", "1e", "xp", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "strategy_", "==_", "'", "rand", "tob", "est", "1b", "in", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bpr", "ime_", "=_", "self_", "._", "mutat", "ion", "\\u", "func_", "(_", "candidate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "select", "\\u", "samples_", "(_", "candidate_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bpr", "ime_", "=_", "self_", "._", "mutat", "ion", "\\u", "func_", "(_", "self_", "._", "\\u", "select", "\\u", "samples_", "(_", "candidate_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "strategy_", "in_", "self_", "._", "\\u", "binomial", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crossover", "s_", "=_", "rng_", "._", "rand_", "(_", "self_", "._", "parameter", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crossover", "s_", "=_", "crossover", "s_", "<_", "self_", "._", "cross", "\\u", "over", "\\u", "probability_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "one", " ", "is", " ", "alw", "ay", "s", " ", "from", " ", "the", " ", "bpr", "ime", " ", "vector", " ", "for", " ", "binomial", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "fill", " ", "in", " ", "modulo", " ", "with", " ", "a", " ", "loop", " ", "you", " ", "have", " ", "to", " ", "set", " ", "the", " ", "last", " ", "one", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "true", ".", " ", "If", " ", "you", " ", "don", "'", "t", " ", "use", " ", "a", " ", "loop", " ", "then", " ", "you", " ", "can", " ", "have", " ", "any", " ", "random", " ", "entry_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "crossover", "s_", "[_", "fill", "\\u", "point_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trial_", "=_", "np_", "._", "where_", "(_", "crossover", "s_", ",_", "bpr", "ime_", ",_", "trial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "trial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "strategy_", "in_", "self_", "._", "\\u", "exponential", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "i_", "<_", "self_", "._", "parameter", "\\u", "count_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", "._", "rand_", "(_", ")_", "<_", "self_", "._", "cross", "\\u", "over", "\\u", "probability_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trial_", "[_", "fill", "\\u", "point_", "]_", "=_", "bpr", "ime_", "[_", "fill", "\\u", "point_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fill", "\\u", "point_", "=_", "(_", "fill", "\\u", "point_", "+_", "1_", ")_", "%_", "self_", "._", "parameter", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "trial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "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", "best", "1_", "(_", "self_", ",_", "samples_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "best", "1b", "in", ",", " ", "best", "1e", "xp", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r0_", ",_", "r1_", "=_", "samples_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", "._", "population_", "[_", "0_", "]_", "+_", "self_", "._", "scale_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "population_", "[_", "r0_", "]_", "-_", "self_", "._", "population_", "[_", "r1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rand", "1_", "(_", "self_", ",_", "samples_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "rand", "1b", "in", ",", " ", "rand", "1e", "xp", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r0_", ",_", "r1_", ",_", "r2_", "=_", "samples_", "[_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", "._", "population_", "[_", "r0_", "]_", "+_", "self_", "._", "scale_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "population_", "[_", "r1_", "]_", "-_", "self_", "._", "population_", "[_", "r2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rand", "tob", "est", "1_", "(_", "self_", ",_", "candidate_", ",_", "samples_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "rand", "tob", "est", "1b", "in", ",", " ", "rand", "tob", "est", "1e", "xp", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r0_", ",_", "r1_", "=_", "samples_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bpr", "ime_", "=_", "np_", "._", "copy_", "(_", "self_", "._", "population_", "[_", "candidate_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bpr", "ime_", "+=_", "self_", "._", "scale_", "*_", "(_", "self_", "._", "population_", "[_", "0_", "]_", "-_", "bpr", "ime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bpr", "ime_", "+=_", "self_", "._", "scale_", "*_", "(_", "self_", "._", "population_", "[_", "r0_", "]_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "population_", "[_", "r1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bpr", "ime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "best", "2_", "(_", "self_", ",_", "samples_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "best", "2b", "in", ",", " ", "best", "2e", "xp", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r0_", ",_", "r1_", ",_", "r2_", ",_", "r3_", "=_", "samples_", "[_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bpr", "ime_", "=_", "(_", "self_", "._", "population_", "[_", "0_", "]_", "+_", "self_", "._", "scale_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "population_", "[_", "r0_", "]_", "+_", "self_", "._", "population_", "[_", "r1_", "]_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "population_", "[_", "r2_", "]_", "-_", "self_", "._", "population_", "[_", "r3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bpr", "ime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rand", "2_", "(_", "self_", ",_", "samples_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "rand", "2b", "in", ",", " ", "rand", "2e", "xp", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r0_", ",_", "r1_", ",_", "r2_", ",_", "r3_", ",_", "r4", "_", "=_", "samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bpr", "ime_", "=_", "(_", "self_", "._", "population_", "[_", "r0_", "]_", "+_", "self_", "._", "scale_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "population_", "[_", "r1_", "]_", "+_", "self_", "._", "population_", "[_", "r2_", "]_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "population_", "[_", "r3_", "]_", "-_", "self_", "._", "population_", "[_", "r4", "_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bpr", "ime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Different", "ial", "Evol", "uti", "on", "Solver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "select", "\\u", "samples_", "(_", "self_", ",_", "candidate_", ",_", "number", "\\u", "samples_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "obtain", " ", "random", " ", "integ", "ers", " ", "from", " ", "range", "(", "self", ".", "num", "\\u", "popul", "ation", "\\u", "member", "s", "),", "\\", "10", ";", " ", " ", " ", " ", "with", "out", " ", "replace", "ment", ".", " ", " ", "You", " ", "can", "'", "t", " ", "have", " ", "the", " ", "original", " ", "candidate", " ", "eit", "her", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idxs_", "=_", "list_", "(_", "range_", "(_", "self_", "._", "num", "\\u", "popul", "ation", "\\u", "members_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idxs_", "._", "remove_", "(_", "candidate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "random", "\\u", "number", "\\u", "generator_", "._", "shuffle_", "(_", "idxs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idxs_", "=_", "idxs_", "[_", ":_", "number", "\\u", "samples_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "idxs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "random", "\\u", "gen_", "(_", "seed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Turn", " ", "seed", " ", "int", "o", " ", "a", " ", "np", ".", "random", ".", "Random", "State", " ", "instance", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "seed", " ", "is", " ", "Non", "e", ",", " ", "return", " ", "the", " ", "Random", "State", " ", "singleton", " ", "used", " ", "by", " ", "np", ".", "random", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "seed", " ", "is", " ", "an", " ", "int", ",", " ", "return", " ", "a", " ", "new", " ", "Random", "State", " ", "instance", " ", "seede", "d", " ", "with", " ", "seed", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "seed", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "Random", "State", " ", "instance", ",", " ", "return", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "wis", "e", " ", "raise", " ", "Value", "Error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "seed_", "is_", "None_", "or_", "seed_", "is_", "np_", "._", "random_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "random_", "._", "mtr", "and_", "._", "\\u", "rand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "seed_", ",_", "(_", "numbers_", "._", "Integral_", ",_", "np_", "._", "integer_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "random_", "._", "Random", "State_", "(_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "seed_", ",_", "np_", "._", "random_", "._", "Random", "State_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "seed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "'%", "r", " ", "cann", "ot", " ", "be", " ", "used", " ", "to", " ", "seed", " ", "a", " ", "nump", "y", ".", "random", ".", "Random", "State", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "instance", "'_", "%_", "seed_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
gregmuellegger/django-autofixture/autofixture_tests/tests/test_autodiscover.py
[ { "content": " def test_builtin_fixtures(self):\n from autofixture.autofixtures import UserFixture\n self.assertEqual(autofixture.REGISTRY[User], UserFixture)", "metadata": "root.AutodiscoverTestCase.test_builtin_fixtures", "header": "['class', 'AutodiscoverTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 9 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Auto", "discove", "r", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "bui", "lti", "n", "\\u", "fixtures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "autof", "ix", "ture_", "._", "autof", "ix", "tures", "_", "import_", "User", "Fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "autof", "ix", "ture_", "._", "REGISTRY", "_", "[_", "User_", "]_", ",_", "User", "Fixture_", ")_" ]
[ 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 ]
Unused local variable
scikit-learn/scikit-learn/sklearn/utils/testing.py
[ { "content": " def __repr__(self):\n args = []\n if self._record:\n args.append(\"record=True\")\n if self._module is not sys.modules['warnings']:\n args.append(\"module=%r\" % self._module)\n name = type(self).__name__\n return \"%s(%s)\" % (name, \", \".join(args))", "metadata": "root._IgnoreWarnings.__repr__", "header": "['class', '_IgnoreWarnings', '(', 'object', ')', ':', '___EOS___']", "index": 345 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "\\u", "Ignor", "e", "Warnings", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "\"", "record", "=", "Tru", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "module_", "is_", "not_", "sys_", "._", "modules_", "[_", "'", "warn", "ings", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "\"", "module", "=", "%", "r", "\"_", "%_", "self_", "._", "\\u", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "type_", "(_", "self_", ")_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "(%", "s", ")\"_", "%_", "(_", "name_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "args_", ")_", ")_", "\\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 ]
Use of 'global' at module level
scipy/scipy/scipy/weave/platform_info.py
[ { "content": "def configure_sys_argv(compiler_name):\n # We're gonna play some tricks with argv here to pass info to distutils\n # which is really built for command line use. better way??\n global old_argv\n try:\n old_argv = sys.argv[:]\n except AttributeError:\n pass\n sys.argv = ['','build_ext','--compiler='+compiler_name]", "metadata": "root.configure_sys_argv", "header": "['module', '___EOS___']", "index": 164 } ]
[]
[]
0
true
[ "[CLS]_", "Use_", "of_", "'", "global", "'_", "at_", "module_", "level_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "configur", "e\\u", "sys", "\\u", "argv_", "(_", "compiler", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "gon", "na", " ", "play", " ", "some", " ", "trick", "s", " ", "with", " ", "argv", " ", "here", " ", "to", " ", "pass", " ", "info", " ", "to", " ", "distutils_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "is", " ", "reall", "y", " ", "bui", "lt", " ", "for", " ", "command", " ", "line", " ", "use", ".", " ", "bett", "er", " ", "way", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "old", "\\u", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "argv_", "=_", "sys_", "._", "argv_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "argv_", "=_", "[_", "''_", ",_", "'", "build", "\\u", "ext", "'_", ",_", "'--", "compiler", "='_", "+_", "compiler", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AppScale/appscale/AppDB/dbinterface.py
[ { "content": "# \n# AppScale Datastore Interface \n#\n__author__=\"Soo Hwan Park\"\n__date__=\"$2009.5.5 18:27:00$\"\n\nimport os\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AppDBInterface:\n\n\n\n\n\n\n\n \n\n", "metadata": "root.AppDBInterface", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def get_entity(self, table_name, row_key, column_names, txnid = 0): \n raise NotImplementedError(\"get_entity is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.get_entity", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 9 }, { "content": " def put_entity(self, table_name, row_key, column_names, cell_values, txnid = 0):\n raise NotImplementedError(\"put_entity is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.put_entity", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 12 }, { "content": " def put_entity_dict(self, table_name, row_key, value_dict):\n raise NotImplementedError(\"put_entity_dict is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.put_entity_dict", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 15 }, { "content": " def get_table(self, table_name, column_names, txnid = 0):\n raise NotImplementedError(\"get_table is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.get_table", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 18 }, { "content": " def delete_row(self, table_name, row_id, txnid = 0):\n raise NotImplementedError(\"delete_row is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.delete_row", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 21 }, { "content": " def get_schema(self, table_name):\n raise NotImplementedError(\"get_schema is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.get_schema", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 24 }, { "content": " def delete_table(self, table_name):\n raise NotImplementedError(\"delete_table is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.delete_table", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 27 }, { "content": " def commit(self, txnid):\n raise NotImplementedError(\"commit is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.commit", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 30 }, { "content": " def rollback(self, txnid):\n raise NotImplementedError(\"rollback is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.rollback", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 32 }, { "content": " def setup_transaction(self, txnid):\n raise NotImplementedError(\"rollback is not implemented in %s.\" % self.__class__)", "metadata": "root.AppDBInterface.setup_transaction", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 34 }, { "content": " def get_local_ip(self):\n try:\n local_ip = self.__local_ip\n except AttributeError:\n local_ip = None\n\n if local_ip is None:\n local_ip = os.environ.get(\"LOCAL_DB_IP\")\n\n if local_ip is None:\n raise Exception(\"Env var LOCAL_DB_IP was not set.\")\n else:\n self.__local_ip = local_ip\n\n return self.__local_ip", "metadata": "root.AppDBInterface.get_local_ip", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 38 }, { "content": " def get_master_ip(self):\n try:\n master_ip = self.__master_ip\n except AttributeError:\n master_ip = None\n\n if master_ip is None:\n master_ip = os.environ.get(\"MASTER_IP\")\n\n if master_ip is None:\n raise Exception(\"Env var MASTER_IP was not set.\")\n else:\n self.__master_ip = master_ip\n\n return self.__master_ip", "metadata": "root.AppDBInterface.get_master_ip", "header": "['class', 'AppDBInterface', ':', '___EOS___']", "index": 54 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "App", "Scale", " ", "Datas", "tore", " ", "Interface", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "So", "o", " ", "Hw", "an", " ", "Park", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "date\\u\\u_", "=_", "\"$", "200", "9.5", ".5", " ", "1", "8", ":", "2", "7", ":", "00", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\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_", "App", "DB", "Interface_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "entity_", "(_", "self_", ",_", "table", "\\u", "name_", ",_", "row", "\\u", "key_", ",_", "column", "\\u", "names_", ",_", "tx", "nid_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "get", "\\u", "entity", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put", "\\u", "entity_", "(_", "self_", ",_", "table", "\\u", "name_", ",_", "row", "\\u", "key_", ",_", "column", "\\u", "names_", ",_", "cell", "\\u", "values_", ",_", "tx", "nid_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "put", "\\u", "entity", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put", "\\u", "entity", "\\u", "dict_", "(_", "self_", ",_", "table", "\\u", "name_", ",_", "row", "\\u", "key_", ",_", "value", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "put", "\\u", "entity", "\\u", "dict", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "table_", "(_", "self_", ",_", "table", "\\u", "name_", ",_", "column", "\\u", "names_", ",_", "tx", "nid_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "get", "\\u", "table", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "row_", "(_", "self_", ",_", "table", "\\u", "name_", ",_", "row", "\\u", "id_", ",_", "tx", "nid_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "delete", "\\u", "row", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "schema_", "(_", "self_", ",_", "table", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "get", "\\u", "schema", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "table_", "(_", "self_", ",_", "table", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "delete", "\\u", "table", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit_", "(_", "self_", ",_", "tx", "nid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "commit", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rollback_", "(_", "self_", ",_", "tx", "nid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "rollback", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "transaction_", "(_", "self_", ",_", "tx", "nid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "rollback", " ", "is", " ", "not", " ", "implemented", " ", "in", " ", "%", "s", ".\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "local", "\\u", "ip_", "(_", "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 ", " _", "local", "\\u", "ip_", "=_", "self_", "._", "\\u\\u", "local", "\\u", "ip_", "\\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 ", " _", "local", "\\u", "ip_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "local", "\\u", "ip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "ip_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "LOCAL", "\\u", "DB", "\\u", "IP", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "local", "\\u", "ip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Env", " ", "var", " ", "LOCAL", "\\u", "DB", "\\u", "IP", " ", "was", " ", "not", " ", "set", ".\"_", ")_", "\\u\\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\\u", "local", "\\u", "ip_", "=_", "local", "\\u", "ip_", "\\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_", "self_", "._", "\\u\\u", "local", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "DB", "Interface_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "master", "\\u", "ip_", "(_", "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 ", " _", "master", "\\u", "ip_", "=_", "self_", "._", "\\u\\u", "master", "\\u", "ip_", "\\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 ", " _", "master", "\\u", "ip_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "master", "\\u", "ip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "master", "\\u", "ip_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "MASTER", "\\u", "IP", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "master", "\\u", "ip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Env", " ", "var", " ", "MASTER", "\\u", "IP", " ", "was", " ", "not", " ", "set", ".\"_", ")_", "\\u\\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\\u", "master", "\\u", "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apps/catalogue/abstract_models.py
[ { "content": " def save_value(self, product, value):\n ProductAttributeValue = get_model('catalogue', 'ProductAttributeValue')\n try:\n value_obj = product.attribute_values.get(attribute=self)\n except ProductAttributeValue.DoesNotExist:\n # FileField uses False for announcing deletion of the file\n # not creating a new value\n delete_file = self.is_file and value is False\n if value is None or value == '' or delete_file:\n return\n value_obj = ProductAttributeValue.objects.create(\n product=product, attribute=self)\n\n if self.is_file:\n # File fields in Django are treated differently, see\n # django.db.models.fields.FileField and method save_form_data\n if value is None:\n # No change\n return\n elif value is False:\n # Delete file\n value_obj.delete()\n else:\n # New uploaded file\n value_obj.value = value\n value_obj.save()\n else:\n if value is None or value == '':\n value_obj.delete()\n return\n if value != value_obj.value:\n value_obj.value = value\n value_obj.save()", "metadata": "root.AbstractProductAttribute.save_value", "header": "['class', 'AbstractProductAttribute', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 844 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Abstract", "Product", "Attribute_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "value_", "(_", "self_", ",_", "product_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Product", "Attribute", "Value_", "=_", "get", "\\u", "model_", "(_", "'", "catalogue", "'_", ",_", "'", "Product", "Attribute", "Value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "obj_", "=_", "product_", "._", "attribute", "\\u", "values_", "._", "get_", "(_", "attribute_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Product", "Attribute", "Value_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "File", "Field", " ", "use", "s", " ", "Fal", "se", " ", "for", " ", "anno", "unci", "ng", " ", "deletion", " ", "of", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "creati", "ng", " ", "a", " ", "new", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "\\u", "file_", "=_", "self_", "._", "is", "\\u", "file_", "and_", "value_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", "or_", "value_", "==_", "''_", "or_", "delete", "\\u", "file_", ":_", "\\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_", "value", "\\u", "obj_", "=_", "Product", "Attribute", "Value_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "product_", "=_", "product_", ",_", "attribute_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "File", " ", "fields", " ", "in", " ", "Dj", "ang", "o", " ", "are", " ", "treat", "ed", " ", "different", "ly", ",", " ", "see", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "File", "Field", " ", "and", " ", "method", " ", "save", "\\u", "form", "\\u", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "obj_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "New", " ", "uploade", "d", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "obj_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\\u", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", "or_", "value_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "obj_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "!=_", "value", "\\u", "obj_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "obj_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\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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 ]
Except block handles 'BaseException'
bndr/pipreqs/tests/test_pipreqs.py
[ { "content": " def tearDown(self):\n \"\"\"\n Remove requiremnts.txt files that were written\n \"\"\"\n try:\n os.remove(self.requirements_path)\n except OSError:\n pass\n try:\n os.remove(self.alt_requirement_path)\n except OSError:\n pass", "metadata": "root.TestPipreqs.tearDown", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 172 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "require", "mnt", "s", ".", "txt", " ", "files", " ", "tha", "t", " ", "wer", "e", " ", "writt", "en", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "require", "ment", "s", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "alt", "\\u", "require", "ment", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unnecessary 'else' clause in loop
jamesturk/jellyfish/jellyfish/_jellyfish.py
[ { "content": "def soundex(s):\n if not s:\n return s\n if isinstance(s, bytes):\n raise TypeError(_no_bytes_err)\n\n s = _normalize(s)\n\n replacements = (('bfpv', '1'),\n ('cgjkqsxz', '2'),\n ('dt', '3'),\n ('l', '4'),\n ('mn', '5'),\n ('r', '6'))\n result = [s[0]]\n count = 1\n\n # find would-be replacment for first character\n for lset, sub in replacements:\n if s[0].lower() in lset:\n last = sub\n break\n else:\n last = None\n\n for letter in s[1:]:\n for lset, sub in replacements:\n if letter.lower() in lset:\n if sub != last:\n result.append(sub)\n count += 1\n last = sub\n break\n else:\n last = None\n if count == 4:\n break\n\n result += '0'*(4-count)\n return ''.join(result)", "metadata": "root.soundex", "header": "['module', '___EOS___']", "index": 156 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sound", "ex_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "s_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\\u", "no", "\\u", "bytes", "\\u", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "\\u", "normalize_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "replacements_", "=_", "(_", "(_", "'", "bf", "pv", "'_", ",_", "'", "1", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "cg", "jk", "qs", "xz", "'_", ",_", "'", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dt", "'_", ",_", "'", "3", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "l", "'_", ",_", "'", "4", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mn", "'_", ",_", "'", "5", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "r", "'_", ",_", "'", "6", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "s_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "wou", "ld", "-", "be", " ", "repla", "cm", "ent", " ", "for", " ", "first", " ", "character_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "lse", "t_", ",_", "sub_", "in_", "replacements_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "in_", "lse", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last_", "=_", "sub_", "\\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 ", " _", "last_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "letter_", "in_", "s_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "lse", "t_", ",_", "sub_", "in_", "replacements_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "letter_", "._", "lower_", "(_", ")_", "in_", "lse", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sub_", "!=_", "last_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "._", "append_", "(_", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last_", "=_", "sub_", "\\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 ", " _", "last_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "count_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "+=_", "'", "0", "'_", "*_", "(_", "4_", "-_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
NVIDIA/DIGITS/digits/frameworks/torch_framework.py
[ { "content": " @override\n def get_network_visualization(self, desc):\n \"\"\"\n return visualization of network\n \"\"\"\n # save network description to temporary file\n temp_network_handle, temp_network_path = tempfile.mkstemp(suffix='.lua')\n os.write(temp_network_handle, desc)\n os.close(temp_network_handle)\n\n try: # do this in a try..finally clause to make sure we delete the temp file\n # build command line\n if config_value('torch_root') == '<PATHS>':\n torch_bin = 'th'\n else:\n torch_bin = os.path.join(config_value('torch_root'), 'bin', 'th')\n\n args = [torch_bin,\n os.path.join(os.path.dirname(os.path.dirname(digits.__file__)),'tools','torch','main.lua'),\n '--network=%s' % os.path.splitext(os.path.basename(temp_network_path))[0],\n '--networkDirectory=%s' % os.path.dirname(temp_network_path),\n '--subtractMean=none', # we are not providing a mean image\n '--visualizeModel=yes',\n '--type=float'\n ]\n\n # execute command\n p = subprocess.Popen(args,\n stdout=subprocess.PIPE,\n stderr=subprocess.STDOUT,\n close_fds=True,\n )\n\n regex = re.compile('\\x1b\\[[0-9;]*m', re.UNICODE) #TODO: need to include regular expression for MAC color codes\n\n # the network description will be accumulated from the command output\n # when collecting_net_definition==True\n collecting_net_definition = False\n desc = []\n unrecognized_output = []\n while p.poll() is None:\n for line in utils.nonblocking_readlines(p.stdout):\n if line is not None:\n # Remove whitespace and color codes. color codes are appended to beginning and end of line by torch binary i.e., 'th'. Check the below link for more information\n # https://groups.google.com/forum/#!searchin/torch7/color$20codes/torch7/8O_0lSgSzuA/Ih6wYg9fgcwJ\n line = regex.sub('', line)\n timestamp, level, message = TorchTrainTask.preprocess_output_torch(line.strip())\n if message:\n if message.startswith('Network definition'):\n collecting_net_definition = not collecting_net_definition\n else:\n if collecting_net_definition:\n desc.append(line)\n elif len(line):\n unrecognized_output.append(line)\n else:\n time.sleep(0.05)\n\n if not len(desc):\n # we did not find a network description\n raise NetworkVisualizationError(''.join(unrecognized_output))\n else:\n output = flask.Markup('<pre>')\n for line in desc:\n output += flask.Markup.escape(line)\n output += flask.Markup('</pre>')\n return output\n finally:\n os.remove(temp_network_path)", "metadata": "root.TorchFramework.get_network_visualization", "header": "['class', 'TorchFramework', '(', 'Framework', ')', ':', '___EOS___']", "index": 102 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tor", "ch", "Framework_", "(_", "Framework_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "override_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "network", "\\u", "visualization", "_", "(_", "self_", ",_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "visualization", " ", "of", " ", "network", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "network", " ", "description", " ", "to", " ", "temporar", "y", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "network", "\\u", "handle_", ",_", "temp", "\\u", "network", "\\u", "path_", "=_", "tempfile_", "._", "mkstemp_", "(_", "suffix_", "=_", "'.", "lua", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "write_", "(_", "temp", "\\u", "network", "\\u", "handle_", ",_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "close_", "(_", "temp", "\\u", "network", "\\u", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "#", " ", "do", " ", "this", " ", "in", " ", "a", " ", "try", "..", "final", "ly", " ", "clause", " ", "to", " ", "make", " ", "sure", " ", "we", " ", "delete", " ", "the", " ", "temp", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config", "\\u", "value_", "(_", "'", "torch", "\\u", "root", "'_", ")_", "==_", "'<", "PATH", "S", ">'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "torch", "\\u", "bin_", "=_", "'", "th", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "torch", "\\u", "bin_", "=_", "os_", "._", "path_", "._", "join_", "(_", "config", "\\u", "value_", "(_", "'", "torch", "\\u", "root", "'_", ")_", ",_", "'", "bin", "'_", ",_", "'", "th", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "[_", "torch", "\\u", "bin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "digits_", "._", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "tool", "s", "'_", ",_", "'", "torch", "'_", ",_", "'", "main", ".", "lua", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "network", "=", "%", "s", "'_", "%_", "os_", "._", "path_", "._", "splitext_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "temp", "\\u", "network", "\\u", "path_", ")_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "network", "Director", "y", "=", "%", "s", "'_", "%_", "os_", "._", "path_", "._", "dirname_", "(_", "temp", "\\u", "network", "\\u", "path_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "subtract", "Mea", "n", "=", "none", "'_", ",_", "#", " ", "we", " ", "are", " ", "not", " ", "provi", "ding", " ", "a", " ", "mean", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "visualize", "Model", "=", "ye", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "type", "=", "float", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "execute", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "close", "\\u", "fds_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "re_", "._", "compile_", "(_", "'\\\\", "x1", "b", "\\\\[", "[", "0", "-", "9", ";", "]*", "m", "'_", ",_", "re_", "._", "UNICODE_", ")_", "#", "TOD", "O", ":", " ", "need", " ", "to", " ", "include", " ", "regular", " ", "express", "ion", " ", "for", " ", "MAC", " ", "color", " ", "codes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "network", " ", "description", " ", "will", " ", "be", " ", "accumulated", " ", "from", " ", "the", " ", "command", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "collecti", "ng", "\\u", "net", "\\u", "definit", "ion", "==", "True_", "\\u\\u\\uNL\\u\\u\\u_", "collecti", "ng", "\\u", "net", "\\u", "definition_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unre", "cogni", "zed", "\\u", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "p_", "._", "poll_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "utils_", "._", "nonb", "locking", "\\u", "readlines_", "(_", "p_", "._", "stdout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "line_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "whitespace", " ", "and", " ", "color", " ", "codes", ".", " ", "color", " ", "codes", " ", "are", " ", "append", "ed", " ", "to", " ", "beginn", "ing", " ", "and", " ", "end", " ", "of", " ", "line", " ", "by", " ", "torch", " ", "binar", "y", " ", "i", ".", "e", ".,", " ", "'", "th", "'.", " ", "Check", " ", "the", " ", "belo", "w", " ", "link", " ", "for", " ", "more", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "group", "s", ".", "google", ".", "com", "/", "forum", "/", "#!", "search", "in", "/", "torch", "7", "/", "color", "$", "20", "codes", "/", "torch", "7", "/", "8", "O", "\\u", "0", "l", "Sg", "Sz", "u", "A", "/", "Ih", "6", "w", "Y", "g", "9", "fg", "cw", "J_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "line_", "=_", "regex_", "._", "sub_", "(_", "''_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp_", ",_", "level_", ",_", "message_", "=_", "Tor", "ch", "Train", "Task_", "._", "preproc", "ess", "\\u", "output", "\\u", "torch_", "(_", "line_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "message_", "._", "startswith_", "(_", "'", "Network", " ", "definit", "ion", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "collecti", "ng", "\\u", "net", "\\u", "definition_", "=_", "not_", "collecti", "ng", "\\u", "net", "\\u", "definition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "collecti", "ng", "\\u", "net", "\\u", "definition_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "desc_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unre", "cogni", "zed", "\\u", "output_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "did", " ", "not", " ", "find", " ", "a", " ", "network", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Network", "Visualiza", "tion", "Error_", "(_", "''_", "._", "join_", "(_", "unre", "cogni", "zed", "\\u", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "flask_", "._", "Markup_", "(_", "'<", "pre", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "desc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "+=_", "flask_", "._", "Markup_", "._", "escape_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "+=_", "flask_", "._", "Markup_", "(_", "'<", "/", "pre", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "temp", "\\u", "network", "\\u", "path_", ")_" ]
[ 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, 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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 ]
Comparison of constants
osrg/ryu/ryu/services/protocols/vrrp/event.py
[ { "content": " def __eq__(self, other):\n return (self.version == other.version and\n self.vrid == other.vrid and\n self.priority == other.priority and\n self.ip_addresses == other.ip_addresses and\n self.advertisement_interval == other.advertisement_interval and\n self.preempt_mode == other.preempt_mode and\n self.preempt_delay == other.preempt_delay and\n self.accept_mode == other.accept_mode and\n self.is_ipv6 == other.is_ipv6)", "metadata": "root.VRRPConfig.__eq__", "header": "['class', 'VRRPConfig', '(', 'object', ')', ':', '___EOS___']", "index": 145 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "VR", "RP", "Config_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "version_", "==_", "other_", "._", "version_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vr", "id_", "==_", "other_", "._", "vr", "id_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "priority_", "==_", "other_", "._", "priority_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ip", "\\u", "addresses_", "==_", "other_", "._", "ip", "\\u", "addresses_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "advertise", "ment", "\\u", "interval_", "==_", "other_", "._", "advertise", "ment", "\\u", "interval_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pree", "mpt", "\\u", "mode_", "==_", "other_", "._", "pree", "mpt", "\\u", "mode_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pree", "mpt", "\\u", "delay_", "==_", "other_", "._", "pree", "mpt", "\\u", "delay_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "accept", "\\u", "mode_", "==_", "other_", "._", "accept", "\\u", "mode_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "is", "\\u", "ipv6_", "==_", "other_", "._", "is", "\\u", "ipv6_", ")_", "\\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 ]
Unreachable code
AppScale/appscale/AppServer/lib/django-1.3/tests/regressiontests/admin_util/models.py
[ { "content": "class Article(models.Model):\n \"\"\"\n A simple Article model for testing\n \"\"\"\n site = models.ForeignKey('sites.Site', related_name=\"admin_articles\")\n title = models.CharField(max_length=100)\n title2 = models.CharField(max_length=100, verbose_name=\"another name\")\n created = models.DateTimeField()\n\n\n test_from_model_with_override.short_description = \"not What you Expect\"", "metadata": "root.Article", "header": "['module', '___EOS___']", "index": 2 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Article_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "simple", " ", "Artic", "le", " ", "model", " ", "for", " ", "testi", "ng", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "sites", ".", "Site", "'_", ",_", "relate", "d\\u", "name_", "=_", "\"", "admin", "\\u", "article", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title", "2_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "verbo", "se", "\\u", "name_", "=_", "\"", "anot", "her", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "test\\u", "from", "\\u", "model", "\\u", "with", "\\u", "override_", "._", "short", "\\u", "description_", "=_", "\"", "not", " ", "What", " ", "you", " ", "Expect", "\"_", "\\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 ]
Unused import
jreese/markdown-pp/MarkdownPP/Modules/YoutubeEmbed.py
[ { "content": "# Copyright (C) 2012 Alex Nisnevich\n# Licensed under the MIT license\n\nfrom __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport re\nimport os\nimport urllib\n\nfrom MarkdownPP.Module import Module\nfrom MarkdownPP.Transform import Transform\n\nyoutube_url_re = re.compile('^!VIDEO\\s+\"http://www\\.youtube\\.com'\n '/embed/([a-zA-Z0-9\\-]*)\"')\nglowfoto_server_re = re.compile(\"<uploadform>(.*)</uploadform>\")\nglowfoto_image_re = re.compile(\"<thumburl>(.*)</thumburl>\")\ncodere = re.compile(\"^( |\\t)\")\nfencedcodere = re.compile(\"^```\\w*$\")\n\nplay_button_url = 'http://i.imgur.com/1IHylPh.png'\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class YoutubeEmbed(Module):\n \"\"\"\n Converts Youtube embed objects into links with screenshots,\n taken from Youtube.\n \"\"\"\n", "metadata": "root.YoutubeEmbed", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def transform(self, data):\n transforms = []\n in_fenced_code_block = False\n linenum = 0\n\n for line in data:\n # Handling fenced code blocks (for Github-flavored markdown)\n if fencedcodere.search(line):\n if in_fenced_code_block:\n in_fenced_code_block = False\n else:\n in_fenced_code_block = True\n\n # Are we in a code block?\n if not in_fenced_code_block and not codere.search(line):\n match = youtube_url_re.search(line)\n if match:\n # find URL of youtube video and screenshot\n url = match.group(1)\n image_url = 'http://img.youtube.com/vi/%s/0.jpg' % url\n video_url = 'http://www.youtube.com/watch?v=%s' % url\n processed_image_dir = os.path.join('images', 'youtube')\n processed_image_path = os.path.join(processed_image_dir,\n '%s.png' % url)\n\n # do we already have a screenshot?\n if not os.path.isfile(processed_image_path):\n # try to add a play button to the screenshot\n try:\n import Image\n from tempfile import NamedTemporaryFile\n\n # create directories if needed\n if not os.path.exists(processed_image_dir):\n os.makedirs(processed_image_dir)\n\n # create temporary files for image operations\n screenshot_img = NamedTemporaryFile(suffix=\".jpg\")\n button_img = NamedTemporaryFile(suffix=\".png\")\n\n # grab screenshot and button image\n urllib.urlretrieve(image_url, screenshot_img.name)\n urllib.urlretrieve(play_button_url,\n button_img.name)\n\n # layer the images using PIL and save\n background = Image.open(screenshot_img.name)\n foreground = Image.open(button_img.name)\n background.paste(foreground, (90, 65), foreground)\n background.save(processed_image_path)\n\n except Exception as e:\n print('Unable to add play button to YouTube '\n 'screenshot (%s). Using the screenshot '\n 'on its own instead.' % e)\n\n image_link = ('[![Link to Youtube video](%s)](%s)\\n' %\n (processed_image_path, video_url))\n transforms.append(Transform(linenum, \"swap\", image_link))\n\n linenum += 1\n\n return transforms", "metadata": "root.YoutubeEmbed.transform", "header": "['class', 'YoutubeEmbed', '(', 'Module', ')', ':', '___EOS___']", "index": 30 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", " ", "Alex", " ", "Ni", "sne", "vic", "h_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "MIT", " ", "license_", "\\u\\u\\uNL\\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_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Markdown", "PP", "_", "._", "Module_", "import_", "Module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Markdown", "PP", "_", "._", "Transform_", "import_", "Transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "youtu", "be", "\\u", "url", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "'", "^", "!", "VIDEO", "\\\\", "s", "+\"", "http", "://", "www", "\\\\.", "youtu", "be", "\\\\.", "com", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "embed", "/([", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\\\-]", "*)\"", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glo", "wf", "oto", "\\u", "server", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\"<", "upload", "form", ">(.", "*)", "</", "upload", "form", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glo", "wf", "oto", "\\u", "image", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\"<", "thumb", "url", ">(.", "*)", "</", "thumb", "url", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coder", "e_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "(", " ", " ", " ", " ", "|\\\\", "t", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fence", "dco", "dere", "_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "```", "\\\\", "w", "*$", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "play", "\\u", "button", "\\u", "url_", "=_", "'", "http", "://", "i", ".", "img", "ur", ".", "com", "/", "1", "IH", "yl", "Ph", ".", "png", "'_", "\\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_", "You", "tube", "Embed_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "You", "tube", " ", "embed", " ", "object", "s", " ", "int", "o", " ", "link", "s", " ", "with", " ", "screenshot", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "take", "n", " ", "from", " ", "You", "tube", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "Embed_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transforms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "fence", "d\\u", "code", "\\u", "block_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linenum_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hand", "ling", " ", "fence", "d", " ", "code", " ", "blocks", " ", "(", "for", " ", "Git", "hub", "-", "flavor", "ed", " ", "mark", "down", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fence", "dco", "dere", "_", "._", "search_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "in", "\\u", "fence", "d\\u", "code", "\\u", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "in", "\\u", "fence", "d\\u", "code", "\\u", "block_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "in", "\\u", "fence", "d\\u", "code", "\\u", "block_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Are", " ", "we", " ", "in", " ", "a", " ", "code", " ", "block", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "in", "\\u", "fence", "d\\u", "code", "\\u", "block_", "and_", "not_", "coder", "e_", "._", "search_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "youtu", "be", "\\u", "url", "\\u", "re_", "._", "search_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "URL", " ", "of", " ", "youtu", "be", " ", "video", " ", "and", " ", "screenshot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "url_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "url_", "=_", "'", "http", "://", "img", ".", "youtu", "be", ".", "com", "/", "vi", "/", "%", "s", "/", "0.", "jp", "g", "'_", "%_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "video", "\\u", "url_", "=_", "'", "http", "://", "www", ".", "youtu", "be", ".", "com", "/", "watch", "?", "v", "=", "%", "s", "'_", "%_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "image", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'", "images", "'_", ",_", "'", "youtu", "be", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "image", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "process", "ed", "\\u", "image", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ".", "png", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "we", " ", "alr", "ead", "y", " ", "have", " ", "a", " ", "screenshot", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "process", "ed", "\\u", "image", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "add", " ", "a", " ", "play", " ", "button", " ", "to", " ", "the", " ", "screenshot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tempfile_", "import_", "Name", "d", "Tempora", "ry", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "director", "ies", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "process", "ed", "\\u", "image", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "makedirs_", "(_", "process", "ed", "\\u", "image", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "temporar", "y", " ", "files", " ", "for", " ", "image", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "screenshot", "\\u", "img_", "=_", "Name", "d", "Tempora", "ry", "File_", "(_", "suffix_", "=_", "\".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button", "\\u", "img_", "=_", "Name", "d", "Tempora", "ry", "File_", "(_", "suffix_", "=_", "\".", "png", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gra", "b", " ", "screenshot", " ", "and", " ", "button", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "urllib_", "._", "urlretrieve_", "(_", "image", "\\u", "url_", ",_", "screenshot", "\\u", "img_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urllib_", "._", "urlretrieve_", "(_", "play", "\\u", "button", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "img_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "layer", " ", "the", " ", "images", " ", "usi", "ng", " ", "PI", "L", " ", "and", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "background_", "=_", "Image_", "._", "open_", "(_", "screenshot", "\\u", "img_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foreground_", "=_", "Image_", "._", "open_", "(_", "button", "\\u", "img_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "background_", "._", "paste_", "(_", "foreground_", ",_", "(_", "90_", ",_", "65_", ")_", ",_", "foreground_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "background_", "._", "save_", "(_", "process", "ed", "\\u", "image", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "'", "Una", "ble", " ", "to", " ", "add", " ", "play", " ", "button", " ", "to", " ", "You", "Tu", "be", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "screenshot", " ", "(%", "s", ").", " ", "Us", "ing", " ", "the", " ", "screenshot", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "on", " ", "its", " ", "own", " ", "inst", "ead", ".'_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image", "\\u", "link_", "=_", "(_", "'[", "![", "Link", " ", "to", " ", "You", "tube", " ", "video", "](", "%", "s", ")]", "(%", "s", ")\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "process", "ed", "\\u", "image", "\\u", "path_", ",_", "video", "\\u", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transforms_", "._", "append_", "(_", "Transform_", "(_", "linenum_", ",_", "\"", "swap", "\"_", ",_", "image", "\\u", "link_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "linenum_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "transforms_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
dominno/django-moderation/tests/urls/auto_discover.py
[ { "content": "from __future__ import unicode_literals\ntry:\n from django.conf.urls.defaults import patterns, include, handler500\nexcept ImportError:\n from django.conf.urls import patterns, include, handler500\nfrom django.conf import settings\nfrom django.contrib import admin\nfrom moderation.helpers import auto_discover\n\nadmin.autodiscover()\nauto_discover()\n\nhandler500\n\nurlpatterns = patterns(\n '',\n (r'^admin/', include(admin.site.urls)),\n (r'^media/(?P<path>.*)$', 'django.views.static.serve', {\n 'document_root': settings.MEDIA_ROOT}),\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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "._", "urls_", "._", "defaults_", "import_", "patterns_", ",_", "include_", ",_", "handler", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "patterns_", ",_", "include_", ",_", "handler", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moder", "ation_", "._", "helpers_", "import_", "auto", "\\u", "discover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "._", "autodiscover", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auto", "\\u", "discover_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handler", "500_", "\\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_", "(_", "r", "'", "^", "admin", "/'_", ",_", "include_", "(_", "admin_", "._", "site_", "._", "urls_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'", "^", "media", "/(", "?", "P", "<", "path", ">.*)", "$'_", ",_", "'", "django", ".", "views", ".", "static", ".", "serve", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "document", "\\u", "root", "'_", ":_", "settings_", "._", "MEDIA", "\\u", "ROOT_", "}_", ")_", ",_", "\\u\\u\\uNL\\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
CGATOxford/cgat/dependency_graph/graph.py
[ { "content": "def main():\n import optparse\n parser = optparse.OptionParser(__doc__.strip())\n\n parser.add_option('-f', '--full-pathnames', '--full', action='store_true',\n help=\"Output the full pathnames, not just the relative.\")\n\n parser.add_option('-p', '--pythonify-filenames', '--remove-extensions',\n action='store_true',\n help=\"Remove filename extensions in the graph and \"\n \"replace slashes with dots.\")\n\n parser.add_option('-r', '--redundant', action='store_false', default=True,\n help=\"Do not eliminate redundant dependencies.\")\n\n parser.add_option('--fontsize', action='store', type='int',\n default=10,\n help=\"The size of the font to use for nodes.\")\n\n global opts\n opts, args = parser.parse_args()\n\n if not args:\n args = ['-']\n\n color_map = {}\n\n for fn in args:\n if fn == '-':\n f = sys.stdin\n else:\n f = open(fn)\n depends = read_depends(f)\n if opts.redundant:\n depends = eliminate_redundant_depends(depends)\n graph(depends, sys.stdout.write, opts.fontsize, color_map)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 75 } ]
[]
[]
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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "optparse_", "._", "Optio", "n", "Parser_", "(_", "\\u\\u", "doc\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "f", "'_", ",_", "'--", "full", "-", "path", "names", "'_", ",_", "'--", "full", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Output", " ", "the", " ", "full", " ", "path", "names", ",", " ", "not", " ", "just", " ", "the", " ", "relative", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "p", "'_", ",_", "'--", "python", "if", "y", "-", "filename", "s", "'_", ",_", "'--", "remove", "-", "extensi", "ons", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Remove", " ", "filename", " ", "extensi", "ons", " ", "in", " ", "the", " ", "graph", " ", "and", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "replace", " ", "slash", "es", " ", "with", " ", "dot", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'-", "r", "'_", ",_", "'--", "redundant", "'_", ",_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "default_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Do", " ", "not", " ", "eliminat", "e", " ", "redundant", " ", "dependen", "cies", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "font", "size", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "type_", "=_", "'", "int", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "The", " ", "size", " ", "of", " ", "the", " ", "font", " ", "to", " ", "use", " ", "for", " ", "nodes", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", ",_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "'-'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "color", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fn_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fn_", "==_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "sys_", "._", "stdin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "depends_", "=_", "read", "\\u", "depends_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "redundant", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "depends_", "=_", "eliminat", "e\\u", "redundant", "\\u", "depends_", "(_", "depends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "graph_", "(_", "depends_", ",_", "sys_", "._", "stdout_", "._", "write_", ",_", "opts_", "._", "fontsize_", ",_", "color", "\\u", "map_", ")_", "\\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, 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OLDER = 'public'\nFOLDER = FOLDER.strip('/')\n\nlogging.basicConfig(level=logging.INFO)\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 deploy():\n AWS_BUCKET_NAME = config('AWS_BUCKET_NAME')\n AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')\n AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')\n local(\"s3cmd sync {}/ s3://{} --acl-public --delete-removed \"\n \"--guess-mime-type --access_key={} --secret_key={}\".format(\n FOLDER,\n AWS_BUCKET_NAME,\n AWS_ACCESS_KEY_ID,\n AWS_SECRET_ACCESS_KEY\n )\n )", "metadata": "root.deploy", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def test():\n local(\"python runtests.py\")", "metadata": "root.test", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def runserver():\n local(\"cd %s && python -m SimpleHTTPServer\" % FOLDER)", "metadata": "root.runserver", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def clean():\n local(\"rm -f .klasses.json\")\n local(\"rm -fr %s/*\" % FOLDER)\n local(\"mkdir -p %s/static\" % FOLDER)", "metadata": "root.clean", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def collect_static():\n local(\"cp -r static %s/\" % FOLDER)", "metadata": "root.collect_static", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def build_local():\n clean()\n collect_static()\n index_generator_for_version()\n build_for_version()", "metadata": "root.build_local", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def index_generator_for_version():\n from build_tools.index_generator import main\n main()", "metadata": "root.index_generator_for_version", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def build_for_version():\n from build_tools.compile_static import main\n main(out_folder=FOLDER)", "metadata": "root.build_for_version", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def build():\n clean()\n logging.info(\"collecting statics\")\n collect_static()\n local(\"tox -c build.ini\")", "metadata": "root.build", "header": "['module', '___EOS___']", "index": 61 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "deco", "uple_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "api_", "import_", "local_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FOLDER_", "=_", "'", "public", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FOLDER_", "=_", "FOLDER_", "._", "strip_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "deploy_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "AW", "S", "\\u", "BUCKET", "\\u", "NAME_", "=_", "config_", "(_", "'", "AW", "S", "\\u", "BUCKET", "\\u", "NAME", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID_", "=_", "config_", "(_", "'", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY_", "=_", "config_", "(_", "'", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "(_", "\"", "s3", "cmd", " ", "sync", " ", "{}/", " ", "s3", "://{}", " ", "--", "acl", "-", "public", " ", "--", "delete", "-", "remove", "d", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "guess", "-", "mime", "-", "type", " ", "--", "access", "\\u", "key", "={}", " ", "--", "secret", "\\u", "key", "={}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOLDER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "AW", "S", "\\u", "BUCKET", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local_", "(_", "\"", "python", " ", "runtest", "s", ".", "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_", "def_", "runs", "erver_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local_", "(_", "\"", "cd", " ", "%", "s", " ", "&&", " ", "python", " ", "-", "m", " ", "Simple", "HTTP", "Server", "\"_", "%_", "FOLDER_", ")_", "\\u\\u\\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_", "clean_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local_", "(_", "\"", "rm", " ", "-", "f", " ", ".", "klass", "es", ".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "(_", "\"", "rm", " ", "-", "fr", " ", "%", "s", "/*\"_", "%_", "FOLDER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "(_", "\"", "mkd", "ir", " ", "-", "p", " ", "%", "s", "/", "static", "\"_", "%_", "FOLDER_", ")_", "\\u\\u\\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_", "collect", "\\u", "static_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local_", "(_", "\"", "cp", " ", "-", "r", " ", "static", " ", "%", "s", "/\"_", "%_", "FOLDER_", ")_", "\\u\\u\\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_", "build", "\\u", "local_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collect", "\\u", "static_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "generat", "or", "\\u", "for", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "for", "\\u", "version_", "(_", ")_", "\\u\\u\\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_", "index", "\\u", "generat", "or", "\\u", "for", "\\u", "version_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "build", "\\u", "tools_", "._", "index", "\\u", "generator_", "import_", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main_", "(_", ")_", "\\u\\u\\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_", "build", "\\u", "for", "\\u", "version_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "build", "\\u", "tools_", "._", "compile", "\\u", "static_", "import_", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main_", "(_", "out", "\\u", "folder_", "=_", "FOLDER_", ")_", "\\u\\u\\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_", "build_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "collecti", "ng", " ", "static", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collect", "\\u", "static_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "(_", "\"", "tox", " ", "-", "c", " ", "build", ".", "ini", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
cloudera/hue/desktop/core/ext-py/kazoo-2.0/kazoo/tests/test_connection.py
[ { "content": " def serialize(self):\n b = bytearray()\n b.extend(write_string(self.path))\n b.extend(int_struct.pack(self.version))\n return b", "metadata": "root.Delete.serialize", "header": "['class', 'Delete', '(', 'namedtuple', '(', \"'Delete'\", ',', \"'path version'\", ')', ')', ':', '___EOS___']", "index": 29 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Delete_", "(_", "namedtuple_", "(_", "'", "Delete", "'_", ",_", "'", "path", " ", "version", "'_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "bytearray_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "extend_", "(_", "write", "\\u", "string_", "(_", "self_", "._", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "extend_", "(_", "int\\u", "struct_", "._", "pack_", "(_", "self_", "._", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "b_", "\\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 ]
Imprecise assert
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/ironic/test_patcher.py
[ { "content": " def test_generic_get_deploy_patch_capabilities(self):\n node = ironic_utils.get_test_node(driver='fake')\n self.flavor['extra_specs']['capabilities:boot_mode'] = 'bios'\n expected = [{'path': '/instance_info/capabilities',\n 'value': '{\"boot_mode\": \"bios\"}',\n 'op': 'add'}]\n expected += self._expected_deploy_patch\n patch = patcher.create(node).get_deploy_patch(\n self.instance, self.image_meta, self.flavor)\n self.assertEqual(sorted(expected), sorted(patch))", "metadata": "root.IronicDriverFieldsTestCase.test_generic_get_deploy_patch_capabilities", "header": "['class', 'IronicDriverFieldsTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']", "index": 71 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Iron", "ic", "Drive", "r", "Field", "s", "Test", "Case_", "(_", "test_", "._", "No", "DB", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gener", "ic", "\\u", "get", "\\u", "deploy", "\\u", "patch", "\\u", "capabilities_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "ironic", "\\u", "utils_", "._", "get", "\\u", "test\\u", "node_", "(_", "driver_", "=_", "'", "fake", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flavor_", "[_", "'", "extra", "\\u", "spec", "s", "'_", "]_", "[_", "'", "capab", "ilities", ":", "boot", "\\u", "mode", "'_", "]_", "=_", "'", "bios", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "{_", "'", "path", "'_", ":_", "'/", "instance", "\\u", "info", "/", "capab", "ilities", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "'{", "\"", "boot", "\\u", "mode", "\":", " ", "\"", "bios", "\"}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "op", "'_", ":_", "'", "add", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "+=_", "self_", "._", "\\u", "expected", "\\u", "deploy", "\\u", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "patcher_", "._", "create_", "(_", "node_", ")_", "._", "get", "\\u", "deploy", "\\u", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", ",_", "self_", "._", "image", "\\u", "meta_", ",_", "self_", "._", "flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "expected_", ")_", ",_", "sorted_", "(_", "patch_", ")_", ")_", "\\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 ]
Unused import
openstack/python-ironicclient/releasenotes/source/conf.py
[ { "content": "# -*- coding: utf-8 -*-\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# Ironic Client Release Notes documentation build configuration file, created\n# by sphinx-quickstart on Wed Dec 23 22:54:56 2015.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n# sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n 'oslosphinx',\n 'reno.sphinxext',\n]\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n# source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'Ironic Client Release Notes'\ncopyright = u'2015, Ironic Developers'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\nimport pbr.version\nironicclient_version = pbr.version.VersionInfo('python-ironicclient')\n# The short X.Y version.\nversion = ironicclient_version.canonical_version_string()\n# The full version, including alpha/beta/rc tags.\nrelease = ironicclient_version.version_string_with_vcs()\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n# language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n# today = ''\n# Else, today_fmt is used as the format for a strftime call.\n# today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = []\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\n# default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n# add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n# add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n# show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n# modindex_common_prefix = []\n\n# If true, keep warnings as \"system message\" paragraphs in the built documents.\n# keep_warnings = False\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n# html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n# html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n# html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n# html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n# html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n# html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# Add any extra paths that contain custom files (such as robots.txt or\n# .htaccess) here, relative to this directory. These files are copied\n# directly to the root of the documentation.\n# html_extra_path = []\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n# html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n# html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n# html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n# html_additional_pages = {}\n\n# If false, no module index is generated.\n# html_domain_indices = True\n\n# If false, no index is generated.\n# html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n# html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n# html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n# html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n# html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n# html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n# html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'IronicClientReleaseNotesdoc'\n\n\n# -- Options for LaTeX output ---------------------------------------------\n\nlatex_elements = {\n # The paper size ('letterpaper' or 'a4paper').\n # 'papersize': 'letterpaper',\n\n # The font size ('10pt', '11pt' or '12pt').\n # 'pointsize': '10pt',\n\n # Additional stuff for the LaTeX preamble.\n # 'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n# author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n ('index', 'IronicClientReleaseNotes.tex',\n u'Ironic Client Release Notes Documentation',\n u'Ironic Developers', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n# latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n# latex_use_parts = False\n\n# If true, show page references after internal links.\n# latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n# latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n# latex_appendices = []\n\n# If false, no module index is generated.\n# latex_domain_indices = True\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'ironicclientreleasenotes',\n u'Ironic Client Release Notes Documentation',\n [u'Ironic Developers'], 1)\n]\n\n# If true, show URL addresses after external links.\n# man_show_urls = False\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'IronicClientReleaseNotes',\n u'Ironic Client Release Notes Documentation',\n u'Ironic Developers', 'IronicClientReleaseNotes',\n 'Bare metal provisioning service client.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n# texinfo_appendices = []\n\n# If false, no module index is generated.\n# texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n# texinfo_show_urls = 'footnote'\n\n# If true, do not generate a @detailmenu in the \"Top\" node's menu.\n# texinfo_no_detailmenu = False\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\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_", "#", " ", "Iron", "ic", " ", "Client", " ", "Release", " ", "Not", "es", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "We", "d", " ", "De", "c", " ", "23", " ", "2", "2", ":", "5", "4", ":", "56", " ", "201", "5._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extensi", "ons", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "oslo", "sphinx", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ren", "o", ".", "sphinx", "ext", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "Iron", "ic", " ", "Client", " ", "Release", " ", "Not", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "201", "5", ",", " ", "Iron", "ic", " ", "Dev", "elope", "rs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pb", "r_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ironic", "client", "\\u", "version_", "=_", "pb", "r_", "._", "version_", "._", "Version", "Info_", "(_", "'", "python", "-", "ironic", "client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "ironic", "client", "\\u", "version_", "._", "canonical", "\\u", "version", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "ironic", "client", "\\u", "version_", "._", "version", "\\u", "string", "\\u", "with", "\\u", "vcs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "keep", " ", "warn", "ings", " ", "as", " ", "\"", "system", " ", "message", "\"", " ", "paragraph", "s", " ", "in", " ", "the", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keep", "\\u", "warn", "ings", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "extra", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "robots", ".", "txt", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "hta", "ccess", ")", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "se", " ", "files", " ", "are", " ", "copied_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "to", " ", "the", " ", "root", " ", "of", " ", "the", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "extra", "\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "Iron", "ic", "Client", "Release", "Not", "esd", "oc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", ",", " ", "manu", "al", ",", " ", "or", " ", "own", " ", "class", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "Iron", "ic", "Client", "Release", "Not", "es", ".", "tex", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Iron", "ic", " ", "Client", " ", "Release", " ", "Not", "es", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Iron", "ic", " ", "Dev", "elope", "rs", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "ironic", "client", "release", "note", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Iron", "ic", " ", "Client", " ", "Release", " ", "Not", "es", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Iron", "ic", " ", "Dev", "elope", "rs", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "-_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "Iron", "ic", "Client", "Release", "Not", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Iron", "ic", " ", "Client", " ", "Release", " ", "Not", "es", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Iron", "ic", " ", "Dev", "elope", "rs", "'_", ",_", "'", "Iron", "ic", "Client", "Release", "Not", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Bar", "e", " ", "metal", " ", "provision", "ing", " ", "service", " ", "client", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "do", " ", "not", " ", "generat", "e", " ", "a", " ", "@", "deta", "il", "menu", " ", "in", " ", "the", " ", "\"", "Top", "\"", " ", "node", "'", "s", " ", "menu", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tex", "info", "\\u", "no", "\\u", "deta", "il", "menu", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
spotify/snakebite/snakebite/commandlineparser.py
[ { "content": " @command(args=\"<mode> [paths]\", descr=\"change file mode (octal)\", allowed_opts=[\"R\"], req_args=['(int) arg', 'dir [dirs]'])\n def chmod(self):\n mode = int(str(self.args.single_int_arg), 8)\n mods = self.client.chmod(self.args.dir, mode, recurse=self.args.recurse)\n for line in format_results(mods, json_output=self.args.json):\n print line", "metadata": "root.CommandLineParser.chmod", "header": "['class', 'CommandLineParser', '(', 'object', ')', ':', '___EOS___']", "index": 537 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Command", "Line", "Parser_", "(_", "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_", "@_", "command_", "(_", "args_", "=_", "\"<", "mode", ">", " ", "[", "path", "s", "]\"_", ",_", "descr_", "=_", "\"", "change", " ", "file", " ", "mode", " ", "(", "octa", "l", ")\"_", ",_", "allow", "ed", "\\u", "opts_", "=_", "[_", "\"", "R", "\"_", "]_", ",_", "req", "\\u", "args_", "=_", "[_", "'(", "int", ")", " ", "arg", "'_", ",_", "'", "dir", " ", "[", "dirs", "]'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "chmod_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "int_", "(_", "str_", "(_", "self_", "._", "args_", "._", "single", "\\u", "int\\u", "arg_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mods_", "=_", "self_", "._", "client_", "._", "chmod_", "(_", "self_", "._", "args_", "._", "dir_", ",_", "mode_", ",_", "recurse_", "=_", "self_", "._", "args_", "._", "recurse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "format\\u", "results_", "(_", "mods_", ",_", "json", "\\u", "output_", "=_", "self_", "._", "args_", "._", "json_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "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 ]
Unused import
vim-awesome/vim-awesome/web/gitter_log_handler.py
[ { "content": "\"\"\"Custom log handler for posting log messages to Gitter\"\"\"\n\nimport logging\n\nfrom util import log_to_gitter\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GitterHandler(logging.Handler):\n \"\"\"Log handler used to send notifications to Gitter\"\"\"\n", "metadata": "root.GitterHandler", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def emit(self, record):\n \"\"\"Sends the record info to Gitter.\"\"\"\n msg = str(self.format(record))\n if record.exc_info:\n exc = logging._defaultFormatter.formatException(record.exc_info)\n msg += \"\\n\" + exc\n\n log_to_gitter(msg)", "metadata": "root.GitterHandler.emit", "header": "['class', 'GitterHandler', '(', 'logging', '.', 'Handler', ')', ':', '___EOS___']", "index": 10 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Custom", " ", "log", " ", "handler", " ", "for", " ", "posting", " ", "log", " ", "message", "s", " ", "to", " ", "Git", "ter", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "util_", "import_", "log", "\\u", "to", "\\u", "git", "ter_", "\\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_", "Git", "ter", "Handler_", "(_", "logging_", "._", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Log", " ", "handler", " ", "used", " ", "to", " ", "send", " ", "notification", "s", " ", "to", " ", "Git", "ter", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "ter", "Handler_", "(_", "logging_", "._", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "emit_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "ds", " ", "the", " ", "record", " ", "info", " ", "to", " ", "Git", "ter", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "str_", "(_", "self_", "._", "format_", "(_", "record_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "record_", "._", "exc", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc_", "=_", "logging_", "._", "\\u", "default", "Formatter_", "._", "format", "Exception_", "(_", "record_", "._", "exc", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\"\\\\", "n", "\"_", "+_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log", "\\u", "to", "\\u", "git", "ter_", "(_", "msg_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Netflix/security_monkey/security_monkey/tests/test_elasticsearch_service.py
[ { "content": "# Copyright 2014 Netflix, 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.. module: security_monkey.tests.test_elasticsearch_service\n :platform: Unix\n\n.. version:: $$VERSION$$\n.. moduleauthor:: Mike Grima <mgrima@netflix.com>\n\n\"\"\"\nimport json\n\nfrom security_monkey.datastore import NetworkWhitelistEntry, Account\nfrom security_monkey.tests import SecurityMonkeyTestCase\nfrom security_monkey import db\n\n# TODO: Make a ES test for spulec/moto, then make test cases that use it.\nfrom security_monkey.watchers.elasticsearch_service import ElasticSearchServiceItem\n\nCONFIG_ONE = {\n \"name\": \"es_test\",\n \"policy\": json.loads(b\"\"\"{\n \"Statement\": [\n {\n \"Action\": \"es:*\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"*\"\n },\n \"Resource\": \"arn:aws:es:us-east-1:012345678910:domain/es_test/*\",\n \"Sid\": \"\"\n }\n ],\n \"Version\": \"2012-10-17\"\n }\n \"\"\")\n}\n\nCONFIG_TWO = {\n \"name\": \"es_test_2\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:us-west-2:012345678910:domain/es_test_2/*\"\n }\n ]\n }\n \"\"\")\n}\n\nCONFIG_THREE = {\n \"name\": \"es_test_3\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::012345678910:root\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_3/*\"\n },\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"es:ESHttp*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_3/*\",\n \"Condition\": {\n \"IpAddress\": {\n \"aws:SourceIp\": [\n \"192.168.1.1/32\",\n \"10.0.0.1/8\"\n ]\n }\n }\n }\n ]\n }\n \"\"\")\n}\n\nCONFIG_FOUR = {\n \"name\": \"es_test_4\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::012345678910:root\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:us-east-1:012345678910:domain/es_test_4/*\"\n },\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"es:ESHttp*\",\n \"Resource\": \"arn:aws:es:us-east-1:012345678910:domain/es_test_4/*\",\n \"Condition\": {\n \"IpAddress\": {\n \"aws:SourceIp\": [\n \"0.0.0.0/0\"\n ]\n }\n }\n }\n ]\n }\n \"\"\")\n}\n\nCONFIG_FIVE = {\n \"name\": \"es_test_5\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::012345678910:root\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:us-east-1:012345678910:domain/es_test_5/*\"\n },\n {\n \"Sid\": \"\",\n \"Effect\": \"Deny\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::012345678910:role/not_this_role\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:us-east-1:012345678910:domain/es_test_5/*\"\n }\n ]\n }\n \"\"\")\n}\n\nCONFIG_SIX = {\n \"name\": \"es_test_6\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::012345678910:role/a_good_role\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_6/*\"\n },\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"es:ESHttp*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_6/*\",\n \"Condition\": {\n \"IpAddress\": {\n \"aws:SourceIp\": [\n \"192.168.1.1/32\",\n \"100.0.0.1/16\"\n ]\n }\n }\n }\n ]\n }\n \"\"\")\n}\n\nCONFIG_SEVEN = {\n \"name\": \"es_test_7\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::012345678910:role/a_good_role\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_7/*\"\n },\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"es:ESHttp*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_7/*\",\n \"Condition\": {\n \"IpAddress\": {\n \"aws:SourceIp\": [\n \"192.168.1.200/32\",\n \"10.0.0.1/8\"\n ]\n }\n }\n }\n ]\n }\n \"\"\")\n}\n\nCONFIG_EIGHT = {\n \"name\": \"es_test_8\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"*\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_8/*\"\n },\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"es:ESHttp*\",\n \"Resource\": \"arn:aws:es:eu-west-1:012345678910:domain/es_test_8/*\",\n \"Condition\": {\n \"IpAddress\": {\n \"aws:SourceIp\": [\n \"192.168.1.1/32\",\n \"100.0.0.1/16\"\n ]\n }\n }\n }\n ]\n }\n \"\"\")\n}\n\nCONFIG_NINE = {\n \"name\": \"es_test_9\",\n \"policy\": json.loads(b\"\"\"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::111111111111:root\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"arn:aws:es:us-east-1:012345678910:domain/es_test_9/*\"\n }\n ]\n }\n \"\"\")\n}\n\n\nWHITELIST_CIDRS = [\n (\"Test one\", \"192.168.1.1/32\"),\n (\"Test two\", \"100.0.0.1/16\"),\n]\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ElasticSearchServiceTestCase(SecurityMonkeyTestCase):\n\n", "metadata": "root.ElasticSearchServiceTestCase", "header": "['module', '___EOS___']", "index": 289 }, { "content": " def setUp(self):\n self.es_items = [\n ElasticSearchServiceItem(region=\"us-east-1\", account=\"TEST_ACCOUNT\", name=\"es_test\", config=CONFIG_ONE),\n ElasticSearchServiceItem(region=\"us-west-2\", account=\"TEST_ACCOUNT\", name=\"es_test_2\", config=CONFIG_TWO),\n ElasticSearchServiceItem(region=\"eu-west-1\", account=\"TEST_ACCOUNT\", name=\"es_test_3\", config=CONFIG_THREE),\n ElasticSearchServiceItem(region=\"us-east-1\", account=\"TEST_ACCOUNT\", name=\"es_test_4\", config=CONFIG_FOUR),\n ElasticSearchServiceItem(region=\"us-east-1\", account=\"TEST_ACCOUNT\", name=\"es_test_5\", config=CONFIG_FIVE),\n ElasticSearchServiceItem(region=\"eu-west-1\", account=\"TEST_ACCOUNT\", name=\"es_test_6\", config=CONFIG_SIX),\n ElasticSearchServiceItem(region=\"eu-west-1\", account=\"TEST_ACCOUNT\", name=\"es_test_7\", config=CONFIG_SEVEN),\n ElasticSearchServiceItem(region=\"eu-west-1\", account=\"TEST_ACCOUNT\", name=\"es_test_8\", config=CONFIG_EIGHT),\n ElasticSearchServiceItem(region=\"us-east-1\", account=\"TEST_ACCOUNT\", name=\"es_test_9\", config=CONFIG_NINE),\n ]\n\n # Add the fake source account into the database:\n test_account = Account()\n test_account.name = \"TEST_ACCOUNT\"\n test_account.notes = \"TEST ACCOUNT\"\n test_account.s3_name = \"TEST_ACCOUNT\"\n test_account.number = \"012345678910\"\n test_account.role_name = \"TEST_ACCOUNT\"\n\n db.session.add(test_account)\n db.session.commit()", "metadata": "root.ElasticSearchServiceTestCase.setUp", "header": "['class', 'ElasticSearchServiceTestCase', '(', 'SecurityMonkeyTestCase', ')', ':', '___EOS___']", "index": 290 }, { "content": " def tearDown(self):\n # Remove the fake source account from the database:\n test_account = Account.query.filter(Account.number == \"012345678910\").first()\n if test_account is not None:\n db.session.delete(test_account)\n db.session.commit()", "metadata": "root.ElasticSearchServiceTestCase.tearDown", "header": "['class', 'ElasticSearchServiceTestCase', '(', 'SecurityMonkeyTestCase', ')', ':', '___EOS___']", "index": 314 }, { "content": " def test_es_auditor(self):\n from security_monkey.auditors.elasticsearch_service import ElasticSearchServiceAuditor\n es_auditor = ElasticSearchServiceAuditor(accounts=[\"012345678910\"])\n\n # Add some test network whitelists into this:\n es_auditor.network_whitelist = []\n for cidr in WHITELIST_CIDRS:\n whitelist_cidr = NetworkWhitelistEntry()\n whitelist_cidr.cidr = cidr[1]\n whitelist_cidr.name = cidr[0]\n\n es_auditor.network_whitelist.append(whitelist_cidr)\n\n for es_domain in self.es_items:\n es_auditor.check_es_access_policy(es_domain)\n\n # Check for correct number of issues located:\n # CONFIG ONE:\n self.assertEquals(len(self.es_items[0].audit_issues), 1)\n self.assertEquals(self.es_items[0].audit_issues[0].score, 20)\n\n # CONFIG TWO:\n self.assertEquals(len(self.es_items[1].audit_issues), 1)\n self.assertEquals(self.es_items[1].audit_issues[0].score, 20)\n\n # CONFIG THREE:\n self.assertEquals(len(self.es_items[2].audit_issues), 2)\n self.assertEquals(self.es_items[2].audit_issues[0].score, 5)\n self.assertEquals(self.es_items[2].audit_issues[1].score, 7)\n\n # CONFIG FOUR:\n self.assertEquals(len(self.es_items[3].audit_issues), 1)\n self.assertEquals(self.es_items[3].audit_issues[0].score, 20)\n\n # CONFIG FIVE:\n self.assertEquals(len(self.es_items[4].audit_issues), 0)\n\n # CONFIG SIX:\n self.assertEquals(len(self.es_items[5].audit_issues), 0)\n\n # CONFIG SEVEN:\n self.assertEquals(len(self.es_items[6].audit_issues), 3)\n self.assertEquals(self.es_items[6].audit_issues[0].score, 5)\n self.assertEquals(self.es_items[6].audit_issues[1].score, 5)\n self.assertEquals(self.es_items[6].audit_issues[2].score, 7)\n\n # CONFIG EIGHT:\n self.assertEquals(len(self.es_items[7].audit_issues), 1)\n self.assertEquals(self.es_items[7].audit_issues[0].score, 20)\n\n # CONFIG NINE:\n self.assertEquals(len(self.es_items[8].audit_issues), 2)\n self.assertEquals(self.es_items[8].audit_issues[0].score, 6)\n self.assertEquals(self.es_items[8].audit_issues[1].score, 10)", "metadata": "root.ElasticSearchServiceTestCase.test_es_auditor", "header": "['class', 'ElasticSearchServiceTestCase', '(', 'SecurityMonkeyTestCase', ')', ':', '___EOS___']", "index": 321 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Net", "fli", "x", ",", " ", "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_", "\"\"\"", "\\", "10", ";", "..", " ", "module", ":", " ", "security", "\\u", "monkey", ".", "tests", ".", "test\\u", "elastic", "search", "\\u", "service", "\\", "10", ";", " ", " ", " ", " ", ":", "platform", ":", " ", "Uni", "x", "\\", "10", ";", "\\", "10", ";", "..", " ", "version", "::", " ", "$$", "VERSI", "ON", "$$", "\\", "10", ";", "..", " ", "module", "author", "::", " ", " ", "Mik", "e", " ", "Gri", "ma", " ", "<", "mgr", "ima", "@", "netf", "li", "x", ".", "com", ">", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "security", "\\u", "monkey_", "._", "datastore_", "import_", "Network", "White", "list", "Entry_", ",_", "Account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "security", "\\u", "monkey_", "._", "tests_", "import_", "Secur", "it", "y", "Mon", "key", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "security", "\\u", "monkey_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Make", " ", "a", " ", "ES", " ", "test", " ", "for", " ", "spu", "lec", "/", "moto", ",", " ", "then", " ", "make", " ", "test", " ", "case", "s", " ", "tha", "t", " ", "use", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "security", "\\u", "monkey_", "._", "watcher", "s_", "._", "elastic", "search", "\\u", "service_", "import_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "ONE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"*", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "us", "-", "east", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test", "/*", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "],", "\\", "10", ";", " ", " ", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\"", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "TWO", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "\"*", "\",", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "us", "-", "west", "-", "2", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "2", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "THREE", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"", "arn", ":", "aws", ":", "iam", "::", "0123456", "789", "10", ":", "root", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "3", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "\"*", "\",", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":", "ES", "Http", "*\"", ",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "3", "/*", "\",", "\\", "10", ";", " ", " ", "\"", "Cond", "ition", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Ip", "Address", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", "aws", ":", "Sou", "rce", "Ip", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "\"", "192", ".1", "68.", "1.1", "/", "32", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "10.", "0.", "0.", "1", "/", "8", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "FOUR", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"", "arn", ":", "aws", ":", "iam", "::", "0123456", "789", "10", ":", "root", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "us", "-", "east", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "4", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "\"*", "\",", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":", "ES", "Http", "*\"", ",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "us", "-", "east", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "4", "/*", "\",", "\\", "10", ";", " ", " ", "\"", "Cond", "ition", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Ip", "Address", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", "aws", ":", "Sou", "rce", "Ip", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "\"", "0.", "0.", "0.", "0", "/", "0", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "FI", "VE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"", "arn", ":", "aws", ":", "iam", "::", "0123456", "789", "10", ":", "root", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "us", "-", "east", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "5", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "Den", "y", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"", "arn", ":", "aws", ":", "iam", "::", "0123456", "789", "10", ":", "role", "/", "not", "\\u", "this", "\\u", "role", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "us", "-", "east", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "5", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "SI", "X_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"", "arn", ":", "aws", ":", "iam", "::", "0123456", "789", "10", ":", "role", "/", "a", "\\u", "good", "\\u", "role", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "6", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "\"*", "\",", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":", "ES", "Http", "*\"", ",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "6", "/*", "\",", "\\", "10", ";", " ", " ", "\"", "Cond", "ition", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Ip", "Address", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", "aws", ":", "Sou", "rce", "Ip", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "\"", "192", ".1", "68.", "1.1", "/", "32", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "100", ".0", ".0", ".1", "/", "16", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "SEV", "EN_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "7", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"", "arn", ":", "aws", ":", "iam", "::", "0123456", "789", "10", ":", "role", "/", "a", "\\u", "good", "\\u", "role", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "7", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "\"*", "\",", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":", "ES", "Http", "*\"", ",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "7", "/*", "\",", "\\", "10", ";", " ", " ", "\"", "Cond", "ition", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Ip", "Address", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", "aws", ":", "Sou", "rce", "Ip", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "\"", "192", ".1", "68.", "1.2", "00", "/", "32", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "10.", "0.", "0.", "1", "/", "8", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "EI", "GHT", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "8", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"*", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "8", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "\"*", "\",", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":", "ES", "Http", "*\"", ",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "eu", "-", "west", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "8", "/*", "\",", "\\", "10", ";", " ", " ", "\"", "Cond", "ition", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Ip", "Address", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", "aws", ":", "Sou", "rce", "Ip", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "\"", "192", ".1", "68.", "1.1", "/", "32", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "100", ".0", ".0", ".1", "/", "16", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "NIN", "E_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "es", "\\u", "test\\u", "9", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "policy", "\"_", ":_", "json_", "._", "loads_", "(_", "b", "\"\"\"{", "\\", "10", ";", " ", " ", "\"", "Version", "\":", " ", "\"", "2012", "-1", "0", "-1", "7", "\",", "\\", "10", ";", " ", " ", "\"", "State", "ment", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "\"", "Si", "d", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", "\"", "Effe", "ct", "\":", " ", "\"", "All", "ow", "\",", "\\", "10", ";", " ", " ", "\"", "Princip", "al", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "AW", "S", "\":", " ", "\"", "arn", ":", "aws", ":", "iam", "::", "11111111111", "1", ":", "root", "\"", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "\"", "Action", "\":", " ", "\"", "es", ":*", "\",", "\\", "10", ";", " ", " ", "\"", "Reso", "urc", "e", "\":", " ", "\"", "arn", ":", "aws", ":", "es", ":", "us", "-", "east", "-1", ":", "0123456", "789", "10", ":", "domain", "/", "es", "\\u", "test\\u", "9", "/*", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WHITE", "LIST", "\\u", "CIDR", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Test", " ", "one", "\"_", ",_", "\"", "192", ".1", "68.", "1.1", "/", "32", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Test", " ", "two", "\"_", ",_", "\"", "100", ".0", ".0", ".1", "/", "16", "\"_", ")_", ",_", "\\u\\u\\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_", "Elast", "ic", "Sear", "ch", "Service", "Test", "Case_", "(_", "Secur", "it", "y", "Mon", "key", "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_", "[SEP]_", "class_", "Elast", "ic", "Sear", "ch", "Service", "Test", "Case_", "(_", "Secur", "it", "y", "Mon", "key", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "es", "\\u", "items_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "us", "-", "east", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "ONE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "us", "-", "west", "-", "2", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "2", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "TWO", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "eu", "-", "west", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "3", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "THREE", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "us", "-", "east", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "4", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "FOUR", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "us", "-", "east", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "5", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "FI", "VE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "eu", "-", "west", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "6", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "SI", "X_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "eu", "-", "west", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "7", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "SEV", "EN_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "eu", "-", "west", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "8", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "EI", "GHT", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Elast", "ic", "Sear", "ch", "Service", "Item_", "(_", "region_", "=_", "\"", "us", "-", "east", "-1", "\"_", ",_", "account_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", ",_", "name_", "=_", "\"", "es", "\\u", "test\\u", "9", "\"_", ",_", "config_", "=_", "CONFIG", "\\u", "NIN", "E_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "fake", " ", "source", " ", "account", " ", "int", "o", " ", "the", " ", "databa", "se", ":_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "account_", "=_", "Account_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "account_", "._", "name_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "account_", "._", "notes_", "=_", "\"", "TEST", " ", "ACCOUNT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "account_", "._", "s3", "\\u", "name_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "account_", "._", "number_", "=_", "\"", "0123456", "789", "10", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "account_", "._", "role", "\\u", "name_", "=_", "\"", "TEST", "\\u", "ACCOUNT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "session_", "._", "add_", "(_", "test\\u", "account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Elast", "ic", "Sear", "ch", "Service", "Test", "Case_", "(_", "Secur", "it", "y", "Mon", "key", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "the", " ", "fake", " ", "source", " ", "account", " ", "from", " ", "the", " ", "databa", "se", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "account_", "=_", "Account_", "._", "query_", "._", "filter_", "(_", "Account_", "._", "number_", "==_", "\"", "0123456", "789", "10", "\"_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "test\\u", "account_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "session_", "._", "delete_", "(_", "test\\u", "account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Elast", "ic", "Sear", "ch", "Service", "Test", "Case_", "(_", "Secur", "it", "y", "Mon", "key", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "es", "\\u", "audit", "or_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "security", "\\u", "monkey_", "._", "audit", "ors_", "._", "elastic", "search", "\\u", "service_", "import_", "Elast", "ic", "Sear", "ch", "Service", "Audi", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es", "\\u", "audit", "or_", "=_", "Elast", "ic", "Sear", "ch", "Service", "Audi", "tor_", "(_", "accounts_", "=_", "[_", "\"", "0123456", "789", "10", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "some", " ", "test", " ", "network", " ", "whitelist", "s", " ", "int", "o", " ", "this", ":_", "\\u\\u\\uNL\\u\\u\\u_", "es", "\\u", "audit", "or_", "._", "network", "\\u", "whitelist_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cidr_", "in_", "WHITE", "LIST", "\\u", "CIDR", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "whitelist", "\\u", "cidr_", "=_", "Network", "White", "list", "Entry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "whitelist", "\\u", "cidr_", "._", "cidr_", "=_", "cidr_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "whitelist", "\\u", "cidr_", "._", "name_", "=_", "cidr_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "es", "\\u", "audit", "or_", "._", "network", "\\u", "whitelist_", "._", "append_", "(_", "whitelist", "\\u", "cidr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "es", "\\u", "domain_", "in_", "self_", "._", "es", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "es", "\\u", "audit", "or_", "._", "check", "\\u", "es", "\\u", "access", "\\u", "policy_", "(_", "es", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "correct", " ", "number", " ", "of", " ", "issue", "s", " ", "located", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "ONE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "0_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "0_", "]_", "._", "audit", "\\u", "issues_", "[_", "0_", "]_", "._", "score_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "TWO", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "1_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "1_", "]_", "._", "audit", "\\u", "issues_", "[_", "0_", "]_", "._", "score_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "THREE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "2_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "2_", "]_", "._", "audit", "\\u", "issues_", "[_", "0_", "]_", "._", "score_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "2_", "]_", "._", "audit", "\\u", "issues_", "[_", "1_", "]_", "._", "score_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "FOUR", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "3_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "3_", "]_", "._", "audit", "\\u", "issues_", "[_", "0_", "]_", "._", "score_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "FI", "VE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "4_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "SI", "X", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "5_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "SEV", "EN", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "6_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "6_", "]_", "._", "audit", "\\u", "issues_", "[_", "0_", "]_", "._", "score_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "6_", "]_", "._", "audit", "\\u", "issues_", "[_", "1_", "]_", "._", "score_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "6_", "]_", "._", "audit", "\\u", "issues_", "[_", "2_", "]_", "._", "score_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "EI", "GHT", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "7_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "7_", "]_", "._", "audit", "\\u", "issues_", "[_", "0_", "]_", "._", "score_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONFIG", " ", "NIN", "E", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "8_", "]_", "._", "audit", "\\u", "issues_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "8_", "]_", "._", "audit", "\\u", "issues_", "[_", "0_", "]_", "._", "score_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "es", "\\u", "items_", "[_", "8_", "]_", "._", "audit", "\\u", "issues_", "[_", "1_", "]_", "._", "score_", ",_", "10_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
stitchfix/pyxley/pyxley/charts/mg/graphic.py
[ { "content": "class Graphic(OptionHelper):\n \"\"\" Graphic options for the metricsgraphics api.\n\n This class contains all graphics options for the metricsgraphics api.\n https://github.com/mozilla/metrics-graphics/wiki/Graphic\n\n \"\"\"\n _allowed_graphics = [\n \"aggregate_rollover\",\n \"animate_on_load\",\n \"area\",\n \"baselines\",\n \"chart_type\",\n \"custom_line_color_map\",\n \"decimals\",\n \"error\",\n \"format\",\n \"full_height\",\n \"full_width\",\n \"interpolate\",\n \"interpolate_tension\",\n \"legend\",\n \"legend_target\",\n \"linked\",\n \"lined_format\",\n \"list\",\n \"markers\",\n \"max_data_size\",\n \"mouseover\",\n \"mousemove\",\n \"mouseout\",\n \"point_size\",\n \"show_confidence_band\",\n \"show_rollover_text\",\n \"show_tooltips\",\n \"target\",\n \"transition_on_update\",\n \"x_rug\",\n \"y_rug\"\n ]\n\n _allowed_charts = [\"line\", \"histogram\", \"point\", \"bar\", \"missing-data\"]\n\n _allowed_interpolates = [\n \"cardinal\",\n \"linear\",\n \"linear-closed\",\n \"step\",\n \"step-before\",\n \"step-after\",\n \"basis\",\n \"basis-open\",\n \"basis-closed\",\n \"bundle\",\n \"cardinal-open\",\n \"cardinal-closed\",\n \"monotone\"\n ]\n\n\n\n\n\n\n\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.Graphic", "header": "['module', '___EOS___']", "index": 2 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Graphic", "_", "(_", "Optio", "n", "Helper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Graphic", " ", "options", " ", "for", " ", "the", " ", "metric", "sgr", "aph", "ics", " ", "api", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "contain", "s", " ", "all", " ", "graphic", "s", " ", "options", " ", "for", " ", "the", " ", "metric", "sgr", "aph", "ics", " ", "api", ".", "\\", "10", ";", " ", " ", " ", " ", "https", "://", "git", "hub", ".", "com", "/", "moz", "illa", "/", "metric", "s", "-", "graphic", "s", "/", "wiki", "/", "Graphic", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "allow", "ed", "\\u", "graphics_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "aggre", "gate", "\\u", "rollo", "ver", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "animate", "\\u", "on", "\\u", "load", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "area", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "baseline", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "chart", "\\u", "type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "custom", "\\u", "line", "\\u", "color", "\\u", "map", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "decima", "ls", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "format", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "full", "\\u", "height", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "full", "\\u", "widt", "h", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interpolat", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interpolat", "e\\u", "tens", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "legend", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "legend", "\\u", "target", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linked", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "line", "d\\u", "format", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "list", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "marker", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "\\u", "data\\u", "size", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mouse", "over", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mouse", "move", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mouse", "out", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "point", "\\u", "size", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "show", "\\u", "confidence", "\\u", "band", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "show", "\\u", "rollo", "ver", "\\u", "text", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "show", "\\u", "toolt", "ips", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "transiti", "on", "\\u", "on", "\\u", "update", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", "\\u", "ru", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "y", "\\u", "ru", "g", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "allow", "ed", "\\u", "charts", "_", "=_", "[_", "\"", "line", "\"_", ",_", "\"", "histo", "gram", "\"_", ",_", "\"", "point", "\"_", ",_", "\"", "bar", "\"_", ",_", "\"", "missi", "ng", "-", "data", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "allow", "ed", "\\u", "interpolat", "es_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cardi", "nal", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linear", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linear", "-", "close", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "step", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "step", "-", "bef", "ore", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "step", "-", "after", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "basi", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "basi", "s", "-", "open", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "basi", "s", "-", "close", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bundle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cardi", "nal", "-", "open", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cardi", "nal", "-", "close", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mono", "tone", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
'import *' may pollute namespace
openstack/neutron/neutron/tests/unit/extensions/test_agent.py
[ { "content": "# Copyright (c) 2013 OpenStack Foundation.\n# All Rights Reserved.\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\nimport copy\nfrom datetime import datetime\nimport time\n\nfrom neutron_lib import constants\nfrom oslo_config import cfg\nfrom oslo_utils import uuidutils\nfrom webob import exc\n\nfrom neutron.api.v2 import attributes\nfrom neutron.common import constants as n_const\nfrom neutron import context\nfrom neutron.db import agents_db\nfrom neutron.db import db_base_plugin_v2\nfrom neutron.extensions import agent\nfrom neutron.tests.common import helpers\nfrom neutron.tests import tools\nfrom neutron.tests.unit.api.v2 import test_base\nfrom neutron.tests.unit.db import test_db_base_plugin_v2\n\n\n_uuid = uuidutils.generate_uuid\n_get_path = test_base._get_path\nL3_HOSTA = 'hosta'\nDHCP_HOSTA = 'hosta'\nL3_HOSTB = 'hostb'\nDHCP_HOSTC = 'hostc'\nLBAAS_HOSTA = 'hosta'\nLBAAS_HOSTB = 'hostb'\n\n\n\n\n# This plugin class is just for testing\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Open", "Stack", " ", "Foun", "dati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "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_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "neut", "ron", "\\u", "lib_", "import_", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "config_", "import_", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "utils_", "import_", "uuidutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "webob_", "import_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "neutron_", "._", "api_", "._", "v2_", "import_", "attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "common_", "import_", "constants_", "as_", "n", "\\u", "const_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "db_", "import_", "agent", "s", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "db_", "import_", "db", "\\u", "base", "\\u", "plugin", "\\u", "v2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "extensions_", "import_", "agent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "tests_", "._", "common_", "import_", "helpers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "tests_", "import_", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "tests_", "._", "unit_", "._", "api_", "._", "v2_", "import_", "test\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neutron_", "._", "tests_", "._", "unit_", "._", "db_", "import_", "test\\u", "db", "\\u", "base", "\\u", "plugin", "\\u", "v2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "get", "\\u", "path_", "=_", "test\\u", "base_", "._", "\\u", "get", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L3", "\\u", "HOST", "A_", "=_", "'", "host", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DHC", "P", "\\u", "HOST", "A_", "=_", "'", "host", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L3", "\\u", "HOST", "B_", "=_", "'", "host", "b", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DHC", "P", "\\u", "HOST", "C_", "=_", "'", "host", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LB", "AA", "S", "\\u", "HOST", "A_", "=_", "'", "host", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LB", "AA", "S", "\\u", "HOST", "B_", "=_", "'", "host", "b", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "plugin", " ", "class", " ", "is", " ", "just", " ", "for", " ", "testing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
numba/numba/numba/tests/timsort.py
[ { "content": "\"\"\"\nTimsort implementation. Mostly adapted from CPython's listobject.c.\n\nFor more information, see listsort.txt in CPython's source tree.\n\"\"\"\n\nfrom __future__ import print_function, absolute_import, division\n\nimport collections\n\nfrom numba import types\n\n\nTimsortImplementation = collections.namedtuple(\n 'TimsortImplementation',\n (# The compile function itself\n 'compile',\n # All subroutines exercised by test_sort\n 'count_run', 'binarysort', 'gallop_left', 'gallop_right',\n 'merge_init', 'merge_append', 'merge_pop',\n 'merge_compute_minrun', 'merge_lo', 'merge_hi', 'merge_at',\n 'merge_force_collapse', 'merge_collapse',\n # The top-level functions\n 'run_timsort', 'run_timsort_with_values'\n ))\n\n\n# The maximum number of entries in a MergeState's pending-runs stack.\n# This is enough to sort arrays of size up to about\n# 32 * phi ** MAX_MERGE_PENDING\n# where phi ~= 1.618. 85 is ridiculously large enough, good for an array\n# with 2**64 elements.\n# NOTE this implementation doesn't depend on it (the stack is dynamically\n# allocated), but it's still good to check as an invariant.\nMAX_MERGE_PENDING = 85\n\n# When we get into galloping mode, we stay there until both runs win less\n# often than MIN_GALLOP consecutive times. See listsort.txt for more info.\nMIN_GALLOP = 7\n\n# Start size for temp arrays.\nMERGESTATE_TEMP_SIZE = 256\n\n# A mergestate is a named tuple with the following members:\n# - *min_gallop* is an integer controlling when we get into galloping mode\n# - *keys* is a temp list for merging keys\n# - *values* is a temp list for merging values, if needed\n# - *pending* is a stack of pending runs to be merged\n# - *n* is the current stack length of *pending*\n\nMergeState = collections.namedtuple(\n 'MergeState', ('min_gallop', 'keys', 'values', 'pending', 'n'))\n\n\nMergeRun = collections.namedtuple('MergeRun', ('start', 'size'))\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def make_timsort_impl(wrap, make_temp_area):\n\n make_temp_area = wrap(make_temp_area)\n intp = types.intp\n zero = intp(0)\n\n @wrap\n def has_values(keys, values):\n return values is not keys\n\n @wrap\n def merge_init(keys):\n \"\"\"\n Initialize a MergeState for a non-keyed sort.\n \"\"\"\n temp_size = min(len(keys) // 2 + 1, MERGESTATE_TEMP_SIZE)\n temp_keys = make_temp_area(keys, temp_size)\n temp_values = temp_keys\n pending = [MergeRun(zero, zero)] * MAX_MERGE_PENDING\n return MergeState(intp(MIN_GALLOP), temp_keys, temp_values, pending, zero)\n\n @wrap\n def merge_init_with_values(keys, values):\n \"\"\"\n Initialize a MergeState for a keyed sort.\n \"\"\"\n temp_size = min(len(keys) // 2 + 1, MERGESTATE_TEMP_SIZE)\n temp_keys = make_temp_area(keys, temp_size)\n temp_values = make_temp_area(values, temp_size)\n pending = [MergeRun(zero, zero)] * MAX_MERGE_PENDING\n return MergeState(intp(MIN_GALLOP), temp_keys, temp_values, pending, zero)\n\n @wrap\n def merge_append(ms, run):\n \"\"\"\n Append a run on the merge stack.\n \"\"\"\n n = ms.n\n assert n < MAX_MERGE_PENDING\n ms.pending[n] = run\n return MergeState(ms.min_gallop, ms.keys, ms.values, ms.pending, n + 1)\n\n @wrap\n def merge_pop(ms):\n \"\"\"\n Pop the top run from the merge stack.\n \"\"\"\n return MergeState(ms.min_gallop, ms.keys, ms.values, ms.pending, ms.n - 1)\n\n @wrap\n def merge_getmem(ms, need):\n \"\"\"\n Ensure enough temp memory for 'need' items is available.\n \"\"\"\n alloced = len(ms.keys)\n if need <= alloced:\n return ms\n # Over-allocate\n while alloced < need:\n alloced = alloced << 1\n # Don't realloc! That can cost cycles to copy the old data, but\n # we don't care what's in the block.\n temp_keys = make_temp_area(ms.keys, alloced)\n if has_values(ms.keys, ms.values):\n temp_values = make_temp_area(ms.values, alloced)\n else:\n temp_values = temp_keys\n return MergeState(ms.min_gallop, temp_keys, temp_values, ms.pending, ms.n)\n\n @wrap\n def merge_adjust_gallop(ms, new_gallop):\n \"\"\"\n Modify the MergeState's min_gallop.\n \"\"\"\n return MergeState(intp(new_gallop), ms.keys, ms.values, ms.pending, ms.n)\n\n\n @wrap\n def LT(a, b):\n \"\"\"\n Trivial comparison function between two keys. This is factored out to\n make it clear where comparisons occur.\n \"\"\"\n return a < b\n\n @wrap\n def binarysort(keys, values, lo, hi, start):\n \"\"\"\n binarysort is the best method for sorting small arrays: it does\n few compares, but can do data movement quadratic in the number of\n elements.\n [lo, hi) is a contiguous slice of a list, and is sorted via\n binary insertion. This sort is stable.\n On entry, must have lo <= start <= hi, and that [lo, start) is already\n sorted (pass start == lo if you don't know!).\n \"\"\"\n assert lo <= start and start <= hi\n _has_values = has_values(keys, values)\n if lo == start:\n start += 1\n while start < hi:\n pivot = keys[start]\n # Bisect to find where to insert `pivot`\n # NOTE: bisection only wins over linear search if the comparison\n # function is much more expensive than simply moving data.\n l = lo\n r = start\n # Invariants:\n # pivot >= all in [lo, l).\n # pivot < all in [r, start).\n # The second is vacuously true at the start.\n while l < r:\n p = l + ((r - l) >> 1)\n if LT(pivot, keys[p]):\n r = p\n else:\n l = p+1\n\n # The invariants still hold, so pivot >= all in [lo, l) and\n # pivot < all in [l, start), so pivot belongs at l. Note\n # that if there are elements equal to pivot, l points to the\n # first slot after them -- that's why this sort is stable.\n # Slide over to make room (aka memmove()).\n for p in range(start, l, -1):\n keys[p] = keys[p - 1]\n keys[l] = pivot\n if _has_values:\n pivot_val = values[start]\n for p in range(start, l, -1):\n values[p] = values[p - 1]\n values[l] = pivot_val\n\n start += 1\n\n\n @wrap\n def count_run(keys, lo, hi):\n \"\"\"\n Return the length of the run beginning at lo, in the slice [lo, hi).\n lo < hi is required on entry. \"A run\" is the longest ascending sequence, with\n\n lo[0] <= lo[1] <= lo[2] <= ...\n\n or the longest descending sequence, with\n\n lo[0] > lo[1] > lo[2] > ...\n\n A tuple (length, descending) is returned, where boolean *descending*\n is set to 0 in the former case, or to 1 in the latter.\n For its intended use in a stable mergesort, the strictness of the defn of\n \"descending\" is needed so that the caller can safely reverse a descending\n sequence without violating stability (strict > ensures there are no equal\n elements to get out of order).\n \"\"\"\n assert lo < hi\n if lo + 1 == hi:\n # Trivial 1-long run\n return 1, False\n if LT(keys[lo + 1], keys[lo]):\n # Descending run\n for k in range(lo + 2, hi):\n if not LT(keys[k], keys[k - 1]):\n return k - lo, True\n return hi - lo, True\n else:\n # Ascending run\n for k in range(lo + 2, hi):\n if LT(keys[k], keys[k - 1]):\n return k - lo, False\n return hi - lo, False\n\n\n @wrap\n def gallop_left(key, a, start, stop, hint):\n \"\"\"\n Locate the proper position of key in a sorted vector; if the vector contains\n an element equal to key, return the position immediately to the left of\n the leftmost equal element. [gallop_right() does the same except returns\n the position to the right of the rightmost equal element (if any).]\n\n \"a\" is a sorted vector with stop elements, starting at a[start].\n stop must be > start.\n\n \"hint\" is an index at which to begin the search, start <= hint < stop.\n The closer hint is to the final result, the faster this runs.\n\n The return value is the int k in start..stop such that\n\n a[k-1] < key <= a[k]\n\n pretending that a[start-1] is minus infinity and a[stop] is plus infinity.\n IOW, key belongs at index k; or, IOW, the first k elements of a should\n precede key, and the last stop-start-k should follow key.\n\n See listsort.txt for info on the method.\n \"\"\"\n assert stop > start\n assert hint >= start and hint < stop\n n = stop - start\n\n # First, gallop from the hint to find a \"good\" subinterval for bisecting\n lastofs = 0\n ofs = 1\n if LT(a[hint], key):\n # a[hint] < key => gallop right, until\n # a[hint + lastofs] < key <= a[hint + ofs]\n maxofs = stop - hint\n while ofs < maxofs:\n if LT(a[hint + ofs], key):\n lastofs = ofs\n ofs = (ofs << 1) + 1\n if ofs <= 0:\n # Int overflow\n ofs = maxofs\n else:\n # key <= a[hint + ofs]\n break\n if ofs > maxofs:\n ofs = maxofs\n # Translate back to offsets relative to a[0]\n lastofs += hint\n ofs += hint\n else:\n # key <= a[hint] => gallop left, until\n # a[hint - ofs] < key <= a[hint - lastofs]\n maxofs = hint - start + 1\n while ofs < maxofs:\n if LT(a[hint - ofs], key):\n break\n else:\n # key <= a[hint - ofs]\n lastofs = ofs\n ofs = (ofs << 1) + 1\n if ofs <= 0:\n # Int overflow\n ofs = maxofs\n if ofs > maxofs:\n ofs = maxofs\n # Translate back to positive offsets relative to a[0]\n lastofs, ofs = hint - ofs, hint - lastofs\n\n assert start - 1 <= lastofs and lastofs < ofs and ofs <= stop\n # Now a[lastofs] < key <= a[ofs], so key belongs somewhere to the\n # right of lastofs but no farther right than ofs. Do a binary\n # search, with invariant a[lastofs-1] < key <= a[ofs].\n lastofs += 1\n while lastofs < ofs:\n m = lastofs + ((ofs - lastofs) >> 1)\n if LT(a[m], key):\n # a[m] < key\n lastofs = m + 1\n else:\n # key <= a[m]\n ofs = m\n # Now lastofs == ofs, so a[ofs - 1] < key <= a[ofs]\n return ofs\n\n\n @wrap\n def gallop_right(key, a, start, stop, hint):\n \"\"\"\n Exactly like gallop_left(), except that if key already exists in a[start:stop],\n finds the position immediately to the right of the rightmost equal value.\n\n The return value is the int k in start..stop such that\n\n a[k-1] <= key < a[k]\n\n The code duplication is massive, but this is enough different given that\n we're sticking to \"<\" comparisons that it's much harder to follow if\n written as one routine with yet another \"left or right?\" flag.\n \"\"\"\n assert stop > start\n assert hint >= start and hint < stop\n n = stop - start\n\n # First, gallop from the hint to find a \"good\" subinterval for bisecting\n lastofs = 0\n ofs = 1\n if LT(key, a[hint]):\n # key < a[hint] => gallop left, until\n # a[hint - ofs] <= key < a[hint - lastofs]\n maxofs = hint - start + 1\n while ofs < maxofs:\n if LT(key, a[hint - ofs]):\n lastofs = ofs\n ofs = (ofs << 1) + 1\n if ofs <= 0:\n # Int overflow\n ofs = maxofs\n else:\n # a[hint - ofs] <= key\n break\n if ofs > maxofs:\n ofs = maxofs\n # Translate back to positive offsets relative to a[0]\n lastofs, ofs = hint - ofs, hint - lastofs\n else:\n # a[hint] <= key -- gallop right, until\n # a[hint + lastofs] <= key < a[hint + ofs]\n maxofs = stop - hint\n while ofs < maxofs:\n if LT(key, a[hint + ofs]):\n break\n else:\n # a[hint + ofs] <= key\n lastofs = ofs\n ofs = (ofs << 1) + 1\n if ofs <= 0:\n # Int overflow\n ofs = maxofs\n if ofs > maxofs:\n ofs = maxofs\n # Translate back to offsets relative to a[0]\n lastofs += hint\n ofs += hint\n\n assert start - 1 <= lastofs and lastofs < ofs and ofs <= stop\n # Now a[lastofs] <= key < a[ofs], so key belongs somewhere to the\n # right of lastofs but no farther right than ofs. Do a binary\n # search, with invariant a[lastofs-1] <= key < a[ofs].\n lastofs += 1\n while lastofs < ofs:\n m = lastofs + ((ofs - lastofs) >> 1)\n if LT(key, a[m]):\n # key < a[m]\n ofs = m\n else:\n # a[m] <= key\n lastofs = m + 1\n # Now lastofs == ofs, so a[ofs - 1] <= key < a[ofs]\n return ofs\n\n\n @wrap\n def merge_compute_minrun(n):\n \"\"\"\n Compute a good value for the minimum run length; natural runs shorter\n than this are boosted artificially via binary insertion.\n\n If n < 64, return n (it's too small to bother with fancy stuff).\n Else if n is an exact power of 2, return 32.\n Else return an int k, 32 <= k <= 64, such that n/k is close to, but\n strictly less than, an exact power of 2.\n\n See listsort.txt for more info.\n \"\"\"\n r = 0\n assert n >= 0\n while n >= 64:\n r |= n & 1\n n >>= 1\n return n + r\n\n\n @wrap\n def sortslice_copy(dest_keys, dest_values, dest_start,\n src_keys, src_values, src_start,\n nitems):\n \"\"\"\n Upwards memcpy().\n \"\"\"\n assert src_start >= 0\n assert dest_start >= 0\n for i in range(nitems):\n dest_keys[dest_start + i] = src_keys[src_start + i]\n if has_values(src_keys, src_values):\n for i in range(nitems):\n dest_values[dest_start + i] = src_values[src_start + i]\n\n @wrap\n def sortslice_copy_down(dest_keys, dest_values, dest_start,\n src_keys, src_values, src_start,\n nitems):\n \"\"\"\n Downwards memcpy().\n \"\"\"\n assert src_start >= 0\n assert dest_start >= 0\n for i in range(nitems):\n dest_keys[dest_start - i] = src_keys[src_start - i]\n if has_values(src_keys, src_values):\n for i in range(nitems):\n dest_values[dest_start - i] = src_values[src_start - i]\n\n\n # Disable this for debug or perf comparison\n DO_GALLOP = 1\n\n @wrap\n def merge_lo(ms, keys, values, ssa, na, ssb, nb):\n \"\"\"\n Merge the na elements starting at ssa with the nb elements starting at\n ssb = ssa + na in a stable way, in-place. na and nb must be > 0,\n and should have na <= nb. See listsort.txt for more info.\n\n An updated MergeState is returned (with possibly a different min_gallop\n or larger temp arrays).\n\n NOTE: compared to CPython's timsort, the requirement that\n \"Must also have that keys[ssa + na - 1] belongs at the end of the merge\"\n\n is removed. This makes the code a bit simpler and easier to reason about.\n \"\"\"\n assert na > 0 and nb > 0 and na <= nb\n assert ssb == ssa + na\n # First copy [ssa, ssa + na) into the temp space\n ms = merge_getmem(ms, na)\n sortslice_copy(ms.keys, ms.values, 0,\n keys, values, ssa,\n na)\n a_keys = ms.keys\n a_values = ms.values\n b_keys = keys\n b_values = values\n dest = ssa\n ssa = 0\n\n _has_values = has_values(a_keys, a_values)\n min_gallop = ms.min_gallop\n\n # Now start merging into the space left from [ssa, ...)\n\n while nb > 0 and na > 0:\n # Do the straightforward thing until (if ever) one run\n # appears to win consistently.\n acount = 0\n bcount = 0\n\n while True:\n if LT(b_keys[ssb], a_keys[ssa]):\n keys[dest] = b_keys[ssb]\n if _has_values:\n values[dest] = b_values[ssb]\n dest += 1\n ssb += 1\n nb -= 1\n if nb == 0:\n break\n # It's a B run\n bcount += 1\n acount = 0\n if bcount >= min_gallop:\n break\n else:\n keys[dest] = a_keys[ssa]\n if _has_values:\n values[dest] = a_values[ssa]\n dest += 1\n ssa += 1\n na -= 1\n if na == 0:\n break\n # It's a A run\n acount += 1\n bcount = 0\n if acount >= min_gallop:\n break\n\n # One run is winning so consistently that galloping may\n # be a huge win. So try that, and continue galloping until\n # (if ever) neither run appears to be winning consistently\n # anymore.\n if DO_GALLOP and na > 0 and nb > 0:\n min_gallop += 1\n\n while acount >= MIN_GALLOP or bcount >= MIN_GALLOP:\n # As long as we gallop without leaving this loop, make\n # the heuristic more likely\n min_gallop -= min_gallop > 1\n\n # Gallop in A to find where keys[ssb] should end up\n k = gallop_right(b_keys[ssb], a_keys, ssa, ssa + na, ssa)\n # k is an index, make it a size\n k -= ssa\n acount = k\n if k > 0:\n # Copy everything from A before k\n sortslice_copy(keys, values, dest,\n a_keys, a_values, ssa,\n k)\n dest += k\n ssa += k\n na -= k\n if na == 0:\n # Finished merging\n break\n # Copy keys[ssb]\n keys[dest] = b_keys[ssb]\n if _has_values:\n values[dest] = b_values[ssb]\n dest += 1\n ssb += 1\n nb -= 1\n if nb == 0:\n # Finished merging\n break\n\n # Gallop in B to find where keys[ssa] should end up\n k = gallop_left(a_keys[ssa], b_keys, ssb, ssb + nb, ssb)\n # k is an index, make it a size\n k -= ssb\n bcount = k\n if k > 0:\n # Copy everything from B before k\n # NOTE: source and dest are the same buffer, but the\n # destination index is below the source index\n sortslice_copy(keys, values, dest,\n b_keys, b_values, ssb,\n k)\n dest += k\n ssb += k\n nb -= k\n if nb == 0:\n # Finished merging\n break\n # Copy keys[ssa]\n keys[dest] = a_keys[ssa]\n if _has_values:\n values[dest] = a_values[ssa]\n dest += 1\n ssa += 1\n na -= 1\n if na == 0:\n # Finished merging\n break\n\n # Penalize it for leaving galloping mode\n min_gallop += 1\n\n # Merge finished, now handle the remaining areas\n if nb == 0:\n # Only A remaining to copy at the end of the destination area\n sortslice_copy(keys, values, dest,\n a_keys, a_values, ssa,\n na)\n else:\n assert na == 0\n assert dest == ssb\n # B's tail is already at the right place, do nothing\n\n return merge_adjust_gallop(ms, min_gallop)\n\n\n @wrap\n def merge_hi(ms, keys, values, ssa, na, ssb, nb):\n \"\"\"\n Merge the na elements starting at ssa with the nb elements starting at\n ssb = ssa + na in a stable way, in-place. na and nb must be > 0,\n and should have na >= nb. See listsort.txt for more info.\n\n An updated MergeState is returned (with possibly a different min_gallop\n or larger temp arrays).\n\n NOTE: compared to CPython's timsort, the requirement that\n \"Must also have that keys[ssa + na - 1] belongs at the end of the merge\"\n\n is removed. This makes the code a bit simpler and easier to reason about.\n \"\"\"\n assert na > 0 and nb > 0 and na >= nb\n assert ssb == ssa + na\n # First copy [ssb, ssb + nb) into the temp space\n ms = merge_getmem(ms, nb)\n sortslice_copy(ms.keys, ms.values, 0,\n keys, values, ssb,\n nb)\n a_keys = keys\n a_values = values\n b_keys = ms.keys\n b_values = ms.values\n\n # Now start merging *in descending order* into the space left\n # from [..., ssb + nb).\n dest = ssb + nb - 1\n ssb = nb - 1\n ssa = ssa + na - 1\n\n _has_values = has_values(b_keys, b_values)\n min_gallop = ms.min_gallop\n\n while nb > 0 and na > 0:\n # Do the straightforward thing until (if ever) one run\n # appears to win consistently.\n acount = 0\n bcount = 0\n\n while True:\n if LT(b_keys[ssb], a_keys[ssa]):\n # We merge in descending order, so copy the larger value\n keys[dest] = a_keys[ssa]\n if _has_values:\n values[dest] = a_values[ssa]\n dest -= 1\n ssa -= 1\n na -= 1\n if na == 0:\n break\n # It's a A run\n acount += 1\n bcount = 0\n if acount >= min_gallop:\n break\n else:\n keys[dest] = b_keys[ssb]\n if _has_values:\n values[dest] = b_values[ssb]\n dest -= 1\n ssb -= 1\n nb -= 1\n if nb == 0:\n break\n # It's a B run\n bcount += 1\n acount = 0\n if bcount >= min_gallop:\n break\n\n # One run is winning so consistently that galloping may\n # be a huge win. So try that, and continue galloping until\n # (if ever) neither run appears to be winning consistently\n # anymore.\n if DO_GALLOP and na > 0 and nb > 0:\n min_gallop += 1\n\n while acount >= MIN_GALLOP or bcount >= MIN_GALLOP:\n # As long as we gallop without leaving this loop, make\n # the heuristic more likely\n min_gallop -= min_gallop > 1\n\n # Gallop in A to find where keys[ssb] should end up\n k = gallop_right(b_keys[ssb], a_keys, ssa - na + 1, ssa + 1, ssa)\n # k is an index, make it a size from the end\n k = ssa + 1 - k\n acount = k\n if k > 0:\n # Copy everything from A after k.\n # Destination and source are the same buffer, and destination\n # index is greater, so copy from the end to the start.\n sortslice_copy_down(keys, values, dest,\n a_keys, a_values, ssa,\n k)\n dest -= k\n ssa -= k\n na -= k\n if na == 0:\n # Finished merging\n break\n # Copy keys[ssb]\n keys[dest] = b_keys[ssb]\n if _has_values:\n values[dest] = b_values[ssb]\n dest -= 1\n ssb -= 1\n nb -= 1\n if nb == 0:\n # Finished merging\n break\n\n # Gallop in B to find where keys[ssa] should end up\n k = gallop_left(a_keys[ssa], b_keys, ssb - nb + 1, ssb + 1, ssb)\n # k is an index, make it a size from the end\n k = ssb + 1 - k\n bcount = k\n if k > 0:\n # Copy everything from B before k\n sortslice_copy_down(keys, values, dest,\n b_keys, b_values, ssb,\n k)\n dest -= k\n ssb -= k\n nb -= k\n if nb == 0:\n # Finished merging\n break\n # Copy keys[ssa]\n keys[dest] = a_keys[ssa]\n if _has_values:\n values[dest] = a_values[ssa]\n dest -= 1\n ssa -= 1\n na -= 1\n if na == 0:\n # Finished merging\n break\n\n # Penalize it for leaving galloping mode\n min_gallop += 1\n\n # Merge finished, now handle the remaining areas\n if na == 0:\n # Only B remaining to copy at the front of the destination area\n sortslice_copy(keys, values, dest - nb + 1,\n b_keys, b_values, ssb - nb + 1,\n nb)\n else:\n assert nb == 0\n assert dest == ssa\n # A's front is already at the right place, do nothing\n\n return merge_adjust_gallop(ms, min_gallop)\n\n\n @wrap\n def merge_at(ms, keys, values, i):\n \"\"\"\n Merge the two runs at stack indices i and i+1.\n\n An updated MergeState is returned.\n \"\"\"\n n = ms.n\n assert n >= 2\n assert i >= 0\n assert i == n - 2 or i == n - 3\n\n ssa, na = ms.pending[i]\n ssb, nb = ms.pending[i + 1]\n assert na > 0 and nb > 0\n assert ssa + na == ssb\n\n # Record the length of the combined runs; if i is the 3rd-last\n # run now, also slide over the last run (which isn't involved\n # in this merge). The current run i+1 goes away in any case.\n ms.pending[i] = MergeRun(ssa, na + nb)\n if i == n - 3:\n ms.pending[i + 1] = ms.pending[i + 2]\n ms = merge_pop(ms)\n\n # Where does b start in a? Elements in a before that can be\n # ignored (already in place).\n k = gallop_right(keys[ssb], keys, ssa, ssa + na, ssa)\n # [k, ssa + na) remains to be merged\n na -= k - ssa\n ssa = k\n if na == 0:\n return ms\n\n # Where does a end in b? Elements in b after that can be\n # ignored (already in place).\n k = gallop_left(keys[ssa + na - 1], keys, ssb, ssb + nb, ssb + nb - 1)\n # [ssb, k) remains to be merged\n nb = k - ssb\n\n # Merge what remains of the runs, using a temp array with\n # min(na, nb) elements.\n if na <= nb:\n return merge_lo(ms, keys, values, ssa, na, ssb, nb)\n else:\n return merge_hi(ms, keys, values, ssa, na, ssb, nb)\n\n\n @wrap\n def merge_collapse(ms, keys, values):\n \"\"\"\n Examine the stack of runs waiting to be merged, merging adjacent runs\n until the stack invariants are re-established:\n\n 1. len[-3] > len[-2] + len[-1]\n 2. len[-2] > len[-1]\n\n An updated MergeState is returned.\n\n See listsort.txt for more info.\n \"\"\"\n while ms.n > 1:\n pending = ms.pending\n n = ms.n - 2\n if ((n > 0 and pending[n-1].size <= pending[n].size + pending[n+1].size) or\n (n > 1 and pending[n-2].size <= pending[n-1].size + pending[n].size)):\n if pending[n - 1].size < pending[n + 1].size:\n # Merge smaller one first\n n -= 1\n ms = merge_at(ms, keys, values, n)\n elif pending[n].size < pending[n + 1].size:\n ms = merge_at(ms, keys, values, n)\n else:\n break\n return ms\n\n @wrap\n def merge_force_collapse(ms, keys, values):\n \"\"\"\n Regardless of invariants, merge all runs on the stack until only one\n remains. This is used at the end of the mergesort.\n\n An updated MergeState is returned.\n \"\"\"\n while ms.n > 1:\n pending = ms.pending\n n = ms.n - 2\n if n > 0:\n if pending[n - 1].size < pending[n + 1].size:\n # Merge the smaller one first\n n -= 1\n ms = merge_at(ms, keys, values, n)\n return ms\n\n\n @wrap\n def reverse_slice(keys, values, start, stop):\n \"\"\"\n Reverse a slice, in-place.\n \"\"\"\n i = start\n j = stop - 1\n while i < j:\n keys[i], keys[j] = keys[j], keys[i]\n i += 1\n j -= 1\n if has_values(keys, values):\n i = start\n j = stop - 1\n while i < j:\n values[i], values[j] = values[j], values[i]\n i += 1\n j -= 1\n\n\n @wrap\n def run_timsort_with_mergestate(ms, keys, values):\n \"\"\"\n Run timsort with the mergestate.\n \"\"\"\n nremaining = len(keys)\n if nremaining < 2:\n return\n\n # March over the array once, left to right, finding natural runs,\n # and extending short natural runs to minrun elements.\n minrun = merge_compute_minrun(nremaining)\n\n lo = zero\n while nremaining > 0:\n n, desc = count_run(keys, lo, lo + nremaining)\n if desc:\n # Descending run => reverse\n reverse_slice(keys, values, lo, lo + n)\n # If short, extend to min(minrun, nremaining)\n if n < minrun:\n force = min(minrun, nremaining)\n binarysort(keys, values, lo, lo + force, lo + n)\n n = force\n # Push run onto stack, and maybe merge.\n ms = merge_append(ms, MergeRun(lo, n))\n ms = merge_collapse(ms, keys, values)\n # Advance to find next run.\n lo += n\n nremaining -= n\n\n # All initial runs have been discovered, now finish merging.\n ms = merge_force_collapse(ms, keys, values)\n assert ms.n == 1\n assert ms.pending[0] == (0, len(keys))\n\n\n @wrap\n def run_timsort(keys):\n \"\"\"\n Run timsort over the given keys.\n \"\"\"\n values = keys\n run_timsort_with_mergestate(merge_init(keys), keys, values)\n\n\n @wrap\n def run_timsort_with_values(keys, values):\n \"\"\"\n Run timsort over the given keys and values.\n \"\"\"\n run_timsort_with_mergestate(merge_init_with_values(keys, values),\n keys, values)\n\n return TimsortImplementation(\n wrap,\n count_run, binarysort, gallop_left, gallop_right,\n merge_init, merge_append, merge_pop,\n merge_compute_minrun, merge_lo, merge_hi, merge_at,\n merge_force_collapse, merge_collapse,\n run_timsort, run_timsort_with_values)", "metadata": "root.make_timsort_impl", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def make_py_timsort(*args):\n return make_timsort_impl((lambda f: f), *args)", "metadata": "root.make_py_timsort", "header": "['module', '___EOS___']", "index": 937 }, { "content": "def make_jit_timsort(*args):\n from numba import jit\n return make_timsort_impl((lambda f: jit(nopython=True)(f)),\n *args)", "metadata": "root.make_jit_timsort", "header": "['module', '___EOS___']", "index": 940 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Tim", "sort", " ", "implementation", ".", " ", " ", "Mos", "tl", "y", " ", "adapt", "ed", " ", "from", " ", "CP", "yth", "on", "'", "s", " ", "listo", "bject", ".", "c", ".", "\\", "10", ";", "\\", "10", ";", "For", " ", "more", " ", "informati", "on", ",", " ", "see", " ", "lists", "ort", ".", "txt", " ", "in", " ", "CP", "yth", "on", "'", "s", " ", "source", " ", "tree", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "abs", "olute", "\\u", "import_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numba_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Tim", "sort", "Implementation", "_", "=_", "collections_", "._", "namedtuple_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Tim", "sort", "Implementation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "#", " ", "The", " ", "compile", " ", "function", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "subro", "utine", "s", " ", "exercise", "d", " ", "by", " ", "test\\u", "sort_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "\\u", "run", "'_", ",_", "'", "binar", "ys", "ort", "'_", ",_", "'", "gall", "op", "\\u", "left", "'_", ",_", "'", "gall", "op", "\\u", "right", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "merge", "\\u", "init", "'_", ",_", "'", "merge", "\\u", "append", "'_", ",_", "'", "merge", "\\u", "pop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "merge", "\\u", "compute", "\\u", "min", "run", "'_", ",_", "'", "merge", "\\u", "lo", "'_", ",_", "'", "merge", "\\u", "hi", "'_", ",_", "'", "merge", "\\u", "at", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "merge", "\\u", "force", "\\u", "collapse", "'_", ",_", "'", "merge", "\\u", "collapse", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "top", "-", "level", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "'", "run", "\\u", "tim", "sort", "'_", ",_", "'", "run", "\\u", "tim", "sort", "\\u", "with", "\\u", "values", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "maxim", "um", " ", "number", " ", "of", " ", "entri", "es", " ", "in", " ", "a", " ", "Merge", "State", "'", "s", " ", "pend", "ing", "-", "runs", " ", "stack", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "eno", "ugh", " ", "to", " ", "sort", " ", "arrays", " ", "of", " ", "size", " ", "up", " ", "to", " ", "about_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "32", " ", "*", " ", "phi", " ", "**", " ", "MAX", "\\u", "MERGE", "\\u", "PENDING_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "phi", " ", "~=", " ", "1.6", "18.", " ", " ", "85", " ", "is", " ", "rid", "icul", "ously", " ", "large", " ", "eno", "ugh", ",", " ", "good", " ", "for", " ", "an", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "2", "**", "64", " ", "element", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", " ", "this", " ", "implementation", " ", "doe", "sn", "'", "t", " ", "depend", " ", "on", " ", "it", " ", "(", "the", " ", "stack", " ", "is", " ", "dynami", "call", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allocated", "),", " ", "but", " ", "it", "'", "s", " ", "still", " ", "good", " ", "to", " ", "check", " ", "as", " ", "an", " ", "invariant", "._", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "MERGE", "\\u", "PENDING_", "=_", "85_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "we", " ", "get", " ", "int", "o", " ", "gall", "opin", "g", " ", "mode", ",", " ", "we", " ", "stay", " ", "there", " ", "unti", "l", " ", "bot", "h", " ", "runs", " ", "win", " ", "less_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "oft", "en", " ", "than", " ", "MIN", "\\u", "GAL", "LO", "P", " ", "consec", "uti", "ve", " ", "times", ".", " ", " ", "See", " ", "lists", "ort", ".", "txt", " ", "for", " ", "more", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "MIN", "\\u", "GAL", "LO", "P_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "size", " ", "for", " ", "temp", " ", "arrays", "._", "\\u\\u\\uNL\\u\\u\\u_", "MERGE", "STATE", "\\u", "TEMP", "\\u", "SIZE_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "merges", "tate", " ", "is", " ", "a", " ", "named", " ", "tuple", " ", "with", " ", "the", " ", "follow", "ing", " ", "member", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "*", "min", "\\u", "gall", "op", "*", " ", "is", " ", "an", " ", "integ", "er", " ", "controll", "ing", " ", "whe", "n", " ", "we", " ", "get", " ", "int", "o", " ", "gall", "opin", "g", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "*", "keys", "*", " ", "is", " ", "a", " ", "temp", " ", "list", " ", "for", " ", "mer", "ging", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "*", "values", "*", " ", "is", " ", "a", " ", "temp", " ", "list", " ", "for", " ", "mer", "ging", " ", "values", ",", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "*", "pend", "ing", "*", " ", "is", " ", "a", " ", "stack", " ", "of", " ", "pend", "ing", " ", "runs", " ", "to", " ", "be", " ", "merged_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "*", "n", "*", " ", "is", " ", "the", " ", "current", " ", "stack", " ", "length", " ", "of", " ", "*", "pend", "ing", "*_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Merge", "State_", "=_", "collections_", "._", "namedtuple_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Merge", "State", "'_", ",_", "(_", "'", "min", "\\u", "gall", "op", "'_", ",_", "'", "keys", "'_", ",_", "'", "values", "'_", ",_", "'", "pend", "ing", "'_", ",_", "'", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Merge", "Run_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "Merge", "Run", "'_", ",_", "(_", "'", "start", "'_", ",_", "'", "size", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "tim", "sort", "\\u", "impl_", "(_", "wrap_", ",_", "make", "\\u", "temp", "\\u", "area_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "\\u", "temp", "\\u", "area_", "=_", "wrap_", "(_", "make", "\\u", "temp", "\\u", "area_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intp", "_", "=_", "types_", "._", "intp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zero_", "=_", "intp", "_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "has", "\\u", "values_", "(_", "keys_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "values_", "is_", "not_", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "init_", "(_", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "a", " ", "Merge", "State", " ", "for", " ", "a", " ", "non", "-", "keyed", " ", "sort", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "size_", "=_", "min_", "(_", "len_", "(_", "keys_", ")_", "//_", "2_", "+_", "1_", ",_", "MERGE", "STATE", "\\u", "TEMP", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "keys_", "=_", "make", "\\u", "temp", "\\u", "area_", "(_", "keys_", ",_", "temp", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "values_", "=_", "temp", "\\u", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pending_", "=_", "[_", "Merge", "Run_", "(_", "zero_", ",_", "zero_", ")_", "]_", "*_", "MAX", "\\u", "MERGE", "\\u", "PENDING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Merge", "State_", "(_", "intp", "_", "(_", "MIN", "\\u", "GAL", "LO", "P_", ")_", ",_", "temp", "\\u", "keys_", ",_", "temp", "\\u", "values_", ",_", "pending_", ",_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "init", "\\u", "with", "\\u", "values_", "(_", "keys_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "a", " ", "Merge", "State", " ", "for", " ", "a", " ", "keyed", " ", "sort", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "size_", "=_", "min_", "(_", "len_", "(_", "keys_", ")_", "//_", "2_", "+_", "1_", ",_", "MERGE", "STATE", "\\u", "TEMP", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "keys_", "=_", "make", "\\u", "temp", "\\u", "area_", "(_", "keys_", ",_", "temp", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "values_", "=_", "make", "\\u", "temp", "\\u", "area_", "(_", "values_", ",_", "temp", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pending_", "=_", "[_", "Merge", "Run_", "(_", "zero_", ",_", "zero_", ")_", "]_", "*_", "MAX", "\\u", "MERGE", "\\u", "PENDING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Merge", "State_", "(_", "intp", "_", "(_", "MIN", "\\u", "GAL", "LO", "P_", ")_", ",_", "temp", "\\u", "keys_", ",_", "temp", "\\u", "values_", ",_", "pending_", ",_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "append_", "(_", "ms_", ",_", "run_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Append", " ", "a", " ", "run", " ", "on", " ", "the", " ", "merge", " ", "stack", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "ms_", "._", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n_", "<_", "MAX", "\\u", "MERGE", "\\u", "PENDING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms_", "._", "pending_", "[_", "n_", "]_", "=_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Merge", "State_", "(_", "ms_", "._", "min", "\\u", "gall", "op_", ",_", "ms_", "._", "keys_", ",_", "ms_", "._", "values_", ",_", "ms_", "._", "pending_", ",_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "pop_", "(_", "ms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pop", " ", "the", " ", "top", " ", "run", " ", "from", " ", "the", " ", "merge", " ", "stack", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Merge", "State_", "(_", "ms_", "._", "min", "\\u", "gall", "op_", ",_", "ms_", "._", "keys_", ",_", "ms_", "._", "values_", ",_", "ms_", "._", "pending_", ",_", "ms_", "._", "n_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "getm", "em_", "(_", "ms_", ",_", "need", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "eno", "ugh", " ", "temp", " ", "memory", " ", "for", " ", "'", "need", "'", " ", "items", " ", "is", " ", "avail", "able", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allo", "ced", "_", "=_", "len_", "(_", "ms_", "._", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "_", "<=_", "allo", "ced", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Over", "-", "allocate", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "allo", "ced", "_", "<_", "need", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allo", "ced", "_", "=_", "allo", "ced", "_", "<<_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "reall", "oc", "!", " ", " ", "Tha", "t", " ", "can", " ", "cost", " ", "cycle", "s", " ", "to", " ", "copy", " ", "the", " ", "old", " ", "data", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "care", " ", "what", "'", "s", " ", "in", " ", "the", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "keys_", "=_", "make", "\\u", "temp", "\\u", "area_", "(_", "ms_", "._", "keys_", ",_", "allo", "ced", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "values_", "(_", "ms_", "._", "keys_", ",_", "ms_", "._", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "values_", "=_", "make", "\\u", "temp", "\\u", "area_", "(_", "ms_", "._", "values_", ",_", "allo", "ced", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "values_", "=_", "temp", "\\u", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Merge", "State_", "(_", "ms_", "._", "min", "\\u", "gall", "op_", ",_", "temp", "\\u", "keys_", ",_", "temp", "\\u", "values_", ",_", "ms_", "._", "pending_", ",_", "ms_", "._", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "adjust", "\\u", "gall", "op_", "(_", "ms_", ",_", "new", "\\u", "gall", "op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Modif", "y", " ", "the", " ", "Merge", "State", "'", "s", " ", "min", "\\u", "gall", "op", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Merge", "State_", "(_", "intp", "_", "(_", "new", "\\u", "gall", "op_", ")_", ",_", "ms_", "._", "keys_", ",_", "ms_", "._", "values_", ",_", "ms_", "._", "pending_", ",_", "ms_", "._", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "LT_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tri", "via", "l", " ", "compa", "ris", "on", " ", "function", " ", "bet", "ween", " ", "two", " ", "keys", ".", " ", " ", "Thi", "s", " ", "is", " ", "factor", "ed", " ", "out", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "make", " ", "it", " ", "clear", " ", "where", " ", "comparisons", " ", "occur", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "<_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "binar", "ys", "ort_", "(_", "keys_", ",_", "values_", ",_", "lo_", ",_", "hi_", ",_", "start_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "binar", "ys", "ort", " ", "is", " ", "the", " ", "best", " ", "method", " ", "for", " ", "sorting", " ", "small", " ", "arrays", ":", " ", "it", " ", "doe", "s", "\\", "10", ";", " ", " ", " ", " ", "few", " ", "compare", "s", ",", " ", "but", " ", "can", " ", "do", " ", "data", " ", "movement", " ", "quadratic", " ", "in", " ", "the", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "element", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "[", "lo", ",", " ", "hi", ")", " ", "is", " ", "a", " ", "contiguous", " ", "slice", " ", "of", " ", "a", " ", "list", ",", " ", "and", " ", "is", " ", "sorte", "d", " ", "via", "\\", "10", ";", " ", " ", " ", " ", "binar", "y", " ", "insertion", ".", " ", " ", "Thi", "s", " ", "sort", " ", "is", " ", "stable", ".", "\\", "10", ";", " ", " ", " ", " ", "On", " ", "entry", ",", " ", "must", " ", "have", " ", "lo", " ", "<=", " ", "start", " ", "<=", " ", "hi", ",", " ", "and", " ", "tha", "t", " ", "[", "lo", ",", " ", "start", ")", " ", "is", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "sorte", "d", " ", "(", "pass", " ", "start", " ", "==", " ", "lo", " ", "if", " ", "you", " ", "don", "'", "t", " ", "know", "!)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lo_", "<=_", "start_", "and_", "start_", "<=_", "hi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "has", "\\u", "values_", "=_", "has", "\\u", "values_", "(_", "keys_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lo_", "==_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "start_", "<_", "hi_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pivot_", "=_", "keys_", "[_", "start_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bis", "ect", " ", "to", " ", "find", " ", "where", " ", "to", " ", "insert", " ", "`", "piv", "ot", "`_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "bisect", "ion", " ", "only", " ", "wins", " ", "over", " ", "linear", " ", "search", " ", "if", " ", "the", " ", "comparison_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", " ", "is", " ", "muc", "h", " ", "more", " ", "expen", "sive", " ", "than", " ", "simp", "ly", " ", "movin", "g", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "l_", "=_", "lo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inva", "rian", "ts", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "piv", "ot", " ", ">=", " ", "all", " ", "in", " ", "[", "lo", ",", " ", "l", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "piv", "ot", " ", " ", "<", " ", "all", " ", "in", " ", "[", "r", ",", " ", "start", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "second", " ", "is", " ", "vac", "uo", "usl", "y", " ", "true", " ", "at", " ", "the", " ", "start", "._", "\\u\\u\\uNL\\u\\u\\u_", "while_", "l_", "<_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "l_", "+_", "(_", "(_", "r_", "-_", "l_", ")_", ">>_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "LT_", "(_", "pivot_", ",_", "keys_", "[_", "p_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l_", "=_", "p_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "invariant", "s", " ", "still", " ", "hold", ",", " ", "so", " ", "piv", "ot", " ", ">=", " ", "all", " ", "in", " ", "[", "lo", ",", " ", "l", ")", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "piv", "ot", " ", "<", " ", "all", " ", "in", " ", "[", "l", ",", " ", "start", "),", " ", "so", " ", "piv", "ot", " ", "belo", "ngs", " ", "at", " ", "l", ".", " ", " ", "Note_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "if", " ", "there", " ", "are", " ", "element", "s", " ", "equal", " ", "to", " ", "piv", "ot", ",", " ", "l", " ", "points", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "slot", " ", "after", " ", "them", " ", "--", " ", "tha", "t", "'", "s", " ", "wh", "y", " ", "this", " ", "sort", " ", "is", " ", "stable", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Slide", " ", "over", " ", "to", " ", "make", " ", "room", " ", "(", "aka", " ", "mem", "move", "())", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p_", "in_", "range_", "(_", "start_", ",_", "l_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "[_", "p_", "]_", "=_", "keys_", "[_", "p_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "[_", "l_", "]_", "=_", "pivot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "piv", "ot", "\\u", "val_", "=_", "values_", "[_", "start_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "range_", "(_", "start_", ",_", "l_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "values_", "[_", "p_", "]_", "=_", "values_", "[_", "p_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "[_", "l_", "]_", "=_", "piv", "ot", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "count", "\\u", "run_", "(_", "keys_", ",_", "lo_", ",_", "hi_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "length", " ", "of", " ", "the", " ", "run", " ", "beginn", "ing", " ", "at", " ", "lo", ",", " ", "in", " ", "the", " ", "slice", " ", "[", "lo", ",", " ", "hi", ").", "\\", "10", ";", " ", " ", " ", " ", "lo", " ", "<", " ", "hi", " ", "is", " ", "require", "d", " ", "on", " ", "entry", ".", " ", " ", "\"", "A", " ", "run", "\"", " ", "is", " ", "the", " ", "long", "est", " ", "ascen", "ding", " ", "sequence", ",", " ", "with", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "lo", "[", "0", "]", " ", "<=", " ", "lo", "[", "1", "]", " ", "<=", " ", "lo", "[", "2", "]", " ", "<=", " ", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "long", "est", " ", "descend", "ing", " ", "sequence", ",", " ", "with", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "lo", "[", "0", "]", " ", ">", " ", "lo", "[", "1", "]", " ", ">", " ", "lo", "[", "2", "]", " ", ">", " ", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "tuple", " ", "(", "length", ",", " ", "descend", "ing", ")", " ", "is", " ", "return", "ed", ",", " ", "where", " ", "boolean", " ", "*", "descend", "ing", "*", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "set", " ", "to", " ", "0", " ", "in", " ", "the", " ", "former", " ", "case", ",", " ", "or", " ", "to", " ", "1", " ", "in", " ", "the", " ", "latt", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "its", " ", "inten", "ded", " ", "use", " ", "in", " ", "a", " ", "stable", " ", "merges", "ort", ",", " ", "the", " ", "strict", "ness", " ", "of", " ", "the", " ", "def", "n", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "\"", "descend", "ing", "\"", " ", "is", " ", "need", "ed", " ", "so", " ", "tha", "t", " ", "the", " ", "caller", " ", "can", " ", "safe", "ly", " ", "reverse", " ", "a", " ", "descend", "ing", "\\", "10", ";", " ", " ", " ", " ", "sequence", " ", "with", "out", " ", "viola", "ting", " ", "stability", " ", "(", "strict", " ", ">", " ", "ensure", "s", " ", "there", " ", "are", " ", "no", " ", "equal", "\\", "10", ";", " ", " ", " ", " ", "element", "s", " ", "to", " ", "get", " ", "out", " ", "of", " ", "order", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lo_", "<_", "hi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lo_", "+_", "1_", "==_", "hi_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tri", "via", "l", " ", "1", "-", "long", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "LT_", "(_", "keys_", "[_", "lo_", "+_", "1_", "]_", ",_", "keys_", "[_", "lo_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Descen", "ding", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "range_", "(_", "lo_", "+_", "2_", ",_", "hi_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "LT_", "(_", "keys_", "[_", "k_", "]_", ",_", "keys_", "[_", "k_", "-_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "k_", "-_", "lo_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "hi_", "-_", "lo_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Asc", "ending", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "range_", "(_", "lo_", "+_", "2_", ",_", "hi_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LT_", "(_", "keys_", "[_", "k_", "]_", ",_", "keys_", "[_", "k_", "-_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "k_", "-_", "lo_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "hi_", "-_", "lo_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "gall", "op", "\\u", "left_", "(_", "key_", ",_", "a_", ",_", "start_", ",_", "stop_", ",_", "hint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Locat", "e", " ", "the", " ", "proper", " ", "position", " ", "of", " ", "key", " ", "in", " ", "a", " ", "sorte", "d", " ", "vector", ";", " ", "if", " ", "the", " ", "vector", " ", "contain", "s", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "element", " ", "equal", " ", "to", " ", "key", ",", " ", "return", " ", "the", " ", "position", " ", "immediate", "ly", " ", "to", " ", "the", " ", "left", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "left", "most", " ", "equal", " ", "element", ".", " ", " ", "[", "gall", "op", "\\u", "right", "()", " ", "doe", "s", " ", "the", " ", "same", " ", "except", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "position", " ", "to", " ", "the", " ", "right", " ", "of", " ", "the", " ", "right", "most", " ", "equal", " ", "element", " ", "(", "if", " ", "any", ").", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"", "a", "\"", " ", "is", " ", "a", " ", "sorte", "d", " ", "vector", " ", "with", " ", "stop", " ", "element", "s", ",", " ", "startin", "g", " ", "at", " ", "a", "[", "start", "].", "\\", "10", ";", " ", " ", " ", " ", "stop", " ", "must", " ", "be", " ", ">", " ", "start", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"", "hin", "t", "\"", " ", "is", " ", "an", " ", "index", " ", "at", " ", "whi", "ch", " ", "to", " ", "begin", " ", "the", " ", "search", ",", " ", "start", " ", "<=", " ", "hin", "t", " ", "<", " ", "stop", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "close", "r", " ", "hin", "t", " ", "is", " ", "to", " ", "the", " ", "final", " ", "result", ",", " ", "the", " ", "faste", "r", " ", "this", " ", "runs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "return", " ", "value", " ", "is", " ", "the", " ", "int", " ", "k", " ", "in", " ", "start", "..", "stop", " ", "suc", "h", " ", "tha", "t", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "a", "[", "k", "-1", "]", " ", "<", " ", "key", " ", "<=", " ", "a", "[", "k", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "prete", "ndin", "g", " ", "tha", "t", " ", "a", "[", "start", "-1", "]", " ", "is", " ", "minu", "s", " ", "infinity", " ", "and", " ", "a", "[", "stop", "]", " ", "is", " ", "plus", " ", "infinity", ".", "\\", "10", ";", " ", " ", " ", " ", "IO", "W", ",", " ", "key", " ", "belo", "ngs", " ", "at", " ", "index", " ", "k", ";", " ", "or", ",", " ", "IO", "W", ",", " ", "the", " ", "first", " ", "k", " ", "element", "s", " ", "of", " ", "a", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "prece", "de", " ", "key", ",", " ", "and", " ", "the", " ", "last", " ", "stop", "-", "start", "-", "k", " ", "shou", "ld", " ", "follow", " ", "key", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "lists", "ort", ".", "txt", " ", "for", " ", "info", " ", "on", " ", "the", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "stop_", ">_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "hint_", ">=_", "start_", "and_", "hint_", "<_", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "stop_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "gall", "op", " ", "from", " ", "the", " ", "hin", "t", " ", "to", " ", "find", " ", "a", " ", "\"", "good", "\"", " ", "subin", "ter", "val", " ", "for", " ", "bisect", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "last", "ofs_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "LT_", "(_", "a_", "[_", "hint_", "]_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", "[", "hin", "t", "]", " ", "<", " ", "key", " ", "=>", " ", "gall", "op", " ", "right", ",", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "a", "[", "hin", "t", " ", "+", " ", "last", "ofs", "]", " ", "<", " ", "key", " ", "<=", " ", "a", "[", "hin", "t", " ", "+", " ", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "ofs_", "=_", "stop_", "-_", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ofs_", "<_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LT_", "(_", "a_", "[_", "hint_", "+_", "ofs_", "]_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "ofs_", "=_", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "=_", "(_", "ofs_", "<<_", "1_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ofs_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Int", " ", "overflow", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ofs_", "=_", "max", "ofs_", "\\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_", "#", " ", "key", " ", "<=", " ", "a", "[", "hin", "t", " ", "+", " ", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ofs_", ">_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ofs_", "=_", "max", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Translate", " ", "back", " ", "to", " ", "offset", "s", " ", "relative", " ", "to", " ", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "ofs_", "+=_", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "+=_", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "key", " ", "<=", " ", "a", "[", "hin", "t", "]", " ", "=>", " ", "gall", "op", " ", "left", ",", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", "[", "hin", "t", " ", "-", " ", "ofs", "]", " ", "<", " ", "key", " ", "<=", " ", "a", "[", "hin", "t", " ", "-", " ", "last", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "ofs_", "=_", "hint_", "-_", "start_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ofs_", "<_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LT_", "(_", "a_", "[_", "hint_", "-_", "ofs_", "]_", ",_", "key_", ")_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "key", " ", "<=", " ", "a", "[", "hin", "t", " ", "-", " ", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "ofs_", "=_", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "=_", "(_", "ofs_", "<<_", "1_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ofs_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Int", " ", "overflow", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ofs_", "=_", "max", "ofs_", "\\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_", "ofs_", ">_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ofs_", "=_", "max", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Translate", " ", "back", " ", "to", " ", "posit", "ive", " ", "offset", "s", " ", "relative", " ", "to", " ", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "ofs_", ",_", "ofs_", "=_", "hint_", "-_", "ofs_", ",_", "hint_", "-_", "last", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "start_", "-_", "1_", "<=_", "last", "ofs_", "and_", "last", "ofs_", "<_", "ofs_", "and_", "ofs_", "<=_", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "a", "[", "last", "ofs", "]", " ", "<", " ", "key", " ", "<=", " ", "a", "[", "ofs", "],", " ", "so", " ", "key", " ", "belo", "ngs", " ", "some", "where", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "right", " ", "of", " ", "last", "ofs", " ", "but", " ", "no", " ", "far", "ther", " ", "right", " ", "than", " ", "ofs", ".", " ", " ", "Do", " ", "a", " ", "binary_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "search", ",", " ", "with", " ", "invariant", " ", "a", "[", "last", "ofs", "-1", "]", " ", "<", " ", "key", " ", "<=", " ", "a", "[", "ofs", "].", "_", "\\u\\u\\uNL\\u\\u\\u_", "last", "ofs_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "last", "ofs_", "<_", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "last", "ofs_", "+_", "(_", "(_", "ofs_", "-_", "last", "ofs_", ")_", ">>_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "LT_", "(_", "a_", "[_", "m_", "]_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", "[", "m", "]", " ", "<", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "ofs_", "=_", "m_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "key", " ", "<=", " ", "a", "[", "m", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ofs_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "last", "ofs", " ", "==", " ", "ofs", ",", " ", "so", " ", "a", "[", "ofs", " ", "-", " ", "1", "]", " ", "<", " ", "key", " ", "<=", " ", "a", "[", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "gall", "op", "\\u", "right_", "(_", "key_", ",_", "a_", ",_", "start_", ",_", "stop_", ",_", "hint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Exa", "ctl", "y", " ", "like", " ", "gall", "op", "\\u", "left", "()", ",", " ", "except", " ", "tha", "t", " ", "if", " ", "key", " ", "alr", "ead", "y", " ", "exist", "s", " ", "in", " ", "a", "[", "start", ":", "stop", "],", "\\", "10", ";", " ", " ", " ", " ", "find", "s", " ", "the", " ", "position", " ", "immediate", "ly", " ", "to", " ", "the", " ", "right", " ", "of", " ", "the", " ", "right", "most", " ", "equal", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "return", " ", "value", " ", "is", " ", "the", " ", "int", " ", "k", " ", "in", " ", "start", "..", "stop", " ", "suc", "h", " ", "tha", "t", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "a", "[", "k", "-1", "]", " ", "<=", " ", "key", " ", "<", " ", "a", "[", "k", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "duplicat", "ion", " ", "is", " ", "mass", "ive", ",", " ", "but", " ", "this", " ", "is", " ", "eno", "ugh", " ", "different", " ", "give", "n", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "we", "'", "re", " ", "stick", "ing", " ", "to", " ", "\"<", "\"", " ", "comparisons", " ", "tha", "t", " ", "it", "'", "s", " ", "muc", "h", " ", "hard", "er", " ", "to", " ", "follow", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "writt", "en", " ", "as", " ", "one", " ", "routin", "e", " ", "with", " ", "ye", "t", " ", "anot", "her", " ", "\"", "left", " ", "or", " ", "right", "?\"", " ", "flag", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "stop_", ">_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "hint_", ">=_", "start_", "and_", "hint_", "<_", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "stop_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "gall", "op", " ", "from", " ", "the", " ", "hin", "t", " ", "to", " ", "find", " ", "a", " ", "\"", "good", "\"", " ", "subin", "ter", "val", " ", "for", " ", "bisect", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "last", "ofs_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "LT_", "(_", "key_", ",_", "a_", "[_", "hint_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "key", " ", "<", " ", "a", "[", "hin", "t", "]", " ", "=>", " ", "gall", "op", " ", "left", ",", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "a", "[", "hin", "t", " ", "-", " ", "ofs", "]", " ", "<=", " ", "key", " ", "<", " ", "a", "[", "hin", "t", " ", "-", " ", "last", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "ofs_", "=_", "hint_", "-_", "start_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ofs_", "<_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LT_", "(_", "key_", ",_", "a_", "[_", "hint_", "-_", "ofs_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "ofs_", "=_", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "=_", "(_", "ofs_", "<<_", "1_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ofs_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Int", " ", "overflow", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ofs_", "=_", "max", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", "[", "hin", "t", " ", "-", " ", "ofs", "]", " ", "<=", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ofs_", ">_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ofs_", "=_", "max", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Translate", " ", "back", " ", "to", " ", "posit", "ive", " ", "offset", "s", " ", "relative", " ", "to", " ", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "ofs_", ",_", "ofs_", "=_", "hint_", "-_", "ofs_", ",_", "hint_", "-_", "last", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", "[", "hin", "t", "]", " ", "<=", " ", "key", " ", "--", " ", "gall", "op", " ", "right", ",", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", "[", "hin", "t", " ", "+", " ", "last", "ofs", "]", " ", "<=", " ", "key", " ", "<", " ", "a", "[", "hin", "t", " ", "+", " ", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "ofs_", "=_", "stop_", "-_", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ofs_", "<_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LT_", "(_", "key_", ",_", "a_", "[_", "hint_", "+_", "ofs_", "]_", ")_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", "[", "hin", "t", " ", "+", " ", "ofs", "]", " ", "<=", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "ofs_", "=_", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "=_", "(_", "ofs_", "<<_", "1_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ofs_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Int", " ", "overflow", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ofs_", "=_", "max", "ofs_", "\\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_", "ofs_", ">_", "max", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ofs_", "=_", "max", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Translate", " ", "back", " ", "to", " ", "offset", "s", " ", "relative", " ", "to", " ", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "ofs_", "+=_", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofs_", "+=_", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "start_", "-_", "1_", "<=_", "last", "ofs_", "and_", "last", "ofs_", "<_", "ofs_", "and_", "ofs_", "<=_", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "a", "[", "last", "ofs", "]", " ", "<=", " ", "key", " ", "<", " ", "a", "[", "ofs", "],", " ", "so", " ", "key", " ", "belo", "ngs", " ", "some", "where", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "right", " ", "of", " ", "last", "ofs", " ", "but", " ", "no", " ", "far", "ther", " ", "right", " ", "than", " ", "ofs", ".", " ", " ", "Do", " ", "a", " ", "binary_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "search", ",", " ", "with", " ", "invariant", " ", "a", "[", "last", "ofs", "-1", "]", " ", "<=", " ", "key", " ", "<", " ", "a", "[", "ofs", "].", "_", "\\u\\u\\uNL\\u\\u\\u_", "last", "ofs_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "last", "ofs_", "<_", "ofs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "last", "ofs_", "+_", "(_", "(_", "ofs_", "-_", "last", "ofs_", ")_", ">>_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "LT_", "(_", "key_", ",_", "a_", "[_", "m_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "key", " ", "<", " ", "a", "[", "m", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ofs_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", "[", "m", "]", " ", "<=", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "ofs_", "=_", "m_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "last", "ofs", " ", "==", " ", "ofs", ",", " ", "so", " ", "a", "[", "ofs", " ", "-", " ", "1", "]", " ", "<=", " ", "key", " ", "<", " ", "a", "[", "ofs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ofs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "compute", "\\u", "min", "run_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "a", " ", "good", " ", "value", " ", "for", " ", "the", " ", "minim", "um", " ", "run", " ", "length", ";", " ", "natur", "al", " ", "runs", " ", "shorter", "\\", "10", ";", " ", " ", " ", " ", "than", " ", "this", " ", "are", " ", "boost", "ed", " ", "arti", "ficia", "ll", "y", " ", "via", " ", "binar", "y", " ", "insertion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "n", " ", "<", " ", "64", ",", " ", "return", " ", "n", " ", "(", "it", "'", "s", " ", "too", " ", "small", " ", "to", " ", "bot", "her", " ", "with", " ", "fancy", " ", "stu", "ff", ").", "\\", "10", ";", " ", " ", " ", " ", "Else", " ", "if", " ", "n", " ", "is", " ", "an", " ", "exact", " ", "power", " ", "of", " ", "2", ",", " ", "return", " ", "32.", "\\", "10", ";", " ", " ", " ", " ", "Else", " ", "return", " ", "an", " ", "int", " ", "k", ",", " ", "32", " ", "<=", " ", "k", " ", "<=", " ", "64", ",", " ", "suc", "h", " ", "tha", "t", " ", "n", "/", "k", " ", "is", " ", "close", " ", "to", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "strict", "ly", " ", "less", " ", "than", ",", " ", "an", " ", "exact", " ", "power", " ", "of", " ", "2", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "lists", "ort", ".", "txt", " ", "for", " ", "more", " ", "info", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "n_", ">=_", "64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "|=_", "n_", "&_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", ">>", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_", "+_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sorts", "lice", "\\u", "copy_", "(_", "dest", "\\u", "keys_", ",_", "dest", "\\u", "values_", ",_", "dest", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src", "\\u", "keys_", ",_", "src", "\\u", "values_", ",_", "src", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nitem", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Up", "ward", "s", " ", "memc", "py", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "src", "\\u", "start_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dest", "\\u", "start_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nitem", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "keys_", "[_", "dest", "\\u", "start_", "+_", "i_", "]_", "=_", "src", "\\u", "keys_", "[_", "src", "\\u", "start_", "+_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "values_", "(_", "src", "\\u", "keys_", ",_", "src", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "nitem", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "values_", "[_", "dest", "\\u", "start_", "+_", "i_", "]_", "=_", "src", "\\u", "values_", "[_", "src", "\\u", "start_", "+_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sorts", "lice", "\\u", "copy", "\\u", "down_", "(_", "dest", "\\u", "keys_", ",_", "dest", "\\u", "values_", ",_", "dest", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src", "\\u", "keys_", ",_", "src", "\\u", "values_", ",_", "src", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nitem", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Down", "ward", "s", " ", "memc", "py", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "src", "\\u", "start_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dest", "\\u", "start_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nitem", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "keys_", "[_", "dest", "\\u", "start_", "-_", "i_", "]_", "=_", "src", "\\u", "keys_", "[_", "src", "\\u", "start_", "-_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "values_", "(_", "src", "\\u", "keys_", ",_", "src", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "nitem", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "values_", "[_", "dest", "\\u", "start_", "-_", "i_", "]_", "=_", "src", "\\u", "values_", "[_", "src", "\\u", "start_", "-_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Disa", "ble", " ", "this", " ", "for", " ", "debug", " ", "or", " ", "perf", " ", "comparison_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DO", "\\u", "GAL", "LO", "P_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "lo_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "ssa", "_", ",_", "na_", ",_", "ss", "b_", ",_", "nb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Merge", " ", "the", " ", "na", " ", "element", "s", " ", "startin", "g", " ", "at", " ", "ssa", " ", "with", " ", "the", " ", "nb", " ", "element", "s", " ", "startin", "g", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "ss", "b", " ", "=", " ", "ssa", " ", "+", " ", "na", " ", "in", " ", "a", " ", "stable", " ", "way", ",", " ", "in", "-", "place", ".", " ", " ", "na", " ", "and", " ", "nb", " ", "must", " ", "be", " ", ">", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "shou", "ld", " ", "have", " ", "na", " ", "<=", " ", "nb", ".", " ", "See", " ", "lists", "ort", ".", "txt", " ", "for", " ", "more", " ", "info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "update", "d", " ", "Merge", "State", " ", "is", " ", "return", "ed", " ", "(", "with", " ", "possib", "ly", " ", "a", " ", "different", " ", "min", "\\u", "gall", "op", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "large", "r", " ", "temp", " ", "arrays", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "NOTE", ":", " ", "compare", "d", " ", "to", " ", "CP", "yth", "on", "'", "s", " ", "tim", "sort", ",", " ", "the", " ", "require", "ment", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "\"", "Mus", "t", " ", "als", "o", " ", "have", " ", "tha", "t", " ", "keys", "[", "ssa", " ", "+", " ", "na", " ", "-", " ", "1", "]", " ", "belo", "ngs", " ", "at", " ", "the", " ", "end", " ", "of", " ", "the", " ", "merge", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "remove", "d", ".", " ", "Thi", "s", " ", "make", "s", " ", "the", " ", "code", " ", "a", " ", "bit", " ", "simple", "r", " ", "and", " ", "easi", "er", " ", "to", " ", "reason", " ", "abo", "ut", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "na_", ">_", "0_", "and_", "nb_", ">_", "0_", "and_", "na_", "<=_", "nb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ss", "b_", "==_", "ssa", "_", "+_", "na_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "copy", " ", "[", "ssa", ",", " ", "ssa", " ", "+", " ", "na", ")", " ", "int", "o", " ", "the", " ", "temp", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "getm", "em_", "(_", "ms_", ",_", "na_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sorts", "lice", "\\u", "copy_", "(_", "ms_", "._", "keys_", ",_", "ms_", "._", "values_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", ",_", "values_", ",_", "ssa", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "na_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "keys_", "=_", "ms_", "._", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "values_", "=_", "ms_", "._", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u", "keys_", "=_", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u", "values_", "=_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "ssa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "has", "\\u", "values_", "=_", "has", "\\u", "values_", "(_", "a", "\\u", "keys_", ",_", "a", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "gall", "op_", "=_", "ms_", "._", "min", "\\u", "gall", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "start", " ", "mer", "ging", " ", "int", "o", " ", "the", " ", "space", " ", "left", " ", "from", " ", "[", "ssa", ",", " ", "...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "nb_", ">_", "0_", "and_", "na_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "straight", "forward", " ", "thing", " ", "unti", "l", " ", "(", "if", " ", "ever", ")", " ", "one", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appear", "s", " ", "to", " ", "win", " ", "consistent", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LT_", "(_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", ",_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "keys_", "[_", "dest_", "]_", "=_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "b", "\\u", "values_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nb_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "B", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bco", "unt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bco", "unt_", ">=_", "min", "\\u", "gall", "op_", ":_", "\\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 ", " ", "_", "keys_", "[_", "dest_", "]_", "=_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "a", "\\u", "values_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "A", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aco", "unt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aco", "unt_", ">=_", "min", "\\u", "gall", "op_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "run", " ", "is", " ", "winning", " ", "so", " ", "consistent", "ly", " ", "tha", "t", " ", "gall", "opin", "g", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "a", " ", "huge", " ", "win", ".", " ", " ", "So", " ", "try", " ", "tha", "t", ",", " ", "and", " ", "continue", " ", "gall", "opin", "g", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "if", " ", "ever", ")", " ", "nei", "ther", " ", "run", " ", "appear", "s", " ", "to", " ", "be", " ", "winning", " ", "consistent", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", "more", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DO", "\\u", "GAL", "LO", "P_", "and_", "na_", ">_", "0_", "and_", "nb_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "gall", "op_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "aco", "unt_", ">=_", "MIN", "\\u", "GAL", "LO", "P_", "or_", "bco", "unt_", ">=_", "MIN", "\\u", "GAL", "LO", "P_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "As", " ", "long", " ", "as", " ", "we", " ", "gall", "op", " ", "with", "out", " ", "leaving", " ", "this", " ", "loop", ",", " ", "make_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "heuristic", " ", "more", " ", "like", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "min", "\\u", "gall", "op_", "-=_", "min", "\\u", "gall", "op_", ">_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gal", "lop", " ", "in", " ", "A", " ", "to", " ", "find", " ", "where", " ", "keys", "[", "ss", "b", "]", " ", "shou", "ld", " ", "end", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "gall", "op", "\\u", "right_", "(_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", ",_", "a", "\\u", "keys_", ",_", "ssa", "_", ",_", "ssa", "_", "+_", "na_", ",_", "ssa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "k", " ", "is", " ", "an", " ", "index", ",", " ", "make", " ", "it", " ", "a", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "-=_", "ssa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aco", "unt_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "every", "thing", " ", "from", " ", "A", " ", "bef", "ore", " ", "k_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sorts", "lice", "\\u", "copy_", "(_", "keys_", ",_", "values_", ",_", "dest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a", "\\u", "keys_", ",_", "a", "\\u", "values_", ",_", "ssa", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "+=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "+=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "keys", "[", "ss", "b", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "[_", "dest_", "]_", "=_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "b", "\\u", "values_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nb_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gal", "lop", " ", "in", " ", "B", " ", "to", " ", "find", " ", "where", " ", "keys", "[", "ssa", "]", " ", "shou", "ld", " ", "end", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "k_", "=_", "gall", "op", "\\u", "left_", "(_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", ",_", "b", "\\u", "keys_", ",_", "ss", "b_", ",_", "ss", "b_", "+_", "nb_", ",_", "ss", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "k", " ", "is", " ", "an", " ", "index", ",", " ", "make", " ", "it", " ", "a", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "-=_", "ss", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "unt_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "every", "thing", " ", "from", " ", "B", " ", "bef", "ore", " ", "k_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "source", " ", "and", " ", "dest", " ", "are", " ", "the", " ", "same", " ", "buffer", ",", " ", "but", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "destinat", "ion", " ", "index", " ", "is", " ", "belo", "w", " ", "the", " ", "source", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sorts", "lice", "\\u", "copy_", "(_", "keys_", ",_", "values_", ",_", "dest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "\\u", "keys_", ",_", "b", "\\u", "values_", ",_", "ss", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "+=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", "+=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nb_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "keys", "[", "ssa", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "[_", "dest_", "]_", "=_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "a", "\\u", "values_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pen", "alize", " ", "it", " ", "for", " ", "leaving", " ", "gall", "opin", "g", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "\\u", "gall", "op_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "finish", "ed", ",", " ", "now", " ", "handle", " ", "the", " ", "rema", "inin", "g", " ", "areas_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nb_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "A", " ", "rema", "inin", "g", " ", "to", " ", "copy", " ", "at", " ", "the", " ", "end", " ", "of", " ", "the", " ", "destinat", "ion", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorts", "lice", "\\u", "copy_", "(_", "keys_", ",_", "values_", ",_", "dest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a", "\\u", "keys_", ",_", "a", "\\u", "values_", ",_", "ssa", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "na_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "na_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dest_", "==_", "ss", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "B", "'", "s", " ", "tail", " ", "is", " ", "alr", "ead", "y", " ", "at", " ", "the", " ", "right", " ", "place", ",", " ", "do", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "merge", "\\u", "adjust", "\\u", "gall", "op_", "(_", "ms_", ",_", "min", "\\u", "gall", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "hi_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "ssa", "_", ",_", "na_", ",_", "ss", "b_", ",_", "nb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Merge", " ", "the", " ", "na", " ", "element", "s", " ", "startin", "g", " ", "at", " ", "ssa", " ", "with", " ", "the", " ", "nb", " ", "element", "s", " ", "startin", "g", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "ss", "b", " ", "=", " ", "ssa", " ", "+", " ", "na", " ", "in", " ", "a", " ", "stable", " ", "way", ",", " ", "in", "-", "place", ".", " ", " ", "na", " ", "and", " ", "nb", " ", "must", " ", "be", " ", ">", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "shou", "ld", " ", "have", " ", "na", " ", ">=", " ", "nb", ".", " ", " ", "See", " ", "lists", "ort", ".", "txt", " ", "for", " ", "more", " ", "info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "update", "d", " ", "Merge", "State", " ", "is", " ", "return", "ed", " ", "(", "with", " ", "possib", "ly", " ", "a", " ", "different", " ", "min", "\\u", "gall", "op", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "large", "r", " ", "temp", " ", "arrays", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "NOTE", ":", " ", "compare", "d", " ", "to", " ", "CP", "yth", "on", "'", "s", " ", "tim", "sort", ",", " ", "the", " ", "require", "ment", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "\"", "Mus", "t", " ", "als", "o", " ", "have", " ", "tha", "t", " ", "keys", "[", "ssa", " ", "+", " ", "na", " ", "-", " ", "1", "]", " ", "belo", "ngs", " ", "at", " ", "the", " ", "end", " ", "of", " ", "the", " ", "merge", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "remove", "d", ".", " ", "Thi", "s", " ", "make", "s", " ", "the", " ", "code", " ", "a", " ", "bit", " ", "simple", "r", " ", "and", " ", "easi", "er", " ", "to", " ", "reason", " ", "abo", "ut", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "na_", ">_", "0_", "and_", "nb_", ">_", "0_", "and_", "na_", ">=_", "nb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ss", "b_", "==_", "ssa", "_", "+_", "na_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "copy", " ", "[", "ss", "b", ",", " ", "ss", "b", " ", "+", " ", "nb", ")", " ", "int", "o", " ", "the", " ", "temp", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "getm", "em_", "(_", "ms_", ",_", "nb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sorts", "lice", "\\u", "copy_", "(_", "ms_", "._", "keys_", ",_", "ms_", "._", "values_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", ",_", "values_", ",_", "ss", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "keys_", "=_", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "values_", "=_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u", "keys_", "=_", "ms_", "._", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u", "values_", "=_", "ms_", "._", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "start", " ", "mer", "ging", " ", "*", "in", " ", "descend", "ing", " ", "order", "*", " ", "int", "o", " ", "the", " ", "space", " ", "left_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "[...", ",", " ", "ss", "b", " ", "+", " ", "nb", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "ss", "b_", "+_", "nb_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", "=_", "nb_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "=_", "ssa", "_", "+_", "na_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "has", "\\u", "values_", "=_", "has", "\\u", "values_", "(_", "b", "\\u", "keys_", ",_", "b", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "gall", "op_", "=_", "ms_", "._", "min", "\\u", "gall", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "nb_", ">_", "0_", "and_", "na_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "straight", "forward", " ", "thing", " ", "unti", "l", " ", "(", "if", " ", "ever", ")", " ", "one", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appear", "s", " ", "to", " ", "win", " ", "consistent", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LT_", "(_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", ",_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "merge", " ", "in", " ", "descend", "ing", " ", "order", ",", " ", "so", " ", "copy", " ", "the", " ", "large", "r", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "keys_", "[_", "dest_", "]_", "=_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "a", "\\u", "values_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "A", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aco", "unt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aco", "unt_", ">=_", "min", "\\u", "gall", "op_", ":_", "\\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 ", " ", "_", "keys_", "[_", "dest_", "]_", "=_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "b", "\\u", "values_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nb_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "B", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bco", "unt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aco", "unt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bco", "unt_", ">=_", "min", "\\u", "gall", "op_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "run", " ", "is", " ", "winning", " ", "so", " ", "consistent", "ly", " ", "tha", "t", " ", "gall", "opin", "g", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "a", " ", "huge", " ", "win", ".", " ", " ", "So", " ", "try", " ", "tha", "t", ",", " ", "and", " ", "continue", " ", "gall", "opin", "g", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "if", " ", "ever", ")", " ", "nei", "ther", " ", "run", " ", "appear", "s", " ", "to", " ", "be", " ", "winning", " ", "consistent", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", "more", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DO", "\\u", "GAL", "LO", "P_", "and_", "na_", ">_", "0_", "and_", "nb_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "gall", "op_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "aco", "unt_", ">=_", "MIN", "\\u", "GAL", "LO", "P_", "or_", "bco", "unt_", ">=_", "MIN", "\\u", "GAL", "LO", "P_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "As", " ", "long", " ", "as", " ", "we", " ", "gall", "op", " ", "with", "out", " ", "leaving", " ", "this", " ", "loop", ",", " ", "make_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "heuristic", " ", "more", " ", "like", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "min", "\\u", "gall", "op_", "-=_", "min", "\\u", "gall", "op_", ">_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gal", "lop", " ", "in", " ", "A", " ", "to", " ", "find", " ", "where", " ", "keys", "[", "ss", "b", "]", " ", "shou", "ld", " ", "end", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "gall", "op", "\\u", "right_", "(_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", ",_", "a", "\\u", "keys_", ",_", "ssa", "_", "-_", "na_", "+_", "1_", ",_", "ssa", "_", "+_", "1_", ",_", "ssa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "k", " ", "is", " ", "an", " ", "index", ",", " ", "make", " ", "it", " ", "a", " ", "size", " ", "from", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "ssa", "_", "+_", "1_", "-_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aco", "unt_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "every", "thing", " ", "from", " ", "A", " ", "after", " ", "k", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dest", "ination", " ", "and", " ", "source", " ", "are", " ", "the", " ", "same", " ", "buffer", ",", " ", "and", " ", "destination_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "index", " ", "is", " ", "great", "er", ",", " ", "so", " ", "copy", " ", "from", " ", "the", " ", "end", " ", "to", " ", "the", " ", "start", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sorts", "lice", "\\u", "copy", "\\u", "down_", "(_", "keys_", ",_", "values_", ",_", "dest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a", "\\u", "keys_", ",_", "a", "\\u", "values_", ",_", "ssa", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "keys", "[", "ss", "b", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "[_", "dest_", "]_", "=_", "b", "\\u", "keys_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "b", "\\u", "values_", "[_", "ss", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nb_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gal", "lop", " ", "in", " ", "B", " ", "to", " ", "find", " ", "where", " ", "keys", "[", "ssa", "]", " ", "shou", "ld", " ", "end", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "k_", "=_", "gall", "op", "\\u", "left_", "(_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", ",_", "b", "\\u", "keys_", ",_", "ss", "b_", "-_", "nb_", "+_", "1_", ",_", "ss", "b_", "+_", "1_", ",_", "ss", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "k", " ", "is", " ", "an", " ", "index", ",", " ", "make", " ", "it", " ", "a", " ", "size", " ", "from", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "ss", "b_", "+_", "1_", "-_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "unt_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "every", "thing", " ", "from", " ", "B", " ", "bef", "ore", " ", "k_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sorts", "lice", "\\u", "copy", "\\u", "down_", "(_", "keys_", ",_", "values_", ",_", "dest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "\\u", "keys_", ",_", "b", "\\u", "values_", ",_", "ss", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", "-=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nb_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "keys", "[", "ssa", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "[_", "dest_", "]_", "=_", "a", "\\u", "keys_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "has", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "dest_", "]_", "=_", "a", "\\u", "values_", "[_", "ssa", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "mer", "ging", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pen", "alize", " ", "it", " ", "for", " ", "leaving", " ", "gall", "opin", "g", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "\\u", "gall", "op_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "finish", "ed", ",", " ", "now", " ", "handle", " ", "the", " ", "rema", "inin", "g", " ", "areas_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "B", " ", "rema", "inin", "g", " ", "to", " ", "copy", " ", "at", " ", "the", " ", "front", " ", "of", " ", "the", " ", "destinat", "ion", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorts", "lice", "\\u", "copy_", "(_", "keys_", ",_", "values_", ",_", "dest_", "-_", "nb_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "\\u", "keys_", ",_", "b", "\\u", "values_", ",_", "ss", "b_", "-_", "nb_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "nb_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dest_", "==_", "ssa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", "'", "s", " ", "front", " ", "is", " ", "alr", "ead", "y", " ", "at", " ", "the", " ", "right", " ", "place", ",", " ", "do", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "merge", "\\u", "adjust", "\\u", "gall", "op_", "(_", "ms_", ",_", "min", "\\u", "gall", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "at_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Merge", " ", "the", " ", "two", " ", "runs", " ", "at", " ", "stack", " ", "indice", "s", " ", "i", " ", "and", " ", "i", "+", "1", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "update", "d", " ", "Merge", "State", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "ms_", "._", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n_", ">=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "i_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "i_", "==_", "n_", "-_", "2_", "or_", "i_", "==_", "n_", "-_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ssa", "_", ",_", "na_", "=_", "ms_", "._", "pending_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "b_", ",_", "nb_", "=_", "ms_", "._", "pending_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "na_", ">_", "0_", "and_", "nb_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ssa", "_", "+_", "na_", "==_", "ss", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Record", " ", "the", " ", "length", " ", "of", " ", "the", " ", "combin", "ed", " ", "runs", ";", " ", "if", " ", "i", " ", "is", " ", "the", " ", "3", "rd", "-", "last_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "now", ",", " ", "als", "o", " ", "slide", " ", "over", " ", "the", " ", "last", " ", "run", " ", "(", "whi", "ch", " ", "isn", "'", "t", " ", "involved", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "this", " ", "merge", ").", " ", " ", "The", " ", "current", " ", "run", " ", "i", "+", "1", " ", "go", "es", " ", "awa", "y", " ", "in", " ", "any", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "ms_", "._", "pending_", "[_", "i_", "]_", "=_", "Merge", "Run_", "(_", "ssa", "_", ",_", "na_", "+_", "nb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "n_", "-_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "._", "pending_", "[_", "i_", "+_", "1_", "]_", "=_", "ms_", "._", "pending_", "[_", "i_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "pop_", "(_", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "re", " ", "doe", "s", " ", "b", " ", "start", " ", "in", " ", "a", "?", " ", " ", "Element", "s", " ", "in", " ", "a", " ", "bef", "ore", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ignore", "d", " ", "(", "alr", "ead", "y", " ", "in", " ", "place", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "gall", "op", "\\u", "right_", "(_", "keys_", "[_", "ss", "b_", "]_", ",_", "keys_", ",_", "ssa", "_", ",_", "ssa", "_", "+_", "na_", ",_", "ssa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "[", "k", ",", " ", "ssa", " ", "+", " ", "na", ")", " ", "remains", " ", "to", " ", "be", " ", "merged_", "\\u\\u\\uNL\\u\\u\\u_", "na_", "-=_", "k_", "-_", "ssa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "na_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "re", " ", "doe", "s", " ", "a", " ", "end", " ", "in", " ", "b", "?", " ", " ", "Element", "s", " ", "in", " ", "b", " ", "after", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ignore", "d", " ", "(", "alr", "ead", "y", " ", "in", " ", "place", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "k_", "=_", "gall", "op", "\\u", "left_", "(_", "keys_", "[_", "ssa", "_", "+_", "na_", "-_", "1_", "]_", ",_", "keys_", ",_", "ss", "b_", ",_", "ss", "b_", "+_", "nb_", ",_", "ss", "b_", "+_", "nb_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "[", "ss", "b", ",", " ", "k", ")", " ", "remains", " ", "to", " ", "be", " ", "merged_", "\\u\\u\\uNL\\u\\u\\u_", "nb_", "=_", "k_", "-_", "ss", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "what", " ", "remains", " ", "of", " ", "the", " ", "runs", ",", " ", "usi", "ng", " ", "a", " ", "temp", " ", "array", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "min", "(", "na", ",", " ", "nb", ")", " ", "element", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "na_", "<=_", "nb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "merge", "\\u", "lo_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "ssa", "_", ",_", "na_", ",_", "ss", "b_", ",_", "nb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "merge", "\\u", "hi_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "ssa", "_", ",_", "na_", ",_", "ss", "b_", ",_", "nb_", ")_", "\\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_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "collapse", "_", "(_", "ms_", ",_", "keys_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ine", " ", "the", " ", "stack", " ", "of", " ", "runs", " ", "wait", "ing", " ", "to", " ", "be", " ", "merge", "d", ",", " ", "mer", "ging", " ", "adjacent", " ", "runs", "\\", "10", ";", " ", " ", " ", " ", "unti", "l", " ", "the", " ", "stack", " ", "invariant", "s", " ", "are", " ", "re", "-", "establish", "ed", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "len", "[-", "3", "]", " ", ">", " ", "len", "[-", "2", "]", " ", "+", " ", "len", "[-", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "len", "[-", "2", "]", " ", ">", " ", "len", "[-", "1", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "update", "d", " ", "Merge", "State", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "lists", "ort", ".", "txt", " ", "for", " ", "more", " ", "info", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ms_", "._", "n_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pending_", "=_", "ms_", "._", "pending_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "ms_", "._", "n_", "-_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "n_", ">_", "0_", "and_", "pending_", "[_", "n_", "-_", "1_", "]_", "._", "size_", "<=_", "pending_", "[_", "n_", "]_", "._", "size_", "+_", "pending_", "[_", "n_", "+_", "1_", "]_", "._", "size_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n_", ">_", "1_", "and_", "pending_", "[_", "n_", "-_", "2_", "]_", "._", "size_", "<=_", "pending_", "[_", "n_", "-_", "1_", "]_", "._", "size_", "+_", "pending_", "[_", "n_", "]_", "._", "size_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pending_", "[_", "n_", "-_", "1_", "]_", "._", "size_", "<_", "pending_", "[_", "n_", "+_", "1_", "]_", "._", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Merge", " ", "small", "er", " ", "one", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "n_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "at_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pending_", "[_", "n_", "]_", "._", "size_", "<_", "pending_", "[_", "n_", "+_", "1_", "]_", "._", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "=_", "merge", "\\u", "at_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "force", "\\u", "collapse", "_", "(_", "ms_", ",_", "keys_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Reg", "ard", "less", " ", "of", " ", "invariant", "s", ",", " ", "merge", " ", "all", " ", "runs", " ", "on", " ", "the", " ", "stack", " ", "unti", "l", " ", "only", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "remains", ".", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "at", " ", "the", " ", "end", " ", "of", " ", "the", " ", "merges", "ort", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "update", "d", " ", "Merge", "State", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ms_", "._", "n_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pending_", "=_", "ms_", "._", "pending_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "ms_", "._", "n_", "-_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pending_", "[_", "n_", "-_", "1_", "]_", "._", "size_", "<_", "pending_", "[_", "n_", "+_", "1_", "]_", "._", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Merge", " ", "the", " ", "small", "er", " ", "one", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "n_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "at_", "(_", "ms_", ",_", "keys_", ",_", "values_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "reverse", "\\u", "slice_", "(_", "keys_", ",_", "values_", ",_", "start_", ",_", "stop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Revers", "e", " ", "a", " ", "slice", ",", " ", "in", "-", "place", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "stop_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "[_", "i_", "]_", ",_", "keys_", "[_", "j_", "]_", "=_", "keys_", "[_", "j_", "]_", ",_", "keys_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "values_", "(_", "keys_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "stop_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "i_", "]_", ",_", "values_", "[_", "j_", "]_", "=_", "values_", "[_", "j_", "]_", ",_", "values_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "\\u", "tim", "sort", "\\u", "with", "\\u", "merges", "tate_", "(_", "ms_", ",_", "keys_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "tim", "sort", " ", "with", " ", "the", " ", "merges", "tate", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nre", "main", "ing_", "=_", "len_", "(_", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nre", "main", "ing_", "<_", "2_", ":_", "\\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_", "#", " ", "March", " ", "over", " ", "the", " ", "array", " ", "onc", "e", ",", " ", "left", " ", "to", " ", "right", ",", " ", "finding", " ", "natur", "al", " ", "runs", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "extend", "ing", " ", "short", " ", "natur", "al", " ", "runs", " ", "to", " ", "min", "run", " ", "element", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "run_", "=_", "merge", "\\u", "compute", "\\u", "min", "run_", "(_", "nre", "main", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lo_", "=_", "zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "nre", "main", "ing_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", ",_", "desc_", "=_", "count", "\\u", "run_", "(_", "keys_", ",_", "lo_", ",_", "lo_", "+_", "nre", "main", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "desc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Descen", "ding", " ", "run", " ", "=>", " ", "reverse_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reverse", "\\u", "slice_", "(_", "keys_", ",_", "values_", ",_", "lo_", ",_", "lo_", "+_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "short", ",", " ", "extend", " ", "to", " ", "min", "(", "min", "run", ",", " ", "nre", "main", "ing", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "<_", "min", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "force_", "=_", "min_", "(_", "min", "run_", ",_", "nre", "main", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "ys", "ort_", "(_", "keys_", ",_", "values_", ",_", "lo_", ",_", "lo_", "+_", "force_", ",_", "lo_", "+_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "force_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Push", " ", "run", " ", "onto", " ", "stack", ",", " ", "and", " ", "may", "be", " ", "merge", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "append_", "(_", "ms_", ",_", "Merge", "Run_", "(_", "lo_", ",_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "collapse", "_", "(_", "ms_", ",_", "keys_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Advance", " ", "to", " ", "find", " ", "next", " ", "run", "._", "\\u\\u\\uNL\\u\\u\\u_", "lo_", "+=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nre", "main", "ing_", "-=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "initial", " ", "runs", " ", "have", " ", "bee", "n", " ", "discovere", "d", ",", " ", "now", " ", "finish", " ", "mer", "ging", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ms_", "=_", "merge", "\\u", "force", "\\u", "collapse", "_", "(_", "ms_", ",_", "keys_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "._", "n_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "._", "pending_", "[_", "0_", "]_", "==_", "(_", "0_", ",_", "len_", "(_", "keys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "\\u", "tim", "sort_", "(_", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "tim", "sort", " ", "over", " ", "the", " ", "give", "n", " ", "keys", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "tim", "sort", "\\u", "with", "\\u", "merges", "tate_", "(_", "merge", "\\u", "init_", "(_", "keys_", ")_", ",_", "keys_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "\\u", "tim", "sort", "\\u", "with", "\\u", "values_", "(_", "keys_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "tim", "sort", " ", "over", " ", "the", " ", "give", "n", " ", "keys", " ", "and", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "tim", "sort", "\\u", "with", "\\u", "merges", "tate_", "(_", "merge", "\\u", "init", "\\u", "with", "\\u", "values_", "(_", "keys_", ",_", "values_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Tim", "sort", "Implementation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "wrap_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count", "\\u", "run_", ",_", "binar", "ys", "ort_", ",_", "gall", "op", "\\u", "left_", ",_", "gall", "op", "\\u", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "init_", ",_", "merge", "\\u", "append_", ",_", "merge", "\\u", "pop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "compute", "\\u", "min", "run_", ",_", "merge", "\\u", "lo_", ",_", "merge", "\\u", "hi_", ",_", "merge", "\\u", "at_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "force", "\\u", "collapse", "_", ",_", "merge", "\\u", "collapse", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "run", "\\u", "tim", "sort_", ",_", "run", "\\u", "tim", "sort", "\\u", "with", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "py", "\\u", "tim", "sort_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "tim", "sort", "\\u", "impl_", "(_", "(_", "lambda_", "f_", ":_", "f_", ")_", ",_", "*_", "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_", "make", "\\u", "jit", "\\u", "tim", "sort_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "numba_", "import_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "make", "\\u", "tim", "sort", "\\u", "impl_", "(_", "(_", "lambda_", "f_", ":_", "jit_", "(_", "nop", "ython_", "=_", "True_", ")_", "(_", "f_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
jrief/djangocms-cascade/cmsplugin_cascade/migrations/0008_sortableinlinecascadeelement.py
[ { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('cmsplugin_cascade', '0007_add_proxy_models'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='SortableInlineCascadeElement',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('glossary', jsonfield.fields.JSONField(blank=True, default={})),\n ('order', models.PositiveIntegerField(db_index=True, verbose_name='Sort by')),\n ('cascade_element', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sortinline_elements', to='cmsplugin_cascade.CascadeElement')),\n ],\n options={\n 'ordering': ('order',),\n 'db_table': 'cmsplugin_cascade_sortinline',\n },\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 9 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[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_", "(_", "'", "cms", "plugin", "\\u", "cascade", "'_", ",_", "'", "0007", "\\u", "add", "\\u", "proxy", "\\u", "model", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Creat", "e", "Model_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Sort", "able", "In", "line", "Casca", "de", "Element", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "auto", "\\u", "created_", "=_", "True_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "serialize_", "=_", "False_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "gloss", "ary", "'_", ",_", "jsonfi", "eld_", "._", "fields_", "._", "JSO", "NF", "ield_", "(_", "blank_", "=_", "True_", ",_", "default_", "=_", "{_", "}_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "order", "'_", ",_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "db", "\\u", "index_", "=_", "True_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Sort", " ", "by", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "cascade", "\\u", "element", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "on", "\\u", "delete_", "=_", "django_", "._", "db_", "._", "models_", "._", "deletion_", "._", "CASCADE_", ",_", "relate", "d\\u", "name_", "=_", "'", "sort", "inline", "\\u", "element", "s", "'_", ",_", "to_", "=_", "'", "cms", "plugin", "\\u", "cascade", ".", "Casca", "de", "Element", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orderi", "ng", "'_", ":_", "(_", "'", "order", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "table", "'_", ":_", "'", "cms", "plugin", "\\u", "cascade", "\\u", "sort", "inline", "'_", ",_", "\\u\\u\\uNL\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/test_redshift/test_server.py
[ { "content": "from __future__ import unicode_literals\n\nimport json\nimport sure # noqa\n\nimport moto.server as server\nfrom moto import mock_redshift\n\n'''\nTest the different server responses\n'''\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@mock_redshift\ndef test_describe_clusters():\n backend = server.create_backend_app(\"redshift\")\n test_client = backend.test_client()\n\n res = test_client.get('/?Action=DescribeClusters')\n\n json_data = json.loads(res.data.decode(\"utf-8\"))\n clusters = json_data['DescribeClustersResponse']['DescribeClustersResult']['Clusters']\n list(clusters).should.equal([])", "metadata": "root.test_describe_clusters", "header": "['module', '___EOS___']", "index": 13 } ]
[]
[]
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_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sure", "_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "moto", "_", "._", "server_", "as_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moto", "_", "import_", "mock", "\\u", "redshift", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Test", " ", "the", " ", "different", " ", "server", " ", "response", "s", "\\", "10", ";'", "''_", "\\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_", "@_", "mock", "\\u", "redshift", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "descri", "be", "\\u", "clusters_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "=_", "server_", "._", "create", "\\u", "back", "end", "\\u", "app_", "(_", "\"", "redshift", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "client_", "=_", "backend_", "._", "test\\u", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "test\\u", "client_", "._", "get_", "(_", "'/", "?", "Action", "=", "Describe", "Cluster", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "res_", "._", "data_", "._", "decode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "json", "\\u", "data_", "[_", "'", "Describe", "Cluster", "s", "Respons", "e", "'_", "]_", "[_", "'", "Describe", "Cluster", "s", "Result", "'_", "]_", "[_", "'", "Cluster", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list_", "(_", "clusters_", ")_", "._", "should_", "._", "equal_", "(_", "[_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
StackStorm/st2/st2common/tests/unit/test_rbac_resolvers_rule_enforcement.py
[ { "content": " def setUp(self):\n super(RuleEnforcementPermissionsResolverTestCase, self).setUp()\n\n register_internal_trigger_types()\n\n # Create some mock users\n user_1_db = UserDB(name='1_role_rule_pack_grant')\n user_1_db = User.add_or_update(user_1_db)\n self.users['custom_role_rule_pack_grant'] = user_1_db\n\n user_2_db = UserDB(name='1_role_rule_grant')\n user_2_db = User.add_or_update(user_2_db)\n self.users['custom_role_rule_grant'] = user_2_db\n\n user_3_db = UserDB(name='custom_role_pack_rule_all_grant')\n user_3_db = User.add_or_update(user_3_db)\n self.users['custom_role_pack_rule_all_grant'] = user_3_db\n\n user_4_db = UserDB(name='custom_role_rule_all_grant')\n user_4_db = User.add_or_update(user_4_db)\n self.users['custom_role_rule_all_grant'] = user_4_db\n\n user_5_db = UserDB(name='custom_role_rule_modify_grant')\n user_5_db = User.add_or_update(user_5_db)\n self.users['custom_role_rule_modify_grant'] = user_5_db\n\n user_6_db = UserDB(name='rule_pack_rule_create_grant')\n user_6_db = User.add_or_update(user_6_db)\n self.users['rule_pack_rule_create_grant'] = user_6_db\n\n user_7_db = UserDB(name='rule_pack_rule_all_grant')\n user_7_db = User.add_or_update(user_7_db)\n self.users['rule_pack_rule_all_grant'] = user_7_db\n\n user_8_db = UserDB(name='rule_rule_create_grant')\n user_8_db = User.add_or_update(user_8_db)\n self.users['rule_rule_create_grant'] = user_8_db\n\n user_9_db = UserDB(name='rule_rule_all_grant')\n user_9_db = User.add_or_update(user_9_db)\n self.users['rule_rule_all_grant'] = user_9_db\n\n user_10_db = UserDB(name='custom_role_rule_list_grant')\n user_10_db = User.add_or_update(user_10_db)\n self.users['custom_role_rule_list_grant'] = user_10_db\n\n # Create some mock resources on which permissions can be granted\n rule_1_db = RuleDB(pack='test_pack_1', name='rule1', action={'ref': 'core.local'},\n trigger='core.st2.key_value_pair.create')\n rule_1_db = Rule.add_or_update(rule_1_db)\n self.resources['rule_1'] = rule_1_db\n\n rule_enforcement_1_db = RuleEnforcementDB(trigger_instance_id=str(bson.ObjectId()),\n execution_id=str(bson.ObjectId()),\n rule={'ref': rule_1_db.ref,\n 'uid': rule_1_db.uid,\n 'id': str(rule_1_db.id)})\n rule_enforcement_1_db = RuleEnforcement.add_or_update(rule_enforcement_1_db)\n self.resources['rule_enforcement_1'] = rule_enforcement_1_db\n\n rule_2_db = RuleDB(pack='test_pack_1', name='rule2')\n rule_2_db = Rule.add_or_update(rule_2_db)\n self.resources['rule_2'] = rule_2_db\n\n rule_enforcement_2_db = RuleEnforcementDB(trigger_instance_id=str(bson.ObjectId()),\n execution_id=str(bson.ObjectId()),\n rule={'ref': rule_2_db.ref,\n 'uid': rule_2_db.uid,\n 'id': str(rule_2_db.id)})\n rule_enforcement_2_db = RuleEnforcement.add_or_update(rule_enforcement_2_db)\n self.resources['rule_enforcement_2'] = rule_enforcement_2_db\n\n rule_3_db = RuleDB(pack='test_pack_2', name='rule3')\n rule_3_db = Rule.add_or_update(rule_3_db)\n self.resources['rule_3'] = rule_3_db\n\n rule_enforcement_3_db = RuleEnforcementDB(trigger_instance_id=str(bson.ObjectId()),\n execution_id=str(bson.ObjectId()),\n rule={'ref': rule_3_db.ref,\n 'uid': rule_3_db.uid,\n 'id': str(rule_3_db.id)})\n rule_enforcement_3_db = RuleEnforcement.add_or_update(rule_enforcement_3_db)\n self.resources['rule_enforcement_3'] = rule_enforcement_3_db\n\n # Create some mock roles with associated permission grants\n # Custom role 2 - one grant on parent pack\n # \"rule_view\" on pack_1\n grant_db = PermissionGrantDB(resource_uid=self.resources['pack_1'].get_uid(),\n resource_type=ResourceType.PACK,\n permission_types=[PermissionType.RULE_VIEW])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_3_db = RoleDB(name='custom_role_rule_pack_grant',\n permission_grants=permission_grants)\n role_3_db = Role.add_or_update(role_3_db)\n self.roles['custom_role_rule_pack_grant'] = role_3_db\n\n # Custom role 4 - one grant on rule\n # \"rule_view on rule_3\n grant_db = PermissionGrantDB(resource_uid=self.resources['rule_3'].get_uid(),\n resource_type=ResourceType.RULE,\n permission_types=[PermissionType.RULE_VIEW])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_4_db = RoleDB(name='custom_role_rule_grant', permission_grants=permission_grants)\n role_4_db = Role.add_or_update(role_4_db)\n self.roles['custom_role_rule_grant'] = role_4_db\n\n # Custom role - \"rule_all\" grant on a parent rule pack\n grant_db = PermissionGrantDB(resource_uid=self.resources['pack_1'].get_uid(),\n resource_type=ResourceType.PACK,\n permission_types=[PermissionType.RULE_ALL])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_4_db = RoleDB(name='custom_role_pack_rule_all_grant',\n permission_grants=permission_grants)\n role_4_db = Role.add_or_update(role_4_db)\n self.roles['custom_role_pack_rule_all_grant'] = role_4_db\n\n # Custom role - \"rule_all\" grant on a rule\n grant_db = PermissionGrantDB(resource_uid=self.resources['rule_1'].get_uid(),\n resource_type=ResourceType.RULE,\n permission_types=[PermissionType.RULE_ALL])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_4_db = RoleDB(name='custom_role_rule_all_grant', permission_grants=permission_grants)\n role_4_db = Role.add_or_update(role_4_db)\n self.roles['custom_role_rule_all_grant'] = role_4_db\n\n # Custom role - \"rule_modify\" on role_1\n grant_db = PermissionGrantDB(resource_uid=self.resources['rule_1'].get_uid(),\n resource_type=ResourceType.RULE,\n permission_types=[PermissionType.RULE_MODIFY])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_5_db = RoleDB(name='custom_role_rule_modify_grant',\n permission_grants=permission_grants)\n role_5_db = Role.add_or_update(role_5_db)\n self.roles['custom_role_rule_modify_grant'] = role_5_db\n\n # Custom role - \"rule_create\" grant on pack_1\n grant_db = PermissionGrantDB(resource_uid=self.resources['pack_1'].get_uid(),\n resource_type=ResourceType.PACK,\n permission_types=[PermissionType.RULE_CREATE])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_6_db = RoleDB(name='rule_pack_rule_create_grant',\n permission_grants=permission_grants)\n role_6_db = Role.add_or_update(role_6_db)\n self.roles['rule_pack_rule_create_grant'] = role_6_db\n\n # Custom role - \"rule_all\" grant on pack_1\n grant_db = PermissionGrantDB(resource_uid=self.resources['pack_1'].get_uid(),\n resource_type=ResourceType.PACK,\n permission_types=[PermissionType.RULE_ALL])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_7_db = RoleDB(name='rule_pack_rule_all_grant',\n permission_grants=permission_grants)\n role_7_db = Role.add_or_update(role_7_db)\n self.roles['rule_pack_rule_all_grant'] = role_7_db\n\n # Custom role - \"rule_create\" grant on rule_1\n grant_db = PermissionGrantDB(resource_uid=self.resources['rule_1'].get_uid(),\n resource_type=ResourceType.RULE,\n permission_types=[PermissionType.RULE_CREATE])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_8_db = RoleDB(name='rule_rule_create_grant',\n permission_grants=permission_grants)\n role_8_db = Role.add_or_update(role_8_db)\n self.roles['rule_rule_create_grant'] = role_8_db\n\n # Custom role - \"rule_all\" grant on rule_1\n grant_db = PermissionGrantDB(resource_uid=self.resources['rule_1'].get_uid(),\n resource_type=ResourceType.RULE,\n permission_types=[PermissionType.RULE_ALL])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_9_db = RoleDB(name='rule_rule_all_grant',\n permission_grants=permission_grants)\n role_9_db = Role.add_or_update(role_9_db)\n self.roles['rule_rule_all_grant'] = role_9_db\n\n # Custom role - \"rule_list\" grant\n grant_db = PermissionGrantDB(resource_uid=None,\n resource_type=None,\n permission_types=[PermissionType.RULE_LIST])\n grant_db = PermissionGrant.add_or_update(grant_db)\n permission_grants = [str(grant_db.id)]\n role_10_db = RoleDB(name='custom_role_rule_list_grant',\n permission_grants=permission_grants)\n role_10_db = Role.add_or_update(role_10_db)\n self.roles['custom_role_rule_list_grant'] = role_10_db\n\n # Create some mock role assignments\n user_db = self.users['custom_role_rule_pack_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['custom_role_rule_pack_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['custom_role_rule_grant']\n role_assignment_db = UserRoleAssignmentDB(user=user_db.name,\n role=self.roles['custom_role_rule_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['custom_role_pack_rule_all_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['custom_role_pack_rule_all_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['custom_role_rule_all_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['custom_role_rule_all_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['custom_role_rule_modify_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['custom_role_rule_modify_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['rule_pack_rule_create_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['rule_pack_rule_create_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['rule_pack_rule_all_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['rule_pack_rule_all_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['rule_rule_create_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['rule_rule_create_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['rule_rule_all_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['rule_rule_all_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)\n\n user_db = self.users['custom_role_rule_list_grant']\n role_assignment_db = UserRoleAssignmentDB(\n user=user_db.name,\n role=self.roles['custom_role_rule_list_grant'].name)\n UserRoleAssignment.add_or_update(role_assignment_db)", "metadata": "root.RuleEnforcementPermissionsResolverTestCase.setUp", "header": "['class', 'RuleEnforcementPermissionsResolverTestCase', '(', 'BasePermissionsResolverTestCase', ')', ':', '___EOS___']", "index": 41 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Rule", "Enf", "orce", "ment", "Permi", "ssion", "s", "Resolv", "er", "Test", "Case_", "(_", "Base", "Permi", "ssion", "s", "Resolv", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rule", "Enf", "orce", "ment", "Permi", "ssion", "s", "Resolv", "er", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register", "\\u", "internal", "\\u", "trigger", "\\u", "types_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "some", " ", "mock", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "1", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "1", "\\u", "role", "\\u", "rule", "\\u", "pack", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "1", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "pack", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "1", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "2", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "1", "\\u", "role", "\\u", "rule", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "2", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "2", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "2", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "3", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "3", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "3", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "3", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "4", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "4", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "4", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "4", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "5", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "modif", "y", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "5", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "5", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "modif", "y", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "5", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "6", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "6", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "6", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "6", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "7", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "7", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "7", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "7", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "8", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "8", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "8", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "8", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "9", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "9", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "9", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "9", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "10", "\\u", "db_", "=_", "User", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "list", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "10", "\\u", "db_", "=_", "User_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "user", "\\u", "10", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "list", "\\u", "grant", "'_", "]_", "=_", "user", "\\u", "10", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "some", " ", "mock", " ", "resource", "s", " ", "on", " ", "whi", "ch", " ", "permissi", "ons", " ", "can", " ", "be", " ", "grant", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "1", "\\u", "db_", "=_", "Rule", "DB_", "(_", "pack_", "=_", "'", "test\\u", "pack", "\\u", "1", "'_", ",_", "name_", "=_", "'", "rule", "1", "'_", ",_", "action_", "=_", "{_", "'", "ref", "'_", ":_", "'", "core", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger_", "=_", "'", "core", ".", "st2", ".", "key", "\\u", "value", "\\u", "pair", ".", "create", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "1", "\\u", "db_", "=_", "Rule_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "rule", "\\u", "1", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "1", "'_", "]_", "=_", "rule", "\\u", "1", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "enforce", "ment", "\\u", "1", "\\u", "db_", "=_", "Rule", "Enf", "orce", "ment", "DB_", "(_", "trigger", "\\u", "instance", "\\u", "id_", "=_", "str_", "(_", "bson_", "._", "Object", "Id_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executi", "on", "\\u", "id_", "=_", "str_", "(_", "bson_", "._", "Object", "Id_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rule_", "=_", "{_", "'", "ref", "'_", ":_", "rule", "\\u", "1", "\\u", "db_", "._", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "rule", "\\u", "1", "\\u", "db_", "._", "uid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "str_", "(_", "rule", "\\u", "1", "\\u", "db_", "._", "id_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "enforce", "ment", "\\u", "1", "\\u", "db_", "=_", "Rule", "Enf", "orce", "ment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "rule", "\\u", "enforce", "ment", "\\u", "1", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "enforce", "ment", "\\u", "1", "'_", "]_", "=_", "rule", "\\u", "enforce", "ment", "\\u", "1", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "2", "\\u", "db_", "=_", "Rule", "DB_", "(_", "pack_", "=_", "'", "test\\u", "pack", "\\u", "1", "'_", ",_", "name_", "=_", "'", "rule", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "2", "\\u", "db_", "=_", "Rule_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "rule", "\\u", "2", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "2", "'_", "]_", "=_", "rule", "\\u", "2", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "enforce", "ment", "\\u", "2", "\\u", "db_", "=_", "Rule", "Enf", "orce", "ment", "DB_", "(_", "trigger", "\\u", "instance", "\\u", "id_", "=_", "str_", "(_", "bson_", "._", "Object", "Id_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executi", "on", "\\u", "id_", "=_", "str_", "(_", "bson_", "._", "Object", "Id_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rule_", "=_", "{_", "'", "ref", "'_", ":_", "rule", "\\u", "2", "\\u", "db_", "._", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "rule", "\\u", "2", "\\u", "db_", "._", "uid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "str_", "(_", "rule", "\\u", "2", "\\u", "db_", "._", "id_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "enforce", "ment", "\\u", "2", "\\u", "db_", "=_", "Rule", "Enf", "orce", "ment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "rule", "\\u", "enforce", "ment", "\\u", "2", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "enforce", "ment", "\\u", "2", "'_", "]_", "=_", "rule", "\\u", "enforce", "ment", "\\u", "2", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "3", "\\u", "db_", "=_", "Rule", "DB_", "(_", "pack_", "=_", "'", "test\\u", "pack", "\\u", "2", "'_", ",_", "name_", "=_", "'", "rule", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "3", "\\u", "db_", "=_", "Rule_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "rule", "\\u", "3", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "3", "'_", "]_", "=_", "rule", "\\u", "3", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "enforce", "ment", "\\u", "3", "\\u", "db_", "=_", "Rule", "Enf", "orce", "ment", "DB_", "(_", "trigger", "\\u", "instance", "\\u", "id_", "=_", "str_", "(_", "bson_", "._", "Object", "Id_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executi", "on", "\\u", "id_", "=_", "str_", "(_", "bson_", "._", "Object", "Id_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rule_", "=_", "{_", "'", "ref", "'_", ":_", "rule", "\\u", "3", "\\u", "db_", "._", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "rule", "\\u", "3", "\\u", "db_", "._", "uid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "str_", "(_", "rule", "\\u", "3", "\\u", "db_", "._", "id_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "enforce", "ment", "\\u", "3", "\\u", "db_", "=_", "Rule", "Enf", "orce", "ment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "rule", "\\u", "enforce", "ment", "\\u", "3", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "enforce", "ment", "\\u", "3", "'_", "]_", "=_", "rule", "\\u", "enforce", "ment", "\\u", "3", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "some", " ", "mock", " ", "role", "s", " ", "with", " ", "associate", "d", " ", "permissi", "on", " ", "grants", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "2", " ", "-", " ", "one", " ", "grant", " ", "on", " ", "parent", " ", "pack_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "rule", "\\u", "view", "\"", " ", "on", " ", "pack", "\\u", "1_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "pack", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "PACK", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "VIEW_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "3", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "pack", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "3", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "3", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "pack", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "3", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "4", " ", "-", " ", "one", " ", "grant", " ", "on", " ", "rule_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "rule", "\\u", "view", " ", "on", " ", "rule", "\\u", "3_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "3", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "RULE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "VIEW_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "4", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "grant", "'_", ",_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "4", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "4", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "4", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "all", "\"", " ", "grant", " ", "on", " ", "a", " ", "parent", " ", "rule", " ", "pack_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "pack", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "PACK", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "4", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "4", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "4", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "4", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "all", "\"", " ", "grant", " ", "on", " ", "a", " ", "rule_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "RULE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "4", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ",_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "4", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "4", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "4", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "modif", "y", "\"", " ", "on", " ", "role", "\\u", "1_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "RULE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "MODIFY", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "5", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "modif", "y", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "5", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "5", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "modif", "y", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "5", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "create", "\"", " ", "grant", " ", "on", " ", "pack", "\\u", "1_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "pack", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "PACK", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "CREATE_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "6", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "6", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "6", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "6", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "all", "\"", " ", "grant", " ", "on", " ", "pack", "\\u", "1_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "pack", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "PACK", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "7", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "7", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "7", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "7", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "create", "\"", " ", "grant", " ", "on", " ", "rule", "\\u", "1_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "RULE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "CREATE_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "8", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "8", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "8", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "8", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "all", "\"", " ", "grant", " ", "on", " ", "rule", "\\u", "1_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "self_", "._", "resources_", "[_", "'", "rule", "\\u", "1", "'_", "]_", "._", "get", "\\u", "uid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "Reso", "urc", "e", "Type_", "._", "RULE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "9", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "rule", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "9", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "9", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "9", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "role", " ", "-", " ", "\"", "rule", "\\u", "list", "\"", " ", "grant_", "\\u\\u\\uNL\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "DB_", "(_", "resource", "\\u", "uid_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "type_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "types_", "=_", "[_", "Permi", "ssion", "Type_", "._", "RULE", "\\u", "LIST_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grant", "\\u", "db_", "=_", "Permi", "ssion", "Grant", "_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "grant", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "[_", "str_", "(_", "grant", "\\u", "db_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "10", "\\u", "db_", "=_", "Ro", "le", "DB_", "(_", "name_", "=_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "list", "\\u", "grant", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "grants", "_", "=_", "permissi", "on", "\\u", "grants", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "10", "\\u", "db_", "=_", "Role_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "10", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "list", "\\u", "grant", "'_", "]_", "=_", "role", "\\u", "10", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "some", " ", "mock", " ", "role", " ", "assignments_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "pack", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "pack", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "modif", "y", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "modif", "y", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "pack", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "rule", "\\u", "create", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "rule", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "rule", "\\u", "rule", "\\u", "all", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "self_", "._", "users_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "list", "\\u", "grant", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role", "\\u", "assign", "ment", "\\u", "db_", "=_", "User", "Ro", "le", "Assign", "ment", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "db_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role_", "=_", "self_", "._", "roles_", "[_", "'", "custom", "\\u", "role", "\\u", "rule", "\\u", "list", "\\u", "grant", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User", "Ro", "le", "Assignment_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "role", "\\u", "assign", "ment", "\\u", "db_", ")_", "\\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, 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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 ]
Except block handles 'BaseException'
spatialaudio/nbsphinx/nbsphinx.py
[ { "content": "def html_collect_pages(app):\n \"\"\"This event handler is abused to copy local files around.\"\"\"\n files = set()\n for file_list in getattr(app.env, 'nbsphinx_files', {}).values():\n files.update(file_list)\n for file in app.status_iterator(files, 'copying linked files... ',\n sphinx.util.console.brown, len(files)):\n target = os.path.join(app.builder.outdir, file)\n sphinx.util.ensuredir(os.path.dirname(target))\n try:\n sphinx.util.copyfile(os.path.join(app.env.srcdir, file), target)\n except OSError as err:\n app.warn('cannot copy local file {!r}: {}'.format(file, err))\n return [] # No new HTML pages are created", "metadata": "root.html_collect_pages", "header": "['module', '___EOS___']", "index": 946 } ]
[]
[]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "html", "\\u", "collect", "\\u", "pages_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "event", " ", "handler", " ", "is", " ", "abu", "sed", " ", "to", " ", "copy", " ", "local", " ", "files", " ", "aro", "und", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "\\u", "list_", "in_", "getattr_", "(_", "app_", "._", "env_", ",_", "'", "nb", "sphinx", "\\u", "files", "'_", ",_", "{_", "}_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "._", "update_", "(_", "file", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "file_", "in_", "app_", "._", "status", "\\u", "iterator_", "(_", "files_", ",_", "'", "copy", "ing", " ", "linked", " ", "files", "...", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sphinx_", "._", "util_", "._", "console_", "._", "brow", "n_", ",_", "len_", "(_", "files_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "os_", "._", "path_", "._", "join_", "(_", "app_", "._", "builder_", "._", "outdir_", ",_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sphinx_", "._", "util_", "._", "ensure", "dir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sphinx_", "._", "util_", "._", "copyfile_", "(_", "os_", "._", "path_", "._", "join_", "(_", "app_", "._", "env_", "._", "srcdir_", ",_", "file_", ")_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "warn_", "(_", "'", "cann", "ot", " ", "copy", " ", "local", " ", "file", " ", "{", "!", "r", "}:", " ", "{}'_", "._", "format_", "(_", "file_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "]_", "#", " ", "No", " ", "new", " ", "HTM", "L", " ", "page", "s", " ", "are", " ", "created_", "\\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 ]
Use of the return value of a procedure
FooBarWidget/mizuho/asciidoc/tests/testasciidoc.py
[ { "content": " def backend_filename(self, backend):\n \"\"\"\n Return the path name of the backend output file that is generated from\n the test name and output file type.\n \"\"\"\n return '%s-%s%s' % (\n os.path.normpath(os.path.join(self.datadir, self.name)),\n backend,\n BACKEND_EXT[backend])", "metadata": "root.AsciiDocTest.backend_filename", "header": "['class', 'AsciiDocTest', '(', 'object', ')', ':', '___EOS___']", "index": 91 }, { "content": " def get_expected(self, backend):\n \"\"\"\n Return expected test data output for backend.\n \"\"\"\n f = open(self.backend_filename(backend))\n try:\n result = f.readlines()\n # Strip line terminators.\n result = [ s.rstrip() for s in result ]\n finally:\n f.close()\n return result", "metadata": "root.AsciiDocTest.get_expected", "header": "['class', 'AsciiDocTest', '(', 'object', ')', ':', '___EOS___']", "index": 161 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "class_", "Asc", "ii", "Doc", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "back", "end", "\\u", "filename_", "(_", "self_", ",_", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "path", " ", "name", " ", "of", " ", "the", " ", "back", "end", " ", " ", "output", " ", "file", " ", "tha", "t", " ", "is", " ", "generat", "ed", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "test", " ", "name", " ", "and", " ", "output", " ", "file", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "-%", "s", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "datadir_", ",_", "self_", "._", "name_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "BACK", "END", "\\u", "EXT_", "[_", "backend_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asc", "ii", "Doc", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "expected_", "(_", "self_", ",_", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "expected", " ", "test", " ", "data", " ", "output", " ", "for", " ", "back", "end", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "self_", "._", "back", "end", "\\u", "filename_", "(_", "backend_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Strip", " ", "line", " ", "terminator", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "[_", "s_", "._", "rstrip_", "(_", ")_", "for_", "s_", "in_", "result_", "]_", "\\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 ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
jmcnamara/XlsxWriter/xlsxwriter/test/comparison/test_chart_chartarea01.py
[ { "content": "###############################################################################\n#\n# Tests for XlsxWriter.\n#\n# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org\n#\n\nfrom ..excel_comparsion_test import ExcelComparisonTest\nfrom ...workbook import Workbook\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCompareXLSXFiles(ExcelComparisonTest):\n \"\"\"\n Test file created by XlsxWriter against a file created by Excel.\n\n \"\"\"\n\n", "metadata": "root.TestCompareXLSXFiles", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def setUp(self):\n self.maxDiff = None\n\n filename = 'chart_chartarea01.xlsx'\n\n test_dir = 'xlsxwriter/test/comparison/'\n self.got_filename = test_dir + '_test_' + filename\n self.exp_filename = test_dir + 'xlsx_files/' + filename\n\n self.ignore_files = []\n self.ignore_elements = {}", "metadata": "root.TestCompareXLSXFiles.setUp", "header": "['class', 'TestCompareXLSXFiles', '(', 'ExcelComparisonTest', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_create_file(self):\n \"\"\"Test XlsxWriter chartarea properties.\"\"\"\n\n workbook = Workbook(self.got_filename)\n\n worksheet = workbook.add_worksheet()\n chart = workbook.add_chart({'type': 'column'})\n\n chart.axis_ids = [82933248, 82952960]\n\n data = [\n [1, 2, 3, 4, 5],\n [2, 4, 6, 8, 10],\n [3, 6, 9, 12, 15],\n\n ]\n\n worksheet.write_column('A1', data[0])\n worksheet.write_column('B1', data[1])\n worksheet.write_column('C1', data[2])\n\n chart.add_series({'values': '=Sheet1!$A$1:$A$5'})\n chart.add_series({'values': '=Sheet1!$B$1:$B$5'})\n chart.add_series({'values': '=Sheet1!$C$1:$C$5'})\n\n chart.set_chartarea({\n 'border': {'none': 1},\n 'fill': {'color': 'red'}\n })\n\n chart.set_plotarea({\n 'border': {'color': 'yellow', 'width': 1, 'dash_type': 'dash'},\n 'fill': {'color': '#92D050'}\n })\n\n worksheet.insert_chart('E9', chart)\n\n workbook.close()\n\n self.assertExcelEqual()", "metadata": "root.TestCompareXLSXFiles.test_create_file", "header": "['class', 'TestCompareXLSXFiles', '(', 'ExcelComparisonTest', ')', ':', '___EOS___']", "index": 29 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "s", " ", "for", " ", "Xl", "sx", "Write", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", "),", " ", "2013", "-", "2016", ",", " ", "Joh", "n", " ", "Mc", "Nam", "ara", ",", " ", "jm", "cn", "amar", "a", "@", "cpa", "n", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "exce", "l\\u", "compa", "rsi", "on", "\\u", "test_", "import_", "Exce", "l", "Compari", "son", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "workbook_", "import_", "Workbook", "_", "\\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", "Compare", "XL", "SX", "Files_", "(_", "Exce", "l", "Compari", "son", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "file", " ", "created", " ", "by", " ", "Xl", "sx", "Write", "r", " ", "against", " ", "a", " ", "file", " ", "created", " ", "by", " ", "Exce", "l", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compare", "XL", "SX", "Files_", "(_", "Exce", "l", "Compari", "son", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "Diff_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "'", "chart", "\\u", "chart", "area", "01", ".", "xls", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "dir_", "=_", "'", "xls", "xw", "riter", "/", "test", "/", "compa", "ris", "on", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "got", "\\u", "filename_", "=_", "test\\u", "dir_", "+_", "'\\u", "test\\u", "'_", "+_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exp", "\\u", "filename_", "=_", "test\\u", "dir_", "+_", "'", "xls", "x", "\\u", "files", "/'_", "+_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ignore", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignore", "\\u", "elements_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compare", "XL", "SX", "Files_", "(_", "Exce", "l", "Compari", "son", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Xl", "sx", "Write", "r", " ", "chart", "area", " ", "proper", "ties", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workbook_", "=_", "Workbook", "_", "(_", "self_", "._", "got", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worksheet_", "=_", "workbook_", "._", "add", "\\u", "worksheet_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "=_", "workbook_", "._", "add", "\\u", "chart_", "(_", "{_", "'", "type", "'_", ":_", "'", "column", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chart_", "._", "axis", "\\u", "ids_", "=_", "[_", "829", "332", "48_", ",_", "829", "529", "60_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "2_", ",_", "4_", ",_", "6_", ",_", "8_", ",_", "10_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", ",_", "6_", ",_", "9_", ",_", "12_", ",_", "15_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worksheet_", "._", "write", "\\u", "column_", "(_", "'", "A1", "'_", ",_", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worksheet_", "._", "write", "\\u", "column_", "(_", "'", "B1", "'_", ",_", "data_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worksheet_", "._", "write", "\\u", "column_", "(_", "'", "C1", "'_", ",_", "data_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chart_", "._", "add", "\\u", "series_", "(_", "{_", "'", "values", "'_", ":_", "'=", "She", "et", "1", "!", "$", "A", "$", "1", ":$", "A", "$", "5", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "._", "add", "\\u", "series_", "(_", "{_", "'", "values", "'_", ":_", "'=", "She", "et", "1", "!", "$", "B", "$", "1", ":$", "B", "$", "5", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "._", "add", "\\u", "series_", "(_", "{_", "'", "values", "'_", ":_", "'=", "She", "et", "1", "!", "$", "C", "$", "1", ":$", "C", "$", "5", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chart_", "._", "set\\u", "chart", "area_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "border", "'_", ":_", "{_", "'", "none", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fill", "'_", ":_", "{_", "'", "color", "'_", ":_", "'", "red", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chart_", "._", "set\\u", "plot", "area_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "border", "'_", ":_", "{_", "'", "color", "'_", ":_", "'", "yell", "ow", "'_", ",_", "'", "widt", "h", "'_", ":_", "1_", ",_", "'", "dash", "\\u", "type", "'_", ":_", "'", "dash", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fill", "'_", ":_", "{_", "'", "color", "'_", ":_", "'#", "9", "2", "D0", "50", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worksheet_", "._", "insert", "\\u", "chart_", "(_", "'", "E", "9", "'_", ",_", "chart_", ")_", "\\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'
jupyter/jupyter_client/jupyter_client/blocking/channels.py
[ { "content": "\"\"\"Blocking channels\n\nUseful for test suites and blocking terminal interfaces.\n\"\"\"\n\n# Copyright (c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\n\ntry:\n from queue import Queue, Empty # Py 3\nexcept ImportError:\n from Queue import Queue, Empty # Py 2\n\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_", "\"\"\"", "Block", "ing", " ", "channel", "s", "\\", "10", ";", "\\", "10", ";", "Us", "efu", "l", " ", "for", " ", "test", " ", "suites", " ", "and", " ", "blockin", "g", " ", "termina", "l", " ", "interface", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Ju", "pyt", "er", " ", "Dev", "elo", "pme", "nt", " ", "Tea", "m", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "Modifie", "d", " ", "BS", "D", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "queue_", "import_", "Queue_", ",_", "Empty_", "#", " ", "Py", " ", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Queue_", "import_", "Queue_", ",_", "Empty_", "#", " ", "Py", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
gkno/gkno_launcher/src/networkx/algorithms/link_analysis/tests/test_hits.py
[ { "content": "#!/usr/bin/env python\nfrom nose.tools import *\nfrom nose import SkipTest\nfrom nose.plugins.attrib import attr\nimport networkx\n\n# Example from\n# A. Langville and C. Meyer, \"A survey of eigenvector methods of web\n# information retrieval.\" http://citeseer.ist.psu.edu/713792.html\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestHITS:\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestHITS", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def setUp(self):\n \n G=networkx.DiGraph()\n\n edges=[(1,3),(1,5),\\\n (2,1),\\\n (3,5),\\\n (5,4),(5,3),\\\n (6,5)]\n \n G.add_edges_from(edges,weight=1)\n self.G=G\n self.G.a=dict(zip(G,[0.000000, 0.000000, 0.366025,\n 0.133975, 0.500000, 0.000000]))\n self.G.h=dict(zip(G,[ 0.366025, 0.000000, 0.211325, \n 0.000000, 0.211325, 0.211325]))", "metadata": "root.TestHITS.setUp", "header": "['class', 'TestHITS', ':', '___EOS___']", "index": 13 }, { "content": " def test_hits(self):\n G=self.G\n h,a=networkx.hits(G,tol=1.e-08)\n for n in G:\n assert_almost_equal(h[n],G.h[n],places=4)\n for n in G:\n assert_almost_equal(a[n],G.a[n],places=4)", "metadata": "root.TestHITS.test_hits", "header": "['class', 'TestHITS', ':', '___EOS___']", "index": 31 }, { "content": " def test_hits_nstart(self):\n G = self.G\n nstart = dict([(i, 1./2) for i in G])\n h, a = networkx.hits(G, nstart = nstart)", "metadata": "root.TestHITS.test_hits_nstart", "header": "['class', 'TestHITS', ':', '___EOS___']", "index": 39 }, { "content": " @attr('numpy')\n def test_hits_numpy(self):\n try:\n import numpy as np\n except ImportError:\n raise SkipTest('NumPy not available.')\n\n\n G=self.G\n h,a=networkx.hits_numpy(G)\n for n in G:\n assert_almost_equal(h[n],G.h[n],places=4)\n for n in G:\n assert_almost_equal(a[n],G.a[n],places=4)", "metadata": "root.TestHITS.test_hits_numpy", "header": "['class', 'TestHITS', ':', '___EOS___']", "index": 44 }, { "content": " def test_hits_scipy(self):\n try:\n import scipy as sp\n except ImportError:\n raise SkipTest('SciPy not available.')\n\n G=self.G\n h,a=networkx.hits_scipy(G,tol=1.e-08)\n for n in G:\n assert_almost_equal(h[n],G.h[n],places=4)\n for n in G:\n assert_almost_equal(a[n],G.a[n],places=4)", "metadata": "root.TestHITS.test_hits_scipy", "header": "['class', 'TestHITS', ':', '___EOS___']", "index": 60 }, { "content": " @attr('numpy')\n def test_empty(self):\n try:\n import numpy\n except ImportError:\n raise SkipTest('numpy not available.')\n G=networkx.Graph()\n assert_equal(networkx.hits(G),({},{}))\n assert_equal(networkx.hits_numpy(G),({},{}))\n assert_equal(networkx.authority_matrix(G).shape,(0,0))\n assert_equal(networkx.hub_matrix(G).shape,(0,0))", "metadata": "root.TestHITS.test_empty", "header": "['class', 'TestHITS', ':', '___EOS___']", "index": 74 }, { "content": " def test_empty_scipy(self):\n try:\n import scipy\n except ImportError:\n raise SkipTest('scipy not available.')\n G=networkx.Graph()\n assert_equal(networkx.hits_scipy(G),({},{}))", "metadata": "root.TestHITS.test_empty_scipy", "header": "['class', 'TestHITS', ':', '___EOS___']", "index": 86 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "import_", "Ski", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "plugins_", "._", "attrib_", "import_", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "networkx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", ".", " ", "Lang", "vil", "le", " ", "and", " ", "C", ".", " ", "Me", "yer", ",", " ", "\"", "A", " ", "survey", " ", "of", " ", "eigenvector", " ", "method", "s", " ", "of", " ", "web_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "informati", "on", " ", "retrie", "val", ".\"", " ", " ", "http", "://", "cite", "see", "r", ".", "ist", ".", "psu", ".", "edu", "/", "713", "792", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "HIT", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "HIT", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "networkx_", "._", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edges_", "=_", "[_", "(_", "1_", ",_", "3_", ")_", ",_", "(_", "1_", ",_", "5_", ")_", ",_", "(_", "2_", ",_", "1_", ")_", ",_", "(_", "3_", ",_", "5_", ")_", ",_", "(_", "5_", ",_", "4_", ")_", ",_", "(_", "5_", ",_", "3_", ")_", ",_", "(_", "6_", ",_", "5_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "s", "\\u", "from_", "(_", "edges_", ",_", "weight_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "G_", "=_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "G_", "._", "a_", "=_", "dict_", "(_", "zip_", "(_", "G_", ",_", "[_", "0.000000_", ",_", "0.000000_", ",_", "0.36", "602", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.13", "397", "5_", ",_", "0.50", "0000_", ",_", "0.000000_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "G_", "._", "h_", "=_", "dict_", "(_", "zip_", "(_", "G_", ",_", "[_", "0.36", "602", "5_", ",_", "0.000000_", ",_", "0.21", "132", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.000000_", ",_", "0.21", "132", "5_", ",_", "0.21", "132", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HIT", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "self_", "._", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", ",_", "a_", "=_", "networkx_", "._", "hits_", "(_", "G_", ",_", "tol_", "=_", "1.e", "-0", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "h_", "[_", "n_", "]_", ",_", "G_", "._", "h_", "[_", "n_", "]_", ",_", "places_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "a_", "[_", "n_", "]_", ",_", "G_", "._", "a_", "[_", "n_", "]_", ",_", "places_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HIT", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hits", "\\u", "nsta", "rt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "self_", "._", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nsta", "rt_", "=_", "dict_", "(_", "[_", "(_", "i_", ",_", "1._", "/_", "2_", ")_", "for_", "i_", "in_", "G_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", ",_", "a_", "=_", "networkx_", "._", "hits_", "(_", "G_", ",_", "nsta", "rt_", "=_", "nsta", "rt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HIT", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "attr_", "(_", "'", "nump", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "hits", "\\u", "numpy_", "(_", "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 ", " _", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "Num", "Py", " ", "not", " ", "avail", "able", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "=_", "self_", "._", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", ",_", "a_", "=_", "networkx_", "._", "hits", "\\u", "numpy_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "h_", "[_", "n_", "]_", ",_", "G_", "._", "h_", "[_", "n_", "]_", ",_", "places_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "a_", "[_", "n_", "]_", ",_", "G_", "._", "a_", "[_", "n_", "]_", ",_", "places_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HIT", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hits", "\\u", "scipy_", "(_", "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 ", " _", "import_", "scipy_", "as_", "sp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "Sci", "Py", " ", "not", " ", "avail", "able", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "=_", "self_", "._", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", ",_", "a_", "=_", "networkx_", "._", "hits", "\\u", "scipy_", "(_", "G_", ",_", "tol_", "=_", "1.e", "-0", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "h_", "[_", "n_", "]_", ",_", "G_", "._", "h_", "[_", "n_", "]_", ",_", "places_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "a_", "[_", "n_", "]_", ",_", "G_", "._", "a_", "[_", "n_", "]_", ",_", "places_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HIT", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "attr_", "(_", "'", "nump", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "empty_", "(_", "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 ", " _", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "nump", "y", " ", "not", " ", "avail", "able", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "=_", "networkx_", "._", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "networkx_", "._", "hits_", "(_", "G_", ")_", ",_", "(_", "{_", "}_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "networkx_", "._", "hits", "\\u", "numpy_", "(_", "G_", ")_", ",_", "(_", "{_", "}_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "networkx_", "._", "authori", "ty", "\\u", "matrix_", "(_", "G_", ")_", "._", "shape_", ",_", "(_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "networkx_", "._", "hub", "\\u", "matrix_", "(_", "G_", ")_", "._", "shape_", ",_", "(_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HIT", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty", "\\u", "scipy_", "(_", "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 ", " _", "import_", "scipy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "sci", "py", " ", "not", " ", "avail", "able", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "=_", "networkx_", "._", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "networkx_", "._", "hits", "\\u", "scipy_", "(_", "G_", ")_", ",_", "(_", "{_", "}_", ",_", "{_", "}_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Module is imported with 'import' and 'import from'
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/compute/utils.py
[ { "content": "# Copyright (c) 2011 OpenStack Foundation\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\"\"\"Compute-related Utilities and helpers.\"\"\"\n\nimport itertools\nimport string\nimport traceback\n\nimport netifaces\nfrom oslo_config import cfg\nfrom oslo_log import log\nimport six\n\nfrom nova import block_device\nfrom nova.compute import power_state\nfrom nova.compute import task_states\nfrom nova import exception\nfrom nova.i18n import _LW\nfrom nova.network import model as network_model\nfrom nova import notifications\nfrom nova import objects\nfrom nova import rpc\nfrom nova import utils\nfrom nova.virt import driver\n\nCONF = cfg.CONF\nCONF.import_opt('host', 'nova.netconf')\nLOG = log.getLogger(__name__)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", " ", "Open", "Stack", " ", "Foun", "dati", "on_", "\\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_", "\"\"\"", "Compute", "-", "relate", "d", " ", "Utili", "ties", " ", "and", " ", "help", "ers", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "neti", "faces_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "config_", "import_", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "log_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "import_", "block", "\\u", "device_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "compute_", "import_", "power", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "compute_", "import_", "task", "\\u", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "i18n_", "import_", "\\u", "LW", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "network_", "import_", "model_", "as_", "network", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "notifications_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "rpc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "virt_", "import_", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "=_", "cfg_", "._", "CONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONF_", "._", "import", "\\u", "opt_", "(_", "'", "host", "'_", ",_", "'", "nova", ".", "netconf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "=_", "log_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Redundant comparison
daeilkim/refinery/refinery/bnpy/bnpy-dev/tests/suffstats/TestParamBag.py
[ { "content": " def test_parseArr_dim3_passes(self):\n K=2\n D=2\n PB = ParamBag(K=K, D=D)\n x = PB.parseArr(np.random.randn(K,D,D), dims=('K','D','D'))\n assert x.ndim == 3 and x.size == K*D*D\n\n K=1\n D=2\n PB = ParamBag(K=K, D=D)\n x = PB.parseArr(np.random.rand(K,D,D), dims=('K','D', 'D'))\n assert x.ndim == 3 and x.size == K*D*D\n\n K=3\n D=1\n PB = ParamBag(K=K, D=D)\n x = PB.parseArr(np.random.rand(K,D,D), dims=('K','D', 'D'))\n assert x.ndim == 3 and x.size == K*D*D", "metadata": "root.TestParamBag.test_parseArr_dim3_passes", "header": "['class', 'TestParamBag', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 392 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "class_", "Test", "Param", "Bag", "_", "(_", "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", "parse", "Arr", "\\u", "dim", "3", "\\u", "passes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "K_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PB", "_", "=_", "Param", "Bag", "_", "(_", "K_", "=_", "K_", ",_", "D_", "=_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "PB", "_", "._", "parse", "Arr_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "K_", ",_", "D_", ",_", "D_", ")_", ",_", "dims_", "=_", "(_", "'", "K", "'_", ",_", "'", "D", "'_", ",_", "'", "D", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "x_", "._", "ndim_", "==_", "3_", "and_", "x_", "._", "size_", "==_", "K_", "*_", "D_", "*_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "K_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PB", "_", "=_", "Param", "Bag", "_", "(_", "K_", "=_", "K_", ",_", "D_", "=_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "PB", "_", "._", "parse", "Arr_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "K_", ",_", "D_", ",_", "D_", ")_", ",_", "dims_", "=_", "(_", "'", "K", "'_", ",_", "'", "D", "'_", ",_", "'", "D", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "x_", "._", "ndim_", "==_", "3_", "and_", "x_", "._", "size_", "==_", "K_", "*_", "D_", "*_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "K_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PB", "_", "=_", "Param", "Bag", "_", "(_", "K_", "=_", "K_", ",_", "D_", "=_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "PB", "_", "._", "parse", "Arr_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "K_", ",_", "D_", ",_", "D_", ")_", ",_", "dims_", "=_", "(_", "'", "K", "'_", ",_", "'", "D", "'_", ",_", "'", "D", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "x_", "._", "ndim_", "==_", "3_", "and_", "x_", "._", "size_", "==_", "K_", "*_", "D_", "*_", "D_", "\\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 ]
First parameter of a method is not named 'self'
LASACTF/LASACTF-Problems/Problems/Cryptography/a-or-b-and-not-a-and-b-/challenge.py
[ { "content": " def setup(self):\n self.flag = 'I_like_candide_sheep'", "metadata": "root.Problem.setup", "header": "['class', 'Problem', '(', 'Challenge', ')', ':', '___EOS___']", "index": 3 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Problem_", "(_", "Chall", "enge", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flag_", "=_", "'", "I", "\\u", "like", "\\u", "candi", "de", "\\u", "she", "ep", "'_" ]
[ 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 ]
Except block handles 'BaseException'
MBoustani/Geothon/Create Spatial File/Vector/create_geojson_line.py
[ { "content": "#!/usr/bin/env python\n\n'''\nProject: Geothon (https://github.com/MBoustani/Geothon)\nFile: Vector/create_geojson_line.py\nDescription: This code creates a geojson line file from some points.\nAuthor: Maziyar Boustani (github.com/MBoustani)\n'''\n\ntry:\n import ogr\nexcept ImportError:\n from osgeo import ogr\n\nlatitudes = [30, 30, 40]\nlongitudes = [10, 20, 30]\n\nline = ogr.Geometry(ogr.wkbLineString)\nline.AddPoint(latitudes[0], longitudes[0])\nline.AddPoint(latitudes[1], longitudes[1])\nline.AddPoint(latitudes[2], longitudes[2])\ngeojson_line = line.ExportToJson()\nprint geojson_line\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_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Project", ":", " ", " ", " ", "Geo", "tho", "n", " ", "(", "https", "://", "git", "hub", ".", "com", "/", "MB", "ous", "tan", "i", "/", "Geo", "tho", "n", ")", "\\", "10", ";", "File", ":", " ", " ", "Vector", "/", "create", "\\u", "geo", "json", "\\u", "line", ".", "py", "\\", "10", ";", "Descripti", "on", ":", " ", " ", " ", "Thi", "s", " ", "code", " ", "create", "s", " ", "a", " ", "geo", "json", " ", "line", " ", "file", " ", "from", " ", "some", " ", "points", ".", "\\", "10", ";", "Author", ":", " ", " ", " ", " ", "Ma", "zi", "yar", " ", "Bou", "stan", "i", " ", "(", "git", "hub", ".", "com", "/", "MB", "ous", "tan", "i", ")", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ogr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "osg", "eo_", "import_", "ogr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "latitude", "s_", "=_", "[_", "30_", ",_", "30_", ",_", "40_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "longitude", "s_", "=_", "[_", "10_", ",_", "20_", ",_", "30_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "ogr_", "._", "Geometry_", "(_", "ogr_", "._", "wk", "b", "Line", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "._", "Add", "Point_", "(_", "latitude", "s_", "[_", "0_", "]_", ",_", "longitude", "s_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "._", "Add", "Point_", "(_", "latitude", "s_", "[_", "1_", "]_", ",_", "longitude", "s_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "._", "Add", "Point_", "(_", "latitude", "s_", "[_", "2_", "]_", ",_", "longitude", "s_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "json", "\\u", "line_", "=_", "line_", "._", "Export", "To", "Json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "geo", "json", "\\u", "line_" ]
[ 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 ]
Should use a 'with' statement
EliotBerriot/django-dynamic-preferences/tests/tests.py
[ { "content": " def test_can_cache_single_preference(self):\n\n manager = global_preferences_registry.manager()\n v = manager['no_section']\n with self.assertNumQueries(0):\n v = manager['no_section']\n v = manager['no_section']\n v = manager['no_section']", "metadata": "root.TestModels.test_can_cache_single_preference", "header": "['class', 'TestModels', '(', 'BaseTest', ',', 'TestCase', ')', ':', '___EOS___']", "index": 91 } ]
[]
[]
0
true
[ "[CLS]_", "Sho", "ul", "d_", "use_", "a_", "'", "with", "'_", "statement_", "[SEP]_", "class_", "Test", "Models_", "(_", "Base", "Test_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "can", "\\u", "cache", "\\u", "single", "\\u", "preference_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "=_", "global", "\\u", "preference", "s", "\\u", "registry_", "._", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "manager_", "[_", "'", "no", "\\u", "section", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Num", "Querie", "s_", "(_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "manager_", "[_", "'", "no", "\\u", "section", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "manager_", "[_", "'", "no", "\\u", "section", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "manager_", "[_", "'", "no", "\\u", "section", "'_", "]_", "\\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 ]
Unreachable code
AppScale/appscale/AppServer/google/appengine/tools/appengine_rpc_httplib2.py
[ { "content": "class NoStorage(client.Storage):\n \"\"\"A no-op implementation of storage.\"\"\"\n\n", "metadata": "root.NoStorage", "header": "['module', '___EOS___']", "index": 274 } ]
[]
[]
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_", "class_", "No", "Storage_", "(_", "client_", "._", "Storage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "no", "-", "op", " ", "implementation", " ", "of", " ", "storage", ".\"\"\"_", "\\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 ]
Except block handles 'BaseException'
googlefonts/fontbakery/tools/fontbakery-metadata-vs-api.py
[ { "content": "# -*- coding: utf-8 -*-\n#!/usr/bin/env python\nfrom __future__ import print_function\n\nimport argparse\nimport collections\nimport io\nimport os\nimport sys\nfrom bakery_cli.fonts_public_pb2 import FontProto, FamilyProto\nfrom google.protobuf import text_format\n\nargs = argparse.ArgumentParser()\nargs.add_argument('key', help='Key from Google Fonts Developer API')\nargs.add_argument('repo', help='Directory tree that contains directories with METADATA.pb files')\nargs.add_argument('--cache', help='Directory to store a copy of the files in the fonts developer api',\n default=\"/tmp/fontbakery-compare-git-api\")\nargs.add_argument('--verbose', help='Print additional information', action=\"store_true\")\nargs.add_argument('--ignore-copy-existing-ttf', action=\"store_true\")\nargs.add_argument('--autofix', help='Apply automatic fixes to files', action=\"store_true\")\nargs.add_argument('--api', help='Domain string to use to request', default=\"fonts.googleapis.com\")\nargv = args.parse_args()\n\n\n\n\nif __name__ == '__main__':\n import urllib\n import urlparse\n import json\n response = urllib.urlopen('https://www.googleapis.com/webfonts/v1/webfonts?key={}'.format(argv.key))\n try:\n webfontList = json.loads(response.read())['items']\n webfontListFamilyNames = [item['family'] for item in webfontList]\n except (ValueError, KeyError):\n sys.exit(1)\n\n for dirpath, dirnames, filenames in os.walk(argv.repo):\n metadataProtoFile = os.path.join(dirpath, 'METADATA.pb')\n if not os.path.exists(metadataProtoFile):\n continue\n\n metadata = FamilyProto()\n text_data = open(metadataProtoFile, \"rb\").read()\n text_format.Merge(text_data, metadata)\n try:\n family = metadata.name\n except KeyError:\n print('ER: \"{}\" does not contain FamilyName'.format(metadataProtoFile), file=sys.stderr)\n continue\n\n try:\n index = webfontListFamilyNames.index(family)\n webfontsItem = webfontList[index]\n except ValueError:\n print('ER: Family \"{}\" could not be found in API'.format(family))\n continue\n\n webfontVariants = []\n log_messages = []\n for variant, fonturl in webfontsItem['files'].items():\n cache_font_path = get_cache_font_path(argv.cache, fonturl)\n webfontVariants.append(variant)\n\n if argv.ignore_copy_existing_ttf and os.path.exists(cache_font_path):\n continue\n\n with open(cache_font_path, 'w') as fp:\n filenameWeightStyleIndex = [getVariantName(item) for item in metadata.fonts].index(variant)\n filename = metadata.fonts[filenameWeightStyleIndex].filename\n if argv.verbose:\n print('Downloading \"{}\" as \"{}\"'.format(fonturl, filename))\n\n #Saving:\n fp.write(urllib.urlopen(fonturl).read())\n\n #Symlinking:\n src = cache_font_path\n dst_dir = os.path.dirname(cache_font_path)\n dst = os.path.join(dst_dir, filename)\n if not os.path.exists(dst):\n os.symlink(src, dst)\n\n for subset in webfontsItem['subsets']:\n if subset == \"menu\":\n # note about Google Web Fonts:\n # Menu subsets are no longer generated offline.\n continue\n\n if subset not in metadata.subsets:\n print('ER: \"{}\" lacks subset \"{}\" in git'.format(family, subset), file=sys.stderr)\n else:\n if argv.verbose:\n print('OK: \"{}\" subset \"{}\" in sync'.format(family, subset))\n\n for subset in metadata.subsets:\n if subset != \"menu\" and subset not in webfontsItem['subsets']:\n print('ER: \"{}\" lacks subset \"{}\" in API'.format(family, subset), file=sys.stderr)\n\n if metadata.category.lower() != webfontsItem['category']:\n print('ER: \"{}\" category \"{}\" in git does not match category \"{}\" in API'.format(family, metadata.category, webfontsItem['category']))\n else:\n if argv.verbose:\n print('OK: \"{}\" category \"{}\" in sync'.format(family, metadata.category))\n\n\n for variant in webfontVariants:\n try:\n filenameWeightStyleIndex = [getVariantName(item) for item in metadata.fonts].index(variant)\n repoFileName = metadata.fonts[filenameWeightStyleIndex].filename\n\n fonturl = webfontsItem['files'][variant]\n fontpath = get_cache_font_path(argv.cache, fonturl)\n\n import hashlib\n google_md5 = hashlib.md5(open(fontpath, 'rb').read()).hexdigest()\n repo_md5 = hashlib.md5(open(os.path.join(dirpath, repoFileName), 'rb').read()).hexdigest()\n\n if repo_md5 == google_md5:\n log_messages.append([variant, 'OK', '\"{}\" in sync'.format(repoFileName)])\n else:\n log_messages.append([variant, 'ER', '\"{}\" checksum mismatch, file in API does not match file in git'.format(repoFileName)])\n\n except ValueError:\n log_messages.append([variant, 'ER', '\"{}\" available in API but not in git'.format(font.filename)])\n\n for font in metadata.fonts:\n variant = getVariantName(font)\n try:\n webfontVariants.index(variant)\n except ValueError:\n log_messages.append([variant, 'ER', '\"{}\" available in git but not in API'.format(font.filename)])\n\n #sort all the messages by their respective metadataFileName and print them:\n for message in sorted(log_messages, key=lambda x: x[0].lower()):\n variant, status, text = message\n if status == \"OK\":\n if argv.verbose:\n print('{}: {}'.format(status, text))\n else:\n print('{}: {}'.format(status, text), file=sys.stderr)\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_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bake", "ry", "\\u", "cli_", "._", "font", "s", "\\u", "public", "\\u", "pb2_", "import_", "Font", "Proto_", ",_", "Famil", "y", "Proto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "protobuf_", "import_", "text", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "add", "\\u", "argument_", "(_", "'", "key", "'_", ",_", "help_", "=_", "'", "Key", " ", "from", " ", "Goo", "gle", " ", "Font", "s", " ", "Dev", "elope", "r", " ", "API", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "add", "\\u", "argument_", "(_", "'", "repo", "'_", ",_", "help_", "=_", "'", "Director", "y", " ", "tree", " ", "tha", "t", " ", "contain", "s", " ", "director", "ies", " ", "with", " ", "METAD", "ATA", ".", "pb", " ", "files", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "add", "\\u", "argument_", "(_", "'--", "cache", "'_", ",_", "help_", "=_", "'", "Director", "y", " ", "to", " ", "store", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "files", " ", "in", " ", "the", " ", "font", "s", " ", "developer", " ", "api", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "\"/", "tmp", "/", "font", "bake", "ry", "-", "compare", "-", "git", "-", "api", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "add", "\\u", "argument_", "(_", "'--", "verbo", "se", "'_", ",_", "help_", "=_", "'", "Print", " ", "addition", "al", " ", "informati", "on", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "add", "\\u", "argument_", "(_", "'--", "ignore", "-", "copy", "-", "exist", "ing", "-", "tt", "f", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "add", "\\u", "argument_", "(_", "'--", "autof", "ix", "'_", ",_", "help_", "=_", "'", "Apply", " ", "automati", "c", " ", "fixes", " ", "to", " ", "files", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "add", "\\u", "argument_", "(_", "'--", "api", "'_", ",_", "help_", "=_", "'", "Doma", "in", " ", "string", " ", "to", " ", "use", " ", "to", " ", "request", "'_", ",_", "default_", "=_", "\"", "font", "s", ".", "google", "apis", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv_", "=_", "args_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib_", "._", "urlopen_", "(_", "'", "https", "://", "www", ".", "google", "apis", ".", "com", "/", "web", "font", "s", "/", "v1", "/", "web", "font", "s", "?", "key", "={}'_", "._", "format_", "(_", "argv_", "._", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "web", "font", "List_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "[_", "'", "items", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web", "font", "List", "Famil", "y", "Names_", "=_", "[_", "item_", "[_", "'", "famil", "y", "'_", "]_", "for_", "item_", "in_", "web", "font", "List_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dirpath_", ",_", "dirnames_", ",_", "filenames_", "in_", "os_", "._", "walk_", "(_", "argv_", "._", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata", "Proto", "File_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dirpath_", ",_", "'", "METAD", "ATA", ".", "pb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "metadata", "Proto", "File_", ")_", ":_", "\\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_", "metadata_", "=_", "Famil", "y", "Proto_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "data_", "=_", "open_", "(_", "metadata", "Proto", "File_", ",_", "\"", "rb", "\"_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "format_", "._", "Merge_", "(_", "text", "\\u", "data_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "metadata_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ER", ":", " ", "\"{}\"", " ", "doe", "s", " ", "not", " ", "contain", " ", "Famil", "y", "Name", "'_", "._", "format_", "(_", "metadata", "Proto", "File_", ")_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "web", "font", "List", "Famil", "y", "Names_", "._", "index_", "(_", "family_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web", "font", "s", "Item_", "=_", "web", "font", "List_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ER", ":", " ", "Famil", "y", " ", "\"{}\"", " ", "coul", "d", " ", "not", " ", "be", " ", "found", " ", "in", " ", "API", "'_", "._", "format_", "(_", "family_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "web", "font", "Varia", "nts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "variant_", ",_", "font", "url_", "in_", "web", "font", "s", "Item_", "[_", "'", "files", "'_", "]_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "\\u", "font", "\\u", "path_", "=_", "get", "\\u", "cache", "\\u", "font", "\\u", "path_", "(_", "argv_", "._", "cache_", ",_", "font", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web", "font", "Varia", "nts_", "._", "append_", "(_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argv_", "._", "ignore", "\\u", "copy", "\\u", "exist", "ing", "\\u", "tt", "f_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "cache", "\\u", "font", "\\u", "path_", ")_", ":_", "\\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_", "with_", "open_", "(_", "cache", "\\u", "font", "\\u", "path_", ",_", "'", "w", "'_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename", "Weig", "ht", "Style", "Index_", "=_", "[_", "get", "Varia", "nt", "Name_", "(_", "item_", ")_", "for_", "item_", "in_", "metadata_", "._", "fonts_", "]_", "._", "index_", "(_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "metadata_", "._", "fonts_", "[_", "filename", "Weig", "ht", "Style", "Index_", "]_", "._", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "argv_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "Down", "load", "ing", " ", "\"{}\"", " ", "as", " ", "\"{}\"'_", "._", "format_", "(_", "font", "url_", ",_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Sav", "ing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fp_", "._", "write_", "(_", "urllib_", "._", "urlopen_", "(_", "font", "url_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Sym", "linking", ":_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "=_", "cache", "\\u", "font", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "cache", "\\u", "font", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dst", "\\u", "dir_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "dst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "symlink_", "(_", "src_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subset_", "in_", "web", "font", "s", "Item_", "[_", "'", "subsets", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "subset_", "==_", "\"", "menu", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", " ", "abo", "ut", " ", "Goo", "gle", " ", "Web", " ", "Font", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Menu", " ", "subsets", " ", "are", " ", "no", " ", "long", "er", " ", "generat", "ed", " ", "offline", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subset_", "not_", "in_", "metadata_", "._", "subsets", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ER", ":", " ", "\"{}\"", " ", "lack", "s", " ", "subse", "t", " ", "\"{}\"", " ", "in", " ", "git", "'_", "._", "format_", "(_", "family_", ",_", "subset_", ")_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "OK", ":", " ", "\"{}\"", " ", "subse", "t", " ", "\"{}\"", " ", "in", " ", "sync", "'_", "._", "format_", "(_", "family_", ",_", "subset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subset_", "in_", "metadata_", "._", "subsets", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "subset_", "!=_", "\"", "menu", "\"_", "and_", "subset_", "not_", "in_", "web", "font", "s", "Item_", "[_", "'", "subsets", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ER", ":", " ", "\"{}\"", " ", "lack", "s", " ", "subse", "t", " ", "\"{}\"", " ", "in", " ", "API", "'_", "._", "format_", "(_", "family_", ",_", "subset_", ")_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\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_", "metadata_", "._", "category_", "._", "lower_", "(_", ")_", "!=_", "web", "font", "s", "Item_", "[_", "'", "category", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ER", ":", " ", "\"{}\"", " ", "category", " ", "\"{}\"", " ", "in", " ", "git", " ", "doe", "s", " ", "not", " ", "match", " ", "category", " ", "\"{}\"", " ", "in", " ", "API", "'_", "._", "format_", "(_", "family_", ",_", "metadata_", "._", "category_", ",_", "web", "font", "s", "Item_", "[_", "'", "category", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "OK", ":", " ", "\"{}\"", " ", "category", " ", "\"{}\"", " ", "in", " ", "sync", "'_", "._", "format_", "(_", "family_", ",_", "metadata_", "._", "category_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "variant_", "in_", "web", "font", "Varia", "nts_", ":_", "\\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 ", " _", "filename", "Weig", "ht", "Style", "Index_", "=_", "[_", "get", "Varia", "nt", "Name_", "(_", "item_", ")_", "for_", "item_", "in_", "metadata_", "._", "fonts_", "]_", "._", "index_", "(_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "File", "Name_", "=_", "metadata_", "._", "fonts_", "[_", "filename", "Weig", "ht", "Style", "Index_", "]_", "._", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "font", "url_", "=_", "web", "font", "s", "Item_", "[_", "'", "files", "'_", "]_", "[_", "variant_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "font", "path_", "=_", "get", "\\u", "cache", "\\u", "font", "\\u", "path_", "(_", "argv_", "._", "cache_", ",_", "font", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "google", "\\u", "md5_", "=_", "hashlib_", "._", "md5_", "(_", "open_", "(_", "font", "path_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "md5_", "=_", "hashlib_", "._", "md5_", "(_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "dirpath_", ",_", "repo", "File", "Name_", ")_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "repo", "\\u", "md5_", "==_", "google", "\\u", "md5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log", "\\u", "messages_", "._", "append_", "(_", "[_", "variant_", ",_", "'", "OK", "'_", ",_", "'\"{", "}\"", " ", "in", " ", "sync", "'_", "._", "format_", "(_", "repo", "File", "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 ", " ", "_", "log", "\\u", "messages_", "._", "append_", "(_", "[_", "variant_", ",_", "'", "ER", "'_", ",_", "'\"{", "}\"", " ", "checks", "um", " ", "mism", "atch", ",", " ", "file", " ", "in", " ", "API", " ", "doe", "s", " ", "not", " ", "match", " ", "file", " ", "in", " ", "git", "'_", "._", "format_", "(_", "repo", "File", "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_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "messages_", "._", "append_", "(_", "[_", "variant_", ",_", "'", "ER", "'_", ",_", "'\"{", "}\"", " ", "avail", "able", " ", "in", " ", "API", " ", "but", " ", "not", " ", "in", " ", "git", "'_", "._", "format_", "(_", "font_", "._", "filename_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "font_", "in_", "metadata_", "._", "fonts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variant_", "=_", "get", "Varia", "nt", "Name_", "(_", "font_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "web", "font", "Varia", "nts_", "._", "index_", "(_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "messages_", "._", "append_", "(_", "[_", "variant_", ",_", "'", "ER", "'_", ",_", "'\"{", "}\"", " ", "avail", "able", " ", "in", " ", "git", " ", "but", " ", "not", " ", "in", " ", "API", "'_", "._", "format_", "(_", "font_", "._", "filename_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sort", " ", "all", " ", "the", " ", "message", "s", " ", "by", " ", "thei", "r", " ", "respec", "tiv", "e", " ", "metadata", "File", "Name", " ", "and", " ", "print", " ", "them", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "message_", "in_", "sorted_", "(_", "log", "\\u", "messages_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variant_", ",_", "status_", ",_", "text_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "==_", "\"", "OK", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'{}", ":", " ", "{}'_", "._", "format_", "(_", "status_", ",_", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'{}", ":", " ", "{}'_", "._", "format_", "(_", "status_", ",_", "text_", ")_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
locustio/locust/locust/stats.py
[ { "content": " @property\n def avg_content_length(self):\n try:\n return self.total_content_length / self.num_requests\n except ZeroDivisionError:\n return 0", "metadata": "root.StatsEntry.avg_content_length", "header": "['class', 'StatsEntry', '(', 'object', ')', ':', '___EOS___']", "index": 226 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Stat", "s", "Entry_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "avg", "\\u", "content", "\\u", "length_", "(_", "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_", "._", "total", "\\u", "content", "\\u", "length_", "/_", "self_", "._", "num", "\\u", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\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 ]
Unused import
tangentlabs/django-fancypages/sandbox/settings/oscar.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals, absolute_import\nimport os\n\nfrom configurations import values\nfrom django.utils.translation import ugettext_lazy as _\n\nimport fancypages as fp\n\nfrom . import common\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OscarFancypages(common.Common):\n SANDBOX_MODULE = 'oscar_fancypages'\n\n\n MIDDLEWARE_CLASSES = common.Common.MIDDLEWARE_CLASSES + [\n 'oscar.apps.basket.middleware.BasketMiddleware',\n ]\n\n AUTHENTICATION_BACKENDS = (\n 'oscar.apps.customer.auth_backends.Emailbackend',\n 'django.contrib.auth.backends.ModelBackend',\n )\n\n ########## FANCYPAGES SETTINGS\n FP_NODE_MODEL = 'catalogue.Category'\n FP_PAGE_DETAIL_VIEW = 'fancypages.contrib.oscar_fancypages.views.FancyPageDetailView' # noqa\n ########## END FANCYPAGES SETTINGS\n\n # Required for South < 1.0\n SOUTH_MIGRATION_MODULES = {\n 'fancypages': 'fancypages.south_migrations',\n 'oscar_fancypages': 'fancypages.contrib.oscar_fancypages.south_migrations', # noqa\n }\n\n ########## OSCAR SETTINGS\n OSCAR_ALLOW_ANON_CHECKOUT = True\n\n TEMPLATE_CONTEXT_PROCESSORS = common.Common.TEMPLATE_CONTEXT_PROCESSORS + [\n 'oscar.apps.search.context_processors.search_form',\n 'oscar.apps.promotions.context_processors.promotions',\n 'oscar.apps.checkout.context_processors.checkout',\n 'oscar.apps.customer.notifications.context_processors.notifications',\n 'oscar.core.context_processors.metadata',\n ]\n\n OSCAR_SHOP_NAME = 'FancyPages Sandbox'\n OSCAR_SHOP_TAGLINE = 'Make your pages sparkle and shine!'\n\n # Haystack settings\n HAYSTACK_CONNECTIONS = {\n 'default': {'ENGINE': 'haystack.backends.simple_backend.SimpleEngine'}}\n\n OSCAR_DASHBOARD_NAVIGATION = [\n {\n 'label': _('Dashboard'),\n 'icon': 'icon-th-list',\n 'url_name': 'dashboard:index',\n },\n {\n 'label': _('Catalogue'),\n 'icon': 'icon-sitemap',\n 'children': [\n {\n 'label': _('Products'),\n 'url_name': 'dashboard:catalogue-product-list',\n },\n {\n 'label': _('Pages / Categories'),\n 'url_name': 'fp-dashboard:page-list',\n },\n {\n 'label': _('Ranges'),\n 'url_name': 'dashboard:range-list',\n },\n {\n 'label': _('Low stock alerts'),\n 'url_name': 'dashboard:stock-alert-list',\n },\n ]\n },\n {\n 'label': _('Fulfilment'),\n 'icon': 'icon-shopping-cart',\n 'children': [\n {\n 'label': _('Order management'),\n 'url_name': 'dashboard:order-list',\n },\n {\n 'label': _('Statistics'),\n 'url_name': 'dashboard:order-stats',\n },\n ]\n },\n {\n 'label': _('Customers'),\n 'icon': 'icon-group',\n 'children': [\n {\n 'label': _('Customer management'),\n 'url_name': 'dashboard:users-index',\n },\n {\n 'label': _('Stock alert requests'),\n 'url_name': 'dashboard:user-alert-list',\n },\n ]\n },\n {\n 'label': _('Offers'),\n 'icon': 'icon-bullhorn',\n 'children': [\n {\n 'label': _('Offer management'),\n 'url_name': 'dashboard:offer-list',\n },\n {\n 'label': _('Vouchers'),\n 'url_name': 'dashboard:voucher-list',\n },\n ],\n },\n {\n 'label': _('Content'),\n 'icon': 'icon-folder-close',\n 'children': [\n {\n 'label': _('Content blocks'),\n 'url_name': 'dashboard:promotion-list',\n },\n {\n 'label': _('Content blocks by page'),\n 'url_name': 'dashboard:promotion-list-by-page',\n },\n {\n 'label': _('Pages'),\n 'url_name': 'dashboard:page-list',\n },\n {\n 'label': _('Email templates'),\n 'url_name': 'dashboard:comms-list',\n },\n {\n 'label': _('Reviews'),\n 'url_name': 'dashboard:reviews-list',\n },\n ]\n },\n {\n 'label': _('Reports'),\n 'icon': 'icon-bar-chart',\n 'url_name': 'dashboard:reports-index',\n },\n ]\n ########## END OSCAR SETTINGS\n\n", "metadata": "root.OscarFancypages", "header": "['module', '___EOS___']", "index": 12 }, { "content": " @property\n def INSTALLED_APPS(self):\n from oscar import get_core_apps\n return self.REQUIRED_APPS + [\n 'django.contrib.flatpages',\n 'compressor',\n ] + fp.get_fancypages_apps(use_with_oscar=True) \\\n + get_core_apps()", "metadata": "root.OscarFancypages.INSTALLED_APPS", "header": "['class', 'OscarFancypages', '(', 'common', '.', 'Common', ')', ':', '___EOS___']", "index": 15 }, { "content": " @property\n def TEMPLATE_DIRS(self):\n from oscar import OSCAR_MAIN_TEMPLATE_DIR\n return super(OscarFancypages, self).TEMPLATE_DIRS + [\n os.path.join(OSCAR_MAIN_TEMPLATE_DIR, 'templates'),\n OSCAR_MAIN_TEMPLATE_DIR,\n ]", "metadata": "root.OscarFancypages.TEMPLATE_DIRS", "header": "['class', 'OscarFancypages', '(', 'common', '.', 'Common', ')', ':', '___EOS___']", "index": 166 }, { "content": " @classmethod\n def pre_setup(cls):\n \"\"\"\n Set the default values for fancypages and oscar from their respective\n settings dictionaries before setting up/overwriting them on the\n configurations class.\n \"\"\"\n super(OscarFancypages, cls).pre_setup()\n from oscar.defaults import OSCAR_SETTINGS\n for key, value in OSCAR_SETTINGS.iteritems():\n if not hasattr(cls, key):\n setattr(cls, key, value)", "metadata": "root.OscarFancypages.pre_setup", "header": "['class', 'OscarFancypages', '(', 'common', '.', 'Common', ')', ':', '___EOS___']", "index": 174 }, { "content": "class OscarFancypagesPostgres(OscarFancypages):\n POSTGRES_PORT = values.Value(5432)\n", "metadata": "root.OscarFancypagesPostgres", "header": "['module', '___EOS___']", "index": 188 }, { "content": " @property\n def DATABASES(self):\n return {'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2',\n 'NAME': 'ofp_sandbox',\n 'USER': 'postgres',\n 'PASSWORD': '',\n 'HOST': 'localhost',\n 'PORT': self.POSTGRES_PORT}}", "metadata": "root.OscarFancypagesPostgres.DATABASES", "header": "['class', 'OscarFancypagesPostgres', '(', 'OscarFancypages', ')', ':', '___EOS___']", "index": 191 }, { "content": "class OscarFancypagesMysql(OscarFancypages):\n MYSQL_PORT = values.Value(3306)\n", "metadata": "root.OscarFancypagesMysql", "header": "['module', '___EOS___']", "index": 202 }, { "content": " @property\n def DATABASES(self):\n return {'default': {\n 'ENGINE': 'django.db.backends.mysql',\n 'NAME': 'ofp_sandbox',\n 'USER': 'root',\n 'PASSWORD': '',\n 'HOST': '127.0.0.1',\n 'PORT': self.MYSQL_PORT}}", "metadata": "root.OscarFancypagesMysql.DATABASES", "header": "['class', 'OscarFancypagesMysql', '(', 'OscarFancypages', ')', ':', '___EOS___']", "index": 205 } ]
[]
[]
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_", ",_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "configurations_", "import_", "values_", "\\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_", "import_", "fancy", "pages_", "as_", "fp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Osc", "ar", "Fan", "cy", "pages_", "(_", "common_", "._", "Common_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SAN", "DB", "OX", "\\u", "MODULE_", "=_", "'", "osc", "ar", "\\u", "fancy", "page", "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\\uDEDENT\\u\\u\\u_", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "common_", "._", "Common_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "+_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", ".", "apps", ".", "basket", ".", "middle", "ware", ".", "Bas", "ket", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "AUTHENTICATION", "\\u", "BACKENDS", "_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", ".", "apps", ".", "customer", ".", "auth", "\\u", "back", "ends", ".", "Ema", "il", "back", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", ".", "back", "ends", ".", "Model", "Back", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#########", "#", " ", "FAN", "CY", "PAGE", "S", " ", "SETTINGS_", "\\u\\u\\uNL\\u\\u\\u_", "FP", "\\u", "NODE", "\\u", "MODEL_", "=_", "'", "catalogue", ".", "Cate", "gory", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FP", "\\u", "PAGE", "\\u", "DETAIL", "\\u", "VIEW_", "=_", "'", "fancy", "page", "s", ".", "contrib", ".", "osc", "ar", "\\u", "fancy", "page", "s", ".", "views", ".", "Fan", "cy", "Page", "Det", "ail", "View", "'_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#########", "#", " ", "END", " ", "FAN", "CY", "PAGE", "S", " ", "SETTINGS_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Requ", "ired", " ", "for", " ", "South", " ", "<", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "SOUT", "H", "\\u", "MIGRAT", "ION", "\\u", "MODULES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fancy", "page", "s", "'_", ":_", "'", "fancy", "page", "s", ".", "south", "\\u", "migrati", "ons", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", "\\u", "fancy", "page", "s", "'_", ":_", "'", "fancy", "page", "s", ".", "contrib", ".", "osc", "ar", "\\u", "fancy", "page", "s", ".", "south", "\\u", "migrati", "ons", "'_", ",_", "#", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#########", "#", " ", "OSC", "AR", " ", "SETTINGS_", "\\u\\u\\uNL\\u\\u\\u_", "OSC", "AR", "\\u", "ALLOW", "\\u", "ANON", "\\u", "CHECK", "OUT_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "CONTE", "XT", "\\u", "PROCESSOR", "S_", "=_", "common_", "._", "Common_", "._", "TEMPL", "ATE", "\\u", "CONTE", "XT", "\\u", "PROCESSOR", "S_", "+_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", ".", "apps", ".", "search", ".", "context", "\\u", "process", "ors", ".", "search", "\\u", "form", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", ".", "apps", ".", "promotion", "s", ".", "context", "\\u", "process", "ors", ".", "promotion", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", ".", "apps", ".", "check", "out", ".", "context", "\\u", "process", "ors", ".", "check", "out", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", ".", "apps", ".", "customer", ".", "notification", "s", ".", "context", "\\u", "process", "ors", ".", "notification", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "osc", "ar", ".", "core", ".", "context", "\\u", "process", "ors", ".", "metadata", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OSC", "AR", "\\u", "SHO", "P", "\\u", "NAME_", "=_", "'", "Fan", "cy", "Page", "s", " ", "Sandbox", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OSC", "AR", "\\u", "SHO", "P", "\\u", "TAG", "LINE_", "=_", "'", "Make", " ", "your", " ", "page", "s", " ", "spark", "le", " ", "and", " ", "shin", "e", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ha", "ysta", "ck", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "HA", "YST", "AC", "K", "\\u", "CONNECTION", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "'", "ENGINE", "'_", ":_", "'", "haystack", ".", "back", "ends", ".", "simple", "\\u", "back", "end", ".", "Simple", "Engine", "'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OSC", "AR", "\\u", "DAS", "HB", "OARD", "\\u", "NAV", "IG", "ATION_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Dash", "board", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "'", "icon", "-", "th", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Catalog", "ue", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "'", "icon", "-", "sitemap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "child", "ren", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Product", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "catalogue", "-", "product", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Page", "s", " ", "/", " ", "Categori", "es", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "fp", "-", "dash", "board", ":", "page", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Range", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "range", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Lo", "w", " ", "stock", " ", "alert", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "stock", "-", "alert", "-", "list", "'_", ",_", "\\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_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Fu", "lfil", "ment", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "'", "icon", "-", "shopping", "-", "cart", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "child", "ren", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Order", " ", "manage", "ment", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "order", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Statistic", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "order", "-", "stats", "'_", ",_", "\\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_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Custom", "ers", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "'", "icon", "-", "group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "child", "ren", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Custom", "er", " ", "manage", "ment", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "users", "-", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Stock", " ", "alert", " ", "request", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "user", "-", "alert", "-", "list", "'_", ",_", "\\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_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Offer", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "'", "icon", "-", "bull", "horn", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "child", "ren", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Offer", " ", "manage", "ment", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "off", "er", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Vo", "uche", "rs", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "voucher", "-", "list", "'_", ",_", "\\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_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Conten", "t", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "'", "icon", "-", "folder", "-", "close", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "child", "ren", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Conten", "t", " ", "blocks", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "promotion", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Conten", "t", " ", "blocks", " ", "by", " ", "page", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "promotion", "-", "list", "-", "by", "-", "page", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Page", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "page", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Ema", "il", " ", "template", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "comms", "-", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Review", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "review", "s", "-", "list", "'_", ",_", "\\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_", "'", "label", "'_", ":_", "\\u_", "(_", "'", "Report", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "'", "icon", "-", "bar", "-", "chart", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "name", "'_", ":_", "'", "dash", "board", ":", "report", "s", "-", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#########", "#", " ", "END", " ", "OSC", "AR", " ", "SETTINGS_", "\\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_", "Osc", "ar", "Fan", "cy", "pages_", "(_", "common_", "._", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "INSTALLE", "D", "\\u", "APPS_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "osc", "ar_", "import_", "get", "\\u", "core", "\\u", "apps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "REQUIRE", "D", "\\u", "APPS_", "+_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "flat", "page", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compressor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "+_", "fp_", "._", "get", "\\u", "fancy", "page", "s", "\\u", "apps_", "(_", "use", "\\u", "with", "\\u", "osc", "ar_", "=_", "True_", ")_", "+_", "get", "\\u", "core", "\\u", "apps_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Osc", "ar", "Fan", "cy", "pages_", "(_", "common_", "._", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "TEMPL", "ATE", "\\u", "DIRS_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "osc", "ar_", "import_", "OSC", "AR", "\\u", "MAIN", "\\u", "TEMPL", "ATE", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Osc", "ar", "Fan", "cy", "pages_", ",_", "self_", ")_", "._", "TEMPL", "ATE", "\\u", "DIRS_", "+_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "OSC", "AR", "\\u", "MAIN", "\\u", "TEMPL", "ATE", "\\u", "DIR_", ",_", "'", "template", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "OSC", "AR", "\\u", "MAIN", "\\u", "TEMPL", "ATE", "\\u", "DIR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Osc", "ar", "Fan", "cy", "pages_", "(_", "common_", "._", "Common_", ")_", ":_", "\\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_", "pre", "\\u", "setup_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "default", " ", "values", " ", "for", " ", "fancy", "page", "s", " ", "and", " ", "osc", "ar", " ", "from", " ", "thei", "r", " ", "respec", "tiv", "e", "\\", "10", ";", " ", " ", " ", " ", "settings", " ", "dictionar", "ies", " ", "bef", "ore", " ", "setti", "ng", " ", "up", "/", "overwrit", "ing", " ", "them", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", "s", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Osc", "ar", "Fan", "cy", "pages_", ",_", "cls_", ")_", "._", "pre", "\\u", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "osc", "ar_", "._", "defaults_", "import_", "OSC", "AR", "\\u", "SETTINGS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "OSC", "AR", "\\u", "SETTINGS_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "cls_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "cls_", ",_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Osc", "ar", "Fan", "cy", "page", "s", "Post", "gres", "_", "(_", "Osc", "ar", "Fan", "cy", "pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "POST", "GRES", "\\u", "PORT_", "=_", "values_", "._", "Value_", "(_", "5432", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Osc", "ar", "Fan", "cy", "page", "s", "Post", "gres", "_", "(_", "Osc", "ar", "Fan", "cy", "pages_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "DATABASES_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "'", "django", ".", "db", ".", "back", "ends", ".", "postgres", "ql", "\\u", "psy", "cop", "g2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'", "ofp", "\\u", "sand", "box", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "USER", "'_", ":_", "'", "postgres", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PASS", "WORD", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HOST", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PORT", "'_", ":_", "self_", "._", "POST", "GRES", "\\u", "PORT_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Osc", "ar", "Fan", "cy", "page", "s", "Mys", "ql_", "(_", "Osc", "ar", "Fan", "cy", "pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MYSQL", "\\u", "PORT_", "=_", "values_", "._", "Value_", "(_", "3306", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Osc", "ar", "Fan", "cy", "page", "s", "Mys", "ql_", "(_", "Osc", "ar", "Fan", "cy", "pages_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "DATABASES_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "'", "django", ".", "db", ".", "back", "ends", ".", "mysql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'", "ofp", "\\u", "sand", "box", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "USER", "'_", ":_", "'", "root", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PASS", "WORD", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HOST", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PORT", "'_", ":_", "self_", "._", "MYSQL", "\\u", "PORT_", "}_", "}_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Duplicate key in dict literal
splunk/splunk-sdk-python/tests/searchcommands/test_builtin_options.py
[ { "content": " def _test_boolean_option(self, option):\n\n rebase_environment('app_without_logging_configuration')\n command = StubbedSearchCommand()\n\n # show_configuration accepts Splunk boolean values\n\n boolean_values = {\n '0': False, '1': True,\n 'f': False, 't': True,\n 'n': False, 'y': True,\n 'no': False, 'yes': True,\n 'false': False, 'true': True}\n\n for value in boolean_values:\n for variant in value, value.capitalize(), value.upper():\n for s in variant, bytes(variant):\n option.fset(command, s)\n self.assertEquals(option.fget(command), boolean_values[value])\n\n option.fset(command, None)\n self.assertEquals(option.fget(command), None)\n\n for value in 13, b'bytes', 'string', object():\n try:\n option.fset(command, value)\n except ValueError:\n pass\n except BaseException as error:\n self.fail('Expected ValueError when setting {}={}, but {} was raised'.format(\n option.name, repr(value), type(error)))\n else:\n self.fail('Expected ValueError, but {}={} was accepted.'.format(\n option.name, repr(option.fget(command))))\n\n return", "metadata": "root.TestBuiltinOptions._test_boolean_option", "header": "['class', 'TestBuiltinOptions', '(', 'TestCase', ')', ':', '___EOS___']", "index": 175 } ]
[]
[]
0
true
[ "[CLS]_", "Duplicate", "_", "key_", "in_", "dict_", "literal_", "[SEP]_", "class_", "Test", "Bu", "ilt", "in", "Options_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "boolean", "\\u", "option_", "(_", "self_", ",_", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebase", "\\u", "environment_", "(_", "'", "app", "\\u", "with", "out", "\\u", "logg", "ing", "\\u", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "Stu", "bbe", "d", "Sear", "ch", "Command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "\\u", "configura", "tion", " ", "accepts", " ", "Spl", "unk", " ", "boolean", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "boolean", "\\u", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "0", "'_", ":_", "False_", ",_", "'", "1", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f", "'_", ":_", "False_", ",_", "'", "t", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "'_", ":_", "False_", ",_", "'", "y", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "no", "'_", ":_", "False_", ",_", "'", "ye", "s", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fal", "se", "'_", ":_", "False_", ",_", "'", "true", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "boolean", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "variant_", "in_", "value_", ",_", "value_", "._", "capitalize_", "(_", ")_", ",_", "value_", "._", "upper_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "s_", "in_", "variant_", ",_", "bytes_", "(_", "variant_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "option_", "._", "fset_", "(_", "command_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "option_", "._", "fget_", "(_", "command_", ")_", ",_", "boolean", "\\u", "values_", "[_", "value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "option_", "._", "fset_", "(_", "command_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "option_", "._", "fget_", "(_", "command_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "13_", ",_", "b", "'", "bytes", "'_", ",_", "'", "string", "'_", ",_", "object_", "(_", ")_", ":_", "\\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 ", " _", "option_", "._", "fset_", "(_", "command_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", " ", "whe", "n", " ", "setti", "ng", " ", "{}", "={}", ",", " ", "but", " ", "{}", " ", "was", " ", "raise", "d", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "option_", "._", "name_", ",_", "repr_", "(_", "value_", ")_", ",_", "type_", "(_", "error_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "{}", "={}", " ", "was", " ", "accept", "ed", ".'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "option_", "._", "name_", ",_", "repr_", "(_", "option_", "._", "fget_", "(_", "command_", ")_", ")_", ")_", ")_", "\\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_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
armet/python-armet/tests/connectors/flask.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals, division\nimport flask\nimport wsgi_intercept\nfrom wsgi_intercept.httplib2_intercept import install\nfrom .utils import force_import_module\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def http_setup(connectors, host, port, callback):\n # Install the WSGI interception layer.\n install()\n\n # Flask is pretty straightforward.\n # We just need to push an application context.\n application = flask.Flask(__name__)\n application.debug = True\n\n # Invoke the callback if we got one.\n if callback:\n callback()\n\n # Then import the resources; iterate and mount each one.\n module = force_import_module('tests.connectors.resources')\n for name in module.__all__:\n getattr(module, name).mount(r'/api/', application)\n\n # Enable the WSGI interception layer.\n wsgi_intercept.add_wsgi_intercept(host, port, lambda: application)", "metadata": "root.http_setup", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def http_teardown(host, port):\n # Remove the WSGI interception layer.\n wsgi_intercept.remove_wsgi_intercept(host, port)", "metadata": "root.http_teardown", "header": "['module', '___EOS___']", "index": 30 } ]
[]
[]
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_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "flask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wsgi", "\\u", "intercept_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wsgi", "\\u", "intercept_", "._", "http", "lib", "2", "\\u", "intercept_", "import_", "install_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "force", "\\u", "import", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "http", "\\u", "setup_", "(_", "connectors", "_", ",_", "host_", ",_", "port_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Install", " ", "the", " ", "WS", "GI", " ", "intercept", "ion", " ", "layer", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", " ", "is", " ", "pretty", " ", "straight", "forward", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "just", " ", "need", " ", "to", " ", "push", " ", "an", " ", "applica", "tion", " ", "context", "._", "\\u\\u\\uNL\\u\\u\\u_", "application_", "=_", "flask_", "._", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "application_", "._", "debug_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Invok", "e", " ", "the", " ", "callback", " ", "if", " ", "we", " ", "got", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "import", " ", "the", " ", "resource", "s", ";", " ", "iterate", " ", "and", " ", "mount", " ", "each", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module_", "=_", "force", "\\u", "import", "\\u", "module_", "(_", "'", "tests", ".", "connectors", ".", "resource", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "module_", "._", "\\u\\u", "all\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getattr_", "(_", "module_", ",_", "name_", ")_", "._", "mount_", "(_", "r", "'/", "api", "/'_", ",_", "application_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "the", " ", "WS", "GI", " ", "intercept", "ion", " ", "layer", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wsgi", "\\u", "intercept_", "._", "add", "\\u", "wsgi", "\\u", "intercept_", "(_", "host_", ",_", "port_", ",_", "lambda_", ":_", "application_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "http", "\\u", "teardown_", "(_", "host_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "the", " ", "WS", "GI", " ", "intercept", "ion", " ", "layer", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wsgi", "\\u", "intercept_", "._", "remove", "\\u", "wsgi", "\\u", "intercept_", "(_", "host_", ",_", "port_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nvbn/thefuck/tests/rules/test_rm_root.py
[ { "content": "import pytest\nfrom thefuck.rules.rm_root import match, get_new_command\nfrom tests.utils import Command\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_match():\n assert match(Command(script='rm -rf /',\n stderr='add --no-preserve-root'))", "metadata": "root.test_match", "header": "['module', '___EOS___']", "index": 5 }, { "content": "@pytest.mark.parametrize('command', [\n Command(script='ls', stderr='add --no-preserve-root'),\n Command(script='rm --no-preserve-root /', stderr='add --no-preserve-root'),\n Command(script='rm -rf /', stderr='')])\ndef test_not_match(command):\n assert not match(command)", "metadata": "root.test_not_match", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def test_get_new_command():\n assert get_new_command(Command(script='rm -rf /')) \\\n == 'rm -rf / --no-preserve-root'", "metadata": "root.test_get_new_command", "header": "['module', '___EOS___']", "index": 18 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thef", "uc", "k_", "._", "rules_", "._", "rm", "\\u", "root_", "import_", "match_", ",_", "get", "\\u", "new", "\\u", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tests_", "._", "utils_", "import_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "test\\u", "match_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "match_", "(_", "Command_", "(_", "script_", "=_", "'", "rm", " ", "-", "rf", " ", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "'", "add", " ", "--", "no", "-", "preserve", "-", "root", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "parametrize_", "(_", "'", "command", "'_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Command_", "(_", "script_", "=_", "'", "ls", "'_", ",_", "stderr_", "=_", "'", "add", " ", "--", "no", "-", "preserve", "-", "root", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Command_", "(_", "script_", "=_", "'", "rm", " ", "--", "no", "-", "preserve", "-", "root", " ", "/'_", ",_", "stderr_", "=_", "'", "add", " ", "--", "no", "-", "preserve", "-", "root", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Command_", "(_", "script_", "=_", "'", "rm", " ", "-", "rf", " ", "/'_", ",_", "stderr_", "=_", "''_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "not", "\\u", "match_", "(_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "match_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "new", "\\u", "command_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "get", "\\u", "new", "\\u", "command_", "(_", "Command_", "(_", "script_", "=_", "'", "rm", " ", "-", "rf", " ", "/'_", ")_", ")_", "==_", "'", "rm", " ", "-", "rf", " ", "/", " ", "--", "no", "-", "preserve", "-", "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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
arkadini/twimp/twimp/crypto/handshake.py
[ { "content": "# Copyright (c) 2010, 2011 Arek Korbik\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\nfrom hashlib import sha256\nimport hmac\nimport random\nimport struct\n\nfrom twimp.handshake import Handshaker\nfrom twimp.primitives import _s_ulong_b as _s_ulong\n\nfrom twimp.utils import ms_time\n\nLOG_CATEGORY = 'crypto.hs'\nimport twimp.log\nlog = twimp.log.get_logger(LOG_CATEGORY)\n\n\n\n\n# most constants defined in this module were caught floating around\n# the net...\n_shared_key_suffix = ('f0eec24a8068bee82e00d0d1029e7e57'\n '6eec5d2d29806fab93b8e636cfeb31ae').decode('hex')\n\n_fms_key = 'Genuine Adobe Flash Media Server 001'\n_full_fms_key = _fms_key + _shared_key_suffix\n\n_fp_key = 'Genuine Adobe Flash Player 001'\n_full_fp_key = _fp_key + _shared_key_suffix\n\n\n\n(OFFSET_SCHEME_1, OFFSET_SCHEME_2) = range(2)\n\nschemes = [\n (_make_offset_extractor(8, 4, 728, 12),),\n (_make_offset_extractor(772, 4, 728, 776),),\n ]\n\n# list of offset schemes, sorted by client's min version in descending order\nschemes_by_client_ver = [\n ((10,0,32,0), OFFSET_SCHEME_2, (10,0,32,2)),\n ((9,0,115,0), OFFSET_SCHEME_1, (9,0,115,0)),\n ]\n\n\n\nDEFAULT_SERVER_COMPAT_VERSION = (3, 0, 1, 1)\nDEFAULT_CLIENT_COMPAT_VERSION = schemes_by_client_ver[0][2] # the latest one\nNO_VERSION = (0, 0, 0, 0)\n\n\n_s_ts_ver = struct.Struct('>LBBBB')\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _hmac(key, msg, digestmod=sha256):\n return hmac.new(key, msg, digestmod).digest()", "metadata": "root._hmac", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def _make_offset_extractor(pos, count, mod, shift):\n return (lambda data: sum(map(ord, data[pos:pos+count])) % mod + shift)", "metadata": "root._make_offset_extractor", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def find_client_offset_scheme(version):\n for min_scheme_version, scheme, _cli_version in schemes_by_client_ver:\n if version >= min_scheme_version:\n return scheme\n return None", "metadata": "root.find_client_offset_scheme", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def generate_random_bytes(count):\n n = random.getrandbits(count * 8)\n fmt = '%%0%dx' % (count * 2)\n return (fmt % n).decode('hex')", "metadata": "root.generate_random_bytes", "header": "['module', '___EOS___']", "index": 76 }, { "content": "class CryptoHandshaker(Handshaker):\n server_compat_version = DEFAULT_SERVER_COMPAT_VERSION\n client_compat_version = DEFAULT_CLIENT_COMPAT_VERSION\n\n compat_version = None\n\n strict = True\n\n\n\n # the following four methods are verbose, *sigh*\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.CryptoHandshaker", "header": "['module', '___EOS___']", "index": 82 }, { "content": " def __init__(self, protocol, epoch_base, is_client=False):\n Handshaker.__init__(self, protocol, epoch_base, is_client=is_client)\n\n self._digest_offset_extractor = None\n if self.is_client:\n self.compat_version = self.client_compat_version\n\n # find a scheme matching our client version\n scheme = find_client_offset_scheme(self.compat_version)\n if scheme is not None:\n self._digest_offset_extractor = schemes[scheme][0]\n else:\n # otherwise we'll do non-crypto handshake\n self.compat_version = NO_VERSION\n else:\n self.compat_version = self.server_compat_version", "metadata": "root.CryptoHandshaker.__init__", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 90 }, { "content": " def select_own_key_short(self):\n if self.is_client:\n return _fp_key\n return _fms_key", "metadata": "root.CryptoHandshaker.select_own_key_short", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 109 }, { "content": " def select_own_key(self):\n if self.is_client:\n return _full_fp_key\n else:\n return _full_fms_key", "metadata": "root.CryptoHandshaker.select_own_key", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 114 }, { "content": " def select_other_key_short(self):\n if self.is_client:\n return _fms_key\n return _fp_key", "metadata": "root.CryptoHandshaker.select_other_key_short", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 120 }, { "content": " def select_other_key(self):\n if self.is_client:\n return _full_fms_key\n else:\n return _full_fp_key", "metadata": "root.CryptoHandshaker.select_other_key", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 125 }, { "content": " def _check_client_scheme(self, scheme, data):\n digest_offset_extractor, = schemes[scheme]\n\n # get digest offset\n offset = digest_offset_extractor(data)\n\n # calculate digest\n key = self.select_other_key_short() # assuming we're the server\n digest = _hmac(key, data[:offset] + data[offset+32:])\n\n return buffer(data, offset, 32) == buffer(digest)", "metadata": "root.CryptoHandshaker._check_client_scheme", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 132 }, { "content": " def discover_client_scheme(self, context):\n ts, v0, v1, v2, v3 = _s_ts_ver.unpack_from(context, 0)\n client_ver = (v0, v1, v2, v3)\n\n if client_ver == NO_VERSION:\n log.info(\"no client version - won't use crypto handshake\")\n return None\n\n log.debug('client version: %s', client_ver)\n\n # non-zero version - let's find out the scheme\n scheme = find_client_offset_scheme(client_ver)\n log.debug('scheme from ver: %s', scheme)\n if scheme is not None:\n if self._check_client_scheme(scheme, context):\n log.debug('verified client scheme: %s', scheme)\n self._digest_offset_extractor = schemes[scheme][0]\n return scheme\n\n log.debug('trying all known schemes...')\n # the exact version<->scheme match didn't help - try all the\n # other known schemes\n for i in xrange(len(schemes)):\n if i == scheme:\n # we've checked that one already\n continue\n\n if self._check_client_scheme(i, context):\n log.debug('verified client scheme: %s', i)\n self._digest_offset_extractor = schemes[i][0]\n return i\n\n log.info(\"couldn't figure the client scheme out\")\n if not self.strict:\n # Why so strict? Let's just use the lowest scheme we know\n log.debug('selecting scheme anyway: %s', OFFSET_SCHEME_1)\n return OFFSET_SCHEME_1\n\n return None", "metadata": "root.CryptoHandshaker.discover_client_scheme", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 145 }, { "content": " def generate_base_request(self):\n return (_s_ts_ver.pack(ms_time(self.epoch_time()),\n *self.compat_version) +\n generate_random_bytes(self.packet_bytes - 8))", "metadata": "root.CryptoHandshaker.generate_base_request", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 185 }, { "content": " def generate_request(self, context=None):\n base_request = self.generate_base_request()\n\n if self.is_client:\n if not self._digest_offset_extractor:\n return base_request\n else:\n scheme = self.discover_client_scheme(context)\n if scheme is None:\n return base_request\n\n # truncate, to leave space for digest\n request = buffer(base_request, 0, self.packet_bytes - 32)\n\n # get digest offset\n offset = self._digest_offset_extractor(request)\n\n # calculate digest\n key = self.select_own_key_short()\n digest = _hmac(key, request)\n\n # insert digest at the offset and return the whole packet\n return request[:offset] + digest + request[offset:]", "metadata": "root.CryptoHandshaker.generate_request", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 190 }, { "content": " def generate_simple_response(self, request):\n # echo the request, except for bytes 4-7, where we put our timestamp\n return (buffer(request, 0, 4) +\n (buffer(_s_ulong.pack(ms_time(self.epoch_time()))) +\n buffer(request, 8)))", "metadata": "root.CryptoHandshaker.generate_simple_response", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 214 }, { "content": " def generate_response(self, request):\n if not self._digest_offset_extractor:\n return self.generate_simple_response(request)\n\n # extract the digest embedded in request\n offset = self._digest_offset_extractor(request)\n req_digest = buffer(request, offset, 32)\n\n # calculate a digest of the request digest\n key = self.select_own_key()\n digest_key = _hmac(key, req_digest)\n\n # prepare response\n response = generate_random_bytes(self.packet_bytes - 32)\n\n # calculate response digest and append it to the response\n digest = _hmac(digest_key, response)\n return response + digest", "metadata": "root.CryptoHandshaker.generate_response", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 220 }, { "content": " def verify_simple_response(self, request, response):\n return (buffer(request, 0, 4) == buffer(response, 0, 4) and\n buffer(request, 8) == buffer(response, 8))", "metadata": "root.CryptoHandshaker.verify_simple_response", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 239 }, { "content": " def verify_response(self, request, response):\n if not self._digest_offset_extractor:\n return self.verify_simple_response(request, response)\n\n # extract the digest embedded in request\n offset = self._digest_offset_extractor(request)\n req_digest = buffer(request, offset, 32)\n\n # calculate what would have to be the digest of the request\n # digest calculated by the peer\n key = self.select_other_key()\n digest_key = _hmac(key, req_digest)\n\n # calculate our version of the response digest\n digest = _hmac(digest_key, buffer(response, 0, self.packet_bytes - 32))\n\n # print 'verify_response (%s)' % (('relaxed', 'strict')[self.strict])\n # print 'other:', response[-32:].encode('hex')\n # print ' mine:', digest.encode('hex')\n # print ' ==:', response[-32:] == digest\n\n if not self.strict:\n # in relaxed mode, just say it's all good\n return True\n\n # the response and our digests should match\n return buffer(response, len(response) - 32) == buffer(digest)", "metadata": "root.CryptoHandshaker.verify_response", "header": "['class', 'CryptoHandshaker', '(', 'Handshaker', ')', ':', '___EOS___']", "index": 243 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", ",", " ", "2011", " ", " ", "Are", "k", " ", "Kor", "bi", "k_", "\\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_", "from_", "hashlib_", "import_", "sha256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hmac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twi", "mp_", "._", "handshake", "_", "import_", "Handsha", "ker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twi", "mp_", "._", "primitives_", "import_", "\\u", "s", "\\u", "ulo", "ng", "\\u", "b_", "as_", "\\u", "s", "\\u", "ulong_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twi", "mp_", "._", "utils_", "import_", "ms", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG", "\\u", "CATEGORY", "_", "=_", "'", "crypto", ".", "hs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "twi", "mp_", "._", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "twi", "mp_", "._", "log_", "._", "get", "\\u", "logger_", "(_", "LOG", "\\u", "CATEGORY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "most", " ", "constant", "s", " ", "defin", "ed", " ", "in", " ", "this", " ", "module", " ", "wer", "e", " ", "cau", "ght", " ", "float", "ing", " ", "around_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "net", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "shared", "\\u", "key", "\\u", "suffix_", "=_", "(_", "'", "f0", "eec", "24", "a8", "068", "bee", "8", "2e", "00", "d0", "d1", "029", "e7", "e5", "7", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "6e", "ec", "5d", "2d", "298", "0", "6f", "ab", "9", "3b", "8e", "636", "cf", "eb", "3", "1a", "e", "'_", ")_", "._", "decode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "fm", "s", "\\u", "key_", "=_", "'", "Gen", "uin", "e", " ", "Ado", "be", " ", "Fla", "sh", " ", "Media", " ", "Server", " ", "001", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "full", "\\u", "fm", "s", "\\u", "key_", "=_", "\\u", "fm", "s", "\\u", "key_", "+_", "\\u", "shared", "\\u", "key", "\\u", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "fp", "\\u", "key_", "=_", "'", "Gen", "uin", "e", " ", "Ado", "be", " ", "Fla", "sh", " ", "Player", " ", "001", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "full", "\\u", "fp", "\\u", "key_", "=_", "\\u", "fp", "\\u", "key_", "+_", "\\u", "shared", "\\u", "key", "\\u", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "OFFSET", "\\u", "SCHEME", "\\u", "1_", ",_", "OFFSET", "\\u", "SCHEME", "\\u", "2_", ")_", "=_", "range_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "schemes", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "make", "\\u", "offset", "\\u", "extractor_", "(_", "8_", ",_", "4_", ",_", "728", "_", ",_", "12_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "make", "\\u", "offset", "\\u", "extractor_", "(_", "772", "_", ",_", "4_", ",_", "728", "_", ",_", "776", "_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "offset", " ", "schemes", ",", " ", "sorte", "d", " ", "by", " ", "client", "'", "s", " ", "min", " ", "version", " ", "in", " ", "descend", "ing", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "schemes", "\\u", "by", "\\u", "client", "\\u", "ver_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "10_", ",_", "0_", ",_", "32_", ",_", "0_", ")_", ",_", "OFFSET", "\\u", "SCHEME", "\\u", "2_", ",_", "(_", "10_", ",_", "0_", ",_", "32_", ",_", "2_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "9_", ",_", "0_", ",_", "115_", ",_", "0_", ")_", ",_", "OFFSET", "\\u", "SCHEME", "\\u", "1_", ",_", "(_", "9_", ",_", "0_", ",_", "115_", ",_", "0_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\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_", "DEF", "AUL", "T", "\\u", "SERVER", "\\u", "COMPA", "T", "\\u", "VERSION_", "=_", "(_", "3_", ",_", "0_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CLIENT", "\\u", "COMPA", "T", "\\u", "VERSION_", "=_", "schemes", "\\u", "by", "\\u", "client", "\\u", "ver_", "[_", "0_", "]_", "[_", "2_", "]_", "#", " ", "the", " ", "late", "st", " ", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NO", "\\u", "VERSION_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "s", "\\u", "ts", "\\u", "ver_", "=_", "struct_", "._", "Struct_", "(_", "'>", "LB", "BBB", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "hmac_", "(_", "key_", ",_", "msg_", ",_", "digest", "mod_", "=_", "sha256_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hmac_", "._", "new_", "(_", "key_", ",_", "msg_", ",_", "digest", "mod_", ")_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "make", "\\u", "offset", "\\u", "extractor_", "(_", "pos_", ",_", "count_", ",_", "mod_", ",_", "shift_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "lambda_", "data_", ":_", "sum_", "(_", "map_", "(_", "ord_", ",_", "data_", "[_", "pos_", ":_", "pos_", "+_", "count_", "]_", ")_", ")_", "%_", "mod_", "+_", "shift_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find", "\\u", "client", "\\u", "offset", "\\u", "scheme_", "(_", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "min", "\\u", "sche", "me", "\\u", "version_", ",_", "scheme_", ",_", "\\u", "cli", "\\u", "version_", "in_", "schemes", "\\u", "by", "\\u", "client", "\\u", "ver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "version_", ">=_", "min", "\\u", "sche", "me", "\\u", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "scheme_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generat", "e\\u", "random", "\\u", "bytes_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "random_", "._", "getra", "ndb", "its_", "(_", "count_", "*_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "'%%", "0", "%", "dx", "'_", "%_", "(_", "count_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "fmt_", "%_", "n_", ")_", "._", "decode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\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_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "\\u", "compa", "t", "\\u", "version_", "=_", "DEF", "AUL", "T", "\\u", "SERVER", "\\u", "COMPA", "T", "\\u", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "compa", "t", "\\u", "version_", "=_", "DEF", "AUL", "T", "\\u", "CLIENT", "\\u", "COMPA", "T", "\\u", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strict_", "=_", "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\\uNL\\u\\u\\u_", "#", " ", "the", " ", "follow", "ing", " ", "four", " ", "method", "s", " ", "are", " ", "verbo", "se", ",", " ", "*", "sig", "h", "*_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "protocol_", ",_", "epoch", "\\u", "base_", ",_", "is", "\\u", "client_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Handsha", "ker_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "protocol_", ",_", "epoch", "\\u", "base_", ",_", "is", "\\u", "client_", "=_", "is", "\\u", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "compa", "t", "\\u", "version_", "=_", "self_", "._", "client", "\\u", "compa", "t", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "a", " ", "sche", "me", " ", "matchi", "ng", " ", "our", " ", "client", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "find", "\\u", "client", "\\u", "offset", "\\u", "scheme_", "(_", "self_", "._", "compa", "t", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scheme_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", "=_", "schemes", "_", "[_", "scheme_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "wis", "e", " ", "we", "'", "ll", " ", "do", " ", "non", "-", "crypto", " ", "handshake", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "compa", "t", "\\u", "version_", "=_", "NO", "\\u", "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 ", " _", "self_", "._", "compa", "t", "\\u", "version_", "=_", "self_", "._", "server", "\\u", "compa", "t", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select", "\\u", "own", "\\u", "key", "\\u", "short_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "fp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "fm", "s", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select", "\\u", "own", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "full", "\\u", "fp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "full", "\\u", "fm", "s", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select", "\\u", "other", "\\u", "key", "\\u", "short_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "fm", "s", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "fp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select", "\\u", "other", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "full", "\\u", "fm", "s", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "full", "\\u", "fp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "client", "\\u", "scheme_", "(_", "self_", ",_", "scheme_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digest", "\\u", "offset", "\\u", "extractor_", ",_", "=_", "schemes", "_", "[_", "scheme_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "digest", " ", "offset_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "digest", "\\u", "offset", "\\u", "extractor_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "digest_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "self_", "._", "select", "\\u", "other", "\\u", "key", "\\u", "short_", "(_", ")_", "#", " ", "ass", "umi", "ng", " ", "we", "'", "re", " ", "the", " ", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digest_", "=_", "\\u", "hmac_", "(_", "key_", ",_", "data_", "[_", ":_", "offset_", "]_", "+_", "data_", "[_", "offset_", "+_", "32_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "buffer_", "(_", "data_", ",_", "offset_", ",_", "32_", ")_", "==_", "buffer_", "(_", "digest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "discove", "r", "\\u", "client", "\\u", "scheme_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts_", ",_", "v0_", ",_", "v1_", ",_", "v2_", ",_", "v3_", "=_", "\\u", "s", "\\u", "ts", "\\u", "ver_", "._", "unpack", "\\u", "from_", "(_", "context_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "ver_", "=_", "(_", "v0_", ",_", "v1_", ",_", "v2_", ",_", "v3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "client", "\\u", "ver_", "==_", "NO", "\\u", "VERSION_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "no", " ", "client", " ", "version", " ", "-", " ", "won", "'", "t", " ", "use", " ", "crypto", " ", "handshake", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "client", " ", "version", ":", " ", "%", "s", "'_", ",_", "client", "\\u", "ver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "zero", " ", "version", " ", "-", " ", "let", "'", "s", " ", "find", " ", "out", " ", "the", " ", "scheme_", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "find", "\\u", "client", "\\u", "offset", "\\u", "scheme_", "(_", "client", "\\u", "ver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "sche", "me", " ", "from", " ", "ver", ":", " ", "%", "s", "'_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scheme_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "check", "\\u", "client", "\\u", "scheme_", "(_", "scheme_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "verifie", "d", " ", "client", " ", "sche", "me", ":", " ", "%", "s", "'_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", "=_", "schemes", "_", "[_", "scheme_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "scheme_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "try", "ing", " ", "all", " ", "know", "n", " ", "schemes", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "exact", " ", "version", "<-", ">", "sche", "me", " ", "match", " ", "did", "n", "'", "t", " ", "help", " ", "-", " ", "try", " ", "all", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "know", "n", " ", "schemes", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "schemes", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "scheme_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "ve", " ", "checke", "d", " ", "tha", "t", " ", "one", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "check", "\\u", "client", "\\u", "scheme_", "(_", "i_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "verifie", "d", " ", "client", " ", "sche", "me", ":", " ", "%", "s", "'_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", "=_", "schemes", "_", "[_", "i_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "coul", "dn", "'", "t", " ", "figure", " ", "the", " ", "client", " ", "sche", "me", " ", "out", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "strict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wh", "y", " ", "so", " ", "strict", "?", " ", "Let", "'", "s", " ", "just", " ", "use", " ", "the", " ", "lowe", "st", " ", "sche", "me", " ", "we", " ", "know", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "selecti", "ng", " ", "sche", "me", " ", "anyway", ":", " ", "%", "s", "'_", ",_", "OFFSET", "\\u", "SCHEME", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "OFFSET", "\\u", "SCHEME", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "base", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\\u", "s", "\\u", "ts", "\\u", "ver_", "._", "pack_", "(_", "ms", "\\u", "time_", "(_", "self_", "._", "epoch", "\\u", "time_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "self_", "._", "compa", "t", "\\u", "version_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "generat", "e\\u", "random", "\\u", "bytes_", "(_", "self_", "._", "packet", "\\u", "bytes_", "-_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "request_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "request_", "=_", "self_", "._", "generat", "e\\u", "base", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base", "\\u", "request_", "\\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 ", " _", "scheme_", "=_", "self_", "._", "discove", "r", "\\u", "client", "\\u", "scheme_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scheme_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "truncat", "e", ",", " ", "to", " ", "lea", "ve", " ", "space", " ", "for", " ", "digest_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "buffer_", "(_", "base", "\\u", "request_", ",_", "0_", ",_", "self_", "._", "packet", "\\u", "bytes_", "-_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "digest", " ", "offset_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "digest_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "self_", "._", "select", "\\u", "own", "\\u", "key", "\\u", "short_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digest_", "=_", "\\u", "hmac_", "(_", "key_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insert", " ", "digest", " ", "at", " ", "the", " ", "offset", " ", "and", " ", "return", " ", "the", " ", "whole", " ", "packet_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "request_", "[_", ":_", "offset_", "]_", "+_", "digest_", "+_", "request_", "[_", "offset_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "simple", "\\u", "response_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "echo", " ", "the", " ", "request", ",", " ", "except", " ", "for", " ", "bytes", " ", "4", "-", "7", ",", " ", "where", " ", "we", " ", "put", " ", "our", " ", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "buffer_", "(_", "request_", ",_", "0_", ",_", "4_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "buffer_", "(_", "\\u", "s", "\\u", "ulong_", "._", "pack_", "(_", "ms", "\\u", "time_", "(_", "self_", "._", "epoch", "\\u", "time_", "(_", ")_", ")_", ")_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", "(_", "request_", ",_", "8_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "response_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "generat", "e\\u", "simple", "\\u", "response_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "the", " ", "digest", " ", "embedde", "d", " ", "in", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "=_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "digest_", "=_", "buffer_", "(_", "request_", ",_", "offset_", ",_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "a", " ", "digest", " ", "of", " ", "the", " ", "request", " ", "digest_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "self_", "._", "select", "\\u", "own", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digest", "\\u", "key_", "=_", "\\u", "hmac_", "(_", "key_", ",_", "req", "\\u", "digest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prepar", "e", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "generat", "e\\u", "random", "\\u", "bytes_", "(_", "self_", "._", "packet", "\\u", "bytes_", "-_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "response", " ", "digest", " ", "and", " ", "append", " ", "it", " ", "to", " ", "the", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "digest_", "=_", "\\u", "hmac_", "(_", "digest", "\\u", "key_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "+_", "digest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify", "\\u", "simple", "\\u", "response_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "buffer_", "(_", "request_", ",_", "0_", ",_", "4_", ")_", "==_", "buffer_", "(_", "response_", ",_", "0_", ",_", "4_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", "(_", "request_", ",_", "8_", ")_", "==_", "buffer_", "(_", "response_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crypto", "Handsha", "ker_", "(_", "Handsha", "ker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify", "\\u", "response_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "verify", "\\u", "simple", "\\u", "response_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "the", " ", "digest", " ", "embedde", "d", " ", "in", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "=_", "self_", "._", "\\u", "digest", "\\u", "offset", "\\u", "extractor_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "digest_", "=_", "buffer_", "(_", "request_", ",_", "offset_", ",_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "what", " ", "wou", "ld", " ", "have", " ", "to", " ", "be", " ", "the", " ", "digest", " ", "of", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "digest", " ", "calculated", " ", "by", " ", "the", " ", "peer_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "self_", "._", "select", "\\u", "other", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digest", "\\u", "key_", "=_", "\\u", "hmac_", "(_", "key_", ",_", "req", "\\u", "digest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "our", " ", "version", " ", "of", " ", "the", " ", "response", " ", "digest_", "\\u\\u\\uNL\\u\\u\\u_", "digest_", "=_", "\\u", "hmac_", "(_", "digest", "\\u", "key_", ",_", "buffer_", "(_", "response_", ",_", "0_", ",_", "self_", "._", "packet", "\\u", "bytes_", "-_", "32_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "verify", "\\u", "response", " ", "(%", "s", ")'", " ", "%", " ", "((", "'", "relaxed", "',", " ", "'", "strict", "')", "[", "self", ".", "strict", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "other", ":'", ",", " ", "response", "[-", "32", ":]", ".", "encode", "('", "hex", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", " ", "mine", ":'", ",", " ", "digest", ".", "encode", "('", "hex", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", " ", " ", " ", "==", ":'", ",", " ", "response", "[-", "32", ":]", " ", "==", " ", "digest_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "strict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "relaxed", " ", "mode", ",", " ", "just", " ", "say", " ", "it", "'", "s", " ", "all", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "response", " ", "and", " ", "our", " ", "digest", "s", " ", "shou", "ld", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "buffer_", "(_", "response_", ",_", "len_", "(_", "response_", ")_", "-_", "32_", ")_", "==_", "buffer_", "(_", "digest_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
douban/dpark/dpark/hyperloglog.py
[ { "content": "import math\nfrom bisect import bisect_right\nimport array\n\ntry:\n import pyhash\n hash_func = pyhash.murmur2_x64_64a()\n HASH_LEN = 64\n raise ImportError\nexcept ImportError:\n HASH_LEN = 30\n\nSPARSE = 0\nNORMAL = 1\n\n\n\nif __name__ == '__main__':\n for e in (0.005, 0.01, 0.03, 0.05, 0.1):\n test(xrange(100), e)\n test(xrange(10000), e)\n test(xrange(100000), e)\n# test(xrange(1000000), e)\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_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bisect_", "import_", "bisect", "\\u", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pyh", "ash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "\\u", "func_", "=_", "pyh", "ash_", "._", "mur", "mur", "2", "\\u", "x6", "4", "\\u", "64", "a_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "H", "\\u", "LEN_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Import", "Error_", "\\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 ", " _", "HAS", "H", "\\u", "LEN_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SPAR", "SE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NORMAL_", "=_", "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\\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 ", " _", "for_", "e_", "in_", "(_", "0.005_", ",_", "0.01_", ",_", "0.03_", ",_", "0.05_", ",_", "0.1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "(_", "xrange_", "(_", "100_", ")_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "(_", "xrange_", "(_", "10000_", ")_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "(_", "xrange_", "(_", "100000_", ")_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "test", "(", "xran", "ge", "(", "1000000", "),", " ", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Signature mismatch in overriding method
pytent/pytentd/tentd/documents/profiles.py
[ { "content": "class Profile(EntityMixin, db.Document):\n \"\"\"A profile information type belonging to an entity\n\n The Profile class is an abstract type, defining the relationship between\n an entity and it's profiles, and holding the schema url for the type.\n\n An entity cannot have multiple profiles with the same schema.\n \"\"\"\n meta = {\n 'collection': 'profile',\n 'allow_inheritance': True,\n 'indexes': ['schema'],\n }\n\n #: The info type schema\n schema = URIField(unique_with='entity', required=True)\n permissions = DictField()\n\n\n\n", "metadata": "root.Profile", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __new__(cls, *args, **kwargs):\n \"\"\"If ``schema`` is included in the argument list, return a profile\n object using the correct class.\"\"\"\n if 'schema' in kwargs:\n cls = GenericProfile\n if CoreProfile.__schema__ == kwargs['schema']:\n cls = CoreProfile\n return super(Profile, cls).__new__(cls)", "metadata": "root.Profile.__new__", "header": "['class', 'Profile', '(', 'EntityMixin', ',', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 31 }, { "content": " def __init__(self, **kwargs):\n if self.__class__ is Profile:\n raise NotImplementedError(\"This class is abstract.\")\n\n super(Profile, self).__init__(**kwargs)\n\n # Use the classes default schema if it is availible and no schema has\n # been given. TODO: test this\n if not self.schema and hasattr(self.__class__, '__schema__'):\n self.schema = self.__class__.__schema__", "metadata": "root.Profile.__init__", "header": "['class', 'Profile', '(', 'EntityMixin', ',', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 40 }, { "content": " def __repr__(self):\n return \"<{}: {}>\".format(self.__class__.__name__, self.schema)", "metadata": "root.Profile.__repr__", "header": "['class', 'Profile', '(', 'EntityMixin', ',', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 51 }, { "content": " def update_values(self, values):\n raise NotImplementedError(\"This class is abstract.\")", "metadata": "root.Profile.update_values", "header": "['class', 'Profile', '(', 'EntityMixin', ',', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 54 }, { "content": "class CoreProfile(Profile):\n \"\"\"This model provides the Core profile info type.\n\n Documentation on this profile type can be found here:\n https://tent.io/docs/info-types#core\n\n TODO: Add licence and server relationships\n \"\"\"\n\n meta = {\n 'indexes': [{\n 'fields': ['identity'],\n 'sparse': True,\n }],\n }\n\n __schema__ = 'https://tent.io/types/info/core/v0.1.0'\n\n #: The canonical entity identity\n identity = URIField(unique_with='entity', required=True)\n\n servers = ListField(URIField())\n\n\n", "metadata": "root.CoreProfile", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def __init__(self, *args, **kwargs):\n \"\"\"Sets public permissions and a default identity\"\"\"\n super(CoreProfile, self).__init__(*args, **kwargs)\n self.permissions['public'] = True\n if not self.identity and self.entity is not None:\n self.identity = url_for(\n 'entity.profiles', entity=self.entity, _external=True)", "metadata": "root.CoreProfile.__init__", "header": "['class', 'CoreProfile', '(', 'Profile', ')', ':', '___EOS___']", "index": 81 }, { "content": " def to_json(self):\n return {\n 'entity': self.identity,\n 'licences': [],\n 'servers': self.servers,\n 'tent_version': tent_version\n }", "metadata": "root.CoreProfile.to_json", "header": "['class', 'CoreProfile', '(', 'Profile', ')', ':', '___EOS___']", "index": 89 }, { "content": " def update_values(self, values):\n if 'identity' in values:\n self.identity = values['identity']\n if 'servers' in values:\n self.servers = values['servers']", "metadata": "root.CoreProfile.update_values", "header": "['class', 'CoreProfile', '(', 'Profile', ')', ':', '___EOS___']", "index": 97 } ]
[]
[]
0
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Profile_", "(_", "Entit", "y", "Mixin_", ",_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "profile", " ", "informati", "on", " ", "type", " ", "belonging", " ", "to", " ", "an", " ", "entity", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Profil", "e", " ", "class", " ", "is", " ", "an", " ", "abstract", " ", "type", ",", " ", "defini", "ng", " ", "the", " ", "relation", "ship", " ", "bet", "ween", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "entity", " ", "and", " ", "it", "'", "s", " ", "profile", "s", ",", " ", "and", " ", "holding", " ", "the", " ", "schema", " ", "url", " ", "for", " ", "the", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "entity", " ", "cann", "ot", " ", "have", " ", "multiple", " ", "profile", "s", " ", "with", " ", "the", " ", "same", " ", "schema", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "'", "profile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "\\u", "inherita", "nce", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "indexe", "s", "'_", ":_", "[_", "'", "schema", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "The", " ", "info", " ", "type", " ", "schema_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "=_", "URI", "Field_", "(_", "unique", "\\u", "with_", "=_", "'", "entity", "'_", ",_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissions_", "=_", "Dict", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Profile_", "(_", "Entit", "y", "Mixin_", ",_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "``", "schema", "``", " ", "is", " ", "include", "d", " ", "in", " ", "the", " ", "argu", "ment", " ", "list", ",", " ", "return", " ", "a", " ", "profile", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "usi", "ng", " ", "the", " ", "correct", " ", "class", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "schema", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "Gene", "ric", "Profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Core", "Profile_", "._", "\\u\\u", "schema", "\\u\\u_", "==_", "kwargs_", "[_", "'", "schema", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "Core", "Profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Profile_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Profile_", "(_", "Entit", "y", "Mixin_", ",_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "class\\u\\u_", "is_", "Profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Thi", "s", " ", "class", " ", "is", " ", "abstract", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Profile_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "classe", "s", " ", "default", " ", "schema", " ", "if", " ", "it", " ", "is", " ", "avail", "ibl", "e", " ", "and", " ", "no", " ", "schema", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "give", "n", ".", " ", "TOD", "O", ":", " ", "test", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "schema_", "and_", "hasattr_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "'\\u", "\\u", "schema", "\\u\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "schema_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "schema", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Profile_", "(_", "Entit", "y", "Mixin_", ",_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"<", "{}:", " ", "{}>", "\"_", "._", "format_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "self_", "._", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Profile_", "(_", "Entit", "y", "Mixin_", ",_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "values_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Thi", "s", " ", "class", " ", "is", " ", "abstract", ".\"_", ")_", "\\u\\u\\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_", "Core", "Profile_", "(_", "Profile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "model", " ", "provide", "s", " ", "the", " ", "Core", " ", "profile", " ", "info", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Document", "ation", " ", "on", " ", "this", " ", "profile", " ", "type", " ", "can", " ", "be", " ", "found", " ", "here", ":", "\\", "10", ";", " ", " ", " ", " ", "https", "://", "tent", ".", "io", "/", "docs", "/", "info", "-", "types", "#", "core", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", ":", " ", "Add", " ", "licence", " ", "and", " ", "server", " ", "relation", "ships", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "meta_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "indexe", "s", "'_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "[_", "'", "identi", "ty", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "spars", "e", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "schema", "\\u\\u_", "=_", "'", "https", "://", "tent", ".", "io", "/", "types", "/", "info", "/", "core", "/", "v", "0.", "1.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "The", " ", "canonical", " ", "entity", " ", "identity_", "\\u\\u\\uNL\\u\\u\\u_", "identity_", "=_", "URI", "Field_", "(_", "unique", "\\u", "with_", "=_", "'", "entity", "'_", ",_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "servers_", "=_", "List", "Field_", "(_", "URI", "Field_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Core", "Profile_", "(_", "Profile_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "public", " ", "permissi", "ons", " ", "and", " ", "a", " ", "default", " ", "identi", "ty", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Core", "Profile_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "permissions_", "[_", "'", "public", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "identity_", "and_", "self_", "._", "entity_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "identity_", "=_", "url", "\\u", "for_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", ".", "profile", "s", "'_", ",_", "entity_", "=_", "self_", "._", "entity_", ",_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "Profile_", "(_", "Profile_", ")_", ":_", "\\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_", "to", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "'_", ":_", "self_", "._", "identity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "licence", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "s", "'_", ":_", "self_", "._", "servers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tent", "\\u", "version", "'_", ":_", "tent", "\\u", "version_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "Profile_", "(_", "Profile_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "values_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "identi", "ty", "'_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "identity_", "=_", "values_", "[_", "'", "identi", "ty", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "server", "s", "'_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "servers_", "=_", "values_", "[_", "'", "server", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
saltstack/salt/salt/runners/virt.py
[ { "content": "def _find_vm(name, data, quiet=False):\n '''\n Scan the query data for the named VM\n '''\n for hv_ in data:\n # Check if data is a dict, and not '\"virt.full_info\" is not available.'\n if not isinstance(data[hv_], dict):\n continue\n if name in data[hv_].get('vm_info', {}):\n ret = {hv_: {name: data[hv_]['vm_info'][name]}}\n if not quiet:\n __jid_event__.fire_event({'data': ret, 'outputter': 'nested'}, 'progress')\n return ret\n return {}", "metadata": "root._find_vm", "header": "['module', '___EOS___']", "index": 42 } ]
[]
[]
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_", "\\u", "find", "\\u", "vm_", "(_", "name_", ",_", "data_", ",_", "quiet_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Sca", "n", " ", "the", " ", "query", " ", "data", " ", "for", " ", "the", " ", "named", " ", "VM", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hv", "\\u_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "data", " ", "is", " ", "a", " ", "dict", ",", " ", "and", " ", "not", " ", "'\"", "virt", ".", "full", "\\u", "info", "\"", " ", "is", " ", "not", " ", "avail", "able", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "data_", "[_", "hv", "\\u_", "]_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "in_", "data_", "[_", "hv", "\\u_", "]_", "._", "get_", "(_", "'", "vm", "\\u", "info", "'_", ",_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "{_", "hv", "\\u_", ":_", "{_", "name_", ":_", "data_", "[_", "hv", "\\u_", "]_", "[_", "'", "vm", "\\u", "info", "'_", "]_", "[_", "name_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "quiet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "ji", "d\\u", "event", "\\u\\u_", "._", "fire", "\\u", "event_", "(_", "{_", "'", "data", "'_", ":_", "ret_", ",_", "'", "output", "ter", "'_", ":_", "'", "nest", "ed", "'_", "}_", ",_", "'", "progress", "'_", ")_", "\\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_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
simock85/sharknado/tests/test_sharknado.py
[ { "content": "from collections import namedtuple\nimport json\nimport sharknado\nimport unittest\nfrom bson import ObjectId\nfrom datetime import datetime, timedelta\nfrom tornado import escape, gen\nfrom tornado.escape import to_unicode\nfrom tornado.ioloop import IOLoop\nfrom tornado.testing import AsyncHTTPTestCase\nfrom six.moves.urllib.parse import urlencode\nfrom six import iteritems\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_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shar", "kn", "ado_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "import_", "Object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "escape_", ",_", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "._", "escape_", "import_", "to", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "._", "ioloop_", "import_", "IO", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "._", "testing_", "import_", "Async", "HTTP", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "._", "urllib_", "._", "parse_", "import_", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "import_", "iteritems_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
ionelmc/django-prefetch/src/prefetch.py
[ { "content": "from logging import getLogger\nimport time\nimport collections\n\nimport django\nfrom django.db import models\nfrom django.db.models import query\ntry:\n from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor as ForwardManyToOneDescriptor\nexcept ImportError:\n from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor\n\n__version__ = '1.1.0'\n\nlogger = getLogger(__name__)\n\n\n\n\n\n\n\n\n\nP = PrefetchOption\n\n\n\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_", "from_", "logging_", "import_", "get", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "._", "models_", "._", "fields_", "._", "related_", "import_", "Revers", "e", "Sing", "le", "Rela", "ted", "Object", "Descriptor_", "as_", "Forward", "Many", "To", "One", "Descriptor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "._", "models_", "._", "fields_", "._", "relate", "d\\u", "descriptors_", "import_", "Forward", "Many", "To", "One", "Descriptor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "1.1", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "P_", "=_", "Prefe", "tch", "Option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
HydraChain/hydrachain/hydrachain/consensus/manager.py
[ { "content": "# Copyright (c) 2015 Heiko Hees\nimport sys\nimport rlp\nfrom .base import LockSet, Vote, VoteBlock, VoteNil, Signed, Ready\nfrom .base import BlockProposal, VotingInstruction, DoubleVotingError, InvalidVoteError\nfrom .base import Block, Proposal, HDCBlockHeader, InvalidProposalError\nfrom .protocol import HDCProtocol\nfrom .utils import cstr, phx\nfrom .synchronizer import Synchronizer\nfrom ethereum.slogging import get_logger\nlog = get_logger('hdc.consensus')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ManagerDict(object):\n\n\n\n", "metadata": "root.ManagerDict", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __init__(self, dklass, parent):\n self.d = dict()\n self.dklass = dklass\n self.parent = parent", "metadata": "root.ManagerDict.__init__", "header": "['class', 'ManagerDict', '(', 'object', ')', ':', '___EOS___']", "index": 15 }, { "content": " def __getitem__(self, k):\n if k not in self.d:\n self.d[k] = self.dklass(self.parent, k)\n return self.d[k]", "metadata": "root.ManagerDict.__getitem__", "header": "['class', 'ManagerDict', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def __iter__(self):\n return iter(sorted(self.d, reverse=True))", "metadata": "root.ManagerDict.__iter__", "header": "['class', 'ManagerDict', '(', 'object', ')', ':', '___EOS___']", "index": 25 }, { "content": " def pop(self, k):\n self.d.pop(k)", "metadata": "root.ManagerDict.pop", "header": "['class', 'ManagerDict', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": "class MissingParent(Exception):\n pass", "metadata": "root.MissingParent", "header": "['module', '___EOS___']", "index": 32 }, { "content": "class ProtocolFailureEvidence(object):\n protocol = None\n evidence = None\n", "metadata": "root.ProtocolFailureEvidence", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def __repr__(self):\n return '<%s protocol=%r evidence=%r>' % (self.__class__.__name__,\n self.protocol, self.evidence)", "metadata": "root.ProtocolFailureEvidence.__repr__", "header": "['class', 'ProtocolFailureEvidence', '(', 'object', ')', ':', '___EOS___']", "index": 40 }, { "content": "class InvalidProposalEvidence(ProtocolFailureEvidence):\n", "metadata": "root.InvalidProposalEvidence", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def __init__(self, protocol, proposal):\n self.protocol = protocol\n self.evidence = proposal", "metadata": "root.InvalidProposalEvidence.__init__", "header": "['class', 'InvalidProposalEvidence', '(', 'ProtocolFailureEvidence', ')', ':', '___EOS___']", "index": 47 }, { "content": "class DoubleVotingEvidence(ProtocolFailureEvidence):\n", "metadata": "root.DoubleVotingEvidence", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def __init__(self, protocol, vote, othervote):\n self.protocol = protocol\n self.evidence = (vote, othervote)", "metadata": "root.DoubleVotingEvidence.__init__", "header": "['class', 'DoubleVotingEvidence', '(', 'ProtocolFailureEvidence', ')', ':', '___EOS___']", "index": 54 }, { "content": "class InvalidVoteEvidence(ProtocolFailureEvidence):\n", "metadata": "root.InvalidVoteEvidence", "header": "['module', '___EOS___']", "index": 59 }, { "content": " def __init__(self, protocol, vote):\n self.protocol = protocol\n self.evidence = vote", "metadata": "root.InvalidVoteEvidence.__init__", "header": "['class', 'InvalidVoteEvidence', '(', 'ProtocolFailureEvidence', ')', ':', '___EOS___']", "index": 61 }, { "content": "class FailedToProposeEvidence(ProtocolFailureEvidence):\n", "metadata": "root.FailedToProposeEvidence", "header": "['module', '___EOS___']", "index": 66 }, { "content": " def __init__(self, protocol, round_lockset):\n self.protocol = protocol\n self.evidence = round_lockset", "metadata": "root.FailedToProposeEvidence.__init__", "header": "['class', 'FailedToProposeEvidence', '(', 'ProtocolFailureEvidence', ')', ':', '___EOS___']", "index": 68 }, { "content": "class ForkDetectedEvidence(ProtocolFailureEvidence):\n", "metadata": "root.ForkDetectedEvidence", "header": "['module', '___EOS___']", "index": 73 }, { "content": " def __init__(self, protocol, prevblock, block, committing_lockset):\n self.protocol = protocol\n self.evidence = (prevblock, block, committing_lockset)", "metadata": "root.ForkDetectedEvidence.__init__", "header": "['class', 'ForkDetectedEvidence', '(', 'ProtocolFailureEvidence', ')', ':', '___EOS___']", "index": 75 }, { "content": "class ConsensusManager(object):\n\n allow_empty_blocks = False\n num_initial_blocks = 10\n round_timeout = 3 # timeout when waiting for proposal\n round_timeout_factor = 1.5 # timeout increase per round\n transaction_timeout = 0.5 # delay when waiting for new transaction\n\n\n\n # persist proposals and last committing lockset\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # message handling\n\n\n # validator ready handling\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n start = process\n\n\n\n", "metadata": "root.ConsensusManager", "header": "['module', '___EOS___']", "index": 80 }, { "content": " def __init__(self, chainservice, consensus_contract, privkey):\n self.chainservice = chainservice\n self.chain = chainservice.chain\n self.contract = consensus_contract\n self.privkey = privkey\n\n self.synchronizer = Synchronizer(self)\n self.heights = ManagerDict(HeightManager, self)\n self.block_candidates = dict() # blockhash : BlockProposal\n\n self.tracked_protocol_failures = list()\n\n # wait for enough validators in order to start\n self.ready_validators = set() # addresses\n self.ready_nonce = 0\n\n assert self.contract.isvalidator(self.coinbase)\n self.initialize_locksets()\n\n self.ready_validators = set([self.coinbase]) # old votes dont count", "metadata": "root.ConsensusManager.__init__", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": " def initialize_locksets(self):\n log.debug('initializing locksets')\n # sign genesis\n v = self.sign(VoteBlock(0, 0, self.chainservice.chain.genesis.hash))\n self.add_vote(v)\n\n # add initial lockset\n head_proposal = self.load_proposal(self.head.hash)\n # assert head_proposal\n if head_proposal:\n assert head_proposal.blockhash == self.head.hash\n for v in head_proposal.signing_lockset:\n self.add_vote(v) # head - 1 , height -2\n assert self.heights[self.head.header.number - 1].has_quorum\n last_committing_lockset = self.load_last_committing_lockset()\n if last_committing_lockset:\n assert last_committing_lockset.has_quorum == self.head.hash\n for v in last_committing_lockset.votes:\n self.add_vote(v) # head , height - 1\n assert self.heights[self.head.header.number].has_quorum\n else:\n assert self.head.header.number == 0\n assert self.highest_committing_lockset\n assert self.last_committing_lockset\n assert self.last_valid_lockset", "metadata": "root.ConsensusManager.initialize_locksets", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 109 }, { "content": " def store_last_committing_lockset(self, ls):\n assert isinstance(ls, LockSet)\n assert ls.has_quorum\n self.chainservice.db.put('last_committing_lockset', rlp.encode(ls))", "metadata": "root.ConsensusManager.store_last_committing_lockset", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 137 }, { "content": " def load_last_committing_lockset(self):\n try:\n data = self.chainservice.db.get('last_committing_lockset')\n except KeyError:\n self.log('no last_committing_lockset could be loaded')\n return\n return rlp.decode(data, sedes=LockSet)", "metadata": "root.ConsensusManager.load_last_committing_lockset", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def store_proposal(self, p):\n assert isinstance(p, BlockProposal)\n self.chainservice.db.put('blockproposal:%s' % p.blockhash, rlp.encode(p))", "metadata": "root.ConsensusManager.store_proposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 150 }, { "content": " def load_proposal_rlp(self, blockhash):\n try:\n prlp = self.chainservice.db.get('blockproposal:%s' % blockhash)\n assert isinstance(prlp, bytes)\n return prlp\n except KeyError:\n return None", "metadata": "root.ConsensusManager.load_proposal_rlp", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 154 }, { "content": " def load_proposal(self, blockhash):\n prlp = self.load_proposal_rlp(blockhash)\n if prlp:\n return rlp.decode(prlp, sedes=BlockProposal)", "metadata": "root.ConsensusManager.load_proposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def get_blockproposal(self, blockhash):\n return self.block_candidates.get(blockhash) or self.load_proposal(blockhash)", "metadata": "root.ConsensusManager.get_blockproposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 167 }, { "content": " def has_blockproposal(self, blockhash):\n return bool(self.load_proposal_rlp(blockhash))", "metadata": "root.ConsensusManager.has_blockproposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 170 }, { "content": " def get_blockproposal_rlp_by_height(self, height):\n assert 0 < height < self.height\n bh = self.chainservice.chain.index.get_block_by_number(height)\n return self.load_proposal_rlp(bh)", "metadata": "root.ConsensusManager.get_blockproposal_rlp_by_height", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 173 }, { "content": " @property\n def coinbase(self):\n return self.chain.coinbase", "metadata": "root.ConsensusManager.coinbase", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 178 }, { "content": " def set_proposal_lock(self, block):\n self.chainservice.set_proposal_lock(block)", "metadata": "root.ConsensusManager.set_proposal_lock", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 182 }, { "content": " def __repr__(self):\n return '<CP A:%r H:%d R:%d L:%r %s>' % (phx(self.coinbase), self.height, self.round,\n self.active_round.lock,\n self.active_round.lockset.state)", "metadata": "root.ConsensusManager.__repr__", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 185 }, { "content": " def log(self, tag, **kargs):\n # if self.coinbase != 0: return\n t = int(self.chainservice.now)\n c = lambda x: cstr(self.coinbase, x)\n msg = ' '.join([str(t), c(repr(self)), tag, (' %r' % kargs if kargs else '')])\n log.debug(msg)", "metadata": "root.ConsensusManager.log", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 190 }, { "content": " @property\n def head(self):\n return self.chain.head", "metadata": "root.ConsensusManager.head", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 197 }, { "content": " @property\n def height(self):\n return self.head.number + 1", "metadata": "root.ConsensusManager.height", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 201 }, { "content": " @property\n def round(self):\n return self.heights[self.height].round", "metadata": "root.ConsensusManager.round", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 205 }, { "content": " def broadcast(self, m):\n self.log('broadcasting', message=m)\n self.chainservice.broadcast(m)", "metadata": "root.ConsensusManager.broadcast", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 211 }, { "content": " @property\n def is_ready(self):\n return len(self.ready_validators) > len(self.contract.validators) * 2 / 3.", "metadata": "root.ConsensusManager.is_ready", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 217 }, { "content": " def send_ready(self):\n self.log('cm.send_ready')\n assert not self.is_ready\n r = Ready(self.ready_nonce, self.active_round.lockset)\n self.sign(r)\n self.broadcast(r)\n self.ready_nonce += 1", "metadata": "root.ConsensusManager.send_ready", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 221 }, { "content": " def add_ready(self, ready, proto=None):\n assert isinstance(ready, Ready)\n assert self.contract.isvalidator(ready.sender)\n self.ready_validators.add(ready.sender)\n self.log('cm.add_ready', validator=ready.sender)\n if self.is_ready:\n self.log('cm.add_ready, sufficient count of validators ready',\n num=len(self.ready_validators))\n else:\n self.send_ready()", "metadata": "root.ConsensusManager.add_ready", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 229 }, { "content": " def add_vote(self, v, proto=None):\n assert isinstance(v, Vote)\n assert self.contract.isvalidator(v.sender)\n self.ready_validators.add(v.sender)\n # exception for externaly received votes signed by self, necessary for resyncing\n is_own_vote = bool(v.sender == self.coinbase)\n try:\n success = self.heights[v.height].add_vote(v, force_replace=is_own_vote)\n except DoubleVotingError:\n ls = self.heights[v.height].rounds[v.round].lockset\n self.tracked_protocol_failures.append(DoubleVotingEvidence(proto, v, ls))\n log.warn('double voting detected', vote=v, ls=ls)\n return success", "metadata": "root.ConsensusManager.add_vote", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 240 }, { "content": " def add_proposal(self, p, proto=None):\n assert isinstance(p, Proposal)\n assert proto is None or isinstance(proto, HDCProtocol)\n\n def check(valid):\n if not valid:\n self.tracked_protocol_failures.append(InvalidProposalEvidence(None, p))\n log.warn('invalid proposal', p=p)\n raise InvalidProposalError()\n return True\n\n self.log('cm.add_proposal', p=p)\n if p.height < self.height:\n self.log('proposal from the past')\n return\n\n if not check(self.contract.isvalidator(p.sender) and self.contract.isproposer(p)):\n return\n self.ready_validators.add(p.sender)\n\n if not check(p.lockset.is_valid):\n return\n if not check(p.lockset.height == p.height or p.round == 0):\n return\n if not check(p.round - p.lockset.round == 1 or p.round == 0):\n return\n\n # proposal is valid\n if proto is not None: # inactive proto is False\n self.synchronizer.on_proposal(p, proto)\n\n for v in p.lockset:\n self.add_vote(v) # implicitly checks their validity\n if isinstance(p, BlockProposal):\n if not check(p.block.number == p.height):\n return\n if not check(p.lockset.has_noquorum or p.round == 0):\n return\n # validation\n if p.height > self.height:\n self.log('proposal from the future, not in sync', p=p)\n return # note: we are not broadcasting this, as we could not validate\n blk = self.chainservice.link_block(p.block)\n if not check(blk):\n # safeguard for forks:\n # if there is a quorum on a block which can not be applied: panic!\n ls = self.heights[p.height].last_quorum_lockset\n if ls and ls.has_quorum == p.blockhash:\n raise ForkDetectedEvidence(proto, (self.head, p, ls))\n sys.exit(1)\n return\n p._mutable = True\n p._cached_rlp = None\n p.block = blk # block linked to chain\n self.log('successfully linked block')\n self.add_block_proposal(p) # implicitly checks the votes validity\n else:\n assert isinstance(p, VotingInstruction)\n assert p.lockset.round == p.round - 1 and p.height == p.lockset.height\n assert p.round > 0\n assert p.lockset.has_quorum_possible\n assert not p.lockset.has_quorum\n if not check(p.lockset.has_quorum_possible and not p.lockset.has_quorum):\n return\n is_valid = self.heights[p.height].add_proposal(p)\n return is_valid # can be broadcasted", "metadata": "root.ConsensusManager.add_proposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 254 }, { "content": " def add_lockset(self, ls, proto=None):\n assert ls.is_valid\n for v in ls:\n self.add_vote(v) # implicitly checks their validity", "metadata": "root.ConsensusManager.add_lockset", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 321 }, { "content": " def add_block_proposal(self, p):\n assert isinstance(p, BlockProposal)\n if self.has_blockproposal(p.blockhash):\n self.log('known block_proposal')\n return\n assert p.signing_lockset.has_quorum # on previous block\n assert p.signing_lockset.height == p.height - 1\n for v in p.signing_lockset:\n self.add_vote(v)\n self.block_candidates[p.blockhash] = p", "metadata": "root.ConsensusManager.add_block_proposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 326 }, { "content": " @property\n def last_committing_lockset(self):\n return self.heights[self.height - 1].last_quorum_lockset", "metadata": "root.ConsensusManager.last_committing_lockset", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 337 }, { "content": " @property\n def highest_committing_lockset(self):\n for height in self.heights:\n ls = self.heights[height].last_quorum_lockset\n if ls:\n return ls", "metadata": "root.ConsensusManager.highest_committing_lockset", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 341 }, { "content": " @property\n def last_valid_lockset(self):\n return self.heights[self.height].last_valid_lockset or self.last_committing_lockset", "metadata": "root.ConsensusManager.last_valid_lockset", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 348 }, { "content": " @property\n def last_lock(self):\n return self.heights[self.height].last_lock", "metadata": "root.ConsensusManager.last_lock", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 352 }, { "content": " @property\n def last_blockproposal(self):\n # valid block proposal on currrent height\n p = self.heights[self.height].last_voted_blockproposal\n if p:\n return p\n elif self.height > 1: # or last block\n return self.get_blockproposal(self.head.hash)", "metadata": "root.ConsensusManager.last_blockproposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 356 }, { "content": " @property\n def active_round(self):\n hm = self.heights[self.height]\n return hm.rounds[hm.round]", "metadata": "root.ConsensusManager.active_round", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 365 }, { "content": " def setup_alarm(self):\n ar = self.active_round\n delay = ar.get_timeout()\n self.log('in set up alarm', delay=delay)\n if self.is_waiting_for_proposal:\n if delay is not None:\n self.chainservice.setup_alarm(delay, self.on_alarm, ar)\n self.log('set up alarm on timeout', now=self.chainservice.now,\n delay=delay, triggered=delay + self.chainservice.now)\n else:\n self.chainservice.setup_transaction_alarm(self.on_alarm, ar)\n self.log('set up alarm on tx', now=self.chainservice.now)", "metadata": "root.ConsensusManager.setup_alarm", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 370 }, { "content": " def on_alarm(self, ar):\n assert isinstance(ar, RoundManager)\n if self.active_round == ar:\n self.log('on alarm, matched', ts=self.chainservice.now)\n if not self.is_ready:\n # defer alarm if not ready\n self.log('not ready defering alarm', ts=self.chainservice.now)\n self.setup_alarm()\n elif not self.is_waiting_for_proposal:\n # defer alarm if there are no pending transactions\n self.log('no txs defering alarm', ts=self.chainservice.now)\n self.setup_alarm()\n else:\n self.process()", "metadata": "root.ConsensusManager.on_alarm", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 383 }, { "content": " @property\n def is_waiting_for_proposal(self):\n return self.allow_empty_blocks \\\n or self.has_pending_transactions \\\n or self.height <= self.num_initial_blocks", "metadata": "root.ConsensusManager.is_waiting_for_proposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 398 }, { "content": " @property\n def has_pending_transactions(self):\n return self.chain.head_candidate.num_transactions() > 0", "metadata": "root.ConsensusManager.has_pending_transactions", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 404 }, { "content": " def process(self):\n r = self._process()\n return r", "metadata": "root.ConsensusManager.process", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 408 }, { "content": " def _process(self):\n self.log('-' * 40)\n self.log('in process')\n if not self.is_ready:\n self.log('not ready ')\n self.setup_alarm()\n return\n self.commit()\n self.heights[self.height].process()\n if self.commit(): # re enter process if we did commit (e.g. to immediately propose)\n return self._process()\n self.cleanup()\n self.synchronizer.process()\n self.setup_alarm()\n\n for f in self.tracked_protocol_failures:\n if not isinstance(f, FailedToProposeEvidence):\n log.warn('protocol failure', incident=f)", "metadata": "root.ConsensusManager._process", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 412 }, { "content": " def commit(self):\n self.log('in commit')\n for p in [c for c in self.block_candidates.values() if c.block.prevhash == self.head.hash]:\n assert isinstance(p, BlockProposal)\n ls = self.heights[p.height].last_quorum_lockset\n if ls and ls.has_quorum == p.blockhash:\n self.store_proposal(p)\n self.store_last_committing_lockset(ls)\n success = self.chainservice.commit_block(p.block)\n assert success\n if success:\n self.log('commited', p=p, hash=phx(p.blockhash))\n assert self.head == p.block\n self.commit() # commit all possible\n return True\n else:\n self.log('could not commit', p=p)\n else:\n self.log('no quorum for', p=p)\n if ls:\n self.log('votes', votes=ls.votes)", "metadata": "root.ConsensusManager.commit", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 433 }, { "content": " def cleanup(self):\n self.log('in cleanup')\n for p in self.block_candidates.values():\n if self.head.number >= p.height:\n self.block_candidates.pop(p.blockhash)\n for h in list(self.heights):\n if self.heights[h].height < self.head.number:\n self.heights.pop(h)", "metadata": "root.ConsensusManager.cleanup", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 455 }, { "content": " def mk_lockset(self, height):\n return LockSet(num_eligible_votes=self.contract.num_eligible_votes(height))", "metadata": "root.ConsensusManager.mk_lockset", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 464 }, { "content": " def sign(self, o):\n assert isinstance(o, Signed)\n return o.sign(self.privkey)", "metadata": "root.ConsensusManager.sign", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 467 }, { "content": "class HeightManager(object):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.HeightManager", "header": "['module', '___EOS___']", "index": 472 }, { "content": " def __init__(self, consensusmanager, height=0):\n self.cm = consensusmanager\n self.log = self.cm.log\n self.height = height\n self.rounds = ManagerDict(RoundManager, self)\n log.debug('A:%s Created HeightManager H:%d' % (phx(self.cm.coinbase), self.height))", "metadata": "root.HeightManager.__init__", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 474 }, { "content": " @property\n def round(self):\n l = self.last_valid_lockset\n if l:\n return l.round + 1\n return 0", "metadata": "root.HeightManager.round", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 481 }, { "content": " @property\n def last_lock(self):\n \"highest lock on height\"\n rs = list(self.rounds)\n assert len(rs) < 2 or rs[0] > rs[1] # FIXME REMOVE\n for r in self.rounds: # is sorted highest to lowest\n if self.rounds[r].lock is not None:\n return self.rounds[r].lock", "metadata": "root.HeightManager.last_lock", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 488 }, { "content": " @property\n def last_voted_blockproposal(self):\n \"the last block proposal node voted on\"\n for r in self.rounds:\n if isinstance(self.rounds[r].proposal, BlockProposal):\n assert isinstance(self.rounds[r].lock, Vote)\n if self.rounds[r].proposal.blockhash == self.rounds[r].lock.blockhash:\n return self.rounds[r].proposal", "metadata": "root.HeightManager.last_voted_blockproposal", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 497 }, { "content": " @property\n def last_valid_lockset(self):\n \"highest valid lockset on height\"\n for r in self.rounds:\n ls = self.rounds[r].lockset\n if ls.is_valid:\n return ls\n return None", "metadata": "root.HeightManager.last_valid_lockset", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 506 }, { "content": " @property\n def last_quorum_lockset(self):\n found = None\n for r in sorted(self.rounds): # search from lowest round first\n ls = self.rounds[r].lockset\n if ls.is_valid and ls.has_quorum:\n if found is not None: # consistency check, only one quorum on block allowed\n for r in sorted(self.rounds): # dump all locksets\n self.log('multiple valid locksets', round=r, ls=self.rounds[r].lockset,\n votes=self.rounds[r].lockset.votes)\n if found.has_quorum != ls.has_quorum:\n log.error('FATAL: multiple valid locksets on different proposals')\n import sys\n sys.exit(1)\n found = ls\n return found", "metadata": "root.HeightManager.last_quorum_lockset", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 515 }, { "content": " @property\n def has_quorum(self):\n ls = self.last_quorum_lockset\n if ls:\n return ls.has_quorum", "metadata": "root.HeightManager.has_quorum", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 532 }, { "content": " def add_vote(self, v, force_replace=False):\n return self.rounds[v.round].add_vote(v, force_replace)", "metadata": "root.HeightManager.add_vote", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 538 }, { "content": " def add_proposal(self, p):\n assert p.height == self.height\n assert p.lockset.is_valid\n if p.round > self.round:\n self.round = p.round\n return self.rounds[p.round].add_proposal(p)", "metadata": "root.HeightManager.add_proposal", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 541 }, { "content": " def process(self):\n self.log('in hm.process', height=self.height)\n self.rounds[self.round].process()", "metadata": "root.HeightManager.process", "header": "['class', 'HeightManager', '(', 'object', ')', ':', '___EOS___']", "index": 548 }, { "content": "class RoundManager(object):\n\n\n\n\n\n\n\n", "metadata": "root.RoundManager", "header": "['module', '___EOS___']", "index": 553 }, { "content": " def __init__(self, heightmanager, round_=0):\n\n assert isinstance(round_, int)\n self.round = round_\n\n self.hm = heightmanager\n self.cm = heightmanager.cm\n self.log = self.hm.log\n self.height = heightmanager.height\n self.lockset = self.cm.mk_lockset(self.height)\n self.proposal = None\n self.lock = None\n self.timeout_time = None\n log.debug('A:%s Created RoundManager H:%d R:%d' %\n (phx(self.cm.coinbase), self.hm.height, self.round))", "metadata": "root.RoundManager.__init__", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 555 }, { "content": " def get_timeout(self):\n \"setup a timeout for waiting for a proposal\"\n if self.timeout_time is not None or self.proposal:\n return\n now = self.cm.chainservice.now\n round_timeout = ConsensusManager.round_timeout\n round_timeout_factor = ConsensusManager.round_timeout_factor\n delay = round_timeout * round_timeout_factor ** self.round\n self.timeout_time = now + delay\n return delay", "metadata": "root.RoundManager.get_timeout", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 571 }, { "content": " def add_vote(self, v, force_replace=False):\n if v in self.lockset:\n return\n self.log('rm.adding', vote=v, received_proposal=self.proposal)\n try:\n success = self.lockset.add(v, force_replace)\n except InvalidVoteError:\n self.cm.tracked_protocol_failures.append(InvalidVoteEvidence(None, v))\n return\n # report failed proposer\n if self.lockset.is_valid:\n self.log('lockset is valid', ls=self.lockset)\n if not self.proposal and self.lockset.has_noquorum:\n self.cm.tracked_protocol_failures.append(\n FailedToProposeEvidence(None, self.lockset))\n return success", "metadata": "root.RoundManager.add_vote", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 582 }, { "content": " def add_proposal(self, p):\n self.log('rm.adding', proposal=p, old=self.proposal)\n assert isinstance(p, Proposal)\n assert isinstance(p, VotingInstruction) or isinstance(p.block, Block) # already linked\n assert not self.proposal or self.proposal == p\n self.proposal = p\n return True", "metadata": "root.RoundManager.add_proposal", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 599 }, { "content": " def process(self):\n self.log('in rm.process', height=self.hm.height, round=self.round)\n\n assert self.cm.round == self.round\n assert self.cm.height == self.hm.height == self.height\n p = self.propose()\n if isinstance(p, BlockProposal):\n self.cm.add_block_proposal(p)\n if p:\n self.cm.broadcast(p)\n v = self.vote()\n if v:\n self.cm.broadcast(v)\n assert not self.proposal or self.lock", "metadata": "root.RoundManager.process", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 607 }, { "content": " def mk_proposal(self, round_lockset=None):\n signing_lockset = self.cm.last_committing_lockset.copy() # quorum which signs prev block\n if self.round > 0:\n round_lockset = self.cm.last_valid_lockset.copy()\n assert round_lockset.has_noquorum\n else:\n round_lockset = None\n assert signing_lockset.has_quorum\n # for R0 (std case) we only need one lockset!\n assert round_lockset is None or self.round > 0\n block = self.cm.chain.head_candidate\n # fix pow\n block.header.__class__ = HDCBlockHeader\n block.should_be_locked = True\n bp = BlockProposal(self.height, self.round, block, signing_lockset, round_lockset)\n self.cm.sign(bp)\n self.cm.set_proposal_lock(block)\n assert self.cm.chainservice.proposal_lock.locked()\n return bp", "metadata": "root.RoundManager.mk_proposal", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 622 }, { "content": " def propose(self):\n if not self.cm.is_waiting_for_proposal:\n return\n proposer = self.cm.contract.proposer(self.height, self.round)\n self.log('in propose', proposer=phx(proposer), proposal=self.proposal, lock=self.lock)\n if proposer != self.cm.coinbase:\n return\n self.log('is proposer')\n if self.proposal:\n assert self.proposal.sender == self.cm.coinbase\n assert self.lock\n return\n\n round_lockset = self.cm.last_valid_lockset\n if not round_lockset:\n self.log('no valid round lockset for height')\n return\n\n self.log('in creating proposal', round_lockset=round_lockset)\n\n if round_lockset.height == self.height and round_lockset.has_quorum:\n self.log('have quorum on height, not proposing')\n return\n elif self.round == 0 or round_lockset.has_noquorum:\n proposal = self.mk_proposal()\n elif round_lockset.has_quorum_possible:\n proposal = VotingInstruction(self.height, self.round, round_lockset.copy())\n self.cm.sign(proposal)\n else:\n raise Exception('invalid round_lockset')\n\n self.log('created proposal', p=proposal, bh=phx(proposal.blockhash))\n self.proposal = proposal\n return proposal", "metadata": "root.RoundManager.propose", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 642 }, { "content": " def vote(self):\n if self.lock:\n return # voted in this round\n self.log('in vote', proposal=self.proposal, pid=id(self.proposal))\n\n # get last lock on height\n last_lock = self.hm.last_lock\n\n if self.proposal:\n if isinstance(self.proposal, VotingInstruction):\n assert self.proposal.lockset.has_quorum_possible\n self.log('voting on instruction')\n v = VoteBlock(self.height, self.round, self.proposal.blockhash)\n elif not isinstance(last_lock, VoteBlock):\n assert isinstance(self.proposal, BlockProposal)\n assert isinstance(self.proposal.block, Block) # already linked to chain\n assert self.proposal.lockset.has_noquorum or self.round == 0\n assert self.proposal.block.prevhash == self.cm.head.hash\n self.log('voting proposed block')\n v = VoteBlock(self.height, self.round, self.proposal.blockhash)\n else: # repeat vote\n self.log('voting on last vote')\n v = VoteBlock(self.height, self.round, last_lock.blockhash)\n elif self.timeout_time is not None and self.cm.chainservice.now >= self.timeout_time:\n if isinstance(last_lock, VoteBlock): # repeat vote\n self.log('timeout voting on last vote')\n v = VoteBlock(self.height, self.round, last_lock.blockhash)\n else:\n self.log('timeout voting not locked')\n v = VoteNil(self.height, self.round)\n else:\n return\n self.cm.sign(v)\n\n self.log('voted', vote=v)\n self.lock = v\n assert self.hm.last_lock == self.lock\n self.lockset.add(v)\n return v", "metadata": "root.RoundManager.vote", "header": "['class', 'RoundManager', '(', 'object', ')', ':', '___EOS___']", "index": 677 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", " ", "Hei", "ko", " ", "He", "es_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rlp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "Lock", "Set_", ",_", "Vote", "_", ",_", "Vote", "Block_", ",_", "Vote", "Ni", "l_", ",_", "Signe", "d_", ",_", "Ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "Block", "Propos", "al_", ",_", "Vo", "ting", "Instruction_", ",_", "Doub", "le", "Vo", "ting", "Error_", ",_", "Inva", "lid", "Vote", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "Block_", ",_", "Propos", "al_", ",_", "HD", "CB", "lock", "Header_", ",_", "Inva", "lid", "Propos", "al", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "protocol_", "import_", "HD", "CP", "roto", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "cstr", "_", ",_", "ph", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "synchronize", "r_", "import_", "Synchronize", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ether", "eum", "_", "._", "slo", "ggi", "ng_", "import_", "get", "\\u", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "get", "\\u", "logger_", "(_", "'", "hd", "c", ".", "consensus", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Manager", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Manager", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dk", "lass_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "d_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dk", "lass_", "=_", "dk", "lass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manager", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "not_", "in_", "self_", "._", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "d_", "[_", "k_", "]_", "=_", "self_", "._", "dk", "lass_", "(_", "self_", "._", "parent_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "d_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manager", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "sorted_", "(_", "self_", "._", "d_", ",_", "reverse_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manager", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "d_", "._", "pop_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Missing", "Parent_", "(_", "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_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "protocol_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "evidence_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "%", "s", " ", "protoc", "ol", "=", "%", "r", " ", "eviden", "ce", "=", "%", "r", ">'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "protocol_", ",_", "self_", "._", "evidence_", ")_", "\\u\\u\\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_", "Inva", "lid", "Propos", "al", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Inva", "lid", "Propos", "al", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\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_", ",_", "protocol_", ",_", "proposal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "protocol_", "=_", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "evidence_", "=_", "proposal_", "\\u\\u\\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_", "Doub", "le", "Vo", "ting", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Doub", "le", "Vo", "ting", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\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_", ",_", "protocol_", ",_", "vote_", ",_", "other", "vote_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "protocol_", "=_", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "evidence_", "=_", "(_", "vote_", ",_", "other", "vote_", ")_", "\\u\\u\\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_", "Inva", "lid", "Vote", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Inva", "lid", "Vote", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\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_", ",_", "protocol_", ",_", "vote_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "protocol_", "=_", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "evidence_", "=_", "vote_", "\\u\\u\\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_", "Fail", "ed", "To", "Propos", "e", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fail", "ed", "To", "Propos", "e", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\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_", ",_", "protocol_", ",_", "round", "\\u", "lock", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "protocol_", "=_", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "evidence_", "=_", "round", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "For", "k", "Detect", "ed", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "For", "k", "Detect", "ed", "Evi", "denc", "e_", "(_", "Proto", "col", "Fail", "ure", "Evi", "denc", "e_", ")_", ":_", "\\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_", ",_", "protocol_", ",_", "prev", "block_", ",_", "block_", ",_", "committ", "ing", "\\u", "lock", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "protocol_", "=_", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "evidence_", "=_", "(_", "prev", "block_", ",_", "block_", ",_", "committ", "ing", "\\u", "lock", "set_", ")_", "\\u\\u\\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_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "\\u", "empty", "\\u", "blocks_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "initial", "\\u", "blocks_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "round", "\\u", "timeout_", "=_", "3_", "#", " ", "timeo", "ut", " ", "whe", "n", " ", "wait", "ing", " ", "for", " ", "proposal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "round", "\\u", "timeo", "ut", "\\u", "factor_", "=_", "1.5_", "#", " ", "timeo", "ut", " ", "increase", " ", "per", " ", "round_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u", "timeout_", "=_", "0.5_", "#", " ", "dela", "y", " ", "whe", "n", " ", "wait", "ing", " ", "for", " ", "new", " ", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "persist", " ", "proposals", " ", "and", " ", "last", " ", "committ", "ing", " ", "lock", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", " ", "handling", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validator", " ", "read", "y", " ", "handling", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", "=_", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "chain", "service_", ",_", "consensus", "\\u", "contract_", ",_", "privkey_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "chain", "service_", "=_", "chain", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chain_", "=_", "chain", "service_", "._", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "contract_", "=_", "consensus", "\\u", "contract_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "privkey_", "=_", "privkey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "synchronize", "r_", "=_", "Synchronize", "r_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "heights_", "=_", "Manager", "Dict_", "(_", "Hei", "ght", "Manager_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "block", "\\u", "candidates_", "=_", "dict_", "(_", ")_", "#", " ", "block", "hash", " ", ":", " ", "Block", "Propos", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tracked", "\\u", "protoc", "ol", "\\u", "failures_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", " ", "for", " ", "eno", "ugh", " ", "validator", "s", " ", "in", " ", "order", " ", "to", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "read", "y", "\\u", "validators_", "=_", "set_", "(_", ")_", "#", " ", "addresses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "y", "\\u", "nonce_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "contract_", "._", "is", "validator_", "(_", "self_", "._", "coinbase", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initialize", "\\u", "lock", "sets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "read", "y", "\\u", "validators_", "=_", "set_", "(_", "[_", "self_", "._", "coinbase", "_", "]_", ")_", "#", " ", "old", " ", "vote", "s", " ", "don", "t", " ", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "initialize", "\\u", "lock", "sets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "initiali", "zin", "g", " ", "lock", "sets", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sign", " ", "genesi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "=_", "self_", "._", "sign_", "(_", "Vote", "Block_", "(_", "0_", ",_", "0_", ",_", "self_", "._", "chain", "service_", "._", "chain_", "._", "genesi", "s_", "._", "hash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "vote_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "initial", " ", "lock", "set_", "\\u\\u\\uNL\\u\\u\\u_", "head", "\\u", "proposal_", "=_", "self_", "._", "load", "\\u", "proposal_", "(_", "self_", "._", "head_", "._", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "head", "\\u", "proposal_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "head", "\\u", "proposal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "head", "\\u", "proposal_", "._", "block", "hash_", "==_", "self_", "._", "head_", "._", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "head", "\\u", "proposal_", "._", "signin", "g", "\\u", "lock", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "vote_", "(_", "v_", ")_", "#", " ", "head", " ", "-", " ", "1", " ", ",", " ", "height", " ", "-", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "self_", "._", "heights_", "[_", "self_", "._", "head_", "._", "header_", "._", "number_", "-_", "1_", "]_", "._", "has", "\\u", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "=_", "self_", "._", "load", "\\u", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "._", "has", "\\u", "quorum", "_", "==_", "self_", "._", "head_", "._", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "._", "votes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "vote_", "(_", "v_", ")_", "#", " ", "head", " ", " ", ",", " ", "height", " ", "-", " ", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "self_", "._", "heights_", "[_", "self_", "._", "head_", "._", "header_", "._", "number_", "]_", "._", "has", "\\u", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "head_", "._", "header_", "._", "number_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "self_", "._", "high", "est", "\\u", "committ", "ing", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "last", "\\u", "valid", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "store", "\\u", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "(_", "self_", ",_", "ls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "ls_", ",_", "Lock", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ls_", "._", "has", "\\u", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chain", "service_", "._", "db_", "._", "put_", "(_", "'", "last", "\\u", "committ", "ing", "\\u", "lock", "set", "'_", ",_", "rlp", "_", "._", "encode_", "(_", "ls_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "(_", "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 ", " _", "data_", "=_", "self_", "._", "chain", "service_", "._", "db_", "._", "get_", "(_", "'", "last", "\\u", "committ", "ing", "\\u", "lock", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "no", " ", "last", "\\u", "committ", "ing", "\\u", "lock", "set", " ", "coul", "d", " ", "be", " ", "load", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rlp", "_", "._", "decode_", "(_", "data_", ",_", "sed", "es_", "=_", "Lock", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "store", "\\u", "proposal_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "p_", ",_", "Block", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chain", "service_", "._", "db_", "._", "put_", "(_", "'", "block", "propos", "al", ":", "%", "s", "'_", "%_", "p_", "._", "block", "hash_", ",_", "rlp", "_", "._", "encode_", "(_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "propos", "al", "\\u", "rlp", "_", "(_", "self_", ",_", "block", "hash_", ")_", ":_", "\\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 ", " _", "pr", "lp_", "=_", "self_", "._", "chain", "service_", "._", "db_", "._", "get_", "(_", "'", "block", "propos", "al", ":", "%", "s", "'_", "%_", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "pr", "lp_", ",_", "bytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pr", "lp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "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_", "load", "\\u", "proposal_", "(_", "self_", ",_", "block", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr", "lp_", "=_", "self_", "._", "load", "\\u", "propos", "al", "\\u", "rlp", "_", "(_", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pr", "lp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "rlp", "_", "._", "decode_", "(_", "pr", "lp_", ",_", "sed", "es_", "=_", "Block", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "block", "proposal_", "(_", "self_", ",_", "block", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "block", "\\u", "candidates_", "._", "get_", "(_", "block", "hash_", ")_", "or_", "self_", "._", "load", "\\u", "proposal_", "(_", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "block", "proposal_", "(_", "self_", ",_", "block", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "load", "\\u", "propos", "al", "\\u", "rlp", "_", "(_", "block", "hash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "block", "propos", "al", "\\u", "rlp", "\\u", "by", "\\u", "height_", "(_", "self_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "<_", "height_", "<_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bh_", "=_", "self_", "._", "chain", "service_", "._", "chain_", "._", "index_", "._", "get", "\\u", "block", "\\u", "by", "\\u", "number_", "(_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "load", "\\u", "propos", "al", "\\u", "rlp", "_", "(_", "bh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "coinbase", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "chain_", "._", "coinbase", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "propos", "al", "\\u", "lock_", "(_", "self_", ",_", "block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "chain", "service_", "._", "set\\u", "propos", "al", "\\u", "lock_", "(_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "CP", " ", "A", ":", "%", "r", " ", "H", ":", "%", "d", " ", "R", ":", "%", "d", " ", "L", ":", "%", "r", " ", "%", "s", ">'_", "%_", "(_", "ph", "x_", "(_", "self_", "._", "coinbase", "_", ")_", ",_", "self_", "._", "height_", ",_", "self_", "._", "round_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "active", "\\u", "round_", "._", "lock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "active", "\\u", "round_", "._", "lock", "set_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log_", "(_", "self_", ",_", "tag_", ",_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "self", ".", "coinbase", " ", "!=", " ", "0", ":", " ", "return_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "int_", "(_", "self_", "._", "chain", "service_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "lambda_", "x_", ":_", "cstr", "_", "(_", "self_", "._", "coinbase", "_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "str_", "(_", "t_", ")_", ",_", "c_", "(_", "repr_", "(_", "self_", ")_", ")_", ",_", "tag_", ",_", "(_", "'", " ", "%", "r", "'_", "%_", "kargs_", "if_", "kargs_", "else_", "''_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "head_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "chain_", "._", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "height_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "head_", "._", "number_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "round_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "heights_", "[_", "self_", "._", "height_", "]_", "._", "round_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "broadcast_", "(_", "self_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "broadcast", "ing", "'_", ",_", "message_", "=_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chain", "service_", "._", "broadcast_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "ready_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "read", "y", "\\u", "validators_", ")_", ">_", "len_", "(_", "self_", "._", "contract_", "._", "validators_", ")_", "*_", "2_", "/_", "3._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "ready_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "cm", ".", "send", "\\u", "read", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "is", "\\u", "ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Ready_", "(_", "self_", "._", "read", "y", "\\u", "nonce_", ",_", "self_", "._", "active", "\\u", "round_", "._", "lock", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sign_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "broadcast_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "y", "\\u", "nonce_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "ready_", "(_", "self_", ",_", "ready_", ",_", "proto_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "ready_", ",_", "Ready_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "contract_", "._", "is", "validator_", "(_", "ready_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "y", "\\u", "validators_", "._", "add_", "(_", "ready_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "cm", ".", "add", "\\u", "read", "y", "'_", ",_", "validator_", "=_", "ready_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "cm", ".", "add", "\\u", "read", "y", ",", " ", "sufficient", " ", "count", " ", "of", " ", "validator", "s", " ", "read", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num_", "=_", "len_", "(_", "self_", "._", "read", "y", "\\u", "validators_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "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_", "add", "\\u", "vote_", "(_", "self_", ",_", "v_", ",_", "proto_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "v_", ",_", "Vote", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "contract_", "._", "is", "validator_", "(_", "v_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "y", "\\u", "validators_", "._", "add_", "(_", "v_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exception", " ", "for", " ", "external", "y", " ", "receive", "d", " ", "vote", "s", " ", "sign", "ed", " ", "by", " ", "self", ",", " ", "necessar", "y", " ", "for", " ", "res", "ync", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "own", "\\u", "vote_", "=_", "bool_", "(_", "v_", "._", "sender_", "==_", "self_", "._", "coinbase", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "self_", "._", "heights_", "[_", "v_", "._", "height_", "]_", "._", "add", "\\u", "vote_", "(_", "v_", ",_", "force", "\\u", "replace_", "=_", "is", "\\u", "own", "\\u", "vote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Doub", "le", "Vo", "ting", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "self_", "._", "heights_", "[_", "v_", "._", "height_", "]_", "._", "rounds_", "[_", "v_", "._", "round_", "]_", "._", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tracked", "\\u", "protoc", "ol", "\\u", "failures_", "._", "append_", "(_", "Doub", "le", "Vo", "ting", "Evi", "denc", "e_", "(_", "proto_", ",_", "v_", ",_", "ls_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "warn_", "(_", "'", "double", " ", "voting", " ", "detect", "ed", "'_", ",_", "vote_", "=_", "v_", ",_", "ls_", "=_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "proposal_", "(_", "self_", ",_", "p_", ",_", "proto_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "p_", ",_", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "proto_", "is_", "None_", "or_", "isinstance_", "(_", "proto_", ",_", "HD", "CP", "roto", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check_", "(_", "valid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tracked", "\\u", "protoc", "ol", "\\u", "failures_", "._", "append_", "(_", "Inva", "lid", "Propos", "al", "Evi", "denc", "e_", "(_", "None_", ",_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "warn_", "(_", "'", "invalid", " ", "propos", "al", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Inva", "lid", "Propos", "al", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "cm", ".", "add", "\\u", "propos", "al", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "._", "height_", "<_", "self_", "._", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "propos", "al", " ", "from", " ", "the", " ", "past", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "check_", "(_", "self_", "._", "contract_", "._", "is", "validator_", "(_", "p_", "._", "sender_", ")_", "and_", "self_", "._", "contract_", "._", "isp", "rop", "ose", "r_", "(_", "p_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "read", "y", "\\u", "validators_", "._", "add_", "(_", "p_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check_", "(_", "p_", "._", "lock", "set_", "._", "is", "\\u", "valid_", ")_", ":_", "\\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_", "check_", "(_", "p_", "._", "lock", "set_", "._", "height_", "==_", "p_", "._", "height_", "or_", "p_", "._", "round_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "check_", "(_", "p_", "._", "round_", "-_", "p_", "._", "lock", "set_", "._", "round_", "==_", "1_", "or_", "p_", "._", "round_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "propos", "al", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proto_", "is_", "not_", "None_", ":_", "#", " ", "inact", "ive", " ", "proto", " ", "is", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "synchronize", "r_", "._", "on", "\\u", "proposal_", "(_", "p_", ",_", "proto_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "v_", "in_", "p_", "._", "lock", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "vote_", "(_", "v_", ")_", "#", " ", "implicit", "ly", " ", "checks", " ", "thei", "r", " ", "validity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "p_", ",_", "Block", "Propos", "al_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "check_", "(_", "p_", "._", "block_", "._", "number_", "==_", "p_", "._", "height_", ")_", ":_", "\\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_", "check_", "(_", "p_", "._", "lock", "set_", "._", "has", "\\u", "no", "quorum", "_", "or_", "p_", "._", "round_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "._", "height_", ">_", "self_", "._", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "propos", "al", " ", "from", " ", "the", " ", "future", ",", " ", "not", " ", "in", " ", "sync", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "#", " ", "note", ":", " ", "we", " ", "are", " ", "not", " ", "broadcast", "ing", " ", "this", ",", " ", "as", " ", "we", " ", "coul", "d", " ", "not", " ", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "blk_", "=_", "self_", "._", "chain", "service_", "._", "link", "\\u", "block_", "(_", "p_", "._", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check_", "(_", "blk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "safe", "guard", " ", "for", " ", "fork", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "a", " ", "quorum", " ", "on", " ", "a", " ", "block", " ", "whi", "ch", " ", "can", " ", "not", " ", "be", " ", "applied", ":", " ", "pani", "c", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "self_", "._", "heights_", "[_", "p_", "._", "height_", "]_", "._", "last", "\\u", "quorum", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", "and_", "ls_", "._", "has", "\\u", "quorum", "_", "==_", "p_", "._", "block", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "For", "k", "Detect", "ed", "Evi", "denc", "e_", "(_", "proto_", ",_", "(_", "self_", "._", "head_", ",_", "p_", ",_", "ls_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "._", "\\u", "mutable", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "\\u", "cache", "d\\u", "rlp", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "block_", "=_", "blk_", "#", " ", "block", " ", "linked", " ", "to", " ", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "success", "full", "y", " ", "linked", " ", "block", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "block", "\\u", "proposal_", "(_", "p_", ")_", "#", " ", "implicit", "ly", " ", "checks", " ", "the", " ", "vote", "s", " ", "validity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "p_", ",_", "Vo", "ting", "Instruction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "lock", "set_", "._", "round_", "==_", "p_", "._", "round_", "-_", "1_", "and_", "p_", "._", "height_", "==_", "p_", "._", "lock", "set_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "round_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "\\u", "possible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check_", "(_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "\\u", "possible_", "and_", "not_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "\\u", "valid_", "=_", "self_", "._", "heights_", "[_", "p_", "._", "height_", "]_", "._", "add", "\\u", "proposal_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "is", "\\u", "valid_", "#", " ", "can", " ", "be", " ", "broadcast", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "lock", "set_", "(_", "self_", ",_", "ls_", ",_", "proto_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "ls_", "._", "is", "\\u", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "vote_", "(_", "v_", ")_", "#", " ", "implicit", "ly", " ", "checks", " ", "thei", "r", " ", "validity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "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_", "add", "\\u", "block", "\\u", "proposal_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "p_", ",_", "Block", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "block", "proposal_", "(_", "p_", "._", "block", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "know", "n", " ", "block", "\\u", "propos", "al", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "p_", "._", "signin", "g", "\\u", "lock", "set_", "._", "has", "\\u", "quorum", "_", "#", " ", "on", " ", "previ", "ous", " ", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "signin", "g", "\\u", "lock", "set_", "._", "height_", "==_", "p_", "._", "height_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "p_", "._", "signin", "g", "\\u", "lock", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "vote_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "block", "\\u", "candidates_", "[_", "p_", "._", "block", "hash_", "]_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "heights_", "[_", "self_", "._", "height_", "-_", "1_", "]_", "._", "last", "\\u", "quorum", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "high", "est", "\\u", "committ", "ing", "\\u", "lock", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "height_", "in_", "self_", "._", "heights_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "self_", "._", "heights_", "[_", "height_", "]_", "._", "last", "\\u", "quorum", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "valid", "\\u", "lock", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "heights_", "[_", "self_", "._", "height_", "]_", "._", "last", "\\u", "valid", "\\u", "lock", "set_", "or_", "self_", "._", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "lock_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "heights_", "[_", "self_", "._", "height_", "]_", "._", "last", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "block", "proposal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "valid", " ", "block", " ", "propos", "al", " ", "on", " ", "curr", "rent", " ", "height_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "self_", "._", "heights_", "[_", "self_", "._", "height_", "]_", "._", "last", "\\u", "vote", "d\\u", "block", "proposal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "height_", ">_", "1_", ":_", "#", " ", "or", " ", "last", " ", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "block", "proposal_", "(_", "self_", "._", "head_", "._", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "active", "\\u", "round_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hm_", "=_", "self_", "._", "heights_", "[_", "self_", "._", "height_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "hm_", "._", "rounds_", "[_", "hm_", "._", "round_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "alarm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ar_", "=_", "self_", "._", "active", "\\u", "round_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "ar_", "._", "get", "\\u", "timeout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "in", " ", "set", " ", "up", " ", "alarm", "'_", ",_", "delay_", "=_", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "wait", "ing", "\\u", "for", "\\u", "proposal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "delay_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "chain", "service_", "._", "setup", "\\u", "alarm_", "(_", "delay_", ",_", "self_", "._", "on", "\\u", "alarm_", ",_", "ar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "set", " ", "up", " ", "alarm", " ", "on", " ", "timeo", "ut", "'_", ",_", "now_", "=_", "self_", "._", "chain", "service_", "._", "now_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", "=_", "delay_", ",_", "triggered_", "=_", "delay_", "+_", "self_", "._", "chain", "service_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "chain", "service_", "._", "setup", "\\u", "transaction", "\\u", "alarm_", "(_", "self_", "._", "on", "\\u", "alarm_", ",_", "ar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "set", " ", "up", " ", "alarm", " ", "on", " ", "tx", "'_", ",_", "now_", "=_", "self_", "._", "chain", "service_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "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_", "on", "\\u", "alarm_", "(_", "self_", ",_", "ar_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "ar_", ",_", "Round", "Manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "active", "\\u", "round_", "==_", "ar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "on", " ", "alarm", ",", " ", "matche", "d", "'_", ",_", "ts_", "=_", "self_", "._", "chain", "service_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "defer", " ", "alarm", " ", "if", " ", "not", " ", "ready_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "not", " ", "read", "y", " ", "defer", "ing", " ", "alarm", "'_", ",_", "ts_", "=_", "self_", "._", "chain", "service_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "alarm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "self_", "._", "is", "\\u", "wait", "ing", "\\u", "for", "\\u", "proposal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "defer", " ", "alarm", " ", "if", " ", "there", " ", "are", " ", "no", " ", "pend", "ing", " ", "transactions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "no", " ", "txs", " ", "defer", "ing", " ", "alarm", "'_", ",_", "ts_", "=_", "self_", "._", "chain", "service_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "alarm_", "(_", ")_", "\\u\\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_", "._", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "wait", "ing", "\\u", "for", "\\u", "proposal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "allow", "\\u", "empty", "\\u", "blocks_", "or_", "self_", "._", "has", "\\u", "pend", "ing", "\\u", "transactions_", "or_", "self_", "._", "height_", "<=_", "self_", "._", "num", "\\u", "initial", "\\u", "blocks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "has", "\\u", "pend", "ing", "\\u", "transactions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "chain_", "._", "head", "\\u", "candidate_", "._", "num", "\\u", "transactions_", "(_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "\\u", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'-'_", "*_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "in", " ", "process", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "not", " ", "read", "y", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "alarm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "heights_", "[_", "self_", "._", "height_", "]_", "._", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "commit_", "(_", ")_", ":_", "#", " ", "re", " ", "enter", " ", "process", " ", "if", " ", "we", " ", "did", " ", "commit", " ", "(", "e", ".", "g", ".", " ", "to", " ", "immediate", "ly", " ", "propos", "e", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "synchronize", "r_", "._", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "alarm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "self_", "._", "tracked", "\\u", "protoc", "ol", "\\u", "failures_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "f_", ",_", "Fail", "ed", "To", "Propos", "e", "Evi", "denc", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warn_", "(_", "'", "protoc", "ol", " ", "fail", "ure", "'_", ",_", "incident", "_", "=_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "commit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "in", " ", "commit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "[_", "c_", "for_", "c_", "in_", "self_", "._", "block", "\\u", "candidates_", "._", "values_", "(_", ")_", "if_", "c_", "._", "block_", "._", "prev", "hash_", "==_", "self_", "._", "head_", "._", "hash_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "p_", ",_", "Block", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "=_", "self_", "._", "heights_", "[_", "p_", "._", "height_", "]_", "._", "last", "\\u", "quorum", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", "and_", "ls_", "._", "has", "\\u", "quorum", "_", "==_", "p_", "._", "block", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "store", "\\u", "proposal_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store", "\\u", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "(_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "self_", "._", "chain", "service_", "._", "commit", "\\u", "block_", "(_", "p_", "._", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "(_", "'", "commit", "ed", "'_", ",_", "p_", "=_", "p_", ",_", "hash_", "=_", "ph", "x_", "(_", "p_", "._", "block", "hash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "head_", "==_", "p_", "._", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", ")_", "#", " ", "commit", " ", "all", " ", "possible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "(_", "'", "coul", "d", " ", "not", " ", "commit", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "no", " ", "quorum", " ", "for", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "(_", "'", "vote", "s", "'_", ",_", "votes_", "=_", "ls_", "._", "votes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cleanup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "in", " ", "clean", "up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "self_", "._", "block", "\\u", "candidates_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "head_", "._", "number_", ">=_", "p_", "._", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "block", "\\u", "candidates_", "._", "pop_", "(_", "p_", "._", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "h_", "in_", "list_", "(_", "self_", "._", "heights_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "heights_", "[_", "h_", "]_", "._", "height_", "<_", "self_", "._", "head_", "._", "number_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "heights_", "._", "pop_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mk", "\\u", "lock", "set_", "(_", "self_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Lock", "Set_", "(_", "num", "\\u", "eligible", "\\u", "votes_", "=_", "self_", "._", "contract_", "._", "num", "\\u", "eligible", "\\u", "votes_", "(_", "height_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign_", "(_", "self_", ",_", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "o_", ",_", "Signe", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "o_", "._", "sign_", "(_", "self_", "._", "privkey_", ")_", "\\u\\u\\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_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "consensus", "manager_", ",_", "height_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cm_", "=_", "consensus", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "=_", "self_", "._", "cm_", "._", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "height_", "=_", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rounds_", "=_", "Manager", "Dict_", "(_", "Round", "Manager_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "A", ":", "%", "s", " ", "Creat", "ed", " ", "Hei", "ght", "Manager", " ", "H", ":", "%", "d", "'_", "%_", "(_", "ph", "x_", "(_", "self_", "._", "cm_", "._", "coinbase", "_", ")_", ",_", "self_", "._", "height_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "round_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "last", "\\u", "valid", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "l_", "._", "round_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "lock_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "high", "est", " ", "lock", " ", "on", " ", "height", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs_", "=_", "list_", "(_", "self_", "._", "rounds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "rs_", ")_", "<_", "2_", "or_", "rs_", "[_", "0_", "]_", ">_", "rs_", "[_", "1_", "]_", "#", " ", "FIX", "ME", " ", "REMOVE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "self_", "._", "rounds_", ":_", "#", " ", "is", " ", "sorte", "d", " ", "high", "est", " ", "to", " ", "lowe", "st_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "vote", "d\\u", "block", "proposal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "the", " ", "last", " ", "block", " ", "propos", "al", " ", "node", " ", "vote", "d", " ", "on", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "self_", "._", "rounds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "proposal_", ",_", "Block", "Propos", "al_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock_", ",_", "Vote", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "proposal_", "._", "block", "hash_", "==_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock_", "._", "block", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "proposal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "valid", "\\u", "lock", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "high", "est", " ", "valid", " ", "lock", "set", " ", "on", " ", "height", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "self_", "._", "rounds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", "._", "is", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "quorum", "\\u", "lock", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "sorted_", "(_", "self_", "._", "rounds_", ")_", ":_", "#", " ", "search", " ", "from", " ", "lowe", "st", " ", "round", " ", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", "._", "is", "\\u", "valid_", "and_", "ls_", "._", "has", "\\u", "quorum", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "found_", "is_", "not_", "None_", ":_", "#", " ", "consiste", "nc", "y", " ", "check", ",", " ", "only", " ", "one", " ", "quorum", " ", "on", " ", "block", " ", "allowed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "r_", "in_", "sorted_", "(_", "self_", "._", "rounds_", ")_", ":_", "#", " ", "dump", " ", "all", " ", "lock", "sets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "log_", "(_", "'", "multiple", " ", "valid", " ", "lock", "sets", "'_", ",_", "round_", "=_", "r_", ",_", "ls_", "=_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock", "set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "votes_", "=_", "self_", "._", "rounds_", "[_", "r_", "]_", "._", "lock", "set_", "._", "votes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "found_", "._", "has", "\\u", "quorum", "_", "!=_", "ls_", "._", "has", "\\u", "quorum", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "error_", "(_", "'", "FATAL", ":", " ", "multiple", " ", "valid", " ", "lock", "sets", " ", "on", " ", "different", " ", "proposals", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "found_", "=_", "ls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "has", "\\u", "quorum", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "self_", "._", "last", "\\u", "quorum", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ls_", "._", "has", "\\u", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "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_", "add", "\\u", "vote_", "(_", "self_", ",_", "v_", ",_", "force", "\\u", "replace_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "rounds_", "[_", "v_", "._", "round_", "]_", "._", "add", "\\u", "vote_", "(_", "v_", ",_", "force", "\\u", "replace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "proposal_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "p_", "._", "height_", "==_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "lock", "set_", "._", "is", "\\u", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "._", "round_", ">_", "self_", "._", "round_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "round_", "=_", "p_", "._", "round_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "rounds_", "[_", "p_", "._", "round_", "]_", "._", "add", "\\u", "proposal_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hei", "ght", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "in", " ", "hm", ".", "process", "'_", ",_", "height_", "=_", "self_", "._", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rounds_", "[_", "self_", "._", "round_", "]_", "._", "process_", "(_", ")_", "\\u\\u\\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_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "height", "manager_", ",_", "round", "\\u_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "round", "\\u_", ",_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "round_", "=_", "round", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "hm_", "=_", "height", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cm_", "=_", "height", "manager_", "._", "cm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "=_", "self_", "._", "hm_", "._", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "height_", "=_", "height", "manager_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock", "set_", "=_", "self_", "._", "cm_", "._", "mk", "\\u", "lock", "set_", "(_", "self_", "._", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proposal_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeo", "ut", "\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "A", ":", "%", "s", " ", "Creat", "ed", " ", "Round", "Manager", " ", "H", ":", "%", "d", " ", "R", ":", "%", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ph", "x_", "(_", "self_", "._", "cm_", "._", "coinbase", "_", ")_", ",_", "self_", "._", "hm_", "._", "height_", ",_", "self_", "._", "round_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "timeout_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "setup", " ", "a", " ", "timeo", "ut", " ", "for", " ", "wait", "ing", " ", "for", " ", "a", " ", "propos", "al", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "timeo", "ut", "\\u", "time_", "is_", "not_", "None_", "or_", "self_", "._", "proposal_", ":_", "\\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_", "now_", "=_", "self_", "._", "cm_", "._", "chain", "service_", "._", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "round", "\\u", "timeout_", "=_", "Conse", "nsu", "s", "Manager_", "._", "round", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "round", "\\u", "timeo", "ut", "\\u", "factor_", "=_", "Conse", "nsu", "s", "Manager_", "._", "round", "\\u", "timeo", "ut", "\\u", "factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "round", "\\u", "timeout_", "*_", "round", "\\u", "timeo", "ut", "\\u", "factor_", "**_", "self_", "._", "round_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeo", "ut", "\\u", "time_", "=_", "now_", "+_", "delay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "delay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "vote_", "(_", "self_", ",_", "v_", ",_", "force", "\\u", "replace_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "in_", "self_", "._", "lock", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "rm", ".", "addin", "g", "'_", ",_", "vote_", "=_", "v_", ",_", "receive", "d\\u", "proposal_", "=_", "self_", "._", "proposal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "self_", "._", "lock", "set_", "._", "add_", "(_", "v_", ",_", "force", "\\u", "replace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Inva", "lid", "Vote", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cm_", "._", "tracked", "\\u", "protoc", "ol", "\\u", "failures_", "._", "append_", "(_", "Inva", "lid", "Vote", "Evi", "denc", "e_", "(_", "None_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "report", " ", "fail", "ed", " ", "propos", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "lock", "set_", "._", "is", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "lock", "set", " ", "is", " ", "valid", "'_", ",_", "ls_", "=_", "self_", "._", "lock", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "proposal_", "and_", "self_", "._", "lock", "set_", "._", "has", "\\u", "no", "quorum", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cm_", "._", "tracked", "\\u", "protoc", "ol", "\\u", "failures_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Fail", "ed", "To", "Propos", "e", "Evi", "denc", "e_", "(_", "None_", ",_", "self_", "._", "lock", "set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "proposal_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "rm", ".", "addin", "g", "'_", ",_", "proposal_", "=_", "p_", ",_", "old_", "=_", "self_", "._", "proposal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "p_", ",_", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "p_", ",_", "Vo", "ting", "Instruction_", ")_", "or_", "isinstance_", "(_", "p_", "._", "block_", ",_", "Block_", ")_", "#", " ", "alr", "ead", "y", " ", "linked_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "proposal_", "or_", "self_", "._", "proposal_", "==_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proposal_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "in", " ", "rm", ".", "process", "'_", ",_", "height_", "=_", "self_", "._", "hm_", "._", "height_", ",_", "round_", "=_", "self_", "._", "round_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "cm_", "._", "round_", "==_", "self_", "._", "round_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "cm_", "._", "height_", "==_", "self_", "._", "hm_", "._", "height_", "==_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "self_", "._", "propos", "e_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "p_", ",_", "Block", "Propos", "al_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cm_", "._", "add", "\\u", "block", "\\u", "proposal_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cm_", "._", "broadcast_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "self_", "._", "vote_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cm_", "._", "broadcast_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "self_", "._", "proposal_", "or_", "self_", "._", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mk", "\\u", "proposal_", "(_", "self_", ",_", "round", "\\u", "lock", "set_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signin", "g", "\\u", "lock", "set_", "=_", "self_", "._", "cm_", "._", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "._", "copy_", "(_", ")_", "#", " ", "quorum", " ", "whi", "ch", " ", "signs", " ", "prev", " ", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "round_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "round", "\\u", "lock", "set_", "=_", "self_", "._", "cm_", "._", "last", "\\u", "valid", "\\u", "lock", "set_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "round", "\\u", "lock", "set_", "._", "has", "\\u", "no", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "round", "\\u", "lock", "set_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "signin", "g", "\\u", "lock", "set_", "._", "has", "\\u", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "R0", " ", "(", "std", " ", "case", ")", " ", "we", " ", "only", " ", "need", " ", "one", " ", "lock", "set", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "round", "\\u", "lock", "set_", "is_", "None_", "or_", "self_", "._", "round_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "self_", "._", "cm_", "._", "chain_", "._", "head", "\\u", "candidate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fix", " ", "pow_", "\\u\\u\\uNL\\u\\u\\u_", "block_", "._", "header_", "._", "\\u\\u", "class\\u\\u_", "=_", "HD", "CB", "lock", "Header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "._", "shou", "ld", "\\u", "be", "\\u", "locked_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bp_", "=_", "Block", "Propos", "al_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ",_", "block_", ",_", "signin", "g", "\\u", "lock", "set_", ",_", "round", "\\u", "lock", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cm_", "._", "sign_", "(_", "bp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cm_", "._", "set\\u", "propos", "al", "\\u", "lock_", "(_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "cm_", "._", "chain", "service_", "._", "propos", "al", "\\u", "lock_", "._", "locked_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "propos", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "cm_", "._", "is", "\\u", "wait", "ing", "\\u", "for", "\\u", "proposal_", ":_", "\\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_", "propos", "er_", "=_", "self_", "._", "cm_", "._", "contract_", "._", "propos", "er_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "in", " ", "propos", "e", "'_", ",_", "propos", "er_", "=_", "ph", "x_", "(_", "propos", "er_", ")_", ",_", "proposal_", "=_", "self_", "._", "proposal_", ",_", "lock_", "=_", "self_", "._", "lock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "propos", "er_", "!=_", "self_", "._", "cm_", "._", "coinbase", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "is", " ", "propos", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "proposal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "proposal_", "._", "sender_", "==_", "self_", "._", "cm_", "._", "coinbase", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "round", "\\u", "lock", "set_", "=_", "self_", "._", "cm_", "._", "last", "\\u", "valid", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "round", "\\u", "lock", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "no", " ", "valid", " ", "round", " ", "lock", "set", " ", "for", " ", "height", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "in", " ", "creati", "ng", " ", "propos", "al", "'_", ",_", "round", "\\u", "lock", "set_", "=_", "round", "\\u", "lock", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "round", "\\u", "lock", "set_", "._", "height_", "==_", "self_", "._", "height_", "and_", "round", "\\u", "lock", "set_", "._", "has", "\\u", "quorum", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "have", " ", "quorum", " ", "on", " ", "height", ",", " ", "not", " ", "propos", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "round_", "==_", "0_", "or_", "round", "\\u", "lock", "set_", "._", "has", "\\u", "no", "quorum", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proposal_", "=_", "self_", "._", "mk", "\\u", "proposal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "round", "\\u", "lock", "set_", "._", "has", "\\u", "quorum", "\\u", "possible_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proposal_", "=_", "Vo", "ting", "Instruction_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ",_", "round", "\\u", "lock", "set_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cm_", "._", "sign_", "(_", "proposal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "invalid", " ", "round", "\\u", "lock", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "created", " ", "propos", "al", "'_", ",_", "p_", "=_", "proposal_", ",_", "bh_", "=_", "ph", "x_", "(_", "proposal_", "._", "block", "hash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proposal_", "=_", "proposal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "proposal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Round", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "vote_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "#", " ", "vote", "d", " ", "in", " ", "this", " ", "round_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "in", " ", "vote", "'_", ",_", "proposal_", "=_", "self_", "._", "proposal_", ",_", "pid_", "=_", "id_", "(_", "self_", "._", "proposal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "last", " ", "lock", " ", "on", " ", "height_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "lock_", "=_", "self_", "._", "hm_", "._", "last", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "proposal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "self_", "._", "proposal_", ",_", "Vo", "ting", "Instruction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "proposal_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "\\u", "possible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "voting", " ", "on", " ", "instruct", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Vote", "Block_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ",_", "self_", "._", "proposal_", "._", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "last", "\\u", "lock_", ",_", "Vote", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "self_", "._", "proposal_", ",_", "Block", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "self_", "._", "proposal_", "._", "block_", ",_", "Block_", ")_", "#", " ", "alr", "ead", "y", " ", "linked", " ", "to", " ", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "proposal_", "._", "lock", "set_", "._", "has", "\\u", "no", "quorum", "_", "or_", "self_", "._", "round_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "proposal_", "._", "block_", "._", "prev", "hash_", "==_", "self_", "._", "cm_", "._", "head_", "._", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "voting", " ", "proposed", " ", "block", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Vote", "Block_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ",_", "self_", "._", "proposal_", "._", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "repeat", " ", "vote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "voting", " ", "on", " ", "last", " ", "vote", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Vote", "Block_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ",_", "last", "\\u", "lock_", "._", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "timeo", "ut", "\\u", "time_", "is_", "not_", "None_", "and_", "self_", "._", "cm_", "._", "chain", "service_", "._", "now_", ">=_", "self_", "._", "timeo", "ut", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "last", "\\u", "lock_", ",_", "Vote", "Block_", ")_", ":_", "#", " ", "repeat", " ", "vote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "timeo", "ut", " ", "voting", " ", "on", " ", "last", " ", "vote", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Vote", "Block_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ",_", "last", "\\u", "lock_", "._", "block", "hash_", ")_", "\\u\\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_", "._", "log_", "(_", "'", "timeo", "ut", " ", "voting", " ", "not", " ", "lock", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Vote", "Ni", "l_", "(_", "self_", "._", "height_", ",_", "self_", "._", "round_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "self_", "._", "cm_", "._", "sign_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "vote", "d", "'_", ",_", "vote_", "=_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "hm_", "._", "last", "\\u", "lock_", "==_", "self_", "._", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock", "set_", "._", "add_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "v_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
sebleier/django-redis-cache/redis_cache/backends/single.py
[ { "content": " def clear(self, version=None):\n \"\"\"Flush cache keys.\n\n If version is specified, all keys belonging the version's key\n namespace will be deleted. Otherwise, all keys will be deleted.\n \"\"\"\n if version is None:\n self._clear(self.master_client)\n else:\n self.delete_pattern('*', version=version)", "metadata": "root.RedisCache.clear", "header": "['class', 'RedisCache', '(', 'BaseRedisCache', ')', ':', '___EOS___']", "index": 41 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Red", "is", "Cache_", "(_", "Base", "Red", "is", "Cache_", ")_", ":_", "\\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_", "clear_", "(_", "self_", ",_", "version_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Flu", "sh", " ", "cache", " ", "keys", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "version", " ", "is", " ", "specified", ",", " ", "all", " ", "keys", " ", "belonging", " ", "the", " ", "version", "'", "s", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "namespace", " ", "will", " ", "be", " ", "delete", "d", ".", " ", " ", "Ot", "her", "wis", "e", ",", " ", "all", " ", "keys", " ", "will", " ", "be", " ", "delete", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "version_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "clear_", "(_", "self_", "._", "master", "\\u", "client_", ")_", "\\u\\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_", "._", "delete", "\\u", "pattern_", "(_", "'*'_", ",_", "version_", "=_", "version_", ")_", "\\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 ]
Unused import
wrobstory/climatic/climatic/plottools.py
[ { "content": " # -*- coding: utf-8 -*-\n\n'''\nClimatic plotting tools\n_________\nA micro toolbox of wind data plotting tools with matplotlib\n\n'''\nfrom __future__ import division\nimport math\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport stylers\nimport husl\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def husl_gen():\n '''Generate random set of HUSL colors, one dark, one light'''\n hue = np.random.randint(0, 360)\n saturation, lightness = np.random.randint(0, 100, 2)\n husl_dark = husl.husl_to_hex(hue, saturation, lightness/3)\n husl_light = husl.husl_to_hex(hue, saturation, lightness)\n return husl_dark, husl_light", "metadata": "root.husl_gen", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def wind_rose(freqs, sectors=12, title='Wind Rose', color=None,\n all_ticks=False):\n '''\n Plots a wind rose using sectorwise frequencies\n\n Parameters:\n ___________\n freqs: numpy array, list, or pandas series of float or int\n Array of frequencies to plot for wind rose\n sectors: int\n Number of sectors to plot. Must be the same as len(freqs) to\n avoid error\n title: string\n Plot title\n color: string, default None\n Plot color, from standard matplotlib color library\n all_ticks: boolean, default False\n Enabling this parameter will plot ticks for every sector. Otherwise,\n only 30 degree ticks are plotted\n\n Returns:\n ________\n Wind rose plot\n '''\n\n #Set up binned frequencies and labels\n bins = 360/sectors\n theta = np.arange(0, 360, bins)\n theta_rad = theta*math.pi/180\n if all_ticks:\n ticklabs = [str(x) for x in theta]\n ticks = theta\n else:\n ticklabs, ticks = np.arange(0, 360, 30), np.arange(0, 360, 30)\n\n #Plot, with N correctly oriented\n fig = plt.figure(figsize=(8, 8))\n ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)\n ax.set_theta_zero_location('N')\n ax.set_theta_direction(-1)\n ax.set_thetagrids(ticks, labels=ticklabs)\n ax.set_title(title)\n ax.grid(True, 'major', color='w', linestyle='-', linewidth=0.7)\n ax.patch.set_facecolor('0.90')\n ax.set_axisbelow(True)\n width = bins*math.pi/180\n adj_theta = theta_rad-width/2\n stylers.rbar(ax, adj_theta, freqs, width=width, bottom=0.0, alpha=0.7,\n color=color)", "metadata": "root.wind_rose", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def weibull(x, dist, binned=False, binned_x=None, binned_data=None, **kwargs):\n '''\n Plots a weibull distribution, both the pdf and binned values\n\n Parameters:\n ___________\n x: array of float or int\n x-axis array, independent axis\n dist: scipy.stats pdf\n pdf of distribution, generated by scipy.stats\n binned: boolean, default False\n True if you want to plot both the continuous distribution and\n the hourly distribution\n binned_x: array of float or int, default None\n x-axis array for binned data, optional\n binned_data: array of float or int, default none\n binned data, to plot over pdf\n\n Returns:\n ________\n Plot of weibull distribution\n '''\n\n fig, ax1 = plt.subplots()\n ax2 = None\n\n if binned:\n bin_width = binned_x[1]-binned_x[0]\n stylers.rbar(ax1, binned_x, binned_data, width=bin_width, **kwargs)\n stylers.rstyle(ax1)\n ax1.set_xlabel(r'Wind Speed [m/s]', fontsize=12)\n ax1.set_ylabel(r'Hours', fontsize=12)\n ax2 = ax1.twinx()\n\n if ax2:\n pdfax = ax2\n else:\n pdfax = ax1\n\n pdfax.set_xlim((0, 40))\n stylers.rfill(pdfax, x, dist,)\n if not ax2:\n stylers.rstyle(pdfax)\n pdfax.set_ylabel(r'PDF', fontsize=12)", "metadata": "root.weibull", "header": "['module', '___EOS___']", "index": 76 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\", "652", "7", "9", ";_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Clim", "atic", " ", "plott", "ing", " ", "tool", "s", "\\", "10", ";", "\\u\\u\\u\\u\\u\\u\\u\\u\\u\\", "10", ";", "A", " ", "micro", " ", "toolb", "ox", " ", "of", " ", "wind", " ", "data", " ", "plott", "ing", " ", "tool", "s", " ", "with", " ", "mat", "plotlib", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\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_", "import_", "style", "rs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hus", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "hus", "l\\u", "gen_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Generate", " ", "random", " ", "set", " ", "of", " ", "HU", "SL", " ", "colors", ",", " ", "one", " ", "dark", ",", " ", "one", " ", "light", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hue_", "=_", "np_", "._", "random_", "._", "randint_", "(_", "0_", ",_", "360_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saturation", "_", ",_", "light", "ness_", "=_", "np_", "._", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hus", "l\\u", "dark", "_", "=_", "hus", "l_", "._", "hus", "l\\u", "to", "\\u", "hex_", "(_", "hue_", ",_", "saturation", "_", ",_", "light", "ness_", "/_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hus", "l\\u", "light_", "=_", "hus", "l_", "._", "hus", "l\\u", "to", "\\u", "hex_", "(_", "hue_", ",_", "saturation", "_", ",_", "light", "ness_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "hus", "l\\u", "dark", "_", ",_", "hus", "l\\u", "light_", "\\u\\u\\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_", "wind", "\\u", "rose", "_", "(_", "freqs_", ",_", "sectors", "_", "=_", "12_", ",_", "title_", "=_", "'", "Wind", " ", "Rose", "'_", ",_", "color_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "ticks_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Plot", "s", " ", "a", " ", "wind", " ", "rose", " ", "usi", "ng", " ", "sect", "or", "wis", "e", " ", "freque", "ncie", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u\\u\\u\\u\\u\\u\\u\\u\\", "u\\u", "\\", "10", ";", " ", " ", " ", " ", "freqs", ":", " ", "nump", "y", " ", "array", ",", " ", "list", ",", " ", "or", " ", "panda", "s", " ", "series", " ", "of", " ", "float", " ", "or", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Array", " ", "of", " ", "freque", "ncie", "s", " ", "to", " ", "plot", " ", "for", " ", "wind", " ", "rose", "\\", "10", ";", " ", " ", " ", " ", "sectors", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Number", " ", "of", " ", "sectors", " ", "to", " ", "plot", ".", " ", "Mus", "t", " ", "be", " ", "the", " ", "same", " ", "as", " ", "len", "(", "freqs", ")", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "avoid", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "title", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Plot", " ", "title", "\\", "10", ";", " ", " ", " ", " ", "color", ":", " ", "string", ",", " ", "default", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Plot", " ", "color", ",", " ", "from", " ", "standard", " ", "mat", "plotlib", " ", "color", " ", "librar", "y", "\\", "10", ";", " ", " ", " ", " ", "all", "\\u", "tick", "s", ":", " ", "boolean", ",", " ", "default", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "En", "abl", "ing", " ", "this", " ", "parameter", " ", "will", " ", "plot", " ", "tick", "s", " ", "for", " ", "every", " ", "sect", "or", ".", " ", "Ot", "her", "wis", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "30", " ", "degr", "ee", " ", "tick", "s", " ", "are", " ", "plott", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u\\u\\u\\u\\u\\u\\u", "\\", "10", ";", " ", " ", " ", " ", "Wind", " ", "rose", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Set", " ", "up", " ", "binned", " ", "freque", "ncie", "s", " ", "and", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "bins_", "=_", "360_", "/_", "sectors", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theta_", "=_", "np_", "._", "arange_", "(_", "0_", ",_", "360_", ",_", "bins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theta", "\\u", "rad_", "=_", "theta_", "*_", "math_", "._", "pi_", "/_", "180_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all", "\\u", "ticks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tickl", "abs_", "=_", "[_", "str_", "(_", "x_", ")_", "for_", "x_", "in_", "theta_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ticks_", "=_", "theta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tickl", "abs_", ",_", "ticks_", "=_", "np_", "._", "arange_", "(_", "0_", ",_", "360_", ",_", "30_", ")_", ",_", "np_", "._", "arange_", "(_", "0_", ",_", "360_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Plot", ",", " ", "with", " ", "N", " ", "correct", "ly", " ", "orient", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "8_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "axes_", "(_", "[_", "0.1_", ",_", "0.1_", ",_", "0.8_", ",_", "0.8_", "]_", ",_", "polar", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "theta", "\\u", "zero", "\\u", "location_", "(_", "'", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "theta", "\\u", "direction_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "theta", "grids_", "(_", "ticks_", ",_", "labels_", "=_", "tickl", "abs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "title_", "(_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "grid_", "(_", "True_", ",_", "'", "major", "'_", ",_", "color_", "=_", "'", "w", "'_", ",_", "linestyle_", "=_", "'-'_", ",_", "linewidth_", "=_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "patch_", "._", "set\\u", "facecolor_", "(_", "'", "0.90", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "axis", "below_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "bins_", "*_", "math_", "._", "pi_", "/_", "180_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adj", "\\u", "theta_", "=_", "theta", "\\u", "rad_", "-_", "width_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "rs_", "._", "rba", "r_", "(_", "ax_", ",_", "adj", "\\u", "theta_", ",_", "freqs_", ",_", "width_", "=_", "width_", ",_", "bottom_", "=_", "0.0_", ",_", "alpha_", "=_", "0.7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "color_", ")_", "\\u\\u\\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_", "wei", "bull", "_", "(_", "x_", ",_", "dist_", ",_", "binned", "_", "=_", "False_", ",_", "binned", "\\u", "x_", "=_", "None_", ",_", "binned", "\\u", "data_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Plot", "s", " ", "a", " ", "wei", "bull", " ", "distribu", "tion", ",", " ", "bot", "h", " ", "the", " ", "pdf", " ", "and", " ", "binned", " ", "values", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u\\u\\u\\u\\u\\u\\u\\u\\", "u\\u", "\\", "10", ";", " ", " ", " ", " ", "x", ":", " ", "array", " ", "of", " ", "float", " ", "or", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "x", "-", "axis", " ", "array", ",", " ", "independent", " ", "axis", "\\", "10", ";", " ", " ", " ", " ", "dist", ":", " ", "sci", "py", ".", "stats", " ", "pdf", "\\", "10", ";", " ", " ", " ", " ", "pdf", " ", "of", " ", "distribu", "tion", ",", " ", "generat", "ed", " ", "by", " ", "sci", "py", ".", "stats", "\\", "10", ";", " ", " ", " ", " ", "binned", ":", " ", "boolean", ",", " ", "default", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "if", " ", "you", " ", "want", " ", "to", " ", "plot", " ", "bot", "h", " ", "the", " ", "continuous", " ", "distribu", "tion", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "hour", "ly", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", "binned", "\\u", "x", ":", " ", "array", " ", "of", " ", "float", " ", "or", " ", "int", ",", " ", "default", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "x", "-", "axis", " ", "array", " ", "for", " ", "binned", " ", "data", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "binned", "\\u", "data", ":", " ", "array", " ", "of", " ", "float", " ", "or", " ", "int", ",", " ", "default", " ", "none", "\\", "10", ";", " ", " ", " ", " ", "binned", " ", "data", ",", " ", "to", " ", "plot", " ", "over", " ", "pdf", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u\\u\\u\\u\\u\\u\\u", "\\", "10", ";", " ", " ", " ", " ", "Plot", " ", "of", " ", "wei", "bull", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax1_", "=_", "plt_", "._", "subplots_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "binned", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bin", "\\u", "width_", "=_", "binned", "\\u", "x_", "[_", "1_", "]_", "-_", "binned", "\\u", "x_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "rs_", "._", "rba", "r_", "(_", "ax1_", ",_", "binned", "\\u", "x_", ",_", "binned", "\\u", "data_", ",_", "width_", "=_", "bin", "\\u", "width_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "rs_", "._", "rst", "yle", "_", "(_", "ax1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax1_", "._", "set\\u", "xlabel_", "(_", "r", "'", "Wind", " ", "Spee", "d", " ", "[", "m", "/", "s", "]'_", ",_", "fontsize_", "=_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax1_", "._", "set\\u", "ylabel_", "(_", "r", "'", "Hour", "s", "'_", ",_", "fontsize_", "=_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "=_", "ax1_", "._", "twin", "x_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ax2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdf", "ax_", "=_", "ax2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdf", "ax_", "=_", "ax1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pdf", "ax_", "._", "set\\u", "xlim_", "(_", "(_", "0_", ",_", "40_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "rs_", "._", "rfil", "l_", "(_", "pdf", "ax_", ",_", "x_", ",_", "dist_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ax2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "style", "rs_", "._", "rst", "yle", "_", "(_", "pdf", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pdf", "ax_", "._", "set\\u", "ylabel_", "(_", "r", "'", "PD", "F", "'_", ",_", "fontsize_", "=_", "12_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
openstack/ironic/ironic/tests/unit/drivers/modules/ilo/test_inspect.py
[ { "content": "# Copyright 2014 Hewlett-Packard Development Company, L.P.\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\n\"\"\"Test class for Management Interface used by iLO modules.\"\"\"\n\nimport mock\nfrom oslo_config import cfg\nimport six\n\nfrom ironic.common import exception\nfrom ironic.common import states\nfrom ironic.common import utils\nfrom ironic.conductor import task_manager\nfrom ironic.conductor import utils as conductor_utils\nfrom ironic.db import api as dbapi\nfrom ironic.drivers.modules.ilo import common as ilo_common\nfrom ironic.drivers.modules.ilo import inspect as ilo_inspect\nfrom ironic.drivers.modules.ilo import power as ilo_power\nfrom ironic.tests.unit.conductor import mgr_utils\nfrom ironic.tests.unit.db import base as db_base\nfrom ironic.tests.unit.db import utils as db_utils\nfrom ironic.tests.unit.objects import utils as obj_utils\n\n\nINFO_DICT = db_utils.get_test_ilo_info()\nCONF = cfg.CONF\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class IloInspectTestCase(db_base.DbTestCase):\n\n\n\n\n\n\n", "metadata": "root.IloInspectTestCase", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def setUp(self):\n super(IloInspectTestCase, self).setUp()\n mgr_utils.mock_the_extension_manager(driver=\"fake_ilo\")\n self.node = obj_utils.create_test_node(\n self.context, driver='fake_ilo', driver_info=INFO_DICT)", "metadata": "root.IloInspectTestCase.setUp", "header": "['class', 'IloInspectTestCase', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_get_properties(self):\n with task_manager.acquire(self.context, self.node.uuid,\n shared=False) as task:\n properties = ilo_common.REQUIRED_PROPERTIES.copy()\n self.assertEqual(properties,\n task.driver.inspect.get_properties())", "metadata": "root.IloInspectTestCase.test_get_properties", "header": "['class', 'IloInspectTestCase', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " @mock.patch.object(ilo_common, 'parse_driver_info', spec_set=True,\n autospec=True)\n def test_validate(self, driver_info_mock):\n with task_manager.acquire(self.context, self.node.uuid,\n shared=False) as task:\n task.driver.inspect.validate(task)\n driver_info_mock.assert_called_once_with(task.node)", "metadata": "root.IloInspectTestCase.test_validate", "header": "['class', 'IloInspectTestCase', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " @mock.patch.object(ilo_inspect, '_get_capabilities', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_inspect, '_create_ports_if_not_exist',\n spec_set=True, autospec=True)\n @mock.patch.object(ilo_inspect, '_get_essential_properties', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_power.IloPower, 'get_power_state', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,\n autospec=True)\n def test_inspect_essential_ok(self, get_ilo_object_mock,\n power_mock,\n get_essential_mock,\n create_port_mock,\n get_capabilities_mock):\n ilo_object_mock = get_ilo_object_mock.return_value\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n capabilities = ''\n result = {'properties': properties, 'macs': macs}\n get_essential_mock.return_value = result\n get_capabilities_mock.return_value = capabilities\n power_mock.return_value = states.POWER_ON\n with task_manager.acquire(self.context, self.node.uuid,\n shared=False) as task:\n task.driver.inspect.inspect_hardware(task)\n self.assertEqual(properties, task.node.properties)\n power_mock.assert_called_once_with(mock.ANY, task)\n get_essential_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n get_capabilities_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n create_port_mock.assert_called_once_with(task.node, macs)", "metadata": "root.IloInspectTestCase.test_inspect_essential_ok", "header": "['class', 'IloInspectTestCase', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " @mock.patch.object(ilo_inspect, '_get_capabilities', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_inspect, '_create_ports_if_not_exist',\n spec_set=True, autospec=True)\n @mock.patch.object(ilo_inspect, '_get_essential_properties', spec_set=True,\n autospec=True)\n @mock.patch.object(conductor_utils, 'node_power_action', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_power.IloPower, 'get_power_state', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,\n autospec=True)\n def test_inspect_essential_ok_power_off(self, get_ilo_object_mock,\n power_mock,\n set_power_mock,\n get_essential_mock,\n create_port_mock,\n get_capabilities_mock):\n ilo_object_mock = get_ilo_object_mock.return_value\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n capabilities = ''\n result = {'properties': properties, 'macs': macs}\n get_essential_mock.return_value = result\n get_capabilities_mock.return_value = capabilities\n power_mock.return_value = states.POWER_OFF\n with task_manager.acquire(self.context, self.node.uuid,\n shared=False) as task:\n task.driver.inspect.inspect_hardware(task)\n self.assertEqual(properties, task.node.properties)\n power_mock.assert_called_once_with(mock.ANY, task)\n set_power_mock.assert_any_call(task, states.POWER_ON)\n get_essential_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n get_capabilities_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n create_port_mock.assert_called_once_with(task.node, macs)", "metadata": "root.IloInspectTestCase.test_inspect_essential_ok_power_off", "header": "['class', 'IloInspectTestCase', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " @mock.patch.object(ilo_inspect, '_get_capabilities', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_inspect, '_create_ports_if_not_exist',\n spec_set=True, autospec=True)\n @mock.patch.object(ilo_inspect, '_get_essential_properties', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_power.IloPower, 'get_power_state', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,\n autospec=True)\n def test_inspect_essential_capabilities_ok(self, get_ilo_object_mock,\n power_mock,\n get_essential_mock,\n create_port_mock,\n get_capabilities_mock):\n ilo_object_mock = get_ilo_object_mock.return_value\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n capability_str = 'BootMode:uefi'\n capabilities = {'BootMode': 'uefi'}\n result = {'properties': properties, 'macs': macs}\n get_essential_mock.return_value = result\n get_capabilities_mock.return_value = capabilities\n power_mock.return_value = states.POWER_ON\n with task_manager.acquire(self.context, self.node.uuid,\n shared=False) as task:\n task.driver.inspect.inspect_hardware(task)\n expected_properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64',\n 'capabilities': capability_str}\n self.assertEqual(expected_properties, task.node.properties)\n power_mock.assert_called_once_with(mock.ANY, task)\n get_essential_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n get_capabilities_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n create_port_mock.assert_called_once_with(task.node, macs)", "metadata": "root.IloInspectTestCase.test_inspect_essential_capabilities_ok", "header": "['class', 'IloInspectTestCase', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 137 }, { "content": " @mock.patch.object(ilo_inspect, '_get_capabilities', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_inspect, '_create_ports_if_not_exist',\n spec_set=True, autospec=True)\n @mock.patch.object(ilo_inspect, '_get_essential_properties', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_power.IloPower, 'get_power_state', spec_set=True,\n autospec=True)\n @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,\n autospec=True)\n def test_inspect_essential_capabilities_exist_ok(self, get_ilo_object_mock,\n power_mock,\n get_essential_mock,\n create_port_mock,\n get_capabilities_mock):\n ilo_object_mock = get_ilo_object_mock.return_value\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64',\n 'somekey': 'somevalue'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n result = {'properties': properties, 'macs': macs}\n capabilities = {'BootMode': 'uefi'}\n get_essential_mock.return_value = result\n get_capabilities_mock.return_value = capabilities\n power_mock.return_value = states.POWER_ON\n with task_manager.acquire(self.context, self.node.uuid,\n shared=False) as task:\n task.node.properties = {'capabilities': 'foo:bar'}\n expected_capabilities = ('BootMode:uefi,'\n 'foo:bar')\n set1 = set(expected_capabilities.split(','))\n task.driver.inspect.inspect_hardware(task)\n end_capabilities = task.node.properties['capabilities']\n set2 = set(end_capabilities.split(','))\n self.assertEqual(set1, set2)\n expected_properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64',\n 'capabilities': end_capabilities}\n power_mock.assert_called_once_with(mock.ANY, task)\n self.assertEqual(task.node.properties, expected_properties)\n get_essential_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n get_capabilities_mock.assert_called_once_with(task.node,\n ilo_object_mock)\n create_port_mock.assert_called_once_with(task.node, macs)", "metadata": "root.IloInspectTestCase.test_inspect_essential_capabilities_exist_ok", "header": "['class', 'IloInspectTestCase', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 176 }, { "content": "class TestInspectPrivateMethods(db_base.DbTestCase):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestInspectPrivateMethods", "header": "['module', '___EOS___']", "index": 223 }, { "content": " def setUp(self):\n super(TestInspectPrivateMethods, self).setUp()\n mgr_utils.mock_the_extension_manager(driver=\"fake_ilo\")\n self.node = obj_utils.create_test_node(\n self.context, driver='fake_ilo', driver_info=INFO_DICT)", "metadata": "root.TestInspectPrivateMethods.setUp", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 225 }, { "content": " @mock.patch.object(ilo_inspect.LOG, 'info', spec_set=True, autospec=True)\n @mock.patch.object(dbapi, 'get_instance', spec_set=True, autospec=True)\n def test__create_ports_if_not_exist(self, instance_mock, log_mock):\n db_obj = instance_mock.return_value\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n node_id = self.node.id\n port_dict1 = {'address': 'aa:aa:aa:aa:aa:aa', 'node_id': node_id}\n port_dict2 = {'address': 'bb:bb:bb:bb:bb:bb', 'node_id': node_id}\n ilo_inspect._create_ports_if_not_exist(self.node, macs)\n instance_mock.assert_called_once_with()\n self.assertTrue(log_mock.called)\n db_obj.create_port.assert_any_call(port_dict1)\n db_obj.create_port.assert_any_call(port_dict2)", "metadata": "root.TestInspectPrivateMethods.test__create_ports_if_not_exist", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 231 }, { "content": " @mock.patch.object(ilo_inspect.LOG, 'warning',\n spec_set=True, autospec=True)\n @mock.patch.object(dbapi, 'get_instance', spec_set=True, autospec=True)\n def test__create_ports_if_not_exist_mac_exception(self,\n instance_mock,\n log_mock):\n dbapi_mock = instance_mock.return_value\n dbapi_mock.create_port.side_effect = exception.MACAlreadyExists('f')\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n ilo_inspect._create_ports_if_not_exist(self.node, macs)\n instance_mock.assert_called_once_with()\n self.assertTrue(log_mock.called)", "metadata": "root.TestInspectPrivateMethods.test__create_ports_if_not_exist_mac_exception", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test__get_essential_properties_ok(self):\n ilo_mock = mock.MagicMock(spec=['get_essential_properties'])\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n result = {'properties': properties, 'macs': macs}\n ilo_mock.get_essential_properties.return_value = result\n actual_result = ilo_inspect._get_essential_properties(self.node,\n ilo_mock)\n self.assertEqual(result, actual_result)", "metadata": "root.TestInspectPrivateMethods.test__get_essential_properties_ok", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 258 }, { "content": " def test__get_essential_properties_fail(self):\n ilo_mock = mock.MagicMock(\n spec=['get_additional_capabilities', 'get_essential_properties'])\n # Missing key: cpu_arch\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}\n result = {'properties': properties, 'macs': macs}\n ilo_mock.get_essential_properties.return_value = result\n result = self.assertRaises(exception.HardwareInspectionFailure,\n ilo_inspect._get_essential_properties,\n self.node,\n ilo_mock)\n self.assertEqual(\n six.text_type(result),\n (\"Failed to inspect hardware. Reason: Server didn't return the \"\n \"key(s): cpu_arch\"))", "metadata": "root.TestInspectPrivateMethods.test__get_essential_properties_fail", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 269 }, { "content": " def test__get_essential_properties_fail_invalid_format(self):\n ilo_mock = mock.MagicMock(\n spec=['get_additional_capabilities', 'get_essential_properties'])\n # Not a dict\n properties = ['memory_mb', '512', 'local_gb', '10',\n 'cpus', '1']\n macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb']\n capabilities = ''\n result = {'properties': properties, 'macs': macs}\n ilo_mock.get_essential_properties.return_value = result\n ilo_mock.get_additional_capabilities.return_value = capabilities\n self.assertRaises(exception.HardwareInspectionFailure,\n ilo_inspect._get_essential_properties,\n self.node, ilo_mock)", "metadata": "root.TestInspectPrivateMethods.test__get_essential_properties_fail_invalid_format", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 287 }, { "content": " def test__get_essential_properties_fail_mac_invalid_format(self):\n ilo_mock = mock.MagicMock(spec=['get_essential_properties'])\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64'}\n # Not a dict\n macs = 'aa:aa:aa:aa:aa:aa'\n result = {'properties': properties, 'macs': macs}\n ilo_mock.get_essential_properties.return_value = result\n self.assertRaises(exception.HardwareInspectionFailure,\n ilo_inspect._get_essential_properties,\n self.node, ilo_mock)", "metadata": "root.TestInspectPrivateMethods.test__get_essential_properties_fail_mac_invalid_format", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 302 }, { "content": " def test__get_essential_properties_hardware_port_empty(self):\n ilo_mock = mock.MagicMock(\n spec=['get_additional_capabilities', 'get_essential_properties'])\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64'}\n # Not a dictionary\n macs = None\n result = {'properties': properties, 'macs': macs}\n capabilities = ''\n ilo_mock.get_essential_properties.return_value = result\n ilo_mock.get_additional_capabilities.return_value = capabilities\n self.assertRaises(exception.HardwareInspectionFailure,\n ilo_inspect._get_essential_properties,\n self.node, ilo_mock)", "metadata": "root.TestInspectPrivateMethods.test__get_essential_properties_hardware_port_empty", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 314 }, { "content": " def test__get_essential_properties_hardware_port_not_dict(self):\n ilo_mock = mock.MagicMock(spec=['get_essential_properties'])\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1', 'cpu_arch': 'x86_64'}\n # Not a dict\n macs = 'aa:bb:cc:dd:ee:ff'\n result = {'properties': properties, 'macs': macs}\n ilo_mock.get_essential_properties.return_value = result\n result = self.assertRaises(\n exception.HardwareInspectionFailure,\n ilo_inspect._get_essential_properties, self.node, ilo_mock)", "metadata": "root.TestInspectPrivateMethods.test__get_essential_properties_hardware_port_not_dict", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 329 }, { "content": " @mock.patch.object(utils, 'get_updated_capabilities', spec_set=True,\n autospec=True)\n def test__get_capabilities_ok(self, capability_mock):\n ilo_mock = mock.MagicMock(spec=['get_server_capabilities'])\n capabilities = {'ilo_firmware_version': 'xyz'}\n ilo_mock.get_server_capabilities.return_value = capabilities\n cap = ilo_inspect._get_capabilities(self.node, ilo_mock)\n self.assertEqual(cap, capabilities)", "metadata": "root.TestInspectPrivateMethods.test__get_capabilities_ok", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 341 }, { "content": " def test__validate_ok(self):\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '2', 'cpu_arch': 'x86_arch'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa'}\n data = {'properties': properties, 'macs': macs}\n valid_keys = ilo_inspect.IloInspect.ESSENTIAL_PROPERTIES\n ilo_inspect._validate(self.node, data)\n self.assertEqual(sorted(set(properties)), sorted(valid_keys))", "metadata": "root.TestInspectPrivateMethods.test__validate_ok", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 350 }, { "content": " def test__validate_essential_keys_fail_missing_key(self):\n properties = {'memory_mb': '512', 'local_gb': '10',\n 'cpus': '1'}\n macs = {'Port 1': 'aa:aa:aa:aa:aa:aa'}\n data = {'properties': properties, 'macs': macs}\n self.assertRaises(exception.HardwareInspectionFailure,\n ilo_inspect._validate, self.node, data)", "metadata": "root.TestInspectPrivateMethods.test__validate_essential_keys_fail_missing_key", "header": "['class', 'TestInspectPrivateMethods', '(', 'db_base', '.', 'DbTestCase', ')', ':', '___EOS___']", "index": 359 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "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", "\");", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", " ", "class", " ", "for", " ", "Manage", "ment", " ", "Interface", " ", "used", " ", "by", " ", "i", "LO", " ", "module", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "config_", "import_", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ironic_", "._", "common_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "common_", "import_", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "common_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "conductor", "_", "import_", "task", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "conductor", "_", "import_", "utils_", "as_", "conductor", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "db_", "import_", "api_", "as_", "dbapi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "drivers_", "._", "modules_", "._", "ilo", "_", "import_", "common_", "as_", "ilo", "\\u", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "drivers_", "._", "modules_", "._", "ilo", "_", "import_", "inspect_", "as_", "ilo", "\\u", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "drivers_", "._", "modules_", "._", "ilo", "_", "import_", "power_", "as_", "ilo", "\\u", "power_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "conductor", "_", "import_", "mgr", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "db_", "import_", "base_", "as_", "db", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "db_", "import_", "utils_", "as_", "db", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "objects_", "import_", "utils_", "as_", "obj", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INFO", "\\u", "DICT_", "=_", "db", "\\u", "utils_", "._", "get", "\\u", "test\\u", "ilo", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Il", "o", "Inspect", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr", "\\u", "utils_", "._", "mock", "\\u", "the", "\\u", "extensi", "on", "\\u", "manager_", "(_", "driver_", "=_", "\"", "fake", "\\u", "ilo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "node_", "=_", "obj", "\\u", "utils_", "._", "create", "\\u", "test\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", ",_", "driver_", "=_", "'", "fake", "\\u", "ilo", "'_", ",_", "driver", "\\u", "info_", "=_", "INFO", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "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", "properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "task", "\\u", "manager_", "._", "acquire_", "(_", "self_", "._", "context_", ",_", "self_", "._", "node_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared_", "=_", "False_", ")_", "as_", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "ilo", "\\u", "common_", "._", "REQUIRE", "D", "\\u", "PROPERTIES_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "._", "driver_", "._", "inspect_", "._", "get", "\\u", "properties_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "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_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "common_", ",_", "'", "parse", "\\u", "driver", "\\u", "info", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "validate_", "(_", "self_", ",_", "driver", "\\u", "info", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "task", "\\u", "manager_", "._", "acquire_", "(_", "self_", "._", "context_", ",_", "self_", "._", "node_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared_", "=_", "False_", ")_", "as_", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "driver_", "._", "inspect_", "._", "validate_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver", "\\u", "info", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "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_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "capab", "ilities", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "power_", "._", "Il", "o", "Power_", ",_", "'", "get", "\\u", "power", "\\u", "state", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "common_", ",_", "'", "get", "\\u", "ilo", "\\u", "object", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "inspect", "\\u", "essential", "\\u", "ok_", "(_", "self_", ",_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "object\\u", "mock_", "=_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", "._", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capabilities_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "states_", "._", "POWER", "\\u", "ON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "task", "\\u", "manager_", "._", "acquire_", "(_", "self_", "._", "context_", ",_", "self_", "._", "node_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared_", "=_", "False_", ")_", "as_", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "driver_", "._", "inspect_", "._", "inspect", "\\u", "hardware_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "properties_", ",_", "task_", "._", "node_", "._", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "mock_", "._", "ANY_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "macs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "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_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "capab", "ilities", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "conductor", "\\u", "utils_", ",_", "'", "node", "\\u", "power", "\\u", "action", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "power_", "._", "Il", "o", "Power_", ",_", "'", "get", "\\u", "power", "\\u", "state", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "common_", ",_", "'", "get", "\\u", "ilo", "\\u", "object", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "inspect", "\\u", "essential", "\\u", "ok", "\\u", "power", "\\u", "off_", "(_", "self_", ",_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "set\\u", "power", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "object\\u", "mock_", "=_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", "._", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capabilities_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "states_", "._", "POWER", "\\u", "OFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "task", "\\u", "manager_", "._", "acquire_", "(_", "self_", "._", "context_", ",_", "self_", "._", "node_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared_", "=_", "False_", ")_", "as_", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "driver_", "._", "inspect_", "._", "inspect", "\\u", "hardware_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "properties_", ",_", "task_", "._", "node_", "._", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "mock_", "._", "ANY_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "power", "\\u", "mock_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "task_", ",_", "states_", "._", "POWER", "\\u", "ON_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "macs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "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_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "capab", "ilities", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "power_", "._", "Il", "o", "Power_", ",_", "'", "get", "\\u", "power", "\\u", "state", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "common_", ",_", "'", "get", "\\u", "ilo", "\\u", "object", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "inspect", "\\u", "essential", "\\u", "capab", "ilities", "\\u", "ok_", "(_", "self_", ",_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "object\\u", "mock_", "=_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", "._", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capab", "ilit", "y", "\\u", "str_", "=_", "'", "Boot", "Mode", ":", "ue", "fi", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capabilities_", "=_", "{_", "'", "Boot", "Mode", "'_", ":_", "'", "ue", "fi", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "states_", "._", "POWER", "\\u", "ON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "task", "\\u", "manager_", "._", "acquire_", "(_", "self_", "._", "context_", ",_", "self_", "._", "node_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared_", "=_", "False_", ")_", "as_", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "driver_", "._", "inspect_", "._", "inspect", "\\u", "hardware_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "capab", "ilities", "'_", ":_", "capab", "ilit", "y", "\\u", "str_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected", "\\u", "properties_", ",_", "task_", "._", "node_", "._", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "mock_", "._", "ANY_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "macs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Il", "o", "Inspect", "Test", "Case_", "(_", "db", "\\u", "base_", "._", "Db", "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_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "capab", "ilities", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", ",_", "'\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "power_", "._", "Il", "o", "Power_", ",_", "'", "get", "\\u", "power", "\\u", "state", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "common_", ",_", "'", "get", "\\u", "ilo", "\\u", "object", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "inspect", "\\u", "essential", "\\u", "capab", "ilities", "\\u", "exist", "\\u", "ok_", "(_", "self_", ",_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "object\\u", "mock_", "=_", "get", "\\u", "ilo", "\\u", "object\\u", "mock_", "._", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "some", "key", "'_", ":_", "'", "some", "value", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capabilities_", "=_", "{_", "'", "Boot", "Mode", "'_", ":_", "'", "ue", "fi", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "states_", "._", "POWER", "\\u", "ON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "task", "\\u", "manager_", "._", "acquire_", "(_", "self_", "._", "context_", ",_", "self_", "._", "node_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared_", "=_", "False_", ")_", "as_", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "node_", "._", "properties_", "=_", "{_", "'", "capab", "ilities", "'_", ":_", "'", "foo", ":", "bar", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "capabilities_", "=_", "(_", "'", "Boot", "Mode", ":", "ue", "fi", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", ":", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set1", "_", "=_", "set_", "(_", "expected", "\\u", "capabilities_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "driver_", "._", "inspect_", "._", "inspect", "\\u", "hardware_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "capabilities_", "=_", "task_", "._", "node_", "._", "properties_", "[_", "'", "capab", "ilities", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set", "2_", "=_", "set_", "(_", "end", "\\u", "capabilities_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set1", "_", ",_", "set", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "capab", "ilities", "'_", ":_", "end", "\\u", "capabilities_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "mock_", "._", "ANY_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "task_", "._", "node_", "._", "properties_", ",_", "expected", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "essential", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "capab", "ilities", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "object\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "port", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "task_", "._", "node_", ",_", "macs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Test", "Inspect", "Priva", "te", "Methods_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr", "\\u", "utils_", "._", "mock", "\\u", "the", "\\u", "extensi", "on", "\\u", "manager_", "(_", "driver_", "=_", "\"", "fake", "\\u", "ilo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "node_", "=_", "obj", "\\u", "utils_", "._", "create", "\\u", "test\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", ",_", "driver_", "=_", "'", "fake", "\\u", "ilo", "'_", ",_", "driver", "\\u", "info_", "=_", "INFO", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", "._", "LOG_", ",_", "'", "info", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "dbapi_", ",_", "'", "get", "\\u", "instance", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist_", "(_", "self_", ",_", "instance", "\\u", "mock_", ",_", "log", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "obj_", "=_", "instance", "\\u", "mock_", "._", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "id_", "=_", "self_", "._", "node_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "dict1_", "=_", "{_", "'", "address", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "node", "\\u", "id", "'_", ":_", "node", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "dict2", "_", "=_", "{_", "'", "address", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", ",_", "'", "node", "\\u", "id", "'_", ":_", "node", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist_", "(_", "self_", "._", "node_", ",_", "macs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "log", "\\u", "mock_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "obj_", "._", "create", "\\u", "port_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "port", "\\u", "dict1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "obj_", "._", "create", "\\u", "port_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "port", "\\u", "dict2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "ilo", "\\u", "inspect_", "._", "LOG_", ",_", "'", "warn", "ing", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "dbapi_", ",_", "'", "get", "\\u", "instance", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist", "\\u", "mac", "\\u", "exception_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbapi", "\\u", "mock_", "=_", "instance", "\\u", "mock_", "._", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbapi", "\\u", "mock_", "._", "create", "\\u", "port_", "._", "side", "\\u", "effect_", "=_", "exception_", "._", "MAC", "Al", "read", "y", "Exists_", "(_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "create", "\\u", "port", "s", "\\u", "if", "\\u", "not", "\\u", "exist_", "(_", "self_", "._", "node_", ",_", "macs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "log", "\\u", "mock_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "\\u", "ok_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "mock_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "spec_", "=_", "[_", "'", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "essential", "\\u", "properties_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual", "\\u", "result_", "=_", "ilo", "\\u", "inspect_", "._", "\\u", "get", "\\u", "essential", "\\u", "properties_", "(_", "self_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", ",_", "actual", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "\\u", "fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "mock_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "=_", "[_", "'", "get", "\\u", "addition", "al", "\\u", "capab", "ilities", "'_", ",_", "'", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Missing", " ", "key", ":", " ", "cpu", "\\u", "arch_", "\\u\\u\\uNL\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "Port", " ", "2", "'_", ":_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "essential", "\\u", "properties_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Hard", "ware", "Inspect", "ion", "Failure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "get", "\\u", "essential", "\\u", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "six_", "._", "text", "\\u", "type_", "(_", "result_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Fail", "ed", " ", "to", " ", "inspect", " ", "hard", "ware", ".", " ", "Rea", "son", ":", " ", "Server", " ", "did", "n", "'", "t", " ", "return", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "(", "s", "):", " ", "cpu", "\\u", "arch", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "\\u", "fail", "\\u", "invalid", "\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "mock_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "=_", "[_", "'", "get", "\\u", "addition", "al", "\\u", "capab", "ilities", "'_", ",_", "'", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "a", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "properties_", "=_", "[_", "'", "memory", "\\u", "mb", "'_", ",_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ",_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ",_", "'", "1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "[_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", ",_", "'", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", ":", "bb", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capabilities_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "essential", "\\u", "properties_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "addition", "al", "\\u", "capabilities_", "._", "return", "\\u", "value_", "=_", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Hard", "ware", "Inspect", "ion", "Failure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "get", "\\u", "essential", "\\u", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node_", ",_", "ilo", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "\\u", "fail", "\\u", "mac", "\\u", "invalid", "\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "mock_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "spec_", "=_", "[_", "'", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "a", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "macs", "_", "=_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "essential", "\\u", "properties_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Hard", "ware", "Inspect", "ion", "Failure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "get", "\\u", "essential", "\\u", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node_", ",_", "ilo", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "\\u", "hard", "ware", "\\u", "port", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "mock_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "=_", "[_", "'", "get", "\\u", "addition", "al", "\\u", "capab", "ilities", "'_", ",_", "'", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "a", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "macs", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capabilities_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "essential", "\\u", "properties_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "addition", "al", "\\u", "capabilities_", "._", "return", "\\u", "value_", "=_", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Hard", "ware", "Inspect", "ion", "Failure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "get", "\\u", "essential", "\\u", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node_", ",_", "ilo", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "essential", "\\u", "proper", "ties", "\\u", "hard", "ware", "\\u", "port", "\\u", "not", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "mock_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "spec_", "=_", "[_", "'", "get", "\\u", "essential", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "64", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "a", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "macs", "_", "=_", "'", "aa", ":", "bb", ":", "cc", ":", "dd", ":", "ee", ":", "ff", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "essential", "\\u", "properties_", "._", "return", "\\u", "value_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exception_", "._", "Hard", "ware", "Inspect", "ion", "Failure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "get", "\\u", "essential", "\\u", "properties_", ",_", "self_", "._", "node_", ",_", "ilo", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "utils_", ",_", "'", "get", "\\u", "update", "d\\u", "capab", "ilities", "'_", ",_", "spec", "\\u", "set_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "capab", "ilities", "\\u", "ok_", "(_", "self_", ",_", "capab", "ilit", "y", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ilo", "\\u", "mock_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "spec_", "=_", "[_", "'", "get", "\\u", "server", "\\u", "capab", "ilities", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capabilities_", "=_", "{_", "'", "ilo", "\\u", "firmware", "\\u", "version", "'_", ":_", "'", "xyz", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "mock_", "._", "get", "\\u", "server", "\\u", "capabilities_", "._", "return", "\\u", "value_", "=_", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cap_", "=_", "ilo", "\\u", "inspect_", "._", "\\u", "get", "\\u", "capabilities_", "(_", "self_", "._", "node_", ",_", "ilo", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cap_", ",_", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "validat", "e\\u", "ok_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "2", "'_", ",_", "'", "cpu", "\\u", "arch", "'_", ":_", "'", "x8", "6", "\\u", "arch", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "keys_", "=_", "ilo", "\\u", "inspect_", "._", "Il", "o", "Inspect", "_", "._", "ESS", "ENTI", "AL", "\\u", "PROPERTIES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "validate_", "(_", "self_", "._", "node_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "set_", "(_", "properties_", ")_", ")_", ",_", "sorted_", "(_", "valid", "\\u", "keys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Inspect", "Priva", "te", "Methods_", "(_", "db", "\\u", "base_", "._", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "validat", "e\\u", "essential", "\\u", "keys", "\\u", "fail", "\\u", "missi", "ng", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "{_", "'", "memory", "\\u", "mb", "'_", ":_", "'", "512", "'_", ",_", "'", "local", "\\u", "gb", "'_", ":_", "'", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "'", "1", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "macs", "_", "=_", "{_", "'", "Port", " ", "1", "'_", ":_", "'", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", ":", "aa", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "'", "macs", "'_", ":_", "macs", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Hard", "ware", "Inspect", "ion", "Failure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ilo", "\\u", "inspect_", "._", "\\u", "validate_", ",_", "self_", "._", "node_", ",_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/solum/solum/tests/api/controllers/v1/test_service.py
[ { "content": "# Copyright 2013 - Red Hat, Inc.\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\nimport json\n\nimport mock\n\nfrom solum.api.controllers.v1.datamodel import service as servicemodel\nfrom solum.api.controllers.v1 import service\nfrom solum.common import exception\nfrom solum import objects\nfrom solum.tests import base\nfrom solum.tests import fakes\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@mock.patch('pecan.request', new_callable=fakes.FakePecanRequest)\n@mock.patch('pecan.response', new_callable=fakes.FakePecanResponse)\n@mock.patch('solum.api.handlers.service_handler.ServiceHandler')\nclass TestServiceController(base.BaseTestCase):\n\n\n\n\n\n\n", "metadata": "root.TestServiceController", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def setUp(self):\n super(TestServiceController, self).setUp()\n objects.load()", "metadata": "root.TestServiceController.setUp", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_service_get(self, ServiceHandler, resp_mock, request_mock):\n hand_get = ServiceHandler.return_value.get\n fake_service = fakes.FakeService()\n hand_get.return_value = fake_service\n cont = service.ServiceController('test_id')\n resp = cont.get()\n self.assertIsNotNone(resp)\n self.assertEqual(fake_service.name, resp['result'].name)\n self.assertEqual(fake_service.description,\n resp['result'].description)\n self.assertEqual(fake_service.project_id, resp['result'].project_id)\n self.assertEqual(fake_service.uuid, resp['result'].uuid)\n hand_get.assert_called_with('test_id')\n self.assertEqual(200, resp_mock.status)", "metadata": "root.TestServiceController.test_service_get", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_service_get_not_found(self, ServiceHandler,\n resp_mock, request_mock):\n hand_get = ServiceHandler.return_value.get\n hand_get.side_effect = exception.ResourceNotFound(\n name='service', service_id='test_id')\n cont = service.ServiceController('test_id')\n cont.get()\n hand_get.assert_called_with('test_id')\n self.assertEqual(404, resp_mock.status)", "metadata": "root.TestServiceController.test_service_get_not_found", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_service_put_none(self, ServiceHandler, resp_mock, request_mock):\n request_mock.body = None\n request_mock.content_type = 'application/json'\n hand_put = ServiceHandler.return_value.put\n hand_put.return_value = fakes.FakeService()\n service.ServiceController('test_id').put()\n self.assertEqual(400, resp_mock.status)", "metadata": "root.TestServiceController.test_service_put_none", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_service_put_not_found(self, ServiceHandler,\n resp_mock, request_mock):\n json_update = {'user_id': 'foo', 'name': 'appy'}\n request_mock.body = json.dumps(json_update)\n request_mock.content_type = 'application/json'\n hand_update = ServiceHandler.return_value.update\n hand_update.side_effect = exception.ResourceNotFound(\n name='service',\n service_id='test_id')\n service.ServiceController('test_id').put()\n hand_update.assert_called_with('test_id', json_update)\n self.assertEqual(404, resp_mock.status)", "metadata": "root.TestServiceController.test_service_put_not_found", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 67 }, { "content": " def test_service_put_ok(self, ServiceHandler, resp_mock, request_mock):\n json_update = {'name': 'fee', 'user_id': 'me'}\n request_mock.body = json.dumps(json_update)\n request_mock.content_type = 'application/json'\n hand_update = ServiceHandler.return_value.update\n hand_update.return_value = fakes.FakeService()\n service.ServiceController('test_id').put()\n hand_update.assert_called_with('test_id', json_update)\n self.assertEqual(200, resp_mock.status)", "metadata": "root.TestServiceController.test_service_put_ok", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " def test_service_delete_not_found(self, ServiceHandler,\n resp_mock, request_mock):\n hand_delete = ServiceHandler.return_value.delete\n hand_delete.side_effect = exception.ResourceNotFound(\n name='service',\n service_id='test_id')\n obj = service.ServiceController('test_id')\n obj.delete()\n hand_delete.assert_called_with('test_id')\n self.assertEqual(404, resp_mock.status)", "metadata": "root.TestServiceController.test_service_delete_not_found", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_service_delete_ok(self, ServiceHandler, resp_mock, request_mock):\n hand_delete = ServiceHandler.return_value.delete\n hand_delete.return_value = None\n obj = service.ServiceController('test_id')\n obj.delete()\n hand_delete.assert_called_with('test_id')\n self.assertEqual(204, resp_mock.status)", "metadata": "root.TestServiceController.test_service_delete_ok", "header": "['class', 'TestServiceController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": "@mock.patch('pecan.request', new_callable=fakes.FakePecanRequest)\n@mock.patch('pecan.response', new_callable=fakes.FakePecanResponse)\n@mock.patch('solum.api.handlers.service_handler.ServiceHandler')\nclass TestServicesController(base.BaseTestCase):\n\n\n", "metadata": "root.TestServicesController", "header": "['module', '___EOS___']", "index": 110 }, { "content": " def setUp(self):\n super(TestServicesController, self).setUp()\n objects.load()", "metadata": "root.TestServicesController.setUp", "header": "['class', 'TestServicesController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 114 }, { "content": " def test_services_get_all(self, handler_mock, resp_mock, request_mock):\n hand_get_all = handler_mock.return_value.get_all\n fake_service = fakes.FakeService()\n hand_get_all.return_value = [fake_service]\n obj = service.ServicesController()\n resp = obj.get_all()\n self.assertIsNotNone(resp)\n self.assertEqual(fake_service.name, resp['result'][0].name)\n self.assertEqual(fake_service.description,\n resp['result'][0].description)\n self.assertEqual(fake_service.project_id, resp['result'][0].project_id)\n self.assertEqual(fake_service.uuid, resp['result'][0].uuid)\n hand_get_all.assert_called_with()\n self.assertEqual(200, resp_mock.status)", "metadata": "root.TestServicesController.test_services_get_all", "header": "['class', 'TestServicesController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 118 }, { "content": " def test_services_post(self, handler_mock, resp_mock, request_mock):\n json_create = {'name': 'foo',\n 'description': 'test_desc_service',\n 'user_id': 'user_id_test',\n 'project_id': 'project_id_test'}\n request_mock.body = json.dumps(json_create)\n request_mock.content_type = 'application/json'\n handler_create = handler_mock.return_value.create\n handler_create.return_value = fakes.FakeService()\n service.ServicesController().post()\n handler_create.assert_called_with(json_create)\n self.assertEqual(201, resp_mock.status)\n handler_create.assert_called_once_with(json_create)", "metadata": "root.TestServicesController.test_services_post", "header": "['class', 'TestServicesController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_services_post_nodata(self, handler_mock, resp_mock, request_mock):\n request_mock.body = ''\n request_mock.content_type = 'application/json'\n handler_create = handler_mock.return_value.create\n handler_create.return_value = fakes.FakeService()\n ret_val = service.ServicesController().post()\n self.assertEqual(\"Missing argument: \\\"data\\\"\",\n str(ret_val['faultstring']))\n self.assertEqual(400, resp_mock.status)", "metadata": "root.TestServicesController.test_services_post_nodata", "header": "['class', 'TestServicesController', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 147 }, { "content": "class TestServiceAsDict(base.BaseTestCase):\n\n scenarios = [\n ('none', dict(data=None)),\n ('one', dict(data={'name': 'foo'})),\n ('full', dict(data={'uri': 'http://example.com/v1/services/x1',\n 'name': 'Example-service',\n 'type': 'service',\n 'tags': ['small'],\n 'project_id': '1dae5a09ef2b4d8cbf3594b0eb4f6b94',\n 'user_id': '55f41cf46df74320b9486a35f5d28a11',\n 'description': 'A service'}))\n ]\n", "metadata": "root.TestServiceAsDict", "header": "['module', '___EOS___']", "index": 158 }, { "content": " def test_as_dict(self):\n objects.load()\n if self.data is None:\n s = servicemodel.Service()\n self.data = {}\n else:\n s = servicemodel.Service(**self.data)\n if 'uri' in self.data:\n del self.data['uri']\n if 'type' in self.data:\n del self.data['type']\n self.assertEqual(self.data,\n s.as_dict(objects.registry.Service))", "metadata": "root.TestServiceAsDict.test_as_dict", "header": "['class', 'TestServiceAsDict', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 172 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "-", " ", "Red", " ", "Hat", ",", " ", "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", "\");", " ", "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_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sol", "um_", "._", "api_", "._", "controllers_", "._", "v1_", "._", "datamo", "del_", "import_", "service_", "as_", "service", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sol", "um_", "._", "api_", "._", "controllers_", "._", "v1_", "import_", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sol", "um_", "._", "common_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sol", "um_", "import_", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sol", "um_", "._", "tests_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sol", "um_", "._", "tests_", "import_", "fakes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "mock_", "._", "patch_", "(_", "'", "pec", "an", ".", "request", "'_", ",_", "new", "\\u", "callable_", "=_", "fakes_", "._", "Fake", "Pe", "can", "Request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "pec", "an", ".", "response", "'_", ",_", "new", "\\u", "callable_", "=_", "fakes_", "._", "Fake", "Pe", "can", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "sol", "um", ".", "api", ".", "handler", "s", ".", "service", "\\u", "handler", ".", "Service", "Handle", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "Service", "Controller_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "Controller_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Test", "Service", "Controller_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "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", "service", "\\u", "get_", "(_", "self_", ",_", "Service", "Handler_", ",_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hand", "\\u", "get_", "=_", "Service", "Handler_", "._", "return", "\\u", "value_", "._", "get_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "service_", "=_", "fakes_", "._", "Fake", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "get_", "._", "return", "\\u", "value_", "=_", "fake", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cont_", "=_", "service_", "._", "Service", "Controller_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "cont_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "name_", ",_", "resp_", "[_", "'", "result", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "[_", "'", "result", "'_", "]_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "project", "\\u", "id_", ",_", "resp_", "[_", "'", "result", "'_", "]_", "._", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "uuid_", ",_", "resp_", "[_", "'", "result", "'_", "]_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "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", "service", "\\u", "get", "\\u", "not", "\\u", "found_", "(_", "self_", ",_", "Service", "Handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hand", "\\u", "get_", "=_", "Service", "Handler_", "._", "return", "\\u", "value_", "._", "get_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "get_", "._", "side", "\\u", "effect_", "=_", "exception_", "._", "Reso", "urc", "e", "Not", "Found_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "service", "'_", ",_", "service", "\\u", "id_", "=_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cont_", "=_", "service_", "._", "Service", "Controller_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cont_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "404_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "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", "service", "\\u", "put", "\\u", "none_", "(_", "self_", ",_", "Service", "Handler_", ",_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "mock_", "._", "body_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "mock_", "._", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "put_", "=_", "Service", "Handler_", "._", "return", "\\u", "value_", "._", "put_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "put_", "._", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "Service", "Controller_", "(_", "'", "test\\u", "id", "'_", ")_", "._", "put_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "400_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "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", "service", "\\u", "put", "\\u", "not", "\\u", "found_", "(_", "self_", ",_", "Service", "Handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "update_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "'", "foo", "'_", ",_", "'", "name", "'_", ":_", "'", "app", "y", "'_", "}_", "\\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_", "hand", "\\u", "update_", "=_", "Service", "Handler_", "._", "return", "\\u", "value_", "._", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "update_", "._", "side", "\\u", "effect_", "=_", "exception_", "._", "Reso", "urc", "e", "Not", "Found_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "id_", "=_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "Service", "Controller_", "(_", "'", "test\\u", "id", "'_", ")_", "._", "put_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\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_", "[SEP]_", "class_", "Test", "Service", "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", "service", "\\u", "put", "\\u", "ok_", "(_", "self_", ",_", "Service", "Handler_", ",_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "update_", "=_", "{_", "'", "name", "'_", ":_", "'", "fe", "e", "'_", ",_", "'", "user", "\\u", "id", "'_", ":_", "'", "me", "'_", "}_", "\\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_", "hand", "\\u", "update_", "=_", "Service", "Handler_", "._", "return", "\\u", "value_", "._", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "update_", "._", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "Service", "Controller_", "(_", "'", "test\\u", "id", "'_", ")_", "._", "put_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "update_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "'", "test\\u", "id", "'_", ",_", "json", "\\u", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "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", "service", "\\u", "delete", "\\u", "not", "\\u", "found_", "(_", "self_", ",_", "Service", "Handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hand", "\\u", "delete_", "=_", "Service", "Handler_", "._", "return", "\\u", "value_", "._", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "delete_", "._", "side", "\\u", "effect_", "=_", "exception_", "._", "Reso", "urc", "e", "Not", "Found_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "id_", "=_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "service_", "._", "Service", "Controller_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "delete_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "404_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "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", "service", "\\u", "delete", "\\u", "ok_", "(_", "self_", ",_", "Service", "Handler_", ",_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hand", "\\u", "delete_", "=_", "Service", "Handler_", "._", "return", "\\u", "value_", "._", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "delete_", "._", "return", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "service_", "._", "Service", "Controller_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "delete_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "'", "test\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "204_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "pec", "an", ".", "request", "'_", ",_", "new", "\\u", "callable_", "=_", "fakes_", "._", "Fake", "Pe", "can", "Request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "pec", "an", ".", "response", "'_", ",_", "new", "\\u", "callable_", "=_", "fakes_", "._", "Fake", "Pe", "can", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "sol", "um", ".", "api", ".", "handler", "s", ".", "service", "\\u", "handler", ".", "Service", "Handle", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "Service", "s", "Controller_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "s", "Controller_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Test", "Service", "s", "Controller_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "s", "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", "service", "s", "\\u", "get", "\\u", "all_", "(_", "self_", ",_", "handler", "\\u", "mock_", ",_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hand", "\\u", "get", "\\u", "all_", "=_", "handler", "\\u", "mock_", "._", "return", "\\u", "value_", "._", "get", "\\u", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "service_", "=_", "fakes_", "._", "Fake", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "get", "\\u", "all_", "._", "return", "\\u", "value_", "=_", "[_", "fake", "\\u", "service_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "service_", "._", "Service", "s", "Controller_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "obj_", "._", "get", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "name_", ",_", "resp_", "[_", "'", "result", "'_", "]_", "[_", "0_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "[_", "'", "result", "'_", "]_", "[_", "0_", "]_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "project", "\\u", "id_", ",_", "resp_", "[_", "'", "result", "'_", "]_", "[_", "0_", "]_", "._", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fake", "\\u", "service_", "._", "uuid_", ",_", "resp_", "[_", "'", "result", "'_", "]_", "[_", "0_", "]_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "\\u", "get", "\\u", "all_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "s", "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", "service", "s", "\\u", "post_", "(_", "self_", ",_", "handler", "\\u", "mock_", ",_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "create_", "=_", "{_", "'", "name", "'_", ":_", "'", "foo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "test\\u", "desc", "\\u", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "user", "\\u", "id", "\\u", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "id", "'_", ":_", "'", "project", "\\u", "id", "\\u", "test", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "mock_", "._", "body_", "=_", "json_", "._", "dumps_", "(_", "json", "\\u", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "mock_", "._", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "create_", "=_", "handler", "\\u", "mock_", "._", "return", "\\u", "value_", "._", "create_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "create_", "._", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "Service", "s", "Controller_", "(_", ")_", "._", "post_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "create_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "json", "\\u", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "201_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "create_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "json", "\\u", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "s", "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", "service", "s", "\\u", "post", "\\u", "nodata", "_", "(_", "self_", ",_", "handler", "\\u", "mock_", ",_", "resp", "\\u", "mock_", ",_", "request", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "mock_", "._", "body_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "mock_", "._", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "create_", "=_", "handler", "\\u", "mock_", "._", "return", "\\u", "value_", "._", "create_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "create_", "._", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "val_", "=_", "service_", "._", "Service", "s", "Controller_", "(_", ")_", "._", "post_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Missing", " ", "argu", "ment", ":", " ", "\\\\\"", "data", "\\\\\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "ret", "\\u", "val_", "[_", "'", "faults", "tring", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "400_", ",_", "resp", "\\u", "mock_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Service", "As", "Dict_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scenarios_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "none", "'_", ",_", "dict_", "(_", "data_", "=_", "None_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "one", "'_", ",_", "dict_", "(_", "data_", "=_", "{_", "'", "name", "'_", ":_", "'", "foo", "'_", "}_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "full", "'_", ",_", "dict_", "(_", "data_", "=_", "{_", "'", "uri", "'_", ":_", "'", "http", "://", "example", ".", "com", "/", "v1", "/", "service", "s", "/", "x1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Exam", "ple", "-", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "[_", "'", "small", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "id", "'_", ":_", "'", "1d", "ae", "5a", "09", "ef", "2b", "4d", "8c", "bf", "359", "4b", "0e", "b4", "f6", "b9", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "5", "5f", "4", "1c", "f4", "6d", "f7", "432", "0b", "948", "6a", "3", "5f", "5d", "2", "8a", "11", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "A", " ", "service", "'_", "}_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Service", "As", "Dict_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "as", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objects_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "service", "model_", "._", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "service", "model_", "._", "Service_", "(_", "**_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "uri", "'_", "in_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "data_", "[_", "'", "uri", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "type", "'_", "in_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "data_", "[_", "'", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "as", "\\u", "dict_", "(_", "objects_", "._", "registry_", "._", "Service_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
hellerbarde/stapler/legacy-pypdf-setup.py
[ { "content": "from setuptools import setup, find_packages\n\nversion = \"0.3.3\"\n\nsetup(name=\"stapler\",\n version=version,\n description=\"Manipulate PDF documents from the command line\",\n keywords=\"pdf utility cli concatenate tool\",\n \n author=\"Philip Stark, Fred Wenzel\",\n author_email=\"git@codechaos.ch\",\n url=\"https://github.com/hellerbarde/stapler\",\n\n install_requires = [\n \"PyPDF>=1.12\",\n #\"PyPDF2>=1.24\",\n ],\n\n #include_package_data=True,\n packages=find_packages(),\n package_data={\"\": [\"LICENSE\", \"CONTRIBUTORS\", \"README.md\", ]},\n entry_points=\"\"\"\n [console_scripts]\n stapler = staplelib:main\n pdf-stapler = staplelib:main\n \"\"\",\n\n classifiers=[\n \"Development Status :: 5 - Production/Stable\",\n \"Programming Language :: Python :: 2\",\n \"Intended Audience :: Science/Research\",\n \"Topic :: Utilities\",\n \"License :: OSI Approved :: BSD License\"\n ],\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\"", "0.", "3.3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "name_", "=_", "\"", "sta", "ple", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Manipulat", "e", " ", "PD", "F", " ", "document", "s", " ", "from", " ", "the", " ", "command", " ", "line", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "\"", "pdf", " ", "utility", " ", "cli", " ", "concatenate", " ", "tool", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "\"", "Phil", "ip", " ", "Star", "k", ",", " ", "Fre", "d", " ", "Wen", "zel", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "\"", "git", "@", "codec", "ha", "os", ".", "ch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "https", "://", "git", "hub", ".", "com", "/", "hell", "erb", "ard", "e", "/", "sta", "ple", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Py", "PD", "F", ">=", "1.1", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "Py", "PD", "F2", ">=", "1.2", "4", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "include", "\\u", "package", "\\u", "data", "=", "Tru", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "data_", "=_", "{_", "\"\"_", ":_", "[_", "\"", "LICENSE", "\"_", ",_", "\"", "CONTRIB", "UTO", "RS", "\"_", ",_", "\"", "READ", "ME", ".", "md", "\"_", ",_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "points_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "[", "console", "\\u", "scripts", "]", "\\", "10", ";", " ", " ", " ", " ", "sta", "ple", "r", " ", "=", " ", "sta", "ple", "lib", ":", "main", "\\", "10", ";", " ", " ", " ", " ", "pdf", "-", "sta", "ple", "r", " ", "=", " ", "sta", "ple", "lib", ":", "main", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Sci", "ence", "/", "Rese", "arch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Utili", "ties", "\"_", ",_", "\\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 ]
Unused import
ReactiveX/RxPY/rx/internal/utils.py
[ { "content": "from rx import AnonymousObservable\nfrom rx.disposables import CompositeDisposable\n\nfrom .exceptions import DisposedException\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def add_ref(xs, r):\n def subscribe(observer):\n return CompositeDisposable(r.disposable, xs.subscribe(observer))\n\n return AnonymousObservable(subscribe)", "metadata": "root.add_ref", "header": "['module', '___EOS___']", "index": 6 }, { "content": "def adapt_call(func):\n \"\"\"Adapt called func.\n\n Adapt called funcfrom taking n params to only taking 1 or 2 params\n \"\"\"\n cached = [None]\n\n def func1(arg1, *_):\n return func(arg1)\n\n def func2(arg1, arg2=None, *_):\n return func(arg1, arg2)\n\n def func_wrapped(*args, **kw):\n if cached[0]:\n return cached[0](*args, **kw)\n\n for fn in (func1, func2):\n try:\n ret = fn(*args, **kw)\n except TypeError:\n continue\n else:\n cached[0] = fn\n return ret\n\n # Error if we get here. Just call original function to generate a\n # meaningful error message\n return func(*args, **kw)\n return func_wrapped", "metadata": "root.adapt_call", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def check_disposed(this):\n if this.is_disposed:\n raise DisposedException()", "metadata": "root.check_disposed", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def is_future(p):\n return callable(getattr(p, \"add_done_callback\", None))", "metadata": "root.is_future", "header": "['module', '___EOS___']", "index": 50 }, { "content": "class TimeInterval(object):\n", "metadata": "root.TimeInterval", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def __init__(self, value, interval):\n self.value = value\n self.interval = interval", "metadata": "root.TimeInterval.__init__", "header": "['class', 'TimeInterval', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": "class Timestamp(object):\n", "metadata": "root.Timestamp", "header": "['module', '___EOS___']", "index": 61 }, { "content": " def __init__(self, value, timestamp):\n self.value = value\n self.timestamp = timestamp", "metadata": "root.Timestamp.__init__", "header": "['class', 'Timestamp', '(', 'object', ')', ':', '___EOS___']", "index": 63 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "rx_", "import_", "Ano", "nym", "ous", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Composit", "e", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "exceptions_", "import_", "Dispo", "sed", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "add", "\\u", "ref_", "(_", "xs_", ",_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "subscribe_", "(_", "observer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Composit", "e", "Dispo", "sab", "le_", "(_", "r_", "._", "dispo", "sab", "le_", ",_", "xs_", "._", "subscribe_", "(_", "observer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Ano", "nym", "ous", "Observable_", "(_", "subscribe_", ")_", "\\u\\u\\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_", "adapt", "\\u", "call_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Adapt", " ", "call", "ed", " ", "func", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Adapt", " ", "call", "ed", " ", "func", "from", " ", "tak", "ing", " ", "n", " ", "params", " ", "to", " ", "only", " ", "tak", "ing", " ", "1", " ", "or", " ", "2", " ", "params", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cached_", "=_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "func", "1_", "(_", "arg1_", ",_", "*_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "func_", "(_", "arg1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func", "2_", "(_", "arg1_", ",_", "arg2_", "=_", "None_", ",_", "*_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "func_", "(_", "arg1_", ",_", "arg2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func", "\\u", "wrapped_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cached_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cached_", "[_", "0_", "]_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fn_", "in_", "(_", "func", "1_", ",_", "func", "2_", ")_", ":_", "\\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 ", " _", "ret_", "=_", "fn_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cached_", "[_", "0_", "]_", "=_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Error", " ", "if", " ", "we", " ", "get", " ", "here", ".", " ", "Ju", "st", " ", "call", " ", "original", " ", "function", " ", "to", " ", "generat", "e", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "meaning", "ful", " ", "error", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func", "\\u", "wrapped_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "dispose", "d_", "(_", "this_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "this_", "._", "is", "\\u", "dispose", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Dispo", "sed", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "future_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "callable_", "(_", "getattr_", "(_", "p_", ",_", "\"", "add", "\\u", "don", "e\\u", "callback", "\"_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Time", "Interval_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "Interval_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "value_", ",_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "interval_", "=_", "interval_", "\\u\\u\\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_", "Timestamp_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Timestamp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "value_", ",_", "timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timestamp_", "=_", "timestamp_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
kayhayen/Nuitka/nuitka/nodes/StatementNodes.py
[ { "content": "class StatementExpressionOnly(StatementChildrenHavingBase):\n kind = \"STATEMENT_EXPRESSION_ONLY\"\n\n named_children = (\n \"expression\",\n )\n\n\n\n\n\n getExpression = StatementChildrenHavingBase.childGetter(\n \"expression\"\n )\n", "metadata": "root.StatementExpressionOnly", "header": "['module', '___EOS___']", "index": 214 } ]
[]
[]
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_", "State", "ment", "Expression", "Only_", "(_", "State", "ment", "Chil", "dre", "n", "Ha", "ving", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "\"", "STATE", "MENT", "\\u", "EXPR", "ESSION", "\\u", "ONL", "Y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "named", "\\u", "children_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "express", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "Expression_", "=_", "State", "ment", "Chil", "dre", "n", "Ha", "ving", "Base_", "._", "child", "Getter", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "express", "ion", "\"_", "\\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 ]
Except block handles 'BaseException'
ReactiveX/RxPY/rx/linq/observable/find.py
[ { "content": "def find_value(source, predicate, yield_index):\n def subscribe(observer):\n i = [0]\n\n def on_next(x):\n should_run = False\n try:\n should_run = predicate(x, i, source)\n except Exception as ex:\n observer.on_error(ex)\n return\n\n if should_run:\n observer.on_next(i[0] if yield_index else x)\n observer.on_completed()\n else:\n i[0] += 1\n\n def on_completed():\n observer.on_next(-1 if yield_index else None)\n observer.on_completed()\n\n return source.subscribe(on_next, observer.on_error, on_completed)\n return AnonymousObservable(subscribe)", "metadata": "root.find_value", "header": "['module', '___EOS___']", "index": 5 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find", "\\u", "value_", "(_", "source_", ",_", "predicate_", ",_", "yield", "\\u", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "subscribe_", "(_", "observer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "on", "\\u", "next_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shou", "ld", "\\u", "run_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shou", "ld", "\\u", "run_", "=_", "predicate_", "(_", "x_", ",_", "i_", ",_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "observer_", "._", "on", "\\u", "error_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shou", "ld", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "observer_", "._", "on", "\\u", "next_", "(_", "i_", "[_", "0_", "]_", "if_", "yield", "\\u", "index_", "else_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observer_", "._", "on", "\\u", "completed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "completed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "observer_", "._", "on", "\\u", "next_", "(_", "-_", "1_", "if_", "yield", "\\u", "index_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observer_", "._", "on", "\\u", "completed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "source_", "._", "subscribe_", "(_", "on", "\\u", "next_", ",_", "observer_", "._", "on", "\\u", "error_", ",_", "on", "\\u", "completed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Ano", "nym", "ous", "Observable_", "(_", "subscribe_", ")_", "\\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 ]
Unused import
muricoca/crab/scikits/crab/recommenders/knn/tests/test_classes.py
[ { "content": "import numpy as np\nfrom numpy.testing import assert_array_equal\nfrom nose.tools import assert_raises, assert_equals, assert_almost_equals\nfrom ....models.classes import MatrixPreferenceDataModel, \\\n MatrixBooleanPrefDataModel\nfrom ..item_strategies import ItemsNeighborhoodStrategy, AllPossibleItemsStrategy\nfrom ..neighborhood_strategies import AllNeighborsStrategy, NearestNeighborsStrategy\nfrom ....similarities.basic_similarities import ItemSimilarity, UserSimilarity\nfrom ..classes import ItemBasedRecommender, UserBasedRecommender\nfrom ....models.utils import ItemNotFoundError, UserNotFoundError\nfrom ....metrics.pairwise import euclidean_distances, jaccard_coefficient, pearson_correlation\n\n\nmovies = {'Marcel Caraciolo': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,\n 'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5,\n 'The Night Listener': 3.0},\n'Luciana Nunes': {'Lady in the Water': 3.0, 'Snakes on a Plane': 3.5,\n 'Just My Luck': 1.5, 'Superman Returns': 5.0, 'The Night Listener': 3.0,\n 'You, Me and Dupree': 3.5},\n'Leopoldo Pires': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.0,\n 'Superman Returns': 3.5, 'The Night Listener': 4.0},\n'Lorena Abreu': {'Snakes on a Plane': 3.5, 'Just My Luck': 3.0,\n 'The Night Listener': 4.5, 'Superman Returns': 4.0,\n 'You, Me and Dupree': 2.5},\n'Steve Gates': {'Lady in the Water': 3.0, 'Snakes on a Plane': 4.0,\n 'Just My Luck': 2.0, 'Superman Returns': 3.0, 'The Night Listener': 3.0,\n 'You, Me and Dupree': 2.0},\n'Sheldom': {'Lady in the Water': 3.0, 'Snakes on a Plane': 4.0,\n 'The Night Listener': 3.0, 'Superman Returns': 5.0, 'You, Me and Dupree': 3.5},\n'Penny Frewman': {'Snakes on a Plane': 4.5, 'You, Me and Dupree': 1.0, 'Superman Returns': 4.0},\n'Maria Gabriela': {}}\n\nmatrix_model = MatrixPreferenceDataModel(movies)\nboolean_matrix_model = MatrixBooleanPrefDataModel(movies)\n\n\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 test_create_ItemBasedRecommender():\n items_strategy = AllPossibleItemsStrategy()\n similarity = ItemSimilarity(matrix_model, euclidean_distances)\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_equals(recsys.similarity, similarity)\n assert_equals(recsys.items_selection_strategy, items_strategy)\n assert_equals(recsys.model, matrix_model)\n assert_equals(recsys.capper, True)", "metadata": "root.test_create_ItemBasedRecommender", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def test_create_UserBasedRecommender():\n nhood_strategy = AllNeighborsStrategy()\n similarity = UserSimilarity(matrix_model, euclidean_distances)\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_equals(recsys.similarity, similarity)\n assert_equals(recsys.neighborhood_strategy, nhood_strategy)\n assert_equals(recsys.model, matrix_model)\n assert_equals(recsys.capper, True)", "metadata": "root.test_create_UserBasedRecommender", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def test_all_other_items_ItemBasedRecommender():\n items_strategy = AllPossibleItemsStrategy()\n similarity = ItemSimilarity(matrix_model, euclidean_distances)\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n\n assert_array_equal(np.array(['Lady in the Water']), recsys.all_other_items('Lorena Abreu'))\n assert_array_equal(np.array([], dtype='|S'), recsys.all_other_items('Marcel Caraciolo'))\n assert_array_equal(np.array(['Just My Luck', 'Lady in the Water', 'Snakes on a Plane',\n 'Superman Returns', 'The Night Listener', 'You, Me and Dupree']), recsys.all_other_items('Maria Gabriela'))\n\n similarity = ItemSimilarity(boolean_matrix_model, jaccard_coefficient)\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n\n assert_array_equal(np.array(['Lady in the Water']), recsys.all_other_items('Lorena Abreu'))\n assert_array_equal(np.array([], dtype='|S'), recsys.all_other_items('Marcel Caraciolo'))\n assert_array_equal(np.array(['Just My Luck', 'Lady in the Water', 'Snakes on a Plane',\n 'Superman Returns', 'The Night Listener', 'You, Me and Dupree']), recsys.all_other_items('Maria Gabriela'))", "metadata": "root.test_all_other_items_ItemBasedRecommender", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def test_all_other_items_UserBasedRecommender():\n nhood_strategy = AllNeighborsStrategy()\n similarity = UserSimilarity(boolean_matrix_model, jaccard_coefficient)\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n\n assert_array_equal(np.array(['Lady in the Water']), recsys.all_other_items('Lorena Abreu'))\n assert_array_equal(np.array([], dtype='|S'), recsys.all_other_items('Marcel Caraciolo'))\n assert_array_equal(np.array(['Just My Luck', 'Lady in the Water', 'Snakes on a Plane',\n 'Superman Returns', 'The Night Listener', 'You, Me and Dupree']), recsys.all_other_items('Maria Gabriela'))\n\n similarity = UserSimilarity(boolean_matrix_model, jaccard_coefficient)\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Lady in the Water']),\n recsys.all_other_items(user_id='Lorena Abreu', distance=pearson_correlation, nhood_size=2, minimal_similarity=0.1))\n assert_array_equal(np.array([], dtype='|S'),\n recsys.all_other_items(user_id='Marcel Caraciolo', distance=pearson_correlation, nhood_size=2, minimal_similarity=0.1))\n assert_array_equal(np.array(['Just My Luck', 'Lady in the Water', 'Snakes on a Plane',\n 'Superman Returns', 'The Night Listener', 'You, Me and Dupree']),\n recsys.all_other_items(user_id='Maria Gabriela', distance=pearson_correlation, nhood_size=2, minimal_similarity=0.1))\n\n similarity = UserSimilarity(matrix_model, euclidean_distances)\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n\n assert_array_equal(np.array(['Lady in the Water']), recsys.all_other_items('Lorena Abreu'))\n assert_array_equal(np.array([], dtype='|S'), recsys.all_other_items('Marcel Caraciolo'))\n assert_array_equal(np.array(['Just My Luck', 'Lady in the Water', 'Snakes on a Plane',\n 'Superman Returns', 'The Night Listener', 'You, Me and Dupree']), recsys.all_other_items('Maria Gabriela'))\n\n nhood_strategy = NearestNeighborsStrategy()\n similarity = UserSimilarity(matrix_model, pearson_correlation)\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n\n assert_array_equal(np.array(['Lady in the Water']),\n recsys.all_other_items(user_id='Lorena Abreu', distance=pearson_correlation, nhood_size=2, minimal_similarity=0.1))\n assert_array_equal(np.array([], dtype='|S'),\n recsys.all_other_items(user_id='Marcel Caraciolo', distance=pearson_correlation, nhood_size=3))\n assert_array_equal(np.array([]),\n recsys.all_other_items(user_id='Maria Gabriela', distance=euclidean_distances, nhood_size=2))", "metadata": "root.test_all_other_items_UserBasedRecommender", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def test_estimate_preference_ItemBasedRecommender():\n items_strategy = ItemsNeighborhoodStrategy()\n similarity = ItemSimilarity(matrix_model, euclidean_distances)\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_almost_equals(3.5, recsys.estimate_preference('Marcel Caraciolo', 'Superman Returns'))\n assert_almost_equals(3.14717875510, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n #With capper = False\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy, False)\n assert_almost_equals(3.14717875510, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n #Non-Preferences\n assert_array_equal(np.nan, recsys.estimate_preference('Maria Gabriela', 'You, Me and Dupree'))\n\n items_strategy = ItemsNeighborhoodStrategy()\n similarity = ItemSimilarity(boolean_matrix_model, jaccard_coefficient)\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_almost_equals(1.0, recsys.estimate_preference('Marcel Caraciolo', 'Superman Returns'))\n assert_almost_equals(1.0, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n #With capper = False\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy, False)\n assert_almost_equals(1.0, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n #Non-Preferences\n assert_array_equal(np.NaN, recsys.estimate_preference('Maria Gabriela', 'You, Me and Dupree'))", "metadata": "root.test_estimate_preference_ItemBasedRecommender", "header": "['module', '___EOS___']", "index": 115 }, { "content": "def test_estimate_preference_UserBasedRecommender():\n nhood_strategy = NearestNeighborsStrategy()\n similarity = UserSimilarity(matrix_model, euclidean_distances)\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_almost_equals(3.5, recsys.estimate_preference('Marcel Caraciolo', 'Superman Returns'))\n assert_almost_equals(2.4533792305691886, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_almost_equals(3.5, recsys.estimate_preference('Marcel Caraciolo', 'Superman Returns'))\n assert_almost_equals(2.8960083169728952,\n recsys.estimate_preference(user_id='Leopoldo Pires', item_id='You, Me and Dupree',\n distance=pearson_correlation, nhood_size=4, minimal_similarity=-1.0))\n\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_almost_equals(2.0653946891716108,\n recsys.estimate_preference(user_id='Leopoldo Pires', item_id='You, Me and Dupree',\n nhood_size=4))\n\n #With capper = False\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy, False)\n assert_almost_equals(2.0653946891716108, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n assert_almost_equals(2.8960083169728952,\n recsys.estimate_preference(user_id='Leopoldo Pires', item_id='You, Me and Dupree',\n distance=pearson_correlation, nhood_size=4, minimal_similarity=-1.0))\n\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy, False)\n assert_almost_equals(2.0653946891716108,\n recsys.estimate_preference(user_id='Leopoldo Pires', item_id='You, Me and Dupree',\n nhood_size=4))\n\n #Non-Preferences\n assert_array_equal(np.nan, recsys.estimate_preference('Maria Gabriela', 'You, Me and Dupree'))\n\n nhood_strategy = NearestNeighborsStrategy()\n similarity = UserSimilarity(boolean_matrix_model, jaccard_coefficient)\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_almost_equals(1.0, recsys.estimate_preference('Marcel Caraciolo', 'Superman Returns'))\n assert_almost_equals(1.0, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n assert_almost_equals(1.0,\n recsys.estimate_preference(user_id='Leopoldo Pires', item_id='You, Me and Dupree',\n distance=jaccard_coefficient, nhood_size=3))\n\n #With capper = False\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy, False)\n assert_almost_equals(1.0, recsys.estimate_preference('Leopoldo Pires', 'You, Me and Dupree'))\n #Non-Preferences\n assert_array_equal(np.NaN, recsys.estimate_preference('Maria Gabriela', 'You, Me and Dupree'))", "metadata": "root.test_estimate_preference_UserBasedRecommender", "header": "['module', '___EOS___']", "index": 139 }, { "content": "def test_most_similar_items_ItemBasedRecommender():\n items_strategy = ItemsNeighborhoodStrategy()\n similarity = ItemSimilarity(matrix_model, euclidean_distances)\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n #semi items\n assert_array_equal(np.array(['Snakes on a Plane', \\\n 'The Night Listener', 'Lady in the Water', 'Just My Luck']), \\\n recsys.most_similar_items('Superman Returns', 4))\n #all items\n assert_array_equal(np.array(['Lady in the Water', 'You, Me and Dupree', \\\n 'The Night Listener', 'Snakes on a Plane', 'Superman Returns']), \\\n recsys.most_similar_items('Just My Luck'))\n #Non-existing\n assert_raises(ItemNotFoundError, recsys.most_similar_items, 'Back to the Future')\n #Exceed the limit\n assert_array_equal(np.array(['Lady in the Water', 'You, Me and Dupree', 'The Night Listener', \\\n 'Snakes on a Plane', 'Superman Returns']), \\\n recsys.most_similar_items('Just My Luck', 20))\n #Empty\n assert_array_equal(np.array([]), \\\n recsys.most_similar_items('Just My Luck', 0))\n\n items_strategy = ItemsNeighborhoodStrategy()\n similarity = ItemSimilarity(boolean_matrix_model, jaccard_coefficient)\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n #semi items\n assert_array_equal(np.array(['Snakes on a Plane', 'The Night Listener', \\\n 'You, Me and Dupree', 'Lady in the Water']), \\\n recsys.most_similar_items('Superman Returns', 4))\n #all items\n assert_array_equal(np.array(['The Night Listener', 'You, Me and Dupree', \\\n 'Snakes on a Plane', 'Superman Returns', 'Lady in the Water']), \\\n recsys.most_similar_items('Just My Luck'))\n #Non-existing\n assert_raises(ItemNotFoundError, recsys.most_similar_items, 'Back to the Future')\n #Exceed the limit\n assert_array_equal(np.array(['The Night Listener', 'You, Me and Dupree', 'Snakes on a Plane',\n 'Superman Returns', 'Lady in the Water']), \\\n recsys.most_similar_items('Just My Luck', 20))\n #Empty\n assert_array_equal(np.array([]), \\\n recsys.most_similar_items('Just My Luck', 0))", "metadata": "root.test_most_similar_items_ItemBasedRecommender", "header": "['module', '___EOS___']", "index": 188 }, { "content": "def test_most_similar_users_UserBasedRecommender():\n nhood_strategy = NearestNeighborsStrategy()\n similarity = UserSimilarity(matrix_model, euclidean_distances)\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n #semi items\n assert_array_equal(np.array(['Leopoldo Pires', 'Steve Gates', 'Lorena Abreu',\n 'Penny Frewman']), \\\n recsys.most_similar_users('Marcel Caraciolo', 4))\n #all items\n assert_array_equal(np.array(['Lorena Abreu', 'Marcel Caraciolo', 'Penny Frewman', \\\n 'Steve Gates', 'Luciana Nunes', 'Sheldom']), \\\n recsys.most_similar_users('Leopoldo Pires'))\n #Non-existing\n assert_array_equal(np.array([]), \\\n recsys.most_similar_users('Maria Gabriela'))\n #Exceed the limit\n assert_array_equal(np.array(['Lorena Abreu', 'Marcel Caraciolo', 'Penny Frewman', \\\n 'Steve Gates', 'Luciana Nunes', 'Sheldom']), \\\n recsys.most_similar_users('Leopoldo Pires', 20))\n #Empty\n assert_array_equal(np.array([]), \\\n recsys.most_similar_users('Sheldom', 0))\n\n nhood_strategy = NearestNeighborsStrategy()\n similarity = UserSimilarity(boolean_matrix_model, jaccard_coefficient)\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n #semi items\n assert_array_equal(np.array(['Luciana Nunes', 'Steve Gates', \\\n 'Lorena Abreu', 'Sheldom']), \\\n recsys.most_similar_users('Marcel Caraciolo', 4))\n #all items\n assert_array_equal(np.array(['Sheldom', 'Luciana Nunes', 'Marcel Caraciolo',\n 'Steve Gates', 'Lorena Abreu', 'Penny Frewman']), \\\n recsys.most_similar_users('Leopoldo Pires'))\n #Non-existing\n assert_array_equal(np.array([]), \\\n recsys.most_similar_users('Maria Gabriela'))\n #Exceed the limit\n assert_array_equal(np.array(['Sheldom', 'Luciana Nunes', 'Marcel Caraciolo',\n 'Steve Gates', 'Lorena Abreu', 'Penny Frewman']), \\\n recsys.most_similar_users('Leopoldo Pires', 20))\n #Empty\n assert_array_equal(np.array([]), \\\n recsys.most_similar_users('Sheldom', 0))", "metadata": "root.test_most_similar_users_UserBasedRecommender", "header": "['module', '___EOS___']", "index": 232 }, { "content": "def test_recommend_ItemBasedRecommender():\n items_strategy = ItemsNeighborhoodStrategy()\n similarity = ItemSimilarity(matrix_model, euclidean_distances)\n #Empty Recommendation\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Marcel Caraciolo'))\n\n #Semi Recommendation\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['Just My Luck', 'You, Me and Dupree']), \\\n recsys.recommend('Leopoldo Pires'))\n\n #Semi Recommendation\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['Just My Luck']), \\\n recsys.recommend('Leopoldo Pires', 1))\n\n #Empty Recommendation\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #Test with params update\n recsys.recommend(user_id='Maria Gabriela', similarity=similarity)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #with_preference\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy, True, True)\n assert_equals('Just My Luck', recsys.recommend('Leopoldo Pires')[0][0])\n assert_equals('You, Me and Dupree', recsys.recommend('Leopoldo Pires')[1][0])\n\n assert_almost_equals(3.20597, recsys.recommend('Leopoldo Pires')[0][1], 2)\n assert_almost_equals(3.147178755, recsys.recommend('Leopoldo Pires')[1][1], 2)\n\n similarity = ItemSimilarity(boolean_matrix_model, jaccard_coefficient)\n #Empty Recommendation\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Marcel Caraciolo'))\n\n #Semi Recommendation\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['You, Me and Dupree', 'Just My Luck']), \\\n recsys.recommend('Leopoldo Pires'))\n\n #Semi Recommendation\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['You, Me and Dupree']), \\\n recsys.recommend('Leopoldo Pires', 1))\n\n #Empty Recommendation\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #Test with params update\n recsys.recommend(user_id='Maria Gabriela', similarity=similarity)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #with_preference\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy, True, True)\n assert_equals('You, Me and Dupree', recsys.recommend('Leopoldo Pires')[0][0])\n assert_equals('Just My Luck', recsys.recommend('Leopoldo Pires')[1][0])\n\n assert_almost_equals(1.0, recsys.recommend('Leopoldo Pires')[0][1], 2)\n assert_almost_equals(1.0, recsys.recommend('Leopoldo Pires')[1][1], 2)", "metadata": "root.test_recommend_ItemBasedRecommender", "header": "['module', '___EOS___']", "index": 278 }, { "content": "def test_recommend_UserBasedRecommender():\n nhood_strategy = NearestNeighborsStrategy()\n similarity = UserSimilarity(matrix_model, euclidean_distances)\n #Empty Recommendation\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Marcel Caraciolo'))\n\n #Semi Recommendation\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Just My Luck', 'You, Me and Dupree']), \\\n recsys.recommend('Leopoldo Pires'))\n\n #Semi Recommendation\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Just My Luck']), \\\n recsys.recommend('Leopoldo Pires', 1))\n\n #Empty Recommendation\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #Test with params update\n recsys.recommend(user_id='Maria Gabriela', similarity=similarity)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #with_preference\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy, True, True)\n assert_equals('Just My Luck', recsys.recommend('Leopoldo Pires')[0][0])\n assert_equals('You, Me and Dupree', recsys.recommend('Leopoldo Pires')[1][0])\n\n assert_almost_equals(2.456743361464, recsys.recommend('Leopoldo Pires')[0][1], 2)\n assert_almost_equals(2.453379, recsys.recommend('Leopoldo Pires')[1][1], 2)\n\n similarity = UserSimilarity(boolean_matrix_model, jaccard_coefficient)\n #Empty Recommendation\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Marcel Caraciolo'))\n\n #Semi Recommendation\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['You, Me and Dupree', 'Just My Luck']), \\\n recsys.recommend('Leopoldo Pires'))\n\n #Semi Recommendation\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['You, Me and Dupree']), \\\n recsys.recommend('Leopoldo Pires', 1))\n\n #Empty Recommendation\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #Test with params update\n recsys.recommend(user_id='Maria Gabriela', similarity=similarity)\n assert_array_equal(np.array([]), recsys.recommend('Maria Gabriela'))\n\n #with_preference\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy, True, True)\n assert_equals('You, Me and Dupree', recsys.recommend('Leopoldo Pires')[0][0])\n assert_equals('Just My Luck', recsys.recommend('Leopoldo Pires')[1][0])\n\n assert_almost_equals(1.0, recsys.recommend('Leopoldo Pires')[0][1], 2)\n assert_almost_equals(1.0, recsys.recommend('Leopoldo Pires')[1][1], 2)", "metadata": "root.test_recommend_UserBasedRecommender", "header": "['module', '___EOS___']", "index": 343 }, { "content": "def test_recommend_because_ItemBasedRecommender():\n items_strategy = ItemsNeighborhoodStrategy()\n similarity = ItemSimilarity(matrix_model, euclidean_distances)\n #Full Recommendation Because\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['The Night Listener', 'Superman Returns', \\\n 'Snakes on a Plane', 'Lady in the Water']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck'))\n #over-items\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['The Night Listener', 'Superman Returns', \\\n 'Snakes on a Plane', 'Lady in the Water']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 20))\n #Semi\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['The Night Listener', 'Superman Returns']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 2))\n\n #Non-Existing\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy)\n assert_array_equal(np.array([]), \\\n recsys.recommended_because('Maria Gabriela', 'Just My Luck', 2))\n\n #with_preference\n recsys = ItemBasedRecommender(matrix_model, similarity, items_strategy, True, True)\n assert_array_equal(np.array([('The Night Listener', 4.0), \\\n ('Superman Returns', 3.5)]), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 2))\n\n #boolean_matrix_model\n similarity = ItemSimilarity(boolean_matrix_model, jaccard_coefficient)\n #Full Recommendation Because\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['The Night Listener', 'Superman Returns', \\\n 'Snakes on a Plane', 'Lady in the Water']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck'))\n #over-items\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['The Night Listener', 'Superman Returns', \\\n 'Snakes on a Plane', 'Lady in the Water']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 20))\n #Semi\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array(['The Night Listener', 'Superman Returns']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 2))\n\n #Non-Existing\n recsys = ItemBasedRecommender(boolean_matrix_model, similarity, items_strategy)\n assert_array_equal(np.array([]), \\\n recsys.recommended_because('Maria Gabriela', 'Just My Luck', 2))", "metadata": "root.test_recommend_because_ItemBasedRecommender", "header": "['module', '___EOS___']", "index": 408 }, { "content": "def test_recommend_because_UserBasedRecommender():\n nhood_strategy = NearestNeighborsStrategy()\n similarity = UserSimilarity(matrix_model, euclidean_distances)\n #Full Recommendation Because\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Lorena Abreu', 'Marcel Caraciolo', \\\n 'Steve Gates', 'Luciana Nunes']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck'))\n #over-items\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Lorena Abreu', 'Marcel Caraciolo', \\\n 'Steve Gates', 'Luciana Nunes']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 20))\n #Semi\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Lorena Abreu', 'Marcel Caraciolo']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 2))\n\n #Non-Existing\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array([]), \\\n recsys.recommended_because('Maria Gabriela', 'Just My Luck', 2))\n\n #with_preference\n recsys = UserBasedRecommender(matrix_model, similarity, nhood_strategy, True, True)\n assert_array_equal(np.array([('Lorena Abreu', 3.0), \\\n ('Marcel Caraciolo', 3.0)]), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 2))\n\n #boolean_matrix_model\n similarity = UserSimilarity(boolean_matrix_model, jaccard_coefficient)\n #Full Recommendation Because\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Steve Gates', 'Marcel Caraciolo', 'Luciana Nunes', \\\n 'Lorena Abreu']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck'))\n #over-items\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Steve Gates', 'Marcel Caraciolo', 'Luciana Nunes', \\\n 'Lorena Abreu']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 20))\n #Semi\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array(['Steve Gates', 'Marcel Caraciolo']), \\\n recsys.recommended_because('Leopoldo Pires', 'Just My Luck', 2))\n\n #Non-Existing\n recsys = UserBasedRecommender(boolean_matrix_model, similarity, nhood_strategy)\n assert_array_equal(np.array([]), \\\n recsys.recommended_because('Maria Gabriela', 'Just My Luck', 2))", "metadata": "root.test_recommend_because_UserBasedRecommender", "header": "['module', '___EOS___']", "index": 461 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "array", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "raises_", ",_", "assert", "\\u", "equals_", ",_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "models_", "._", "classes_", "import_", "Matrix", "Preference", "Data", "Model_", ",_", "Matrix", "Boo", "lean", "Pref", "Data", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "item", "\\u", "strategies_", "import_", "Item", "s", "Neighbor", "hood", "Strategy_", ",_", "All", "Poss", "ibl", "e", "Item", "s", "Strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "neighborhood", "\\u", "strategies_", "import_", "All", "Neighbor", "s", "Strategy_", ",_", "Near", "est", "Neighbor", "s", "Strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "similar", "ities_", "._", "basic", "\\u", "similar", "ities_", "import_", "Item", "Simil", "arity_", ",_", "User", "Simil", "arity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "classes_", "import_", "Item", "Base", "d", "Recommend", "er_", ",_", "User", "Base", "d", "Recommend", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "models_", "._", "utils_", "import_", "Item", "Not", "Foun", "d", "Error_", ",_", "User", "Not", "Foun", "d", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "metrics_", "._", "pairwise", "_", "import_", "euclidean", "\\u", "distances_", ",_", "jac", "card", "\\u", "coefficient_", ",_", "pearson", "\\u", "correlation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "movies_", "=_", "{_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ":_", "{_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ":_", "2.5_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ":_", "3.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ":_", "3.0_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ":_", "3.5_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ":_", "2.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ":_", "3.0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ":_", "{_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ":_", "3.0_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ":_", "3.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ":_", "1.5_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ":_", "5.0_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ":_", "3.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ":_", "3.5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ":_", "{_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ":_", "2.5_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ":_", "3.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Super", "man", " ", "Return", "s", "'_", ":_", "3.5_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ":_", "4.0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ":_", "{_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ":_", "3.5_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ":_", "3.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ":_", "4.5_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ":_", "4.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ":_", "2.5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ":_", "{_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ":_", "3.0_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ":_", "4.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ":_", "2.0_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ":_", "3.0_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ":_", "3.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ":_", "2.0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Shel", "dom", "'_", ":_", "{_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ":_", "3.0_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ":_", "4.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ":_", "3.0_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ":_", "5.0_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ":_", "3.5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Pen", "ny", " ", "Fre", "wma", "n", "'_", ":_", "{_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ":_", "4.5_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ":_", "1.0_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ":_", "4.0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "matrix", "\\u", "model_", "=_", "Matrix", "Preference", "Data", "Model_", "(_", "movies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boolean", "\\u", "matrix", "\\u", "model_", "=_", "Matrix", "Boo", "lean", "Pref", "Data", "Model_", "(_", "movies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "Item", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items", "\\u", "strategy_", "=_", "All", "Poss", "ibl", "e", "Item", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "similarity_", ",_", "similarity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "items", "\\u", "selection", "\\u", "strategy_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "model_", ",_", "matrix", "\\u", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "cap", "per_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "User", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nho", "od", "\\u", "strategy_", "=_", "All", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "similarity_", ",_", "similarity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "neighborhood", "\\u", "strategy_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "model_", ",_", "matrix", "\\u", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "rec", "sys_", "._", "cap", "per_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "all", "\\u", "other", "\\u", "items", "\\u", "Item", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items", "\\u", "strategy_", "=_", "All", "Poss", "ibl", "e", "Item", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ",_", "dtype_", "=_", "'|", "S", "'_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ",_", "dtype_", "=_", "'|", "S", "'_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "all", "\\u", "other", "\\u", "items", "\\u", "User", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nho", "od", "\\u", "strategy_", "=_", "All", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ",_", "dtype_", "=_", "'|", "S", "'_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "user", "\\u", "id_", "=_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "distance_", "=_", "pearson", "\\u", "correlation_", ",_", "nho", "od", "\\u", "size_", "=_", "2_", ",_", "minima", "l\\u", "similarity_", "=_", "0.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ",_", "dtype_", "=_", "'|", "S", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "user", "\\u", "id_", "=_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "distance_", "=_", "pearson", "\\u", "correlation_", ",_", "nho", "od", "\\u", "size_", "=_", "2_", ",_", "minima", "l\\u", "similarity_", "=_", "0.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "user", "\\u", "id_", "=_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "distance_", "=_", "pearson", "\\u", "correlation_", ",_", "nho", "od", "\\u", "size_", "=_", "2_", ",_", "minima", "l\\u", "similarity_", "=_", "0.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ",_", "dtype_", "=_", "'|", "S", "'_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nho", "od", "\\u", "strategy_", "=_", "Near", "est", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "pearson", "\\u", "correlation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "user", "\\u", "id_", "=_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "distance_", "=_", "pearson", "\\u", "correlation_", ",_", "nho", "od", "\\u", "size_", "=_", "2_", ",_", "minima", "l\\u", "similarity_", "=_", "0.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ",_", "dtype_", "=_", "'|", "S", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "user", "\\u", "id_", "=_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "distance_", "=_", "pearson", "\\u", "correlation_", ",_", "nho", "od", "\\u", "size_", "=_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "all", "\\u", "other", "\\u", "items_", "(_", "user", "\\u", "id_", "=_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "distance_", "=_", "euclidean", "\\u", "distances_", ",_", "nho", "od", "\\u", "size_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "estimate", "\\u", "preference", "\\u", "Item", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items", "\\u", "strategy_", "=_", "Item", "s", "Neighbor", "hood", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "3.5_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "3.14", "717", "875", "510", "_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "With", " ", "cap", "per", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "3.14", "717", "875", "510", "_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Non", "-", "Preferences_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "nan_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "items", "\\u", "strategy_", "=_", "Item", "s", "Neighbor", "hood", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "With", " ", "cap", "per", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Non", "-", "Preferences_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "Na", "N_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "estimate", "\\u", "preference", "\\u", "User", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nho", "od", "\\u", "strategy_", "=_", "Near", "est", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "3.5_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.4", "533", "792", "305", "691", "886", "_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "3.5_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.8", "9600", "831", "697", "289", "52_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "user", "\\u", "id_", "=_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "item", "\\u", "id_", "=_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "pearson", "\\u", "correlation_", ",_", "nho", "od", "\\u", "size_", "=_", "4_", ",_", "minima", "l\\u", "similarity_", "=_", "-_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.0", "653", "946", "891", "716", "108_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "user", "\\u", "id_", "=_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "item", "\\u", "id_", "=_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nho", "od", "\\u", "size_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "With", " ", "cap", "per", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.0", "653", "946", "891", "716", "108_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.8", "9600", "831", "697", "289", "52_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "user", "\\u", "id_", "=_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "item", "\\u", "id_", "=_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "pearson", "\\u", "correlation_", ",_", "nho", "od", "\\u", "size_", "=_", "4_", ",_", "minima", "l\\u", "similarity_", "=_", "-_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.0", "653", "946", "891", "716", "108_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "user", "\\u", "id_", "=_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "item", "\\u", "id_", "=_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nho", "od", "\\u", "size_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Non", "-", "Preferences_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "nan_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nho", "od", "\\u", "strategy_", "=_", "Near", "est", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "user", "\\u", "id_", "=_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "item", "\\u", "id_", "=_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "jac", "card", "\\u", "coefficient_", ",_", "nho", "od", "\\u", "size_", "=_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "With", " ", "cap", "per", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Non", "-", "Preferences_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "Na", "N_", ",_", "rec", "sys_", "._", "estimate", "\\u", "preference_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "most", "\\u", "similar", "\\u", "items", "\\u", "Item", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items", "\\u", "strategy_", "=_", "Item", "s", "Neighbor", "hood", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "semi", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "all", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Non", "-", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Item", "Not", "Foun", "d", "Error_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", ",_", "'", "Back", " ", "to", " ", "the", " ", "Fu", "ture", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Exce", "ed", " ", "the", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Empty_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "items", "\\u", "strategy_", "=_", "Item", "s", "Neighbor", "hood", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "semi", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "all", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Non", "-", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Item", "Not", "Foun", "d", "Error_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", ",_", "'", "Back", " ", "to", " ", "the", " ", "Fu", "ture", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Exce", "ed", " ", "the", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Empty_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "items_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "most", "\\u", "similar", "\\u", "users", "\\u", "User", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nho", "od", "\\u", "strategy_", "=_", "Near", "est", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "semi", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Pen", "ny", " ", "Fre", "wma", "n", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "all", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Pen", "ny", " ", "Fre", "wma", "n", "'_", ",_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ",_", "'", "Shel", "dom", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Non", "-", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Exce", "ed", " ", "the", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Pen", "ny", " ", "Fre", "wma", "n", "'_", ",_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ",_", "'", "Shel", "dom", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Empty_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Shel", "dom", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nho", "od", "\\u", "strategy_", "=_", "Near", "est", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "semi", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ",_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Shel", "dom", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "all", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Shel", "dom", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Pen", "ny", " ", "Fre", "wma", "n", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Non", "-", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Exce", "ed", " ", "the", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Shel", "dom", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Pen", "ny", " ", "Fre", "wma", "n", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Empty_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "most", "\\u", "similar", "\\u", "users_", "(_", "'", "Shel", "dom", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recommend", "\\u", "Item", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items", "\\u", "strategy_", "=_", "Item", "s", "Neighbor", "hood", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "with", " ", "params", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "recommend", "_", "(_", "user", "\\u", "id_", "=_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "similarity_", "=_", "similarity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "with", "\\u", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "3.2", "059", "7_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "3.14", "717", "875", "5_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "with", " ", "params", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "recommend", "_", "(_", "user", "\\u", "id_", "=_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "similarity_", "=_", "similarity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "with", "\\u", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recommend", "\\u", "User", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nho", "od", "\\u", "strategy_", "=_", "Near", "est", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "with", " ", "params", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "recommend", "_", "(_", "user", "\\u", "id_", "=_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "similarity_", "=_", "similarity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "with", "\\u", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.4", "567", "433", "614", "64_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "2.4", "533", "79_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Semi", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Emp", "ty", " ", "Recommend", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "with", " ", "params", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "._", "recommend", "_", "(_", "user", "\\u", "id_", "=_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "similarity_", "=_", "similarity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "with", "\\u", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "You", ",", " ", "Me", " ", "and", " ", "Dup", "ree", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "(_", "1.0_", ",_", "rec", "sys_", "._", "recommend", "_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ")_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recommend", "\\u", "bec", "aus", "e\\u", "Item", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items", "\\u", "strategy_", "=_", "Item", "s", "Neighbor", "hood", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Full", " ", "Recommend", "ation", " ", "Be", "cause_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "over", "-", "items_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Semi", "_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Non", "-", "Exist", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "with", "\\u", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "(_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "4.0_", ")_", ",_", "(_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "3.5_", ")_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "boolean", "\\u", "matrix", "\\u", "model_", "\\u\\u\\uNL\\u\\u\\u_", "similarity_", "=_", "Item", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Full", " ", "Recommend", "ation", " ", "Be", "cause_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "over", "-", "items_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", ",_", "'", "Sna", "kes", " ", "on", " ", "a", " ", "Plan", "e", "'_", ",_", "'", "Lad", "y", " ", "in", " ", "the", " ", "Water", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Semi", "_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "The", " ", "Night", " ", "Listen", "er", "'_", ",_", "'", "Super", "man", " ", "Return", "s", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Non", "-", "Exist", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "Item", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "items", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recommend", "\\u", "bec", "aus", "e\\u", "User", "Base", "d", "Recommend", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nho", "od", "\\u", "strategy_", "=_", "Near", "est", "Neighbor", "s", "Strategy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "matrix", "\\u", "model_", ",_", "euclidean", "\\u", "distances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Full", " ", "Recommend", "ation", " ", "Be", "cause_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "over", "-", "items_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Semi", "_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Non", "-", "Exist", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "with", "\\u", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "(_", "'", "Lore", "na", " ", "Abr", "eu", "'_", ",_", "3.0_", ")_", ",_", "(_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "3.0_", ")_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "boolean", "\\u", "matrix", "\\u", "model_", "\\u\\u\\uNL\\u\\u\\u_", "similarity_", "=_", "User", "Simil", "arity_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "jac", "card", "\\u", "coefficient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Full", " ", "Recommend", "ation", " ", "Be", "cause_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ",_", "'", "Lore", "na", " ", "Abr", "eu", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "over", "-", "items_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", ",_", "'", "Luc", "iana", " ", "Nu", "nes", "'_", ",_", "'", "Lore", "na", " ", "Abr", "eu", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Semi", "_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "'", "Ste", "ve", " ", "Gat", "es", "'_", ",_", "'", "Marc", "el", " ", "Car", "aci", "olo", "'_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Leo", "pol", "do", " ", "Pi", "res", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Non", "-", "Exist", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "sys_", "=_", "User", "Base", "d", "Recommend", "er_", "(_", "boolean", "\\u", "matrix", "\\u", "model_", ",_", "similarity_", ",_", "nho", "od", "\\u", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "[_", "]_", ")_", ",_", "rec", "sys_", "._", "recommende", "d\\u", "bec", "aus", "e_", "(_", "'", "Mari", "a", " ", "Gab", "rie", "la", "'_", ",_", "'", "Ju", "st", " ", "My", " ", "Luc", "k", "'_", ",_", "2_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Imprecise assert
openstack/cloudbase-init/cloudbaseinit/tests/metadata/services/osconfigdrive/test_windows.py
[ { "content": " @mock.patch('os.path.exists')\n def _test_check_for_config_drive(self, mock_exists, exists=True,\n label=\"config-2\", fail=False):\n drive = \"C:\\\\\"\n self.osutils.get_volume_label.return_value = label\n mock_exists.return_value = exists\n\n with self.snatcher:\n response = self._config_manager._check_for_config_drive(drive)\n\n self.osutils.get_volume_label.assert_called_once_with(drive)\n if exists and not fail:\n self.assertEqual([\"Config Drive found on C:\\\\\"],\n self.snatcher.output)\n self.assertEqual(not fail, response)", "metadata": "root.TestWindowsConfigDriveManager._test_check_for_config_drive", "header": "['class', 'TestWindowsConfigDriveManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Window", "s", "Config", "Drive", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "os", ".", "path", ".", "exist", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "test\\u", "check", "\\u", "for", "\\u", "config", "\\u", "drive_", "(_", "self_", ",_", "mock", "\\u", "exists_", ",_", "exists_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\"", "config", "-", "2", "\"_", ",_", "fail_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drive_", "=_", "\"", "C", ":\\\\", "\\\\\"", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "osu", "tils_", "._", "get", "\\u", "volume", "\\u", "label_", "._", "return", "\\u", "value_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "exists_", "._", "return", "\\u", "value_", "=_", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "snat", "cher", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u", "config", "\\u", "manager_", "._", "\\u", "check", "\\u", "for", "\\u", "config", "\\u", "drive_", "(_", "drive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "osu", "tils_", "._", "get", "\\u", "volume", "\\u", "label_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "drive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exists_", "and_", "not_", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "[_", "\"", "Config", " ", "Drive", " ", "found", " ", "on", " ", "C", ":\\\\", "\\\\\"", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "snat", "cher", "_", "._", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "not_", "fail_", ",_", "response_", ")_", "\\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 ]
Use of the return value of a procedure
OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/geometry/stl_group.py
[ { "content": " def deform(self,**kwargs):\n \"\"\" deforms the geometry applying the new locations for the control points, given by body name\"\"\"\n for name,delta_C in kwargs.iteritems():\n i = self._i_comps[name]\n comp = self._comps[i]\n if isinstance(comp,Body):\n comp.deform(delta_C)\n else:\n comp.deform(*delta_C)\n self.list_parameters()", "metadata": "root.STLGroup.deform", "header": "['class', 'STLGroup', '(', 'Component', ')', ':', '___EOS___']", "index": 144 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "class_", "STL", "Group_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deform", "_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "deform", "s", " ", "the", " ", "geom", "etry", " ", "appl", "ying", " ", "the", " ", "new", " ", "location", "s", " ", "for", " ", "the", " ", "control", " ", "points", ",", " ", "give", "n", " ", "by", " ", "body", " ", "name", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "delta", "\\u", "C_", "in_", "kwargs_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "self_", "._", "\\u", "i", "\\u", "comps_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "self_", "._", "\\u", "comps_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "comp_", ",_", "Body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "deform", "_", "(_", "delta", "\\u", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "deform", "_", "(_", "*_", "delta", "\\u", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "list", "\\u", "parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
azoft-dev-team/imagrium/env/Lib/test/test_jython_initializer.py
[ { "content": "import os\nimport subprocess\nimport sys\nimport unittest\nfrom test import test_support\n\n\n\nif __name__ == \"__main__\":\n test_main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestUsingInitializer(unittest.TestCase):\n", "metadata": "root.TestUsingInitializer", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def test_syspath_initializer(self):\n fn = test_support.findfile('check_for_initializer_in_syspath.py')\n env = dict(CLASSPATH='tests/data/initializer',\n PATH=os.environ.get('PATH', ''))\n self.assertEquals(0, subprocess.call([sys.executable, fn], env=env))", "metadata": "root.TestUsingInitializer.test_syspath_initializer", "header": "['class', 'TestUsingInitializer', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 8 }, { "content": "def test_main():\n test_support.run_unittest(TestUsingInitializer)", "metadata": "root.test_main", "header": "['module', '___EOS___']", "index": 14 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test_", "import_", "test\\u", "support_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Us", "ing", "Initializer", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Us", "ing", "Initializer", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "sysp", "ath", "\\u", "initializer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "test\\u", "support_", "._", "find", "file_", "(_", "'", "check", "\\u", "for", "\\u", "initializer", "\\u", "in", "\\u", "sysp", "ath", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "dict_", "(_", "CLASS", "PATH_", "=_", "'", "tests", "/", "data", "/", "initializer", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "PATH", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "0_", ",_", "subprocess_", "._", "call_", "(_", "[_", "sys_", "._", "executable_", ",_", "fn_", "]_", ",_", "env_", "=_", "env_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "support_", "._", "run", "\\u", "unittest_", "(_", "Test", "Us", "ing", "Initializer", "_", ")_", "\\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, 4, 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, 4, 2, 2, 2, 2, 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
IDSIA/sacred/tests/test_experiment.py
[ { "content": "#!/usr/bin/env python\n# coding=utf-8\nfrom __future__ import division, print_function, unicode_literals\n\"\"\"Global Docstring\"\"\"\n\nfrom mock import patch\nimport pytest\nimport sys\n\nfrom sacred.experiment import Experiment\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": "@pytest.fixture\ndef ex():\n return Experiment('ator3000')", "metadata": "root.ex", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def test_main(ex):\n @ex.main\n def foo():\n pass\n\n assert 'foo' in ex.commands\n assert ex.commands['foo'] == foo\n assert ex.default_command == 'foo'", "metadata": "root.test_main", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def test_automain_imported(ex):\n main_called = [False]\n\n with patch.object(sys, 'argv', ['test.py']):\n\n @ex.automain\n def foo():\n main_called[0] = True\n\n assert 'foo' in ex.commands\n assert ex.commands['foo'] == foo\n assert ex.default_command == 'foo'\n assert main_called[0] is False", "metadata": "root.test_automain_imported", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def test_automain_script_runs_main(ex):\n global __name__\n oldname = __name__\n main_called = [False]\n\n try:\n __name__ = '__main__'\n with patch.object(sys, 'argv', ['test.py']):\n @ex.automain\n def foo():\n main_called[0] = True\n\n assert 'foo' in ex.commands\n assert ex.commands['foo'] == foo\n assert ex.default_command == 'foo'\n assert main_called[0] is True\n finally:\n __name__ = oldname", "metadata": "root.test_automain_script_runs_main", "header": "['module', '___EOS___']", "index": 42 }, { "content": "def test_fails_on_unused_config_updates(ex):\n @ex.config\n def cfg():\n a = 1\n c = 3\n\n @ex.main\n def foo(a, b=2):\n return a + b\n\n # normal config updates work\n assert ex.run(config_updates={'a': 3}).result == 5\n # not in config but used works\n assert ex.run(config_updates={'b': 8}).result == 9\n # unused but in config updates work\n assert ex.run(config_updates={'c': 9}).result == 3\n\n # unused config updates raise\n with pytest.raises(KeyError):\n ex.run(config_updates={'d': 3})", "metadata": "root.test_fails_on_unused_config_updates", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def test_fails_on_nested_unused_config_updates(ex):\n @ex.config\n def cfg():\n a = {'b': 1}\n d = {'e': 3}\n\n @ex.main\n def foo(a):\n return a['b']\n\n # normal config updates work\n assert ex.run(config_updates={'a': {'b': 2}}).result == 2\n # not in config but parent is works\n assert ex.run(config_updates={'a': {'c': 5}}).result == 1\n # unused but in config works\n assert ex.run(config_updates={'d': {'e': 7}}).result == 1\n\n # unused nested config updates raise\n with pytest.raises(KeyError):\n ex.run(config_updates={'d': {'f': 3}})", "metadata": "root.test_fails_on_nested_unused_config_updates", "header": "['module', '___EOS___']", "index": 84 }, { "content": "def test_considers_captured_functions_for_fail_on_unused_config(ex):\n @ex.config\n def cfg():\n a = 1\n\n @ex.capture\n def transmogrify(a, b=0):\n return a + b\n\n @ex.main\n def foo():\n return transmogrify()\n\n assert ex.run(config_updates={'a': 7}).result == 7\n assert ex.run(config_updates={'b': 3}).result == 4\n\n with pytest.raises(KeyError):\n ex.run(config_updates={'c': 3})", "metadata": "root.test_considers_captured_functions_for_fail_on_unused_config", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def test_used_prefix_for_fail_on_unused_config(ex):\n @ex.config\n def cfg():\n a = {'b': 1}\n\n @ex.capture(prefix='a')\n def transmogrify(b):\n return b\n\n @ex.main\n def foo():\n return transmogrify()\n\n assert ex.run(config_updates={'a': {'b': 3}}).result == 3\n\n with pytest.raises(KeyError):\n ex.run(config_updates={'b': 5})\n\n with pytest.raises(KeyError):\n ex.run(config_updates={'a': {'c': 5}})", "metadata": "root.test_used_prefix_for_fail_on_unused_config", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def test_using_a_named_config(ex):\n @ex.config\n def cfg():\n a = 1\n\n @ex.named_config\n def ncfg():\n a = 10\n\n @ex.main\n def run(a):\n return a\n\n assert ex.run().result == 1\n assert ex.run(named_configs=['ncfg']).result == 10", "metadata": "root.test_using_a_named_config", "header": "['module', '___EOS___']", "index": 148 } ]
[]
[]
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_", "\\u\\u", "future\\u\\u_", "import_", "division_", ",_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Global", " ", "Docs", "tring", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sac", "red_", "._", "experiment_", "import_", "Experiment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ex_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Experiment_", "(_", "'", "ator", "3000", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "main_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\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_", "assert_", "'", "foo", "'_", "in_", "ex_", "._", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "commands_", "[_", "'", "foo", "'_", "]_", "==_", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "default", "\\u", "command_", "==_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "autom", "ain", "\\u", "imported_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "\\u", "called_", "=_", "[_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "sys_", ",_", "'", "argv", "'_", ",_", "[_", "'", "test", ".", "py", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "autom", "ain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "\\u", "called_", "[_", "0_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "'", "foo", "'_", "in_", "ex_", "._", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "commands_", "[_", "'", "foo", "'_", "]_", "==_", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "default", "\\u", "command_", "==_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "main", "\\u", "called_", "[_", "0_", "]_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "autom", "ain", "\\u", "script", "\\u", "runs", "\\u", "main_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oldn", "ame_", "=_", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "\\u", "called_", "=_", "[_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "name\\u\\u_", "=_", "'\\u", "\\u", "main", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "sys_", ",_", "'", "argv", "'_", ",_", "[_", "'", "test", ".", "py", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "autom", "ain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "\\u", "called_", "[_", "0_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "'", "foo", "'_", "in_", "ex_", "._", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "commands_", "[_", "'", "foo", "'_", "]_", "==_", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "default", "\\u", "command_", "==_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "main", "\\u", "called_", "[_", "0_", "]_", "is_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "name\\u\\u_", "=_", "oldn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fail", "s", "\\u", "on", "\\u", "unu", "sed", "\\u", "config", "\\u", "updates_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "a_", ",_", "b_", "=_", "2_", ")_", ":_", "\\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_", "#", " ", "normal", " ", "config", " ", "update", "s", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "3_", "}_", ")_", "._", "result_", "==_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "in", " ", "config", " ", "but", " ", "used", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "b", "'_", ":_", "8_", "}_", ")_", "._", "result_", "==_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unu", "sed", " ", "but", " ", "in", " ", "config", " ", "update", "s", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "c", "'_", ":_", "9_", "}_", ")_", "._", "result_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unu", "sed", " ", "config", " ", "update", "s", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "d", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\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", "fail", "s", "\\u", "on", "\\u", "nest", "ed", "\\u", "unu", "sed", "\\u", "config", "\\u", "updates_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "{_", "'", "b", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "{_", "'", "e", "'_", ":_", "3_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "a_", ")_", ":_", "\\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_", "#", " ", "normal", " ", "config", " ", "update", "s", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "b", "'_", ":_", "2_", "}_", "}_", ")_", "._", "result_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "in", " ", "config", " ", "but", " ", "parent", " ", "is", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "c", "'_", ":_", "5_", "}_", "}_", ")_", "._", "result_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unu", "sed", " ", "but", " ", "in", " ", "config", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "d", "'_", ":_", "{_", "'", "e", "'_", ":_", "7_", "}_", "}_", ")_", "._", "result_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unu", "sed", " ", "nest", "ed", " ", "config", " ", "update", "s", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "d", "'_", ":_", "{_", "'", "f", "'_", ":_", "3_", "}_", "}_", ")_", "\\u\\u\\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", "consider", "s", "\\u", "captured", "\\u", "function", "s", "\\u", "for", "\\u", "fail", "\\u", "on", "\\u", "unu", "sed", "\\u", "config_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "capture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trans", "mog", "rif", "y_", "(_", "a_", ",_", "b_", "=_", "0_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "trans", "mog", "rif", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "7_", "}_", ")_", "._", "result_", "==_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "b", "'_", ":_", "3_", "}_", ")_", "._", "result_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "c", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\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", "used", "\\u", "prefix", "\\u", "for", "\\u", "fail", "\\u", "on", "\\u", "unu", "sed", "\\u", "config_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "{_", "'", "b", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "capture_", "(_", "prefix_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trans", "mog", "rif", "y_", "(_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "trans", "mog", "rif", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "b", "'_", ":_", "3_", "}_", "}_", ")_", "._", "result_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "b", "'_", ":_", "5_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "c", "'_", ":_", "5_", "}_", "}_", ")_", "\\u\\u\\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", "usi", "ng", "\\u", "a", "\\u", "named", "\\u", "config_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "named", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ncf", "g_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", ")_", "._", "result_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "named", "\\u", "configs_", "=_", "[_", "'", "ncf", "g", "'_", "]_", ")_", "._", "result_", "==_", "10_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Unused import
hirokiky/django-reportmail/tests/test_command.py
[ { "content": "from django.test import TestCase\nfrom django.test.utils import override_settings\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@override_settings(ADMINS=(('admin', 'admin@example.com'),),\n EMAIL_SUBJECT_PREFIX=\"\")\nclass TestApplyReporter(TestCase):\n\n\n", "metadata": "root.TestApplyReporter", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def _makeOne(self, *args, **kwargs):\n from reportmail.command import apply_reporter\n return apply_reporter(*args, **kwargs)", "metadata": "root.TestApplyReporter._makeOne", "header": "['class', 'TestApplyReporter', '(', 'TestCase', ')', ':', '___EOS___']", "index": 7 }, { "content": " def test__it(self):\n class DummySelf(object):\n __module__ = '__module__'\n wrapper = self._makeOne(\"Title\")\n\n def wrapped(self, reporter, *args, **options):\n reporter.append(\"Stored\")\n return reporter, args, options\n\n r, a, o = wrapper(wrapped)(DummySelf(), 'arg', test='option')\n self.assertEqual(r.subject, \"Title\")\n self.assertEqual(r.template, 'reportmail/command_report.txt')\n self.assertEqual(r.base_context, {'args': a, 'options': o,\n 'command': '__module__'})\n self.assertEqual(r.stored_text, [\"Stored\"])\n self.assertEqual(a, ('arg',))\n self.assertEqual(o, {'test': 'option'})\n\n from django.core import mail\n self.assertEqual(len(mail.outbox), 1)\n self.assertEqual(mail.outbox[0].subject, 'Title')\n self.assertEqual(mail.outbox[0].body, \"\"\"\\\nReport of __module__\nargs: arg,\noptions: test=option,\n\nresult:\nStored\n\"\"\")", "metadata": "root.TestApplyReporter.test__it", "header": "['class', 'TestApplyReporter', '(', 'TestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def test__additional_context(self):\n class DummySelf(object):\n __module__ = '__module__'\n wrapper = self._makeOne(\"Title\", additional_context={'more': 'data'})\n\n def wrapped(self, reporter, *args, **options):\n reporter.append(\"Stored\")\n return reporter, args, options\n\n r, a, o = wrapper(wrapped)(DummySelf(), 'arg', test='option')\n self.assertEqual(r.subject, \"Title\")\n self.assertEqual(r.template, 'reportmail/command_report.txt')\n self.assertEqual(r.base_context, {'args': a, 'options': o,\n 'command': '__module__',\n 'more': 'data'})\n self.assertEqual(r.stored_text, [\"Stored\"])\n self.assertEqual(a, ('arg',))\n self.assertEqual(o, {'test': 'option'})\n\n from django.core import mail\n self.assertEqual(len(mail.outbox), 1)\n self.assertEqual(mail.outbox[0].subject, 'Title')\n # Template doesn't use the 'more' key, so can't test the rendered output\n self.assertEqual(mail.outbox[0].body, \"\"\"\\\nReport of __module__\nargs: arg,\noptions: test=option,\n\nresult:\nStored\n\"\"\")", "metadata": "root.TestApplyReporter.test__additional_context", "header": "['class', 'TestApplyReporter', '(', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test__unexpected_error_occurred(self):\n class DummySelf(object):\n __module__ = '__module__'\n\n wrapper = self._makeOne(\"Title\")\n\n def wrapped(self, reporter, *args, **options):\n reporter.append(\"Stored\")\n raise Exception(\"KADOOOOM!!!!!\")\n\n with self.assertRaises(Exception):\n wrapper(wrapped)(DummySelf(), 'arg', test='option')\n\n from django.core import mail\n self.assertEqual(len(mail.outbox), 1)\n self.assertEqual(mail.outbox[0].subject, 'Title')\n self.assertEqual(mail.outbox[0].body[:120], \"\"\"\\\nReport of __module__\nargs: arg,\noptions: test=option,\n\nresult:\nStored\nKADOOOOM!!!!!\n\nTraceback (most recent call last):\n\"\"\")", "metadata": "root.TestApplyReporter.test__unexpected_error_occurred", "header": "['class', 'TestApplyReporter', '(', 'TestCase', ')', ':', '___EOS___']", "index": 73 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "utils_", "import_", "override", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "override", "\\u", "settings_", "(_", "ADMINS_", "=_", "(_", "(_", "'", "admin", "'_", ",_", "'", "admin", "@", "example", ".", "com", "'_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EMA", "IL", "\\u", "SUBJECT", "\\u", "PREFIX_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "Apply", "Reporter_", "(_", "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_", "[SEP]_", "class_", "Test", "Apply", "Reporter_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "make", "One_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "report", "mail_", "._", "command_", "import_", "appl", "y", "\\u", "reporter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "appl", "y", "\\u", "reporter_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Apply", "Reporter_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "it_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Self", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "module\\u\\u_", "=_", "'\\u", "\\u", "module", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrapper_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "wrapped_", "(_", "self_", ",_", "reporter_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reporter_", "._", "append_", "(_", "\"", "Stor", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "reporter_", ",_", "args_", ",_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", ",_", "a_", ",_", "o_", "=_", "wrapper_", "(_", "wrapped_", ")_", "(_", "Du", "mm", "y", "Self", "_", "(_", ")_", ",_", "'", "arg", "'_", ",_", "test_", "=_", "'", "option", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "subject_", ",_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "template_", ",_", "'", "report", "mail", "/", "command", "\\u", "report", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "base", "\\u", "context_", ",_", "{_", "'", "args", "'_", ":_", "a_", ",_", "'", "options", "'_", ":_", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "command", "'_", ":_", "'\\u", "\\u", "module", "\\u\\u'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "store", "d\\u", "text_", ",_", "[_", "\"", "Stor", "ed", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "(_", "'", "arg", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "o_", ",_", "{_", "'", "test", "'_", ":_", "'", "option", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "subject_", ",_", "'", "Tit", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "body_", ",_", "\"\"\"", "\\\\", "\\", "10", ";", "Report", " ", "of", " ", "\\u\\u", "module", "\\u\\u", "\\", "10", ";", "args", ":", " ", "arg", ",", "\\", "10", ";", "options", ":", " ", "test", "=", "option", ",", "\\", "10", ";", "\\", "10", ";", "result", ":", "\\", "10", ";", "Stor", "ed", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Apply", "Reporter_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "addition", "al", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Self", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "module\\u\\u_", "=_", "'\\u", "\\u", "module", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrapper_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\"", "Tit", "le", "\"_", ",_", "addition", "al", "\\u", "context_", "=_", "{_", "'", "more", "'_", ":_", "'", "data", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "wrapped_", "(_", "self_", ",_", "reporter_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reporter_", "._", "append_", "(_", "\"", "Stor", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "reporter_", ",_", "args_", ",_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", ",_", "a_", ",_", "o_", "=_", "wrapper_", "(_", "wrapped_", ")_", "(_", "Du", "mm", "y", "Self", "_", "(_", ")_", ",_", "'", "arg", "'_", ",_", "test_", "=_", "'", "option", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "subject_", ",_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "template_", ",_", "'", "report", "mail", "/", "command", "\\u", "report", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "base", "\\u", "context_", ",_", "{_", "'", "args", "'_", ":_", "a_", ",_", "'", "options", "'_", ":_", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "command", "'_", ":_", "'\\u", "\\u", "module", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "more", "'_", ":_", "'", "data", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "store", "d\\u", "text_", ",_", "[_", "\"", "Stor", "ed", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "(_", "'", "arg", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "o_", ",_", "{_", "'", "test", "'_", ":_", "'", "option", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "subject_", ",_", "'", "Tit", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Templa", "te", " ", "doe", "sn", "'", "t", " ", "use", " ", "the", " ", "'", "more", "'", " ", "key", ",", " ", "so", " ", "can", "'", "t", " ", "test", " ", "the", " ", "render", "ed", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "body_", ",_", "\"\"\"", "\\\\", "\\", "10", ";", "Report", " ", "of", " ", "\\u\\u", "module", "\\u\\u", "\\", "10", ";", "args", ":", " ", "arg", ",", "\\", "10", ";", "options", ":", " ", "test", "=", "option", ",", "\\", "10", ";", "\\", "10", ";", "result", ":", "\\", "10", ";", "Stor", "ed", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Apply", "Reporter_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "unexpected", "\\u", "error", "\\u", "occur", "red_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Self", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "module\\u\\u_", "=_", "'\\u", "\\u", "module", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrapper_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "wrapped_", "(_", "self_", ",_", "reporter_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reporter_", "._", "append_", "(_", "\"", "Stor", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "KA", "DOO", "OOM", "!!!", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapper_", "(_", "wrapped_", ")_", "(_", "Du", "mm", "y", "Self", "_", "(_", ")_", ",_", "'", "arg", "'_", ",_", "test_", "=_", "'", "option", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "subject_", ",_", "'", "Tit", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "body_", "[_", ":_", "120_", "]_", ",_", "\"\"\"", "\\\\", "\\", "10", ";", "Report", " ", "of", " ", "\\u\\u", "module", "\\u\\u", "\\", "10", ";", "args", ":", " ", "arg", ",", "\\", "10", ";", "options", ":", " ", "test", "=", "option", ",", "\\", "10", ";", "\\", "10", ";", "result", ":", "\\", "10", ";", "Stor", "ed", "\\", "10", ";", "KA", "DOO", "OOM", "!!!", "!!", "\\", "10", ";", "\\", "10", ";", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";\"\"\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
QingdaoU/OnlineJudge/judge_dispatcher/tasks.py
[ { "content": " def judge(self):\n self.submission.judge_start_time = int(time.time() * 1000)\n\n judge_server = self.choose_judge_server()\n\n # 如果没有合适的判题服务器,就放入等待队列中等待判题\n if not judge_server:\n JudgeWaitingQueue.objects.create(submission_id=self.submission.id, time_limit=self.time_limit,\n memory_limit=self.memory_limit, test_case_id=self.test_case_id,\n spj=self.spj, spj_language=self.spj_language, spj_code=self.spj_code,\n spj_version=self.spj_version)\n return\n\n try:\n s = TimeoutServerProxy(\"http://\" + judge_server.ip + \":\" + str(judge_server.port),\n timeout=30)\n\n data = s.run(judge_server.token, self.submission.id, self.submission.language,\n self.submission.code, self.time_limit, self.memory_limit, self.test_case_id,\n self.spj, self._none_to_false(self.spj_language),\n self._none_to_false(self.spj_code), self._none_to_false(self.spj_version))\n # 编译错误\n if data[\"code\"] == 1:\n self.submission.result = result[\"compile_error\"]\n self.submission.info = data[\"data\"][\"error\"]\n # system error\n elif data[\"code\"] == 2:\n self.submission.result = result[\"system_error\"]\n self.submission.info = data[\"data\"][\"error\"]\n elif data[\"code\"] == 0:\n self.submission.result = data[\"data\"][\"result\"]\n self.submission.info = json.dumps(data[\"data\"][\"info\"])\n self.submission.accepted_answer_time = data[\"data\"][\"accepted_answer_time\"]\n except Exception as e:\n self.submission.result = result[\"system_error\"]\n self.submission.info = str(e)\n finally:\n self.release_judge_instance(judge_server.id)\n\n self.submission.judge_end_time = int(time.time() * 1000)\n self.submission.save(update_fields=[\"judge_start_time\", \"result\", \"info\", \"accepted_answer_time\", \"judge_end_time\"])\n\n if self.submission.contest_id:\n self.update_contest_problem_status()\n else:\n self.update_problem_status()\n\n with transaction.atomic():\n waiting_submissions = JudgeWaitingQueue.objects.select_for_update().all()\n if waiting_submissions.exists():\n # 防止循环依赖\n from submission.tasks import _judge\n\n waiting_submission = waiting_submissions.first()\n waiting_submission.delete()\n _judge.delay(submission_id=waiting_submission.submission_id,\n time_limit=waiting_submission.time_limit,\n memory_limit=waiting_submission.memory_limit,\n test_case_id=waiting_submission.test_case_id,\n spj=waiting_submission.spj,\n spj_language=waiting_submission.spj_language,\n spj_code=waiting_submission.spj_code,\n spj_version=waiting_submission.spj_version)", "metadata": "root.JudgeDispatcher.judge", "header": "['class', 'JudgeDispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 57 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Jud", "ge", "Dispatcher_", "(_", "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_", "judge", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "submission_", "._", "judge", "\\u", "start", "\\u", "time_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "judge", "\\u", "server_", "=_", "self_", "._", "choose", "\\u", "judge", "\\u", "server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\", "229", "14", ";", "\\", "265", "24", ";", "\\", "278", "09", ";", "\\", "263", "7", "7", ";", "\\", "215", "1", "2", ";", "\\", "368", "6", "6", ";", "\\", "303", "40", ";", "\\", "210", "2", "8", ";", "\\", "390", "64", ";", "\\", "263", "8", "1", ";", "\\", "211", "5", "3", ";", "\\", "221", "20", ";", "\\", "652", "9", "2", ";", "\\", "236", "01", ";", "\\", "259", "1", "8", ";", "\\", "208", "3", "7", ";", "\\", "315", "6", "1", ";", "\\", "244", "5", "3", ";", "\\", "384", "3", "1", ";", "\\", "210", "15", ";", "\\", "200", "13", ";", "\\", "315", "6", "1", ";", "\\", "244", "5", "3", ";", "\\", "210", "2", "8", ";", "\\", "390", "64", ";_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "judge", "\\u", "server_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Jud", "ge", "Wait", "ing", "Queue_", "._", "objects_", "._", "create_", "(_", "subm", "ission", "\\u", "id_", "=_", "self_", "._", "submission_", "._", "id_", ",_", "time", "\\u", "limit_", "=_", "self_", "._", "time", "\\u", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory", "\\u", "limit_", "=_", "self_", "._", "memory", "\\u", "limit_", ",_", "test\\u", "case", "\\u", "id_", "=_", "self_", "._", "test\\u", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "j_", "=_", "self_", "._", "sp", "j_", ",_", "sp", "j", "\\u", "language_", "=_", "self_", "._", "sp", "j", "\\u", "language_", ",_", "sp", "j", "\\u", "code_", "=_", "self_", "._", "sp", "j", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "j", "\\u", "version_", "=_", "self_", "._", "sp", "j", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Time", "out", "Server", "Proxy_", "(_", "\"", "http", "://\"_", "+_", "judge", "\\u", "server_", "._", "ip_", "+_", "\":\"_", "+_", "str_", "(_", "judge", "\\u", "server_", "._", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "s_", "._", "run_", "(_", "judge", "\\u", "server_", "._", "token_", ",_", "self_", "._", "submission_", "._", "id_", ",_", "self_", "._", "submission_", "._", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "submission_", "._", "code_", ",_", "self_", "._", "time", "\\u", "limit_", ",_", "self_", "._", "memory", "\\u", "limit_", ",_", "self_", "._", "test\\u", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sp", "j_", ",_", "self_", "._", "\\u", "none", "\\u", "to", "\\u", "false_", "(_", "self_", "._", "sp", "j", "\\u", "language_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "none", "\\u", "to", "\\u", "false_", "(_", "self_", "._", "sp", "j", "\\u", "code_", ")_", ",_", "self_", "._", "\\u", "none", "\\u", "to", "\\u", "false_", "(_", "self_", "._", "sp", "j", "\\u", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\", "325", "3", "4", ";", "\\", "357", "9", "3", ";", "\\", "381", "6", "9", ";", "\\", "358", "23", ";_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data_", "[_", "\"", "code", "\"_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "submission_", "._", "result_", "=_", "result_", "[_", "\"", "compile", "\\u", "error", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submission_", "._", "info_", "=_", "data_", "[_", "\"", "data", "\"_", "]_", "[_", "\"", "error", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "system", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "[_", "\"", "code", "\"_", "]_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "submission_", "._", "result_", "=_", "result_", "[_", "\"", "system", "\\u", "error", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submission_", "._", "info_", "=_", "data_", "[_", "\"", "data", "\"_", "]_", "[_", "\"", "error", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "[_", "\"", "code", "\"_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "submission_", "._", "result_", "=_", "data_", "[_", "\"", "data", "\"_", "]_", "[_", "\"", "result", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submission_", "._", "info_", "=_", "json_", "._", "dumps_", "(_", "data_", "[_", "\"", "data", "\"_", "]_", "[_", "\"", "info", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submission_", "._", "accept", "ed", "\\u", "answer", "\\u", "time_", "=_", "data_", "[_", "\"", "data", "\"_", "]_", "[_", "\"", "accept", "ed", "\\u", "answer", "\\u", "time", "\"_", "]_", "\\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 ", " _", "self_", "._", "submission_", "._", "result_", "=_", "result_", "[_", "\"", "system", "\\u", "error", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submission_", "._", "info_", "=_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "release", "\\u", "judge", "\\u", "instance_", "(_", "judge", "\\u", "server_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "submission_", "._", "judge", "\\u", "end", "\\u", "time_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submission_", "._", "save_", "(_", "update", "\\u", "fields_", "=_", "[_", "\"", "judge", "\\u", "start", "\\u", "time", "\"_", ",_", "\"", "result", "\"_", ",_", "\"", "info", "\"_", ",_", "\"", "accept", "ed", "\\u", "answer", "\\u", "time", "\"_", ",_", "\"", "judge", "\\u", "end", "\\u", "time", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "submission_", "._", "contest", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "contest", "\\u", "problem", "\\u", "status_", "(_", ")_", "\\u\\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_", "._", "update", "\\u", "problem", "\\u", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "transaction_", "._", "atomic_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wait", "ing", "\\u", "submissions_", "=_", "Jud", "ge", "Wait", "ing", "Queue_", "._", "objects_", "._", "select", "\\u", "for", "\\u", "update_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wait", "ing", "\\u", "submissions_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\", "384", "50", ";", "\\", "274", "90", ";", "\\", "244", "90", ";", "\\", "296", "15", ";", "\\", "203", "8", "1", ";", "\\", "361", "8", "2", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "submission_", "._", "tasks_", "import_", "\\u", "judge", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wait", "ing", "\\u", "submission_", "=_", "wait", "ing", "\\u", "submissions_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wait", "ing", "\\u", "submission_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "judge", "_", "._", "delay_", "(_", "subm", "ission", "\\u", "id_", "=_", "wait", "ing", "\\u", "submission_", "._", "subm", "ission", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "limit_", "=_", "wait", "ing", "\\u", "submission_", "._", "time", "\\u", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory", "\\u", "limit_", "=_", "wait", "ing", "\\u", "submission_", "._", "memory", "\\u", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "case", "\\u", "id_", "=_", "wait", "ing", "\\u", "submission_", "._", "test\\u", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "j_", "=_", "wait", "ing", "\\u", "submission_", "._", "sp", "j_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "j", "\\u", "language_", "=_", "wait", "ing", "\\u", "submission_", "._", "sp", "j", "\\u", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "j", "\\u", "code_", "=_", "wait", "ing", "\\u", "submission_", "._", "sp", "j", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "j", "\\u", "version_", "=_", "wait", "ing", "\\u", "submission_", "._", "sp", "j", "\\u", "version_", ")_", "\\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 ]
Unnecessary pass
BasicWolf/kaylee/kaylee/errors.py
[ { "content": "class KayleeProjectAssertError(KayleeError):\n \"\"\"Base class for all Kaylee project-related runtime assertion\n (regular, **not** Python ``asert`` checks) errors.\"\"\"\n pass", "metadata": "root.KayleeProjectAssertError", "header": "['module', '___EOS___']", "index": 18 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ka", "yle", "e", "Project", "Assert", "Error_", "(_", "Ka", "yle", "e", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "all", " ", "Ka", "yle", "e", " ", "project", "-", "relate", "d", " ", "runt", "ime", " ", "assertion", "\\", "10", ";", " ", " ", " ", " ", "(", "regular", ",", " ", "**", "not", "**", " ", "Pyth", "on", " ", "``", "ase", "rt", "``", " ", "checks", ")", " ", "error", "s", ".\"\"\"_", "\\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 ]
Comparison of constants
kmike/port-for/port_for/docopt.py
[ { "content": "def parse_args(source, options):\n tokens = TokenStream(source, DocoptExit)\n options = copy(options)\n parsed = []\n while tokens.current() is not None:\n if tokens.current() == '--':\n return parsed + [Argument(None, v) for v in tokens]\n elif tokens.current().startswith('--'):\n parsed += parse_long(tokens, options)\n elif tokens.current().startswith('-') and tokens.current() != '-':\n parsed += parse_shorts(tokens, options)\n else:\n parsed.append(Argument(None, tokens.move()))\n return parsed", "metadata": "root.parse_args", "header": "['module', '___EOS___']", "index": 395 } ]
[]
[]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "args_", "(_", "source_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "Token", "Stream_", "(_", "source_", ",_", "Doc", "opt", "Exit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "copy_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tokens_", "._", "current_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tokens_", "._", "current_", "(_", ")_", "==_", "'--'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "parsed_", "+_", "[_", "Argument_", "(_", "None_", ",_", "v_", ")_", "for_", "v_", "in_", "tokens_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tokens_", "._", "current_", "(_", ")_", "._", "startswith_", "(_", "'--'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "+=_", "parse", "\\u", "long_", "(_", "tokens_", ",_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tokens_", "._", "current_", "(_", ")_", "._", "startswith_", "(_", "'-'_", ")_", "and_", "tokens_", "._", "current_", "(_", ")_", "!=_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "+=_", "parse", "\\u", "short", "s_", "(_", "tokens_", ",_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "._", "append_", "(_", "Argument_", "(_", "None_", ",_", "tokens_", "._", "move_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "parsed_", "\\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 ]
Unused import
gbeced/pyalgotrade/pyalgotrade/dispatcher.py
[ { "content": "# PyAlgoTrade\n#\n# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz\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.. moduleauthor:: Gabriel Martin Becedillas Ruiz <gabriel.becedillas@gmail.com>\n\"\"\"\n\nfrom pyalgotrade import utils\nfrom pyalgotrade import observer\nfrom pyalgotrade import dispatchprio\n\n\n# This class is responsible for dispatching events from multiple subjects, synchronizing them if necessary.\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Dispatcher(object):\n\n # Returns the current event datetime. It may be None for events from realtime subjects.\n\n\n\n\n\n\n # Return True if events were dispatched.\n\n # Returns a tuple with booleans\n # 1: True if all subjects hit eof\n # 2: True if at least one subject dispatched events.\n", "metadata": "root.Dispatcher", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def __init__(self):\n self.__subjects = []\n self.__stop = False\n self.__startEvent = observer.Event()\n self.__idleEvent = observer.Event()\n self.__currDateTime = None", "metadata": "root.Dispatcher.__init__", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": " def getCurrentDateTime(self):\n return self.__currDateTime", "metadata": "root.Dispatcher.getCurrentDateTime", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def getStartEvent(self):\n return self.__startEvent", "metadata": "root.Dispatcher.getStartEvent", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def getIdleEvent(self):\n return self.__idleEvent", "metadata": "root.Dispatcher.getIdleEvent", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": " def stop(self):\n self.__stop = True", "metadata": "root.Dispatcher.stop", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def getSubjects(self):\n return self.__subjects", "metadata": "root.Dispatcher.getSubjects", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def addSubject(self, subject):\n # Skip the subject if it was already added.\n if subject in self.__subjects:\n return\n\n # If the subject has no specific dispatch priority put it right at the end.\n if subject.getDispatchPriority() is dispatchprio.LAST:\n self.__subjects.append(subject)\n else:\n # Find the position according to the subject's priority.\n pos = 0\n for s in self.__subjects:\n if s.getDispatchPriority() is dispatchprio.LAST or subject.getDispatchPriority() < s.getDispatchPriority():\n break\n pos += 1\n self.__subjects.insert(pos, subject)\n\n subject.onDispatcherRegistered(self)", "metadata": "root.Dispatcher.addSubject", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " def __dispatchSubject(self, subject, currEventDateTime):\n ret = False\n # Dispatch if the datetime is currEventDateTime of if its a realtime subject.\n if not subject.eof() and subject.peekDateTime() in (None, currEventDateTime):\n ret = subject.dispatch() is True\n return ret", "metadata": "root.Dispatcher.__dispatchSubject", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 70 }, { "content": " def __dispatch(self):\n smallestDateTime = None\n eof = True\n eventsDispatched = False\n\n # Scan for the lowest datetime.\n for subject in self.__subjects:\n if not subject.eof():\n eof = False\n smallestDateTime = utils.safe_min(smallestDateTime, subject.peekDateTime())\n\n # Dispatch realtime subjects and those subjects with the lowest datetime.\n if not eof:\n self.__currDateTime = smallestDateTime\n\n for subject in self.__subjects:\n if self.__dispatchSubject(subject, smallestDateTime):\n eventsDispatched = True\n return eof, eventsDispatched", "metadata": "root.Dispatcher.__dispatch", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 80 }, { "content": " def run(self):\n try:\n for subject in self.__subjects:\n subject.start()\n\n self.__startEvent.emit()\n\n while not self.__stop:\n eof, eventsDispatched = self.__dispatch()\n if eof:\n self.__stop = True\n elif not eventsDispatched:\n self.__idleEvent.emit()\n finally:\n for subject in self.__subjects:\n subject.stop()\n for subject in self.__subjects:\n subject.join()", "metadata": "root.Dispatcher.run", "header": "['class', 'Dispatcher', '(', 'object', ')', ':', '___EOS___']", "index": 100 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Py", "Algo", "Trade", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", "-", "201", "5", " ", "Gab", "rie", "l", " ", "Mart", "in", " ", "Be", "ced", "illa", "s", " ", "Ru", "iz_", "\\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_", "\"\"\"", "\\", "10", ";", "..", " ", "module", "author", "::", " ", "Gab", "rie", "l", " ", "Mart", "in", " ", "Be", "ced", "illa", "s", " ", "Ru", "iz", " ", "<", "gab", "rie", "l", ".", "bec", "edi", "lla", "s", "@", "gma", "il", ".", "com", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pya", "lg", "otr", "ade_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "lg", "otr", "ade_", "import_", "observer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "lg", "otr", "ade_", "import_", "dispatch", "prio", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "class", " ", "is", " ", "responsib", "le", " ", "for", " ", "dispatch", "ing", " ", "events", " ", "from", " ", "multiple", " ", "subject", "s", ",", " ", "synchron", "izi", "ng", " ", "them", " ", "if", " ", "necessar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", "s", " ", "the", " ", "current", " ", "event", " ", "datetime", ".", " ", "It", " ", "may", " ", "be", " ", "Non", "e", " ", "for", " ", "events", " ", "from", " ", "realtime", " ", "subject", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "Tru", "e", " ", "if", " ", "events", " ", "wer", "e", " ", "dispatch", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", "s", " ", "a", " ", "tuple", " ", "with", " ", "boolean", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ":", " ", "Tru", "e", " ", "if", " ", "all", " ", "subject", "s", " ", "hit", " ", "eof_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ":", " ", "Tru", "e", " ", "if", " ", "at", " ", "leas", "t", " ", "one", " ", "subject", " ", "dispatch", "ed", " ", "events", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "subjects_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "stop_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "start", "Event_", "=_", "observer_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "idle", "Event_", "=_", "observer_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "curr", "Date", "Time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Curr", "ent", "Date", "Time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "curr", "Date", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Start", "Event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "start", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Id", "le", "Event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "idle", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "stop_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Sub", "ject", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "subjects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Subject_", "(_", "self_", ",_", "subject_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "the", " ", "subject", " ", "if", " ", "it", " ", "was", " ", "alr", "ead", "y", " ", "adde", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "subject_", "in_", "self_", "._", "\\u\\u", "subjects_", ":_", "\\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_", "#", " ", "If", " ", "the", " ", "subject", " ", "has", " ", "no", " ", "specific", " ", "dispatch", " ", "priorit", "y", " ", "put", " ", "it", " ", "right", " ", "at", " ", "the", " ", "end", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subject_", "._", "get", "Dispa", "tch", "Priority_", "(_", ")_", "is_", "dispatch", "prio", "_", "._", "LAST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "subjects_", "._", "append_", "(_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "position", " ", "according", " ", "to", " ", "the", " ", "subject", "'", "s", " ", "priorit", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "self_", "._", "\\u\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "._", "get", "Dispa", "tch", "Priority_", "(_", ")_", "is_", "dispatch", "prio", "_", "._", "LAST_", "or_", "subject_", "._", "get", "Dispa", "tch", "Priority_", "(_", ")_", "<_", "s_", "._", "get", "Dispa", "tch", "Priority_", "(_", ")_", ":_", "\\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_", "pos_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "subjects_", "._", "insert_", "(_", "pos_", ",_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subject_", "._", "on", "Dispatcher", "Register", "ed_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "dispatch", "Subject_", "(_", "self_", ",_", "subject_", ",_", "curr", "Event", "Date", "Time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dispa", "tch", " ", "if", " ", "the", " ", "datetime", " ", "is", " ", "curr", "Event", "Date", "Time", " ", "of", " ", "if", " ", "its", " ", "a", " ", "realtime", " ", "subject", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "subject_", "._", "eof_", "(_", ")_", "and_", "subject_", "._", "peek", "Date", "Time_", "(_", ")_", "in_", "(_", "None_", ",_", "curr", "Event", "Date", "Time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "subject_", "._", "dispatch_", "(_", ")_", "is_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "dispatch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "smallest", "Date", "Time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eof_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events", "Dispa", "tche", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sca", "n", " ", "for", " ", "the", " ", "lowe", "st", " ", "datetime", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "subject_", "in_", "self_", "._", "\\u\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "subject_", "._", "eof_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eof_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "smallest", "Date", "Time_", "=_", "utils_", "._", "safe", "\\u", "min_", "(_", "smallest", "Date", "Time_", ",_", "subject_", "._", "peek", "Date", "Time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dispa", "tch", " ", "realtime", " ", "subject", "s", " ", "and", " ", "tho", "se", " ", "subject", "s", " ", "with", " ", "the", " ", "lowe", "st", " ", "datetime", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "eof_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "curr", "Date", "Time_", "=_", "smallest", "Date", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "subject_", "in_", "self_", "._", "\\u\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "dispatch", "Subject_", "(_", "subject_", ",_", "smallest", "Date", "Time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "events", "Dispa", "tche", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "eof_", ",_", "events", "Dispa", "tche", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "subject_", "in_", "self_", "._", "\\u\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "start", "Event_", "._", "emit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "\\u\\u", "stop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eof_", ",_", "events", "Dispa", "tche", "d_", "=_", "self_", "._", "\\u\\u", "dispatch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "eof_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u\\u", "stop_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "events", "Dispa", "tche", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u\\u", "idle", "Event_", "._", "emit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "subject_", "in_", "self_", "._", "\\u\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subject_", "in_", "self_", "._", "\\u\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject_", "._", "join_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 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
marteinn/AtomicPress/examples/base-example/settings/prod.py
[ { "content": "import os\nfrom .base import * # NOQA\n\n\nDEBUG = False\nSECRET_KEY = os.environ.get(\"SECRET_KEY\")\nFREEZER_BASE_URL = Path(\"/blog/\")\nSTATIC_URL = FREEZER_BASE_URL.child(\"static\")\nUPLOADS_URL = FREEZER_BASE_URL.child(\"uploads\")\nGIST_BACKEND_RENDERING = False\nSITE_URL = \"http://marteinn.se/blog\"\n\nFREEZER_DESTINATION = PROJECT_ROOT.child(\"blog\")\n\nGA_TRACKING = os.environ.get(\"GA_TRACKING\")\n\nAWS_ACCESS_KEY_ID = os.environ.get(\"AWS_ACCESS_KEY_ID\")\nAWS_ACCESS_KEY = os.environ.get(\"AWS_ACCESS_KEY\")\nS3_BUCKET = os.environ.get(\"S3_BUCKET\")\nS3_DESTINATION = os.environ.get(\"S3_DESTINATION\")\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_", "._", "base_", "import_", "*_", "#", " ", "NO", "QA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEC", "RET", "\\u", "KEY_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "SEC", "RET", "\\u", "KEY", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FREE", "ZE", "R", "\\u", "BASE", "\\u", "URL_", "=_", "Path_", "(_", "\"/", "blog", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATI", "C", "\\u", "URL_", "=_", "FREE", "ZE", "R", "\\u", "BASE", "\\u", "URL_", "._", "child_", "(_", "\"", "static", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UPLOAD", "S", "\\u", "URL_", "=_", "FREE", "ZE", "R", "\\u", "BASE", "\\u", "URL_", "._", "child_", "(_", "\"", "uploads", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GI", "ST", "\\u", "BACK", "END", "\\u", "RENDER", "ING_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SITE", "\\u", "URL_", "=_", "\"", "http", "://", "mart", "ein", "n", ".", "se", "/", "blog", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FREE", "ZE", "R", "\\u", "DEST", "INATION", "_", "=_", "PROJECT", "\\u", "ROOT_", "._", "child_", "(_", "\"", "blog", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "GA", "\\u", "TRACK", "ING_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "GA", "\\u", "TRACK", "ING", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "3", "\\u", "BUCKET", "_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "S", "3", "\\u", "BUCKET", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "3", "\\u", "DEST", "INATION", "_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "S", "3", "\\u", "DEST", "INATION", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
AppScale/appscale/AppServer/lib/webob-1.2.3/webob/cookies.py
[ { "content": " def __delitem__(self, name):\n name = self._valid_cookie_name(name)\n found = self._mutate_header(name, None)\n if not found:\n raise KeyError(name)", "metadata": "root.RequestCookies.__delitem__", "header": "['class', 'RequestCookies', '(', 'collections', '.', 'MutableMapping', ')', ':', '___EOS___']", "index": 112 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Request", "Cooki", "es_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "\\u", "valid", "\\u", "cookie", "\\u", "name_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "self_", "._", "\\u", "mutate", "\\u", "header_", "(_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "Error_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
globocom/database-as-a-service/dbaas/account/views.py
[ { "content": "@login_required\ndef profile(request, user_id=None):\n user = None\n databases = None\n teams = None\n roles = None\n try:\n user = User.objects.get(id=user_id)\n teams = Team.objects.filter(users=user)\n databases = Database.alive.filter(\n team__in=[team.id for team in teams]).order_by('team')\n roles = [team.role for team in teams]\n except Exception, e:\n LOG.warning(\"Ops... %s\" % e)\n\n return render_to_response(\"account/profile.html\", locals(), context_instance=RequestContext(request))", "metadata": "root.profile", "header": "['module', '___EOS___']", "index": 19 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "profile_", "(_", "request_", ",_", "user", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "databases_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "teams_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roles_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "teams_", "=_", "Team_", "._", "objects_", "._", "filter_", "(_", "users_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "databases_", "=_", "Database_", "._", "alive_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "team", "\\u\\u", "in_", "=_", "[_", "team_", "._", "id_", "for_", "team_", "in_", "teams_", "]_", ")_", "._", "order", "\\u", "by_", "(_", "'", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roles_", "=_", "[_", "team_", "._", "role_", "for_", "team_", "in_", "teams_", "]_", "\\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 ", " _", "LOG_", "._", "warning_", "(_", "\"", "Op", "s", "...", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\"", "account", "/", "profile", ".", "html", "\"_", ",_", "locals_", "(_", ")_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_" ]
[ 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 ]
Inconsistent equality and hashing
basho/riak-python-client/riak/bucket.py
[ { "content": "class BucketType(object):\n \"\"\"\n The ``BucketType`` object allows you to access and change\n properties on a Riak bucket type and access buckets within its\n namespace.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n __repr__ = __str__\n\n\n", "metadata": "root.BucketType", "header": "['module', '___EOS___']", "index": 610 }, { "content": " def __init__(self, client, name):\n \"\"\"\n Returns a new ``BucketType`` instance.\n\n :param client: A :class:`RiakClient <riak.client.RiakClient>`\n instance\n :type client: :class:`RiakClient <riak.client.RiakClient>`\n :param name: The bucket-type's name\n :type name: string\n \"\"\"\n self._client = client\n self.name = name", "metadata": "root.BucketType.__init__", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 616 }, { "content": " def is_default(self):\n \"\"\"\n Whether this bucket type is the default type, or a user-defined type.\n\n :rtype: bool\n\n \"\"\"\n return self.name == 'default'", "metadata": "root.BucketType.is_default", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 629 }, { "content": " def get_property(self, key):\n \"\"\"\n Retrieve a bucket-type property.\n\n :param key: The property to retrieve.\n :type key: string\n :rtype: mixed\n \"\"\"\n return self.get_properties()[key]", "metadata": "root.BucketType.get_property", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 638 }, { "content": " def set_property(self, key, value):\n \"\"\"\n Set a bucket-type property.\n\n :param key: Property to set.\n :type key: string\n :param value: Property value.\n :type value: mixed\n \"\"\"\n return self.set_properties({key: value})", "metadata": "root.BucketType.set_property", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 648 }, { "content": " def get_properties(self):\n \"\"\"\n Retrieve a dict of all bucket-type properties.\n\n :rtype: dict\n \"\"\"\n return self._client.get_bucket_type_props(self)", "metadata": "root.BucketType.get_properties", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 659 }, { "content": " def set_properties(self, props):\n \"\"\"\n Set multiple bucket-type properties in one call.\n\n :param props: A dictionary of properties\n :type props: dict\n \"\"\"\n self._client.set_bucket_type_props(self, props)", "metadata": "root.BucketType.set_properties", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 667 }, { "content": " def bucket(self, name):\n \"\"\"\n Gets a bucket that belongs to this bucket-type.\n\n :param name: the bucket name\n :type name: str\n :rtype: :class:`RiakBucket`\n \"\"\"\n return self._client.bucket(name, self)", "metadata": "root.BucketType.bucket", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 676 }, { "content": " def get_buckets(self, timeout=None):\n \"\"\"\n Get the list of buckets under this bucket-type as\n :class:`RiakBucket <riak.bucket.RiakBucket>` instances.\n\n .. warning:: Do not use this in production, as it requires\n traversing through all keys stored in a cluster.\n\n .. note:: This request is automatically retried :attr:`retries`\n times if it fails due to network error.\n\n :param timeout: a timeout value in milliseconds\n :type timeout: int\n :rtype: list of :class:`RiakBucket <riak.bucket.RiakBucket>`\n instances\n \"\"\"\n return self._client.get_buckets(bucket_type=self, timeout=timeout)", "metadata": "root.BucketType.get_buckets", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 686 }, { "content": " def stream_buckets(self, timeout=None):\n \"\"\"\n Streams the list of buckets under this bucket-type. This is a\n generator method that should be iterated over.\n\n The caller must close the stream when finished. See\n :meth:`RiakClient.stream_buckets()\n <riak.client.RiakClient.stream_buckets>` for more details.\n\n .. warning:: Do not use this in production, as it requires\n traversing through all keys stored in a cluster.\n\n :param timeout: a timeout value in milliseconds\n :type timeout: int\n :rtype: iterator that yields lists of :class:`RiakBucket\n <riak.bucket.RiakBucket>` instances\n \"\"\"\n return self._client.stream_buckets(bucket_type=self, timeout=timeout)", "metadata": "root.BucketType.stream_buckets", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 704 }, { "content": " @lazy_property\n def datatype(self):\n \"\"\"\n The assigned datatype for this bucket type, if present.\n\n :rtype: None or string\n \"\"\"\n if self.is_default():\n return None\n else:\n return self.get_properties().get('datatype')", "metadata": "root.BucketType.datatype", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 723 }, { "content": " def __str__(self):\n return \"<BucketType {0!r}>\".format(self.name)", "metadata": "root.BucketType.__str__", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 735 }, { "content": " def __hash__(self):\n return hash((self.name, self._client))", "metadata": "root.BucketType.__hash__", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 740 }, { "content": " def __eq__(self, other):\n if isinstance(other, self.__class__):\n return hash(self) == hash(other)\n else:\n return False", "metadata": "root.BucketType.__eq__", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 743 }, { "content": " def __ne__(self, other):\n if isinstance(other, self.__class__):\n return hash(self) != hash(other)\n else:\n return True", "metadata": "root.BucketType.__ne__", "header": "['class', 'BucketType', '(', 'object', ')', ':', '___EOS___']", "index": 749 } ]
[]
[]
0
false
[ "[CLS]_", "Inco", "nsis", "tent", "_", "equality", "_", "and_", "hashin", "g_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "``", "Buck", "et", "Type", "``", " ", "object", " ", "allow", "s", " ", "you", " ", "to", " ", "access", " ", "and", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "proper", "ties", " ", "on", " ", "a", " ", "Ri", "ak", " ", "bucket", " ", "type", " ", "and", " ", "access", " ", "bucket", "s", " ", "within", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "namespace", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "repr\\u\\u_", "=_", "\\u\\u", "str\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "client_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "new", " ", "``", "Buck", "et", "Type", "``", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "client", ":", " ", "A", " ", ":", "class", ":`", "Ri", "ak", "Client", " ", "<", "ria", "k", ".", "client", ".", "Ri", "ak", "Client", ">`", "\\", "10", ";", " ", " ", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "client", ":", " ", ":", "class", ":`", "Ri", "ak", "Client", " ", "<", "ria", "k", ".", "client", ".", "Ri", "ak", "Client", ">`", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "name", ":", " ", "The", " ", "bucket", "-", "type", "'", "s", " ", "name", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "name", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "client_", "=_", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "this", " ", "bucket", " ", "type", " ", "is", " ", "the", " ", "default", " ", "type", ",", " ", "or", " ", "a", " ", "user", "-", "defin", "ed", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "bool", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "name_", "==_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "property_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "a", " ", "bucket", "-", "type", " ", "property", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "key", ":", " ", "The", " ", "property", " ", "to", " ", "retrieve", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "key", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "mixed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get", "\\u", "properties_", "(_", ")_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "property_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "a", " ", "bucket", "-", "type", " ", "property", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "key", ":", " ", "Proper", "ty", " ", "to", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "key", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "mixed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "set\\u", "properties_", "(_", "{_", "key_", ":_", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "a", " ", "dict", " ", "of", " ", "all", " ", "bucket", "-", "type", " ", "proper", "ties", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "\\u", "bucket", "\\u", "type", "\\u", "props_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "properties_", "(_", "self_", ",_", "props_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "multiple", " ", "bucket", "-", "type", " ", "proper", "ties", " ", "in", " ", "one", " ", "call", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "props", ":", " ", "A", " ", "dictionar", "y", " ", "of", " ", "proper", "ties", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "props", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "client_", "._", "set\\u", "bucket", "\\u", "type", "\\u", "props_", "(_", "self_", ",_", "props_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bucket_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", "s", " ", "a", " ", "bucket", " ", "tha", "t", " ", "belo", "ngs", " ", "to", " ", "this", " ", "bucket", "-", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "name", ":", " ", "the", " ", "bucket", " ", "name", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "name", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "Ri", "ak", "Buck", "et", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "bucket_", "(_", "name_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "buckets_", "(_", "self_", ",_", "timeout_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "list", " ", "of", " ", "bucket", "s", " ", "under", " ", "this", " ", "bucket", "-", "type", " ", "as", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "Ri", "ak", "Buck", "et", " ", "<", "ria", "k", ".", "bucket", ".", "Ri", "ak", "Buck", "et", ">`", " ", "instance", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", " ", "Do", " ", "not", " ", "use", " ", "this", " ", "in", " ", "producti", "on", ",", " ", "as", " ", "it", " ", "require", "s", "\\", "10", ";", " ", " ", " ", "trav", "ersi", "ng", " ", "through", " ", "all", " ", "keys", " ", "store", "d", " ", "in", " ", "a", " ", "cluster", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", " ", "Thi", "s", " ", "request", " ", "is", " ", "automati", "call", "y", " ", "retrie", "d", " ", ":", "attr", ":`", "retrie", "s", "`", "\\", "10", ";", " ", " ", " ", "times", " ", "if", " ", "it", " ", "fail", "s", " ", "due", " ", "to", " ", "network", " ", "error", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "timeo", "ut", ":", " ", "a", " ", "timeo", "ut", " ", "value", " ", "in", " ", "milliseconds", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "timeo", "ut", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "list", " ", "of", " ", ":", "class", ":`", "Ri", "ak", "Buck", "et", " ", "<", "ria", "k", ".", "bucket", ".", "Ri", "ak", "Buck", "et", ">`", "\\", "10", ";", " ", " ", " ", " ", "instance", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "\\u", "buckets_", "(_", "bucket", "\\u", "type_", "=_", "self_", ",_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stream", "\\u", "buckets_", "(_", "self_", ",_", "timeout_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Stream", "s", " ", "the", " ", "list", " ", "of", " ", "bucket", "s", " ", "under", " ", "this", " ", "bucket", "-", "type", ".", " ", "Thi", "s", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "generat", "or", " ", "method", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "iterate", "d", " ", "over", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "caller", " ", "must", " ", "close", " ", "the", " ", "stream", " ", "whe", "n", " ", "finish", "ed", ".", " ", " ", "See", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "Ri", "ak", "Client", ".", "stream", "\\u", "bucket", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "<", "ria", "k", ".", "client", ".", "Ri", "ak", "Client", ".", "stream", "\\u", "bucket", "s", ">`", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", " ", "Do", " ", "not", " ", "use", " ", "this", " ", "in", " ", "producti", "on", ",", " ", "as", " ", "it", " ", "require", "s", "\\", "10", ";", " ", " ", " ", "trav", "ersi", "ng", " ", "through", " ", "all", " ", "keys", " ", "store", "d", " ", "in", " ", "a", " ", "cluster", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "timeo", "ut", ":", " ", "a", " ", "timeo", "ut", " ", "value", " ", "in", " ", "milliseconds", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "timeo", "ut", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "iter", "ator", " ", "tha", "t", " ", "yield", "s", " ", "lists", " ", "of", " ", ":", "class", ":`", "Ri", "ak", "Buck", "et", "\\", "10", ";", " ", " ", " ", " ", " ", "<", "ria", "k", ".", "bucket", ".", "Ri", "ak", "Buck", "et", ">`", " ", "instance", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "stream", "\\u", "buckets_", "(_", "bucket", "\\u", "type_", "=_", "self_", ",_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lazy", "\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "datatype_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "assign", "ed", " ", "datatype", " ", "for", " ", "this", " ", "bucket", " ", "type", ",", " ", "if", " ", "presen", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Non", "e", " ", "or", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "default_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "properties_", "(_", ")_", "._", "get_", "(_", "'", "datatype", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"<", "Buck", "et", "Type", " ", "{", "0", "!", "r", "}>", "\"_", "._", "format_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u", "client_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "self_", ")_", "==_", "hash_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Buck", "et", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "self_", ")_", "!=_", "hash_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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", "metadata": "root.EtcdDriver.unwatch_join_group", "header": "['class', 'EtcdDriver', '(', 'coordination', '.', 'CoordinationDriver', ')', ':', '___EOS___']", "index": 221 } ]
[]
[]
0
true
[ "[CLS]_", "Il", "lega", "l_", "raise_", "[SEP]_", "class_", "Et", "cd", "Driver_", "(_", "coordin", "ation_", "._", "Coordinat", "ion", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "unwa", "tch", "\\u", "join", "\\u", "group_", "(_", "group", "\\u", "id_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "too", "z_", "._", "Not", "Implemented_", "\\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 ]
Unnecessary pass
anandology/pyjamas/pgen/tokenize.py
[ { "content": "def tokenize(readline, tokeneater=printtoken):\n \"\"\"\n The tokenize() function accepts two parameters: one representing the\n input stream, and one providing an output mechanism for tokenize().\n\n The first parameter, readline, must be a callable object which provides\n the same interface as the readline() method of built-in file objects.\n Each call to the function should return one line of input as a string.\n\n The second parameter, tokeneater, must also be a callable object. It is\n called once for each token, with five arguments, corresponding to the\n tuples generated by generate_tokens().\n \"\"\"\n try:\n tokenize_loop(readline, tokeneater)\n except StopTokenizing:\n pass", "metadata": "root.tokenize", "header": "['module', '___EOS___']", "index": 151 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tokenize_", "(_", "readline_", ",_", "token", "eat", "er_", "=_", "print", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "tokenize", "()", " ", "function", " ", "accepts", " ", "two", " ", "parameter", "s", ":", " ", "one", " ", "represent", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "input", " ", "stream", ",", " ", "and", " ", "one", " ", "provi", "ding", " ", "an", " ", "output", " ", "mechanism", " ", "for", " ", "tokenize", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "first", " ", "parameter", ",", " ", "readline", ",", " ", "must", " ", "be", " ", "a", " ", "calla", "ble", " ", "object", " ", "whi", "ch", " ", "provide", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "same", " ", "interface", " ", "as", " ", "the", " ", "readline", "()", " ", "method", " ", "of", " ", "bui", "lt", "-", "in", " ", "file", " ", "object", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "call", " ", "to", " ", "the", " ", "function", " ", "shou", "ld", " ", "return", " ", "one", " ", "line", " ", "of", " ", "input", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "second", " ", "parameter", ",", " ", "token", "eat", "er", ",", " ", "must", " ", "als", "o", " ", "be", " ", "a", " ", "calla", "ble", " ", "object", ".", " ", "It", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "onc", "e", " ", "for", " ", "each", " ", "token", ",", " ", "with", " ", "five", " ", "argu", "ment", "s", ",", " ", "correspond", "ing", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "tuple", "s", " ", "generat", "ed", " ", "by", " ", "generat", "e\\u", "token", "s", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokenize", "\\u", "loop_", "(_", "readline_", ",_", "token", "eat", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Token", "izi", "ng_", ":_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/bsd/nodes.py
[ { "content": " def tolinkmsgs(self, flags):\n ''' Build CORE API TLVs for a point-to-point link. One Link message\n describes this network.\n '''\n tlvdata = \"\"\n if len(self._netif) != 2:\n return tlvdata\n (if1, if2) = self._netif.items()\n if1 = if1[1]\n if2 = if2[1]\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_N1NUMBER,\n if1.node.objid)\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_N2NUMBER,\n if2.node.objid)\n delay = if1.getparam('delay')\n bw = if1.getparam('bw')\n loss = if1.getparam('loss')\n duplicate = if1.getparam('duplicate')\n jitter = if1.getparam('jitter')\n if delay is not None:\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_DELAY,\n delay)\n if bw is not None:\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_BW, bw)\n if loss is not None:\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_PER,\n str(loss))\n if duplicate is not None:\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_DUP,\n str(duplicate))\n if jitter is not None:\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_JITTER,\n jitter)\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_TYPE,\n self.linktype)\n\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF1NUM, \\\n if1.node.getifindex(if1))\n if if1.hwaddr:\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF1MAC,\n if1.hwaddr)\n for addr in if1.addrlist:\n (ip, sep, mask) = addr.partition('/')\n mask = int(mask)\n if isIPv4Address(ip):\n family = AF_INET\n tlvtypeip = coreapi.CORE_TLV_LINK_IF1IP4\n tlvtypemask = coreapi.CORE_TLV_LINK_IF1IP4MASK\n else:\n family = AF_INET6\n tlvtypeip = coreapi.CORE_TLV_LINK_IF1IP6\n tlvtypemask = coreapi.CORE_TLV_LINK_IF1IP6MASK\n ipl = socket.inet_pton(family, ip)\n tlvdata += coreapi.CoreLinkTlv.pack(tlvtypeip,\n IPAddr(af=family, addr=ipl))\n tlvdata += coreapi.CoreLinkTlv.pack(tlvtypemask, mask)\n\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2NUM, \\\n if2.node.getifindex(if2))\n if if2.hwaddr:\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2MAC,\n if2.hwaddr)\n for addr in if2.addrlist:\n (ip, sep, mask) = addr.partition('/')\n mask = int(mask)\n if isIPv4Address(ip):\n family = AF_INET\n tlvtypeip = coreapi.CORE_TLV_LINK_IF2IP4\n tlvtypemask = coreapi.CORE_TLV_LINK_IF2IP4MASK\n else:\n family = AF_INET6\n tlvtypeip = coreapi.CORE_TLV_LINK_IF2IP6\n tlvtypemask = coreapi.CORE_TLV_LINK_IF2IP6MASK\n ipl = socket.inet_pton(family, ip)\n tlvdata += coreapi.CoreLinkTlv.pack(tlvtypeip,\n IPAddr(af=family, addr=ipl))\n tlvdata += coreapi.CoreLinkTlv.pack(tlvtypemask, mask)\n\n msg = coreapi.CoreLinkMessage.pack(flags, tlvdata)\n return [msg,]", "metadata": "root.PtpNet.tolinkmsgs", "header": "['class', 'PtpNet', '(', 'NetgraphPipeNet', ')', ':', '___EOS___']", "index": 32 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Pt", "p", "Net_", "(_", "Net", "graph", "Pipe", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tol", "ink", "msgs_", "(_", "self_", ",_", "flags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Build", " ", "CORE", " ", "API", " ", "TLV", "s", " ", "for", " ", "a", " ", "point", "-", "to", "-", "point", " ", "link", ".", " ", "One", " ", "Link", " ", "message", "\\", "10", ";", " ", " ", " ", " ", "descri", "bes", " ", "this", " ", "network", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "neti", "f_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tlv", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "if", "1_", ",_", "if", "2_", ")_", "=_", "self_", "._", "\\u", "neti", "f_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "1_", "=_", "if", "1_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "2_", "=_", "if", "2_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "N1", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "if", "1_", "._", "node_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "N", "2", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "if", "2_", "._", "node_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "if", "1_", "._", "getpar", "am_", "(_", "'", "dela", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bw_", "=_", "if", "1_", "._", "getpar", "am_", "(_", "'", "bw", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loss_", "=_", "if", "1_", "._", "getpar", "am_", "(_", "'", "loss", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duplicate_", "=_", "if", "1_", "._", "getpar", "am_", "(_", "'", "duplicat", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jitter_", "=_", "if", "1_", "._", "getpar", "am_", "(_", "'", "jitter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "delay_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "DELAY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bw_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "BW", "_", ",_", "bw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "loss_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "PER", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "loss_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "duplicate_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "DU", "P_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "duplicate_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "jitter_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "JI", "TT", "ER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "jitter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "linkt", "ype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "1", "NUM_", ",_", "if", "1_", "._", "node_", "._", "geti", "finde", "x_", "(_", "if", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "if", "1_", "._", "hwa", "ddr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "1", "MAC_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "if", "1_", "._", "hwa", "ddr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "addr_", "in_", "if", "1_", "._", "addr", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "ip_", ",_", "sep_", ",_", "mask_", ")_", "=_", "addr_", "._", "partition_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "=_", "int_", "(_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "IP", "v", "4", "Address_", "(_", "ip_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "ip_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "1", "IP", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "mask_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "1", "IP", "4", "MASK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "AF", "\\u", "INE", "T6", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "ip_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "1", "IP", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "mask_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "1", "IP", "6", "MASK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ipl", "_", "=_", "socket_", "._", "inet", "\\u", "pto", "n_", "(_", "family_", ",_", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "tlv", "type", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IPA", "ddr_", "(_", "af_", "=_", "family_", ",_", "addr_", "=_", "ipl", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "tlv", "type", "mask_", ",_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "2", "NUM_", ",_", "if", "2_", "._", "node_", "._", "geti", "finde", "x_", "(_", "if", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "if", "2_", "._", "hwa", "ddr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "2", "MAC_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "if", "2_", "._", "hwa", "ddr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "addr_", "in_", "if", "2_", "._", "addr", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "ip_", ",_", "sep_", ",_", "mask_", ")_", "=_", "addr_", "._", "partition_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "=_", "int_", "(_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "IP", "v", "4", "Address_", "(_", "ip_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "ip_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "2", "IP", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "mask_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "2", "IP", "4", "MASK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "AF", "\\u", "INE", "T6", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "ip_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "2", "IP", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "type", "mask_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "2", "IP", "6", "MASK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ipl", "_", "=_", "socket_", "._", "inet", "\\u", "pto", "n_", "(_", "family_", ",_", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "tlv", "type", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IPA", "ddr_", "(_", "af_", "=_", "family_", ",_", "addr_", "=_", "ipl", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "tlv", "type", "mask_", ",_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "core", "api_", "._", "Core", "Link", "Message_", "._", "pack_", "(_", "flags_", ",_", "tlv", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "msg_", ",_", "]_", "\\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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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 ]
Unused import
everydo/ztq/ztq_console/ztq_console/utils/password.py
[ { "content": "#coding:utf-8\nfrom ConfigParser import ConfigParser, RawConfigParser\nimport sys\nimport os\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_password():\n cf = ConfigParser()\n cf.read(sys.argv[1])\n password_path = cf.get('password_path', 'password_path')\n cf.read(password_path)\n return cf.get('password', 'password')", "metadata": "root.get_password", "header": "['module', '___EOS___']", "index": 5 }, { "content": "def modify_password(new_password):\n cf = ConfigParser()\n cf.read(sys.argv[1])\n password_path = cf.get('password_path', 'password_path')\n if os.path.exists(password_path):\n passwd_txt = ConfigParser()\n passwd_txt.read(password_path)\n else:\n passwd_txt = RawConfigParser()\n passwd_txt.add_section('password') \n\n passwd_txt.set('password', 'password', new_password)\n with open(password_path, 'w') as new_password:\n passwd_txt.write(new_password)", "metadata": "root.modify_password", "header": "['module', '___EOS___']", "index": 12 } ]
[]
[]
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_", "Config", "Parser_", "import_", "Config", "Parser_", ",_", "Ra", "w", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "password_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cf_", "=_", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "._", "read_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "path_", "=_", "cf_", "._", "get_", "(_", "'", "password", "\\u", "path", "'_", ",_", "'", "password", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "._", "read_", "(_", "password", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cf_", "._", "get_", "(_", "'", "password", "'_", ",_", "'", "password", "'_", ")_", "\\u\\u\\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_", "modif", "y", "\\u", "password_", "(_", "new", "\\u", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cf_", "=_", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "._", "read_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "path_", "=_", "cf_", "._", "get_", "(_", "'", "password", "\\u", "path", "'_", ",_", "'", "password", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "password", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "passw", "d\\u", "txt_", "=_", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "passw", "d\\u", "txt_", "._", "read_", "(_", "password", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "passw", "d\\u", "txt_", "=_", "Ra", "w", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "passw", "d\\u", "txt_", "._", "add", "\\u", "section_", "(_", "'", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "passw", "d\\u", "txt_", "._", "set_", "(_", "'", "password", "'_", ",_", "'", "password", "'_", ",_", "new", "\\u", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "password", "\\u", "path_", ",_", "'", "w", "'_", ")_", "as_", "new", "\\u", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "passw", "d\\u", "txt_", "._", "write_", "(_", "new", "\\u", "password_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Redundant assignment
rouge8/20questions/web/debugerror.py
[ { "content": "def djangoerror():\n def _get_lines_from_file(filename, lineno, context_lines):\n \"\"\"\n Returns context_lines before and after lineno from file.\n Returns (pre_context_lineno, pre_context, context_line, post_context).\n \"\"\"\n try:\n source = open(filename).readlines()\n lower_bound = max(0, lineno - context_lines)\n upper_bound = lineno + context_lines\n\n pre_context = \\\n [line.strip('\\n') for line in source[lower_bound:lineno]]\n context_line = source[lineno].strip('\\n')\n post_context = \\\n [line.strip('\\n') for line in source[lineno + 1:upper_bound]]\n\n return lower_bound, pre_context, context_line, post_context\n except (OSError, IOError, IndexError):\n return None, [], None, [] \n \n exception_type, exception_value, tback = sys.exc_info()\n frames = []\n while tback is not None:\n filename = tback.tb_frame.f_code.co_filename\n function = tback.tb_frame.f_code.co_name\n lineno = tback.tb_lineno - 1\n\n # hack to get correct line number for templates\n lineno += tback.tb_frame.f_locals.get(\"__lineoffset__\", 0)\n \n pre_context_lineno, pre_context, context_line, post_context = \\\n _get_lines_from_file(filename, lineno, 7)\n\n if '__hidetraceback__' not in tback.tb_frame.f_locals:\n frames.append(web.storage({\n 'tback': tback,\n 'filename': filename,\n 'function': function,\n 'lineno': lineno,\n 'vars': tback.tb_frame.f_locals,\n 'id': id(tback),\n 'pre_context': pre_context,\n 'context_line': context_line,\n 'post_context': post_context,\n 'pre_context_lineno': pre_context_lineno,\n }))\n tback = tback.tb_next\n frames.reverse()\n urljoin = urlparse.urljoin\n def prettify(x):\n try: \n out = pprint.pformat(x)\n except Exception, e: \n out = '[could not display: <' + e.__class__.__name__ + \\\n ': '+str(e)+'>]'\n return out\n \n global djangoerror_r\n if djangoerror_r is None:\n djangoerror_r = Template(djangoerror_t, filename=__file__, filter=websafe)\n \n t = djangoerror_r\n globals = {'ctx': web.ctx, 'web':web, 'dict':dict, 'str':str, 'prettify': prettify}\n t.t.func_globals.update(globals)\n return t(exception_type, exception_value, frames)", "metadata": "root.djangoerror", "header": "['module', '___EOS___']", "index": 229 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "django", "error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "get", "\\u", "lines", "\\u", "from", "\\u", "file_", "(_", "filename_", ",_", "lineno_", ",_", "context", "\\u", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "context", "\\u", "lines", " ", "bef", "ore", " ", "and", " ", "after", " ", "linen", "o", " ", "from", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "(", "pre", "\\u", "context", "\\u", "linen", "o", ",", " ", "pre", "\\u", "context", ",", " ", "context", "\\u", "line", ",", " ", "post", "\\u", "context", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "open_", "(_", "filename_", ")_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower", "\\u", "bound_", "=_", "max_", "(_", "0_", ",_", "lineno_", "-_", "context", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upper", "\\u", "bound_", "=_", "lineno_", "+_", "context", "\\u", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "\\u", "context_", "=_", "[_", "line_", "._", "strip_", "(_", "'\\\\", "n", "'_", ")_", "for_", "line_", "in_", "source_", "[_", "lower", "\\u", "bound_", ":_", "lineno_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "line_", "=_", "source_", "[_", "lineno_", "]_", "._", "strip_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "context_", "=_", "[_", "line_", "._", "strip_", "(_", "'\\\\", "n", "'_", ")_", "for_", "line_", "in_", "source_", "[_", "lineno_", "+_", "1_", ":_", "upper", "\\u", "bound_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "lower", "\\u", "bound_", ",_", "pre", "\\u", "context_", ",_", "context", "\\u", "line_", ",_", "post", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ",_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", ",_", "[_", "]_", ",_", "None_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exception", "\\u", "type_", ",_", "exception", "\\u", "value_", ",_", "tba", "ck_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frames_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tba", "ck_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "tba", "ck_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function_", "=_", "tba", "ck_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "tba", "ck_", "._", "tb", "\\u", "lineno_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hack", " ", "to", " ", "get", " ", "correct", " ", "line", " ", "number", " ", "for", " ", "templates_", "\\u\\u\\uNL\\u\\u\\u_", "lineno_", "+=_", "tba", "ck_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "locals_", "._", "get_", "(_", "\"\\u\\u", "line", "offset", "\\u\\u\"_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "\\u", "context", "\\u", "lineno_", ",_", "pre", "\\u", "context_", ",_", "context", "\\u", "line_", ",_", "post", "\\u", "context_", "=_", "\\u", "get", "\\u", "lines", "\\u", "from", "\\u", "file_", "(_", "filename_", ",_", "lineno_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'\\u", "\\u", "hide", "traceback", "\\u\\u'_", "not_", "in_", "tba", "ck_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "locals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frames_", "._", "append_", "(_", "web_", "._", "storage_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tba", "ck", "'_", ":_", "tba", "ck_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filename", "'_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "function", "'_", ":_", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "linen", "o", "'_", ":_", "lineno_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vars", "'_", ":_", "tba", "ck_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "locals_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "id_", "(_", "tba", "ck_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pre", "\\u", "context", "'_", ":_", "pre", "\\u", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "context", "\\u", "line", "'_", ":_", "context", "\\u", "line_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "post", "\\u", "context", "'_", ":_", "post", "\\u", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pre", "\\u", "context", "\\u", "linen", "o", "'_", ":_", "pre", "\\u", "context", "\\u", "lineno_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tba", "ck_", "=_", "tba", "ck_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frames_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urljoin_", "=_", "urlparse_", "._", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pret", "tify", "_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "pprint_", "._", "pformat_", "(_", "x_", ")_", "\\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 ", " _", "out_", "=_", "'[", "coul", "d", " ", "not", " ", "display", ":", " ", "<'_", "+_", "e_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "+_", "':", " ", "'_", "+_", "str_", "(_", "e_", ")_", "+_", "'>", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "django", "error", "\\u", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "django", "error", "\\u", "r_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "django", "error", "\\u", "r_", "=_", "Template_", "(_", "django", "error", "\\u", "t_", ",_", "filename_", "=_", "\\u\\u", "file\\u\\u_", ",_", "filter_", "=_", "webs", "afe", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "django", "error", "\\u", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "=_", "{_", "'", "ctx", "'_", ":_", "web_", "._", "ctx_", ",_", "'", "web", "'_", ":_", "web_", ",_", "'", "dict", "'_", ":_", "dict_", ",_", "'", "str", "'_", ":_", "str_", ",_", "'", "pret", "tify", "'_", ":_", "pret", "tify", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "t_", "._", "func", "\\u", "globals_", "._", "update_", "(_", "globals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "t_", "(_", "exception", "\\u", "type_", ",_", "exception", "\\u", "value_", ",_", "frames_", ")_", "\\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, 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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 ]
Unused import
dropbox/changes/tests/changes/expanders/test_tests.py
[ { "content": "from __future__ import absolute_import\n\nimport pytest\n\nfrom mock import patch\n\nfrom changes.constants import Status, Result\nfrom changes.expanders.tests import TestsExpander\nfrom changes.testutils import TestCase\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestsExpanderTest(TestCase):\n\n\n\n\n", "metadata": "root.TestsExpanderTest", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def setUp(self):\n super(TestsExpanderTest, self).setUp()\n self.project = self.create_project()", "metadata": "root.TestsExpanderTest.setUp", "header": "['class', 'TestsExpanderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 12 }, { "content": " def get_expander(self, data):\n return TestsExpander(self.project, data)", "metadata": "root.TestsExpanderTest.get_expander", "header": "['class', 'TestsExpanderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_validate(self):\n with pytest.raises(AssertionError):\n self.get_expander({}).validate()\n\n with pytest.raises(AssertionError):\n self.get_expander({'tests': []}).validate()\n\n with pytest.raises(AssertionError):\n self.get_expander({'cmd': 'echo 1', 'tests': []}).validate()\n\n self.get_expander({\n 'tests': [],\n 'cmd': 'echo {test_names}',\n }).validate()", "metadata": "root.TestsExpanderTest.test_validate", "header": "['class', 'TestsExpanderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_get_test_stats(self):\n build = self.create_build(\n project=self.project,\n status=Status.finished,\n result=Result.passed,\n )\n job = self.create_job(build)\n self.create_test(job, name='foo.bar.test_baz', duration=50)\n self.create_test(job, name='foo.bar.test_bar', duration=25)\n\n expander = self.get_expander({})\n results, avg_time = expander.get_test_stats(self.project.slug)\n\n assert avg_time == 37\n\n assert results[('foo', 'bar')] == 75\n assert results[('foo', 'bar', 'test_baz')] == 50\n assert results[('foo', 'bar', 'test_bar')] == 25", "metadata": "root.TestsExpanderTest.test_get_test_stats", "header": "['class', 'TestsExpanderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_sharding(self):\n tests = [\n 'foo/bar.py',\n 'foo/baz.py',\n 'foo.bar.test_biz',\n 'foo.bar.test_buz',\n ]\n test_weights = {\n ('foo', 'bar'): 50,\n ('foo', 'baz'): 15,\n ('foo', 'bar', 'test_biz'): 10,\n ('foo', 'bar', 'test_buz'): 200,\n }\n avg_test_time = sum(test_weights.values()) / len(test_weights)\n\n groups = TestsExpander.shard_tests(tests, 2, test_weights, avg_test_time)\n assert len(groups) == 2\n groups.sort()\n assert groups[0] == (78, ['foo/bar.py', 'foo/baz.py', 'foo.bar.test_biz'])\n assert groups[1] == (201, ['foo.bar.test_buz'])\n\n groups = TestsExpander.shard_tests(tests, 3, test_weights, avg_test_time)\n assert len(groups) == 3\n groups.sort()\n assert groups[0] == (27, ['foo/baz.py', 'foo.bar.test_biz'])\n assert groups[1] == (51, ['foo/bar.py'])\n assert groups[2] == (201, ['foo.bar.test_buz'])\n\n # more shards than tests\n groups = TestsExpander.shard_tests(tests, len(tests) * 2, test_weights, avg_test_time)\n assert len(groups) == len(tests)", "metadata": "root.TestsExpanderTest.test_sharding", "header": "['class', 'TestsExpanderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " @patch.object(TestsExpander, 'get_test_stats')\n def test_expand(self, mock_get_test_stats):\n mock_get_test_stats.return_value = {\n ('foo', 'bar'): 50,\n ('foo', 'baz'): 15,\n ('foo', 'bar', 'test_biz'): 10,\n ('foo', 'bar', 'test_buz'): 200,\n }, 68\n\n results = list(self.get_expander({\n 'cmd': 'py.test --junit=junit.xml {test_names}',\n 'tests': [\n 'foo/bar.py',\n 'foo/baz.py',\n 'foo.bar.test_biz',\n 'foo.bar.test_buz',\n ],\n }).expand(max_executors=2))\n\n results.sort(key=lambda x: x.data['weight'], reverse=True)\n\n assert len(results) == 2\n assert results[0].label == 'py.test --junit=junit.xml foo.bar.test_buz'\n assert results[0].data['weight'] == 201\n assert set(results[0].data['tests']) == set(['foo.bar.test_buz'])\n assert results[0].data['shard_count'] == 2\n assert results[0].commands[0].label == results[0].label\n assert results[0].commands[0].script == results[0].label\n\n assert results[1].label == 'py.test --junit=junit.xml foo/bar.py foo/baz.py foo.bar.test_biz'\n assert results[1].data['weight'] == 78\n assert set(results[1].data['tests']) == set(['foo/bar.py', 'foo/baz.py', 'foo.bar.test_biz'])\n assert results[1].data['shard_count'] == 2\n assert results[1].commands[0].label == results[1].label\n assert results[1].commands[0].script == results[1].label", "metadata": "root.TestsExpanderTest.test_expand", "header": "['class', 'TestsExpanderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 85 } ]
[]
[]
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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "changes_", "._", "constants_", "import_", "Status_", ",_", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "changes_", "._", "expander", "s_", "._", "tests_", "import_", "Test", "s", "Expand", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "changes_", "._", "testutils_", "import_", "Test", "Case_", "\\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", "s", "Expand", "er", "Test_", "(_", "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_", "[SEP]_", "class_", "Test", "s", "Expand", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Test", "s", "Expand", "er", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "project_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "s", "Expand", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "expander", "_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Test", "s", "Expand", "er_", "(_", "self_", "._", "project_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "s", "Expand", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Assert", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "\\u", "expander", "_", "(_", "{_", "}_", ")_", "._", "validate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Assert", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "\\u", "expander", "_", "(_", "{_", "'", "tests", "'_", ":_", "[_", "]_", "}_", ")_", "._", "validate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Assert", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "\\u", "expander", "_", "(_", "{_", "'", "cmd", "'_", ":_", "'", "echo", " ", "1", "'_", ",_", "'", "tests", "'_", ":_", "[_", "]_", "}_", ")_", "._", "validate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "get", "\\u", "expander", "_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tests", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cmd", "'_", ":_", "'", "echo", " ", "{", "test\\u", "names", "}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "validate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "s", "Expand", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "test\\u", "stats_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "build_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "self_", "._", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "Status_", "._", "finished_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Result_", "._", "passed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "self_", "._", "create", "\\u", "job_", "(_", "build_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "test_", "(_", "job_", ",_", "name_", "=_", "'", "foo", ".", "bar", ".", "test\\u", "ba", "z", "'_", ",_", "duration_", "=_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "test_", "(_", "job_", ",_", "name_", "=_", "'", "foo", ".", "bar", ".", "test\\u", "bar", "'_", ",_", "duration_", "=_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expander", "_", "=_", "self_", "._", "get", "\\u", "expander", "_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", ",_", "avg", "\\u", "time_", "=_", "expander", "_", "._", "get", "\\u", "test\\u", "stats_", "(_", "self_", "._", "project_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "avg", "\\u", "time_", "==_", "37_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "results_", "[_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ")_", "]_", "==_", "75_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "test\\u", "ba", "z", "'_", ")_", "]_", "==_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "test\\u", "bar", "'_", ")_", "]_", "==_", "25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "s", "Expand", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "shard", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tests_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "/", "bar", ".", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "/", "ba", "z", ".", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", ".", "bar", ".", "test\\u", "biz", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", ".", "bar", ".", "test\\u", "bu", "z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "weights_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ")_", ":_", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "ba", "z", "'_", ")_", ":_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "test\\u", "biz", "'_", ")_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "test\\u", "bu", "z", "'_", ")_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avg", "\\u", "test\\u", "time_", "=_", "sum_", "(_", "test\\u", "weights_", "._", "values_", "(_", ")_", ")_", "/_", "len_", "(_", "test\\u", "weights_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "groups_", "=_", "Test", "s", "Expand", "er_", "._", "shard", "\\u", "tests_", "(_", "tests_", ",_", "2_", ",_", "test\\u", "weights_", ",_", "avg", "\\u", "test\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "groups_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "groups_", "[_", "0_", "]_", "==_", "(_", "78_", ",_", "[_", "'", "foo", "/", "bar", ".", "py", "'_", ",_", "'", "foo", "/", "ba", "z", ".", "py", "'_", ",_", "'", "foo", ".", "bar", ".", "test\\u", "biz", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "groups_", "[_", "1_", "]_", "==_", "(_", "201_", ",_", "[_", "'", "foo", ".", "bar", ".", "test\\u", "bu", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "groups_", "=_", "Test", "s", "Expand", "er_", "._", "shard", "\\u", "tests_", "(_", "tests_", ",_", "3_", ",_", "test\\u", "weights_", ",_", "avg", "\\u", "test\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "groups_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "groups_", "[_", "0_", "]_", "==_", "(_", "27_", ",_", "[_", "'", "foo", "/", "ba", "z", ".", "py", "'_", ",_", "'", "foo", ".", "bar", ".", "test\\u", "biz", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "groups_", "[_", "1_", "]_", "==_", "(_", "51_", ",_", "[_", "'", "foo", "/", "bar", ".", "py", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "groups_", "[_", "2_", "]_", "==_", "(_", "201_", ",_", "[_", "'", "foo", ".", "bar", ".", "test\\u", "bu", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "more", " ", "shard", "s", " ", "than", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "groups_", "=_", "Test", "s", "Expand", "er_", "._", "shard", "\\u", "tests_", "(_", "tests_", ",_", "len_", "(_", "tests_", ")_", "*_", "2_", ",_", "test\\u", "weights_", ",_", "avg", "\\u", "test\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "groups_", ")_", "==_", "len_", "(_", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "s", "Expand", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "patch_", "._", "object_", "(_", "Test", "s", "Expand", "er_", ",_", "'", "get", "\\u", "test\\u", "stats", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "expand_", "(_", "self_", ",_", "mock", "\\u", "get", "\\u", "test\\u", "stats_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "get", "\\u", "test\\u", "stats_", "._", "return", "\\u", "value_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ")_", ":_", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "ba", "z", "'_", ")_", ":_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "test\\u", "biz", "'_", ")_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "test\\u", "bu", "z", "'_", ")_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "68_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "get", "\\u", "expander", "_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cmd", "'_", ":_", "'", "py", ".", "test", " ", "--", "junit", "=", "junit", ".", "xml", " ", "{", "test\\u", "names", "}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tests", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "/", "bar", ".", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "/", "ba", "z", ".", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", ".", "bar", ".", "test\\u", "biz", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", ".", "bar", ".", "test\\u", "bu", "z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "expand_", "(_", "max", "\\u", "executors", "_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "data_", "[_", "'", "weight", "'_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "results_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "0_", "]_", "._", "label_", "==_", "'", "py", ".", "test", " ", "--", "junit", "=", "junit", ".", "xml", " ", "foo", ".", "bar", ".", "test\\u", "bu", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "0_", "]_", "._", "data_", "[_", "'", "weight", "'_", "]_", "==_", "201_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set_", "(_", "results_", "[_", "0_", "]_", "._", "data_", "[_", "'", "tests", "'_", "]_", ")_", "==_", "set_", "(_", "[_", "'", "foo", ".", "bar", ".", "test\\u", "bu", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "0_", "]_", "._", "data_", "[_", "'", "shard", "\\u", "count", "'_", "]_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "0_", "]_", "._", "commands_", "[_", "0_", "]_", "._", "label_", "==_", "results_", "[_", "0_", "]_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "0_", "]_", "._", "commands_", "[_", "0_", "]_", "._", "script_", "==_", "results_", "[_", "0_", "]_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "results_", "[_", "1_", "]_", "._", "label_", "==_", "'", "py", ".", "test", " ", "--", "junit", "=", "junit", ".", "xml", " ", "foo", "/", "bar", ".", "py", " ", "foo", "/", "ba", "z", ".", "py", " ", "foo", ".", "bar", ".", "test\\u", "biz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "1_", "]_", "._", "data_", "[_", "'", "weight", "'_", "]_", "==_", "78_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set_", "(_", "results_", "[_", "1_", "]_", "._", "data_", "[_", "'", "tests", "'_", "]_", ")_", "==_", "set_", "(_", "[_", "'", "foo", "/", "bar", ".", "py", "'_", ",_", "'", "foo", "/", "ba", "z", ".", "py", "'_", ",_", "'", "foo", ".", "bar", ".", "test\\u", "biz", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "1_", "]_", "._", "data_", "[_", "'", "shard", "\\u", "count", "'_", "]_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "1_", "]_", "._", "commands_", "[_", "0_", "]_", "._", "label_", "==_", "results_", "[_", "1_", "]_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "results_", "[_", "1_", "]_", "._", "commands_", "[_", "0_", "]_", "._", "script_", "==_", "results_", "[_", "1_", "]_", "._", "label_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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