query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Unused import
viewfinderco/viewfinder/backend/www/test_hook.py
[ { "content": "# Copyright 2013 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"HTTP request handler for reading and writing photo image file\nassets for automated UI testing.\n\n\"\"\"\n\n__author__ = ['[email protected] (Greg Vandenberg)']\n\nimport json\nimport logging\nimport os\nimport shutil\n\nfrom tornado import gen, options, web\nfrom viewfinder.backend.base import handler\nfrom viewfinder.backend.base.environ import ServerEnvironment\nfrom viewfinder.backend.db.identity import Identity\nfrom viewfinder.backend.db.operation import Operation\nfrom viewfinder.backend.db.viewpoint import Viewpoint\nfrom viewfinder.backend.www import base\n\n_TEST_HOOKS_NOT_SUPPORTED = 'Test hooks are not supported. They are only supported when ' + \\\n 'running on a development machine (using --devbox).'\n_TEST_ACTION_NOT_SUPPORTED = 'This action is not supported.'\n_STATIC_RESULTS_BASELINE = '/testing/static/results/baseline'\n_STATIC_RESULTS_CURRENT = '/testing/static/results/current'\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestHookHandler(web.RequestHandler):\n \"\"\" Handles POST requests and copies a given image to the\n specified destination\n \"\"\"\n\n\n\n\n", "metadata": "root.TestHookHandler", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def check_xsrf_cookie(self):\n pass", "metadata": "root.TestHookHandler.check_xsrf_cookie", "header": "['class', 'TestHookHandler', '(', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 35 }, { "content": " @handler.asynchronous(datastore=True, obj_store=True)\n @gen.coroutine\n def post(self, action):\n\n if not ServerEnvironment.IsDevBox():\n raise web.HTTPError(403, _TEST_HOOKS_NOT_SUPPORTED)\n\n from PIL import Image, ImageChops\n\n if action == 'copy':\n logging.info('Updating baseline image')\n urls = {}\n body = json.loads(self.request.body)\n testname = body['testname']\n imagename = body['imagename']\n scheme = body['scheme']\n\n _FULL_RESULTS_BASELINE = '%s/results/baseline/%s' % (options.options.testing_path, scheme)\n _FULL_RESULTS_CURRENT = '%s/results/current/%s' % (options.options.testing_path, scheme)\n\n # Overwrite the 'baseline' image for the test with the 'current' image.\n baseline_image = r'%s/%s/%s' % (_FULL_RESULTS_BASELINE, testname, imagename)\n current_image = r'%s/%s/Run 1/%s' % (_FULL_RESULTS_CURRENT, testname, imagename)\n\n yield self._UpdateImageMaskConfig(testname, imagename, scheme)\n\n if os.path.exists(current_image):\n shutil.copy(current_image, baseline_image)\n logging.info('Updated baseline image for %s' % testname)\n\n baseline_web_image = r'%s/%s/%s/%s' % (_STATIC_RESULTS_BASELINE, scheme, testname, imagename)\n current_web_image = r'%s/%s/%s/Run 1/%s' % (_STATIC_RESULTS_CURRENT, scheme, testname, imagename)\n\n urls['baseline'] = baseline_web_image\n urls['current'] = current_web_image\n\n # Return JSON result.\n self.write(urls)\n self.finish()\n return\n\n if action == 'delete':\n body = json.loads(self.request.body)\n testname = body['testname']\n imagename = body['imagename']\n\n current_image = r'%s/%s/Run 1/%s' % (_FULL_RESULTS_CURRENT, testname, imagename)\n if os.path.exists(current_image) is True:\n os.remove(current_image)\n logging.info('Deleted current capture image for %s' % testname)\n self.finish()\n return\n\n if action == 'token':\n body = json.loads(self.request.body)\n identity_key = body['auth_info']['identity'];\n\n identity = yield gen.Task(Identity.Query, self._client, identity_key, None, must_exist=False)\n if identity is None:\n raise web.HTTPError(400, 'Identity does not exist.')\n\n self.write(identity.access_token)\n self.finish()\n return\n\n if action == 'image':\n body = json.loads(self.request.body)\n test_name = body['testname']\n image_name = body['imagename']\n scheme = body['scheme']\n _FULL_RESULTS_BASELINE = '%s/results/baseline/%s' % (options.options.testing_path, scheme)\n _FULL_RESULTS_CURRENT = '%s/results/current/%s' % (options.options.testing_path, scheme)\n\n # get image base name\n tmp = image_name[:-4]\n base, num = tmp.split('|', 1)\n image_base_name = '%s.png' % base\n\n image1 = r'%s/%s/%s' % (_FULL_RESULTS_BASELINE, test_name, image_base_name)\n image2 = r'%s/%s/Run 1/%s' % (_FULL_RESULTS_CURRENT, test_name, image_name)\n\n if os.path.exists(image1) and os.path.exists(image2):\n self.set_header('Content-Type', 'application/json; charset=UTF-8')\n im1 = Image.open(image1)\n im2 = Image.open(image2)\n\n diff = ImageChops.difference(im2, im1)\n result = diff.getbbox() is None\n response = { 'response': result, 'bbox': diff.getbbox() }\n self.write(response)\n self.finish()\n return\n\n raise web.HTTPError(400, _TEST_ACTION_NOT_SUPPORTED)", "metadata": "root.TestHookHandler.post", "header": "['class', 'TestHookHandler', '(', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 38 }, { "content": " @gen.coroutine\n def _UpdateImageMaskConfig(self, test_name, image_name, scheme):\n\n _IMAGE_MASK_CONFIG_PATH = os.path.join(options.options.testing_path, 'config')\n _IMAGE_MASK_CONFIG_FILE = '%s/%s/image_masks_json.cfg' % (_IMAGE_MASK_CONFIG_PATH, scheme)\n _FULL_RESULTS_BASELINE = '%s/results/baseline' % options.options.testing_path\n _FULL_RESULTS_CURRENT = '%s/results/current' % options.options.testing_path\n baseline_image = r'%s/%s/%s/%s' % (_FULL_RESULTS_BASELINE, scheme, test_name, image_name)\n current_image = r'%s/%s/%s/Run 1/%s' % (_FULL_RESULTS_CURRENT, scheme, test_name, image_name)\n\n from PIL import Image, ImageChops\n\n try:\n im1 = Image.open(baseline_image)\n im2 = Image.open(current_image)\n _IMAGE_MASK_CONFIG = {}\n diff = ImageChops.difference(im2, im1)\n # TODO: if image delta is smaller than 100 x 100 write to config\n bbox = diff.getbbox()\n if bbox is not None:\n if os.path.exists(_IMAGE_MASK_CONFIG_FILE):\n config_data = open(_IMAGE_MASK_CONFIG_FILE, 'r')\n _IMAGE_MASK_CONFIG = json.load(config_data)\n width = bbox[2] - bbox[0];\n height = bbox[3] - bbox[1]\n if width <= 100 and height <= 100:\n x, y = 0, 0\n mask = { \"x\":bbox[0], \"y\":bbox[1], \"height\":height-1, \"width\":width-1 }\n logging.info('bbox: %s' % mask)\n if test_name not in _IMAGE_MASK_CONFIG:\n _IMAGE_MASK_CONFIG[test_name] = {}\n _IMAGE_MASK_CONFIG[test_name][image_name] = []\n else:\n if image_name not in _IMAGE_MASK_CONFIG[test_name]:\n _IMAGE_MASK_CONFIG[test_name][image_name] = []\n else:\n # do not allow duplicate masks\n for dict in _IMAGE_MASK_CONFIG[test_name][image_name]:\n if dict['x'] == bbox[0] and dict['y'] == bbox[1]:\n if dict['height'] == height or dict['width'] == width:\n return;\n\n _IMAGE_MASK_CONFIG[test_name][image_name].append(mask)\n cfg_data_file = open(_IMAGE_MASK_CONFIG_FILE, 'w')\n cfg_data_file.write(json.dumps(_IMAGE_MASK_CONFIG))\n logging.info('Updated %s' % _IMAGE_MASK_CONFIG_FILE)\n except (IOError, ValueError) as e:\n logging.exception('Exception during image comparison')", "metadata": "root.TestHookHandler._UpdateImageMaskConfig", "header": "['class', 'TestHookHandler', '(', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 133 } ]
[ { "span": "from viewfinder.backend.db.operation import Operation", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 53 }, { "span": "from viewfinder.backend.db.viewpoint import Viewpoint", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 53 }, { "span": "from viewfinder.backend.www import base", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "HTTP", " ", "request", " ", "handler", " ", "for", " ", "readi", "ng", " ", "and", " ", "writ", "ing", " ", "photo", " ", "image", " ", "file", "\\", "10", ";", "asset", "s", " ", "for", " ", "automat", "ed", " ", "UI", " ", "testi", "ng", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "[_", "'", "greg", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Gre", "g", " ", "Van", "den", "ber", "g", ")'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", ",_", "options_", ",_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "environ_", "import_", "Server", "Environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "identity_", "import_", "Identity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "operation_", "import_", "Operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "view", "point_", "import_", "View", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "www", "_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEST", "\\u", "HOOK", "S", "\\u", "NOT", "\\u", "SUPPORTED", "_", "=_", "'", "Test", " ", "hook", "s", " ", "are", " ", "not", " ", "support", "ed", ".", " ", "The", "y", " ", "are", " ", "only", " ", "support", "ed", " ", "whe", "n", " ", "'_", "+_", "'", "runn", "ing", " ", "on", " ", "a", " ", "develop", "ment", " ", "machine", " ", "(", "usi", "ng", " ", "--", "dev", "box", ").'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "TEST", "\\u", "ACTI", "ON", "\\u", "NOT", "\\u", "SUPPORTED", "_", "=_", "'", "Thi", "s", " ", "action", " ", "is", " ", "not", " ", "support", "ed", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STATI", "C", "\\u", "RESULTS", "\\u", "BASE", "LINE_", "=_", "'/", "testi", "ng", "/", "static", "/", "results", "/", "baseline", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STATI", "C", "\\u", "RESULTS", "\\u", "CURREN", "T_", "=_", "'/", "testi", "ng", "/", "static", "/", "results", "/", "current", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Hook", "Handler_", "(_", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", "s", " ", "POST", " ", "request", "s", " ", "and", " ", "copie", "s", " ", "a", " ", "give", "n", " ", "image", " ", "to", " ", "the", "\\", "10", ";", " ", " ", "specified", " ", "destinat", "ion", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Hook", "Handler_", "(_", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "xsrf", "\\u", "cookie_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Hook", "Handler_", "(_", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handler_", "._", "async", "hronous", "_", "(_", "datastore_", "=_", "True_", ",_", "obj", "\\u", "store_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Server", "Environment_", "._", "Is", "Dev", "Box_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "403_", ",_", "\\u", "TEST", "\\u", "HOOK", "S", "\\u", "NOT", "\\u", "SUPPORTED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", ",_", "Image", "Cho", "ps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "action_", "==_", "'", "copy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Up", "dati", "ng", " ", "baseline", " ", "image", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testname_", "=_", "body_", "[_", "'", "testn", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imagen", "ame_", "=_", "body_", "[_", "'", "imagen", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheme_", "=_", "body_", "[_", "'", "sche", "me", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "BASE", "LINE_", "=_", "'%", "s", "/", "results", "/", "baseline", "/", "%", "s", "'_", "%_", "(_", "options_", "._", "options_", "._", "testi", "ng", "\\u", "path_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "CURREN", "T_", "=_", "'%", "s", "/", "results", "/", "current", "/", "%", "s", "'_", "%_", "(_", "options_", "._", "options_", "._", "testi", "ng", "\\u", "path_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Over", "write", " ", "the", " ", "'", "baseline", "'", " ", "image", " ", "for", " ", "the", " ", "test", " ", "with", " ", "the", " ", "'", "current", "'", " ", "image", "._", "\\u\\u\\uNL\\u\\u\\u_", "baseline", "\\u", "image_", "=_", "r", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "BASE", "LINE_", ",_", "testname_", ",_", "imagen", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "image_", "=_", "r", "'%", "s", "/", "%", "s", "/", "Run", " ", "1", "/", "%", "s", "'_", "%_", "(_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "CURREN", "T_", ",_", "testname_", ",_", "imagen", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "\\u", "Update", "Image", "Mask", "Config_", "(_", "testname_", ",_", "imagen", "ame_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "current", "\\u", "image_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copy_", "(_", "current", "\\u", "image_", ",_", "baseline", "\\u", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Update", "d", " ", "baseline", " ", "image", " ", "for", " ", "%", "s", "'_", "%_", "testname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "baseline", "\\u", "web", "\\u", "image_", "=_", "r", "'%", "s", "/", "%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u", "STATI", "C", "\\u", "RESULTS", "\\u", "BASE", "LINE_", ",_", "scheme_", ",_", "testname_", ",_", "imagen", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "web", "\\u", "image_", "=_", "r", "'%", "s", "/", "%", "s", "/", "%", "s", "/", "Run", " ", "1", "/", "%", "s", "'_", "%_", "(_", "\\u", "STATI", "C", "\\u", "RESULTS", "\\u", "CURREN", "T_", ",_", "scheme_", ",_", "testname_", ",_", "imagen", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urls_", "[_", "'", "baseline", "'_", "]_", "=_", "baseline", "\\u", "web", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls_", "[_", "'", "current", "'_", "]_", "=_", "current", "\\u", "web", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "JSO", "N", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write_", "(_", "urls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\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_", "action_", "==_", "'", "delete", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testname_", "=_", "body_", "[_", "'", "testn", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "imagen", "ame_", "=_", "body_", "[_", "'", "imagen", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "image_", "=_", "r", "'%", "s", "/", "%", "s", "/", "Run", " ", "1", "/", "%", "s", "'_", "%_", "(_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "CURREN", "T_", ",_", "testname_", ",_", "imagen", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "current", "\\u", "image_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "current", "\\u", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Delete", "d", " ", "current", " ", "captur", "e", " ", "image", " ", "for", " ", "%", "s", "'_", "%_", "testname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\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_", "action_", "==_", "'", "token", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "key_", "=_", "body_", "[_", "'", "auth", "\\u", "info", "'_", "]_", "[_", "'", "identi", "ty", "'_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "identity_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Identity_", "._", "Query_", ",_", "self_", "._", "\\u", "client_", ",_", "identi", "ty", "\\u", "key_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "identity_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "'", "Ident", "it", "y", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write_", "(_", "identity_", "._", "access", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\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_", "action_", "==_", "'", "image", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "name_", "=_", "body_", "[_", "'", "testn", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "name_", "=_", "body_", "[_", "'", "imagen", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheme_", "=_", "body_", "[_", "'", "sche", "me", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "BASE", "LINE_", "=_", "'%", "s", "/", "results", "/", "baseline", "/", "%", "s", "'_", "%_", "(_", "options_", "._", "options_", "._", "testi", "ng", "\\u", "path_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "CURREN", "T_", "=_", "'%", "s", "/", "results", "/", "current", "/", "%", "s", "'_", "%_", "(_", "options_", "._", "options_", "._", "testi", "ng", "\\u", "path_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "image", " ", "base", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "image", "\\u", "name_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", ",_", "num_", "=_", "tmp_", "._", "split_", "(_", "'|'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "base", "\\u", "name_", "=_", "'%", "s", ".", "png", "'_", "%_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "image1", "_", "=_", "r", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "BASE", "LINE_", ",_", "test\\u", "name_", ",_", "image", "\\u", "base", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image2", "_", "=_", "r", "'%", "s", "/", "%", "s", "/", "Run", " ", "1", "/", "%", "s", "'_", "%_", "(_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "CURREN", "T_", ",_", "test\\u", "name_", ",_", "image", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "image1", "_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "image2", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "applica", "tion", "/", "json", ";", " ", "charset", "=", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "1_", "=_", "Image_", "._", "open_", "(_", "image1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im2", "_", "=_", "Image_", "._", "open_", "(_", "image2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "Image", "Cho", "ps_", "._", "difference_", "(_", "im2", "_", ",_", "im", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "diff_", "._", "getb", "box_", "(_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "{_", "'", "response", "'_", ":_", "result_", ",_", "'", "bbox", "'_", ":_", "diff_", "._", "getb", "box_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\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_", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "\\u", "TEST", "\\u", "ACTI", "ON", "\\u", "NOT", "\\u", "SUPPORTED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Hook", "Handler_", "(_", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Update", "Image", "Mask", "Config_", "(_", "self_", ",_", "test\\u", "name_", ",_", "image", "\\u", "name_", ",_", "scheme_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG", "\\u", "PATH_", "=_", "os_", "._", "path_", "._", "join_", "(_", "options_", "._", "options_", "._", "testi", "ng", "\\u", "path_", ",_", "'", "config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG", "\\u", "FILE_", "=_", "'%", "s", "/", "%", "s", "/", "image", "\\u", "mask", "s", "\\u", "json", ".", "cfg", "'_", "%_", "(_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG", "\\u", "PATH_", ",_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "BASE", "LINE_", "=_", "'%", "s", "/", "results", "/", "baseline", "'_", "%_", "options_", "._", "options_", "._", "testi", "ng", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "CURREN", "T_", "=_", "'%", "s", "/", "results", "/", "current", "'_", "%_", "options_", "._", "options_", "._", "testi", "ng", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline", "\\u", "image_", "=_", "r", "'%", "s", "/", "%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "BASE", "LINE_", ",_", "scheme_", ",_", "test\\u", "name_", ",_", "image", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "image_", "=_", "r", "'%", "s", "/", "%", "s", "/", "%", "s", "/", "Run", " ", "1", "/", "%", "s", "'_", "%_", "(_", "\\u", "FULL", "\\u", "RESULTS", "\\u", "CURREN", "T_", ",_", "scheme_", ",_", "test\\u", "name_", ",_", "image", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", ",_", "Image", "Cho", "ps_", "\\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 ", " _", "im", "1_", "=_", "Image_", "._", "open_", "(_", "baseline", "\\u", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im2", "_", "=_", "Image_", "._", "open_", "(_", "current", "\\u", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "Image", "Cho", "ps_", "._", "difference_", "(_", "im2", "_", ",_", "im", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", " ", "if", " ", "image", " ", "delta", " ", "is", " ", "small", "er", " ", "than", " ", "100", " ", "x", " ", "100", " ", "write", " ", "to", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "bbox_", "=_", "diff_", "._", "getb", "box_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bbox_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG", "\\u", "FILE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "data_", "=_", "open_", "(_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG", "\\u", "FILE_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "=_", "json_", "._", "load_", "(_", "config", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "width_", "=_", "bbox_", "[_", "2_", "]_", "-_", "bbox_", "[_", "0_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "bbox_", "[_", "3_", "]_", "-_", "bbox_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "width_", "<=_", "100_", "and_", "height_", "<=_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "=_", "{_", "\"", "x", "\"_", ":_", "bbox_", "[_", "0_", "]_", ",_", "\"", "y", "\"_", ":_", "bbox_", "[_", "1_", "]_", ",_", "\"", "height", "\"_", ":_", "height_", "-_", "1_", ",_", "\"", "widt", "h", "\"_", ":_", "width_", "-_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "bbox", ":", " ", "%", "s", "'_", "%_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "test\\u", "name_", "not_", "in_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "[_", "test\\u", "name_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "[_", "test\\u", "name_", "]_", "[_", "image", "\\u", "name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "image", "\\u", "name_", "not_", "in_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "[_", "test\\u", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "[_", "test\\u", "name_", "]_", "[_", "image", "\\u", "name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "not", " ", "allow", " ", "duplicat", "e", " ", "masks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dict_", "in_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "[_", "test\\u", "name_", "]_", "[_", "image", "\\u", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dict_", "[_", "'", "x", "'_", "]_", "==_", "bbox_", "[_", "0_", "]_", "and_", "dict_", "[_", "'", "y", "'_", "]_", "==_", "bbox_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dict_", "[_", "'", "height", "'_", "]_", "==_", "height_", "or_", "dict_", "[_", "'", "widt", "h", "'_", "]_", "==_", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", "[_", "test\\u", "name_", "]_", "[_", "image", "\\u", "name_", "]_", "._", "append_", "(_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "\\u", "data\\u", "file_", "=_", "open_", "(_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG", "\\u", "FILE_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "\\u", "data\\u", "file_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Update", "d", " ", "%", "s", "'_", "%_", "\\u", "IMA", "GE", "\\u", "MASK", "\\u", "CONFIG", "\\u", "FILE_", ")_", "\\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_", "(_", "IO", "Error_", ",_", "Value", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "exception_", "(_", "'", "Except", "ion", " ", "dur", "ing", " ", "image", " ", "compa", "ris", "on", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1,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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 ]
Missing call to `__init__` during object initialization
ODM2/ODMToolsPython/odmtools/lib/ObjectListView/ListCtrlPrinter.py
[ { "content": " def __init__(self, engine=None):\n self.engine = engine # This is also set when the block is added to a print engine", "metadata": "root.Block.__init__", "header": "['class', 'Block', '(', 'object', ')', ':', '___EOS___']", "index": 1151 }, { "content": "class CellBlock(Block):\n \"\"\"\n A CellBlock is a Block whose data is presented in a cell format.\n \"\"\"\n\n\n #----------------------------------------------------------------------------\n # Accessing - Subclasses should override\n\n\n\n\n\n\n #----------------------------------------------------------------------------\n # Accessing\n\n\n\n\n\n\n\n\n #----------------------------------------------------------------------------\n # Calculating\n\n\n\n\n #----------------------------------------------------------------------------\n # Commands\n\n\n #def CanFit(self, height):\n # height *= self.scale\n # return Block.CanFit(self, height)\n\n\n\n\n\n\n", "metadata": "root.CellBlock", "header": "['module', '___EOS___']", "index": 1470 }, { "content": " def __init__(self):\n self.scale = 1\n self.oldScale = 1", "metadata": "root.CellBlock.__init__", "header": "['class', 'CellBlock', '(', 'Block', ')', ':', '___EOS___']", "index": 1475 }, { "content": "class RunningBlockPusher(Block):\n \"\"\"\n A RunningBlockPusher pushes (or pops) a running block onto the stack when it is executed.\n \"\"\"\n\n", "metadata": "root.RunningBlockPusher", "header": "['module', '___EOS___']", "index": 1802 }, { "content": " def __init__(self, block, push=True):\n \"\"\"\n \"\"\"\n self.block = block\n self.push = push", "metadata": "root.RunningBlockPusher.__init__", "header": "['class', 'RunningBlockPusher', '(', 'Block', ')', ':', '___EOS___']", "index": 1807 }, { "content": "class ListBlock(Block):\n \"\"\"\n A ListBlock handles the printing of an entire ListCtrl.\n \"\"\"\n\n\n #----------------------------------------------------------------------------\n # Commands\n\n\n\n\n", "metadata": "root.ListBlock", "header": "['module', '___EOS___']", "index": 1828 }, { "content": " def __init__(self, lv, title):\n self.lv = lv\n self.title = title", "metadata": "root.ListBlock.__init__", "header": "['class', 'ListBlock', '(', 'Block', ')', ':', '___EOS___']", "index": 1833 }, { "content": "class ListHeaderBlock(TextBlock):\n \"\"\"\n A ListHeaderBlock is the title that comes before an ListCtrl.\n \"\"\"\n\n", "metadata": "root.ListHeaderBlock", "header": "['module', '___EOS___']", "index": 1912 }, { "content": " def __init__(self, lv, title):\n self.lv = lv\n self.title = title", "metadata": "root.ListHeaderBlock.__init__", "header": "['class', 'ListHeaderBlock', '(', 'TextBlock', ')', ':', '___EOS___']", "index": 1917 }, { "content": "class ListFooterBlock(TextBlock):\n \"\"\"\n A ListFooterBlock is the text that comes after an ListCtrl.\n \"\"\"\n\n", "metadata": "root.ListFooterBlock", "header": "['module', '___EOS___']", "index": 1929 }, { "content": " def __init__(self, lv, text):\n self.lv = lv\n self.text = text", "metadata": "root.ListFooterBlock.__init__", "header": "['class', 'ListFooterBlock', '(', 'TextBlock', ')', ':', '___EOS___']", "index": 1934 }, { "content": "class GroupTitleBlock(TextBlock):\n \"\"\"\n A GroupTitleBlock is the title that comes before a list group.\n \"\"\"\n\n", "metadata": "root.GroupTitleBlock", "header": "['module', '___EOS___']", "index": 1947 }, { "content": " def __init__(self, lv, group):\n self.lv = lv\n self.group = group", "metadata": "root.GroupTitleBlock.__init__", "header": "['class', 'GroupTitleBlock', '(', 'TextBlock', ')', ':', '___EOS___']", "index": 1952 }, { "content": "class ListSliceBlock(Block):\n \"\"\"\n A ListSliceBlock prints a vertical slice of an ListCtrl.\n \"\"\"\n\n\n #----------------------------------------------------------------------------\n # Commands\n\n", "metadata": "root.ListSliceBlock", "header": "['module', '___EOS___']", "index": 1964 }, { "content": " def __init__(self, lv, left, right, allCellWidths):\n self.lv = lv\n self.left = left\n self.right = right\n self.allCellWidths = allCellWidths", "metadata": "root.ListSliceBlock.__init__", "header": "['class', 'ListSliceBlock', '(', 'Block', ')', ':', '___EOS___']", "index": 1969 }, { "content": "class ColumnBasedBlock(CellBlock):\n \"\"\"\n A ColumnBasedBlock is a cell block that takes its width from the\n columns of a ListCtrl.\n\n This is an abstract class\n \"\"\"\n\n\n #----------------------------------------------------------------------------\n # Accessing - Subclasses should override\n\n\n\n\n #----------------------------------------------------------------------------\n # Utiltities\n", "metadata": "root.ColumnBasedBlock", "header": "['module', '___EOS___']", "index": 2024 }, { "content": " def __init__(self, lv, left, right, scale, allCellWidths):\n self.lv = lv\n self.left = left\n self.right = right\n self.scale = scale\n self.allCellWidths = allCellWidths", "metadata": "root.ColumnBasedBlock.__init__", "header": "['class', 'ColumnBasedBlock', '(', 'CellBlock', ')', ':', '___EOS___']", "index": 2032 }, { "content": "class ListRowsBlock(Block):\n \"\"\"\n A ListRowsBlock prints rows of an ListCtrl.\n \"\"\"\n\n\n #----------------------------------------------------------------------------\n # Commands\n", "metadata": "root.ListRowsBlock", "header": "['module', '___EOS___']", "index": 2123 }, { "content": " def __init__(self, lv, left, right, scale, allCellWidths):\n \"\"\"\n \"\"\"\n self.lv = lv\n self.left = left\n self.right = right\n self.scale = scale\n self.allCellWidths = allCellWidths\n self.currentIndex = 0\n self.totalRows = self.lv.GetItemCount()", "metadata": "root.ListRowsBlock.__init__", "header": "['class', 'ListRowsBlock', '(', 'Block', ')', ':', '___EOS___']", "index": 2128 }, { "content": "class GroupListRowsBlock(Block):\n \"\"\"\n A GroupListRowsBlock prints rows of an GroupListView.\n \"\"\"\n\n\n #----------------------------------------------------------------------------\n # Commands\n", "metadata": "root.GroupListRowsBlock", "header": "['module', '___EOS___']", "index": 2160 }, { "content": " def __init__(self, lv, left, right, scale, allCellWidths):\n \"\"\"\n \"\"\"\n self.lv = lv # Must be a GroupListView\n self.left = left\n self.right = right\n self.scale = scale\n self.allCellWidths = allCellWidths\n\n self.currentIndex = 0\n self.totalRows = self.lv.GetItemCount()", "metadata": "root.GroupListRowsBlock.__init__", "header": "['class', 'GroupListRowsBlock', '(', 'Block', ')', ':', '___EOS___']", "index": 2165 }, { "content": "class RowBlock(ColumnBasedBlock):\n \"\"\"\n A RowBlock prints a vertical slice of a single row of an ListCtrl.\n \"\"\"\n\n\n #----------------------------------------------------------------------------\n # Accessing\n\n\n\n\n\n\n\n #----------------------------------------------------------------------------\n # Overrides for CellBlock\n\n\n\n\n #def GetTexts(self):\n # \"\"\"\n # Return a list of the texts that should be drawn with the cells\n # \"\"\"\n # modelObjects = self.lv.GetObjectAt(self.rowIndex)\n # return [self.lv.GetStringValueAt(modelObjects, i) for i in range(self.left, self.right+1)]\n #\n #def GetAlignments(self):\n # \"\"\"\n # Return a list indicating how the text within each cell is aligned.\n # \"\"\"\n # return [self.lv.columns[i].GetAlignment() for i in range(self.left, self.right+1)]\n #\n #def GetImages(self):\n # \"\"\"\n # Return a list of the images that should be drawn in each cell\n # \"\"\"\n # modelObjects = self.lv.GetObjectAt(self.rowIndex)\n # return [self.lv.GetImageAt(modelObjects, i) for i in range(self.left, self.right+1)]", "metadata": "root.RowBlock", "header": "['module', '___EOS___']", "index": 2209 }, { "content": " def __init__(self, lv, rowIndex, left, right, scale, allCellWidths):\n self.lv = lv\n self.rowIndex = rowIndex\n self.left = left\n self.right = right\n self.scale = scale\n self.allCellWidths = allCellWidths", "metadata": "root.RowBlock.__init__", "header": "['class', 'RowBlock', '(', 'ColumnBasedBlock', ')', ':', '___EOS___']", "index": 2214 } ]
[ { "span": "class CellBlock(Block):", "start_line": 1470, "start_column": 0, "end_line": 1470, "end_column": 23 }, { "span": "class RunningBlockPusher(Block):", "start_line": 1802, "start_column": 0, "end_line": 1802, "end_column": 32 }, { "span": "class ListBlock(Block):", "start_line": 1828, "start_column": 0, "end_line": 1828, "end_column": 23 }, { "span": "class ListHeaderBlock(TextBlock):", "start_line": 1912, "start_column": 0, "end_line": 1912, "end_column": 33 }, { "span": "class ListFooterBlock(TextBlock):", "start_line": 1929, "start_column": 0, "end_line": 1929, "end_column": 33 }, { "span": "class GroupTitleBlock(TextBlock):", "start_line": 1947, "start_column": 0, "end_line": 1947, "end_column": 33 }, { "span": "class ListSliceBlock(Block):", "start_line": 1964, "start_column": 0, "end_line": 1964, "end_column": 28 }, { "span": "class ColumnBasedBlock(CellBlock):", "start_line": 2024, "start_column": 0, "end_line": 2024, "end_column": 34 }, { "span": "class ListRowsBlock(Block):", "start_line": 2123, "start_column": 0, "end_line": 2123, "end_column": 27 }, { "span": "class GroupListRowsBlock(Block):", "start_line": 2160, "start_column": 0, "end_line": 2160, "end_column": 32 }, { "span": "class RowBlock(ColumnBasedBlock):", "start_line": 2209, "start_column": 0, "end_line": 2209, "end_column": 33 } ]
[ { "span": "def __init__(self, engine=None):", "start_line": 1151, "start_column": 4, "end_line": 1151, "end_column": 36 }, { "span": "def __init__(self):", "start_line": 1475, "start_column": 4, "end_line": 1475, "end_column": 23 }, { "span": "def __init__(self, block, push=True):", "start_line": 1807, "start_column": 4, "end_line": 1807, "end_column": 41 }, { "span": "def __init__(self, lv, title):", "start_line": 1833, "start_column": 4, "end_line": 1833, "end_column": 34 }, { "span": "def __init__(self, lv, title):", "start_line": 1917, "start_column": 4, "end_line": 1917, "end_column": 34 }, { "span": "def __init__(self, lv, text):", "start_line": 1934, "start_column": 4, "end_line": 1934, "end_column": 33 }, { "span": "def __init__(self, lv, group):", "start_line": 1952, "start_column": 4, "end_line": 1952, "end_column": 34 }, { "span": "def __init__(self, lv, left, right, allCellWidths):", "start_line": 1969, "start_column": 4, "end_line": 1969, "end_column": 55 }, { "span": "def __init__(self, lv, left, right, scale, allCellWidths):", "start_line": 2032, "start_column": 4, "end_line": 2032, "end_column": 62 }, { "span": "def __init__(self, lv, left, right, scale, allCellWidths):", "start_line": 2128, "start_column": 4, "end_line": 2128, "end_column": 62 }, { "span": "def __init__(self, lv, left, right, scale, allCellWidths):", "start_line": 2165, "start_column": 4, "end_line": 2165, "end_column": 62 }, { "span": "def __init__(self, lv, rowIndex, left, right, scale, allCellWidths):", "start_line": 2214, "start_column": 4, "end_line": 2214, "end_column": 72 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Block_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "engine_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "engine_", "=_", "engine_", "#", " ", "Thi", "s", " ", "is", " ", "als", "o", " ", "set", " ", "whe", "n", " ", "the", " ", "block", " ", "is", " ", "adde", "d", " ", "to", " ", "a", " ", "print", " ", "engine_", "\\u\\u\\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_", "Cel", "l", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Cel", "l", "Block", " ", "is", " ", "a", " ", "Block", " ", "who", "se", " ", "data", " ", "is", " ", "presente", "d", " ", "in", " ", "a", " ", "cell", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Access", "ing", " ", "-", " ", "Subc", "lasse", "s", " ", "shou", "ld", " ", "override_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Access", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculating", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "Can", "Fit", "(", "self", ",", " ", "height", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "height", " ", "*=", " ", "self", ".", "scale_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "Block", ".", "Can", "Fit", "(", "self", ",", " ", "height", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cel", "l", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scale_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "old", "Scale_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Run", "ning", "Block", "Push", "er_", "(_", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Run", "ning", "Block", "Push", "er", " ", "pushe", "s", " ", "(", "or", " ", "pops", ")", " ", "a", " ", "runn", "ing", " ", "block", " ", "onto", " ", "the", " ", "stack", " ", "whe", "n", " ", "it", " ", "is", " ", "executed", ".", "\\", "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_", "Run", "ning", "Block", "Push", "er_", "(_", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "block_", ",_", "push_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "block_", "=_", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "push_", "=_", "push_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "List", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "List", "Block", " ", "handle", "s", " ", "the", " ", "printin", "g", " ", "of", " ", "an", " ", "entire", " ", "List", "Ctrl", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "List", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "title_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "List", "Head", "er", "Block_", "(_", "Text", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "List", "Head", "er", "Block", " ", "is", " ", "the", " ", "title", " ", "tha", "t", " ", "come", "s", " ", "bef", "ore", " ", "an", " ", "List", "Ctrl", ".", "\\", "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_", "List", "Head", "er", "Block_", "(_", "Text", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "title_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "List", "Footer", "Block_", "(_", "Text", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "List", "Footer", "Block", " ", "is", " ", "the", " ", "text", " ", "tha", "t", " ", "come", "s", " ", "after", " ", "an", " ", "List", "Ctrl", ".", "\\", "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_", "List", "Footer", "Block_", "(_", "Text", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Group", "Tit", "le", "Block_", "(_", "Text", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Group", "Tit", "le", "Block", " ", "is", " ", "the", " ", "title", " ", "tha", "t", " ", "come", "s", " ", "bef", "ore", " ", "a", " ", "list", " ", "group", ".", "\\", "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_", "Group", "Tit", "le", "Block_", "(_", "Text", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "group_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "group_", "=_", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "List", "Slice", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "List", "Slice", "Block", " ", "print", "s", " ", "a", " ", "vertical", " ", "slice", " ", "of", " ", "an", " ", "List", "Ctrl", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Commands_", "\\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_", "List", "Slice", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "left_", ",_", "right_", ",_", "all", "Cel", "l", "Wid", "ths_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "Cel", "l", "Wid", "ths_", "=_", "all", "Cel", "l", "Wid", "ths_", "\\u\\u\\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_", "Colum", "n", "Base", "d", "Block_", "(_", "Cel", "l", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Colum", "n", "Base", "d", "Block", " ", "is", " ", "a", " ", "cell", " ", "block", " ", "tha", "t", " ", "take", "s", " ", "its", " ", "widt", "h", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "column", "s", " ", "of", " ", "a", " ", "List", "Ctrl", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "abstract", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Access", "ing", " ", "-", " ", "Subc", "lasse", "s", " ", "shou", "ld", " ", "override_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ut", "ilt", "ities_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Colum", "n", "Base", "d", "Block_", "(_", "Cel", "l", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "left_", ",_", "right_", ",_", "scale_", ",_", "all", "Cel", "l", "Wid", "ths_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scale_", "=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "Cel", "l", "Wid", "ths_", "=_", "all", "Cel", "l", "Wid", "ths_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "List", "Row", "s", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "List", "Row", "s", "Block", " ", "print", "s", " ", "rows", " ", "of", " ", "an", " ", "List", "Ctrl", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "List", "Row", "s", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "left_", ",_", "right_", ",_", "scale_", ",_", "all", "Cel", "l", "Wid", "ths_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scale_", "=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "Cel", "l", "Wid", "ths_", "=_", "all", "Cel", "l", "Wid", "ths_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "Index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "Rows_", "=_", "self_", "._", "lv_", "._", "Get", "Item", "Count_", "(_", ")_", "\\u\\u\\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_", "Group", "List", "Row", "s", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Group", "List", "Row", "s", "Block", " ", "print", "s", " ", "rows", " ", "of", " ", "an", " ", "Group", "List", "View", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Group", "List", "Row", "s", "Block_", "(_", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "left_", ",_", "right_", ",_", "scale_", ",_", "all", "Cel", "l", "Wid", "ths_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lv_", "=_", "lv_", "#", " ", "Mus", "t", " ", "be", " ", "a", " ", "Group", "List", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scale_", "=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "Cel", "l", "Wid", "ths_", "=_", "all", "Cel", "l", "Wid", "ths_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "current", "Index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "Rows_", "=_", "self_", "._", "lv_", "._", "Get", "Item", "Count_", "(_", ")_", "\\u\\u\\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_", "Row", "Block_", "(_", "Colum", "n", "Base", "d", "Block_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Row", "Block", " ", "print", "s", " ", "a", " ", "vertical", " ", "slice", " ", "of", " ", "a", " ", "single", " ", "row", " ", "of", " ", "an", " ", "List", "Ctrl", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Access", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", "s", " ", "for", " ", "Cel", "l", "Block_", "\\u\\u\\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_", "#", "def", " ", "Get", "Texts", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "the", " ", "texts", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "draw", "n", " ", "with", " ", "the", " ", "cells_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "model", "Object", "s", " ", "=", " ", "self", ".", "lv", ".", "Get", "Object", "At", "(", "self", ".", "row", "Index", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "[", "self", ".", "lv", ".", "Get", "String", "Value", "At", "(", "model", "Object", "s", ",", " ", "i", ")", " ", "for", " ", "i", " ", "in", " ", "range", "(", "self", ".", "left", ",", " ", "self", ".", "right", "+", "1", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "Get", "Align", "ment", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "indicati", "ng", " ", "how", " ", "the", " ", "text", " ", "within", " ", "each", " ", "cell", " ", "is", " ", "aligned", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "[", "self", ".", "lv", ".", "column", "s", "[", "i", "].", "Get", "Align", "ment", "()", " ", "for", " ", "i", " ", "in", " ", "range", "(", "self", ".", "left", ",", " ", "self", ".", "right", "+", "1", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "Get", "Image", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "the", " ", "images", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "draw", "n", " ", "in", " ", "each", " ", "cell_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "model", "Object", "s", " ", "=", " ", "self", ".", "lv", ".", "Get", "Object", "At", "(", "self", ".", "row", "Index", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "[", "self", ".", "lv", ".", "Get", "Image", "At", "(", "model", "Object", "s", ",", " ", "i", ")", " ", "for", " ", "i", " ", "in", " ", "range", "(", "self", ".", "left", ",", " ", "self", ".", "right", "+", "1", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Row", "Block_", "(_", "Colum", "n", "Base", "d", "Block_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lv_", ",_", "row", "Index_", ",_", "left_", ",_", "right_", ",_", "scale_", ",_", "all", "Cel", "l", "Wid", "ths_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lv_", "=_", "lv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "row", "Index_", "=_", "row", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scale_", "=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "Cel", "l", "Wid", "ths_", "=_", "all", "Cel", "l", "Wid", "ths_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
VisTrails/VisTrails/contrib/sahm/init.py
[ { "content": " def compute(self):\n global color_breaks_csv\n \n ModelOutput = {\"FIT_BRT_pluggable.r\":\"brt\",\n \"FIT_GLM_pluggable.r\":\"glm\",\n \"FIT_RF_pluggable.r\":\"rf\",\n \"FIT_MARS_pluggable.r\":\"mars\"}\n ModelAbbrev = ModelOutput[self.name]\n \n output_dname = utils.mknextdir(prefix=ModelAbbrev + 'output_')\n argsDict = utils.map_ports(self, self.port_map)\n mdsFile = self.force_get_input('mdsFile').name\n \n args = ''\n for k, v in argsDict.iteritems():\n if k == 'c':\n args += ' ' + '='.join([str(k),'\"' + str(v) + '\"'])\n else:\n args += ' ' + '='.join([str(k),str(v)])\n args += \" o=\" + '\"' + output_dname + '\"'\n args += \" rc=\" + utils.MDSresponseCol(mdsFile)\n# if self.has_input('makeBinMap'):\n# makeBinMap = self.force_get_input('makeBinMap')\n# args += ' mbt=' + str(makeBinMap).upper()\n# else:\n# makeBinMap = True\n# args += ' mbt=TRUE'\n# \n# if self.has_input('makeProbabilityMap'):\n# makeProbabilityMap = self.force_get_input('makeProbabilityMap')\n# args += ' mpt=' + str(makeProbabilityMap).upper()\n# else:\n# makeProbabilityMap = True\n# args += ' mpt=TRUE' \n# \n# if self.has_input('seed'):\n# args += ' seed=' + str(self.force_get_input('seed'))\n# \n# if self.has_input('someParam'):\n# x = self.force_get_input('someParam')\n# if x > 1:\n# msg = \"Expected output from \" + ModelAbbrev + \" was not found.\"\n# msg += \"\\nThis likely indicates problems with the inputs to the R module.\"\n# writetolog(msg, False, True)\n# args += \" abr=\" + x\n \n utils.runRScript(self.name, args, self)\n# utils.runRScript('FIT_BRT_pluggableErrorMessage.r', args, self)\n \n input_fname = os.path.join(output_dname, ModelAbbrev + \"_prob_map.tif\")\n output_fname = os.path.join(output_dname, ModelAbbrev + \"_prob_map.jpeg\")\n if os.path.exists(input_fname):\n# utils.tif_to_color_jpeg(input_fname, output_fname, color_breaks_csv)\n# output_file4 = utils.create_file_module(output_fname)\n self.set_output('ProbabilityMap', input_fname)\n elif (argsDict.has_key('mpt') and argsDict['mpt'] == True) or \\\n not argsDict.has_key('mpt'):\n msg = \"Expected output from \" + ModelAbbrev + \" was not found.\"\n msg += \"\\nThis might indicate problems with the inputs to the R module.\"\n msg += \"\\nCheck the console output for additional R warnings \"\n writetolog(msg, False, True)\n raise ModuleError(self, msg)\n \n if (argsDict.has_key('mbt') and argsDict['mbt'] == True) or \\\n not argsDict.has_key('mbt'):\n outFileName = os.path.join(output_dname, ModelAbbrev + \"_bin_map.tif\")\n output_file1 = utils.create_file_module(outFileName)\n self.set_output('BinaryMap', output_file1)\n \n outFileName = os.path.join(output_dname, ModelAbbrev + \"_output.txt\")\n output_file2 = utils.create_file_module(outFileName)\n self.set_output('Text_Output', output_file2)\n \n outFileName = os.path.join(output_dname, ModelAbbrev + \"_auc_plot.jpg\")\n# print \"out auc: \", outFileName\n output_file3 = utils.create_file_module(outFileName)\n self.set_output('AUC_plot', output_file3)\n \n outFileName = os.path.join(output_dname, ModelAbbrev + \"_response_curves.pdf\")\n output_file5 = utils.create_file_module(outFileName)\n self.set_output('ResponseCurves', output_file5)\n \n outFileName = os.path.join(output_dname, \"modelWorkspace\")\n# print \"out auc: \", outFileName\n output_file6 = utils.create_file_module(outFileName)\n self.set_output('modelWorkspace', output_file6)\n \n writetolog(\"Finished \" + ModelAbbrev + \" builder\\n\", True, True) ", "metadata": "root.Model.compute", "header": "['class', 'Model', '(', 'Module', ')', ':', '___EOS___']", "index": 526 }, { "content": " def compute(self):\n #writetolog(\"\\nRunning PARC\", True)\n \n ourPARC = parc.PARC()\n output_dname = utils.mknextdir(prefix='PARC_')\n \n if configuration.verbose:\n ourPARC.verbose = True\n ourPARC.logger = utils.getLogger()\n \n ourPARC.out_dir = output_dname\n\n if self.has_input(\"multipleCores\"):\n if self.get_input(\"multipleCores\"):\n ourPARC.multicores = \"True\"\n\n workingCSV = utils.mknextfile(prefix='tmpFilesToPARC_', suffix='.csv')\n outputCSV = utils.mknextfile(prefix='PARCOutput_', suffix='.csv')\n\n #append additional inputs to the existing CSV if one was supplied\n #otherwise start a new CSV\n if self.has_input(\"RastersWithPARCInfoCSV\"):\n inputCSV = self.force_get_input(\"RastersWithPARCInfoCSV\").name\n shutil.copy(inputCSV, workingCSV)\n f = open(workingCSV, \"ab\")\n csvWriter = csv.writer(f)\n else:\n f = open(workingCSV, \"wb\")\n csvWriter = csv.writer(f)\n csvWriter.writerow([\"FilePath\", \"Categorical\", \"Resampling\", \"Aggregation\"])\n \n if self.has_input(\"PredictorList\"):\n predictor_lists = self.force_get_input_list('PredictorList')\n for predictor_list in predictor_lists:\n for predictor in predictor_list:\n csvWriter.writerow(list(predictor))\n \n if self.has_input(\"predictor\"):\n predictor_list = self.force_get_input_list('predictor')\n for predictor in predictor_list:\n csvWriter.writerow(list(predictor))\n f.close()\n del csvWriter\n ourPARC.inputs_CSV = workingCSV\n ourPARC.template = self.force_get_input('templateLayer').name\n writetolog(' template layer = ' + self.force_get_input('templateLayer').name)\n writetolog(\" output_dname=\" + output_dname, False, False)\n writetolog(\" workingCSV=\" + workingCSV, False, False)\n try:\n ourPARC.parcFiles()\n except TrappedError as e:\n writetolog(e.message)\n raise ModuleError(self, e.message)\n except:\n utils.informative_untrapped_error(self, \"PARC\") \n \n #delete our temp working file\n os.remove(workingCSV)\n \n predictorsDir = utils.create_dir_module(output_dname)\n outputCSV = os.path.join(output_dname, \"PARC_Files.csv\")\n output_file = utils.create_file_module(outputCSV)\n \n \n writetolog(\"Finished running PARC\", True)\n self.set_output('RastersWithPARCInfoCSV', output_file)", "metadata": "root.PARC.compute", "header": "['class', 'PARC', '(', 'Module', ')', ':', '___EOS___']", "index": 906 }, { "content": " def compute(self):\n models = ['CCCMA', 'CSIRO', 'hadcm3']\n scenarioss = ['A2a', 'B2b']\n years = ['2020', '2050', '2080']\n \n writetolog(\"\\nRunning make Projection Layers\", True)\n \n inputCSV = self.force_get_input('RastersWithPARCInfoCSV').name\n \n if self.has_input('templateLayer'):\n template = self.force_get_input('templateLayer').name\n else:\n template = '' #we'll get a template below\n \n fromto = []\n climargs = {}\n \n for input in ['model', 'scenario', 'year']:\n if self.has_input(input):\n climargs[input] = self.force_get_input(input)\n if climargs <> {} and climargs.keys() <> ['model', 'scenario', 'year']:\n #they did not add in one of each, Not going to fly\n raise ModuleError(self, \"All of model, scenario, and year must be supplied if any are used.\")\n elif climargs <> {} and climargs.keys <> ['model', 'scenario', 'year']:\n #they specified a alt climate scenario add this to our list to search for\n fromto.append([r'K:\\GIS_LIBRARY\\Climate\\WorldClim\\BioclimaticVariables\\bio_30s_esri\\bio',\n os.path.join('I:\\WorldClim_Future_Climate\\RenamedBILs', \n climargs['model'], climargs['scenario'], climargs['year'])])\n \n if self.has_input('directoryCrosswalkCSV'):\n crosswalkCSV = csv.reader(open(self.force_get_input('directoryCrosswalkCSV'), 'r'))\n header = crosswalkCSV\n for row in crosswalkCSV:\n fromto.append(row[0], row[1])\n del crosswalkCSV \n \n #write out the outputs to an empty MDS file (just the header is needed to PARC the outputs)\n \n \n inCSV = csv.reader(open(inputCSV, 'r'))\n inCSV.next() #skip header\n workingCSV = utils.mknextfile(prefix='tmpFilesToPARC_', suffix='.csv')\n tmpCSV = csv.writer(open(workingCSV, 'wb'))\n tmpCSV.writerow([\"FilePath\", \"Categorical\", \"Resampling\", \"Aggregation\"])\n outHeader1 = ['x', 'y', 'response']\n outHeader2 = ['', '', '']\n outHeader3 = ['', '', '']\n \n output_dname = utils.mknextdir(prefix='ProjectionLayers_')\n \n for row in inCSV:\n if template == '':\n template = row[0]\n fileShortName = utils.getShortName(row[0])\n if row[1] == 1:\n outHeader1.append(fileShortName + '_categorical')\n else:\n outHeader1.append(fileShortName)\n outHeader2.append('1')\n outHeader3.append(os.path.join(output_dname, fileShortName + '.tif'))\n\n origFile = row[4]\n newOrigFile = origFile\n for lookup in fromto:\n if lookup[0] in origFile:\n newOrigFile = origFile.replace(lookup[0], lookup[1])\n tmpCSV.writerow([newOrigFile,] + row[1:4])\n del tmpCSV\n \n #PARC the files here\n ourPARC = parc.PARC()\n \n \n if configuration.verbose:\n ourPARC.verbose = True\n writetolog(\" output_dname=\" + output_dname, False, False)\n ourPARC.outDir = output_dname\n ourPARC.inputsCSV = workingCSV\n ourPARC.template = template\n\n try:\n ourPARC.parcFiles()\n except TrappedError as e:\n raise ModuleError(self, e.message)\n except :\n utils.informative_untrapped_error(self, \"PARC\")\n \n #loop through our workingCSV and format it into an MDS header\n \n #outputMDS = utils.mknextfile(prefix='ProjectionLayersMDS_', suffix = '.csv')\n outputMDS = os.path.join(output_dname, 'ProjectionLayersMDS.csv')\n outCSV = csv.writer(open(outputMDS, 'wb'))\n outCSV.writerow(outHeader1)\n outCSV.writerow(outHeader2)\n outCSV.writerow(outHeader3)\n \n output_file = utils.create_file_module(outputMDS)\n self.set_output(\"MDS\", output_file)\n writetolog(\"Finished Select Projection Layers widget\", True)", "metadata": "root.ProjectionLayers.compute", "header": "['class', 'ProjectionLayers', '(', 'Module', ')', ':', '___EOS___']", "index": 1298 } ]
[ { "span": "output_fname ", "start_line": 576, "start_column": 8, "end_line": 576, "end_column": 20 }, { "span": "predictorsDir ", "start_line": 965, "start_column": 8, "end_line": 965, "end_column": 21 }, { "span": "models ", "start_line": 1299, "start_column": 8, "end_line": 1299, "end_column": 14 }, { "span": "scenarioss ", "start_line": 1300, "start_column": 8, "end_line": 1300, "end_column": 18 }, { "span": "years ", "start_line": 1301, "start_column": 8, "end_line": 1301, "end_column": 13 }, { "span": "header ", "start_line": 1329, "start_column": 12, "end_line": 1329, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Model_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "color", "\\u", "breaks", "\\u", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Output_", "=_", "{_", "\"", "FIT", "\\u", "BR", "T", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "br", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FIT", "\\u", "GL", "M", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "glm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FIT", "\\u", "RF", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "rf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FIT", "\\u", "MAR", "S", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "mars", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model", "Abbr", "ev_", "=_", "Model", "Output_", "[_", "self_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "dname_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "Model", "Abbr", "ev_", "+_", "'", "output", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "Dict_", "=_", "utils_", "._", "map", "\\u", "ports_", "(_", "self_", ",_", "self_", "._", "port", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mds", "File_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "mds", "File", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "args", "Dict_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "'", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "+=_", "'", " ", "'_", "+_", "'='_", "._", "join_", "(_", "[_", "str_", "(_", "k_", ")_", ",_", "'\"'_", "+_", "str_", "(_", "v_", ")_", "+_", "'\"'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "+=_", "'", " ", "'_", "+_", "'='_", "._", "join_", "(_", "[_", "str_", "(_", "k_", ")_", ",_", "str_", "(_", "v_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "+=_", "\"", " ", "o", "=\"_", "+_", "'\"'_", "+_", "output", "\\u", "dname_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "+=_", "\"", " ", "rc", "=\"_", "+_", "utils_", "._", "MD", "Sr", "esp", "ons", "e", "Col_", "(_", "mds", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "make", "Bin", "Map", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Bin", "Map", " ", "=", " ", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "make", "Bin", "Map", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mb", "t", "='", " ", "+", " ", "str", "(", "make", "Bin", "Map", ").", "upper", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Bin", "Map", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mb", "t", "=", "TRU", "E", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "make", "Probabili", "ty", "Map", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Probabili", "ty", "Map", " ", "=", " ", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "make", "Probabili", "ty", "Map", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mpt", "='", " ", "+", " ", "str", "(", "make", "Probabili", "ty", "Map", ").", "upper", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Probabili", "ty", "Map", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mpt", "=", "TRU", "E", "'", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "seed", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "seed", "='", " ", "+", " ", "str", "(", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "seed", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "some", "Param", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "x", " ", "=", " ", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "some", "Param", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "x", " ", ">", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "msg", " ", "=", " ", "\"", "Expect", "ed", " ", "output", " ", "from", " ", "\"", " ", "+", " ", "Model", "Abbr", "ev", " ", "+", " ", "\"", " ", "was", " ", "not", " ", "found", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "msg", " ", "+=", " ", "\"\\\\", "n", "Thi", "s", " ", "like", "ly", " ", "indicat", "es", " ", "problem", "s", " ", "with", " ", "the", " ", "inputs", " ", "to", " ", "the", " ", "R", " ", "module", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writet", "olog", "(", "msg", ",", " ", "Fal", "se", ",", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "\"", " ", "abr", "=\"", " ", "+", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "run", "RS", "cript_", "(_", "self_", "._", "name_", ",_", "args_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "util", "s", ".", "run", "RS", "cript", "('", "FIT", "\\u", "BR", "T", "\\u", "plug", "gab", "le", "Error", "Messag", "e", ".", "r", "',", " ", "args", ",", " ", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "prob", "\\u", "map", ".", "tif", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "prob", "\\u", "map", ".", "jpeg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "input", "\\u", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "util", "s", ".", "tif", "\\u", "to", "\\u", "color", "\\u", "jpeg", "(", "input", "\\u", "fname", ",", " ", "output", "\\u", "fname", ",", " ", "color", "\\u", "breaks", "\\u", "csv", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "output", "\\u", "file", "4", " ", "=", " ", "util", "s", ".", "create", "\\u", "file", "\\u", "module", "(", "output", "\\u", "fname", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "output_", "(_", "'", "Probabili", "ty", "Map", "'_", ",_", "input", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mpt", "'_", ")_", "and_", "args", "Dict_", "[_", "'", "mpt", "'_", "]_", "==_", "True_", ")_", "or_", "not_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mpt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Expect", "ed", " ", "output", " ", "from", " ", "\"_", "+_", "Model", "Abbr", "ev_", "+_", "\"", " ", "was", " ", "not", " ", "found", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\"\\\\", "n", "Thi", "s", " ", "mig", "ht", " ", "indicat", "e", " ", "problem", "s", " ", "with", " ", "the", " ", "inputs", " ", "to", " ", "the", " ", "R", " ", "module", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\"\\\\", "n", "Check", " ", "the", " ", "console", " ", "output", " ", "for", " ", "addition", "al", " ", "R", " ", "warn", "ings", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "msg_", ",_", "False_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mb", "t", "'_", ")_", "and_", "args", "Dict_", "[_", "'", "mb", "t", "'_", "]_", "==_", "True_", ")_", "or_", "not_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mb", "t", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "bin", "\\u", "map", ".", "tif", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file1_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Bin", "ary", "Map", "'_", ",_", "output", "\\u", "file1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "output", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file2_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Text", "\\u", "Output", "'_", ",_", "output", "\\u", "file2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "auc", "\\u", "plot", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "out", " ", "auc", ":", " ", "\",", " ", "out", "File", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file", "3_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "AUC", "\\u", "plot", "'_", ",_", "output", "\\u", "file", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "response", "\\u", "curve", "s", ".", "pdf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file", "5_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Respons", "e", "Curve", "s", "'_", ",_", "output", "\\u", "file", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "\"", "model", "Works", "pace", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "out", " ", "auc", ":", " ", "\",", " ", "out", "File", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file", "6_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "model", "Works", "pace", "'_", ",_", "output", "\\u", "file", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "\"_", "+_", "Model", "Abbr", "ev_", "+_", "\"", " ", "builde", "r", "\\\\", "n", "\"_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PAR", "C_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "writet", "olog", "(\"", "\\\\", "n", "Run", "ning", " ", "PAR", "C", "\",", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "=_", "parc", "_", "._", "PAR", "C_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "dname_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "'", "PAR", "C", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "configuration_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "verbose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "our", "PAR", "C_", "._", "logger_", "=_", "utils_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "PAR", "C_", "._", "out", "\\u", "dir_", "=_", "output", "\\u", "dname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "multiple", "Core", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "multiple", "Core", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "multico", "res_", "=_", "\"", "Tru", "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_", "working", "CSV_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "tmp", "Files", "To", "PAR", "C", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "CSV_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "PAR", "CO", "ut", "put", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "append", " ", "addition", "al", " ", "inputs", " ", "to", " ", "the", " ", "exist", "ing", " ", "CSV", " ", "if", " ", "one", " ", "was", " ", "supplie", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", "other", "wis", "e", " ", "start", " ", "a", " ", "new", " ", "CSV_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "CSV_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "\"_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "input", "CSV_", ",_", "working", "CSV_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "working", "CSV_", ",_", "\"", "ab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Writer_", "=_", "csv_", "._", "writer_", "(_", "f_", ")_", "\\u\\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_", "(_", "working", "CSV_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Writer_", "=_", "csv_", "._", "writer_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Writer_", "._", "writerow_", "(_", "[_", "\"", "File", "Path", "\"_", ",_", "\"", "Categori", "cal", "\"_", ",_", "\"", "Res", "ampling", "\"_", ",_", "\"", "Aggregation", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Predictor", "List", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "predictor", "\\u", "lists_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "'", "Predictor", "List", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predictor", "\\u", "list_", "in_", "predictor", "\\u", "lists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "predictor_", "in_", "predictor", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "csv", "Writer_", "._", "writerow_", "(_", "list_", "(_", "predictor_", ")_", ")_", "\\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_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "predictor", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "predictor", "\\u", "list_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "'", "predictor", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predictor_", "in_", "predictor", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv", "Writer_", "._", "writerow_", "(_", "list_", "(_", "predictor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "csv", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "inputs", "\\u", "CSV_", "=_", "working", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "template_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "'", " ", " ", " ", " ", "template", " ", "layer", " ", "=", " ", "'_", "+_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "\\u", "dna", "me", "=\"_", "+_", "output", "\\u", "dname_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "working", "CSV", "=\"_", "+_", "working", "CSV_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "parc", "Files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tra", "pped", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writet", "olog", "_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "e_", "._", "message_", ")_", "\\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 ", " _", "utils_", "._", "informati", "ve", "\\u", "untr", "appe", "d\\u", "error_", "(_", "self_", ",_", "\"", "PAR", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "delete", " ", "our", " ", "temp", " ", "working", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "working", "CSV_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "predictor", "s", "Dir_", "=_", "utils_", "._", "create", "\\u", "dir\\u", "module_", "(_", "output", "\\u", "dname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "CSV_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "\"", "PAR", "C", "\\u", "Files", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "CSV_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "runn", "ing", " ", "PAR", "C", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Projection", "Layers_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "models_", "=_", "[_", "'", "CCC", "MA", "'_", ",_", "'", "CSI", "RO", "'_", ",_", "'", "had", "cm", "3", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "ario", "ss_", "=_", "[_", "'", "A2", "a", "'_", ",_", "'", "B2", "b", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "years_", "=_", "[_", "'", "2020", "'_", ",_", "'", "2050", "'_", ",_", "'", "208", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"\\\\", "n", "Run", "ning", " ", "make", " ", "Projection", " ", "Layer", "s", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "CSV_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", "._", "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 ", " _", "template_", "=_", "''_", "#", "we", "'", "ll", " ", "get", " ", "a", " ", "template", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "to_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clim", "args_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "input_", "in_", "[_", "'", "model", "'_", ",_", "'", "scen", "ario", "'_", ",_", "'", "year", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "input_", "(_", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clim", "args_", "[_", "input_", "]_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "clim", "args_", "<_", ">_", "{_", "}_", "and_", "clim", "args_", "._", "keys_", "(_", ")_", "<_", ">_", "[_", "'", "model", "'_", ",_", "'", "scen", "ario", "'_", ",_", "'", "year", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "the", "y", " ", "did", " ", "not", " ", "add", " ", "in", " ", "one", " ", "of", " ", "each", ",", " ", "Not", " ", "goi", "ng", " ", "to", " ", "fly", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "All", " ", "of", " ", "model", ",", " ", "scen", "ario", ",", " ", "and", " ", "year", " ", "must", " ", "be", " ", "supplie", "d", " ", "if", " ", "any", " ", "are", " ", "used", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "clim", "args_", "<_", ">_", "{_", "}_", "and_", "clim", "args_", "._", "keys_", "<_", ">_", "[_", "'", "model", "'_", ",_", "'", "scen", "ario", "'_", ",_", "'", "year", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "the", "y", " ", "specified", " ", "a", " ", "alt", " ", "climate", " ", "scen", "ario", " ", "add", " ", "this", " ", "to", " ", "our", " ", "list", " ", "to", " ", "search", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "to_", "._", "append_", "(_", "[_", "r", "'", "K", ":\\\\", "GI", "S", "\\u", "LIBRARY", "\\\\", "Clim", "ate", "\\\\", "Wor", "ld", "Clim", "\\\\", "Bio", "clim", "atic", "Varia", "bles", "\\\\", "bio", "\\u", "30", "s", "\\u", "esr", "i", "\\\\", "bio", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "'", "I", ":\\\\", "Wor", "ld", "Clim", "\\u", "Fu", "ture", "\\u", "Clim", "ate", "\\\\", "Rename", "d", "BIL", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clim", "args_", "[_", "'", "model", "'_", "]_", ",_", "clim", "args_", "[_", "'", "scen", "ario", "'_", "]_", ",_", "clim", "args_", "[_", "'", "year", "'_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "director", "y", "Cross", "walk", "CSV", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cross", "walk", "CSV_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "director", "y", "Cross", "walk", "CSV", "'_", ")_", ",_", "'", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "cross", "walk", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "cross", "walk", "CSV_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "to_", "._", "append_", "(_", "row_", "[_", "0_", "]_", ",_", "row_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "cross", "walk", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "write", " ", "out", " ", "the", " ", "output", "s", " ", "to", " ", "an", " ", "empty", " ", "MD", "S", " ", "file", " ", "(", "just", " ", "the", " ", "header", " ", "is", " ", "need", "ed", " ", "to", " ", "PAR", "C", " ", "the", " ", "output", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "CSV_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "input", "CSV_", ",_", "'", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "CSV_", "._", "next_", "(_", ")_", "#", "skip", " ", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "working", "CSV_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "tmp", "Files", "To", "PAR", "C", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "CSV_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "working", "CSV_", ",_", "'", "wb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "CSV_", "._", "writerow_", "(_", "[_", "\"", "File", "Path", "\"_", ",_", "\"", "Categori", "cal", "\"_", ",_", "\"", "Res", "ampling", "\"_", ",_", "\"", "Aggregation", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er1", "_", "=_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "response", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er2", "_", "=_", "[_", "''_", ",_", "''_", ",_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er", "3_", "=_", "[_", "''_", ",_", "''_", ",_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "dname_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "'", "Projection", "Layer", "s", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "in", "CSV_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Short", "Name_", "=_", "utils_", "._", "get", "Short", "Name_", "(_", "row_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", "[_", "1_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Head", "er1", "_", "._", "append_", "(_", "file", "Short", "Name_", "+_", "'\\u", "categor", "ical", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Head", "er1", "_", "._", "append_", "(_", "file", "Short", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "Head", "er2", "_", "._", "append_", "(_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er", "3_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "file", "Short", "Name_", "+_", "'.", "tif", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "File_", "=_", "row_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Orig", "File_", "=_", "orig", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lookup_", "in_", "from", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lookup_", "[_", "0_", "]_", "in_", "orig", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Orig", "File_", "=_", "orig", "File_", "._", "replace_", "(_", "lookup_", "[_", "0_", "]_", ",_", "lookup_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "CSV_", "._", "writerow_", "(_", "[_", "new", "Orig", "File_", ",_", "]_", "+_", "row_", "[_", "1_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "tmp", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "PAR", "C", " ", "the", " ", "files", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "our", "PAR", "C_", "=_", "parc", "_", "._", "PAR", "C_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "configuration_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "verbose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "\\u", "dna", "me", "=\"_", "+_", "output", "\\u", "dname_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "out", "Dir_", "=_", "output", "\\u", "dname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "inputs", "CSV_", "=_", "working", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "template_", "=_", "template_", "\\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 ", " _", "our", "PAR", "C_", "._", "parc", "Files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tra", "pped", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "e_", "._", "message_", ")_", "\\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 ", " _", "utils_", "._", "informati", "ve", "\\u", "untr", "appe", "d\\u", "error_", "(_", "self_", ",_", "\"", "PAR", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "loop", " ", "through", " ", "our", " ", "working", "CSV", " ", "and", " ", "format", " ", "it", " ", "int", "o", " ", "an", " ", "MD", "S", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "output", "MD", "S", " ", "=", " ", "util", "s", ".", "mk", "next", "file", "(", "prefix", "='", "Projection", "Layer", "s", "MD", "S", "\\u", "',", " ", "suff", "ix", " ", "=", " ", "'.", "csv", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "MD", "S_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "'", "Projection", "Layer", "s", "MD", "S", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "output", "MD", "S_", ",_", "'", "wb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "._", "writerow_", "(_", "out", "Head", "er1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "._", "writerow_", "(_", "out", "Head", "er2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "._", "writerow_", "(_", "out", "Head", "er", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "MD", "S", "\"_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "Select", " ", "Projection", " ", "Layer", "s", " ", "widget", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Imprecise assert
frankwiles/django-taggit-suggest/taggit_suggest/tests.py
[ { "content": " def test_simple_suggest(self):\n ku_tag = Tag.objects.create(name='ku')\n TagKeyword.objects.create(\n tag=ku_tag,\n keyword='kansas university'\n )\n\n suggested_tags = suggest_tags('I used to be a student at kansas university')\n self.assertTrue(ku_tag in suggested_tags)", "metadata": "root.SuggestCase.test_simple_suggest", "header": "['class', 'SuggestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_regex_suggest(self):\n ku_tag = Tag.objects.create(name='ku')\n TagRegex.objects.create(\n tag=ku_tag,\n name='Find University of Kansas',\n regex='University\\s+of\\s+Kansas'\n )\n\n suggested_tags = suggest_tags('I was once a student at the University of Kansas')\n\n self.assertTrue(ku_tag in suggested_tags)", "metadata": "root.SuggestCase.test_regex_suggest", "header": "['class', 'SuggestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_bad_regex(self):\n ku_tag = Tag.objects.create(name='ku')\n TagKeyword.objects.create(\n tag=ku_tag,\n keyword='kansas university'\n )\n new_regex = TagRegex(\n tag=ku_tag,\n name='Find University of Kansas',\n regex='University\\s+of(\\s+Kansas'\n )\n self.assertRaises(ValidationError, new_regex.save)\n\n suggested_tags = suggest_tags('I was once a student at the University '\n 'of Kansas. Also known as kansas university by the way.')\n\n self.assertTrue(ku_tag in suggested_tags)", "metadata": "root.SuggestCase.test_bad_regex", "header": "['class', 'SuggestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 31 } ]
[ { "span": "self.assertTrue(ku_tag in suggested_tags)", "start_line": 17, "start_column": 8, "end_line": 17, "end_column": 49 }, { "span": "self.assertTrue(ku_tag in suggested_tags)", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 49 }, { "span": "self.assertTrue(ku_tag in suggested_tags)", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Sug", "gest", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "simple", "\\u", "suggest", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ku", "\\u", "tag_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "ku", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ta", "g", "Keyword_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "ku", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyword_", "=_", "'", "kan", "sas", " ", "universi", "ty", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suggested", "\\u", "tags_", "=_", "suggest", "\\u", "tags_", "(_", "'", "I", " ", "used", " ", "to", " ", "be", " ", "a", " ", "student", " ", "at", " ", "kan", "sas", " ", "universi", "ty", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ku", "\\u", "tag_", "in_", "suggested", "\\u", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sug", "gest", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "regex", "\\u", "suggest", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ku", "\\u", "tag_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "ku", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ta", "g", "Regex_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "ku", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Fin", "d", " ", "Univers", "it", "y", " ", "of", " ", "Kan", "sas", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "'", "Univers", "it", "y", "\\\\", "s", "+", "of", "\\\\", "s", "+", "Kan", "sas", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suggested", "\\u", "tags_", "=_", "suggest", "\\u", "tags_", "(_", "'", "I", " ", "was", " ", "onc", "e", " ", "a", " ", "student", " ", "at", " ", "the", " ", "Univers", "it", "y", " ", "of", " ", "Kan", "sas", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ku", "\\u", "tag_", "in_", "suggested", "\\u", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sug", "gest", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "regex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ku", "\\u", "tag_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "ku", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ta", "g", "Keyword_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "ku", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyword_", "=_", "'", "kan", "sas", " ", "universi", "ty", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "regex_", "=_", "Ta", "g", "Regex_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "ku", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Fin", "d", " ", "Univers", "it", "y", " ", "of", " ", "Kan", "sas", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "'", "Univers", "it", "y", "\\\\", "s", "+", "of", "(\\\\", "s", "+", "Kan", "sas", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ",_", "new", "\\u", "regex_", "._", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suggested", "\\u", "tags_", "=_", "suggest", "\\u", "tags_", "(_", "'", "I", " ", "was", " ", "onc", "e", " ", "a", " ", "student", " ", "at", " ", "the", " ", "Univers", "it", "y", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "of", " ", "Kan", "sas", ".", " ", "Al", "so", " ", "know", "n", " ", "as", " ", "kan", "sas", " ", "universi", "ty", " ", "by", " ", "the", " ", "way", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ku", "\\u", "tag_", "in_", "suggested", "\\u", "tags_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
girishramnani/hacking-tools/port_scanner/portScan.py
[ { "content": "def conn(tgthost,tgtprt):\n try:\n connectSkt = socket()\n connectSkt.connect((tgthost,tgtprt))\n connectSkt.send(b'heyo man \\r\\n')\n result = connectSkt.recv(10)\n print(\"{} /tcp open\".format(tgtprt))\n connectSkt.close()\n except:\n pass", "metadata": "root.conn", "header": "['module', '___EOS___']", "index": 6 }, { "content": "def portScan(tgtHost,tgtPorts):\n try:\n tgtIP=gethostbyname(tgtHost)\n except:\n print(\"achi tarah se likh\")\n else:\n setdefaulttimeout(0.2)\n for tgtport in tgtPorts:\n print(\"Scanning port {}\".format(tgtport))\n conn(tgtIP,int(tgtport))", "metadata": "root.portScan", "header": "['module', '___EOS___']", "index": 17 } ]
[ { "span": "except:", "start_line": 14, "start_column": 4, "end_line": 14, "end_column": 11 }, { "span": "except:", "start_line": 20, "start_column": 4, "end_line": 20, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "conn_", "(_", "tgt", "host_", ",_", "tgt", "prt", "_", ")_", ":_", "\\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 ", " _", "connect", "Sk", "t_", "=_", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect", "Sk", "t_", "._", "connect_", "(_", "(_", "tgt", "host_", ",_", "tgt", "prt", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect", "Sk", "t_", "._", "send_", "(_", "b", "'", "hey", "o", " ", "man", " ", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "connect", "Sk", "t_", "._", "recv_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"{}", " ", "/", "tcp", " ", "open", "\"_", "._", "format_", "(_", "tgt", "prt", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect", "Sk", "t_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[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_", "port", "Scan_", "(_", "tgt", "Host_", ",_", "tgt", "Ports_", ")_", ":_", "\\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 ", " _", "tgt", "IP_", "=_", "gethostbyname", "_", "(_", "tgt", "Host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "achi", " ", "tar", "ah", " ", "se", " ", "lik", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setdefault", "timeout_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tgt", "port_", "in_", "tgt", "Ports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Scann", "ing", " ", "port", " ", "{}\"_", "._", "format_", "(_", "tgt", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "(_", "tgt", "IP_", ",_", "int_", "(_", "tgt", "port_", ")_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
thomasmesnard/DeepMind-Teaching-Machines-to-Read-and-Comprehend/config/deep_bidir_lstm_2x128.py
[ { "content": "from blocks.algorithms import BasicMomentum, AdaDelta, RMSProp, Adam, CompositeRule, StepClipping\nfrom blocks.initialization import IsotropicGaussian, Constant\nfrom blocks.bricks import Tanh\n\nfrom model.deep_bidir_lstm import Model\n\n\nbatch_size = 32\nsort_batch_count = 20\n\nshuffle_questions = True\nshuffle_entities = True\n\nconcat_ctx_and_question = True\nconcat_question_before = True\t\t## should not matter for bidirectionnal network\n\nembed_size = 200\n\nlstm_size = [128, 128]\nskip_connections = True\n\nn_entities = 550\nout_mlp_hidden = []\nout_mlp_activations = []\n\nstep_rule = CompositeRule([RMSProp(decay_rate=0.95, learning_rate=5e-5),\n BasicMomentum(momentum=0.9)])\n\ndropout = 0.1\nw_noise = 0.05\n\nvalid_freq = 1000\nsave_freq = 1000\nprint_freq = 100\n\nweights_init = IsotropicGaussian(0.01)\nbiases_init = Constant(0.)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from blocks.algorithms import BasicMomentum, AdaDelta, RMSProp, Adam, CompositeRule, StepClipping", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 97 }, { "span": "from blocks.bricks import Tanh", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 30 }, { "span": "from model.deep_bidir_lstm import Model", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "blocks_", "._", "algorithms_", "import_", "Basic", "Moment", "um_", ",_", "Ada", "Delta_", ",_", "RMS", "Prop_", ",_", "Adam", "_", ",_", "Composit", "e", "Rule_", ",_", "Step", "Clip", "ping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "initialization", "_", "import_", "Iso", "trop", "ic", "Gaussian", "_", ",_", "Constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "bricks", "_", "import_", "Tan", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "model_", "._", "deep", "\\u", "bid", "ir", "\\u", "lstm", "_", "import_", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "batch", "\\u", "count_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shu", "ffle", "\\u", "questions_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shu", "ffle", "\\u", "entities_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conc", "at", "\\u", "ctx", "\\u", "and", "\\u", "question_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conc", "at", "\\u", "question", "\\u", "before_", "=_", "True_", "##", " ", "shou", "ld", " ", "not", " ", "matte", "r", " ", "for", " ", "bidirect", "ionn", "al", " ", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "embed", "\\u", "size_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lstm", "\\u", "size_", "=_", "[_", "128_", ",_", "128_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip", "\\u", "connections_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "entities_", "=_", "550_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "mlp", "\\u", "hidden_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "mlp", "\\u", "activations_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "\\u", "rule_", "=_", "Composit", "e", "Rule_", "(_", "[_", "RMS", "Prop_", "(_", "deca", "y", "\\u", "rate_", "=_", "0.95_", ",_", "learn", "ing", "\\u", "rate_", "=_", "5e-", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Basic", "Moment", "um_", "(_", "momentum_", "=_", "0.9_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dropout_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "noise_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "freq_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "freq_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "freq_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "s", "\\u", "init_", "=_", "Iso", "trop", "ic", "Gaussian", "_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bias", "es", "\\u", "init_", "=_", "Constant_", "(_", "0._", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
AcademicsToday/py-academicstoday/academicstoday_project/landpage/tests/test_privacy.py
[ { "content": "from django.core.urlresolvers import resolve\nfrom django.http import HttpRequest\nfrom django.http import QueryDict\nfrom django.test import TestCase\nfrom django.test import Client\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth import authenticate, login, logout\nfrom landpage.views import privacy\nimport json\nfrom landpage.models import LandpageTeamMember\nfrom landpage.models import LandpageCoursePreview\nfrom registrar.models import Course\nfrom registrar.models import Student\nfrom registrar.models import Teacher\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PrivacyTest(TestCase):\n \n \n", "metadata": "root.PrivacyTest", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def tearDown(self):\n pass", "metadata": "root.PrivacyTest.tearDown", "header": "['class', 'PrivacyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def setUp(self):\n pass", "metadata": "root.PrivacyTest.setUp", "header": "['class', 'PrivacyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 20 }, { "content": " def test_url_resolves_to_privacy_page(self):\n found = resolve('/privacy');\n self.assertEqual(found.func,privacy.privacy_page)", "metadata": "root.PrivacyTest.test_url_resolves_to_privacy_page", "header": "['class', 'PrivacyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_privacy_page_returns_correct_html(self):\n parameters = {\"course_id\":1}\n client = Client()\n response = client.post(\n '/privacy',\n data=parameters,\n )\n self.assertEqual(response.status_code, 200)\n self.assertIn(b'Privacy',response.content)\n self.assertIn(b'(1)',response.content)", "metadata": "root.PrivacyTest.test_privacy_page_returns_correct_html", "header": "['class', 'PrivacyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 27 } ]
[ { "span": "from django.http import HttpRequest", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 35 }, { "span": "from django.http import QueryDict", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 33 }, { "span": "from django.contrib.auth.models import User", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 43 }, { "span": "from django.contrib.auth import authenticate, login, logout", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 59 }, { "span": "import json", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 11 }, { "span": "from landpage.models import LandpageTeamMember", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 46 }, { "span": "from landpage.models import LandpageCoursePreview", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 49 }, { "span": "from registrar.models import Course", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 35 }, { "span": "from registrar.models import Student", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 36 }, { "span": "from registrar.models import Teacher", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "resolve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Query", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "authenticate_", ",_", "login_", ",_", "logout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "land", "page_", "._", "views_", "import_", "privacy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "land", "page_", "._", "models_", "import_", "Land", "page", "Tea", "m", "Member_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "land", "page_", "._", "models_", "import_", "Land", "page", "Cour", "se", "Preview", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Course_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Student_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Teacher", "_", "\\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_", "Priva", "cy", "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_", "[SEP]_", "class_", "Priva", "cy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "cy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "cy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "url", "\\u", "resolve", "s", "\\u", "to", "\\u", "privacy", "\\u", "page_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "resolve_", "(_", "'/", "privacy", "'_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "found_", "._", "func_", ",_", "privacy", "_", "._", "privacy", "\\u", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "cy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "privacy", "\\u", "page", "\\u", "return", "s", "\\u", "correct", "\\u", "html_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameters_", "=_", "{_", "\"", "course", "\\u", "id", "\"_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "privacy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "parameters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "b", "'", "Priva", "cy", "'_", ",_", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "b", "'(", "1", ")'_", ",_", "response_", "._", "content_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
LabPy/lantz/lantz/drivers/labjack/_internal/u12.py
[ { "content": " def rawAIContinuous(self, channel0PGAMUX = 8, channel1PGAMUX = 9, channel2PGAMUX = 10, channel3PGAMUX = 11, FeatureReports = False, CounterRead = False, UpdateIO = False, LEDState = True, IO3ToIO0States = 0, SampleInterval = 15000):\n \"\"\"\n Currently in development.\n \n The function is mostly implemented, but is currently too slow to be \n useful.\n \"\"\"\n command = [ 0 ] * 8\n \n # Bits 6-4: PGA for 1st Channel\n # Bits 3-0: MUX command for 1st Channel\n command[0] = int(channel0PGAMUX)\n \n tempNum = command[0] & 7 # 7 = 0b111\n channel0Number = tempNum if (command[0] & 0xf) > 7 else tempNum+8\n channel0Gain = (command[0] >> 4) & 7 # 7 = 0b111\n \n command[1] = int(channel1PGAMUX)\n \n tempNum = command[1] & 7 # 7 = 0b111\n channel1Number = tempNum if (command[1] & 0xf) > 7 else tempNum+8\n channel1Gain = (command[1] >> 4) & 7 # 7 = 0b111\n \n command[2] = int(channel2PGAMUX)\n \n tempNum = command[2] & 7 # 7 = 0b111\n channel2Number = tempNum if (command[2] & 0xf) > 7 else tempNum+8\n channel2Gain = (command[2] >> 4) & 7 # 7 = 0b111\n \n command[3] = int(channel3PGAMUX)\n \n tempNum = command[3] & 7 # 7 = 0b111\n channel3Number = tempNum if (command[3] & 0xf) > 7 else tempNum+8\n channel3Gain = (command[3] >> 4) & 7 # 7 = 0b111\n \n bf = BitField()\n bf.bit7 = int(bool(FeatureReports))\n bf.bit6 = int(bool(CounterRead))\n bf.bit1 = int(bool(UpdateIO))\n bf.bit0 = int(bool(LEDState))\n \n command[4] = int(bf)\n \n # Bits 7-4: 1001 (Start Continuous)\n bf2 = BitField( rawByte = int(IO3ToIO0States) )\n bf2.bit7 = 1\n bf2.bit4 = 1\n \n command[5] = int(bf2)\n \n command[6] = ( SampleInterval >> 8)\n command[7] = SampleInterval & 0xff\n \n byte0bf = BitField()\n returnDict = dict()\n \n self.write(command)\n while True:\n results = self.read()\n \n byte0bf.fromByte(results[0])\n \n returnDict['Byte0'] = byte0bf\n returnDict['IterationCounter'] = (results[1] >> 5)\n returnDict['Backlog'] = results[1] & 0xf\n \n \n yield returnDict", "metadata": "root.U12.rawAIContinuous", "header": "['class', 'U12', '(', 'object', ')', ':', '___EOS___']", "index": 1213 }, { "content": " def aiSample(self, numChannels, channels, idNum=None, demo=0, stateIOin=0, updateIO=0, ledOn=0, gains=[0, 0, 0, 0], disableCal=0):\n \"\"\"\n Name: U12.aiSample(channels, idNum=None, demo=0, stateIOin=0, updateIO=0, ledOn=0, gains=[0, 0, 0, 0], disableCal=0)\n Args: See section 4.6 of the User's Guide\n Desc: Reads the voltages from 1,2, or 4 analog inputs. Also controls/reads the 4 IO ports.\n\n >>> dev = U12()\n >>> dev.aiSample(2, [0, 1])\n {'stateIO': [0, 0, 0, 0], 'overVoltage': 0, 'idnum': 1, 'voltages': [1.4208984375, 1.4306640625]}\n \"\"\"\n \n # Check id num\n if idNum is None:\n idNum = self.id\n idNum = ctypes.c_long(idNum)\n \n # Check to make sure that everything is checked\n if not isIterable(channels): raise TypeError(\"channels must be iterable\")\n if not isIterable(gains): raise TypeError(\"gains must be iterable\")\n if len(channels) < numChannels: raise ValueError(\"channels must have atleast numChannels elements\")\n if len(gains) < numChannels: raise ValueError(\"gains must have atleast numChannels elements\")\n \n # Convert lists to arrays and create other ctypes\n channelsArray = listToCArray(channels, ctypes.c_long)\n gainsArray = listToCArray(gains, ctypes.c_long)\n overVoltage = ctypes.c_long(999)\n longArrayType = (ctypes.c_long * 4)\n floatArrayType = (ctypes.c_float * 4)\n voltages = floatArrayType(0, 0, 0, 0)\n stateIOin = ctypes.c_long(stateIOin)\n \n ecode = staticLib.AISample(ctypes.byref(idNum), demo, ctypes.byref(stateIOin), updateIO, ledOn, numChannels, ctypes.byref(channelsArray), ctypes.byref(gainsArray), disableCal, ctypes.byref(overVoltage), ctypes.byref(voltages))\n\n if ecode != 0: raise U12Exception(ecode)\n \n return {\"idnum\":idNum.value, \"stateIO\":stateIOin.value, \"overVoltage\":overVoltage.value, \"voltages\":voltages[0:numChannels]}", "metadata": "root.U12.aiSample", "header": "['class', 'U12', '(', 'object', ')', ':', '___EOS___']", "index": 2117 }, { "content": " def aiBurst(self, numChannels, channels, scanRate, numScans, idNum=None, demo=0, stateIOin=0, updateIO=0, ledOn=0, gains=[0, 0, 0, 0], disableCal=0, triggerIO=0, triggerState=0, timeout=1, transferMode=0):\n \"\"\"\n Name: U12.aiBurst(numChannels, channels, scanRate, numScans, idNum=None, demo=0, stateIOin=[0, 0, 0, 0], updateIO=0, ledOn=0, gains=[0, 0, 0, 0], disableCal=0, triggerIO=0, triggerState=0, timeout=1, transferMode=0)\n Args: See section 4.7 of the User's Guide\n Desc: Reads a specified number of scans (up to 4096) at a specified scan rate (up to 8192 Hz) from 1,2, or 4 analog inputs\n\n >>> dev = U12()\n >>> dev.aiBurst(1, [0], 400, 10)\n {'overVoltage': 0, 'scanRate': 400.0, 'stateIOout': <u12.c_long_Array_4096 object at 0x00DB4BC0>, 'idnum': 1, 'voltages': <u12.c_float_Array_4096_Array_4 object at 0x00DB4B70>}\n \"\"\"\n \n # Check id number\n if idNum is None:\n idNum = self.id\n idNum = ctypes.c_long(idNum)\n \n # check list sizes\n if len(channels) < numChannels: raise ValueError(\"channels must have atleast numChannels elements\")\n if len(gains) < numChannels: raise ValueError(\"gains must have atleast numChannels elements\")\n \n # Convert lists to arrays and create other ctypes\n channelsArray = listToCArray(channels, ctypes.c_long)\n gainsArray = listToCArray(gains, ctypes.c_long)\n scanRate = ctypes.c_float(scanRate)\n pointerArray = (ctypes.c_void_p * 4)\n arr4096_type = ctypes.c_float * 4096 \n voltages_type = arr4096_type * 4 \n voltages = voltages_type() \n stateIOout = (ctypes.c_long * 4096)()\n overVoltage = ctypes.c_long(999)\n \n ecode = staticLib.AIBurst(ctypes.byref(idNum), demo, stateIOin, updateIO, ledOn, numChannels, ctypes.byref(channelsArray), ctypes.byref(gainsArray), ctypes.byref(scanRate), disableCal, triggerIO, triggerState, numScans, timeout, ctypes.byref(voltages), ctypes.byref(stateIOout), ctypes.byref(overVoltage), transferMode)\n\n if ecode != 0: raise U12Exception(ecode)\n \n return {\"idnum\":idNum.value, \"scanRate\":scanRate.value, \"voltages\":voltages, \"stateIOout\":stateIOout, \"overVoltage\":overVoltage.value}", "metadata": "root.U12.aiBurst", "header": "['class', 'U12', '(', 'object', ')', ':', '___EOS___']", "index": 2154 } ]
[ { "span": "channel0Number ", "start_line": 1227, "start_column": 8, "end_line": 1227, "end_column": 22 }, { "span": "channel0Gain ", "start_line": 1228, "start_column": 8, "end_line": 1228, "end_column": 20 }, { "span": "channel1Number ", "start_line": 1233, "start_column": 8, "end_line": 1233, "end_column": 22 }, { "span": "channel1Gain ", "start_line": 1234, "start_column": 8, "end_line": 1234, "end_column": 20 }, { "span": "channel2Number ", "start_line": 1239, "start_column": 8, "end_line": 1239, "end_column": 22 }, { "span": "channel2Gain ", "start_line": 1240, "start_column": 8, "end_line": 1240, "end_column": 20 }, { "span": "channel3Number ", "start_line": 1245, "start_column": 8, "end_line": 1245, "end_column": 22 }, { "span": "channel3Gain ", "start_line": 1246, "start_column": 8, "end_line": 1246, "end_column": 20 }, { "span": "longArrayType ", "start_line": 2143, "start_column": 8, "end_line": 2143, "end_column": 21 }, { "span": "pointerArray ", "start_line": 2178, "start_column": 8, "end_line": 2178, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "U1", "2_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "raw", "AI", "Continu", "ous_", "(_", "self_", ",_", "channel", "0", "PG", "AM", "UX", "_", "=_", "8_", ",_", "channel", "1", "PG", "AM", "UX", "_", "=_", "9_", ",_", "channel", "2", "PG", "AM", "UX", "_", "=_", "10_", ",_", "channel", "3", "PG", "AM", "UX", "_", "=_", "11_", ",_", "Feature", "Report", "s_", "=_", "False_", ",_", "Counter", "Read_", "=_", "False_", ",_", "Update", "IO_", "=_", "False_", ",_", "LED", "State_", "=_", "True_", ",_", "IO", "3", "To", "IO", "0", "States_", "=_", "0_", ",_", "Sampl", "e", "Interval_", "=_", "15000", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", "ly", " ", "in", " ", "develop", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "function", " ", "is", " ", "most", "ly", " ", "implemented", ",", " ", "but", " ", "is", " ", "currentl", "y", " ", "too", " ", "slow", " ", "to", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "usef", "ul", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "[_", "0_", "]_", "*_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bit", "s", " ", "6", "-", "4", ":", " ", "PG", "A", " ", "for", " ", "1s", "t", " ", "Channel_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bit", "s", " ", "3", "-0", ":", " ", "MU", "X", " ", "command", " ", "for", " ", "1s", "t", " ", "Channel_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "[_", "0_", "]_", "=_", "int_", "(_", "channel", "0", "PG", "AM", "UX", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "Num_", "=_", "command_", "[_", "0_", "]_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "0", "Number_", "=_", "temp", "Num_", "if_", "(_", "command_", "[_", "0_", "]_", "&_", "0xf", "_", ")_", ">_", "7_", "else_", "temp", "Num_", "+_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "0", "Gain", "_", "=_", "(_", "command_", "[_", "0_", "]_", ">>_", "4_", ")_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "[_", "1_", "]_", "=_", "int_", "(_", "channel", "1", "PG", "AM", "UX", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "Num_", "=_", "command_", "[_", "1_", "]_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "1", "Number_", "=_", "temp", "Num_", "if_", "(_", "command_", "[_", "1_", "]_", "&_", "0xf", "_", ")_", ">_", "7_", "else_", "temp", "Num_", "+_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "1", "Gain", "_", "=_", "(_", "command_", "[_", "1_", "]_", ">>_", "4_", ")_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "[_", "2_", "]_", "=_", "int_", "(_", "channel", "2", "PG", "AM", "UX", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "Num_", "=_", "command_", "[_", "2_", "]_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "2", "Number_", "=_", "temp", "Num_", "if_", "(_", "command_", "[_", "2_", "]_", "&_", "0xf", "_", ")_", ">_", "7_", "else_", "temp", "Num_", "+_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "2", "Gain", "_", "=_", "(_", "command_", "[_", "2_", "]_", ">>_", "4_", ")_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "[_", "3_", "]_", "=_", "int_", "(_", "channel", "3", "PG", "AM", "UX", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "Num_", "=_", "command_", "[_", "3_", "]_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "3", "Number_", "=_", "temp", "Num_", "if_", "(_", "command_", "[_", "3_", "]_", "&_", "0xf", "_", ")_", ">_", "7_", "else_", "temp", "Num_", "+_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "3", "Gain", "_", "=_", "(_", "command_", "[_", "3_", "]_", ">>_", "4_", ")_", "&_", "7_", "#", " ", "7", " ", "=", " ", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bf_", "=_", "Bit", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "._", "bit", "7_", "=_", "int_", "(_", "bool_", "(_", "Feature", "Report", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "._", "bit", "6_", "=_", "int_", "(_", "bool_", "(_", "Counter", "Read_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "._", "bit", "1_", "=_", "int_", "(_", "bool_", "(_", "Update", "IO_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "._", "bit", "0_", "=_", "int_", "(_", "bool_", "(_", "LED", "State_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "[_", "4_", "]_", "=_", "int_", "(_", "bf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bit", "s", " ", "7", "-", "4", ":", " ", "100", "1", " ", "(", "Start", " ", "Continu", "ous", ")_", "\\u\\u\\uNL\\u\\u\\u_", "bf", "2_", "=_", "Bit", "Field_", "(_", "raw", "Byte_", "=_", "int_", "(_", "IO", "3", "To", "IO", "0", "States_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf", "2_", "._", "bit", "7_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf", "2_", "._", "bit", "4_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "[_", "5_", "]_", "=_", "int_", "(_", "bf", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "[_", "6_", "]_", "=_", "(_", "Sampl", "e", "Interval_", ">>_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "[_", "7_", "]_", "=_", "Sampl", "e", "Interval_", "&_", "0xff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "byte", "0b", "f_", "=_", "Bit", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "Dict_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "self_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "byte", "0b", "f_", "._", "from", "Byte_", "(_", "results_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return", "Dict_", "[_", "'", "Byte", "0", "'_", "]_", "=_", "byte", "0b", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "Dict_", "[_", "'", "Iterat", "ion", "Counter", "'_", "]_", "=_", "(_", "results_", "[_", "1_", "]_", ">>_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "Dict_", "[_", "'", "Back", "log", "'_", "]_", "=_", "results_", "[_", "1_", "]_", "&_", "0xf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "return", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "U1", "2_", "(_", "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_", "ai", "Sample_", "(_", "self_", ",_", "num", "Channels_", ",_", "channels_", ",_", "id", "Num_", "=_", "None_", ",_", "demo_", "=_", "0_", ",_", "state", "IO", "in_", "=_", "0_", ",_", "update", "IO_", "=_", "0_", ",_", "led", "On_", "=_", "0_", ",_", "gains", "_", "=_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "disable", "Cal", "_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Name", ":", " ", "U1", "2", ".", "ai", "Sampl", "e", "(", "channel", "s", ",", " ", "id", "Num", "=", "Non", "e", ",", " ", "demo", "=", "0", ",", " ", "state", "IO", "in", "=", "0", ",", " ", "update", "IO", "=", "0", ",", " ", "led", "On", "=", "0", ",", " ", "gains", "=[", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", "],", " ", "disable", "Cal", "=", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", " ", "See", " ", "section", " ", "4.6", " ", "of", " ", "the", " ", "User", "'", "s", " ", "Guide", "\\", "10", ";", " ", " ", " ", " ", "Des", "c", ":", " ", "Read", "s", " ", "the", " ", "voltage", "s", " ", "from", " ", "1", ",", "2", ",", " ", "or", " ", "4", " ", "analog", " ", "inputs", ".", " ", "Al", "so", " ", "controls", "/", "reads", " ", "the", " ", "4", " ", "IO", " ", "port", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dev", " ", "=", " ", "U1", "2", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dev", ".", "ai", "Sampl", "e", "(", "2", ",", " ", "[", "0", ",", " ", "1", "])", "\\", "10", ";", " ", " ", " ", " ", "{", "'", "state", "IO", "':", " ", "[", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", "],", " ", "'", "over", "Volt", "age", "':", " ", "0", ",", " ", "'", "idn", "um", "':", " ", "1", ",", " ", "'", "voltage", "s", "':", " ", "[", "1.4", "208", "984", "375", ",", " ", "1.4", "306", "640", "625", "]}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "id", " ", "num_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "id", "Num_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id", "Num_", "=_", "self_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "id", "Num_", "=_", "ctypes_", "._", "c\\u", "long_", "(_", "id", "Num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "make", " ", "sure", " ", "tha", "t", " ", "every", "thing", " ", "is", " ", "checked_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "Iterable_", "(_", "channels_", ")_", ":_", "raise_", "Type", "Error_", "(_", "\"", "channel", "s", " ", "must", " ", "be", " ", "iterable", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "Iterable_", "(_", "gains", "_", ")_", ":_", "raise_", "Type", "Error_", "(_", "\"", "gains", " ", "must", " ", "be", " ", "iterable", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "channels_", ")_", "<_", "num", "Channels_", ":_", "raise_", "Value", "Error_", "(_", "\"", "channel", "s", " ", "must", " ", "have", " ", "atl", "east", " ", "num", "Chan", "nels", " ", "element", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "gains", "_", ")_", "<_", "num", "Channels_", ":_", "raise_", "Value", "Error_", "(_", "\"", "gains", " ", "must", " ", "have", " ", "atl", "east", " ", "num", "Chan", "nels", " ", "element", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "lists", " ", "to", " ", "arrays", " ", "and", " ", "create", " ", "other", " ", "ctypes_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "s", "Array_", "=_", "list", "To", "CA", "rray_", "(_", "channels_", ",_", "ctypes_", "._", "c\\u", "long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gains", "Array_", "=_", "list", "To", "CA", "rray_", "(_", "gains", "_", ",_", "ctypes_", "._", "c\\u", "long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "Volt", "age_", "=_", "ctypes_", "._", "c\\u", "long_", "(_", "999_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "Array", "Type_", "=_", "(_", "ctypes_", "._", "c\\u", "long_", "*_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "float", "Array", "Type_", "=_", "(_", "ctypes_", "._", "c\\u", "float_", "*_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voltage", "s_", "=_", "float", "Array", "Type_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state", "IO", "in_", "=_", "ctypes_", "._", "c\\u", "long_", "(_", "state", "IO", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ecode", "_", "=_", "static", "Lib_", "._", "AI", "Sample_", "(_", "ctypes_", "._", "byref_", "(_", "id", "Num_", ")_", ",_", "demo_", ",_", "ctypes_", "._", "byref_", "(_", "state", "IO", "in_", ")_", ",_", "update", "IO_", ",_", "led", "On_", ",_", "num", "Channels_", ",_", "ctypes_", "._", "byref_", "(_", "channel", "s", "Array_", ")_", ",_", "ctypes_", "._", "byref_", "(_", "gains", "Array_", ")_", ",_", "disable", "Cal", "_", ",_", "ctypes_", "._", "byref_", "(_", "over", "Volt", "age_", ")_", ",_", "ctypes_", "._", "byref_", "(_", "voltage", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ecode", "_", "!=_", "0_", ":_", "raise_", "U1", "2E", "xcept", "ion_", "(_", "ecode", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "idn", "um", "\"_", ":_", "id", "Num_", "._", "value_", ",_", "\"", "state", "IO", "\"_", ":_", "state", "IO", "in_", "._", "value_", ",_", "\"", "over", "Volt", "age", "\"_", ":_", "over", "Volt", "age_", "._", "value_", ",_", "\"", "voltage", "s", "\"_", ":_", "voltage", "s_", "[_", "0_", ":_", "num", "Channels_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "U1", "2_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ai", "Bur", "st_", "(_", "self_", ",_", "num", "Channels_", ",_", "channels_", ",_", "scan", "Rate_", ",_", "num", "Sca", "ns_", ",_", "id", "Num_", "=_", "None_", ",_", "demo_", "=_", "0_", ",_", "state", "IO", "in_", "=_", "0_", ",_", "update", "IO_", "=_", "0_", ",_", "led", "On_", "=_", "0_", ",_", "gains", "_", "=_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "disable", "Cal", "_", "=_", "0_", ",_", "trigger", "IO_", "=_", "0_", ",_", "trigger", "State_", "=_", "0_", ",_", "timeout_", "=_", "1_", ",_", "transfer", "Mode_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Name", ":", " ", "U1", "2", ".", "ai", "Bur", "st", "(", "num", "Chan", "nels", ",", " ", "channel", "s", ",", " ", "scan", "Rat", "e", ",", " ", "num", "Sca", "ns", ",", " ", "id", "Num", "=", "Non", "e", ",", " ", "demo", "=", "0", ",", " ", "state", "IO", "in", "=[", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", "],", " ", "update", "IO", "=", "0", ",", " ", "led", "On", "=", "0", ",", " ", "gains", "=[", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", "],", " ", "disable", "Cal", "=", "0", ",", " ", "trigger", "IO", "=", "0", ",", " ", "trigger", "State", "=", "0", ",", " ", "timeo", "ut", "=", "1", ",", " ", "transfer", "Mode", "=", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", " ", "See", " ", "section", " ", "4.7", " ", "of", " ", "the", " ", "User", "'", "s", " ", "Guide", "\\", "10", ";", " ", " ", " ", " ", "Des", "c", ":", " ", "Read", "s", " ", "a", " ", "specified", " ", "number", " ", "of", " ", "scans", " ", "(", "up", " ", "to", " ", "409", "6", ")", " ", "at", " ", "a", " ", "specified", " ", "scan", " ", "rate", " ", "(", "up", " ", "to", " ", "819", "2", " ", "H", "z", ")", " ", "from", " ", "1", ",", "2", ",", " ", "or", " ", "4", " ", "analog", " ", "inputs", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dev", " ", "=", " ", "U1", "2", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dev", ".", "ai", "Bur", "st", "(", "1", ",", " ", "[", "0", "],", " ", "400", ",", " ", "10", ")", "\\", "10", ";", " ", " ", " ", " ", "{", "'", "over", "Volt", "age", "':", " ", "0", ",", " ", "'", "scan", "Rat", "e", "':", " ", "400", ".0", ",", " ", "'", "state", "IO", "out", "':", " ", "<", "u1", "2", ".", "c\\u", "long", "\\u", "Array", "\\u", "409", "6", " ", "object", " ", "at", " ", "0x00", "DB", "4", "BC", "0", ">", ",", " ", "'", "idn", "um", "':", " ", "1", ",", " ", "'", "voltage", "s", "':", " ", "<", "u1", "2", ".", "c\\u", "float", "\\u", "Array", "\\u", "409", "6", "\\u", "Array", "\\u", "4", " ", "object", " ", "at", " ", "0x00", "DB", "4", "B", "7", "0", ">}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "id", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "id", "Num_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id", "Num_", "=_", "self_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "id", "Num_", "=_", "ctypes_", "._", "c\\u", "long_", "(_", "id", "Num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "list", " ", "sizes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "channels_", ")_", "<_", "num", "Channels_", ":_", "raise_", "Value", "Error_", "(_", "\"", "channel", "s", " ", "must", " ", "have", " ", "atl", "east", " ", "num", "Chan", "nels", " ", "element", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "gains", "_", ")_", "<_", "num", "Channels_", ":_", "raise_", "Value", "Error_", "(_", "\"", "gains", " ", "must", " ", "have", " ", "atl", "east", " ", "num", "Chan", "nels", " ", "element", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "lists", " ", "to", " ", "arrays", " ", "and", " ", "create", " ", "other", " ", "ctypes_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "s", "Array_", "=_", "list", "To", "CA", "rray_", "(_", "channels_", ",_", "ctypes_", "._", "c\\u", "long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gains", "Array_", "=_", "list", "To", "CA", "rray_", "(_", "gains", "_", ",_", "ctypes_", "._", "c\\u", "long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scan", "Rate_", "=_", "ctypes_", "._", "c\\u", "float_", "(_", "scan", "Rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point", "er", "Array_", "=_", "(_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", "*_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arr", "409", "6", "\\u", "type_", "=_", "ctypes_", "._", "c\\u", "float_", "*_", "4096_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voltage", "s", "\\u", "type_", "=_", "arr", "409", "6", "\\u", "type_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voltage", "s_", "=_", "voltage", "s", "\\u", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state", "IO", "out_", "=_", "(_", "ctypes_", "._", "c\\u", "long_", "*_", "4096_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "Volt", "age_", "=_", "ctypes_", "._", "c\\u", "long_", "(_", "999_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ecode", "_", "=_", "static", "Lib_", "._", "AI", "Bur", "st_", "(_", "ctypes_", "._", "byref_", "(_", "id", "Num_", ")_", ",_", "demo_", ",_", "state", "IO", "in_", ",_", "update", "IO_", ",_", "led", "On_", ",_", "num", "Channels_", ",_", "ctypes_", "._", "byref_", "(_", "channel", "s", "Array_", ")_", ",_", "ctypes_", "._", "byref_", "(_", "gains", "Array_", ")_", ",_", "ctypes_", "._", "byref_", "(_", "scan", "Rate_", ")_", ",_", "disable", "Cal", "_", ",_", "trigger", "IO_", ",_", "trigger", "State_", ",_", "num", "Sca", "ns_", ",_", "timeout_", ",_", "ctypes_", "._", "byref_", "(_", "voltage", "s_", ")_", ",_", "ctypes_", "._", "byref_", "(_", "state", "IO", "out_", ")_", ",_", "ctypes_", "._", "byref_", "(_", "over", "Volt", "age_", ")_", ",_", "transfer", "Mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ecode", "_", "!=_", "0_", ":_", "raise_", "U1", "2E", "xcept", "ion_", "(_", "ecode", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "idn", "um", "\"_", ":_", "id", "Num_", "._", "value_", ",_", "\"", "scan", "Rat", "e", "\"_", ":_", "scan", "Rate_", "._", "value_", ",_", "\"", "voltage", "s", "\"_", ":_", "voltage", "s_", ",_", "\"", "state", "IO", "out", "\"_", ":_", "state", "IO", "out_", ",_", "\"", "over", "Volt", "age", "\"_", ":_", "over", "Volt", "age_", "._", "value_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
datafolklabs/boss/boss/cli/template.py
[ { "content": " def _inject_or_pass(self, path):\n if 'excludes' in self.config.keys():\n for pattern in self.config['excludes']:\n if re.match(pattern, path):\n self.app.log.debug(\n \"not doing injections for excluded %s\" % path\n )\n return False\n return self._inject(path)\n return True", "metadata": "root.TemplateManager._inject_or_pass", "header": "['class', 'TemplateManager', '(', 'object', ')', ':', '___EOS___']", "index": 215 } ]
[ { "span": "return True", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Templa", "te", "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_", "\\u", "inject", "\\u", "or", "\\u", "pass_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "excludes", "'_", "in_", "self_", "._", "config_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pattern_", "in_", "self_", "._", "config_", "[_", "'", "excludes", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "match_", "(_", "pattern_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "not", " ", "doi", "ng", " ", "injection", "s", " ", "for", " ", "exclu", "ded", " ", "%", "s", "\"_", "%_", "path_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\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_", "self_", "._", "\\u", "inject_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2 ]
Except block handles 'BaseException'
RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/util/compat.py
[ { "content": " @contextmanager\n def nested(*managers):\n exits = []\n vars = []\n exc = (None, None, None)\n try:\n for mgr in managers:\n exit = mgr.__exit__\n enter = mgr.__enter__\n vars.append(enter())\n exits.append(exit)\n yield vars\n except:\n exc = sys.exc_info()\n finally:\n while exits:\n exit = exits.pop()\n try:\n if exit(*exc):\n exc = (None, None, None)\n except:\n exc = sys.exc_info()\n if exc != (None, None, None):\n reraise(exc[0], exc[1], exc[2])", "metadata": "root.nested", "header": "['module', '___EOS___']", "index": 238 } ]
[ { "span": "except:", "start_line": 250, "start_column": 8, "end_line": 250, "end_column": 15 }, { "span": "except:", "start_line": 258, "start_column": 16, "end_line": 258, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "nested_", "(_", "*_", "managers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exits", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc_", "=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "mgr_", "in_", "managers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "=_", "mgr_", "._", "\\u\\u", "exit\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enter_", "=_", "mgr_", "._", "\\u\\u", "enter\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "._", "append_", "(_", "enter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exits", "_", "._", "append_", "(_", "exit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\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 ", " _", "while_", "exits", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "=_", "exits", "_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "exit_", "(_", "*_", "exc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exc_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exc_", "!=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reraise", "_", "(_", "exc_", "[_", "0_", "]_", ",_", "exc_", "[_", "1_", "]_", ",_", "exc_", "[_", "2_", "]_", ")_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
`__init__` method calls overridden method
google/grr/grr/lib/rdfvalue.py
[ { "content": "class RDFValue(object):\n \"\"\"Baseclass for values.\n\n RDFValues are serialized to and from the data store.\n \"\"\"\n __metaclass__ = RDFValueMetaclass\n\n # This is how the attribute will be serialized to the data store. It must\n # indicate both the type emitted by SerializeToDataStore() and expected by\n # ParseFromDataStore()\n data_store_type = \"bytes\"\n\n # URL pointing to a help page about this value type.\n context_help_url = None\n\n _age = 0\n\n # Mark as dirty each time we modify this object.\n dirty = False\n\n # If this value was created as part of an AFF4 attribute, the attribute is\n # assigned here.\n attribute_instance = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # The operators this type supports in the query language\n operators = dict(contains=(1, \"ContainsMatch\"))", "metadata": "root.RDFValue", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def __init__(self, initializer=None, age=None):\n \"\"\"Constructor must be able to take no args.\n\n Args:\n initializer: Optional parameter to construct from.\n age: The age of this entry as an RDFDatetime. If not provided, create a\n new instance.\n\n Raises:\n InitializeError: if we can not be initialized from this parameter.\n \"\"\"\n # Default timestamp is now.\n if age is None:\n age = RDFDatetime(age=0)\n\n self._age = age\n\n # Allow an RDFValue to be initialized from an identical RDFValue.\n if initializer.__class__ == self.__class__:\n self.ParseFromString(initializer.SerializeToString())\n\n elif initializer is not None:\n self.ParseFromString(initializer)", "metadata": "root.RDFValue.__init__", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def Copy(self):\n \"\"\"Make a new copy of this RDFValue.\"\"\"\n return self.__class__(initializer=self.SerializeToString())", "metadata": "root.RDFValue.Copy", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 119 }, { "content": " def __copy__(self):\n return self.Copy()", "metadata": "root.RDFValue.__copy__", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": " @property\n def age(self):\n if self._age.__class__ is not RDFDatetime:\n self._age = RDFDatetime(self._age, age=0)\n\n return self._age", "metadata": "root.RDFValue.age", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": " @age.setter\n def age(self, value):\n \"\"\"When assigning to this attribute it must be an RDFDatetime.\"\"\"\n self._age = RDFDatetime(value, age=0)", "metadata": "root.RDFValue.age", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 133 }, { "content": " def ParseFromDataStore(self, data_store_obj):\n \"\"\"Serialize from an object read from the datastore.\"\"\"\n return self.ParseFromString(data_store_obj)", "metadata": "root.RDFValue.ParseFromDataStore", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 138 }, { "content": " @abc.abstractmethod\n def ParseFromString(self, string):\n \"\"\"Given a string, parse ourselves from it.\"\"\"\n pass", "metadata": "root.RDFValue.ParseFromString", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def SerializeToDataStore(self):\n \"\"\"Serialize to a datastore compatible form.\"\"\"\n return self.SerializeToString()", "metadata": "root.RDFValue.SerializeToDataStore", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 147 }, { "content": " @abc.abstractmethod\n def SerializeToString(self):\n \"\"\"Serialize into a string which can be parsed using ParseFromString.\"\"\"", "metadata": "root.RDFValue.SerializeToString", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 151 }, { "content": " def __getstate__(self):\n \"\"\"Support the pickle protocol.\"\"\"\n # __pickled_rdfvalue is used to mark RDFValues pickled via the new way.\n return dict(__pickled_rdfvalue=True,\n age=int(self.age),\n data=self.SerializeToString())", "metadata": "root.RDFValue.__getstate__", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def __setstate__(self, data):\n \"\"\"Support the pickle protocol.\"\"\"\n if \"__pickled_rdfvalue\" in data:\n self.ParseFromString(data[\"data\"])\n self.age = RDFDatetime(data[\"age\"])\n else:\n self.__dict__ = data", "metadata": "root.RDFValue.__setstate__", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def AsProto(self):\n \"\"\"Serialize into an RDFValue protobuf.\"\"\"\n return jobs_pb2.EmbeddedRDFValue(age=int(self.age),\n name=self.__class__.__name__,\n data=self.SerializeToString())", "metadata": "root.RDFValue.AsProto", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 170 }, { "content": " def __iter__(self):\n \"\"\"This allows every RDFValue to be iterated over.\"\"\"\n yield self", "metadata": "root.RDFValue.__iter__", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 176 }, { "content": " def __hash__(self):\n return hash(self.SerializeToString())", "metadata": "root.RDFValue.__hash__", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 180 }, { "content": " def Summary(self):\n \"\"\"Return a summary representation of the object.\"\"\"\n return str(self)", "metadata": "root.RDFValue.Summary", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 183 }, { "content": " @classmethod\n def Fields(cls):\n \"\"\"Return a list of fields which can be queried from this value.\"\"\"\n return []", "metadata": "root.RDFValue.Fields", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 187 }, { "content": " @staticmethod\n def ContainsMatch(attribute, filter_implemention, regex):\n return filter_implemention.PredicateContainsFilter(attribute, regex)", "metadata": "root.RDFValue.ContainsMatch", "header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": "class RDFBytes(RDFValue):\n \"\"\"An attribute which holds bytes.\"\"\"\n data_store_type = \"bytes\"\n\n _value = \"\"\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.RDFBytes", "header": "['module', '___EOS___']", "index": 200 }, { "content": " def ParseFromString(self, string):\n # TODO(user): this needs some more test coverage, particularly around\n # submitting unicode strings and byte literals in the UI forms.\n if isinstance(string, unicode):\n self._value = utils.SmartStr(string)\n else:\n self._value = string", "metadata": "root.RDFBytes.ParseFromString", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 206 }, { "content": " def SerializeToString(self):\n return self._value", "metadata": "root.RDFBytes.SerializeToString", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 214 }, { "content": " def __str__(self):\n return utils.SmartStr(self._value)", "metadata": "root.RDFBytes.__str__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 217 }, { "content": " def __lt__(self, other):\n if isinstance(other, self.__class__):\n return self._value < other._value # pylint: disable=protected-access\n else:\n return self._value < other", "metadata": "root.RDFBytes.__lt__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 220 }, { "content": " def __gt__(self, other):\n if isinstance(other, self.__class__):\n return self._value > other._value # pylint: disable=protected-access\n else:\n return self._value > other", "metadata": "root.RDFBytes.__gt__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 226 }, { "content": " def __eq__(self, other):\n if isinstance(other, self.__class__):\n return self._value == other._value # pylint: disable=protected-access\n else:\n return self._value == other", "metadata": "root.RDFBytes.__eq__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 232 }, { "content": " def __ne__(self, other):\n return not self.__eq__(other)", "metadata": "root.RDFBytes.__ne__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 238 }, { "content": " def __hash__(self):\n return hash(self._value)", "metadata": "root.RDFBytes.__hash__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 241 }, { "content": " def __bool__(self):\n return bool(self._value)", "metadata": "root.RDFBytes.__bool__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 244 }, { "content": " def __nonzero__(self):\n return bool(self._value)", "metadata": "root.RDFBytes.__nonzero__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 247 }, { "content": " def __len__(self):\n return len(self._value)", "metadata": "root.RDFBytes.__len__", "header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 250 }, { "content": "class RDFZippedBytes(RDFBytes):\n \"\"\"Zipped bytes sequence.\"\"\"\n", "metadata": "root.RDFZippedBytes", "header": "['module', '___EOS___']", "index": 254 }, { "content": " def Uncompress(self):\n if self:\n return zlib.decompress(self._value)\n else:\n return \"\"", "metadata": "root.RDFZippedBytes.Uncompress", "header": "['class', 'RDFZippedBytes', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 257 }, { "content": "class RDFString(RDFBytes):\n \"\"\"Represent a simple string.\"\"\"\n\n data_store_type = \"string\"\n\n _value = u\"\"\n\n\n operators = RDFValue.operators.copy()\n operators[\"matches\"] = (1, \"ContainsMatch\")\n operators[\"=\"] = (1, \"ContainsMatch\")\n operators[\"startswith\"] = (1, \"Startswith\")\n\n\n\n\n\n\n", "metadata": "root.RDFString", "header": "['module', '___EOS___']", "index": 264 }, { "content": " @staticmethod\n def Startswith(attribute, filter_implemention, string):\n return filter_implemention.PredicateContainsFilter(\n attribute, \"^\" + utils.EscapeRegex(string))", "metadata": "root.RDFString.Startswith", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 271 }, { "content": " def format(self, *args, **kwargs): # pylint: disable=invalid-name\n return self._value.format(*args, **kwargs)", "metadata": "root.RDFString.format", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 281 }, { "content": " def split(self, *args, **kwargs): # pylint: disable=invalid-name\n return self._value.split(*args, **kwargs)", "metadata": "root.RDFString.split", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 284 }, { "content": " def __unicode__(self):\n return utils.SmartUnicode(self._value)", "metadata": "root.RDFString.__unicode__", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 287 }, { "content": " def __getitem__(self, value):\n return self._value.__getitem__(value)", "metadata": "root.RDFString.__getitem__", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 290 }, { "content": " def ParseFromString(self, string):\n # This handles the cases when we're initialized from Unicode strings.\n self._value = utils.SmartStr(string)", "metadata": "root.RDFString.ParseFromString", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 293 }, { "content": " def SerializeToString(self):\n return utils.SmartStr(self._value)", "metadata": "root.RDFString.SerializeToString", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 297 }, { "content": " def SerializeToDataStore(self):\n return utils.SmartUnicode(self._value)", "metadata": "root.RDFString.SerializeToDataStore", "header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 300 }, { "content": "class HashDigest(RDFBytes):\n \"\"\"Binary hash digest with hex string representation.\"\"\"\n\n data_store_type = \"bytes\"\n\n\n", "metadata": "root.HashDigest", "header": "['module', '___EOS___']", "index": 304 }, { "content": " def __str__(self):\n return self._value.encode(\"hex\")", "metadata": "root.HashDigest.__str__", "header": "['class', 'HashDigest', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 309 }, { "content": " def __eq__(self, other):\n return (self._value == utils.SmartStr(other) or\n self._value.encode(\"hex\") == other)", "metadata": "root.HashDigest.__eq__", "header": "['class', 'HashDigest', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 312 }, { "content": " def __ne__(self, other):\n return not self.__eq__(other)", "metadata": "root.HashDigest.__ne__", "header": "['class', 'HashDigest', '(', 'RDFBytes', ')', ':', '___EOS___']", "index": 316 }, { "content": "@functools.total_ordering\nclass RDFInteger(RDFString):\n \"\"\"Represent an integer.\"\"\"\n\n data_store_type = \"integer\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n operators = {\"<\": (1, \"LessThan\"),\n \">\": (1, \"GreaterThan\"),\n \"=\": (1, \"Equal\")}", "metadata": "root.RDFInteger", "header": "['module', '___EOS___']", "index": 320 }, { "content": " @staticmethod\n def IsNumeric(value):\n return isinstance(value, (int, long, float, RDFInteger))", "metadata": "root.RDFInteger.IsNumeric", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 326 }, { "content": " def __init__(self, initializer=None, age=None):\n super(RDFInteger, self).__init__(initializer=initializer, age=age)\n if initializer is None:\n self._value = 0\n else:\n self.ParseFromString(initializer)", "metadata": "root.RDFInteger.__init__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 330 }, { "content": " def ParseFromString(self, string):\n self._value = 0\n if string:\n try:\n self._value = int(string)\n except TypeError as e:\n raise DecodeError(e)", "metadata": "root.RDFInteger.ParseFromString", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 337 }, { "content": " def SerializeToDataStore(self):\n \"\"\"Use varint to store the integer.\"\"\"\n return int(self._value)", "metadata": "root.RDFInteger.SerializeToDataStore", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 345 }, { "content": " def Set(self, value):\n if isinstance(value, (long, int)):\n self._value = value\n else:\n self.ParseFromString(value)", "metadata": "root.RDFInteger.Set", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 349 }, { "content": " def __long__(self):\n return long(self._value)", "metadata": "root.RDFInteger.__long__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 355 }, { "content": " def __int__(self):\n return int(self._value)", "metadata": "root.RDFInteger.__int__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 358 }, { "content": " def __float__(self):\n return float(self._value)", "metadata": "root.RDFInteger.__float__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 361 }, { "content": " def __index__(self):\n return self._value", "metadata": "root.RDFInteger.__index__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 364 }, { "content": " def __eq__(self, other):\n return self._value == other", "metadata": "root.RDFInteger.__eq__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 367 }, { "content": " def __lt__(self, other):\n return self._value < other", "metadata": "root.RDFInteger.__lt__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 370 }, { "content": " def __and__(self, other):\n return self._value & other", "metadata": "root.RDFInteger.__and__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 373 }, { "content": " def __rand__(self, other):\n return self._value & other", "metadata": "root.RDFInteger.__rand__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 376 }, { "content": " def __iand__(self, other):\n self._value &= other\n return self", "metadata": "root.RDFInteger.__iand__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 379 }, { "content": " def __or__(self, other):\n return self._value | other", "metadata": "root.RDFInteger.__or__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 383 }, { "content": " def __ror__(self, other):\n return self._value | other", "metadata": "root.RDFInteger.__ror__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 386 }, { "content": " def __ior__(self, other):\n self._value |= other\n return self", "metadata": "root.RDFInteger.__ior__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 389 }, { "content": " def __add__(self, other):\n return self._value + other", "metadata": "root.RDFInteger.__add__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 393 }, { "content": " def __radd__(self, other):\n return self._value + other", "metadata": "root.RDFInteger.__radd__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 396 }, { "content": " def __iadd__(self, other):\n self._value += other\n return self", "metadata": "root.RDFInteger.__iadd__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 399 }, { "content": " def __sub__(self, other):\n return self._value - other", "metadata": "root.RDFInteger.__sub__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 403 }, { "content": " def __rsub__(self, other):\n return other - self._value", "metadata": "root.RDFInteger.__rsub__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 406 }, { "content": " def __isub__(self, other):\n self._value -= other\n return self", "metadata": "root.RDFInteger.__isub__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 409 }, { "content": " def __mul__(self, other):\n return self._value * other", "metadata": "root.RDFInteger.__mul__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 413 }, { "content": " def __rmul__(self, other):\n return self._value * other", "metadata": "root.RDFInteger.__rmul__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 416 }, { "content": " def __div__(self, other):\n return self._value / other", "metadata": "root.RDFInteger.__div__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 419 }, { "content": " def __rdiv__(self, other):\n return other / self._value", "metadata": "root.RDFInteger.__rdiv__", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 422 }, { "content": " @staticmethod\n def LessThan(attribute, filter_implemention, value):\n return filter_implemention.PredicateLessThanFilter(attribute, long(value))", "metadata": "root.RDFInteger.LessThan", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 425 }, { "content": " @staticmethod\n def GreaterThan(attribute, filter_implemention, value):\n return filter_implemention.PredicateGreaterThanFilter(\n attribute, long(value))", "metadata": "root.RDFInteger.GreaterThan", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 429 }, { "content": " @staticmethod\n def Equal(attribute, filter_implemention, value):\n return filter_implemention.PredicateNumericEqualFilter(\n attribute, long(value))", "metadata": "root.RDFInteger.Equal", "header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']", "index": 434 }, { "content": "class RDFBool(RDFInteger):\n \"\"\"Boolean value.\"\"\"\n data_store_type = \"unsigned_integer\"", "metadata": "root.RDFBool", "header": "['module', '___EOS___']", "index": 444 }, { "content": "class RDFDatetime(RDFInteger):\n \"\"\"A date and time internally stored in MICROSECONDS.\"\"\"\n converter = MICROSECONDS\n data_store_type = \"unsigned_integer\"\n\n # A value of 0 means this object is not initialized.\n _value = 0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n operators = {\"<\": (1, \"LessThan\"),\n \">\": (1, \"GreaterThan\"),\n \"<=\": (1, \"LessThanEq\"),\n \">=\": (1, \"GreaterThanEq\")}", "metadata": "root.RDFDatetime", "header": "['module', '___EOS___']", "index": 449 }, { "content": " def __init__(self, initializer=None, age=None):\n super(RDFDatetime, self).__init__(None, age)\n\n if isinstance(initializer, RDFInteger):\n self._value = initializer._value # pylint: disable=protected-access\n\n elif isinstance(initializer, (int, long, float)):\n self._value = int(initializer)\n\n elif isinstance(initializer, datetime.datetime):\n seconds = calendar.timegm(initializer.utctimetuple())\n self._value = (seconds * self.converter) + initializer.microsecond\n\n elif isinstance(initializer, basestring):\n try:\n # Can be just a serialized integer.\n self._value = int(initializer)\n except ValueError:\n if initializer:\n # Try to parse from human readable string.\n self.ParseFromHumanReadable(initializer)\n\n elif initializer is not None:\n raise InitializeError(\"Unknown initializer for RDFDateTime: %s.\" %\n type(initializer))", "metadata": "root.RDFDatetime.__init__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 457 }, { "content": " def Now(self):\n self._value = int(time.time() * self.converter)\n return self", "metadata": "root.RDFDatetime.Now", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 483 }, { "content": " def Format(self, fmt):\n \"\"\"Return the value as a string formatted as per strftime semantics.\"\"\"\n return time.strftime(fmt, time.gmtime(self._value / self.converter))", "metadata": "root.RDFDatetime.Format", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 487 }, { "content": " def __str__(self):\n \"\"\"Return the date in human readable (UTC).\"\"\"\n return self.Format(\"%Y-%m-%d %H:%M:%S\")", "metadata": "root.RDFDatetime.__str__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 491 }, { "content": " def __unicode__(self):\n return utils.SmartUnicode(str(self))", "metadata": "root.RDFDatetime.__unicode__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 495 }, { "content": " def AsDatetime(self):\n \"\"\"Return the time as a python datetime object.\"\"\"\n return datetime.datetime.utcfromtimestamp(self._value / self.converter)", "metadata": "root.RDFDatetime.AsDatetime", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 498 }, { "content": " def AsSecondsFromEpoch(self):\n return self._value / self.converter", "metadata": "root.RDFDatetime.AsSecondsFromEpoch", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 502 }, { "content": " def AsMicroSecondsFromEpoch(self):\n return self._value", "metadata": "root.RDFDatetime.AsMicroSecondsFromEpoch", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 505 }, { "content": " def FromSecondsFromEpoch(self, value):\n self._value = value * self.converter\n\n return self", "metadata": "root.RDFDatetime.FromSecondsFromEpoch", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 508 }, { "content": " def ParseFromHumanReadable(self, string, eoy=False):\n self._value = self._ParseFromHumanReadable(string, eoy=eoy)\n return self", "metadata": "root.RDFDatetime.ParseFromHumanReadable", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 513 }, { "content": " def __add__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n return self.__class__(self._value + other * self.converter)\n\n return NotImplemented", "metadata": "root.RDFDatetime.__add__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 517 }, { "content": " def __iadd__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n self._value += other * self.converter\n return self\n\n return NotImplemented", "metadata": "root.RDFDatetime.__iadd__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 524 }, { "content": " def __mul__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n return self.__class__(self._value * other)\n\n return NotImplemented", "metadata": "root.RDFDatetime.__mul__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 532 }, { "content": " def __rmul__(self, other):\n return self.__mul__(other)", "metadata": "root.RDFDatetime.__rmul__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 538 }, { "content": " def __sub__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n return self.__class__(self._value - other * self.converter)\n\n if isinstance(other, RDFDatetime):\n return Duration(self.AsSecondsFromEpoch() - other.AsSecondsFromEpoch())\n\n return NotImplemented", "metadata": "root.RDFDatetime.__sub__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 541 }, { "content": " def __isub__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n self._value -= other * self.converter\n return self\n\n return NotImplemented", "metadata": "root.RDFDatetime.__isub__", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 551 }, { "content": " @classmethod\n def _ParseFromHumanReadable(cls, string, eoy=False):\n \"\"\"Parse a human readable string of a timestamp (in local time).\n\n Args:\n string: The string to parse.\n eoy: If True, sets the default value to the end of the year.\n Usually this method returns a timestamp where each field that is\n not present in the given string is filled with values from the date\n January 1st of the current year, midnight. Sometimes it makes more\n sense to compare against the end of a period so if eoy is set, the\n default values are copied from the 31st of December of the current\n year, 23:59h.\n\n Returns:\n The parsed timestamp.\n \"\"\"\n # By default assume the time is given in UTC.\n if eoy:\n default = datetime.datetime(time.gmtime().tm_year, 12, 31, 23, 59,\n tzinfo=dateutil.tz.tzutc())\n else:\n default = datetime.datetime(time.gmtime().tm_year, 1, 1, 0, 0,\n tzinfo=dateutil.tz.tzutc())\n\n timestamp = parser.parse(string, default=default)\n\n return calendar.timegm(timestamp.utctimetuple()) * cls.converter", "metadata": "root.RDFDatetime._ParseFromHumanReadable", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 559 }, { "content": " @classmethod\n def LessThanEq(cls, attribute, filter_implemention, value):\n return filter_implemention.PredicateLesserEqualFilter(\n attribute, cls._ParseFromHumanReadable(value, eoy=True))", "metadata": "root.RDFDatetime.LessThanEq", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 588 }, { "content": " @classmethod\n def LessThan(cls, attribute, filter_implemention, value):\n \"\"\"For dates we want to recognize a variety of values.\"\"\"\n return filter_implemention.PredicateLesserEqualFilter(\n attribute, cls._ParseFromHumanReadable(value))", "metadata": "root.RDFDatetime.LessThan", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 593 }, { "content": " @classmethod\n def GreaterThanEq(cls, attribute, filter_implemention, value):\n return filter_implemention.PredicateGreaterEqualFilter(\n attribute, cls._ParseFromHumanReadable(value))", "metadata": "root.RDFDatetime.GreaterThanEq", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 599 }, { "content": " @classmethod\n def GreaterThan(cls, attribute, filter_implemention, value):\n return filter_implemention.PredicateGreaterEqualFilter(\n attribute, cls._ParseFromHumanReadable(value, eoy=True))", "metadata": "root.RDFDatetime.GreaterThan", "header": "['class', 'RDFDatetime', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 604 }, { "content": "class RDFDatetimeSeconds(RDFDatetime):\n \"\"\"A DateTime class which is stored in whole seconds.\"\"\"\n converter = 1", "metadata": "root.RDFDatetimeSeconds", "header": "['module', '___EOS___']", "index": 615 }, { "content": "class Duration(RDFInteger):\n \"\"\"Duration value stored in seconds internally.\"\"\"\n data_store_type = \"unsigned_integer\"\n\n DIVIDERS = collections.OrderedDict((\n (\"w\", 60 * 60 * 24 * 7),\n (\"d\", 60 * 60 * 24),\n (\"h\", 60 * 60),\n (\"m\", 60),\n (\"s\", 1)))\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Duration", "header": "['module', '___EOS___']", "index": 620 }, { "content": " def __init__(self, initializer=None, age=None):\n super(Duration, self).__init__(None, age)\n if isinstance(initializer, Duration):\n self._value = initializer._value # pylint: disable=protected-access\n elif isinstance(initializer, basestring):\n self.ParseFromHumanReadable(initializer)\n elif isinstance(initializer, (int, long, float)):\n self._value = initializer\n elif isinstance(initializer, RDFInteger):\n self._value = int(initializer)\n elif initializer is None:\n self._value = 0\n else:\n raise InitializeError(\"Unknown initializer for Duration: %s.\" %\n type(initializer))", "metadata": "root.Duration.__init__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 631 }, { "content": " def Validate(self, value, **_):\n self.ParseFromString(value)", "metadata": "root.Duration.Validate", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 647 }, { "content": " def ParseFromString(self, string):\n self.ParseFromHumanReadable(string)", "metadata": "root.Duration.ParseFromString", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 650 }, { "content": " def SerializeToString(self):\n return str(self)", "metadata": "root.Duration.SerializeToString", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 653 }, { "content": " @property\n def seconds(self):\n return self._value", "metadata": "root.Duration.seconds", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 656 }, { "content": " @property\n def microseconds(self):\n return self._value * 1000000", "metadata": "root.Duration.microseconds", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 660 }, { "content": " def __str__(self):\n time_secs = self._value\n for label, divider in self.DIVIDERS.items():\n if time_secs % divider == 0:\n return \"%d%s\" % (time_secs / divider, label)", "metadata": "root.Duration.__str__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 664 }, { "content": " def __unicode__(self):\n return utils.SmartUnicode(str(self))", "metadata": "root.Duration.__unicode__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 670 }, { "content": " def __add__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n return self.__class__(self._value + other)\n\n return NotImplemented", "metadata": "root.Duration.__add__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 673 }, { "content": " def __iadd__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n self._value += other\n return self\n\n return NotImplemented", "metadata": "root.Duration.__iadd__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 680 }, { "content": " def __mul__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n return self.__class__(self._value * other)\n\n return NotImplemented", "metadata": "root.Duration.__mul__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 688 }, { "content": " def __rmul__(self, other):\n return self.__mul__(other)", "metadata": "root.Duration.__rmul__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 694 }, { "content": " def __sub__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n return self.__class__(self._value - other)\n\n return NotImplemented", "metadata": "root.Duration.__sub__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 697 }, { "content": " def __isub__(self, other):\n if isinstance(other, (int, long, float, Duration)):\n # Assume other is in seconds\n self._value -= other\n return self\n\n return NotImplemented", "metadata": "root.Duration.__isub__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 704 }, { "content": " def __abs__(self):\n return Duration(abs(self._value))", "metadata": "root.Duration.__abs__", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 712 }, { "content": " def Expiry(self, base_time=None):\n if base_time is None:\n base_time = RDFDatetime().Now()\n else:\n base_time = base_time.Copy()\n\n base_time_sec = base_time.AsSecondsFromEpoch()\n\n return base_time.FromSecondsFromEpoch(base_time_sec + self._value)", "metadata": "root.Duration.Expiry", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 715 }, { "content": " def ParseFromHumanReadable(self, timestring):\n \"\"\"Parse a human readable string of a duration.\n\n Args:\n timestring: The string to parse.\n \"\"\"\n if not timestring:\n return\n\n orig_string = timestring\n\n multiplicator = 1\n\n if timestring[-1].isdigit():\n pass\n else:\n try:\n multiplicator = self.DIVIDERS[timestring[-1]]\n except KeyError:\n raise RuntimeError(\"Invalid duration multiplicator: '%s' ('%s').\" %\n (timestring[-1], orig_string))\n\n timestring = timestring[:-1]\n\n try:\n self._value = int(timestring) * multiplicator\n except ValueError:\n raise InitializeError(\"Could not parse expiration time '%s'.\" %\n orig_string)", "metadata": "root.Duration.ParseFromHumanReadable", "header": "['class', 'Duration', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 725 }, { "content": "class ByteSize(RDFInteger):\n \"\"\"A size for bytes allowing standard unit prefixes.\n\n We use the standard IEC 60027-2 A.2 and ISO/IEC 80000:\n Binary units (powers of 2): Ki, Mi, Gi\n SI units (powers of 10): k, m, g\n \"\"\"\n data_store_type = \"unsigned_integer\"\n\n DIVIDERS = dict((\n (\"\", 1),\n (\"k\", 1000),\n (\"m\", 1000 ** 2),\n (\"g\", 1000 ** 3),\n (\"ki\", 1024),\n (\"mi\", 1024 ** 2),\n (\"gi\", 1024 ** 3),\n ))\n\n REGEX = re.compile(\"^([0-9.]+)([kmgi]*)b?$\")\n\n\n", "metadata": "root.ByteSize", "header": "['module', '___EOS___']", "index": 756 }, { "content": " def __init__(self, initializer=None, age=None):\n super(ByteSize, self).__init__(None, age)\n if isinstance(initializer, ByteSize):\n self._value = initializer._value # pylint: disable=protected-access\n elif isinstance(initializer, basestring):\n self.ParseFromHumanReadable(initializer)\n elif isinstance(initializer, (int, long, float)):\n self._value = initializer\n elif isinstance(initializer, RDFInteger):\n self._value = int(initializer)\n elif initializer is None:\n self._value = 0\n else:\n raise InitializeError(\"Unknown initializer for ByteSize: %s.\" %\n type(initializer))", "metadata": "root.ByteSize.__init__", "header": "['class', 'ByteSize', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 777 }, { "content": " def __str__(self):\n size_token = \"\"\n if self._value > 1024 ** 3:\n size_token = \"Gb\"\n value = float(self._value) / 1024 ** 3\n elif self._value > 1024 ** 2:\n size_token = \"Mb\"\n value = float(self._value) / 1024 ** 2\n elif self._value > 1024:\n size_token = \"Kb\"\n value = float(self._value) / 1024\n else:\n return utils.SmartStr(self._value) + \"b\"\n\n return \"%.1f%s\" % (value, size_token)", "metadata": "root.ByteSize.__str__", "header": "['class', 'ByteSize', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 793 }, { "content": " def ParseFromHumanReadable(self, string):\n \"\"\"Parse a human readable string of a byte string.\n\n Args:\n string: The string to parse.\n\n Raises:\n DecodeError: If the string can not be parsed.\n \"\"\"\n if not string:\n return None\n\n match = self.REGEX.match(string.strip().lower())\n if not match:\n raise DecodeError(\"Unknown specification for ByteSize %s\" % string)\n\n multiplier = self.DIVIDERS.get(match.group(2))\n if not multiplier:\n raise DecodeError(\"Invalid multiplier %s\" % match.group(2))\n\n # The value may be represented as a float, but if not dont lose accuracy.\n value = match.group(1)\n if \".\" in value:\n value = float(value)\n else:\n value = long(value)\n\n self._value = int(value * multiplier)", "metadata": "root.ByteSize.ParseFromHumanReadable", "header": "['class', 'ByteSize', '(', 'RDFInteger', ')', ':', '___EOS___']", "index": 809 }, { "content": "@functools.total_ordering\nclass RDFURN(RDFValue):\n \"\"\"An object to abstract URL manipulation.\"\"\"\n\n data_store_type = \"string\"\n\n # Careful when changing this value, this is hardcoded a few times in this\n # class for performance reasons.\n scheme = \"aff4\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.RDFURN", "header": "['module', '___EOS___']", "index": 839 }, { "content": " def __init__(self, initializer=None, age=None):\n \"\"\"Constructor.\n\n Args:\n initializer: A string or another RDFURN.\n age: The age of this entry.\n Raises:\n ValueError: if no urn passed\n \"\"\"\n if isinstance(initializer, RDFURN):\n # Make a direct copy of the other object\n self._string_urn = initializer.Path()\n super(RDFURN, self).__init__(None, age)\n return\n\n if initializer is None:\n raise ValueError(\"URN cannot be None\")\n\n super(RDFURN, self).__init__(initializer=initializer, age=age)", "metadata": "root.RDFURN.__init__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 849 }, { "content": " def ParseFromString(self, initializer=None):\n \"\"\"Create RDFRUN from string.\n\n Args:\n initializer: url string\n \"\"\"\n # Strip off the aff4: prefix if necessary.\n if initializer.startswith(\"aff4:/\"):\n initializer = initializer[5:]\n\n self._string_urn = utils.NormalizePath(initializer)", "metadata": "root.RDFURN.ParseFromString", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 869 }, { "content": " def SerializeToString(self):\n return str(self)", "metadata": "root.RDFURN.SerializeToString", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 881 }, { "content": " def SerializeToDataStore(self):\n return unicode(self)", "metadata": "root.RDFURN.SerializeToDataStore", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 884 }, { "content": " def __setstate__(self, data):\n \"\"\"Support the pickle protocol.\"\"\"\n RDFValue.__setstate__(self, data)\n # NOTE: This is done for backwards compatibility with\n # old pickled RDFURNs that got pickled via default pickling mechanism and\n # have 'aff4:/' pickled as part of _string_urn as a result.\n if self._string_urn.startswith(\"aff4:/\"):\n self._string_urn = self._string_urn[5:]", "metadata": "root.RDFURN.__setstate__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 887 }, { "content": " def Dirname(self):\n return posixpath.dirname(self._string_urn)", "metadata": "root.RDFURN.Dirname", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 896 }, { "content": " def Basename(self):\n return posixpath.basename(self.Path())", "metadata": "root.RDFURN.Basename", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 899 }, { "content": " def Add(self, path, age=None):\n \"\"\"Add a relative stem to the current value and return a new RDFURN.\n\n If urn is a fully qualified URN, replace the current value with it.\n\n Args:\n path: A string containing a relative path.\n age: The age of the object. If None set to current time.\n\n Returns:\n A new RDFURN that can be chained.\n\n Raises:\n ValueError: if the path component is not a string.\n \"\"\"\n if not isinstance(path, basestring):\n raise ValueError(\"Only strings should be added to a URN.\")\n\n result = self.Copy(age)\n result.Update(path=utils.JoinPath(self._string_urn, path))\n\n return result", "metadata": "root.RDFURN.Add", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 902 }, { "content": " def Update(self, url=None, path=None):\n \"\"\"Update one of the fields.\n\n Args:\n url: An optional string containing a URL.\n path: If the path for this URN should be updated.\n \"\"\"\n if url:\n self.ParseFromString(url)\n if path:\n self._string_urn = path\n self.dirty = True", "metadata": "root.RDFURN.Update", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 925 }, { "content": " def Copy(self, age=None):\n \"\"\"Make a copy of ourselves.\"\"\"\n if age is None:\n age = int(time.time() * MICROSECONDS)\n return self.__class__(self, age=age)", "metadata": "root.RDFURN.Copy", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 938 }, { "content": " def __str__(self):\n return utils.SmartStr(\"aff4:%s\" % self._string_urn)", "metadata": "root.RDFURN.__str__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 944 }, { "content": " def __unicode__(self):\n return utils.SmartUnicode(u\"aff4:%s\" % self._string_urn)", "metadata": "root.RDFURN.__unicode__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 947 }, { "content": " def __eq__(self, other):\n if isinstance(other, basestring):\n other = self.__class__(other)\n\n elif other is None:\n return False\n\n elif not isinstance(other, RDFURN):\n return NotImplemented\n\n return self._string_urn == other.Path()", "metadata": "root.RDFURN.__eq__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 950 }, { "content": " def __ne__(self, other):\n return not self.__eq__(other)", "metadata": "root.RDFURN.__ne__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 962 }, { "content": " def __lt__(self, other):\n return self._string_urn < other", "metadata": "root.RDFURN.__lt__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 965 }, { "content": " def Path(self):\n \"\"\"Return the path of the urn.\"\"\"\n return self._string_urn", "metadata": "root.RDFURN.Path", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 968 }, { "content": " def Split(self, count=None):\n \"\"\"Returns all the path components.\n\n Args:\n count: If count is specified, the output will be exactly this many path\n components, possibly extended with the empty string. This is useful for\n tuple assignments without worrying about ValueErrors:\n\n namespace, path = urn.Split(2)\n\n Returns:\n A list of path components of this URN.\n \"\"\"\n if count:\n result = filter(None, self._string_urn.split(\"/\", count))\n while len(result) < count:\n result.append(\"\")\n\n return result\n\n else:\n return filter(None, self._string_urn.split(\"/\"))", "metadata": "root.RDFURN.Split", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 972 }, { "content": " def RelativeName(self, volume):\n \"\"\"Given a volume URN return the relative URN as a unicode string.\n\n We remove the volume prefix from our own.\n Args:\n volume: An RDFURN or fully qualified url string.\n\n Returns:\n A string of the url relative from the volume or None if our URN does not\n start with the volume prefix.\n \"\"\"\n string_url = utils.SmartUnicode(self)\n volume_url = utils.SmartUnicode(volume)\n if string_url.startswith(volume_url):\n result = string_url[len(volume_url):]\n # This must always return a relative path so we strip leading \"/\"s. The\n # result is always a unicode string.\n return result.lstrip(\"/\")\n\n return None", "metadata": "root.RDFURN.RelativeName", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 995 }, { "content": " def __repr__(self):\n return \"<%s age=%s>\" % (str(self), self.age)", "metadata": "root.RDFURN.__repr__", "header": "['class', 'RDFURN', '(', 'RDFValue', ')', ':', '___EOS___']", "index": 1016 }, { "content": "class Subject(RDFURN):\n \"\"\"A psuedo attribute representing the subject of an AFF4 object.\"\"\"\n\n\n\n\n operators = dict(matches=(1, \"ContainsMatch\"),\n contains=(1, \"ContainsMatch\"),\n startswith=(1, \"Startswith\"),\n has=(1, \"HasAttribute\"))", "metadata": "root.Subject", "header": "['module', '___EOS___']", "index": 1020 }, { "content": " @staticmethod\n def ContainsMatch(unused_attribute, filter_implemention, regex):\n return filter_implemention.SubjectContainsFilter(regex)", "metadata": "root.Subject.ContainsMatch", "header": "['class', 'Subject', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1023 }, { "content": " @staticmethod\n def Startswith(unused_attribute, filter_implemention, string):\n return filter_implemention.SubjectContainsFilter(\n \"^\" + utils.EscapeRegex(string))", "metadata": "root.Subject.Startswith", "header": "['class', 'Subject', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1027 }, { "content": " @staticmethod\n def HasAttribute(unused_attribute, filter_implemention, string):\n return filter_implemention.HasPredicateFilter(string)", "metadata": "root.Subject.HasAttribute", "header": "['class', 'Subject', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1032 }, { "content": "class SessionID(RDFURN):\n \"\"\"An rdfvalue object that represents a session_id.\"\"\"\n\n\n\n\n", "metadata": "root.SessionID", "header": "['module', '___EOS___']", "index": 1044 }, { "content": " def __init__(\n self, initializer=None, age=None, base=\"aff4:/flows\",\n queue=DEFAULT_FLOW_QUEUE, flow_name=None):\n \"\"\"Constructor.\n\n Args:\n initializer: A string or another RDFURN.\n age: The age of this entry.\n base: The base namespace this session id lives in.\n queue: The queue to use.\n flow_name: The name of this flow or its random id.\n Raises:\n InitializeError: The given URN cannot be converted to a SessionID.\n \"\"\"\n if initializer is None:\n # This SessionID is being constructed from scratch.\n if flow_name is None:\n flow_name = utils.PRNG.GetULong()\n\n if isinstance(flow_name, int):\n initializer = RDFURN(base).Add(\"%s:%X\" % (queue.Basename(), flow_name))\n else:\n initializer = RDFURN(base).Add(\"%s:%s\" % (queue.Basename(), flow_name))\n elif isinstance(initializer, RDFURN):\n try:\n self.ValidateID(initializer.Basename())\n except ValueError as e:\n raise InitializeError(\"Invalid URN for SessionID: %s, %s\" %\n (initializer, e.message))\n super(SessionID, self).__init__(initializer=initializer, age=age)", "metadata": "root.SessionID.__init__", "header": "['class', 'SessionID', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1047 }, { "content": " def Queue(self):\n return RDFURN(self.Basename().split(\":\")[0])", "metadata": "root.SessionID.Queue", "header": "['class', 'SessionID', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1078 }, { "content": " def FlowName(self):\n return self.Basename().split(\":\", 1)[1]", "metadata": "root.SessionID.FlowName", "header": "['class', 'SessionID', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1081 }, { "content": " def Add(self, path, age=None):\n # Adding to a SessionID results in a normal RDFURN.\n return RDFURN(self).Add(path, age=age)", "metadata": "root.SessionID.Add", "header": "['class', 'SessionID', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1084 }, { "content": " @classmethod\n def ValidateID(cls, id_str):\n # This check is weaker than it could be because we allow queues called\n # \"DEBUG-user1\" and IDs like \"TransferStore\". We also have to allow\n # flows session ids like H:123456:hunt.\n allowed_re = re.compile(r\"^[-0-9a-zA-Z]+:[0-9a-zA-Z]+(:[0-9a-zA-Z]+)?$\")\n if not allowed_re.match(id_str):\n raise ValueError(\"Invalid SessionID\")", "metadata": "root.SessionID.ValidateID", "header": "['class', 'SessionID', '(', 'RDFURN', ')', ':', '___EOS___']", "index": 1088 }, { "content": " def ParseFromString(self, initializer=None):\n # Old clients sometimes send bare well known flow ids.\n if not utils.SmartStr(initializer).startswith(\"aff4\"):\n initializer = \"aff4:/flows/\" + initializer\n super(FlowSessionID, self).ParseFromString(initializer)", "metadata": "root.FlowSessionID.ParseFromString", "header": "['class', 'FlowSessionID', '(', 'SessionID', ')', ':', '___NEWLINE___', '___NL___', '# TODO(user): This is code to fix some legacy issues. Remove this when all', '___NL___', '# clients are built after Dec 2014.', '___NL___', '___EOS___']", "index": 1103 } ]
[ { "span": "self.ParseFromString(initializer.SerializeToString())", "start_line": 114, "start_column": 6, "end_line": 114, "end_column": 59 }, { "span": "self.ParseFromString(initializer)", "start_line": 117, "start_column": 6, "end_line": 117, "end_column": 39 }, { "span": "self.ParseFromString(initializer)", "start_line": 335, "start_column": 6, "end_line": 335, "end_column": 39 } ]
[ { "span": "def ParseFromString(self, string):", "start_line": 143, "start_column": 2, "end_line": 143, "end_column": 36 }, { "span": "def ParseFromString(self, string):", "start_line": 206, "start_column": 2, "end_line": 206, "end_column": 36 }, { "span": "def ParseFromString(self, string):", "start_line": 293, "start_column": 2, "end_line": 293, "end_column": 36 }, { "span": "def ParseFromString(self, string):", "start_line": 337, "start_column": 2, "end_line": 337, "end_column": 36 }, { "span": "def ParseFromString(self, string):", "start_line": 650, "start_column": 2, "end_line": 650, "end_column": 36 }, { "span": "def ParseFromString(self, initializer=None):", "start_line": 869, "start_column": 2, "end_line": 869, "end_column": 46 }, { "span": "def ParseFromString(self, initializer=None):", "start_line": 1103, "start_column": 2, "end_line": 1103, "end_column": 46 } ]
1
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", "class", " ", "for", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "RDF", "Value", "s", " ", "are", " ", "serialize", "d", " ", "to", " ", "and", " ", "from", " ", "the", " ", "data", " ", "store", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "metaclass\\u\\u_", "=_", "RDF", "Value", "Meta", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "how", " ", "the", " ", "attribute", " ", "will", " ", "be", " ", "serialize", "d", " ", "to", " ", "the", " ", "data", " ", "store", ".", " ", "It", " ", "must", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indicat", "e", " ", "bot", "h", " ", "the", " ", "type", " ", "emitte", "d", " ", "by", " ", "Seriali", "ze", "To", "Data", "Stor", "e", "()", " ", "and", " ", "expected", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", "Fro", "m", "Data", "Stor", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "bytes", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "pointi", "ng", " ", "to", " ", "a", " ", "help", " ", "page", " ", "abo", "ut", " ", "this", " ", "value", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "help", "\\u", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "age_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mark", " ", "as", " ", "dir", "ty", " ", "each", " ", "time", " ", "we", " ", "modif", "y", " ", "this", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "value", " ", "was", " ", "created", " ", "as", " ", "part", " ", "of", " ", "an", " ", "AFF", "4", " ", "attribute", ",", " ", "the", " ", "attribute", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", "ed", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "attribute", "\\u", "instance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "opera", "tors", " ", "this", " ", "type", " ", "support", "s", " ", "in", " ", "the", " ", "query", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "operators_", "=_", "dict_", "(_", "contains_", "=_", "(_", "1_", ",_", "\"", "Contain", "s", "Match", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "initializer_", "=_", "None_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", " ", "must", " ", "be", " ", "able", " ", "to", " ", "take", " ", "no", " ", "args", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "initializer", ":", " ", "Optio", "nal", " ", "parameter", " ", "to", " ", "construct", " ", "from", ".", "\\", "10", ";", " ", " ", "age", ":", " ", "The", " ", "age", " ", "of", " ", "this", " ", "entry", " ", "as", " ", "an", " ", "RDF", "Date", "time", ".", " ", "If", " ", "not", " ", "provided", ",", " ", "create", " ", "a", "\\", "10", ";", " ", " ", " ", "new", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Initializ", "e", "Error", ":", " ", "if", " ", "we", " ", "can", " ", "not", " ", "be", " ", "initialize", "d", " ", "from", " ", "this", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Default", " ", "timestamp", " ", "is", " ", "now", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "age_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "age_", "=_", "RDF", "Datetime_", "(_", "age_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "age_", "=_", "age_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "an", " ", "RDF", "Value", " ", "to", " ", "be", " ", "initialize", "d", " ", "from", " ", "an", " ", "identi", "cal", " ", "RDF", "Value", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "initializer_", "._", "\\u\\u", "class\\u\\u_", "==_", "self_", "._", "\\u\\u", "class\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "initializer_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "initializer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "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_", "Copy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", " ", "a", " ", "new", " ", "copy", " ", "of", " ", "this", " ", "RDF", "Value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "initializer_", "=_", "self_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "copy", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "Copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "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_", "age_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "age_", "._", "\\u\\u", "class\\u\\u_", "is_", "not_", "RDF", "Datetime_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "age_", "=_", "RDF", "Datetime_", "(_", "self_", "._", "\\u", "age_", ",_", "age_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "age_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "age_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "age_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Whe", "n", " ", "assign", "ing", " ", "to", " ", "this", " ", "attribute", " ", "it", " ", "must", " ", "be", " ", "an", " ", "RDF", "Date", "time", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "age_", "=_", "RDF", "Datetime_", "(_", "value_", ",_", "age_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "Data", "Store_", "(_", "self_", ",_", "data\\u", "store", "\\u", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Seriali", "ze", " ", "from", " ", "an", " ", "object", " ", "read", " ", "from", " ", "the", " ", "datast", "ore", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "data\\u", "store", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "String_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "a", " ", "string", ",", " ", "parse", " ", "ours", "elv", "es", " ", "from", " ", "it", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Seriali", "ze", "To", "Data", "Store_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Seriali", "ze", " ", "to", " ", "a", " ", "datast", "ore", " ", "compatible", " ", "form", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Seriali", "ze", "To", "String_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Seriali", "ze", " ", "int", "o", " ", "a", " ", "string", " ", "whi", "ch", " ", "can", " ", "be", " ", "parsed", " ", "usi", "ng", " ", "Pars", "e", "Fro", "m", "String", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getstate", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Supp", "ort", " ", "the", " ", "pickle", " ", "protoc", "ol", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u\\u", "pickled", "\\u", "rdf", "value", " ", "is", " ", "used", " ", "to", " ", "mark", " ", "RDF", "Value", "s", " ", "pickled", " ", "via", " ", "the", " ", "new", " ", "way", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "dict_", "(_", "\\u\\u", "pickled", "\\u", "rdfvalue_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "age_", "=_", "int_", "(_", "self_", "._", "age_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Supp", "ort", " ", "the", " ", "pickle", " ", "protoc", "ol", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"\\u\\u", "pickled", "\\u", "rdf", "value", "\"_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "data_", "[_", "\"", "data", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "age_", "=_", "RDF", "Datetime_", "(_", "data_", "[_", "\"", "age", "\"_", "]_", ")_", "\\u\\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", "dict\\u\\u_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "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_", "As", "Proto_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Seriali", "ze", " ", "int", "o", " ", "an", " ", "RDF", "Value", " ", "proto", "buf", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jobs", "\\u", "pb2_", "._", "Emb", "edd", "ed", "RDF", "Value_", "(_", "age_", "=_", "int_", "(_", "self_", "._", "age_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "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 ", " _", "\"\"\"", "Thi", "s", " ", "allow", "s", " ", "every", " ", "RDF", "Value", " ", "to", " ", "be", " ", "iterate", "d", " ", "over", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "self_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Summary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "summar", "y", " ", "represent", "ation", " ", "of", " ", "the", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Fields_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "fields", " ", "whi", "ch", " ", "can", " ", "be", " ", "queried", " ", "from", " ", "this", " ", "value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Contain", "s", "Match_", "(_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "regex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Contain", "s", "Filter_", "(_", "attribute_", ",_", "regex_", ")_", "\\u\\u\\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_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "attribute", " ", "whi", "ch", " ", "hold", "s", " ", "bytes", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "bytes", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "value_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "String_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "this", " ", "need", "s", " ", "some", " ", "more", " ", "test", " ", "covera", "ge", ",", " ", "partic", "ular", "ly", " ", "around_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", "ting", " ", "unicode", " ", "string", "s", " ", "and", " ", "byte", " ", "literal", "s", " ", "in", " ", "the", " ", "UI", " ", "forms", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "string_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "utils_", "._", "Sma", "rt", "Str_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\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_", "Seriali", "ze", "To", "String_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Str_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "<_", "other_", "._", "\\u", "value_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "<_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\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", "gt", "\\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_", "self_", "._", "\\u", "value_", ">_", "other_", "._", "\\u", "value_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", ">_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\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", "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_", "self_", "._", "\\u", "value_", "==_", "other_", "._", "\\u", "value_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "==_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\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 ", " _", "return_", "not_", "self_", "._", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "bool\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Bytes_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "\\u", "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_", "class_", "RDF", "Zip", "ped", "Bytes_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Zip", "ped", " ", "bytes", " ", "sequence", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Zip", "ped", "Bytes_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Unco", "mpr", "ess_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "zlib_", "._", "decompress_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", " ", "a", " ", "simple", " ", "string", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "value_", "=_", "u", "\"\"_", "\\u\\u\\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_", "operators_", "=_", "RDF", "Value_", "._", "operators_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operators_", "[_", "\"", "matche", "s", "\"_", "]_", "=_", "(_", "1_", ",_", "\"", "Contain", "s", "Match", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operators_", "[_", "\"=\"_", "]_", "=_", "(_", "1_", ",_", "\"", "Contain", "s", "Match", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operators_", "[_", "\"", "startswith", "\"_", "]_", "=_", "(_", "1_", ",_", "\"", "Start", "swi", "th", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Start", "swi", "th_", "(_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Contain", "s", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", ",_", "\"", "^", "\"_", "+_", "utils_", "._", "Esc", "ape", "Regex_", "(_", "string_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "format_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "invalid", "-", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "._", "format_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "split_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "invalid", "-", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "._", "split_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Unicode_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\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_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "String_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "handle", "s", " ", "the", " ", "case", "s", " ", "whe", "n", " ", "we", "'", "re", " ", "initialize", "d", " ", "from", " ", "Unic", "ode", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "utils_", "._", "Sma", "rt", "Str_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Seriali", "ze", "To", "String_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Str_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "String_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Seriali", "ze", "To", "Data", "Store_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Unicode_", "(_", "self_", "._", "\\u", "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_", "class_", "Hash", "Dig", "est_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Bin", "ary", " ", "hash", " ", "digest", " ", "with", " ", "hex", " ", "string", " ", "represent", "ation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "bytes", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Hash", "Dig", "est_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hash", "Dig", "est_", "(_", "RDF", "Bytes_", ")_", ":_", "\\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_", "._", "\\u", "value_", "==_", "utils_", "._", "Sma", "rt", "Str_", "(_", "other_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "value_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hash", "Dig", "est_", "(_", "RDF", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "functools_", "._", "total", "\\u", "ordering_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", " ", "an", " ", "integ", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "integ", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\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u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "operators_", "=_", "{_", "\"<\"_", ":_", "(_", "1_", ",_", "\"", "Less", "Than", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\">\"_", ":_", "(_", "1_", ",_", "\"", "Great", "er", "Than", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"=\"_", ":_", "(_", "1_", ",_", "\"", "Equal", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Is", "Numeric_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "value_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "RDF", "Integer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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_", ",_", "initializer_", "=_", "None_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "RDF", "Integer_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "initializer_", "=_", "initializer_", ",_", "age_", "=_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "initializer_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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_", "Pars", "e", "Fro", "m", "String_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "string_", ":_", "\\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", "value_", "=_", "int_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Decode", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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_", "Seriali", "ze", "To", "Data", "Store_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "e", " ", "vari", "nt", " ", "to", " ", "store", " ", "the", " ", "integ", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Set_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "(_", "long_", ",_", "int_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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", "long", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "long_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "int\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "float", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "index", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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_", "._", "\\u", "value_", "==_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "<_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "and", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "&_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rand", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "&_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ian", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "&=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "or\\u\\u", "_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "|_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ror", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "|_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ior", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "|=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "+_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "+_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "+=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "-_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rsu", "b", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "-_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "isu", "b", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "-=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "*_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rm", "ul", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "*_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "/_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rdi", "v", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "/_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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_", "Less", "Than", "_", "(_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Less", "Than", "Filter_", "(_", "attribute_", ",_", "long_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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_", "Great", "er", "Than", "_", "(_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Great", "er", "Than", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", ",_", "long_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Integer_", "(_", "RDF", "String_", ")_", ":_", "\\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_", "Equal_", "(_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Numer", "ic", "Equal", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", ",_", "long_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "RDF", "Bool_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Boo", "lean", " ", "value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "unsigned", "\\u", "integ", "er", "\"_", "\\u\\u\\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_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "date", " ", "and", " ", "time", " ", "internal", "ly", " ", "store", "d", " ", "in", " ", "MICRO", "SECOND", "S", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "converter_", "=_", "MICRO", "SECONDS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "unsigned", "\\u", "integ", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "value", " ", "of", " ", "0", " ", "means", " ", "this", " ", "object", " ", "is", " ", "not", " ", "initialize", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "value_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "operators_", "=_", "{_", "\"<\"_", ":_", "(_", "1_", ",_", "\"", "Less", "Than", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\">\"_", ":_", "(_", "1_", ",_", "\"", "Great", "er", "Than", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "=\"_", ":_", "(_", "1_", ",_", "\"", "Less", "Than", "Eq", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\">", "=\"_", ":_", "(_", "1_", ",_", "\"", "Great", "er", "Than", "Eq", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "initializer_", "=_", "None_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "RDF", "Datetime_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "None_", ",_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "initializer_", ",_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "initializer_", "._", "\\u", "value_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "int_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seconds_", "=_", "calendar_", "._", "time", "gm_", "(_", "initializer_", "._", "utc", "timetuple_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "value_", "=_", "(_", "seconds_", "*_", "self_", "._", "converter_", ")_", "+_", "initializer_", "._", "microsecond_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Can", " ", "be", " ", "just", " ", "a", " ", "serialize", "d", " ", "integ", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "int_", "(_", "initializer_", ")_", "\\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 ", " _", "if_", "initializer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "parse", " ", "from", " ", "human", " ", "reada", "ble", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "initializer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Initializ", "e", "Error_", "(_", "\"", "Un", "know", "n", " ", "initializer", " ", "for", " ", "RDF", "Date", "Time", ":", " ", "%", "s", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "initializer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "Now_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "self_", "._", "converter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Format_", "(_", "self_", ",_", "fmt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "value", " ", "as", " ", "a", " ", "string", " ", "format", "ted", " ", "as", " ", "per", " ", "strf", "time", " ", "semantics", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "time_", "._", "strftime_", "(_", "fmt_", ",_", "time_", "._", "gmtime_", "(_", "self_", "._", "\\u", "value_", "/_", "self_", "._", "converter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "date", " ", "in", " ", "human", " ", "reada", "ble", " ", "(", "UT", "C", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Format_", "(_", "\"%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Unicode_", "(_", "str_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "As", "Datetime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "time", " ", "as", " ", "a", " ", "python", " ", "datetime", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "datetime_", "._", "utc", "fromtimestamp_", "(_", "self_", "._", "\\u", "value_", "/_", "self_", "._", "converter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "As", "Second", "s", "Fro", "m", "Epoch", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "/_", "self_", "._", "converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "As", "Micro", "Second", "s", "Fro", "m", "Epoch", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Fro", "m", "Second", "s", "Fro", "m", "Epoch", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "value_", "*_", "self_", "._", "converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "self_", ",_", "string_", ",_", "eo", "y_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "self_", "._", "\\u", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "string_", ",_", "eo", "y_", "=_", "eo", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "\\u", "value_", "+_", "other_", "*_", "self_", "._", "converter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "+=_", "other_", "*_", "self_", "._", "converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "\\u", "value_", "*_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rm", "ul", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "mul\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "\\u", "value_", "-_", "other_", "*_", "self_", "._", "converter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "other_", ",_", "RDF", "Datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Duration_", "(_", "self_", "._", "As", "Second", "s", "Fro", "m", "Epoch", "_", "(_", ")_", "-_", "other_", "._", "As", "Second", "s", "Fro", "m", "Epoch", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "isu", "b", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "-=_", "other_", "*_", "self_", "._", "converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "cls_", ",_", "string_", ",_", "eo", "y_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "a", " ", "human", " ", "reada", "ble", " ", "string", " ", "of", " ", "a", " ", "timestamp", " ", "(", "in", " ", "local", " ", "time", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "string", ":", " ", "The", " ", "string", " ", "to", " ", "parse", ".", "\\", "10", ";", " ", " ", "eo", "y", ":", " ", "If", " ", "Tru", "e", ",", " ", "sets", " ", "the", " ", "default", " ", "value", " ", "to", " ", "the", " ", "end", " ", "of", " ", "the", " ", "year", ".", "\\", "10", ";", " ", " ", " ", "Us", "ual", "ly", " ", "this", " ", "method", " ", "return", "s", " ", "a", " ", "timestamp", " ", "where", " ", "each", " ", "field", " ", "tha", "t", " ", "is", "\\", "10", ";", " ", " ", " ", "not", " ", "presen", "t", " ", "in", " ", "the", " ", "give", "n", " ", "string", " ", "is", " ", "filled", " ", "with", " ", "values", " ", "from", " ", "the", " ", "date", "\\", "10", ";", " ", " ", " ", "Januar", "y", " ", "1s", "t", " ", "of", " ", "the", " ", "current", " ", "year", ",", " ", "mid", "night", ".", " ", "Some", "times", " ", "it", " ", "make", "s", " ", "more", "\\", "10", ";", " ", " ", " ", "sense", " ", "to", " ", "compare", " ", "against", " ", "the", " ", "end", " ", "of", " ", "a", " ", "period", " ", "so", " ", "if", " ", "eo", "y", " ", "is", " ", "set", ",", " ", "the", "\\", "10", ";", " ", " ", " ", "default", " ", "values", " ", "are", " ", "copie", "d", " ", "from", " ", "the", " ", "3", "1s", "t", " ", "of", " ", "Dece", "mber", " ", "of", " ", "the", " ", "current", "\\", "10", ";", " ", " ", " ", "year", ",", " ", "23", ":", "5", "9", "h", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "parsed", " ", "timestamp", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "By", " ", "default", " ", "assume", " ", "the", " ", "time", " ", "is", " ", "give", "n", " ", "in", " ", "UT", "C", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "eo", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default_", "=_", "datetime_", "._", "datetime_", "(_", "time_", "._", "gmtime_", "(_", ")_", "._", "tm", "\\u", "year_", ",_", "12_", ",_", "31_", ",_", "23_", ",_", "59_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "dateutil_", "._", "tz_", "._", "tz", "utc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default_", "=_", "datetime_", "._", "datetime_", "(_", "time_", "._", "gmtime_", "(_", ")_", "._", "tm", "\\u", "year_", ",_", "1_", ",_", "1_", ",_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "dateutil_", "._", "tz_", "._", "tz", "utc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timestamp_", "=_", "parser_", "._", "parse_", "(_", "string_", ",_", "default_", "=_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "calendar_", "._", "time", "gm_", "(_", "timestamp_", "._", "utc", "timetuple_", "(_", ")_", ")_", "*_", "cls_", "._", "converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "Less", "Than", "Eq_", "(_", "cls_", ",_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Less", "er", "Equal", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", ",_", "cls_", "._", "\\u", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "value_", ",_", "eo", "y_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "Less", "Than", "_", "(_", "cls_", ",_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "For", " ", "dates", " ", "we", " ", "want", " ", "to", " ", "recognize", " ", "a", " ", "variet", "y", " ", "of", " ", "values", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Less", "er", "Equal", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", ",_", "cls_", "._", "\\u", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "Great", "er", "Than", "Eq_", "(_", "cls_", ",_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Great", "er", "Equal", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", ",_", "cls_", "._", "\\u", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Datetime_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "Great", "er", "Than", "_", "(_", "cls_", ",_", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Predicate", "Great", "er", "Equal", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", ",_", "cls_", "._", "\\u", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "value_", ",_", "eo", "y_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "RDF", "Date", "time", "Seconds_", "(_", "RDF", "Datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Date", "Time", " ", "class", " ", "whi", "ch", " ", "is", " ", "store", "d", " ", "in", " ", "whole", " ", "second", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "converter_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Dur", "ation", " ", "value", " ", "store", "d", " ", "in", " ", "second", "s", " ", "internal", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "unsigned", "\\u", "integ", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DIVI", "DER", "S_", "=_", "collections_", "._", "Order", "ed", "Dict_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "w", "\"_", ",_", "60_", "*_", "60_", "*_", "24_", "*_", "7_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "d", "\"_", ",_", "60_", "*_", "60_", "*_", "24_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "h", "\"_", ",_", "60_", "*_", "60_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "m", "\"_", ",_", "60_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "s", "\"_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "initializer_", "=_", "None_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Duration_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "None_", ",_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "initializer_", ",_", "Duration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "initializer_", "._", "\\u", "value_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "initializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "int_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "initializer_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Initializ", "e", "Error_", "(_", "\"", "Un", "know", "n", " ", "initializer", " ", "for", " ", "Dur", "ation", ":", " ", "%", "s", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "initializer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "Validate", "_", "(_", "self_", ",_", "value_", ",_", "**_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "String_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Seriali", "ze", "To", "String_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "seconds_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\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_", "microseconds_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "*_", "1000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "secs_", "=_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "label_", ",_", "divider", "_", "in_", "self_", "._", "DIVI", "DER", "S_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "time", "\\u", "secs_", "%_", "divider", "_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "d", "%", "s", "\"_", "%_", "(_", "time", "\\u", "secs_", "/_", "divider", "_", ",_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Unicode_", "(_", "str_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "\\u", "value_", "+_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "+=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "\\u", "value_", "*_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rm", "ul", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "mul\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "\\u", "value_", "-_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "isu", "b", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ",_", "Duration_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "other", " ", "is", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "-=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "abs", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Duration_", "(_", "abs_", "(_", "self_", "._", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Expir", "y_", "(_", "self_", ",_", "base", "\\u", "time_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "base", "\\u", "time_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "time_", "=_", "RDF", "Datetime_", "(_", ")_", "._", "Now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "time_", "=_", "base", "\\u", "time_", "._", "Copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base", "\\u", "time", "\\u", "sec_", "=_", "base", "\\u", "time_", "._", "As", "Second", "s", "Fro", "m", "Epoch", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "base", "\\u", "time_", "._", "Fro", "m", "Second", "s", "Fro", "m", "Epoch", "_", "(_", "base", "\\u", "time", "\\u", "sec_", "+_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duration_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "self_", ",_", "timestr", "ing_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "a", " ", "human", " ", "reada", "ble", " ", "string", " ", "of", " ", "a", " ", "duration", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "timestr", "ing", ":", " ", "The", " ", "string", " ", "to", " ", "parse", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "timestr", "ing_", ":_", "\\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_", "orig", "\\u", "string_", "=_", "timestr", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "multipl", "icat", "or_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "timestr", "ing_", "[_", "-_", "1_", "]_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "multipl", "icat", "or_", "=_", "self_", "._", "DIVI", "DER", "S_", "[_", "timestr", "ing_", "[_", "-_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Inva", "lid", " ", "duration", " ", "multipl", "icat", "or", ":", " ", "'%", "s", "'", " ", "('", "%", "s", "')", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "timestr", "ing_", "[_", "-_", "1_", "]_", ",_", "orig", "\\u", "string_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timestr", "ing_", "=_", "timestr", "ing_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "int_", "(_", "timestr", "ing_", ")_", "*_", "multipl", "icat", "or_", "\\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 ", " _", "raise_", "Initializ", "e", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "parse", " ", "expir", "ation", " ", "time", " ", "'%", "s", "'.\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Byte", "Size_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "size", " ", "for", " ", "bytes", " ", "allow", "ing", " ", "standard", " ", "unit", " ", "prefix", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "We", " ", "use", " ", "the", " ", "standard", " ", "IE", "C", " ", "600", "2", "7", "-", "2", " ", "A", ".2", " ", "and", " ", "ISO", "/", "IE", "C", " ", "80000", ":", "\\", "10", ";", " ", " ", "Bin", "ary", " ", "unit", "s", " ", "(", "powers", " ", "of", " ", "2", "):", " ", "Ki", ",", " ", "Mi", ",", " ", "Gi", "\\", "10", ";", " ", " ", "SI", " ", "unit", "s", " ", "(", "powers", " ", "of", " ", "10", "):", " ", "k", ",", " ", "m", ",", " ", "g", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "unsigned", "\\u", "integ", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DIVI", "DER", "S_", "=_", "dict_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"\"_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "k", "\"_", ",_", "1000_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "m", "\"_", ",_", "1000_", "**_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "g", "\"_", ",_", "1000_", "**_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ki", "\"_", ",_", "1024_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "mi", "\"_", ",_", "1024_", "**_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "gi", "\"_", ",_", "1024_", "**_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "REGEX_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "([", "0", "-", "9", ".]+", ")(", "[", "km", "gi", "]*)", "b", "?$", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Byte", "Size_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "initializer_", "=_", "None_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Byte", "Size_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "None_", ",_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "initializer_", ",_", "Byte", "Size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "initializer_", "._", "\\u", "value_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "initializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "int_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "initializer_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Initializ", "e", "Error_", "(_", "\"", "Un", "know", "n", " ", "initializer", " ", "for", " ", "Byte", "Size", ":", " ", "%", "s", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "initializer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Byte", "Size_", "(_", "RDF", "Integer_", ")_", ":_", "\\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 ", " _", "size", "\\u", "token_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "value_", ">_", "1024_", "**_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size", "\\u", "token_", "=_", "\"", "Gb", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "float_", "(_", "self_", "._", "\\u", "value_", ")_", "/_", "1024_", "**_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "value_", ">_", "1024_", "**_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size", "\\u", "token_", "=_", "\"", "Mb", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "float_", "(_", "self_", "._", "\\u", "value_", ")_", "/_", "1024_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "value_", ">_", "1024_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size", "\\u", "token_", "=_", "\"", "Kb", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "float_", "(_", "self_", "._", "\\u", "value_", ")_", "/_", "1024_", "\\u\\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_", "utils_", "._", "Sma", "rt", "Str_", "(_", "self_", "._", "\\u", "value_", ")_", "+_", "\"", "b", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"%", ".1", "f", "%", "s", "\"_", "%_", "(_", "value_", ",_", "size", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Byte", "Size_", "(_", "RDF", "Integer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "Huma", "n", "Read", "able_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "a", " ", "human", " ", "reada", "ble", " ", "string", " ", "of", " ", "a", " ", "byte", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "string", ":", " ", "The", " ", "string", " ", "to", " ", "parse", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Decode", "Error", ":", " ", "If", " ", "the", " ", "string", " ", "can", " ", "not", " ", "be", " ", "parsed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "string_", ":_", "\\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_", "match_", "=_", "self_", "._", "REGEX_", "._", "match_", "(_", "string_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Decode", "Error_", "(_", "\"", "Un", "know", "n", " ", "specifica", "tion", " ", "for", " ", "Byte", "Size", " ", "%", "s", "\"_", "%_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "multiplier_", "=_", "self_", "._", "DIVI", "DER", "S_", "._", "get_", "(_", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "multiplier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Decode", "Error_", "(_", "\"", "Inva", "lid", " ", "multiplie", "r", " ", "%", "s", "\"_", "%_", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "value", " ", "may", " ", "be", " ", "represent", "ed", " ", "as", " ", "a", " ", "float", ",", " ", "but", " ", "if", " ", "not", " ", "don", "t", " ", "lose", " ", "accu", "rac", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\".\"_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "long_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "value_", "=_", "int_", "(_", "value_", "*_", "multiplier_", ")_", "\\u\\u\\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_", "@_", "functools_", "._", "total", "\\u", "ordering_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "object", " ", "to", " ", "abstract", " ", "URL", " ", "manipulati", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store", "\\u", "type_", "=_", "\"", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Care", "ful", " ", "whe", "n", " ", "chang", "ing", " ", "this", " ", "value", ",", " ", "this", " ", "is", " ", "hard", "code", "d", " ", "a", " ", "few", " ", "times", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "for", " ", "perform", "anc", "e", " ", "reasons", "._", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "\"", "aff4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "initializer_", "=_", "None_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "initializer", ":", " ", "A", " ", "string", " ", "or", " ", "anot", "her", " ", "RDF", "URN", ".", "\\", "10", ";", " ", " ", "age", ":", " ", "The", " ", "age", " ", "of", " ", "this", " ", "entry", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Value", "Error", ":", " ", "if", " ", "no", " ", "urn", " ", "pass", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "initializer_", ",_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "direct", " ", "copy", " ", "of", " ", "the", " ", "other", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "string", "\\u", "urn_", "=_", "initializer_", "._", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "RDF", "URN", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "None_", ",_", "age_", ")_", "\\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_", "initializer_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "URN", " ", "cann", "ot", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "RDF", "URN", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "initializer_", "=_", "initializer_", ",_", "age_", "=_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Fro", "m", "String_", "(_", "self_", ",_", "initializer_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "RDF", "RUN", " ", "from", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "initializer", ":", " ", "url", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Strip", " ", "off", " ", "the", " ", "aff4", ":", " ", "prefix", " ", "if", " ", "necessar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "initializer_", "._", "startswith_", "(_", "\"", "aff4", ":/", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initializer_", "=_", "initializer_", "[_", "5_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "string", "\\u", "urn_", "=_", "utils_", "._", "Normalize", "Path_", "(_", "initializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Seriali", "ze", "To", "String_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Seriali", "ze", "To", "Data", "Store_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Supp", "ort", " ", "the", " ", "pickle", " ", "protoc", "ol", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RDF", "Value_", "._", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Thi", "s", " ", "is", " ", "don", "e", " ", "for", " ", "back", "ward", "s", " ", "compatibility", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "old", " ", "pickled", " ", "RDF", "URN", "s", " ", "tha", "t", " ", "got", " ", "pickled", " ", "via", " ", "default", " ", "pick", "ling", " ", "mechanism", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "'", "aff4", ":/", "'", " ", "pickled", " ", "as", " ", "part", " ", "of", " ", "\\u", "string", "\\u", "urn", " ", "as", " ", "a", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "string", "\\u", "urn_", "._", "startswith_", "(_", "\"", "aff4", ":/", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "string", "\\u", "urn_", "=_", "self_", "._", "\\u", "string", "\\u", "urn_", "[_", "5_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\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_", "Dir", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "posixpath_", "._", "dirname_", "(_", "self_", "._", "\\u", "string", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Base", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "posixpath_", "._", "basename_", "(_", "self_", "._", "Path_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Add_", "(_", "self_", ",_", "path_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "relative", " ", "stem", " ", "to", " ", "the", " ", "current", " ", "value", " ", "and", " ", "return", " ", "a", " ", "new", " ", "RDF", "URN", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "urn", " ", "is", " ", "a", " ", "full", "y", " ", "qualified", " ", "URN", ",", " ", "replace", " ", "the", " ", "current", " ", "value", " ", "with", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "path", ":", " ", "A", " ", "string", " ", "contain", "ing", " ", "a", " ", "relative", " ", "path", ".", "\\", "10", ";", " ", " ", "age", ":", " ", "The", " ", "age", " ", "of", " ", "the", " ", "object", ".", " ", "If", " ", "Non", "e", " ", "set", " ", "to", " ", "current", " ", "time", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", "A", " ", "new", " ", "RDF", "URN", " ", "tha", "t", " ", "can", " ", "be", " ", "chained", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", "Value", "Error", ":", " ", "if", " ", "the", " ", "path", " ", "component", " ", "is", " ", "not", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "path_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "On", "ly", " ", "string", "s", " ", "shou", "ld", " ", "be", " ", "adde", "d", " ", "to", " ", "a", " ", "URN", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "self_", "._", "Copy_", "(_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "Update_", "(_", "path_", "=_", "utils_", "._", "Join", "Path_", "(_", "self_", "._", "\\u", "string", "\\u", "urn_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Update_", "(_", "self_", ",_", "url_", "=_", "None_", ",_", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "one", " ", "of", " ", "the", " ", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", "url", ":", " ", "An", " ", "option", "al", " ", "string", " ", "contain", "ing", " ", "a", " ", "URL", ".", "\\", "10", ";", " ", " ", " ", "path", ":", " ", "If", " ", "the", " ", "path", " ", "for", " ", "this", " ", "URN", " ", "shou", "ld", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "string", "\\u", "urn_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Copy_", "(_", "self_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", " ", "a", " ", "copy", " ", "of", " ", "ours", "elv", "es", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "age_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "age_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "MICRO", "SECONDS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", ",_", "age_", "=_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Str_", "(_", "\"", "aff4", ":", "%", "s", "\"_", "%_", "self_", "._", "\\u", "string", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "Sma", "rt", "Unicode_", "(_", "u", "\"", "aff4", ":", "%", "s", "\"_", "%_", "self_", "._", "\\u", "string", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\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_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "other_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "other_", ",_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "string", "\\u", "urn_", "==_", "other_", "._", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "string", "\\u", "urn_", "<_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "path", " ", "of", " ", "the", " ", "urn", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "string", "\\u", "urn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Split_", "(_", "self_", ",_", "count_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "all", " ", "the", " ", "path", " ", "component", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "count", ":", " ", "If", " ", "count", " ", "is", " ", "specified", ",", " ", "the", " ", "output", " ", "will", " ", "be", " ", "exact", "ly", " ", "this", " ", "many", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "component", "s", ",", " ", "possib", "ly", " ", "extend", "ed", " ", "with", " ", "the", " ", "empty", " ", "string", ".", " ", "Thi", "s", " ", "is", " ", "usef", "ul", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "tuple", " ", "assign", "ment", "s", " ", "with", "out", " ", "wor", "ry", "ing", " ", "abo", "ut", " ", "Value", "Error", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "namespace", ",", " ", "path", " ", "=", " ", "urn", ".", "Split", "(", "2", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "list", " ", "of", " ", "path", " ", "component", "s", " ", "of", " ", "this", " ", "URN", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "filter_", "(_", "None_", ",_", "self_", "._", "\\u", "string", "\\u", "urn_", "._", "split_", "(_", "\"/\"_", ",_", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "result_", ")_", "<_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "return_", "filter_", "(_", "None_", ",_", "self_", "._", "\\u", "string", "\\u", "urn_", "._", "split_", "(_", "\"/\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\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_", "Relative", "Name_", "(_", "self_", ",_", "volume_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "a", " ", "volume", " ", "URN", " ", "return", " ", "the", " ", "relative", " ", "URN", " ", "as", " ", "a", " ", "unicode", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "remove", " ", "the", " ", "volume", " ", "prefix", " ", "from", " ", "our", " ", "own", ".", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "volume", ":", " ", "An", " ", "RDF", "URN", " ", "or", " ", "full", "y", " ", "qualified", " ", "url", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "of", " ", "the", " ", "url", " ", "relative", " ", "from", " ", "the", " ", "volume", " ", "or", " ", "Non", "e", " ", "if", " ", "our", " ", "URN", " ", "doe", "s", " ", "not", "\\", "10", ";", " ", " ", "start", " ", "with", " ", "the", " ", "volume", " ", "prefix", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "\\u", "url_", "=_", "utils_", "._", "Sma", "rt", "Unicode_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume", "\\u", "url_", "=_", "utils_", "._", "Sma", "rt", "Unicode_", "(_", "volume_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "string", "\\u", "url_", "._", "startswith_", "(_", "volume", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "string", "\\u", "url_", "[_", "len_", "(_", "volume", "\\u", "url_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "must", " ", "alw", "ay", "s", " ", "return", " ", "a", " ", "relative", " ", "path", " ", "so", " ", "we", " ", "strip", " ", "lead", "ing", " ", "\"/", "\"", "s", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "alw", "ay", "s", " ", "a", " ", "unicode", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_", "._", "lstrip_", "(_", "\"/\"_", ")_", "\\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_", "RDF", "URN", "_", "(_", "RDF", "Value_", ")_", ":_", "\\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_", "\"<", "%", "s", " ", "age", "=", "%", "s", ">\"_", "%_", "(_", "str_", "(_", "self_", ")_", ",_", "self_", "._", "age_", ")_", "\\u\\u\\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_", "Subject_", "(_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "psu", "edo", " ", "attribute", " ", "represent", "ing", " ", "the", " ", "subject", " ", "of", " ", "an", " ", "AFF", "4", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "operators_", "=_", "dict_", "(_", "matches_", "=_", "(_", "1_", ",_", "\"", "Contain", "s", "Match", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contains_", "=_", "(_", "1_", ",_", "\"", "Contain", "s", "Match", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "startswith_", "=_", "(_", "1_", ",_", "\"", "Start", "swi", "th", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "has_", "=_", "(_", "1_", ",_", "\"", "Has", "Attribute", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subject_", "(_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Contain", "s", "Match_", "(_", "unu", "sed", "\\u", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "regex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Sub", "ject", "Contain", "s", "Filter_", "(_", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subject_", "(_", "RDF", "URN", "_", ")_", ":_", "\\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_", "Start", "swi", "th_", "(_", "unu", "sed", "\\u", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Sub", "ject", "Contain", "s", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "^", "\"_", "+_", "utils_", "._", "Esc", "ape", "Regex_", "(_", "string_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subject_", "(_", "RDF", "URN", "_", ")_", ":_", "\\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_", "Has", "Attribute_", "(_", "unu", "sed", "\\u", "attribute_", ",_", "filter", "\\u", "implement", "ion_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter", "\\u", "implement", "ion_", "._", "Has", "Predicate", "Filter_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Sess", "ion", "ID_", "(_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "rdf", "value", " ", "object", " ", "tha", "t", " ", "represent", "s", " ", "a", " ", "session", "\\u", "id", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Sess", "ion", "ID_", "(_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "initializer_", "=_", "None_", ",_", "age_", "=_", "None_", ",_", "base_", "=_", "\"", "aff4", ":/", "flow", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "=_", "DEF", "AUL", "T", "\\u", "FLOW", "\\u", "QUEUE", "_", ",_", "flow", "\\u", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "initializer", ":", " ", "A", " ", "string", " ", "or", " ", "anot", "her", " ", "RDF", "URN", ".", "\\", "10", ";", " ", " ", "age", ":", " ", "The", " ", "age", " ", "of", " ", "this", " ", "entry", ".", "\\", "10", ";", " ", " ", "base", ":", " ", "The", " ", "base", " ", "namespace", " ", "this", " ", "session", " ", "id", " ", "lives", " ", "in", ".", "\\", "10", ";", " ", " ", "queue", ":", " ", "The", " ", "queue", " ", "to", " ", "use", ".", "\\", "10", ";", " ", " ", "flow", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "this", " ", "flow", " ", "or", " ", "its", " ", "random", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Initializ", "e", "Error", ":", " ", "The", " ", "give", "n", " ", "URN", " ", "cann", "ot", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "Sess", "ion", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "initializer_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "Sess", "ion", "ID", " ", "is", " ", "bei", "ng", " ", "construct", "ed", " ", "from", " ", "scratch", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "flow", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flow", "\\u", "name_", "=_", "utils_", "._", "PR", "NG_", "._", "Get", "UL", "ong_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "flow", "\\u", "name_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initializer_", "=_", "RDF", "URN", "_", "(_", "base_", ")_", "._", "Add_", "(_", "\"%", "s", ":", "%", "X", "\"_", "%_", "(_", "queue_", "._", "Base", "name_", "(_", ")_", ",_", "flow", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initializer_", "=_", "RDF", "URN", "_", "(_", "base_", ")_", "._", "Add_", "(_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "queue_", "._", "Base", "name_", "(_", ")_", ",_", "flow", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "initializer_", ",_", "RDF", "URN", "_", ")_", ":_", "\\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_", "._", "Validate", "ID_", "(_", "initializer_", "._", "Base", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Initializ", "e", "Error_", "(_", "\"", "Inva", "lid", " ", "URN", " ", "for", " ", "Sess", "ion", "ID", ":", " ", "%", "s", ",", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "initializer_", ",_", "e_", "._", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Sess", "ion", "ID_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "initializer_", "=_", "initializer_", ",_", "age_", "=_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sess", "ion", "ID_", "(_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Queue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "RDF", "URN", "_", "(_", "self_", "._", "Base", "name_", "(_", ")_", "._", "split_", "(_", "\":\"_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sess", "ion", "ID_", "(_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Flow", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "Base", "name_", "(_", ")_", "._", "split_", "(_", "\":\"_", ",_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sess", "ion", "ID_", "(_", "RDF", "URN", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Add_", "(_", "self_", ",_", "path_", ",_", "age_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "to", " ", "a", " ", "Sess", "ion", "ID", " ", "results", " ", "in", " ", "a", " ", "normal", " ", "RDF", "URN", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "RDF", "URN", "_", "(_", "self_", ")_", "._", "Add_", "(_", "path_", ",_", "age_", "=_", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sess", "ion", "ID_", "(_", "RDF", "URN", "_", ")_", ":_", "\\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_", "Validate", "ID_", "(_", "cls_", ",_", "id", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "check", " ", "is", " ", "weak", "er", " ", "than", " ", "it", " ", "coul", "d", " ", "be", " ", "bec", "aus", "e", " ", "we", " ", "allow", " ", "queue", "s", " ", "called_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "DEBU", "G", "-", "user", "1", "\"", " ", "and", " ", "ID", "s", " ", "like", " ", "\"", "Transfer", "Stor", "e", "\".", " ", "We", " ", "als", "o", " ", "have", " ", "to", " ", "allow_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flow", "s", " ", "session", " ", "ids", " ", "like", " ", "H", ":", "12345", "6", ":", "hunt", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "ed", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "\"", "^", "[-", "0", "-", "9", "a", "-", "z", "A", "-", "Z", "]+", ":[", "0", "-", "9", "a", "-", "z", "A", "-", "Z", "]+(", ":[", "0", "-", "9", "a", "-", "z", "A", "-", "Z", "]+)", "?$", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "allow", "ed", "\\u", "re_", "._", "match_", "(_", "id", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Inva", "lid", " ", "Sess", "ion", "ID", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Flow", "Sess", "ion", "ID_", "(_", "Sess", "ion", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "Thi", "s", " ", "is", " ", "code", " ", "to", " ", "fix", " ", "some", " ", "lega", "cy", " ", "issue", "s", ".", " ", "Remove", " ", "this", " ", "whe", "n", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clients", " ", "are", " ", "bui", "lt", " ", "after", " ", "De", "c", " ", "2014", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "Pars", "e", "Fro", "m", "String_", "(_", "self_", ",_", "initializer_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Old", " ", "clients", " ", "somet", "imes", " ", "send", " ", "bare", " ", "well", " ", "know", "n", " ", "flow", " ", "ids", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "utils_", "._", "Sma", "rt", "Str_", "(_", "initializer_", ")_", "._", "startswith_", "(_", "\"", "aff4", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initializer_", "=_", "\"", "aff4", ":/", "flow", "s", "/\"_", "+_", "initializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Flow", "Sess", "ion", "ID_", ",_", "self_", ")_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "initializer_", ")_" ]
[ 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, 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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, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
VisTrails/VisTrails/vistrails/db/versions/v0_3_0/persistence/xml/io.py
[ { "content": "###############################################################################\n##\n## Copyright (C) 2014-2016, New York University.\n## Copyright (C) 2011-2014, NYU-Poly.\n## Copyright (C) 2006-2011, University of Utah.\n## All rights reserved.\n## Contact: [email protected]\n##\n## This file is part of VisTrails.\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are met:\n##\n## - Redistributions of source code must retain the above copyright notice,\n## this list of conditions and the following disclaimer.\n## - Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in the\n## documentation and/or other materials provided with the distribution.\n## - Neither the name of the New York University nor the names of its\n## contributors may be used to endorse or promote products derived from\n## this software without specific prior written permission.\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n## OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n###############################################################################\nfrom __future__ import division\n\nfrom xml.parsers.expat import ExpatError\nimport xml.dom.minidom\n\nfrom vistrails.db import VistrailsDBException\nfrom vistrails.db.versions.v0_3_0 import version as my_version\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def parse_xml_file(filename):\n try:\n return xml.dom.minidom.parse(filename)\n except xml.parsers.expat.ExpatError, e:\n msg = 'XML parse error at line %s, col %s: %s' % \\\n (e.lineno, e.offset, e.code)\n raise VistrailsDBException(msg)", "metadata": "root.parse_xml_file", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def write_xml_file(filename, dom, prettyprint=True):\n output = open(filename, 'w')\n if prettyprint:\n dom.writexml(output, '',' ','\\n')\n else:\n dom.writexml(output)\n output.close()", "metadata": "root.write_xml_file", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def read_xml_object(vtType, node, dao_list):\n return dao_list[vtType].fromXML(node)", "metadata": "root.read_xml_object", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def write_xml_object(obj, dom, dao_list, node=None):\n res_node = dao_list[obj.vtType].toXML(obj, dom, node)\n return res_node", "metadata": "root.write_xml_object", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def open_from_xml(filename, vtType, dao_list):\n \"\"\"open_from_xml(filename) -> DBVistrail\"\"\"\n dom = parse_xml_file(filename)\n vistrail = read_xml_object(vtType, dom.documentElement, dao_list)\n dom.unlink()\n return vistrail", "metadata": "root.open_from_xml", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def save_to_xml(obj, filename, dao_list):\n dom = xml.dom.minidom.getDOMImplementation().createDocument(None, None,\n None)\n root = write_xml_object(obj, dom, dao_list)\n dom.appendChild(root)\n if obj.vtType == 'vistrail':\n root.setAttribute('version', my_version)\n root.setAttribute('xmlns:xsi', \n 'http://www.w3.org/2001/XMLSchema-instance')\n root.setAttribute('xsi:schemaLocation', \n 'http://www.vistrails.org/vistrail.xsd')\n write_xml_file(filename, dom)\n dom.unlink()", "metadata": "root.save_to_xml", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def serialize(object, dao_list):\n dom = xml.dom.minidom.getDOMImplementation().createDocument(None, None,\n None)\n root = write_xml_object(object, dom, dao_list)\n dom.appendChild(root)\n return dom.toxml()", "metadata": "root.serialize", "header": "['module', '___EOS___']", "index": 87 }, { "content": "def unserialize(str, obj_type):\n dom = xml.dom.minidom.parseString(str)\n return read_xml_object(obj_type, dom.documentElement, dao_list)", "metadata": "root.unserialize", "header": "['module', '___EOS___']", "index": 94 } ]
[ { "span": "from xml.parsers.expat import ExpatError", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2014", "-", "2016", ",", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", "-", "2014", ",", " ", "NY", "U", "-", "Poly", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2011", ",", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Conta", "ct", ":", " ", "contact", "@", "vist", "rail", "s", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\"", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "xml_", "._", "parsers_", "._", "expa", "t_", "import_", "Expa", "t", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "dom_", "._", "minidom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "import_", "Vis", "trail", "s", "DB", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "._", "versions_", "._", "v", "0", "\\u", "3", "\\u", "0_", "import_", "version_", "as_", "my", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "\\u", "xml", "\\u", "file_", "(_", "filename_", ")_", ":_", "\\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_", "xml_", "._", "dom_", "._", "minidom_", "._", "parse_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "xml_", "._", "parsers_", "._", "expa", "t_", "._", "Expa", "t", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "XML", " ", "parse", " ", "error", " ", "at", " ", "line", " ", "%", "s", ",", " ", "col", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "e_", "._", "lineno_", ",_", "e_", "._", "offset_", ",_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Vis", "trail", "s", "DB", "Exception_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "xml", "\\u", "file_", "(_", "filename_", ",_", "dom_", ",_", "pretty", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom_", "._", "write", "xml_", "(_", "output_", ",_", "''_", ",_", "'", " ", " ", "'_", ",_", "'\\\\", "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 ", " _", "dom_", "._", "write", "xml_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "xml", "\\u", "object_", "(_", "vt", "Type_", ",_", "node_", ",_", "dao", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dao", "\\u", "list_", "[_", "vt", "Type_", "]_", "._", "from", "XML_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "xml", "\\u", "object_", "(_", "obj_", ",_", "dom_", ",_", "dao", "\\u", "list_", ",_", "node_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "node_", "=_", "dao", "\\u", "list_", "[_", "obj_", "._", "vt", "Type_", "]_", "._", "to", "XML_", "(_", "obj_", ",_", "dom_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "\\u", "from", "\\u", "xml_", "(_", "filename_", ",_", "vt", "Type_", ",_", "dao", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "open", "\\u", "from", "\\u", "xml", "(", "filename", ")", " ", "->", " ", "DB", "Vis", "trail", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "=_", "parse", "\\u", "xml", "\\u", "file_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vist", "rail", "_", "=_", "read", "\\u", "xml", "\\u", "object_", "(_", "vt", "Type_", ",_", "dom_", "._", "document", "Element_", ",_", "dao", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "._", "unlink_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "vist", "rail", "_", "\\u\\u\\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_", "save", "\\u", "to", "\\u", "xml_", "(_", "obj_", ",_", "filename_", ",_", "dao", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom_", "=_", "xml_", "._", "dom_", "._", "minidom_", "._", "get", "DOM", "Implementation", "_", "(_", ")_", "._", "create", "Document_", "(_", "None_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "write", "\\u", "xml", "\\u", "object_", "(_", "obj_", ",_", "dom_", ",_", "dao", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "._", "append", "Child_", "(_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "vt", "Type_", "==_", "'", "vist", "rail", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "._", "set", "Attribute_", "(_", "'", "version", "'_", ",_", "my", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "set", "Attribute_", "(_", "'", "xml", "ns", ":", "xsi", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "set", "Attribute_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "vist", "rail", "s", ".", "org", "/", "vist", "rail", ".", "xsd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "xml", "\\u", "file_", "(_", "filename_", ",_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "._", "unlink_", "(_", ")_", "\\u\\u\\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_", "serialize_", "(_", "object_", ",_", "dao", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom_", "=_", "xml_", "._", "dom_", "._", "minidom_", "._", "get", "DOM", "Implementation", "_", "(_", ")_", "._", "create", "Document_", "(_", "None_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "write", "\\u", "xml", "\\u", "object_", "(_", "object_", ",_", "dom_", ",_", "dao", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "._", "append", "Child_", "(_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dom_", "._", "tox", "ml_", "(_", ")_", "\\u\\u\\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_", "unse", "rial", "ize_", "(_", "str_", ",_", "obj", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom_", "=_", "xml_", "._", "dom_", "._", "minidom_", "._", "parse", "String_", "(_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "read", "\\u", "xml", "\\u", "object_", "(_", "obj", "\\u", "type_", ",_", "dom_", "._", "document", "Element_", ",_", "dao", "\\u", "list_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
google/transitfeed/transitfeed/fareattribute.py
[ { "content": " def __init__(self,\n fare_id=None, price=None, currency_type=None,\n payment_method=None, transfers=None, transfer_duration=None,\n field_dict=None):\n self._schedule = None\n (self.fare_id, self.price, self.currency_type, self.payment_method,\n self.transfers, self.transfer_duration) = \\\n (fare_id, price, currency_type, payment_method,\n transfers, transfer_duration)\n\n if field_dict:\n if isinstance(field_dict, FareAttribute):\n # Special case so that we don't need to re-parse the attributes to\n # native types iteritems returns all attributes that don't start with _\n for k, v in field_dict.iteritems():\n self.__dict__[k] = v\n else:\n self.__dict__.update(field_dict)\n self.rules = []\n\n try:\n self.price = float(self.price)\n except (TypeError, ValueError):\n pass\n try:\n self.payment_method = int(self.payment_method)\n except (TypeError, ValueError):\n pass\n if self.transfers == None or self.transfers == \"\":\n self.transfers = None\n else:\n try:\n self.transfers = int(self.transfers)\n except (TypeError, ValueError):\n pass\n if self.transfer_duration == None or self.transfer_duration == \"\":\n self.transfer_duration = None\n else:\n try:\n self.transfer_duration = int(self.transfer_duration)\n except (TypeError, ValueError):\n pass", "metadata": "root.FareAttribute.__init__", "header": "['class', 'FareAttribute', '(', 'GtfsObjectBase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def ValidatePrice(self, problems):\n if self.price == None:\n problems.MissingValue(\"price\")\n elif not isinstance(self.price, float) and not isinstance(self.price, int):\n problems.InvalidValue(\"price\", self.price)\n elif self.price < 0:\n problems.InvalidValue(\"price\", self.price)", "metadata": "root.FareAttribute.ValidatePrice", "header": "['class', 'FareAttribute', '(', 'GtfsObjectBase', ')', ':', '___EOS___']", "index": 105 }, { "content": " def ValidatePaymentMethod(self, problems):\n if self.payment_method == \"\" or self.payment_method == None:\n problems.MissingValue(\"payment_method\")\n elif (not isinstance(self.payment_method, int) or\n self.payment_method not in range(0, 2)):\n problems.InvalidValue(\"payment_method\", self.payment_method)", "metadata": "root.FareAttribute.ValidatePaymentMethod", "header": "['class', 'FareAttribute', '(', 'GtfsObjectBase', ')', ':', '___EOS___']", "index": 119 }, { "content": " def ValidateTransfers(self, problems):\n if not ((self.transfers == None) or\n (isinstance(self.transfers, int) and\n self.transfers in range(0, 3))):\n problems.InvalidValue(\"transfers\", self.transfers)", "metadata": "root.FareAttribute.ValidateTransfers", "header": "['class', 'FareAttribute', '(', 'GtfsObjectBase', ')', ':', '___EOS___']", "index": 126 } ]
[ { "span": "self.transfers == None ", "start_line": 55, "start_column": 7, "end_line": 55, "end_column": 29 }, { "span": "self.transfer_duration == None ", "start_line": 62, "start_column": 7, "end_line": 62, "end_column": 37 }, { "span": "self.price == None:", "start_line": 106, "start_column": 7, "end_line": 106, "end_column": 25 }, { "span": "self.payment_method == None:", "start_line": 120, "start_column": 36, "end_line": 120, "end_column": 63 }, { "span": "self.transfers == None)", "start_line": 127, "start_column": 13, "end_line": 127, "end_column": 35 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Far", "e", "Attribute_", "(_", "Gt", "fs", "Object", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fare", "\\u", "id_", "=_", "None_", ",_", "price_", "=_", "None_", ",_", "curr", "ency", "\\u", "type_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pay", "ment", "\\u", "method_", "=_", "None_", ",_", "transfers", "_", "=_", "None_", ",_", "transfer", "\\u", "duration_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "dict_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "schedule_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "self_", "._", "fare", "\\u", "id_", ",_", "self_", "._", "price_", ",_", "self_", "._", "curr", "ency", "\\u", "type_", ",_", "self_", "._", "pay", "ment", "\\u", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transfers", "_", ",_", "self_", "._", "transfer", "\\u", "duration_", ")_", "=_", "(_", "fare", "\\u", "id_", ",_", "price_", ",_", "curr", "ency", "\\u", "type_", ",_", "pay", "ment", "\\u", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transfers", "_", ",_", "transfer", "\\u", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "field", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "field", "\\u", "dict_", ",_", "Far", "e", "Attribute_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", " ", "case", " ", "so", " ", "tha", "t", " ", "we", " ", "don", "'", "t", " ", "need", " ", "to", " ", "re", "-", "parse", " ", "the", " ", "attribute", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nativ", "e", " ", "types", " ", "iter", "items", " ", "return", "s", " ", "all", " ", "attribute", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "start", " ", "with", " ", "\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "field", "\\u", "dict_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "k_", "]_", "=_", "v_", "\\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_", "._", "\\u\\u", "dict\\u\\u_", "._", "update_", "(_", "field", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "price_", "=_", "float_", "(_", "self_", "._", "price_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 ", " _", "self_", "._", "pay", "ment", "\\u", "method_", "=_", "int_", "(_", "self_", "._", "pay", "ment", "\\u", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "transfers", "_", "==_", "None_", "or_", "self_", "._", "transfers", "_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transfers", "_", "=_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transfers", "_", "=_", "int_", "(_", "self_", "._", "transfers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "transfer", "\\u", "duration_", "==_", "None_", "or_", "self_", "._", "transfer", "\\u", "duration_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transfer", "\\u", "duration_", "=_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transfer", "\\u", "duration_", "=_", "int_", "(_", "self_", "._", "transfer", "\\u", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Far", "e", "Attribute_", "(_", "Gt", "fs", "Object", "Base_", ")_", ":_", "\\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_", "Validate", "Price_", "(_", "self_", ",_", "problems_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "price_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "problems_", "._", "Missing", "Value_", "(_", "\"", "price", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "self_", "._", "price_", ",_", "float_", ")_", "and_", "not_", "isinstance_", "(_", "self_", "._", "price_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "problems_", "._", "Inva", "lid", "Value_", "(_", "\"", "price", "\"_", ",_", "self_", "._", "price_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "price_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "problems_", "._", "Inva", "lid", "Value_", "(_", "\"", "price", "\"_", ",_", "self_", "._", "price_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Far", "e", "Attribute_", "(_", "Gt", "fs", "Object", "Base_", ")_", ":_", "\\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_", "Validate", "Payment", "Method_", "(_", "self_", ",_", "problems_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "pay", "ment", "\\u", "method_", "==_", "\"\"_", "or_", "self_", "._", "pay", "ment", "\\u", "method_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "problems_", "._", "Missing", "Value_", "(_", "\"", "pay", "ment", "\\u", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "not_", "isinstance_", "(_", "self_", "._", "pay", "ment", "\\u", "method_", ",_", "int_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pay", "ment", "\\u", "method_", "not_", "in_", "range_", "(_", "0_", ",_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "problems_", "._", "Inva", "lid", "Value_", "(_", "\"", "pay", "ment", "\\u", "method", "\"_", ",_", "self_", "._", "pay", "ment", "\\u", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Far", "e", "Attribute_", "(_", "Gt", "fs", "Object", "Base_", ")_", ":_", "\\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_", "Validate", "Transfer", "s_", "(_", "self_", ",_", "problems_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "(_", "self_", "._", "transfers", "_", "==_", "None_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "isinstance_", "(_", "self_", "._", "transfers", "_", ",_", "int_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transfers", "_", "in_", "range_", "(_", "0_", ",_", "3_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "problems_", "._", "Inva", "lid", "Value_", "(_", "\"", "transfers", "\"_", ",_", "self_", "._", "transfers", "_", ")_", "\\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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary delete statement in function
saltstack/salt/salt/__init__.py
[ { "content": "def __define_global_system_encoding_variable__():\n import sys\n # This is the most trustworthy source of the system encoding, though, if\n # salt is being imported after being daemonized, this information is lost\n # and reset to None\n if sys.stdin is not None:\n encoding = sys.stdin.encoding\n else:\n encoding = None\n if not encoding:\n # If the system is properly configured this should return a valid\n # encoding. MS Windows has problems with this and reports the wrong\n # encoding\n import locale\n try:\n encoding = locale.getdefaultlocale()[-1]\n except ValueError:\n # A bad locale setting was most likely found:\n # https://github.com/saltstack/salt/issues/26063\n pass\n\n # This is now garbage collectable\n del locale\n if not encoding:\n # This is most likely ascii which is not the best but we were\n # unable to find a better encoding. If this fails, we fall all\n # the way back to ascii\n encoding = sys.getdefaultencoding() or 'ascii'\n\n # We can't use six.moves.builtins because these builtins get deleted sooner\n # than expected. See:\n # https://github.com/saltstack/salt/issues/21036\n if sys.version_info[0] < 3:\n import __builtin__ as builtins\n else:\n import builtins # pylint: disable=import-error\n\n # Define the detected encoding as a built-in variable for ease of use\n setattr(builtins, '__salt_system_encoding__', encoding)\n\n # This is now garbage collectable\n del sys\n del builtins\n del encoding", "metadata": "root.__define_global_system_encoding_variable__", "header": "['module', '___EOS___']", "index": 32 } ]
[ { "span": "del encoding", "start_line": 75, "start_column": 4, "end_line": 75, "end_column": 16 } ]
[ { "span": "def __define_global_system_encoding_variable__():", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 49 } ]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "delete_", "statement_", "in_", "function_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "defin", "e\\u", "global", "\\u", "system", "\\u", "encoding", "\\u", "variab", "le", "\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "most", " ", "trust", "worth", "y", " ", "source", " ", "of", " ", "the", " ", "system", " ", "encoding", ",", " ", "tho", "ugh", ",", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "salt", " ", "is", " ", "bei", "ng", " ", "import", "ed", " ", "after", " ", "bei", "ng", " ", "daemon", "ize", "d", ",", " ", "this", " ", "informati", "on", " ", "is", " ", "lost_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "reset", " ", "to", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "stdin_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "sys_", "._", "stdin_", "._", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "encoding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "system", " ", "is", " ", "proper", "ly", " ", "configur", "ed", " ", "this", " ", "shou", "ld", " ", "return", " ", "a", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ".", " ", "MS", " ", "Window", "s", " ", "has", " ", "problem", "s", " ", "with", " ", "this", " ", "and", " ", "report", "s", " ", "the", " ", "wrong", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "locale_", "._", "getde", "fault", "locale_", "(_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "bad", " ", "locale", " ", "setti", "ng", " ", "was", " ", "most", " ", "like", "ly", " ", "found", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "https", "://", "git", "hub", ".", "com", "/", "salt", "stack", "/", "salt", "/", "issue", "s", "/", "260", "63_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "now", " ", "gar", "bage", " ", "collect", "able_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "encoding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "most", " ", "like", "ly", " ", "ascii", " ", "whi", "ch", " ", "is", " ", "not", " ", "the", " ", "best", " ", "but", " ", "we", " ", "wer", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "una", "ble", " ", "to", " ", "find", " ", "a", " ", "bett", "er", " ", "encoding", ".", " ", "If", " ", "this", " ", "fail", "s", ",", " ", "we", " ", "fall", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "way", " ", "back", " ", "to", " ", "ascii_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "sys_", "._", "getde", "fault", "encoding_", "(_", ")_", "or_", "'", "ascii", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "use", " ", "si", "x", ".", "moves", ".", "bui", "lti", "ns", " ", "bec", "aus", "e", " ", "these", " ", "bui", "lti", "ns", " ", "get", " ", "delete", "d", " ", "soo", "ner_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "than", " ", "expected", ".", " ", "See", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "https", "://", "git", "hub", ".", "com", "/", "salt", "stack", "/", "salt", "/", "issue", "s", "/", "210", "36_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u\\u", "builtin\\u\\u_", "as_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "builtins_", "#", " ", "pylint", ":", " ", "disable", "=", "import", "-", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "the", " ", "detect", "ed", " ", "encoding", " ", "as", " ", "a", " ", "bui", "lt", "-", "in", " ", "variab", "le", " ", "for", " ", "eas", "e", " ", "of", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "builtins_", ",_", "'\\u", "\\u", "salt", "\\u", "system", "\\u", "encoding", "\\u\\u'_", ",_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "now", " ", "gar", "bage", " ", "collect", "able_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 0, 1, 2 ]
Unused import
bernardopires/django-tenant-schemas/dts_test_project/dts_test_project/urls.py
[ { "content": "\"\"\"wtf URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.9/topics/http/urls/\nExamples:\nFunction views\n 1. Add an import: from my_app import views\n 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')\nClass-based views\n 1. Add an import: from other_app.views import Home\n 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')\nIncluding another URLconf\n 1. Add an import: from blog import urls as blog_urls\n 2. Import the include() function: from django.conf.urls import url, include\n 3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))\n\"\"\"\nfrom django.conf.urls import url\nfrom django.contrib import admin\n\nurlpatterns = [\n]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from django.conf.urls import url", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 32 }, { "span": "from django.contrib import admin", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "wtf", " ", "URL", " ", "Configura", "tion", "\\", "10", ";", "\\", "10", ";", "The", " ", "`", "urlpa", "tter", "ns", "`", " ", "list", " ", "route", "s", " ", "URL", "s", " ", "to", " ", "views", ".", " ", "For", " ", "more", " ", "informati", "on", " ", "plea", "se", " ", "see", ":", "\\", "10", ";", " ", " ", " ", " ", "https", "://", "docs", ".", "django", "project", ".", "com", "/", "en", "/", "1.9", "/", "topic", "s", "/", "http", "/", "urls", "/", "\\", "10", ";", "Exam", "ples", ":", "\\", "10", ";", "Function", " ", "views", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Add", " ", "an", " ", "import", ":", " ", " ", "from", " ", "my", "\\u", "app", " ", "import", " ", "views", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Add", " ", "a", " ", "URL", " ", "to", " ", "urlpa", "tter", "ns", ":", " ", " ", "url", "(", "r", "'", "^", "$", "',", " ", "views", ".", "home", ",", " ", "name", "='", "home", "')", "\\", "10", ";", "Class", "-", "based", " ", "views", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Add", " ", "an", " ", "import", ":", " ", " ", "from", " ", "other", "\\u", "app", ".", "views", " ", "import", " ", "Home", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Add", " ", "a", " ", "URL", " ", "to", " ", "urlpa", "tter", "ns", ":", " ", " ", "url", "(", "r", "'", "^", "$", "',", " ", "Home", ".", "as", "\\u", "view", "()", ",", " ", "name", "='", "home", "')", "\\", "10", ";", "Includi", "ng", " ", "anot", "her", " ", "URL", "conf", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Add", " ", "an", " ", "import", ":", " ", " ", "from", " ", "blog", " ", "import", " ", "urls", " ", "as", " ", "blog", "\\u", "urls", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Import", " ", "the", " ", "include", "()", " ", "function", ":", " ", "from", " ", "django", ".", "conf", ".", "urls", " ", "import", " ", "url", ",", " ", "include", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Add", " ", "a", " ", "URL", " ", "to", " ", "urlpa", "tter", "ns", ":", " ", " ", "url", "(", "r", "'", "^", "blog", "/'", ",", " ", "include", "(", "blog", "\\u", "urls", "))\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "[_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
danielfm/django-flash/src/djangoflash/codec/json_zlib_impl.py
[ { "content": "# -*- coding: utf-8 -*-\n\n\"\"\"This module provides a JSON-based codec implementation that uses the\n:mod:`zlib` module to reduce the encoded flash footprint.\n\"\"\"\n\nimport zlib\n\nfrom djangoflash.codec.json_impl import CodecClass as JSONCodecClass\nfrom djangoflash.models import FlashScope\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CodecClass(JSONCodecClass):\n \"\"\"JSON/zlib-based codec implementation.\n \"\"\"\n\n", "metadata": "root.CodecClass", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self):\n \"\"\"Returns a new JSON/zlib-based codec.\n \"\"\"\n JSONCodecClass.__init__(self)", "metadata": "root.CodecClass.__init__", "header": "['class', 'CodecClass', '(', 'JSONCodecClass', ')', ':', '___EOS___']", "index": 15 }, { "content": " def encode(self, flash):\n \"\"\"Encodes the given *flash* as a zlib compressed JSON string.\n \"\"\"\n return zlib.compress(JSONCodecClass.encode(self, flash))", "metadata": "root.CodecClass.encode", "header": "['class', 'CodecClass', '(', 'JSONCodecClass', ')', ':', '___EOS___']", "index": 20 }, { "content": " def decode(self, encoded_flash):\n \"\"\"Restores the *flash* from the given zlib compressed JSON string.\n \"\"\"\n return JSONCodecClass.decode(self, zlib.decompress(encoded_flash))", "metadata": "root.CodecClass.decode", "header": "['class', 'CodecClass', '(', 'JSONCodecClass', ')', ':', '___EOS___']", "index": 25 } ]
[ { "span": "from djangoflash.models import FlashScope", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 41 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "module", " ", "provide", "s", " ", "a", " ", "JSO", "N", "-", "based", " ", "codec", " ", "implementation", " ", "tha", "t", " ", "use", "s", " ", "the", "\\", "10", ";", ":", "mod", ":`", "zli", "b", "`", " ", "module", " ", "to", " ", "reduce", " ", "the", " ", "encode", "d", " ", "flash", " ", "footprint", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "flash_", "._", "codec_", "._", "json", "\\u", "impl_", "import_", "Code", "c", "Class_", "as_", "JSO", "NC", "ode", "c", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "flash_", "._", "models_", "import_", "Fla", "sh", "Scope_", "\\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_", "Code", "c", "Class_", "(_", "JSO", "NC", "ode", "c", "Class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "JSO", "N", "/", "zli", "b", "-", "based", " ", "codec", " ", "implementation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Code", "c", "Class_", "(_", "JSO", "NC", "ode", "c", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "new", " ", "JSO", "N", "/", "zli", "b", "-", "based", " ", "codec", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JSO", "NC", "ode", "c", "Class_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code", "c", "Class_", "(_", "JSO", "NC", "ode", "c", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode_", "(_", "self_", ",_", "flash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Encode", "s", " ", "the", " ", "give", "n", " ", "*", "flash", "*", " ", "as", " ", "a", " ", "zli", "b", " ", "compress", "ed", " ", "JSO", "N", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "zlib_", "._", "compress_", "(_", "JSO", "NC", "ode", "c", "Class_", "._", "encode_", "(_", "self_", ",_", "flash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code", "c", "Class_", "(_", "JSO", "NC", "ode", "c", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode_", "(_", "self_", ",_", "encode", "d\\u", "flash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Restor", "es", " ", "the", " ", "*", "flash", "*", " ", "from", " ", "the", " ", "give", "n", " ", "zli", "b", " ", "compress", "ed", " ", "JSO", "N", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "JSO", "NC", "ode", "c", "Class_", "._", "decode_", "(_", "self_", ",_", "zlib_", "._", "decompress_", "(_", "encode", "d\\u", "flash_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Variable defined multiple times
shish/eve-mlp/eve_mlp/gui/mainframe.py
[ { "content": " def __menu(self):\n menu_bar = wx.MenuBar()\n\n ################################################################\n menu = wx.Menu()\n m_exit = menu.Append(wx.ID_EXIT, \"E&xit\\tAlt-X\", \"Close window and exit program.\")\n self.Bind(wx.EVT_MENU, self.OnClose, m_exit)\n menu_bar.Append(menu, \"&File\")\n\n ################################################################\n menu = wx.Menu()\n\n m_rempasswd = menu.Append(2020, \"Remember Passwords\", \"\", kind=wx.ITEM_CHECK)\n self.m_rempasswd = m_rempasswd # event handler needs this object, not just ID?\n if self.config.settings[\"remember-passwords\"]:\n m_rempasswd.Check(True)\n self.Bind(wx.EVT_MENU, self.OnToggleRememberPasswords, m_rempasswd)\n\n m_start_tray = menu.Append(2021, \"Start in Systray\", \"\", kind=wx.ITEM_CHECK)\n self.m_start_tray = m_start_tray # event handler needs this object, not just ID?\n if self.config.settings[\"start-tray\"]:\n m_start_tray.Check(True)\n self.Bind(wx.EVT_MENU, self.OnToggleStartTray, m_start_tray)\n\n menu_bar.Append(menu, \"&Options\")\n\n ################################################################\n menu = wx.Menu()\n m_exit = menu.Append(wx.ID_EXIT, \"Launch Patcher\", \"\")\n m_exit = menu.Append(wx.ID_EXIT, \"Launch Repair\", \"\")\n #self.Bind(wx.EVT_MENU, self.OnClose, m_exit)\n #menu_bar.Append(menu, \"&Tools\")\n\n ################################################################\n menu = wx.Menu()\n m_about = menu.Append(wx.ID_ABOUT, \"&About\", \"Information about this program\")\n self.Bind(wx.EVT_MENU, self.OnAbout, m_about)\n menu_bar.Append(menu, \"&Help\")\n\n return menu_bar", "metadata": "root.MainFrame.__menu", "header": "['class', 'MainFrame', '(', 'wx', '.', 'Frame', ')', ':', '___EOS___']", "index": 24 } ]
[ { "span": "m_exit ", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 14 } ]
[ { "span": "m_exit ", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 14 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Main", "Frame_", "(_", "wx_", "._", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "menu_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu", "\\u", "bar_", "=_", "wx_", "._", "Menu", "Bar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "menu_", "=_", "wx_", "._", "Menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "exit_", "=_", "menu_", "._", "Append_", "(_", "wx_", "._", "ID", "\\u", "EXIT", "_", ",_", "\"", "E", "&", "xit", "\\\\", "t", "Alt", "-", "X", "\"_", ",_", "\"", "Clos", "e", " ", "window", " ", "and", " ", "exit", " ", "program", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Bind_", "(_", "wx_", "._", "EV", "T", "\\u", "MENU_", ",_", "self_", "._", "On", "Close_", ",_", "m", "\\u", "exit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu", "\\u", "bar_", "._", "Append_", "(_", "menu_", ",_", "\"&", "File", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "menu_", "=_", "wx_", "._", "Menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m", "\\u", "rem", "passwd_", "=_", "menu_", "._", "Append_", "(_", "2020_", ",_", "\"", "Reme", "mber", " ", "Passw", "ords", "\"_", ",_", "\"\"_", ",_", "kind_", "=_", "wx_", "._", "ITEM", "\\u", "CHECK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "m", "\\u", "rem", "passwd_", "=_", "m", "\\u", "rem", "passwd_", "#", " ", "event", " ", "handler", " ", "need", "s", " ", "this", " ", "object", ",", " ", "not", " ", "just", " ", "ID", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "config_", "._", "settings_", "[_", "\"", "remember", "-", "passwords", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "rem", "passwd_", "._", "Check_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Bind_", "(_", "wx_", "._", "EV", "T", "\\u", "MENU_", ",_", "self_", "._", "On", "Toggle", "Reme", "mber", "Passw", "ords_", ",_", "m", "\\u", "rem", "passwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m", "\\u", "start", "\\u", "tray", "_", "=_", "menu_", "._", "Append_", "(_", "202", "1_", ",_", "\"", "Start", " ", "in", " ", "Sys", "tray", "\"_", ",_", "\"\"_", ",_", "kind_", "=_", "wx_", "._", "ITEM", "\\u", "CHECK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "m", "\\u", "start", "\\u", "tray", "_", "=_", "m", "\\u", "start", "\\u", "tray", "_", "#", " ", "event", " ", "handler", " ", "need", "s", " ", "this", " ", "object", ",", " ", "not", " ", "just", " ", "ID", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "config_", "._", "settings_", "[_", "\"", "start", "-", "tray", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "start", "\\u", "tray", "_", "._", "Check_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Bind_", "(_", "wx_", "._", "EV", "T", "\\u", "MENU_", ",_", "self_", "._", "On", "Toggle", "Start", "Tra", "y_", ",_", "m", "\\u", "start", "\\u", "tray", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "menu", "\\u", "bar_", "._", "Append_", "(_", "menu_", ",_", "\"&", "Optio", "ns", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "menu_", "=_", "wx_", "._", "Menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "exit_", "=_", "menu_", "._", "Append_", "(_", "wx_", "._", "ID", "\\u", "EXIT", "_", ",_", "\"", "Launch", " ", "Patche", "r", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "exit_", "=_", "menu_", "._", "Append_", "(_", "wx_", "._", "ID", "\\u", "EXIT", "_", ",_", "\"", "Launch", " ", "Repair", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "Bind", "(", "wx", ".", "EV", "T", "\\u", "MENU", ",", " ", "self", ".", "On", "Clos", "e", ",", " ", "m", "\\u", "exit", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "menu", "\\u", "bar", ".", "Append", "(", "menu", ",", " ", "\"&", "Tool", "s", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "menu_", "=_", "wx_", "._", "Menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "about_", "=_", "menu_", "._", "Append_", "(_", "wx_", "._", "ID", "\\u", "ABO", "UT_", ",_", "\"&", "Abo", "ut", "\"_", ",_", "\"", "Information", " ", "abo", "ut", " ", "this", " ", "program", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Bind_", "(_", "wx_", "._", "EV", "T", "\\u", "MENU_", ",_", "self_", "._", "On", "About_", ",_", "m", "\\u", "about_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu", "\\u", "bar_", "._", "Append_", "(_", "menu_", ",_", "\"&", "Help", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "menu", "\\u", "bar_", "\\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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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 ]
Unused local variable
cloudera/hue/desktop/core/ext-py/Django-1.6.10/tests/expressions_regress/tests.py
[ { "content": " def test_delta_invalid_op_mult(self):\n raised = False\n try:\n r = repr(Experiment.objects.filter(end__lt=F('start')*self.deltas[0]))\n except TypeError:\n raised = True\n self.assertTrue(raised, \"TypeError not raised on attempt to multiply datetime by timedelta.\")", "metadata": "root.FTimeDeltaTests.test_delta_invalid_op_mult", "header": "['class', 'FTimeDeltaTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 363 }, { "content": " def test_delta_invalid_op_div(self):\n raised = False\n try:\n r = repr(Experiment.objects.filter(end__lt=F('start')/self.deltas[0]))\n except TypeError:\n raised = True\n self.assertTrue(raised, \"TypeError not raised on attempt to divide datetime by timedelta.\")", "metadata": "root.FTimeDeltaTests.test_delta_invalid_op_div", "header": "['class', 'FTimeDeltaTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 371 }, { "content": " def test_delta_invalid_op_mod(self):\n raised = False\n try:\n r = repr(Experiment.objects.filter(end__lt=F('start')%self.deltas[0]))\n except TypeError:\n raised = True\n self.assertTrue(raised, \"TypeError not raised on attempt to modulo divide datetime by timedelta.\")", "metadata": "root.FTimeDeltaTests.test_delta_invalid_op_mod", "header": "['class', 'FTimeDeltaTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 379 }, { "content": " def test_delta_invalid_op_and(self):\n raised = False\n try:\n r = repr(Experiment.objects.filter(end__lt=F('start').bitand(self.deltas[0])))\n except TypeError:\n raised = True\n self.assertTrue(raised, \"TypeError not raised on attempt to binary and a datetime with a timedelta.\")", "metadata": "root.FTimeDeltaTests.test_delta_invalid_op_and", "header": "['class', 'FTimeDeltaTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 387 }, { "content": " def test_delta_invalid_op_or(self):\n raised = False\n try:\n r = repr(Experiment.objects.filter(end__lt=F('start').bitor(self.deltas[0])))\n except TypeError:\n raised = True\n self.assertTrue(raised, \"TypeError not raised on attempt to binary or a datetime with a timedelta.\")", "metadata": "root.FTimeDeltaTests.test_delta_invalid_op_or", "header": "['class', 'FTimeDeltaTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 395 } ]
[ { "span": "r ", "start_line": 366, "start_column": 12, "end_line": 366, "end_column": 13 }, { "span": "r ", "start_line": 374, "start_column": 12, "end_line": 374, "end_column": 13 }, { "span": "r ", "start_line": 382, "start_column": 12, "end_line": 382, "end_column": 13 }, { "span": "r ", "start_line": 390, "start_column": 12, "end_line": 390, "end_column": 13 }, { "span": "r ", "start_line": 398, "start_column": 12, "end_line": 398, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "FT", "ime", "Del", "ta", "Tests_", "(_", "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", "delta", "\\u", "invalid", "\\u", "op", "\\u", "mult_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raised_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "repr_", "(_", "Experiment_", "._", "objects_", "._", "filter_", "(_", "end", "\\u\\u", "lt_", "=_", "F_", "(_", "'", "start", "'_", ")_", "*_", "self_", "._", "deltas_", "[_", "0_", "]_", ")_", ")_", "\\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 ", " _", "raised_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "raised_", ",_", "\"", "Type", "Error", " ", "not", " ", "raise", "d", " ", "on", " ", "atte", "mpt", " ", "to", " ", "multipl", "y", " ", "datetime", " ", "by", " ", "timedelta", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FT", "ime", "Del", "ta", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delta", "\\u", "invalid", "\\u", "op", "\\u", "div_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raised_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "repr_", "(_", "Experiment_", "._", "objects_", "._", "filter_", "(_", "end", "\\u\\u", "lt_", "=_", "F_", "(_", "'", "start", "'_", ")_", "/_", "self_", "._", "deltas_", "[_", "0_", "]_", ")_", ")_", "\\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 ", " _", "raised_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "raised_", ",_", "\"", "Type", "Error", " ", "not", " ", "raise", "d", " ", "on", " ", "atte", "mpt", " ", "to", " ", "divide", " ", "datetime", " ", "by", " ", "timedelta", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FT", "ime", "Del", "ta", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delta", "\\u", "invalid", "\\u", "op", "\\u", "mod_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raised_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "repr_", "(_", "Experiment_", "._", "objects_", "._", "filter_", "(_", "end", "\\u\\u", "lt_", "=_", "F_", "(_", "'", "start", "'_", ")_", "%_", "self_", "._", "deltas_", "[_", "0_", "]_", ")_", ")_", "\\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 ", " _", "raised_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "raised_", ",_", "\"", "Type", "Error", " ", "not", " ", "raise", "d", " ", "on", " ", "atte", "mpt", " ", "to", " ", "modulo", " ", "divide", " ", "datetime", " ", "by", " ", "timedelta", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FT", "ime", "Del", "ta", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delta", "\\u", "invalid", "\\u", "op", "\\u", "and_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raised_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "repr_", "(_", "Experiment_", "._", "objects_", "._", "filter_", "(_", "end", "\\u\\u", "lt_", "=_", "F_", "(_", "'", "start", "'_", ")_", "._", "bita", "nd_", "(_", "self_", "._", "deltas_", "[_", "0_", "]_", ")_", ")_", ")_", "\\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 ", " _", "raised_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "raised_", ",_", "\"", "Type", "Error", " ", "not", " ", "raise", "d", " ", "on", " ", "atte", "mpt", " ", "to", " ", "binar", "y", " ", "and", " ", "a", " ", "datetime", " ", "with", " ", "a", " ", "timedelta", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FT", "ime", "Del", "ta", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delta", "\\u", "invalid", "\\u", "op", "\\u", "or_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raised_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "repr_", "(_", "Experiment_", "._", "objects_", "._", "filter_", "(_", "end", "\\u\\u", "lt_", "=_", "F_", "(_", "'", "start", "'_", ")_", "._", "bit", "or_", "(_", "self_", "._", "deltas_", "[_", "0_", "]_", ")_", ")_", ")_", "\\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 ", " _", "raised_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "raised_", ",_", "\"", "Type", "Error", " ", "not", " ", "raise", "d", " ", "on", " ", "atte", "mpt", " ", "to", " ", "binar", "y", " ", "or", " ", "a", " ", "datetime", " ", "with", " ", "a", " ", "timedelta", ".\"_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
rvanlaar/easy-transifex/src/transifex/transifex/resources/tests/views/views.py
[ { "content": "# -*- coding: utf-8 -*-\nimport os\nfrom django.utils import simplejson\nfrom django.core.urlresolvers import reverse\nfrom django.core import serializers\nfrom django.test.client import Client\nfrom django.utils import simplejson as json\nfrom transifex.languages.models import Language\nfrom transifex.resources.models import Resource, Translation, Template, \\\n SourceEntity\nfrom transifex.txcommon.tests import base, utils\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CoreViewsTest(base.BaseTestCase):\n \"\"\"Test basic view function\"\"\"\n\n\n\n\n #def test_resource_file_upload(self):\n # raise NotImplementedError\n\n #def test_resource_file_download(self):\n # \"\"\"Test that downloading a reosurce with a template file works.\"\"\"\n # # We first need a test that creates a resource with a template.\n # raise NotImplementedError\n # resp = self.client['registered'].get(\n # reverse('download_translation',\n # args=[self.project.slug, self.resource.slug, self.language.code]), follow=True)\n # self.assertEqual(resp.status_code, 200)\n # self.assertTrue('project1_resource1.po' in resp['Content-Disposition'])\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.CoreViewsTest", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def test_resource_details(self):\n \"\"\"\n Test resource details of a resource.\n \"\"\"\n\n # Check details page\n resp = self.client['maintainer'].get(self.urls['resource'])\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n # Test if RLStats was created automatically\n self.assertTrue(self.team.language.name.encode('utf-8') in resp.content)\n\n # response.context[-1] holds our extra_context. maybe we should check\n # some of these to make sure they're there?", "metadata": "root.CoreViewsTest.test_resource_details", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_resource_delete(self):\n \"\"\"\n Test resource delete view.\n \"\"\"\n\n slug=self.resource.slug\n # Check if resource gets deleted successfully\n resp = self.client['maintainer'].post(reverse('resource_delete',\n args=[self.project.slug, self.resource.slug]))\n self.assertEqual(resp.status_code, 302)\n self.assertEqual(Resource.objects.filter(slug=slug,\n project__slug=self.project.slug).count(), 0)", "metadata": "root.CoreViewsTest.test_resource_delete", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_resource_actions(self):\n \"\"\"\n Test AJAX resource actions.\n \"\"\"\n url = self.urls['resource_actions']\n\n # Test response for maintainer\n resp = self.client['maintainer'].get(url)\n self.assertEqual(resp.status_code, 200)\n self.assertContains(resp, \"Translate now\")\n self.assertTemplateUsed(resp, 'resources/resource_actions.html')\n\n url_lock = reverse('resource_language_lock', args=[self.project.slug, self.resource.slug, self.language.code])\n\n # Test response for registered user WITHOUT lock\n resp = self.client['registered'].get(url)\n self.assertContains(resp, \"This translation isn't locked\")\n self.assertContains(resp, \"Translate now\")\n\n # Test response for team_member WITHOUT lock\n resp = self.client['team_member'].get(url)\n self.assertContains(resp, \"Lock this translation to notify others\")\n self.assertContains(resp, \"Translate now\")\n\n # Test response for team_member WITH lock\n resp = self.client['team_member'].post(url_lock)\n resp = self.client['team_member'].get(url)\n self.assertContains(resp, \"Translate now\")\n\n # Test response for team_coordinator WITH resource locked by someone else\n resp = self.client['team_coordinator'].get(url)\n self.assertContains(resp, \"This resource is currently locked by\")\n\n # Test response for registered user WITH resource locked by someone else\n resp = self.client['registered'].get(url)\n self.assertContains(resp, \"you need to be logged in and a member\")", "metadata": "root.CoreViewsTest.test_resource_actions", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_project_resources(self):\n \"\"\"\n Test view that fetches project resources\n \"\"\"\n\n resp = self.client['maintainer'].get(reverse('project_resources',\n args=[self.project.slug, 0]))\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_list_more.html')\n for r in Resource.objects.filter(project=self.project)[0:4]:\n self.assertTrue(r.name in resp.content)", "metadata": "root.CoreViewsTest.test_project_resources", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_clone_language(self):\n url = reverse(\n 'clone_translate', args=[\n self.project.slug, self.resource.slug, self.language_ar.code,\n self.language.code\n ])\n resp = self.client['maintainer'].post(url, follow=True)\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(\n [i.string for i in Translation.objects.filter(\n source_entity__resource=self.resource, language=self.language_ar\n )],\n [i.string for i in Translation.objects.filter(\n source_entity__resource=self.resource, language=self.language\n )]\n )", "metadata": "root.CoreViewsTest.test_clone_language", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_push_translation(self):\n \"\"\"\n Test translation push view.\n \"\"\"\n # Create primary language translation. This is needed to push\n # additional translations\n source_trans = Translation(\n source_entity=self.source_entity,\n language = self.language,\n string=\"foobar\",\n resource=self.resource\n )\n source_trans.save()\n\n trans_lang = 'el'\n trans = \"foo\"\n new_trans = \"foo2\"\n # Create new translation\n # FIXME: Test plurals\n resp = self.client['maintainer'].post(reverse('push_translation',\n args=[self.project.slug, trans_lang]),\n json.dumps({'strings':[{'id':source_trans.id,'translations':{'other':trans}}]}),\n content_type='application/json' )\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(Translation.objects.filter(source_entity__resource=self.resource,\n language__code = trans_lang, string=trans).count(), 1)\n\n # Update existing translation\n resp = self.client['maintainer'].post(reverse('push_translation',\n args=[self.project.slug, trans_lang]),\n json.dumps({'strings':[{'id': source_trans.id,\n 'translations':{'other':new_trans}}]}),\n content_type='application/json')\n self.assertEqual(resp.status_code, 200)\n translations = Translation.objects.filter(source_entity__resource=self.resource,\n language__code = trans_lang, string=new_trans)\n self.assertEqual(translations.count(), 1)\n\n source_trans.delete()\n translations.delete()", "metadata": "root.CoreViewsTest.test_push_translation", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 123 }, { "content": " def test_delete_resource_translations(self):\n \"\"\"\n Test resource translation deletion\n \"\"\"\n # Create primary language translation. This is needed to push\n # additional translations\n source_trans = Translation(\n source_entity=self.source_entity, language=self.language,\n string=\"foobar\", resource=self.resource\n )\n source_trans.save()\n\n trans_lang = 'el'\n trans = \"foo\"\n # Create new translation\n resp = self.client['maintainer'].post(reverse('push_translation',\n args=[self.project.slug, trans_lang]),\n json.dumps({'strings':[{'id':source_trans.id,\n 'translations': { 'other': trans}}]}),\n content_type='application/json')\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(Translation.objects.filter(source_entity__resource=self.resource,\n language__code = trans_lang, string =trans).count(), 1)\n\n # Delete Translations\n # Delete source language translations\n delete_url = reverse('resource_translations_delete',\n args=[self.project.slug, self.resource.slug,self.language.code])\n resp = self.client['maintainer'].get(delete_url)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_translations_confirm_delete.html')\n\n resp = self.client['maintainer'].post(delete_url, follow=True)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(Translation.objects.filter(source_entity__resource=self.resource,\n language = self.language).count(), 0)\n\n # Delete target language translations\n delete_url_el = reverse('resource_translations_delete',\n args=[self.project.slug, self.resource.slug, trans_lang])\n resp = self.client['maintainer'].get(delete_url_el)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_translations_confirm_delete.html')\n\n resp = self.client['maintainer'].post(delete_url_el, follow=True)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(Translation.objects.filter(source_entity__resource=self.resource,\n language__code = trans_lang).count(), 0)", "metadata": "root.CoreViewsTest.test_delete_resource_translations", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 165 }, { "content": " def test_resource_edit(self, file_handler=None, bad=False):\n \"\"\"Test editing a resource\"\"\"\n if file_handler:\n fh = file_handler\n else:\n fh = open('%s/../lib/pofile/tests.pot'% os.path.split(__file__)[0],)\n url = reverse('resource_edit', args=[self.project.slug, self.resource.slug])\n DATA = {'slug':'resource1', 'name':'Resource1', 'accept_translations':'on', 'sourcefile':fh, 'source_file_url':'',}\n resp = self.client['maintainer'].post(url, DATA, follow=True)\n if file_handler:\n return resp\n else:\n self.assertEqual(resp.status_code, 200)", "metadata": "root.CoreViewsTest.test_resource_edit", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 216 }, { "content": " def test_get_pot_file(self):\n \"\"\"Test retrieval of pot files\"\"\"\n self.test_resource_edit()\n url = reverse('download_pot', args=[self.project.slug, self.resource.slug])\n resp = self.client['registered'].get(url, follow=True)\n self.assertContains(resp, 'msgid', status_code=200)", "metadata": "root.CoreViewsTest.test_get_pot_file", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 230 }, { "content": " def test_get_translation_file(self):\n \"\"\"Test download of a translation file\"\"\"\n self.test_resource_edit()\n url = reverse('download_translation', args=[self.project.slug, self.resource.slug, self.language.code])\n resp = self.client['maintainer'].post(url)\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('project1_resource1_pt_BR.po' in resp['Content-Disposition'])", "metadata": "root.CoreViewsTest.test_get_translation_file", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 237 }, { "content": " def test_lock_and_get_translation_file(self):\n \"\"\"Test lock and get translation file\"\"\"\n self.test_resource_edit()\n url = reverse('lock_and_download_translation',\n args=[self.project.slug, self.resource.slug, self.language.code])\n resp = self.client['maintainer'].post(url)\n self.assertEqual(resp.status_code, 200)\n json = simplejson.loads(resp.content)\n self.assertEqual(json['status'], 'OK')\n self.assertEqual(json['redirect'], '/projects/p/%s/resource/%s/l/%s/download/'\n %(self.project.slug, self.resource.slug, self.language.code))", "metadata": "root.CoreViewsTest.test_lock_and_get_translation_file", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test_different_resource_formats(self):\n \"\"\"Test creation of resource with different source file formats\"\"\"\n #javaproperties\n fh = open('%s/../lib/javaproperties/complex.properties'%os.path.split(__file__)[0],)\n self.resource.i18n_method = 'PROPERTIES'\n self.resource.save()\n resp = self.test_resource_edit(fh)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(SourceEntity.objects.filter(resource=self.resource).count(), 25)\n\n #Qt\n fh = open('%s/../lib/qt/en.ts'%os.path.split(__file__)[0],)\n self.resource.i18n_method = 'QT'\n self.resource.save()\n resp = self.test_resource_edit(fh)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(SourceEntity.objects.filter(resource=self.resource).count(), 43)\n\n #Joomla\n fh = open('%s/../lib/joomla_ini/example1.5.ini'%os.path.split(__file__)[0],)\n self.resource.i18n_method = 'INI'\n self.resource.save()\n resp = self.test_resource_edit(fh)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(SourceEntity.objects.filter(resource=self.resource).count(), 1)\n\n #Desktop\n fh = open('%s/../lib/desktop/data/okular.desktop'%os.path.split(__file__)[0],)\n self.resource.i18n_method = 'DESKTOP'\n self.resource.save()\n resp = self.test_resource_edit(fh)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(SourceEntity.objects.filter(resource=self.resource).count(), 2)\n\n\n #bad file\n fh = open('%s/../lib/pofile/wrong.pot'%os.path.split(__file__)[0],)\n self.resource.i18n_method = 'POT'\n self.resource.save()\n resp = self.test_resource_edit(fh)\n self.assertContains(resp, 'Syntax error in po file', status_code=200)\n #Since source entities will not be updated\n self.assertEqual(SourceEntity.objects.filter(resource=self.resource).count(), 2)\n self.resource.i18n_method = 'PO'\n self.resource.save()", "metadata": "root.CoreViewsTest.test_different_resource_formats", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 257 }, { "content": "class ResourceAutofetchTests(base.BaseTestCase):\n\n\n\n\n\n", "metadata": "root.ResourceAutofetchTests", "header": "['module', '___EOS___']", "index": 304 }, { "content": " def setUp(self, *args, **kwargs):\n super(ResourceAutofetchTests, self).setUp(*args, **kwargs)\n self.SFILE = \"http://meego.gitorious.org/meego-netbook-ux/abrt-netbook/blobs/raw/master/po/en_GB.po\"\n self.url_edit = reverse('resource_edit', args=[self.project.slug, self.resource.slug])", "metadata": "root.ResourceAutofetchTests.setUp", "header": "['class', 'ResourceAutofetchTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 306 }, { "content": " def test_save_form_url(self):\n \"\"\"Test that saving the form creates the source URL.\"\"\"\n resp = self.client['maintainer'].post(self.url_edit, {\n 'source_file_url': self.SFILE, 'auto_update': 'on',\n 'sourcefile': '', 'accept_translations': 'on',\n 'slug': self.resource.slug, 'name': self.resource.name, })\n self.assertEquals(self.resource.url_info.source_file_url, self.SFILE)\n resp = self.client['maintainer'].get(self.url_edit)\n self.assertContains(resp, self.SFILE)", "metadata": "root.ResourceAutofetchTests.test_save_form_url", "header": "['class', 'ResourceAutofetchTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 312 }, { "content": " def test_save_form_remove_url(self):\n \"\"\"Test that saving the form without a source file URL removes it.\"\"\"\n\n # First create the source file...\n self.test_save_form_url()\n\n # Then try to remove it.\n resp = self.client['maintainer'].post(self.url_edit,\n {'source_file_url': '', 'sourcefile': '',\n 'accept_translations': 'on', 'slug': self.resource.slug,\n 'name': self.resource.name, })\n resp = self.client['maintainer'].get(self.url_edit)\n self.assertNotContains(resp, self.SFILE)\n resp = self.client['anonymous'].get(self.urls['resource'])\n self.assertNotContains(resp, self.SFILE)", "metadata": "root.ResourceAutofetchTests.test_save_form_remove_url", "header": "['class', 'ResourceAutofetchTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 322 }, { "content": " def test_save_form_url_nourl(self):\n \"\"\"Test that autofetch without url does not work.\"\"\"\n resp = self.client['maintainer'].post(self.url_edit,\n {'source_file_url': '', 'auto_update': 'on', 'sourcefile': '',\n 'accept_translations': 'on', 'slug': self.resource.slug,\n 'name': self.resource.name, })\n self.assertContains(resp, \"You have checked the auto update checkbox\")", "metadata": "root.ResourceAutofetchTests.test_save_form_url_nourl", "header": "['class', 'ResourceAutofetchTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 339 }, { "content": "class ReleasesViewsTest(base.BaseTestCase):\n\n", "metadata": "root.ReleasesViewsTest", "header": "['module', '___EOS___']", "index": 349 }, { "content": " def setUp(self, *args, **kwargs):\n super(ReleasesViewsTest, self).setUp(*args, **kwargs)\n self.release = self.project.releases.create(slug='release1', name='Release1')\n self.release.resources.add(self.resource)", "metadata": "root.ReleasesViewsTest.setUp", "header": "['class', 'ReleasesViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 351 }, { "content": " def test_release_detail_page(self):\n resp = self.client['registered'].get(self.urls['release'])\n self.assertContains(resp, \"This release has 1 resource\", status_code=200)\n\n # FIXME: Check if the correct language appears in the table.\n self.assertContains(resp, \"Portuguese\", status_code=200)\n #raise NotImplementedError('Test if the table has the correct languages.')", "metadata": "root.ReleasesViewsTest.test_release_detail_page", "header": "['class', 'ReleasesViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 356 }, { "content": "class ResourcesLookupsTests(base.BaseTestCase):\n", "metadata": "root.ResourcesLookupsTests", "header": "['module', '___EOS___']", "index": 365 }, { "content": " def test_private_resources_ajax_lookup(self):\n \"\"\"Test that a private resource isn't present in lookup.\n\n This AJAX lookup/dropdown is present in the Release Add/Edit form.\n \"\"\"\n\n public_project = \"Test Project: Resource1\"\n private_project = \"Test Private Project: Resource1\"\n\n # Test that a private project is not visible to a random user\n self.assertTrue(self.user['registered'] not in self.project_private.maintainers.all())\n resp = self.client['registered'].get('/ajax/ajax_lookup/resources', {'q': 'r', 'limit': '150', })\n self.assertContains(resp, public_project, status_code=200)\n self.assertNotContains(resp, private_project, status_code=200)\n\n # Test that a private project is visible to its maintainer\n self.assertTrue(self.user['maintainer'] in self.project_private.maintainers.all())\n resp = self.client['maintainer'].get('/ajax/ajax_lookup/resources', {'q': 'r', 'limit': '150', })\n self.assertContains(resp, public_project, status_code=200)\n self.assertContains(resp, private_project, status_code=200)\n\n # Test that a private project is visible to a member of its teams\n self.assertTrue(self.user['team_member'] in self.team_private.members.all())\n self.assertFalse(self.user['team_member'] in self.project_private.maintainers.all())\n resp = self.client['team_member'].get('/ajax/ajax_lookup/resources', {'q': 'r', 'limit': '150', })\n self.assertContains(resp, public_project, status_code=200)\n self.assertContains(resp, private_project, status_code=200)", "metadata": "root.ResourcesLookupsTests.test_private_resources_ajax_lookup", "header": "['class', 'ResourcesLookupsTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 367 } ]
[ { "span": "from django.core import serializers", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 35 }, { "span": "from django.test.client import Client", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 37 }, { "span": "from transifex.languages.models import Language", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 47 }, { "span": "from transifex.resources.models import Resource, Translation, Template, \\\n SourceEntity", "start_line": 8, "start_column": 0, "end_line": 9, "end_column": 20 }, { "span": "from transifex.txcommon.tests import base, utils", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "languages_", "._", "models_", "import_", "Language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "resources_", "._", "models_", "import_", "Resource_", ",_", "Translation_", ",_", "Template_", ",_", "Sou", "rce", "Entity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "tx", "common_", "._", "tests_", "import_", "base_", ",_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Core", "View", "s", "Test_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "basic", " ", "view", " ", "function", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "test\\u", "resource", "\\u", "file", "\\u", "upload", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "raise", " ", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "test\\u", "resource", "\\u", "file", "\\u", "download", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"", "Test", " ", "tha", "t", " ", "download", "ing", " ", "a", " ", "reo", "sur", "ce", " ", "with", " ", "a", " ", "template", " ", "file", " ", "works", ".\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "We", " ", "first", " ", "need", " ", "a", " ", "test", " ", "tha", "t", " ", "create", "s", " ", "a", " ", "resource", " ", "with", " ", "a", " ", "template", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "raise", " ", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "resp", " ", "=", " ", "self", ".", "client", "['", "register", "ed", "']", ".", "get", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "reverse", "('", "download", "\\u", "translatio", "n", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", "=[", "self", ".", "project", ".", "slug", ",", " ", "self", ".", "resource", ".", "slug", ",", " ", "self", ".", "language", ".", "code", "])", ",", " ", "follow", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "resp", ".", "status", "\\u", "code", ",", " ", "200", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Tru", "e", "('", "project", "1", "\\u", "resource", "1", ".", "po", "'", " ", "in", " ", "resp", "['", "Conten", "t", "-", "Dispo", "sition", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "View", "s", "Test_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "resource", "\\u", "details_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "resource", " ", "deta", "il", "s", " ", "of", " ", "a", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "deta", "il", "s", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "self_", "._", "urls_", "[_", "'", "resource", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "if", " ", "RL", "Stat", "s", " ", "was", " ", "created", " ", "automati", "call", "y_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "team_", "._", "language_", "._", "name_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "in_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", ".", "context", "[-", "1", "]", " ", "hold", "s", " ", "our", " ", "extra", "\\u", "context", ".", " ", "may", "be", " ", "we", " ", "shou", "ld", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "of", " ", "these", " ", "to", " ", "make", " ", "sure", " ", "the", "y", "'", "re", " ", "there", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "resource", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "resource", " ", "delete", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", "=_", "self_", "._", "resource_", "._", "slug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "resource", " ", "gets", " ", "delete", "d", " ", "success", "full", "y_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "reverse_", "(_", "'", "resource", "\\u", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Resource_", "._", "objects_", "._", "filter_", "(_", "slug_", "=_", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "slug_", "=_", "self_", "._", "project_", "._", "slug_", ")_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "resource", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "AJ", "AX", " ", "resource", " ", "action", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "urls_", "[_", "'", "resource", "\\u", "action", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "response", " ", "for", " ", "maintainer_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Translate", " ", "now", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "action", "s", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "lock_", "=_", "reverse_", "(_", "'", "resource", "\\u", "language", "\\u", "lock", "'_", ",_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "response", " ", "for", " ", "register", "ed", " ", "user", " ", "WITH", "OUT", " ", "lock_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Thi", "s", " ", "translatio", "n", " ", "isn", "'", "t", " ", "lock", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Translate", " ", "now", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "response", " ", "for", " ", "team", "\\u", "member", " ", "WITH", "OUT", " ", "lock_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Lock", " ", "this", " ", "translatio", "n", " ", "to", " ", "notif", "y", " ", "other", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Translate", " ", "now", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "response", " ", "for", " ", "team", "\\u", "member", " ", "WITH", " ", "lock_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "post_", "(_", "url", "\\u", "lock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Translate", " ", "now", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "response", " ", "for", " ", "team", "\\u", "coordinator", " ", "WITH", " ", "resource", " ", "lock", "ed", " ", "by", " ", "some", "one", " ", "else_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "team", "\\u", "coordinator", "'_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Thi", "s", " ", "resource", " ", "is", " ", "currentl", "y", " ", "lock", "ed", " ", "by", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "response", " ", "for", " ", "register", "ed", " ", "user", " ", " ", "WITH", " ", "resource", " ", "lock", "ed", " ", "by", " ", "some", "one", " ", "else_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "you", " ", "need", " ", "to", " ", "be", " ", "logged", " ", "in", " ", "and", " ", "a", " ", "member", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "project", "\\u", "resources_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "view", " ", "tha", "t", " ", "fetches", " ", "project", " ", "resource", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "project", "\\u", "resource", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "list", "\\u", "more", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "Resource_", "._", "objects_", "._", "filter_", "(_", "project_", "=_", "self_", "._", "project_", ")_", "[_", "0_", ":_", "4_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "r_", "._", "name_", "in_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "base_", "._", "Base", "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", "clone", "\\u", "language_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "clone", "\\u", "translat", "e", "'_", ",_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "self_", "._", "language", "\\u", "ar_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "language_", "._", "code_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "url_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "i_", "._", "string_", "for_", "i_", "in_", "Translation_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "language_", "=_", "self_", "._", "language", "\\u", "ar_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "i_", "._", "string_", "for_", "i_", "in_", "Translation_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "language_", "=_", "self_", "._", "language_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "push", "\\u", "translation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "translatio", "n", " ", "push", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "primary", " ", "language", " ", "translatio", "n", ".", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "to", " ", "push_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "trans_", "=_", "Translation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "entity_", "=_", "self_", "._", "source", "\\u", "entity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "self_", "._", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "string_", "=_", "\"", "fooba", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "trans_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trans", "\\u", "lang_", "=_", "'", "el", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "\"", "foo", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "trans_", "=_", "\"", "foo", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "new", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Test", " ", "plural", "s_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "reverse_", "(_", "'", "push", "\\u", "translatio", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "trans", "\\u", "lang_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "{_", "'", "string", "s", "'_", ":_", "[_", "{_", "'", "id", "'_", ":_", "source", "\\u", "trans_", "._", "id_", ",_", "'", "translatio", "ns", "'_", ":_", "{_", "'", "other", "'_", ":_", "trans_", "}_", "}_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language", "\\u\\u", "code_", "=_", "trans", "\\u", "lang_", ",_", "string_", "=_", "trans_", ")_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "exist", "ing", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "reverse_", "(_", "'", "push", "\\u", "translatio", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "trans", "\\u", "lang_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "{_", "'", "string", "s", "'_", ":_", "[_", "{_", "'", "id", "'_", ":_", "source", "\\u", "trans_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "translatio", "ns", "'_", ":_", "{_", "'", "other", "'_", ":_", "new", "\\u", "trans_", "}_", "}_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "translations_", "=_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language", "\\u\\u", "code_", "=_", "trans", "\\u", "lang_", ",_", "string_", "=_", "new", "\\u", "trans_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "translations_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "trans_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "translations_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "delete", "\\u", "resource", "\\u", "translations_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "resource", " ", "translatio", "n", " ", "deletion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "primary", " ", "language", " ", "translatio", "n", ".", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "to", " ", "push_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "trans_", "=_", "Translation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "entity_", "=_", "self_", "._", "source", "\\u", "entity_", ",_", "language_", "=_", "self_", "._", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "string_", "=_", "\"", "fooba", "r", "\"_", ",_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "trans_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trans", "\\u", "lang_", "=_", "'", "el", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "\"", "foo", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "new", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "reverse_", "(_", "'", "push", "\\u", "translatio", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "trans", "\\u", "lang_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "{_", "'", "string", "s", "'_", ":_", "[_", "{_", "'", "id", "'_", ":_", "source", "\\u", "trans_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "translatio", "ns", "'_", ":_", "{_", "'", "other", "'_", ":_", "trans_", "}_", "}_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language", "\\u\\u", "code_", "=_", "trans", "\\u", "lang_", ",_", "string_", "=_", "trans_", ")_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "Translat", "ions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "source", " ", "language", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "url_", "=_", "reverse_", "(_", "'", "resource", "\\u", "translatio", "ns", "\\u", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "delete", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "translatio", "ns", "\\u", "confirm", "\\u", "delete", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "delete", "\\u", "url_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "self_", "._", "language_", ")_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "target", " ", "language", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "url", "\\u", "el_", "=_", "reverse_", "(_", "'", "resource", "\\u", "translatio", "ns", "\\u", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "trans", "\\u", "lang_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "delete", "\\u", "url", "\\u", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "translatio", "ns", "\\u", "confirm", "\\u", "delete", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "delete", "\\u", "url", "\\u", "el_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language", "\\u\\u", "code_", "=_", "trans", "\\u", "lang_", ")_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "resource", "\\u", "edit_", "(_", "self_", ",_", "file", "\\u", "handler_", "=_", "None_", ",_", "bad_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "editin", "g", " ", "a", " ", "resource", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "=_", "file", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "=_", "open_", "(_", "'%", "s", "/../", "lib", "/", "pof", "ile", "/", "tests", ".", "pot", "'_", "%_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "'", "resource", "\\u", "edit", "'_", ",_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA_", "=_", "{_", "'", "slug", "'_", ":_", "'", "resource", "1", "'_", ",_", "'", "name", "'_", ":_", "'", "Reso", "urc", "e1", "'_", ",_", "'", "accept", "\\u", "translatio", "ns", "'_", ":_", "'", "on", "'_", ",_", "'", "sourcef", "ile", "'_", ":_", "fh_", ",_", "'", "source", "\\u", "file", "\\u", "url", "'_", ":_", "''_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "url_", ",_", "DATA_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "resp_", "\\u\\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_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "pot", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "retrie", "val", " ", "of", " ", "pot", " ", "files", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "'", "download", "\\u", "pot", "'_", ",_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "url_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "'", "msgid", "'_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "get", "\\u", "translatio", "n", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "download", " ", "of", " ", "a", " ", "translatio", "n", " ", "file", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "'", "download", "\\u", "translatio", "n", "'_", ",_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "project", "1", "\\u", "resource", "1", "\\u", "pt", "\\u", "BR", ".", "po", "'_", "in_", "resp_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "lock", "\\u", "and", "\\u", "get", "\\u", "translatio", "n", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "lock", " ", "and", " ", "get", " ", "translatio", "n", " ", "file", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "'", "lock", "\\u", "and", "\\u", "download", "\\u", "translatio", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "=_", "simplejson_", "._", "loads_", "(_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "json_", "[_", "'", "status", "'_", "]_", ",_", "'", "OK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "json_", "[_", "'", "redirec", "t", "'_", "]_", ",_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "resource", "/", "%", "s", "/", "l", "/", "%", "s", "/", "download", "/'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "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", "different", "\\u", "resource", "\\u", "formats_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "creati", "on", " ", "of", " ", "resource", " ", "with", " ", "different", " ", "source", " ", "file", " ", "formats", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "java", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "fh_", "=_", "open_", "(_", "'%", "s", "/../", "lib", "/", "java", "proper", "ties", "/", "complex", ".", "proper", "ties", "'_", "%_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "i18n", "\\u", "method_", "=_", "'", "PROPER", "TIES", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "count_", "(_", ")_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Qt_", "\\u\\u\\uNL\\u\\u\\u_", "fh_", "=_", "open_", "(_", "'%", "s", "/../", "lib", "/", "qt", "/", "en", ".", "ts", "'_", "%_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "i18n", "\\u", "method_", "=_", "'", "QT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "count_", "(_", ")_", ",_", "43_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Jo", "om", "la_", "\\u\\u\\uNL\\u\\u\\u_", "fh_", "=_", "open_", "(_", "'%", "s", "/../", "lib", "/", "jo", "om", "la", "\\u", "ini", "/", "example", "1.5", ".", "ini", "'_", "%_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "i18n", "\\u", "method_", "=_", "'", "INI", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Des", "kto", "p_", "\\u\\u\\uNL\\u\\u\\u_", "fh_", "=_", "open_", "(_", "'%", "s", "/../", "lib", "/", "desk", "top", "/", "data", "/", "oku", "lar", ".", "desk", "top", "'_", "%_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "i18n", "\\u", "method_", "=_", "'", "DES", "KT", "OP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "bad", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "fh_", "=_", "open_", "(_", "'%", "s", "/../", "lib", "/", "pof", "ile", "/", "wrong", ".", "pot", "'_", "%_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "i18n", "\\u", "method_", "=_", "'", "POT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "test\\u", "resource", "\\u", "edit_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "'", "Syntax", " ", "error", " ", "in", " ", "po", " ", "file", "'_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Sin", "ce", " ", "source", " ", "entit", "ies", " ", "will", " ", "not", " ", "be", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "i18n", "\\u", "method_", "=_", "'", "PO", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Auto", "fetch", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Auto", "fetch", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Reso", "urc", "e", "Auto", "fetch", "Tests_", ",_", "self_", ")_", "._", "set", "Up_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "SF", "ILE_", "=_", "\"", "http", "://", "mee", "go", ".", "git", "ori", "ous", ".", "org", "/", "mee", "go", "-", "netbo", "ok", "-", "ux", "/", "abr", "t", "-", "netbo", "ok", "/", "blobs", "/", "raw", "/", "master", "/", "po", "/", "en", "\\u", "GB", ".", "po", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "url", "\\u", "edit_", "=_", "reverse_", "(_", "'", "resource", "\\u", "edit", "'_", ",_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Auto", "fetch", "Tests_", "(_", "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", "save", "\\u", "form", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "saving", " ", "the", " ", "form", " ", "create", "s", " ", "the", " ", "source", " ", "URL", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "self_", "._", "url", "\\u", "edit_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "file", "\\u", "url", "'_", ":_", "self_", "._", "SF", "ILE_", ",_", "'", "auto", "\\u", "update", "'_", ":_", "'", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sourcef", "ile", "'_", ":_", "''_", ",_", "'", "accept", "\\u", "translatio", "ns", "'_", ":_", "'", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "self_", "._", "resource_", "._", "slug_", ",_", "'", "name", "'_", ":_", "self_", "._", "resource_", "._", "name_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "resource_", "._", "url", "\\u", "info_", "._", "source", "\\u", "file", "\\u", "url_", ",_", "self_", "._", "SF", "ILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "self_", "._", "url", "\\u", "edit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "self_", "._", "SF", "ILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Auto", "fetch", "Tests_", "(_", "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", "save", "\\u", "form", "\\u", "remove", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "saving", " ", "the", " ", "form", " ", "with", "out", " ", "a", " ", "source", " ", "file", " ", "URL", " ", "remove", "s", " ", "it", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "create", " ", "the", " ", "source", " ", "file", "..._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "test\\u", "save", "\\u", "form", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "try", " ", "to", " ", "remove", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "self_", "._", "url", "\\u", "edit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "source", "\\u", "file", "\\u", "url", "'_", ":_", "''_", ",_", "'", "sourcef", "ile", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "accept", "\\u", "translatio", "ns", "'_", ":_", "'", "on", "'_", ",_", "'", "slug", "'_", ":_", "self_", "._", "resource_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "self_", "._", "resource_", "._", "name_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "self_", "._", "url", "\\u", "edit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "self_", "._", "SF", "ILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "anonym", "ous", "'_", "]_", "._", "get_", "(_", "self_", "._", "urls_", "[_", "'", "resource", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "self_", "._", "SF", "ILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Auto", "fetch", "Tests_", "(_", "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", "save", "\\u", "form", "\\u", "url", "\\u", "nou", "rl_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "autof", "etch", " ", "with", "out", " ", "url", " ", "doe", "s", " ", "not", " ", "work", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "self_", "._", "url", "\\u", "edit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "source", "\\u", "file", "\\u", "url", "'_", ":_", "''_", ",_", "'", "auto", "\\u", "update", "'_", ":_", "'", "on", "'_", ",_", "'", "sourcef", "ile", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "accept", "\\u", "translatio", "ns", "'_", ":_", "'", "on", "'_", ",_", "'", "slug", "'_", ":_", "self_", "._", "resource_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "self_", "._", "resource_", "._", "name_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "You", " ", "have", " ", "checke", "d", " ", "the", " ", "auto", " ", "update", " ", "checkb", "ox", "\"_", ")_", "\\u\\u\\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_", "Release", "s", "View", "s", "Test_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Release", "s", "View", "s", "Test_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Release", "s", "View", "s", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "release_", "=_", "self_", "._", "project_", "._", "releases_", "._", "create_", "(_", "slug_", "=_", "'", "release", "1", "'_", ",_", "name_", "=_", "'", "Release", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "release_", "._", "resources_", "._", "add_", "(_", "self_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Release", "s", "View", "s", "Test_", "(_", "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", "release", "\\u", "deta", "il", "\\u", "page_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "self_", "._", "urls_", "[_", "'", "release", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Thi", "s", " ", "release", " ", "has", " ", "1", " ", "resource", "\"_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Check", " ", "if", " ", "the", " ", "correct", " ", "language", " ", "appear", "s", " ", "in", " ", "the", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Portug", "ues", "e", "\"_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Not", "Impl", "ement", "ed", "Error", "('", "Test", " ", "if", " ", "the", " ", "table", " ", "has", " ", "the", " ", "correct", " ", "language", "s", ".'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "es", "Look", "ups", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "es", "Look", "ups", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "private", "\\u", "resource", "s", "\\u", "aja", "x", "\\u", "lookup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "resource", " ", "isn", "'", "t", " ", "presen", "t", " ", "in", " ", "look", "up", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "AJ", "AX", " ", "look", "up", "/", "dropdown", " ", "is", " ", "presen", "t", " ", "in", " ", "the", " ", "Release", " ", "Add", "/", "Edit", " ", "form", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "project_", "=_", "\"", "Test", " ", "Project", ":", " ", "Reso", "urc", "e1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "private", "\\u", "project_", "=_", "\"", "Test", " ", "Priva", "te", " ", "Project", ":", " ", "Reso", "urc", "e1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "project", " ", "is", " ", "not", " ", "visi", "ble", " ", "to", " ", "a", " ", "random", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "user_", "[_", "'", "register", "ed", "'_", "]_", "not_", "in_", "self_", "._", "project", "\\u", "private_", "._", "maintainer", "s_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "'/", "aja", "x", "/", "aja", "x", "\\u", "look", "up", "/", "resource", "s", "'_", ",_", "{_", "'", "q", "'_", ":_", "'", "r", "'_", ",_", "'", "limit", "'_", ":_", "'", "150", "'_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "public", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "private", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "project", " ", "is", " ", "visi", "ble", " ", "to", " ", "its", " ", "maintainer_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "user_", "[_", "'", "maintainer", "'_", "]_", "in_", "self_", "._", "project", "\\u", "private_", "._", "maintainer", "s_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "'/", "aja", "x", "/", "aja", "x", "\\u", "look", "up", "/", "resource", "s", "'_", ",_", "{_", "'", "q", "'_", ":_", "'", "r", "'_", ",_", "'", "limit", "'_", ":_", "'", "150", "'_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "public", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "private", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "project", " ", "is", " ", "visi", "ble", " ", "to", " ", "a", " ", "member", " ", "of", " ", "its", " ", "teams_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "in_", "self_", "._", "team", "\\u", "private_", "._", "members_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "in_", "self_", "._", "project", "\\u", "private_", "._", "maintainer", "s_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "get_", "(_", "'/", "aja", "x", "/", "aja", "x", "\\u", "look", "up", "/", "resource", "s", "'_", ",_", "{_", "'", "q", "'_", ":_", "'", "r", "'_", ",_", "'", "limit", "'_", ":_", "'", "150", "'_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "public", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "private", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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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 ]
Unused import
anzev/hedwig/hedwig/learners/bottomup.py
[ { "content": "'''\nMain learner class.\n\n@author: [email protected]\n'''\nfrom collections import defaultdict\n\nfrom hedwig.core import UnaryPredicate, Rule, Example\nfrom hedwig.core.settings import logger\nfrom hedwig.stats.significance import is_redundant\nfrom hedwig.stats.scorefunctions import interesting\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BottomUpLearner:\n '''\n Bottom-up learner.\n '''\n Similarity = 'similarity'\n Improvement = 'improvement'\n Default = 'default'\n\n\n\n\n\n\n\n\n", "metadata": "root.BottomUpLearner", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __init__(self, kb, n=None, min_sup=1, sim=1, depth=4, target=None,\n use_negations=False):\n self.kb = kb\n self.n = n # Beam length\n self.min_sup = min_sup\n self.sim = sim\n self.extending = Learner.Improvement\n self.depth = depth # Max number of conjunctions\n self.use_negations = use_negations\n\n if kb.is_discrete_target():\n self.target = list(self.kb.class_values)[0] if not target else target\n else:\n self.target = None\n\n self.pruned_subclasses = self._pruned_subclasses()\n self.pruned_superclasses_closure = self._pruned_superclasses()\n self.implicit_roots = self._implicit_roots()", "metadata": "root.BottomUpLearner.__init__", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 21 }, { "content": " def _pruned_subclasses(self):\n min_sup = lambda pred: self.kb.n_members(pred) >= self.min_sup\n pruned_subclasses = {}\n for pred in self.kb.predicates:\n subclasses = self.kb.get_subclasses(pred)\n pruned_subclasses[pred] = filter(min_sup, subclasses)\n\n return pruned_subclasses", "metadata": "root.BottomUpLearner._pruned_subclasses", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 40 }, { "content": " def _pruned_superclasses(self):\n min_sup = lambda pred: self.kb.n_members(pred) >= self.min_sup\n pruned_superclasses = {}\n for pred in self.kb.predicates:\n superclasses = self.kb.super_classes(pred)\n pruned_superclasses[pred] = filter(min_sup, superclasses)\n\n return pruned_superclasses", "metadata": "root.BottomUpLearner._pruned_superclasses", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 49 }, { "content": " def _implicit_roots(self):\n implicit_roots = set()\n n_examples = self.kb.n_examples()\n for pred in self.kb.predicates:\n if self.kb.n_members(pred) == n_examples:\n implicit_roots.add(pred)\n\n return implicit_roots", "metadata": "root.BottomUpLearner._implicit_roots", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 58 }, { "content": " def get_subclasses(self, pred):\n return self.pruned_subclasses[pred.label]", "metadata": "root.BottomUpLearner.get_subclasses", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 67 }, { "content": " def get_superclasses(self, pred):\n return self.pruned_superclasses_closure[pred]", "metadata": "root.BottomUpLearner.get_superclasses", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 70 }, { "content": " def is_implicit_root(self, pred):\n return pred in self.implicit_roots", "metadata": "root.BottomUpLearner.is_implicit_root", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 73 }, { "content": " def induce(self):\n '''\n Induces rules for the given knowledge base.\n '''\n pass", "metadata": "root.BottomUpLearner.induce", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 76 }, { "content": " def bottom_clause(self):\n pass", "metadata": "root.BottomUpLearner.bottom_clause", "header": "['class', 'BottomUpLearner', ':', '___EOS___']", "index": 82 } ]
[ { "span": "from collections import defaultdict", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 35 }, { "span": "from hedwig.core import UnaryPredicate, Rule, Example", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 53 }, { "span": "from hedwig.core.settings import logger", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 39 }, { "span": "from hedwig.stats.significance import is_redundant", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 50 }, { "span": "from hedwig.stats.scorefunctions import interesting", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Main", " ", "learner", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "an", "ze", ".", "va", "vp", "etic", "@", "ij", "s", ".", "si", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hed", "wig", "_", "._", "core_", "import_", "Una", "ry", "Predicate_", ",_", "Rule_", ",_", "Example_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hed", "wig", "_", "._", "core_", "._", "settings_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hed", "wig", "_", "._", "stats_", "._", "significan", "ce_", "import_", "is", "\\u", "redundant", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hed", "wig", "_", "._", "stats_", "._", "score", "functions_", "import_", "interesting", "_", "\\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_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Bott", "om", "-", "up", " ", "learner", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Simil", "arity_", "=_", "'", "similar", "it", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Impro", "ve", "ment_", "=_", "'", "improvement", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Default_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "kb_", ",_", "n_", "=_", "None_", ",_", "min", "\\u", "sup_", "=_", "1_", ",_", "sim_", "=_", "1_", ",_", "depth_", "=_", "4_", ",_", "target_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "negati", "ons_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "kb_", "=_", "kb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "n_", "=_", "n_", "#", " ", "Beam", " ", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "min", "\\u", "sup_", "=_", "min", "\\u", "sup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sim_", "=_", "sim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extend", "ing_", "=_", "Learner", "_", "._", "Impro", "ve", "ment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "depth_", "=_", "depth_", "#", " ", "Max", " ", "number", " ", "of", " ", "conjunction", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "\\u", "negati", "ons_", "=_", "use", "\\u", "negati", "ons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "kb_", "._", "is", "\\u", "discrete", "\\u", "target_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target_", "=_", "list_", "(_", "self_", "._", "kb_", "._", "class", "\\u", "values_", ")_", "[_", "0_", "]_", "if_", "not_", "target_", "else_", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pruned", "\\u", "subclasses", "_", "=_", "self_", "._", "\\u", "pruned", "\\u", "subclasses", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pruned", "\\u", "superclass", "es", "\\u", "closure_", "=_", "self_", "._", "\\u", "pruned", "\\u", "superclass", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "implicit", "\\u", "roots_", "=_", "self_", "._", "\\u", "implicit", "\\u", "roots_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pruned", "\\u", "subclasses", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "sup_", "=_", "lambda_", "pred_", ":_", "self_", "._", "kb_", "._", "n", "\\u", "members_", "(_", "pred_", ")_", ">=_", "self_", "._", "min", "\\u", "sup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pruned", "\\u", "subclasses", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pred_", "in_", "self_", "._", "kb_", "._", "predicates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subclasses", "_", "=_", "self_", "._", "kb_", "._", "get", "\\u", "subclasses", "_", "(_", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pruned", "\\u", "subclasses", "_", "[_", "pred_", "]_", "=_", "filter_", "(_", "min", "\\u", "sup_", ",_", "subclasses", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pruned", "\\u", "subclasses", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pruned", "\\u", "superclass", "es_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "sup_", "=_", "lambda_", "pred_", ":_", "self_", "._", "kb_", "._", "n", "\\u", "members_", "(_", "pred_", ")_", ">=_", "self_", "._", "min", "\\u", "sup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pruned", "\\u", "superclass", "es_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pred_", "in_", "self_", "._", "kb_", "._", "predicates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "superclass", "es_", "=_", "self_", "._", "kb_", "._", "super", "\\u", "classes_", "(_", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pruned", "\\u", "superclass", "es_", "[_", "pred_", "]_", "=_", "filter_", "(_", "min", "\\u", "sup_", ",_", "superclass", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pruned", "\\u", "superclass", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "implicit", "\\u", "roots_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "implicit", "\\u", "roots_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "examples_", "=_", "self_", "._", "kb_", "._", "n", "\\u", "examples_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pred_", "in_", "self_", "._", "kb_", "._", "predicates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "kb_", "._", "n", "\\u", "members_", "(_", "pred_", ")_", "==_", "n", "\\u", "examples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "implicit", "\\u", "roots_", "._", "add_", "(_", "pred_", ")_", "\\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_", "implicit", "\\u", "roots_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "subclasses", "_", "(_", "self_", ",_", "pred_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pruned", "\\u", "subclasses", "_", "[_", "pred_", "._", "label_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "superclass", "es_", "(_", "self_", ",_", "pred_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pruned", "\\u", "superclass", "es", "\\u", "closure_", "[_", "pred_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "implicit", "\\u", "root_", "(_", "self_", ",_", "pred_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pred_", "in_", "self_", "._", "implicit", "\\u", "roots_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "induc", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Ind", "uce", "s", " ", "rule", "s", " ", "for", " ", "the", " ", "give", "n", " ", "knowledge", " ", "base", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bott", "om", "Up", "Learner", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bottom", "\\u", "clause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
tjguk/networkzero/tests/test_scenarios.py
[ { "content": "import sys\nimport contextlib\nimport io\nimport logging\ntry:\n import queue\nexcept ImportError:\n import Queue as queue\nimport re\nimport threading\nimport time\nimport uuid\n\nimport pytest\nimport zmq\n\nimport networkzero as nw0\n_logger = nw0.core.get_logger(\"networkzero.tests\")\nnw0.core._enable_debug_logging()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 }, { "span": "import contextlib", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 17 }, { "span": "import io", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "import logging", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 14 }, { "span": "import queue", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 16 }, { "span": "import Queue as queue", "start_line": 7, "start_column": 4, "end_line": 7, "end_column": 25 }, { "span": "import re", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 9 }, { "span": "import threading", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 16 }, { "span": "import time", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 11 }, { "span": "import uuid", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 11 }, { "span": "import pytest", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 13 }, { "span": "import zmq", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "contextlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "queue_", "\\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_", "Queue_", "as_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "network", "zero_", "as_", "nw", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "logger_", "=_", "nw", "0_", "._", "core_", "._", "get", "\\u", "logger_", "(_", "\"", "network", "zero", ".", "tests", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nw", "0_", "._", "core_", "._", "\\u", "enable", "\\u", "debug", "\\u", "logging_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
glue-viz/glue/glue/viewers/scatter/qt/tests/test_viewer_widget.py
[ { "content": "# pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103\n\nfrom __future__ import absolute_import, division, print_function\n\nfrom distutils.version import LooseVersion # pylint:disable=W0611\n\nimport pytest\nfrom mock import patch\nfrom matplotlib import __version__ as mpl_version # pylint:disable=W0611\n\nfrom glue import core\nfrom glue.core.tests.util import simple_session\nfrom glue.viewers.common.qt.mpl_widget import MplCanvas\n\nfrom ..viewer_widget import ScatterWidget\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestScatterWidget(object):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestScatterWidget", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def setup_method(self, method):\n s = simple_session()\n self.hub = s.hub\n self.d1 = core.Data(x=[1, 2, 3], y=[2, 3, 4],\n z=[3, 4, 5], w=[4, 5, 6])\n self.d1.label = 'd1'\n self.d2 = core.Data(x=[1, 2, 3], y=[2, 3, 4],\n z=[3, 4, 5], w=[4, 5, 6])\n self.d2.label = 'd2'\n self.data = [self.d1, self.d2]\n self.collect = s.data_collection\n self.collect.append(self.data)\n self.widget = ScatterWidget(s)\n self.session = s\n self.connect_to_hub()", "metadata": "root.TestScatterWidget.setup_method", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def teardown_method(self, method):\n self.assert_widget_synced()", "metadata": "root.TestScatterWidget.teardown_method", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def assert_widget_synced(self):\n cl = self.widget.client\n w = self.widget\n assert abs(w.xmin - cl.xmin) < 1e-3\n assert abs(w.xmax - cl.xmax) < 1e-3\n assert w.xlog == cl.xlog\n assert w.ylog == cl.ylog\n assert w.xflip == cl.xflip\n assert w.yflip == cl.yflip\n assert abs(w.ymin - cl.ymin) < 1e-3\n assert abs(w.ymax - cl.ymax) < 1e-3", "metadata": "root.TestScatterWidget.assert_widget_synced", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def connect_to_hub(self):\n self.widget.register_to_hub(self.hub)\n self.collect.register_to_hub(self.hub)", "metadata": "root.TestScatterWidget.connect_to_hub", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " def add_layer_via_hub(self):\n layer = self.data[0]\n layer.label = 'Test Layer'\n self.collect.append(layer)\n return layer", "metadata": "root.TestScatterWidget.add_layer_via_hub", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 54 }, { "content": " def add_layer_via_method(self, index=0):\n layer = self.data[index]\n self.widget.add_data(layer)\n return layer", "metadata": "root.TestScatterWidget.add_layer_via_method", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def plot_data(self, layer):\n \"\"\" Return the data bounds for a given layer (data or subset)\n Output format: [xmin, xmax], [ymin, ymax]\n \"\"\"\n client = self.widget.client\n x, y = client.artists[layer][0].get_data()\n assert x.size > 0\n assert y.size > 0\n xmin = x.min()\n xmax = x.max()\n ymin = y.min()\n ymax = y.max()\n return [xmin, xmax], [ymin, ymax]", "metadata": "root.TestScatterWidget.plot_data", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 65 }, { "content": " def plot_limits(self):\n \"\"\" Return the plot limits\n Output format [xmin, xmax], [ymin, ymax]\n \"\"\"\n ax = self.widget.client.axes\n xlim = ax.get_xlim()\n ylim = ax.get_ylim()\n return xlim, ylim", "metadata": "root.TestScatterWidget.plot_limits", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 79 }, { "content": " def assert_layer_inside_limits(self, layer):\n \"\"\"Assert that points of a layer are within plot limits \"\"\"\n xydata = self.plot_data(layer)\n xylimits = self.plot_limits()\n assert xydata[0][0] >= xylimits[0][0]\n assert xydata[1][0] >= xylimits[1][0]\n assert xydata[0][1] <= xylimits[0][1]\n assert xydata[1][1] <= xylimits[1][1]", "metadata": "root.TestScatterWidget.assert_layer_inside_limits", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": " def is_layer_present(self, layer):\n return self.widget.client.is_layer_present(layer)", "metadata": "root.TestScatterWidget.is_layer_present", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 97 }, { "content": " def is_layer_visible(self, layer):\n return self.widget.client.is_visible(layer)", "metadata": "root.TestScatterWidget.is_layer_visible", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 100 }, { "content": " def test_rescaled_on_init(self):\n layer = self.add_layer_via_method()\n self.assert_layer_inside_limits(layer)", "metadata": "root.TestScatterWidget.test_rescaled_on_init", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 103 }, { "content": " def test_hub_data_add_is_ignored(self):\n layer = self.add_layer_via_hub()\n assert not self.widget.client.is_layer_present(layer)", "metadata": "root.TestScatterWidget.test_hub_data_add_is_ignored", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def test_valid_add_data_via_method(self):\n layer = self.add_layer_via_method()\n assert self.is_layer_present(layer)", "metadata": "root.TestScatterWidget.test_valid_add_data_via_method", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_add_first_data_updates_combos(self):\n self.add_layer_via_method()\n xatt = str(self.widget.ui.xAxisComboBox.currentText())\n yatt = str(self.widget.ui.yAxisComboBox.currentText())\n assert xatt is not None\n assert yatt is not None", "metadata": "root.TestScatterWidget.test_add_first_data_updates_combos", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " def test_flip_x(self):\n self.add_layer_via_method()\n self.widget.xflip = True\n assert self.widget.client.xflip\n self.widget.xflip = False\n assert not self.widget.client.xflip", "metadata": "root.TestScatterWidget.test_flip_x", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 122 }, { "content": " def test_flip_y(self):\n self.add_layer_via_method()\n self.widget.yflip = True\n assert self.widget.client.yflip\n self.widget.yflip = False\n assert not self.widget.client.yflip", "metadata": "root.TestScatterWidget.test_flip_y", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def test_log_x(self):\n self.add_layer_via_method()\n self.widget.xlog = True\n assert self.widget.client.xlog\n self.widget.xlog = False\n assert not self.widget.client.xlog", "metadata": "root.TestScatterWidget.test_log_x", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def test_log_y(self):\n self.widget.ylog = True\n assert self.widget.client.ylog\n self.widget.ylog = False\n assert not self.widget.client.ylog", "metadata": "root.TestScatterWidget.test_log_y", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 143 }, { "content": " def test_double_add_ignored(self):\n self.add_layer_via_method()\n nobj = self.widget.ui.xAxisComboBox.count()\n self.add_layer_via_method()\n assert self.widget.ui.xAxisComboBox.count() == nobj", "metadata": "root.TestScatterWidget.test_double_add_ignored", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 149 }, { "content": " def test_subsets_dont_duplicate_fields(self):\n layer = self.add_layer_via_method()\n nobj = self.widget.ui.xAxisComboBox.count()\n subset = layer.new_subset()\n subset.register()\n assert self.widget.ui.xAxisComboBox.count() == nobj", "metadata": "root.TestScatterWidget.test_subsets_dont_duplicate_fields", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def test_correct_title_single_data(self):\n ct = self.widget.client.layer_count\n assert ct == 0\n layer = self.add_layer_via_method()\n ct = self.widget.client.layer_count\n assert ct == 1\n assert len(layer.label) > 0\n assert self.widget.windowTitle() == layer.label", "metadata": "root.TestScatterWidget.test_correct_title_single_data", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test_title_updates_with_label_change(self):\n layer = self.add_layer_via_method()\n assert layer.hub is self.hub\n layer.label = \"changed label\"\n assert self.widget.windowTitle() == layer.label", "metadata": "root.TestScatterWidget.test_title_updates_with_label_change", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 171 }, { "content": " def test_title_updates_with_second_data(self):\n l1 = self.add_layer_via_method(0)\n l2 = self.add_layer_via_method(1)\n expected = '%s | %s' % (l1.label, l2.label)\n self.widget.windowTitle() == expected", "metadata": "root.TestScatterWidget.test_title_updates_with_second_data", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 177 }, { "content": " def test_second_data_add_preserves_plot_variables(self):\n self.add_layer_via_method(0)\n self.widget.ui.xAxisComboBox.setCurrentIndex(3)\n self.widget.ui.yAxisComboBox.setCurrentIndex(2)\n self.add_layer_via_method(1)\n\n assert self.widget.ui.xAxisComboBox.currentIndex() == 3\n assert self.widget.ui.yAxisComboBox.currentIndex() == 2", "metadata": "root.TestScatterWidget.test_second_data_add_preserves_plot_variables", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 183 }, { "content": " def test_set_limits(self):\n self.add_layer_via_method(0)\n w = self.widget\n c = self.widget.client\n ax = self.widget.client.axes\n\n print(w.xmin, w.xmax, w.ymin, w.ymax)\n print(c.xmin, c.xmax, c.ymin, c.ymax)\n print(ax.get_xlim(), ax.get_ylim())\n\n self.widget.xmax = 20\n print(w.xmin, w.xmax, w.ymin, w.ymax)\n print(c.xmin, c.xmax, c.ymin, c.ymax)\n print(ax.get_xlim(), ax.get_ylim())\n\n self.widget.xmin = 10\n print(w.xmin, w.xmax, w.ymin, w.ymax)\n print(c.xmin, c.xmax, c.ymin, c.ymax)\n print(ax.get_xlim(), ax.get_ylim())\n\n self.widget.ymax = 40\n print(w.xmin, w.xmax, w.ymin, w.ymax)\n print(c.xmin, c.xmax, c.ymin, c.ymax)\n print(ax.get_xlim(), ax.get_ylim())\n\n self.widget.ymin = 30\n print(w.xmin, w.xmax, w.ymin, w.ymax)\n print(c.xmin, c.xmax, c.ymin, c.ymax)\n print(ax.get_xlim(), ax.get_ylim())\n\n assert self.widget.client.axes.get_xlim() == (10, 20)\n assert self.widget.client.axes.get_ylim() == (30, 40)\n assert float(self.widget.ui.xmin.text()) == 10\n assert float(self.widget.ui.xmax.text()) == 20\n assert float(self.widget.ui.ymin.text()) == 30\n assert float(self.widget.ui.ymax.text()) == 40", "metadata": "root.TestScatterWidget.test_set_limits", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": " def test_widget_props_synced_with_client(self):\n\n self.widget.client.xmax = 100\n assert self.widget.xmax == 100\n self.widget.client.ymax = 200\n assert self.widget.ymax == 200\n\n self.widget.client.xmin = 10\n assert self.widget.xmin == 10\n\n self.widget.client.ymin = 30\n assert self.widget.ymin == 30", "metadata": "root.TestScatterWidget.test_widget_props_synced_with_client", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 229 }, { "content": " @pytest.mark.xfail(\"LooseVersion(mpl_version) <= LooseVersion('1.1.0')\")\n def test_labels_sync_with_plot_limits(self):\n \"\"\"For some reason, manually calling draw() doesnt trigger the\n draw_event in MPL 1.1.0. Ths functionality nevertheless seems\n to work when actually using Glue\"\"\"\n\n self.add_layer_via_method(0)\n self.widget.client.axes.set_xlim((3, 4))\n self.widget.client.axes.set_ylim((5, 6))\n\n # call MPL draw to force render, not Glue draw\n super(MplCanvas, self.widget.client.axes.figure.canvas).draw()\n\n assert float(self.widget.ui.xmin.text()) == 3\n assert float(self.widget.ui.xmax.text()) == 4\n assert float(self.widget.ui.ymin.text()) == 5\n assert float(self.widget.ui.ymax.text()) == 6", "metadata": "root.TestScatterWidget.test_labels_sync_with_plot_limits", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 242 }, { "content": " def assert_component_present(self, label):\n ui = self.widget.ui\n for combo in [ui.xAxisComboBox, ui.yAxisComboBox]:\n atts = [combo.itemText(i) for i in range(combo.count())]\n assert label in atts", "metadata": "root.TestScatterWidget.assert_component_present", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 260 }, { "content": " def test_component_change_syncs_with_combo(self):\n l1 = self.add_layer_via_method()\n l1.add_component(l1[l1.components[0]], 'testing')\n self.assert_component_present('testing')", "metadata": "root.TestScatterWidget.test_component_change_syncs_with_combo", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 266 }, { "content": " def test_swap_axes(self):\n self.add_layer_via_method()\n cl = self.widget.client\n cl.xlog, cl.xflip = True, True\n cl.ylog, cl.yflip = False, False\n\n x, y = cl.xatt, cl.yatt\n\n self.widget.ui.swapAxes.click()\n assert (cl.xlog, cl.xflip) == (False, False)\n assert (cl.ylog, cl.yflip) == (True, True)\n assert (cl.xatt, cl.yatt) == (y, x)", "metadata": "root.TestScatterWidget.test_swap_axes", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 271 }, { "content": " def test_hidden(self):\n self.add_layer_via_method()\n xcombo = self.widget.ui.xAxisComboBox\n\n self.widget.hidden = False\n assert xcombo.count() == 4\n self.widget.hidden = True\n assert xcombo.count() == 6\n self.widget.hidden = False\n assert xcombo.count() == 4", "metadata": "root.TestScatterWidget.test_hidden", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 284 }, { "content": " def test_add_subset_preserves_plot_variables(self):\n self.add_layer_via_method(0)\n print(self.widget.client.layer_count)\n\n self.widget.ui.xAxisComboBox.setCurrentIndex(3)\n self.widget.ui.yAxisComboBox.setCurrentIndex(2)\n assert self.widget.ui.xAxisComboBox.currentIndex() == 3\n assert self.widget.ui.yAxisComboBox.currentIndex() == 2\n\n s = self.data[1].new_subset(label='new')\n self.widget.add_subset(s)\n\n assert self.widget.ui.xAxisComboBox.currentIndex() == 3\n assert self.widget.ui.yAxisComboBox.currentIndex() == 2", "metadata": "root.TestScatterWidget.test_add_subset_preserves_plot_variables", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 295 }, { "content": " def test_title_synced_if_data_removed(self):\n # regression test for #517\n n0 = self.widget.windowTitle()\n self.add_layer_via_method(0)\n n1 = self.widget.windowTitle()\n assert n1 != n0\n l2 = self.add_layer_via_method(1)\n n2 = self.widget.windowTitle()\n assert n2 != n1\n self.widget.remove_layer(l2)\n assert self.widget.windowTitle() == n1", "metadata": "root.TestScatterWidget.test_title_synced_if_data_removed", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 310 }, { "content": "class TestDrawCount(TestScatterWidget):\n\n\n", "metadata": "root.TestDrawCount", "header": "['module', '___EOS___']", "index": 323 }, { "content": " def patch_draw(self):\n return patch('glue.viewers.common.qt.mpl_widget.MplCanvas.draw')", "metadata": "root.TestDrawCount.patch_draw", "header": "['class', 'TestDrawCount', '(', 'TestScatterWidget', ')', ':', '___EOS___']", "index": 325 }, { "content": " def test_xatt_redraws_once(self):\n self.add_layer_via_method()\n with self.patch_draw() as draw:\n self.widget.yatt = self.widget.xatt\n assert draw.call_count == 1", "metadata": "root.TestDrawCount.test_xatt_redraws_once", "header": "['class', 'TestDrawCount', '(', 'TestScatterWidget', ')', ':', '___EOS___']", "index": 328 }, { "content": " def test_swap_redraws_once(self):\n self.add_layer_via_method()\n with self.patch_draw() as draw:\n self.widget.swap_axes()\n assert draw.call_count == 1", "metadata": "root.TestDrawCount.test_swap_redraws_once", "header": "['class', 'TestDrawCount', '(', 'TestScatterWidget', ')', ':', '___EOS___']", "index": 334 } ]
[ { "span": "from distutils.version import LooseVersion ", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 42 }, { "span": "from matplotlib import __version__ as mpl_version ", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "I", "0011", ",", "W", "061", "3", ",", "W", "020", "1", ",", "W", "021", "2", ",", "E1", "101", ",", "E1", "103_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "distutils_", "._", "version_", "import_", "Lo", "ose", "Version_", "#", " ", "pylint", ":", "disable", "=", "W", "061", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "import_", "\\u\\u", "version\\u\\u_", "as_", "mpl", "\\u", "version_", "#", " ", "pylint", ":", "disable", "=", "W", "061", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "glue", "_", "import_", "core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glue", "_", "._", "core_", "._", "tests_", "._", "util_", "import_", "simple", "\\u", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glue", "_", "._", "viewer", "s_", "._", "common_", "._", "qt_", "._", "mpl", "\\u", "widget_", "import_", "Mp", "l", "Canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "viewer", "\\u", "widget_", "import_", "Scatter", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Test", "Scatter", "Widget_", "(_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup", "\\u", "method_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "simple", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hub_", "=_", "s_", "._", "hub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "d1_", "=_", "core_", "._", "Data_", "(_", "x_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "y_", "=_", "[_", "2_", ",_", "3_", ",_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "=_", "[_", "3_", ",_", "4_", ",_", "5_", "]_", ",_", "w_", "=_", "[_", "4_", ",_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "d1_", "._", "label_", "=_", "'", "d1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "d2_", "=_", "core_", "._", "Data_", "(_", "x_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "y_", "=_", "[_", "2_", ",_", "3_", ",_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "=_", "[_", "3_", ",_", "4_", ",_", "5_", "]_", ",_", "w_", "=_", "[_", "4_", ",_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "d2_", "._", "label_", "=_", "'", "d2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "[_", "self_", "._", "d1_", ",_", "self_", "._", "d2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "collect_", "=_", "s_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "collect_", "._", "append_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "=_", "Scatter", "Widget_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connect", "\\u", "to", "\\u", "hub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "down", "\\u", "method_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "\\u", "widget", "\\u", "synced", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "widget", "\\u", "synced", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cl_", "=_", "self_", "._", "widget_", "._", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "self_", "._", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "abs_", "(_", "w_", "._", "xmin_", "-_", "cl_", "._", "xmin_", ")_", "<_", "1e-3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "abs_", "(_", "w_", "._", "xmax_", "-_", "cl_", "._", "xmax_", ")_", "<_", "1e-3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "w_", "._", "xlog", "_", "==_", "cl_", "._", "xlog", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "w_", "._", "ylo", "g_", "==_", "cl_", "._", "ylo", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "w_", "._", "xf", "lip", "_", "==_", "cl_", "._", "xf", "lip", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "w_", "._", "yf", "lip", "_", "==_", "cl_", "._", "yf", "lip", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "abs_", "(_", "w_", "._", "ymin_", "-_", "cl_", "._", "ymin_", ")_", "<_", "1e-3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "abs_", "(_", "w_", "._", "ymax_", "-_", "cl_", "._", "ymax_", ")_", "<_", "1e-3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect", "\\u", "to", "\\u", "hub_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget_", "._", "register", "\\u", "to", "\\u", "hub_", "(_", "self_", "._", "hub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "collect_", "._", "register", "\\u", "to", "\\u", "hub_", "(_", "self_", "._", "hub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "layer", "\\u", "via", "\\u", "hub_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "data_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer_", "._", "label_", "=_", "'", "Test", " ", "Layer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "collect_", "._", "append_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "layer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "self_", ",_", "index_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "data_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "add", "\\u", "data_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "layer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "data_", "(_", "self_", ",_", "layer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "data", " ", "bound", "s", " ", "for", " ", "a", " ", "give", "n", " ", "layer", " ", "(", "data", " ", "or", " ", "subse", "t", ")", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "format", ":", " ", "[", "xmi", "n", ",", " ", "xma", "x", "],", " ", "[", "ymin", ",", " ", "ymax", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "widget_", "._", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "client_", "._", "artists_", "[_", "layer_", "]_", "[_", "0_", "]_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "x_", "._", "size_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "y_", "._", "size_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmin_", "=_", "x_", "._", "min_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmax_", "=_", "x_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymin_", "=_", "y_", "._", "min_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax_", "=_", "y_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "xmin_", ",_", "xmax_", "]_", ",_", "[_", "ymin_", ",_", "ymax_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "plot", " ", "limit", "s", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "format", " ", "[", "xmi", "n", ",", " ", "xma", "x", "],", " ", "[", "ymin", ",", " ", "ymax", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "self_", "._", "widget_", "._", "client_", "._", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xlim_", "=_", "ax_", "._", "get", "\\u", "xlim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylim_", "=_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "xlim_", ",_", "ylim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "layer", "\\u", "insi", "de", "\\u", "limits_", "(_", "self_", ",_", "layer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Assert", " ", "tha", "t", " ", "points", " ", "of", " ", "a", " ", "layer", " ", "are", " ", "within", " ", "plot", " ", "limit", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xy", "data_", "=_", "self_", "._", "plot", "\\u", "data_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xy", "limits_", "=_", "self_", "._", "plot", "\\u", "limits_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xy", "data_", "[_", "0_", "]_", "[_", "0_", "]_", ">=_", "xy", "limits_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xy", "data_", "[_", "1_", "]_", "[_", "0_", "]_", ">=_", "xy", "limits_", "[_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xy", "data_", "[_", "0_", "]_", "[_", "1_", "]_", "<=_", "xy", "limits_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xy", "data_", "[_", "1_", "]_", "[_", "1_", "]_", "<=_", "xy", "limits_", "[_", "1_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "layer", "\\u", "present_", "(_", "self_", ",_", "layer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "widget_", "._", "client_", "._", "is", "\\u", "layer", "\\u", "present_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "layer", "\\u", "visible_", "(_", "self_", ",_", "layer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "widget_", "._", "client_", "._", "is", "\\u", "visible_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rescale", "d\\u", "on", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "layer", "\\u", "insi", "de", "\\u", "limits_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hub", "\\u", "data\\u", "add", "\\u", "is", "\\u", "ignored_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "hub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "widget_", "._", "client_", "._", "is", "\\u", "layer", "\\u", "present_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "valid", "\\u", "add", "\\u", "data\\u", "via", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "is", "\\u", "layer", "\\u", "present_", "(_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "first", "\\u", "data\\u", "update", "s", "\\u", "combo", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xa", "tt_", "=_", "str_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ya", "tt_", "=_", "str_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "y", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xa", "tt_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ya", "tt_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flip", "\\u", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "xf", "lip", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "client_", "._", "xf", "lip", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "xf", "lip", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "widget_", "._", "client_", "._", "xf", "lip", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flip", "\\u", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "yf", "lip", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "client_", "._", "yf", "lip", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "yf", "lip", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "widget_", "._", "client_", "._", "yf", "lip", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "xlog", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "client_", "._", "xlog", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "xlog", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "widget_", "._", "client_", "._", "xlog", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget_", "._", "ylo", "g_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "client_", "._", "ylo", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "ylo", "g_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "widget_", "._", "client_", "._", "ylo", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "double", "\\u", "add", "\\u", "ignored_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "j_", "=_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "count_", "(_", ")_", "==_", "nob", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "subsets", "\\u", "don", "t", "\\u", "duplicat", "e\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "j_", "=_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subset_", "=_", "layer_", "._", "new", "\\u", "subset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subset_", "._", "register_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "count_", "(_", ")_", "==_", "nob", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "correct", "\\u", "title", "\\u", "single", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ct_", "=_", "self_", "._", "widget_", "._", "client_", "._", "layer", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ct_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ct_", "=_", "self_", "._", "widget_", "._", "client_", "._", "layer", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ct_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "layer_", "._", "label_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "window", "Title_", "(_", ")_", "==_", "layer_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "title", "\\u", "update", "s", "\\u", "with", "\\u", "label", "\\u", "change_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "layer_", "._", "hub_", "is_", "self_", "._", "hub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer_", "._", "label_", "=_", "\"", "change", "d", " ", "label", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "window", "Title_", "(_", ")_", "==_", "layer_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "title", "\\u", "update", "s", "\\u", "with", "\\u", "second", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l1_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "'%", "s", " ", "|", " ", "%", "s", "'_", "%_", "(_", "l1_", "._", "label_", ",_", "l2_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "window", "Title_", "(_", ")_", "==_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "second", "\\u", "data\\u", "add", "\\u", "preserve", "s", "\\u", "plot", "\\u", "variables_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "set", "Curr", "ent", "Index_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "ui_", "._", "y", "Axi", "s", "Comb", "o", "Box_", "._", "set", "Curr", "ent", "Index_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Index_", "(_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "y", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Index_", "(_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "set\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "self_", "._", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "self_", "._", "widget_", "._", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "self_", "._", "widget_", "._", "client_", "._", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "w_", "._", "xmin_", ",_", "w_", "._", "xmax_", ",_", "w_", "._", "ymin_", ",_", "w_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "c_", "._", "xmin_", ",_", "c_", "._", "xmax_", ",_", "c_", "._", "ymin_", ",_", "c_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ax_", "._", "get", "\\u", "xlim_", "(_", ")_", ",_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "xmax_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "w_", "._", "xmin_", ",_", "w_", "._", "xmax_", ",_", "w_", "._", "ymin_", ",_", "w_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "c_", "._", "xmin_", ",_", "c_", "._", "xmax_", ",_", "c_", "._", "ymin_", ",_", "c_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ax_", "._", "get", "\\u", "xlim_", "(_", ")_", ",_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "xmin_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "w_", "._", "xmin_", ",_", "w_", "._", "xmax_", ",_", "w_", "._", "ymin_", ",_", "w_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "c_", "._", "xmin_", ",_", "c_", "._", "xmax_", ",_", "c_", "._", "ymin_", ",_", "c_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ax_", "._", "get", "\\u", "xlim_", "(_", ")_", ",_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "ymax_", "=_", "40_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "w_", "._", "xmin_", ",_", "w_", "._", "xmax_", ",_", "w_", "._", "ymin_", ",_", "w_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "c_", "._", "xmin_", ",_", "c_", "._", "xmax_", ",_", "c_", "._", "ymin_", ",_", "c_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ax_", "._", "get", "\\u", "xlim_", "(_", ")_", ",_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "ymin_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "w_", "._", "xmin_", ",_", "w_", "._", "xmax_", ",_", "w_", "._", "ymin_", ",_", "w_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "c_", "._", "xmin_", ",_", "c_", "._", "xmax_", ",_", "c_", "._", "ymin_", ",_", "c_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ax_", "._", "get", "\\u", "xlim_", "(_", ")_", ",_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "client_", "._", "axes_", "._", "get", "\\u", "xlim_", "(_", ")_", "==_", "(_", "10_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "client_", "._", "axes_", "._", "get", "\\u", "ylim_", "(_", ")_", "==_", "(_", "30_", ",_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "xmin_", "._", "text_", "(_", ")_", ")_", "==_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "xmax_", "._", "text_", "(_", ")_", ")_", "==_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "ymin_", "._", "text_", "(_", ")_", ")_", "==_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "ymax_", "._", "text_", "(_", ")_", ")_", "==_", "40_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "widget", "\\u", "props", "\\u", "synced", "\\u", "with", "\\u", "client_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget_", "._", "client_", "._", "xmax_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "xmax_", "==_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "client_", "._", "ymax_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ymax_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "client_", "._", "xmin_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "xmin_", "==_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "client_", "._", "ymin_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ymin_", "==_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "xfail_", "(_", "\"", "Lo", "ose", "Version", "(", "mpl", "\\u", "version", ")", " ", "<=", " ", "Lo", "ose", "Version", "('", "1.1", ".0", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "labels", "\\u", "sync", "\\u", "with", "\\u", "plot", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "For", " ", "some", " ", "reason", ",", " ", "manu", "ally", " ", "calling", " ", "draw", "()", " ", "doesnt", " ", "trigger", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "draw", "\\u", "event", " ", "in", " ", "MPL", " ", "1.1", ".0", ".", " ", "Th", "s", " ", "functional", "it", "y", " ", "neve", "rt", "hel", "ess", " ", "see", "ms", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "work", " ", "whe", "n", " ", "actual", "ly", " ", "usi", "ng", " ", "Glu", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "client_", "._", "axes_", "._", "set\\u", "xlim_", "(_", "(_", "3_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "client_", "._", "axes_", "._", "set\\u", "ylim_", "(_", "(_", "5_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "MPL", " ", "draw", " ", "to", " ", "force", " ", "render", ",", " ", "not", " ", "Glu", "e", " ", "draw_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Mp", "l", "Canvas_", ",_", "self_", "._", "widget_", "._", "client_", "._", "axes_", "._", "figure_", "._", "canvas_", ")_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "xmin_", "._", "text_", "(_", ")_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "xmax_", "._", "text_", "(_", ")_", ")_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "ymin_", "._", "text_", "(_", ")_", ")_", "==_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "float_", "(_", "self_", "._", "widget_", "._", "ui_", "._", "ymax_", "._", "text_", "(_", ")_", ")_", "==_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "component", "\\u", "present_", "(_", "self_", ",_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "=_", "self_", "._", "widget_", "._", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "combo_", "in_", "[_", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", ",_", "ui_", "._", "y", "Axi", "s", "Comb", "o", "Box_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atts_", "=_", "[_", "combo_", "._", "item", "Text_", "(_", "i_", ")_", "for_", "i_", "in_", "range_", "(_", "combo_", "._", "count_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "label_", "in_", "atts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "component", "\\u", "change", "\\u", "sync", "s", "\\u", "with", "\\u", "combo_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l1_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l1_", "._", "add", "\\u", "component_", "(_", "l1_", "[_", "l1_", "._", "components_", "[_", "0_", "]_", "]_", ",_", "'", "testi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "component", "\\u", "present_", "(_", "'", "testi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "swap", "\\u", "axes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "=_", "self_", "._", "widget_", "._", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "._", "xlog", "_", ",_", "cl_", "._", "xf", "lip", "_", "=_", "True_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "._", "ylo", "g_", ",_", "cl_", "._", "yf", "lip", "_", "=_", "False_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", "=_", "cl_", "._", "xa", "tt_", ",_", "cl_", "._", "ya", "tt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "ui_", "._", "swap", "Axes_", "._", "click_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cl_", "._", "xlog", "_", ",_", "cl_", "._", "xf", "lip", "_", ")_", "==_", "(_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cl_", "._", "ylo", "g_", ",_", "cl_", "._", "yf", "lip", "_", ")_", "==_", "(_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cl_", "._", "xa", "tt_", ",_", "cl_", "._", "ya", "tt_", ")_", "==_", "(_", "y_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hidden_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xco", "mbo", "_", "=_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "hidden_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xco", "mbo", "_", "._", "count_", "(_", ")_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "hidden_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xco", "mbo", "_", "._", "count_", "(_", ")_", "==_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "hidden_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "xco", "mbo", "_", "._", "count_", "(_", ")_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "subse", "t", "\\u", "preserve", "s", "\\u", "plot", "\\u", "variables_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "self_", "._", "widget_", "._", "client_", "._", "layer", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "set", "Curr", "ent", "Index_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "ui_", "._", "y", "Axi", "s", "Comb", "o", "Box_", "._", "set", "Curr", "ent", "Index_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Index_", "(_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "y", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Index_", "(_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "self_", "._", "data_", "[_", "1_", "]_", "._", "new", "\\u", "subset_", "(_", "label_", "=_", "'", "new", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "add", "\\u", "subset_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Index_", "(_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "y", "Axi", "s", "Comb", "o", "Box_", "._", "current", "Index_", "(_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "title", "\\u", "synced", "\\u", "if", "\\u", "data\\u", "removed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "regress", "ion", " ", "test", " ", "for", " ", "#", "517", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n0_", "=_", "self_", "._", "widget_", "._", "window", "Title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "self_", "._", "widget_", "._", "window", "Title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n1_", "!=_", "n0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "self_", "._", "widget_", "._", "window", "Title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n2_", "!=_", "n1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "remove", "\\u", "layer_", "(_", "l2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "window", "Title_", "(_", ")_", "==_", "n1_", "\\u\\u\\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", "Draw", "Count_", "(_", "Test", "Scatter", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Draw", "Count_", "(_", "Test", "Scatter", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "patch", "\\u", "draw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "patch_", "(_", "'", "glue", ".", "viewer", "s", ".", "common", ".", "qt", ".", "mpl", "\\u", "widget", ".", "Mp", "l", "Can", "vas", ".", "draw", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Draw", "Count_", "(_", "Test", "Scatter", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "xa", "tt", "\\u", "redraw", "s", "\\u", "once_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "patch", "\\u", "draw_", "(_", ")_", "as_", "draw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget_", "._", "ya", "tt_", "=_", "self_", "._", "widget_", "._", "xa", "tt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "draw_", "._", "call", "\\u", "count_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Draw", "Count_", "(_", "Test", "Scatter", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "swap", "\\u", "redraw", "s", "\\u", "once_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "patch", "\\u", "draw_", "(_", ")_", "as_", "draw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget_", "._", "swap", "\\u", "axes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "draw_", "._", "call", "\\u", "count_", "==_", "1_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
rvanlaar/easy-transifex/src/transifex/transifex/resources/tests/lib/validators/__init__.py
[ { "content": " def test_brackets(self):\n v = MatchingBracketsValidator()\n for c in MatchingBracketsValidator.bracket_chars:\n old = c + \"string\"\n new = c + \"trans\"\n v(old, new)\n new = \"trans\" + c\n v(old, new)\n new = \"tr\" + c + \"ans\"\n v(old, new)\n new = \"trans\"\n self.assertRaises(ValidationError, v, old, new)\n for c1 in MatchingBracketsValidator.bracket_chars:\n for c2 in MatchingBracketsValidator.bracket_chars:\n old = 'a' + c1 + 'b' + c2 + 'c'\n new = c1 + 'abc' + c2\n v(old, new)\n new = c2 + 'abc' + c1\n v\n new = c1 + 'abc'\n self.assertRaises(ValidationError, v, old, new)\n new = c2 + 'abc'\n self.assertRaises(ValidationError, v, old, new)", "metadata": "root.TestValidators.test_brackets", "header": "['class', 'TestValidators', '(', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def test_start_newlines(self):\n v = NewLineAtBeginningValidator()\n old = \"asdaf\"\n new = \"asdasa\"\n v(old, new)\n old = \"\\n asdasa\"\n self.assertRaises(ValidationError, v, old, new)\n new = \"\\nasdasdsaafsaf\"\n v(old, new)\n old = \"asadaaf\"\n self.assertRaises(ValidationError, v, old, new)", "metadata": "root.TestValidators.test_start_newlines", "header": "['class', 'TestValidators', '(', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_start_newlines(self):\n v = NewLineAtEndValidator()\n old = \"asdaf\"\n new = \"asdasa\"\n v(old, new)\n old = \"asdasa\\n\"\n self.assertRaises(ValidationError, v, old, new)\n new = \"asdasdsaafsaf\\n\"\n v(old, new)\n old = \"asadaaf\"\n self.assertRaises(ValidationError, v, old, new)", "metadata": "root.TestValidators.test_start_newlines", "header": "['class', 'TestValidators', '(', 'TestCase', ')', ':', '___EOS___']", "index": 91 } ]
[ { "span": "new ", "start_line": 41, "start_column": 16, "end_line": 41, "end_column": 19 }, { "span": "test_start_newlines(", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 27 } ]
[ { "span": "new ", "start_line": 43, "start_column": 16, "end_line": 43, "end_column": 19 }, { "span": "test_start_newlines(", "start_line": 91, "start_column": 8, "end_line": 91, "end_column": 27 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Validat", "ors_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "brackets", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "Match", "ing", "Bracket", "s", "Validator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "Match", "ing", "Bracket", "s", "Validator_", "._", "bracket", "\\u", "chars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old_", "=_", "c_", "+_", "\"", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "c_", "+_", "\"", "trans", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "\"", "trans", "\"_", "+_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "\"", "tr", "\"_", "+_", "c_", "+_", "\"", "ans", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "\"", "trans", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ",_", "v_", ",_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "c1_", "in_", "Match", "ing", "Bracket", "s", "Validator_", "._", "bracket", "\\u", "chars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "c2_", "in_", "Match", "ing", "Bracket", "s", "Validator_", "._", "bracket", "\\u", "chars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old_", "=_", "'", "a", "'_", "+_", "c1_", "+_", "'", "b", "'_", "+_", "c2_", "+_", "'", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "c1_", "+_", "'", "abc", "'_", "+_", "c2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "c2_", "+_", "'", "abc", "'_", "+_", "c1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "c1_", "+_", "'", "abc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ",_", "v_", ",_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "c2_", "+_", "'", "abc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ",_", "v_", ",_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Validat", "ors_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "start", "\\u", "newlines_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "New", "Line", "At", "Begin", "ning", "Validator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "\"", "asd", "af", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "\"", "asd", "asa", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "\"\\\\", "n", " ", "asd", "asa", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ",_", "v_", ",_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "\"\\\\", "nas", "das", "dsa", "af", "saf", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "\"", "asa", "da", "af", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ",_", "v_", ",_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Validat", "ors_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "start", "\\u", "newlines_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "New", "Line", "At", "End", "Validator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "\"", "asd", "af", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "\"", "asd", "asa", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "\"", "asd", "asa", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ",_", "v_", ",_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "\"", "asd", "asd", "sa", "af", "saf", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "\"", "asa", "da", "af", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
babble/babble/include/jython/Lib/bdb.py
[ { "content": " def clear_bpbynumber(self, arg):\n try:\n number = int(arg)\n except:\n return 'Non-numeric breakpoint number (%s)' % arg\n try:\n bp = Breakpoint.bpbynumber[number]\n except IndexError:\n return 'Breakpoint number (%d) out of range' % number\n if not bp:\n return 'Breakpoint (%d) already deleted' % number\n self.clear_break(bp.file, bp.line)", "metadata": "root.Bdb.clear_bpbynumber", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 252 }, { "content": "def effective(file, line, frame):\n \"\"\"Determine which breakpoint for this file:line is to be acted upon.\n\n Called only if we know there is a bpt at this\n location. Returns breakpoint that was triggered and a flag\n that indicates if it is ok to delete a temporary bp.\n\n \"\"\"\n possibles = Breakpoint.bplist[file,line]\n for i in range(0, len(possibles)):\n b = possibles[i]\n if b.enabled == 0:\n continue\n if not checkfuncname(b, frame):\n continue\n # Count every hit when bp is enabled\n b.hits = b.hits + 1\n if not b.cond:\n # If unconditional, and ignoring,\n # go on to next, else break\n if b.ignore > 0:\n b.ignore = b.ignore -1\n continue\n else:\n # breakpoint and marker that's ok\n # to delete if temporary\n return (b,1)\n else:\n # Conditional bp.\n # Ignore count applies only to those bpt hits where the\n # condition evaluates to true.\n try:\n val = eval(b.cond, frame.f_globals,\n frame.f_locals)\n if val:\n if b.ignore > 0:\n b.ignore = b.ignore -1\n # continue\n else:\n return (b,1)\n # else:\n # continue\n except:\n # if eval fails, most conservative\n # thing is to stop on breakpoint\n # regardless of ignore count.\n # Don't delete temporary,\n # as another hint to user.\n return (b,0)\n return (None, None)", "metadata": "root.effective", "header": "['module', '___EOS___']", "index": 528 } ]
[ { "span": "except:", "start_line": 255, "start_column": 8, "end_line": 255, "end_column": 15 }, { "span": "except:", "start_line": 570, "start_column": 12, "end_line": 570, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\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", "\\u", "bp", "by", "number_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\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 ", " _", "number_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Non", "-", "numeri", "c", " ", "break", "point", " ", "number", " ", "(%", "s", ")'_", "%_", "arg_", "\\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 ", " _", "bp_", "=_", "Breakpoint", "_", "._", "bp", "by", "number_", "[_", "number_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Breakpoint", " ", "number", " ", "(%", "d", ")", " ", "out", " ", "of", " ", "range", "'_", "%_", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "bp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Breakpoint", " ", "(%", "d", ")", " ", "alr", "ead", "y", " ", "delete", "d", "'_", "%_", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "clear", "\\u", "break_", "(_", "bp_", "._", "file_", ",_", "bp_", "._", "line_", ")_", "\\u\\u\\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_", "effective", "_", "(_", "file_", ",_", "line_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", " ", "whi", "ch", " ", "break", "point", " ", "for", " ", "this", " ", "file", ":", "line", " ", "is", " ", "to", " ", "be", " ", "acte", "d", " ", "upo", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "only", " ", "if", " ", "we", " ", "know", " ", "there", " ", "is", " ", "a", " ", "bp", "t", " ", "at", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "location", ".", " ", " ", "Return", "s", " ", "break", "point", " ", "tha", "t", " ", "was", " ", "trigger", "ed", " ", "and", " ", "a", " ", "flag", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "indicat", "es", " ", "if", " ", "it", " ", "is", " ", "ok", " ", "to", " ", "delete", " ", "a", " ", "temporar", "y", " ", "bp", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possib", "les_", "=_", "Breakpoint", "_", "._", "bp", "list_", "[_", "file_", ",_", "line_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "possib", "les_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "possib", "les_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "._", "enabled_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "check", "funcname_", "(_", "b_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Count", " ", "every", " ", "hit", " ", "whe", "n", " ", "bp", " ", "is", " ", "enabled_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "._", "hits_", "=_", "b_", "._", "hits_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "b_", "._", "cond_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "uncon", "dition", "al", ",", " ", "and", " ", "ign", "orin", "g", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "go", " ", "on", " ", "to", " ", "next", ",", " ", "else", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "b_", "._", "ignore_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "ignore_", "=_", "b_", "._", "ignore_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "break", "point", " ", "and", " ", "marker", " ", "tha", "t", "'", "s", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "delete", " ", "if", " ", "temporar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "b_", ",_", "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_", "#", " ", "Cond", "itional", " ", "bp", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "count", " ", "appli", "es", " ", "only", " ", "to", " ", "tho", "se", " ", "bp", "t", " ", "hits", " ", "where", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "condition", " ", "evaluate", "s", " ", "to", " ", "true", "._", "\\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 ", " _", "val_", "=_", "eval_", "(_", "b_", "._", "cond_", ",_", "frame_", "._", "f", "\\u", "globals_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frame_", "._", "f", "\\u", "locals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "b_", "._", "ignore_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "b_", "._", "ignore_", "=_", "b_", "._", "ignore_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "continue_", "\\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 ", " ", " _", "return_", "(_", "b_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "eval", " ", "fail", "s", ",", " ", "most", " ", "conserv", "ative_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thing", " ", "is", " ", "to", " ", "stop", " ", "on", " ", "breakpoint_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rega", "rd", "less", " ", "of", " ", "ignore", " ", "count", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "delete", " ", "temporar", "y", ",_", "\\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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
ImageEngine/gaffer/python/GafferSceneTest/DuplicateTest.py
[ { "content": "\tdef testNamePlugAffects( self ) :\n\n\t\td = GafferScene.Duplicate()\n\t\tcs = GafferTest.CapturingSlot( d.plugDirtiedSignal() )\n\n\t\td[\"name\"].setValue( \"test\" )\n\t\tself.assertTrue( d[\"out\"][\"childNames\"] in [ c[0] for c in cs ] )", "metadata": "root.DuplicateTest.testNamePlugAffects", "header": "['class', 'DuplicateTest', '(', 'GafferSceneTest', '.', 'SceneTestCase', ')', ':', '___EOS___']", "index": 149 } ]
[ { "span": "self.assertTrue( d[\"out\"][\"childNames\"] in [ c[0] for c in cs ] )", "start_line": 155, "start_column": 2, "end_line": 155, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Duplicate", "Test_", "(_", "Ga", "ffer", "Scen", "e", "Test_", "._", "Scen", "e", "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", "Name", "Plug", "Affect", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "d_", "=_", "Ga", "ffer", "Scene_", "._", "Duplicate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cs_", "=_", "Ga", "ffer", "Test_", "._", "Captur", "ing", "Slot_", "(_", "d_", "._", "plug", "Dir", "tied", "Signal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "[_", "\"", "name", "\"_", "]_", "._", "set", "Value_", "(_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "d_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "child", "Names", "\"_", "]_", "in_", "[_", "c_", "[_", "0_", "]_", "for_", "c_", "in_", "cs_", "]_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
zbyte64/django-hyperadmin/hyperadmin/resources/__init__.py
[ { "content": "from hyperadmin.resources.resources import BaseResource\nfrom hyperadmin.resources.endpoints import ResourceEndpoint\nfrom hyperadmin.resources.crud import CRUDResource\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from hyperadmin.resources.resources import BaseResource", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 55 }, { "span": "from hyperadmin.resources.endpoints import ResourceEndpoint", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 59 }, { "span": "from hyperadmin.resources.crud import CRUDResource", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "hyper", "admin_", "._", "resources_", "._", "resources_", "import_", "Base", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hyper", "admin_", "._", "resources_", "._", "endpoints_", "import_", "Reso", "urc", "e", "Endpoint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hyper", "admin_", "._", "resources_", "._", "crud", "_", "import_", "CRUD", "Resource_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
pydata/pandas/scripts/roll_median_leak.py
[ { "content": "from __future__ import print_function\nfrom pandas import *\n\nimport numpy as np\nimport os\n\nfrom vbench.api import Benchmark\nfrom pandas.util.testing import rands\nfrom pandas.compat import range\nimport pandas.lib as lib\nimport pandas._sandbox as sbx\nimport time\n\nimport psutil\n\npid = os.getpid()\nproc = psutil.Process(pid)\n\nlst = SparseList()\nlst.append([5] * 10000)\nlst.append(np.repeat(np.nan, 1000000))\n\nfor _ in range(10000):\n print(proc.get_memory_info())\n sdf = SparseDataFrame({'A': lst.to_array()})\n chunk = sdf[sdf['A'] == 5]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from vbench.api import Benchmark", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 32 }, { "span": "from pandas.util.testing import rands", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 37 }, { "span": "import pandas.lib as lib", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 24 }, { "span": "import pandas._sandbox as sbx", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 29 }, { "span": "import time", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "vb", "ench", "_", "._", "api_", "import_", "Benchmark", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "._", "util_", "._", "testing_", "import_", "rand", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "._", "compat_", "import_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "._", "lib_", "as_", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "._", "\\u", "sandbox_", "as_", "sb", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pid_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "psutil_", "._", "Process_", "(_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lst_", "=_", "Spar", "se", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lst_", "._", "append_", "(_", "[_", "5_", "]_", "*_", "10000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lst_", "._", "append_", "(_", "np_", "._", "repeat_", "(_", "np_", "._", "nan_", ",_", "1000000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "10000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "proc_", "._", "get", "\\u", "memory", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sdf", "_", "=_", "Spar", "se", "Data", "Frame_", "(_", "{_", "'", "A", "'_", ":_", "lst_", "._", "to", "\\u", "array_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "sdf", "_", "[_", "sdf", "_", "[_", "'", "A", "'_", "]_", "==_", "5_", "]_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
QuantEcon/QuantEcon.py/quantecon/game_theory/tests/test_normal_form_game.py
[ { "content": "@raises(ValueError)\ndef test_normalformgame_invalid_input_players_shape_inconsistent():\n p0 = Player(np.zeros((2, 3)))\n p1 = Player(np.zeros((2, 3)))\n g = NormalFormGame([p0, p1])", "metadata": "root.test_normalformgame_invalid_input_players_shape_inconsistent", "header": "['module', '___EOS___']", "index": 325 }, { "content": "@raises(ValueError)\ndef test_normalformgame_invalid_input_players_num_inconsistent():\n p0 = Player(np.zeros((2, 2, 2)))\n p1 = Player(np.zeros((2, 2, 2)))\n g = NormalFormGame([p0, p1])", "metadata": "root.test_normalformgame_invalid_input_players_num_inconsistent", "header": "['module', '___EOS___']", "index": 332 }, { "content": "@raises(ValueError)\ndef test_normalformgame_invalid_input_players_dtype_inconsistent():\n p0 = Player(np.zeros((2, 2), dtype=int))\n p1 = Player(np.zeros((2, 2), dtype=float))\n g = NormalFormGame([p0, p1])", "metadata": "root.test_normalformgame_invalid_input_players_dtype_inconsistent", "header": "['module', '___EOS___']", "index": 339 }, { "content": "@raises(ValueError)\ndef test_normalformgame_invalid_input_nosquare_matrix():\n g = NormalFormGame(np.zeros((2, 3)))", "metadata": "root.test_normalformgame_invalid_input_nosquare_matrix", "header": "['module', '___EOS___']", "index": 346 }, { "content": "@raises(ValueError)\ndef test_normalformgame_invalid_input_payoff_profiles():\n g = NormalFormGame(np.zeros((2, 2, 1)))", "metadata": "root.test_normalformgame_invalid_input_payoff_profiles", "header": "['module', '___EOS___']", "index": 351 } ]
[ { "span": "g ", "start_line": 329, "start_column": 4, "end_line": 329, "end_column": 5 }, { "span": "g ", "start_line": 336, "start_column": 4, "end_line": 336, "end_column": 5 }, { "span": "g ", "start_line": 343, "start_column": 4, "end_line": 343, "end_column": 5 }, { "span": "g ", "start_line": 348, "start_column": 4, "end_line": 348, "end_column": 5 }, { "span": "g ", "start_line": 353, "start_column": 4, "end_line": 353, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "normal", "form", "game", "\\u", "invalid", "\\u", "input", "\\u", "player", "s", "\\u", "shape", "\\u", "inconsistent", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p0_", "=_", "Player_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "Player_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "Normal", "Form", "Game_", "(_", "[_", "p0_", ",_", "p1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "normal", "form", "game", "\\u", "invalid", "\\u", "input", "\\u", "player", "s", "\\u", "num", "\\u", "inconsistent", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p0_", "=_", "Player_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "2_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "Player_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "2_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "Normal", "Form", "Game_", "(_", "[_", "p0_", ",_", "p1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "normal", "form", "game", "\\u", "invalid", "\\u", "input", "\\u", "player", "s", "\\u", "dt", "ype", "\\u", "inconsistent", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p0_", "=_", "Player_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "2_", ")_", ",_", "dtype_", "=_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "Player_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "2_", ")_", ",_", "dtype_", "=_", "float_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "Normal", "Form", "Game_", "(_", "[_", "p0_", ",_", "p1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "normal", "form", "game", "\\u", "invalid", "\\u", "input", "\\u", "nos", "quare", "\\u", "matrix_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "Normal", "Form", "Game_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "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_", "@_", "raises_", "(_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "normal", "form", "game", "\\u", "invalid", "\\u", "input", "\\u", "payoff", "\\u", "profiles_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "Normal", "Form", "Game_", "(_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "2_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
bt3gl/Neat-Problems-in-Python-and-Flask/USEFUL/snippets_and_examples_Flask/example_role_permission/app/models.py
[ { "content": " def confirm(self, token):\n s = Serializer(current_app.config['SECRET_KEY'])\n try:\n data = s.loads(token)\n except:\n return False\n if data.get('confirm') != self.id:\n return False\n self.confirmed = True\n db.session.add(self)\n return True", "metadata": "root.User.confirm", "header": "['class', 'User', '(', 'UserMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 80 }, { "content": " def reset_password(self, token, new_password):\n s = Serializer(current_app.config['SECRET_KEY'])\n try:\n data = s.loads(token)\n except:\n return False\n if data.get('reset') != self.id:\n return False\n self.password = new_password\n db.session.add(self)\n return True", "metadata": "root.User.reset_password", "header": "['class', 'User', '(', 'UserMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 96 }, { "content": " def change_email(self, token):\n s = Serializer(current_app.config['SECRET_KEY'])\n try:\n data = s.loads(token)\n except:\n return False\n if data.get('change_email') != self.id:\n return False\n new_email = data.get('new_email')\n if new_email is None:\n return False\n if self.query.filter_by(email=new_email).first() is not None:\n return False\n self.email = new_email\n db.session.add(self)\n return True", "metadata": "root.User.change_email", "header": "['class', 'User', '(', 'UserMixin', ',', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 112 } ]
[ { "span": "except:", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 15 }, { "span": "except:", "start_line": 100, "start_column": 8, "end_line": 100, "end_column": 15 }, { "span": "except:", "start_line": 116, "start_column": 8, "end_line": 116, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "User_", "(_", "User", "Mixin_", ",_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "confirm_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Serializer_", "(_", "current", "\\u", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "s_", "._", "loads_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "._", "get_", "(_", "'", "confirm", "'_", ")_", "!=_", "self_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "confirmed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "add_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "User", "Mixin_", ",_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset", "\\u", "password_", "(_", "self_", ",_", "token_", ",_", "new", "\\u", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Serializer_", "(_", "current", "\\u", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "s_", "._", "loads_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "._", "get_", "(_", "'", "reset", "'_", ")_", "!=_", "self_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "password_", "=_", "new", "\\u", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "add_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "User", "Mixin_", ",_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "\\u", "email_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Serializer_", "(_", "current", "\\u", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "s_", "._", "loads_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "._", "get_", "(_", "'", "change", "\\u", "email", "'_", ")_", "!=_", "self_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "email_", "=_", "data_", "._", "get_", "(_", "'", "new", "\\u", "email", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "email_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "email_", "=_", "new", "\\u", "email_", ")_", "._", "first_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "email_", "=_", "new", "\\u", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "add_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
hoytak/lazyrunner/test/test_environment/processor/__init__.py
[ { "content": "import process", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import process", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "process_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1 ]
Unused import
aldebaran/qibuild/python/qibuild/test/test_open.py
[ { "content": "## Copyright (c) 2012-2016 Aldebaran Robotics. All rights reserved.\n## Use of this source code is governed by a BSD-style license that can be\n## found in the COPYING file.\n\n\"\"\" testing for qibuild open\n\n\"\"\"\n\nimport StringIO\nimport unittest\nimport mock\nimport pytest\n\nimport qisys.error\nimport qibuild.actions.open\n\n\n\n\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OpenTestCase(unittest.TestCase):\n\n\n\n\n\n\n", "metadata": "root.OpenTestCase", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def setUp(self):\n self.ask_patcher = mock.patch('qisys.interact.ask_choice')\n self.ask_mock = self.ask_patcher.start()", "metadata": "root.OpenTestCase.setUp", "header": "['class', 'OpenTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_no_ide_in_conf(self):\n empty_cfg = qibuild.config.QiBuildConfig()\n self.assertEqual(qibuild.actions.open.get_ide(empty_cfg), None)", "metadata": "root.OpenTestCase.test_no_ide_in_conf", "header": "['class', 'OpenTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_qt_creator_in_conf(self):\n qibuild_cfg = qibuild.config.QiBuildConfig()\n qt_creator = qibuild.config.IDE()\n qt_creator.name = \"QtCreator\"\n qt_creator.path = \"/path/to/qtsdk/bin/qtcreator\"\n qibuild_cfg.add_ide(qt_creator)\n ide = qibuild.actions.open.get_ide(qibuild_cfg)\n self.assertEqual(ide.name, \"QtCreator\")\n self.assertEqual(ide.path, \"/path/to/qtsdk/bin/qtcreator\")\n self.assertFalse(self.ask_mock.called)", "metadata": "root.OpenTestCase.test_qt_creator_in_conf", "header": "['class', 'OpenTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_two_ides(self):\n qibuild_cfg = qibuild.config.QiBuildConfig()\n vs = qibuild.config.IDE()\n vs.name = \"Visual Studio\"\n qt_creator = qibuild.config.IDE()\n qt_creator.name = \"QtCreator\"\n qt_creator.path = r\"C:\\QtSDK\\bin\\QtCreator\"\n qibuild_cfg.add_ide(qt_creator)\n qibuild_cfg.add_ide(vs)\n self.ask_mock.return_value = \"QtCreator\"\n ide = qibuild.actions.open.get_ide(qibuild_cfg)\n self.assertEqual(ide.name, \"QtCreator\")\n self.assertEqual(ide.path, r\"C:\\QtSDK\\bin\\QtCreator\")\n call_args_list = self.ask_mock.call_args_list\n self.assertEqual(len(call_args_list), 1)\n (choices, _question) = call_args_list[0][0]\n self.assertEqual(choices, ['Visual Studio', 'QtCreator'])", "metadata": "root.OpenTestCase.test_two_ides", "header": "['class', 'OpenTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_two_ides_matching_default_conf(self):\n global_cfg = StringIO.StringIO(r\"\"\"\n<qibuild version=\"1\">\n <config name=\"win32-vs2010\" ide=\"Visual Studio\" />\n <config name=\"mingw\" ide=\"QtCreator\" />\n <ide name=\"Visual Studio\" />\n <ide name=\"QtCreator\" path=\"C:\\QtSDK\\bin\\QtCreator\" />\n</qibuild>\n\"\"\")\n\n qibuild_cfg = qibuild.config.QiBuildConfig()\n qibuild_cfg.read(global_cfg, create_if_missing=False)\n local_cfg = StringIO.StringIO(r\"\"\"\n<qibuild version=\"1\">\n <defaults config=\"mingw\" />\n</qibuild>\n\"\"\")\n qibuild_cfg.read_local_config(local_cfg)\n ide = qibuild.actions.open.get_ide(qibuild_cfg)\n self.assertEqual(ide.name, \"QtCreator\")\n self.assertEqual(ide.path, r\"C:\\QtSDK\\bin\\QtCreator\")", "metadata": "root.OpenTestCase.test_two_ides_matching_default_conf", "header": "['class', 'OpenTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_two_ides_matching_user_conf(self):\n # A default config in local config file,\n # but user used -c\n qibuild_cfg = qibuild.config.QiBuildConfig()\n global_cfg = StringIO.StringIO(r\"\"\"\n<qibuild version=\"1\">\n <config name=\"win32-vs2010\" ide=\"Visual Studio\" />\n <config name=\"mingw\" ide=\"QtCreator\" />\n <ide name=\"Visual Studio\" />\n <ide name=\"QtCreator\" path=\"C:\\QtSDK\\bin\\QtCreator\" />\n</qibuild>\n\"\"\")\n qibuild_cfg.read(global_cfg, create_if_missing=False)\n qibuild_cfg.set_active_config(\"win32-vs2010\")\n ide = qibuild.actions.open.get_ide(qibuild_cfg)\n self.assertEqual(ide.name, \"Visual Studio\")\n self.assertFalse(self.ask_mock.called)", "metadata": "root.OpenTestCase.test_two_ides_matching_user_conf", "header": "['class', 'OpenTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def tearDown(self):\n self.ask_patcher.stop()", "metadata": "root.OpenTestCase.tearDown", "header": "['class', 'OpenTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 96 }, { "content": "def test_eclipse_cdt_in_conf(record_messages):\n qibuild_cfg = qibuild.config.QiBuildConfig()\n eclipse = qibuild.config.IDE()\n eclipse.name = \"Eclipse CDT\"\n qibuild_cfg.add_ide(eclipse)\n # pylint:disable-msg=E1101\n with pytest.raises(SystemExit) as e:\n qibuild.actions.open.get_ide(qibuild_cfg)\n assert e.value.code != 0\n assert not record_messages.find(\"Could not find any IDE in configuration\")\n assert record_messages.find(\"`qibuild open` only supports\")", "metadata": "root.test_eclipse_cdt_in_conf", "header": "['module', '___EOS___']", "index": 100 } ]
[ { "span": "import qisys.error", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2016", " ", "Al", "deb", "aran", " ", "Robot", "ics", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Us", "e", " ", "of", " ", "this", " ", "source", " ", "code", " ", "is", " ", "govern", "ed", " ", "by", " ", "a", " ", "BS", "D", "-", "style", " ", "license", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "found", " ", "in", " ", "the", " ", "COPY", "ING", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "testi", "ng", " ", "for", " ", "qi", "build", " ", "open", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "qi", "sys_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "build_", "._", "actions_", "._", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ask", "\\u", "patcher_", "=_", "mock_", "._", "patch_", "(_", "'", "qi", "sys", ".", "interact", ".", "ask", "\\u", "choice", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ask", "\\u", "mock_", "=_", "self_", "._", "ask", "\\u", "patcher_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "ide", "\\u", "in", "\\u", "conf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "empty", "\\u", "cfg_", "=_", "qi", "build_", "._", "config_", "._", "Qi", "Build", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qi", "build_", "._", "actions_", "._", "open_", "._", "get", "\\u", "ide_", "(_", "empty", "\\u", "cfg_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "qt", "\\u", "creat", "or", "\\u", "in", "\\u", "conf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "cfg_", "=_", "qi", "build_", "._", "config_", "._", "Qi", "Build", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "creator_", "=_", "qi", "build_", "._", "config_", "._", "IDE", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "creator_", "._", "name_", "=_", "\"", "Qt", "Creat", "or", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "creator_", "._", "path_", "=_", "\"/", "path", "/", "to", "/", "qt", "sd", "k", "/", "bin", "/", "qt", "creat", "or", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "add", "\\u", "ide_", "(_", "qt", "\\u", "creator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ide_", "=_", "qi", "build_", "._", "actions_", "._", "open_", "._", "get", "\\u", "ide_", "(_", "qi", "build", "\\u", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ide_", "._", "name_", ",_", "\"", "Qt", "Creat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ide_", "._", "path_", ",_", "\"/", "path", "/", "to", "/", "qt", "sd", "k", "/", "bin", "/", "qt", "creat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "ask", "\\u", "mock_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "ides", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "cfg_", "=_", "qi", "build_", "._", "config_", "._", "Qi", "Build", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vs_", "=_", "qi", "build_", "._", "config_", "._", "IDE", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vs_", "._", "name_", "=_", "\"", "Vis", "ual", " ", "Stud", "io", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "creator_", "=_", "qi", "build_", "._", "config_", "._", "IDE", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "creator_", "._", "name_", "=_", "\"", "Qt", "Creat", "or", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "creator_", "._", "path_", "=_", "r", "\"", "C", ":\\\\", "Qt", "SD", "K", "\\\\", "bin", "\\\\", "Qt", "Creat", "or", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "add", "\\u", "ide_", "(_", "qt", "\\u", "creator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "add", "\\u", "ide_", "(_", "vs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ask", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "\"", "Qt", "Creat", "or", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ide_", "=_", "qi", "build_", "._", "actions_", "._", "open_", "._", "get", "\\u", "ide_", "(_", "qi", "build", "\\u", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ide_", "._", "name_", ",_", "\"", "Qt", "Creat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ide_", "._", "path_", ",_", "r", "\"", "C", ":\\\\", "Qt", "SD", "K", "\\\\", "bin", "\\\\", "Qt", "Creat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args", "\\u", "list_", "=_", "self_", "._", "ask", "\\u", "mock_", "._", "call", "\\u", "args", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "call", "\\u", "args", "\\u", "list_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "choices_", ",_", "\\u", "question_", ")_", "=_", "call", "\\u", "args", "\\u", "list_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "choices_", ",_", "[_", "'", "Vis", "ual", " ", "Stud", "io", "'_", ",_", "'", "Qt", "Creat", "or", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "ides", "\\u", "matchi", "ng", "\\u", "default", "\\u", "conf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "\\u", "cfg_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "r", "\"\"\"", "\\", "10", ";<", "qi", "build", " ", "version", "=\"", "1", "\">", "\\", "10", ";", " ", " ", "<", "config", " ", "name", "=\"", "win32", "-", "vs", "2010", "\"", " ", "ide", "=\"", "Vis", "ual", " ", "Stud", "io", "\"", " ", "/>", "\\", "10", ";", " ", " ", "<", "config", " ", "name", "=\"", "ming", "w", "\"", " ", "ide", "=\"", "Qt", "Creat", "or", "\"", " ", "/>", "\\", "10", ";", " ", " ", "<", "ide", " ", "name", "=\"", "Vis", "ual", " ", "Stud", "io", "\"", " ", "/>", "\\", "10", ";", " ", " ", "<", "ide", " ", "name", "=\"", "Qt", "Creat", "or", "\"", " ", "path", "=\"", "C", ":\\\\", "Qt", "SD", "K", "\\\\", "bin", "\\\\", "Qt", "Creat", "or", "\"", " ", "/>", "\\", "10", ";<", "/", "qi", "build", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "=_", "qi", "build_", "._", "config_", "._", "Qi", "Build", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "read_", "(_", "global", "\\u", "cfg_", ",_", "create", "\\u", "if", "\\u", "missing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "cfg_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "r", "\"\"\"", "\\", "10", ";<", "qi", "build", " ", "version", "=\"", "1", "\">", "\\", "10", ";", " ", " ", "<", "default", "s", " ", "config", "=\"", "ming", "w", "\"", " ", "/>", "\\", "10", ";<", "/", "qi", "build", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "read", "\\u", "local", "\\u", "config_", "(_", "local", "\\u", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ide_", "=_", "qi", "build_", "._", "actions_", "._", "open_", "._", "get", "\\u", "ide_", "(_", "qi", "build", "\\u", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ide_", "._", "name_", ",_", "\"", "Qt", "Creat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ide_", "._", "path_", ",_", "r", "\"", "C", ":\\\\", "Qt", "SD", "K", "\\\\", "bin", "\\\\", "Qt", "Creat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "ides", "\\u", "matchi", "ng", "\\u", "user", "\\u", "conf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "default", " ", "config", " ", "in", " ", "local", " ", "config", " ", "file", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "user", " ", "used", " ", "-", "c_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "cfg_", "=_", "qi", "build_", "._", "config_", "._", "Qi", "Build", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "cfg_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "r", "\"\"\"", "\\", "10", ";<", "qi", "build", " ", "version", "=\"", "1", "\">", "\\", "10", ";", " ", " ", "<", "config", " ", "name", "=\"", "win32", "-", "vs", "2010", "\"", " ", "ide", "=\"", "Vis", "ual", " ", "Stud", "io", "\"", " ", "/>", "\\", "10", ";", " ", " ", "<", "config", " ", "name", "=\"", "ming", "w", "\"", " ", "ide", "=\"", "Qt", "Creat", "or", "\"", " ", "/>", "\\", "10", ";", " ", " ", "<", "ide", " ", "name", "=\"", "Vis", "ual", " ", "Stud", "io", "\"", " ", "/>", "\\", "10", ";", " ", " ", "<", "ide", " ", "name", "=\"", "Qt", "Creat", "or", "\"", " ", "path", "=\"", "C", ":\\\\", "Qt", "SD", "K", "\\\\", "bin", "\\\\", "Qt", "Creat", "or", "\"", " ", "/>", "\\", "10", ";<", "/", "qi", "build", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "read_", "(_", "global", "\\u", "cfg_", ",_", "create", "\\u", "if", "\\u", "missing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "set\\u", "active", "\\u", "config_", "(_", "\"", "win32", "-", "vs", "2010", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ide_", "=_", "qi", "build_", "._", "actions_", "._", "open_", "._", "get", "\\u", "ide_", "(_", "qi", "build", "\\u", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ide_", "._", "name_", ",_", "\"", "Vis", "ual", " ", "Stud", "io", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "ask", "\\u", "mock_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ask", "\\u", "patcher_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eclipse", "\\u", "cd", "t", "\\u", "in", "\\u", "conf_", "(_", "record", "\\u", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "cfg_", "=_", "qi", "build_", "._", "config_", "._", "Qi", "Build", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eclipse", "_", "=_", "qi", "build_", "._", "config_", "._", "IDE", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eclipse", "_", "._", "name_", "=_", "\"", "Ecl", "ipse", " ", "CD", "T", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "cfg_", "._", "add", "\\u", "ide_", "(_", "eclipse", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", "disable", "-", "msg", "=", "E1", "101_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "System", "Exit_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build_", "._", "actions_", "._", "open_", "._", "get", "\\u", "ide_", "(_", "qi", "build", "\\u", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "e_", "._", "value_", "._", "code_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "record", "\\u", "messages_", "._", "find_", "(_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "any", " ", "IDE", " ", "in", " ", "configura", "tion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "record", "\\u", "messages_", "._", "find_", "(_", "\"`", "qi", "build", " ", "open", "`", " ", "only", " ", "support", "s", "\"_", ")_", "\\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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 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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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 ]
Unused import
skyostil/tracy/src/analyzer/plugins/gles/GlesReport.py
[ { "content": "# Copyright (c) 2011 Nokia\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n\n\"\"\"GLES performance report generator.\"\"\"\n\nimport Report\nimport ReportGenerator\nfrom common import Task\nimport Trace\nimport GlesTraceOperations\nimport GlesChecklist\nimport Common\nfrom common import Log\nimport os\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def addRenderTargetSection(g):\n s = g.report.create(Report.Section, \"Render targets\")\n \n # Check the used EGL configurations and surfaces\n configs = set()\n for event in g.trace.events:\n for key, value in event.values.items():\n if isinstance(value, Trace.Object):\n if value.cls.name == \"EGLConfig\":\n id = value.attrs.get(\"config_id\")\n if not id or id in configs:\n continue\n configs.add(id)\n s2 = s.create(Report.Section, \"EGL configuration #%d\" % id)\n t = s2.create(Report.Table, [\"Property\", \"Value\"])\n for cfgKey, cfgValue in value.attrs.items():\n cfgKey = cfgKey.replace(\"_\", \" \").capitalize()\n t.addRow(cfgKey, cfgValue)\n if event.name == \"eglCreateWindowSurface\":\n window = event.values.get(\"window\")\n \n if not window:\n continue\n \n s2 = s.create(Report.Section, \"Window surface 0x%x\" % event.values[None].id)\n t = s2.create(Report.Table, [\"Property\", \"Value\"])\n t.addRow(\"Width\", window.attrs[\"width\"])\n t.addRow(\"Height\", window.attrs[\"height\"])\n t.addRow(\"Config ID\", event.values[\"config\"].id)\n elif event.name == \"eglCreatePixmapSurface\":\n pixmap = event.values.get(\"pixmap\")\n \n if not pixmap:\n continue\n \n s2 = s.create(Report.Section, \"Pixmap surface 0x%x\" % event.values[None].id)\n t = s2.create(Report.Table, [\"Property\", \"Value\"])\n t.addRow(\"Width\", pixmap.attrs[\"width\"])\n t.addRow(\"Height\", pixmap.attrs[\"height\"])\n t.addRow(\"Config ID\", event.values[\"config\"].id)\n elif event.name == \"eglCreatePbufferSurface\": \n attrs = event.values.get(\"attrib_list\")\n \n if not attrs:\n continue\n \n try:\n width = attrs[attrs.index(g.constants.EGL_WIDTH) + 1]\n height = attrs[attrs.index(g.constants.EGL_HEIGHT) + 1]\n except ValueError:\n continue\n\n s2 = s.create(Report.Section, \"Pbuffer surface 0x%x\" % event.values[None].id)\n t = s2.create(Report.Table, [\"Property\", \"Value\"])\n t.addRow(\"Width\", width)\n t.addRow(\"Height\", height)\n t.addRow(\"Config ID\", event.values[\"config\"].id)", "metadata": "root.addRenderTargetSection", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def generateReport(project, trace, traceFileName, path, format):\n if traceFileName:\n title = \"OpenGL ES performance report for %s\" % os.path.basename(traceFileName)\n else:\n title = \"OpenGL ES performance report\"\n \n g = ReportGenerator.ReportGenerator(project, trace, title, path, format)\n\n # Calculate GLES specific stats\n GlesTraceOperations.calculateStatistics(project, trace)\n\n # Calculate general stats\n g.calculateStatistics()\n\n # Add some general information first\n section = g.report.create(Report.Section, \"General statistics\")\n table = g.createGeneralStatisticsTable()\n \n if traceFileName:\n table.addRow(\"File name\", traceFileName)\n\n section.add(table)\n \n # Add a section about the used render targets\n addRenderTargetSection(g)\n \n # Add an overall timeline of all events\n g.report.add(g.createEventPlot(\"Event distribution\", trace.events))\n\n # Add a graph about the event type distribution\n g.report.add(g.createEventFrequencyPlot(\"Operation distribution\", trace.events))\n \n # Add overview section\n overviewSection = g.report.create(Report.Section, \"Overview\")\n \n # Frame thumbnails\n thumbnailSection = overviewSection.create(Report.Section, \"Selected frames\")\n thumbnails = g.createEventThumbnails([f.swapEvent for f in g.interestingFrames])\n \n for frame, thumbnail in zip(g.interestingFrames, thumbnails):\n thumbnailSection.create(Report.Link, \"#frame%d\" % (frame.number + 1), thumbnail)\n\n # Textures\n textureLoaders = GlesTraceOperations.getTextureLoaders(project, trace)\n \n if textureLoaders:\n textureSection = overviewSection.create(Report.Section, \"Loaded textures\")\n task = Task.startTask(\"load-textures\", \"Loading textures\", len(textureLoaders))\n for event, func in textureLoaders:\n task.step()\n image = func().convert(\"RGBA\")\n fn = os.path.join(path, \"texture%03d.png\" % event.seq)\n image.save(fn)\n textureSection.create(Report.Image, fn)\n\n # FPS\n data = [1.0 / f.duration for f in g.frames]\n plot = g.createPlot(\"Frames per second\", range(len(g.frames)), data)\n overviewSection.add(plot)\n\n # Render calls\n data = [len(f.events) for f in g.frames]\n plot = g.createPlot(\"Number of API calls per frame\", range(len(g.frames)), data)\n overviewSection.add(plot)\n\n # Overdraw\n data = [f.swapEvent.sensorData.get(\"draw_ratio\", 0) for f in g.frames]\n plot = g.createPlot(\"Draw ratio\", range(len(g.frames)), data)\n overviewSection.add(plot)\n\n # Fragment count\n data = [f.swapEvent.sensorData.get(\"rasterizer_pixels\", 0) for f in g.frames]\n plot = g.createPlot(\"Rasterized fragments per frame\", range(len(g.frames)), data)\n overviewSection.add(plot)\n\n # Texture reads\n data = [f.swapEvent.sensorData.get(\"rasterizer_texel_fetches\", 0) for f in g.frames]\n plot = g.createPlot(\"Texel fetches per frame\", range(len(g.frames)), data)\n overviewSection.add(plot)\n\n # Texture uploads\n data = [f.swapEvent.sensorData.get(\"texel_uploads\", 0) for f in g.frames]\n plot = g.createPlot(\"Texel uploads per frame\", range(len(g.frames)), data)\n overviewSection.add(plot)\n\n # Now go over each interesting frame\n task = Task.startTask(\"frame-report\", \"Generating report\", len(g.interestingFrames))\n frameDetailSection = g.report.create(Report.Section, \"Detailed frame statistics\")\n \n for frame in g.interestingFrames:\n task.step()\n frameSection = g.createFrameSection(frame)\n \n # Add some custom plots\n plot = g.createSensorPlot(frame, \"rasterizer_pixels\")\n frameSection.add(plot)\n plot = g.createSensorPlot(frame, \"rasterizer_texel_fetches\")\n frameSection.add(plot)\n plot = g.createSensorPlot(frame, \"texel_uploads\")\n frameSection.add(plot)\n \n # Now go over the individual render calls + the swap event\n for event in frame.renderEvents + [frame.swapEvent]:\n eventSection = g.createEventSection(event)\n frameSection.add(eventSection)\n\n frameDetailSection.add(frameSection)\n\n # Add the checklist result\n g.report.add(g.createChecklistSection(\"Performance Checklist\", GlesChecklist.checklistItems))\n\n # Finalize the report\n task.finish()\n g.generate()", "metadata": "root.generateReport", "header": "['module', '___EOS___']", "index": 90 } ]
[ { "span": "import Common", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 13 }, { "span": "from common import Log", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", " ", "No", "kia", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "GLE", "S", " ", "perform", "anc", "e", " ", "report", " ", "generat", "or", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Report", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common_", "import_", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Trace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Gl", "es", "Trace", "Operations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Gl", "es", "Check", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common_", "import_", "Log_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "Render", "Target", "Section_", "(_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "g_", "._", "report_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Render", " ", "target", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "used", " ", "EGL", " ", "configura", "tion", "s", " ", "and", " ", "surfaces", "_", "\\u\\u\\uNL\\u\\u\\u_", "configs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "g_", "._", "trace_", "._", "events_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "event_", "._", "values_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "Trace_", "._", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "cls_", "._", "name_", "==_", "\"", "EGL", "Config", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "value_", "._", "attrs_", "._", "get_", "(_", "\"", "config", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "id_", "or_", "id_", "in_", "configs_", ":_", "\\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_", "configs_", "._", "add_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2_", "=_", "s_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "EGL", " ", "configura", "tion", " ", "#", "%", "d", "\"_", "%_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "s2_", "._", "create_", "(_", "Report_", "._", "Table_", ",_", "[_", "\"", "Proper", "ty", "\"_", ",_", "\"", "Value", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cfg", "Key_", ",_", "cfg", "Value_", "in_", "value_", "._", "attrs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg", "Key_", "=_", "cfg", "Key_", "._", "replace_", "(_", "\"\\u\"_", ",_", "\"", " ", "\"_", ")_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "cfg", "Key_", ",_", "cfg", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "._", "name_", "==_", "\"", "eg", "l", "Creat", "e", "Window", "Surf", "ace", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "event_", "._", "values_", "._", "get_", "(_", "\"", "window", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "window_", ":_", "\\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_", "s2_", "=_", "s_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Window", " ", "surf", "ace", " ", "0", "x", "%", "x", "\"_", "%_", "event_", "._", "values_", "[_", "None_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "s2_", "._", "create_", "(_", "Report_", "._", "Table_", ",_", "[_", "\"", "Proper", "ty", "\"_", ",_", "\"", "Value", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Wid", "th", "\"_", ",_", "window_", "._", "attrs_", "[_", "\"", "widt", "h", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Hei", "ght", "\"_", ",_", "window_", "._", "attrs_", "[_", "\"", "height", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Config", " ", "ID", "\"_", ",_", "event_", "._", "values_", "[_", "\"", "config", "\"_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "._", "name_", "==_", "\"", "eg", "l", "Creat", "e", "Pix", "map", "Surf", "ace", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pixmap_", "=_", "event_", "._", "values_", "._", "get_", "(_", "\"", "pixmap", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "pixmap_", ":_", "\\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_", "s2_", "=_", "s_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Pix", "map", " ", "surf", "ace", " ", "0", "x", "%", "x", "\"_", "%_", "event_", "._", "values_", "[_", "None_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "s2_", "._", "create_", "(_", "Report_", "._", "Table_", ",_", "[_", "\"", "Proper", "ty", "\"_", ",_", "\"", "Value", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Wid", "th", "\"_", ",_", "pixmap_", "._", "attrs_", "[_", "\"", "widt", "h", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Hei", "ght", "\"_", ",_", "pixmap_", "._", "attrs_", "[_", "\"", "height", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Config", " ", "ID", "\"_", ",_", "event_", "._", "values_", "[_", "\"", "config", "\"_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "._", "name_", "==_", "\"", "eg", "l", "Creat", "e", "Pb", "uffe", "r", "Surf", "ace", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "event_", "._", "values_", "._", "get_", "(_", "\"", "attrib", "\\u", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "attrs_", "[_", "attrs_", "._", "index_", "(_", "g_", "._", "constants_", "._", "EGL", "\\u", "WIDTH_", ")_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "attrs_", "[_", "attrs_", "._", "index_", "(_", "g_", "._", "constants_", "._", "EGL", "\\u", "HEIGHT_", ")_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s2_", "=_", "s_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Pb", "uffe", "r", " ", "surf", "ace", " ", "0", "x", "%", "x", "\"_", "%_", "event_", "._", "values_", "[_", "None_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "s2_", "._", "create_", "(_", "Report_", "._", "Table_", ",_", "[_", "\"", "Proper", "ty", "\"_", ",_", "\"", "Value", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Wid", "th", "\"_", ",_", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Hei", "ght", "\"_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Row_", "(_", "\"", "Config", " ", "ID", "\"_", ",_", "event_", "._", "values_", "[_", "\"", "config", "\"_", "]_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e", "Report_", "(_", "project_", ",_", "trace_", ",_", "trace", "File", "Name_", ",_", "path_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "trace", "File", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Open", "GL", " ", "ES", " ", "perform", "anc", "e", " ", "report", " ", "for", " ", "%", "s", "\"_", "%_", "os_", "._", "path_", "._", "basename_", "(_", "trace", "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 ", " _", "title_", "=_", "\"", "Open", "GL", " ", "ES", " ", "perform", "anc", "e", " ", "report", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "=_", "Report", "Generator_", "._", "Report", "Generator_", "(_", "project_", ",_", "trace_", ",_", "title_", ",_", "path_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "GLE", "S", " ", "specific", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "Gl", "es", "Trace", "Operations_", "._", "calcul", "ate", "Statistics_", "(_", "project_", ",_", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "genera", "l", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "._", "calcul", "ate", "Statistics_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "some", " ", "genera", "l", " ", "informati", "on", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "section_", "=_", "g_", "._", "report_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "General", " ", "statistic", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "g_", "._", "create", "General", "Statistic", "s", "Table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "trace", "File", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "add", "Row_", "(_", "\"", "File", " ", "name", "\"_", ",_", "trace", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "section_", "._", "add_", "(_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "section", " ", "abo", "ut", " ", "the", " ", "used", " ", "render", " ", "targets_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Render", "Target", "Section_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "over", "all", " ", "timeline", " ", "of", " ", "all", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "._", "report_", "._", "add_", "(_", "g_", "._", "create", "Event", "Plot_", "(_", "\"", "Event", " ", "distribu", "tion", "\"_", ",_", "trace_", "._", "events_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "graph", " ", "abo", "ut", " ", "the", " ", "event", " ", "type", " ", "distribution_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "._", "report_", "._", "add_", "(_", "g_", "._", "create", "Event", "Freq", "uenc", "y", "Plot_", "(_", "\"", "Opera", "tion", " ", "distribu", "tion", "\"_", ",_", "trace_", "._", "events_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "over", "view", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "over", "view", "Section_", "=_", "g_", "._", "report_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Over", "view", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Frame", " ", "thumbnail", "s_", "\\u\\u\\uNL\\u\\u\\u_", "thumbnail", "Section_", "=_", "over", "view", "Section_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Select", "ed", " ", "frames", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumbnail", "s_", "=_", "g_", "._", "create", "Event", "Thumb", "nail", "s_", "(_", "[_", "f_", "._", "swap", "Event_", "for_", "f_", "in_", "g_", "._", "interesting", "Frames_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "frame_", ",_", "thumbnail_", "in_", "zip_", "(_", "g_", "._", "interesting", "Frames_", ",_", "thumbnail", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumbnail", "Section_", "._", "create_", "(_", "Report_", "._", "Link_", ",_", "\"#", "frame", "%", "d", "\"_", "%_", "(_", "frame_", "._", "number_", "+_", "1_", ")_", ",_", "thumbnail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Textures", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "textu", "re", "Load", "ers_", "=_", "Gl", "es", "Trace", "Operations_", "._", "get", "Text", "ure", "Load", "ers_", "(_", "project_", ",_", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "textu", "re", "Load", "ers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "textu", "re", "Section_", "=_", "over", "view", "Section_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Load", "ed", " ", "textures", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "Task_", "._", "start", "Task_", "(_", "\"", "load", "-", "textures", "\"_", ",_", "\"", "Load", "ing", " ", "textures", "\"_", ",_", "len_", "(_", "textu", "re", "Load", "ers_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", ",_", "func_", "in_", "textu", "re", "Load", "ers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "func_", "(_", ")_", "._", "convert_", "(_", "\"", "RGB", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "\"", "textu", "re", "%", "03", "d", ".", "png", "\"_", "%_", "event_", "._", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "save_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "textu", "re", "Section_", "._", "create_", "(_", "Report_", "._", "Image_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FPS", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "[_", "1.0_", "/_", "f_", "._", "duration_", "for_", "f_", "in_", "g_", "._", "frames_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Plot_", "(_", "\"", "Frame", "s", " ", "per", " ", "second", "\"_", ",_", "range_", "(_", "len_", "(_", "g_", "._", "frames_", ")_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "view", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Render", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "[_", "len_", "(_", "f_", "._", "events_", ")_", "for_", "f_", "in_", "g_", "._", "frames_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Plot_", "(_", "\"", "Number", " ", "of", " ", "API", " ", "calls", " ", "per", " ", "frame", "\"_", ",_", "range_", "(_", "len_", "(_", "g_", "._", "frames_", ")_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "view", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Over", "draw_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "[_", "f_", "._", "swap", "Event_", "._", "sensor", "Data_", "._", "get_", "(_", "\"", "draw", "\\u", "ratio", "\"_", ",_", "0_", ")_", "for_", "f_", "in_", "g_", "._", "frames_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Plot_", "(_", "\"", "Draw", " ", "ratio", "\"_", ",_", "range_", "(_", "len_", "(_", "g_", "._", "frames_", ")_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "view", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fragment", " ", "count_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "[_", "f_", "._", "swap", "Event_", "._", "sensor", "Data_", "._", "get_", "(_", "\"", "rasteri", "zer", "\\u", "pixel", "s", "\"_", ",_", "0_", ")_", "for_", "f_", "in_", "g_", "._", "frames_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Plot_", "(_", "\"", "Ras", "teri", "zed", " ", "fragment", "s", " ", "per", " ", "frame", "\"_", ",_", "range_", "(_", "len_", "(_", "g_", "._", "frames_", ")_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "view", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Text", "ure", " ", "reads_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "[_", "f_", "._", "swap", "Event_", "._", "sensor", "Data_", "._", "get_", "(_", "\"", "rasteri", "zer", "\\u", "tex", "el", "\\u", "fetches", "\"_", ",_", "0_", ")_", "for_", "f_", "in_", "g_", "._", "frames_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Plot_", "(_", "\"", "Tex", "el", " ", "fetches", " ", "per", " ", "frame", "\"_", ",_", "range_", "(_", "len_", "(_", "g_", "._", "frames_", ")_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "view", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Text", "ure", " ", "uploads", "_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "[_", "f_", "._", "swap", "Event_", "._", "sensor", "Data_", "._", "get_", "(_", "\"", "tex", "el", "\\u", "uploads", "\"_", ",_", "0_", ")_", "for_", "f_", "in_", "g_", "._", "frames_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Plot_", "(_", "\"", "Tex", "el", " ", "uploads", " ", "per", " ", "frame", "\"_", ",_", "range_", "(_", "len_", "(_", "g_", "._", "frames_", ")_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "view", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "over", " ", "each", " ", "interesting", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "Task_", "._", "start", "Task_", "(_", "\"", "frame", "-", "report", "\"_", ",_", "\"", "Generat", "ing", " ", "report", "\"_", ",_", "len_", "(_", "g_", "._", "interesting", "Frames_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Det", "ail", "Section_", "=_", "g_", "._", "report_", "._", "create_", "(_", "Report_", "._", "Section_", ",_", "\"", "Det", "ail", "ed", " ", "frame", " ", "statistic", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "frame_", "in_", "g_", "._", "interesting", "Frames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Section_", "=_", "g_", "._", "create", "Frame", "Section_", "(_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "some", " ", "custom", " ", "plots_", "\\u\\u\\uNL\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Sen", "sor", "Plot_", "(_", "frame_", ",_", "\"", "rasteri", "zer", "\\u", "pixel", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Sen", "sor", "Plot_", "(_", "frame_", ",_", "\"", "rasteri", "zer", "\\u", "tex", "el", "\\u", "fetches", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "g_", "._", "create", "Sen", "sor", "Plot_", "(_", "frame_", ",_", "\"", "tex", "el", "\\u", "uploads", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Section_", "._", "add_", "(_", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "over", " ", "the", " ", "individual", " ", "render", " ", "calls", " ", "+", " ", "the", " ", "swap", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event_", "in_", "frame_", "._", "render", "Events_", "+_", "[_", "frame_", "._", "swap", "Event_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "Section_", "=_", "g_", "._", "create", "Event", "Section_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Section_", "._", "add_", "(_", "event", "Section_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frame", "Det", "ail", "Section_", "._", "add_", "(_", "frame", "Section_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "checklist", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "._", "report_", "._", "add_", "(_", "g_", "._", "create", "Check", "list", "Section_", "(_", "\"", "Perform", "anc", "e", " ", "Check", "list", "\"_", ",_", "Gl", "es", "Check", "list_", "._", "checklist", "Items_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Finali", "ze", " ", "the", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "generate_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
pebble/cloudpebble/ide/migrations/0018_auto__add_field_project_project_type.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'auth.group': {\n 'Meta': {'object_name': 'Group'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n u'auth.permission': {\n 'Meta': {'ordering': \"(u'content_type__app_label', u'content_type__model', u'codename')\", 'unique_together': \"((u'content_type', u'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n u'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Group']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Permission']\"}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n u'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'ide.buildresult': {\n 'Meta': {'object_name': 'BuildResult'},\n 'binary_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'finished': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'builds'\", 'to': \"orm['ide.Project']\"}),\n 'resource_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'started': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),\n 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}),\n 'total_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'uuid': ('django.db.models.fields.CharField', [], {'default': \"'b84e091c-1712-4e5d-973b-e37323897fd8'\", 'max_length': '36'})\n },\n 'ide.project': {\n 'Meta': {'unique_together': \"(('owner', 'name'),)\", 'object_name': 'Project'},\n 'app_capabilities': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'app_company_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'app_is_watchface': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'app_jshint': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'app_keys': ('django.db.models.fields.TextField', [], {'default': \"'{}'\"}),\n 'app_long_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'app_short_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'app_uuid': ('django.db.models.fields.CharField', [], {'default': \"'4b4975dc-0fca-43d1-b212-dc2f4209c8b2'\", 'max_length': '36', 'null': 'True', 'blank': 'True'}),\n 'app_version_code': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}),\n 'app_version_label': ('django.db.models.fields.CharField', [], {'default': \"'1.0'\", 'max_length': '40', 'null': 'True', 'blank': 'True'}),\n 'github_branch': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'github_hook_build': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'github_hook_uuid': ('django.db.models.fields.CharField', [], {'max_length': '36', 'null': 'True', 'blank': 'True'}),\n 'github_last_commit': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),\n 'github_last_sync': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'github_repo': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),\n 'optimisation': ('django.db.models.fields.CharField', [], {'default': \"'s'\", 'max_length': '1'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['auth.User']\"}),\n 'project_type': ('django.db.models.fields.CharField', [], {'default': \"'native'\", 'max_length': '10'}),\n 'sdk_version': ('django.db.models.fields.CharField', [], {'default': \"'1'\", 'max_length': '10'}),\n 'version_def_name': ('django.db.models.fields.CharField', [], {'default': \"'APP_RESOURCES'\", 'max_length': '50'})\n },\n 'ide.resourcefile': {\n 'Meta': {'unique_together': \"(('project', 'file_name'),)\", 'object_name': 'ResourceFile'},\n 'file_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_menu_icon': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'kind': ('django.db.models.fields.CharField', [], {'max_length': '9'}),\n 'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'resources'\", 'to': \"orm['ide.Project']\"})\n },\n 'ide.resourceidentifier': {\n 'Meta': {'unique_together': \"(('resource_file', 'resource_id'),)\", 'object_name': 'ResourceIdentifier'},\n 'character_regex': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'resource_file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'identifiers'\", 'to': \"orm['ide.ResourceFile']\"}),\n 'resource_id': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'tracking': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})\n },\n 'ide.sourcefile': {\n 'Meta': {'unique_together': \"(('project', 'file_name'),)\", 'object_name': 'SourceFile'},\n 'file_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),\n 'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'source_files'\", 'to': \"orm['ide.Project']\"})\n },\n 'ide.templateproject': {\n 'Meta': {'object_name': 'TemplateProject', '_ormbases': ['ide.Project']},\n u'project_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['ide.Project']\", 'unique': 'True', 'primary_key': 'True'}),\n 'template_kind': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'})\n },\n 'ide.usergithub': {\n 'Meta': {'object_name': 'UserGithub'},\n 'avatar': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'nonce': ('django.db.models.fields.CharField', [], {'max_length': '36', 'null': 'True', 'blank': 'True'}),\n 'token': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),\n 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"'github'\", 'unique': 'True', 'primary_key': 'True', 'to': u\"orm['auth.User']\"}),\n 'username': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'})\n },\n 'ide.usersettings': {\n 'Meta': {'object_name': 'UserSettings'},\n 'accepted_terms': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'autocomplete': ('django.db.models.fields.IntegerField', [], {'default': '1'}),\n 'keybinds': ('django.db.models.fields.CharField', [], {'default': \"'default'\", 'max_length': '20'}),\n 'tab_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '2'}),\n 'theme': ('django.db.models.fields.CharField', [], {'default': \"'monokai'\", 'max_length': '50'}),\n 'use_spaces': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u\"orm['auth.User']\", 'unique': 'True', 'primary_key': 'True'})\n }\n }\n\n complete_apps = ['ide']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding field 'Project.project_type'\n db.add_column(u'ide_project', 'project_type',\n self.gf('django.db.models.fields.CharField')(default='native', max_length=10),\n keep_default=False)", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting field 'Project.project_type'\n db.delete_column(u'ide_project', 'project_type')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 16 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "u", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "u", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "u", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "(", "u", "'", "content", "\\u", "type", "',", " ", "u", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Group", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "buildr", "esult", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Build", "Result", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "binar", "y", "\\u", "size", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "finish", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "builds", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "ide", ".", "Project", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "size", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "total", "\\u", "size", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uuid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "b8", "4e", "091", "c", "-1", "712", "-", "4e", "5d", "-", "973", "b", "-", "e3", "732", "389", "7f", "d8", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "6", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "project", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "owner", "',", " ", "'", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Project", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "capab", "ilities", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "compan", "y", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "is", "\\u", "watch", "face", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "js", "hin", "t", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "keys", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'{", "}'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "long", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "short", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "uuid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "4b", "497", "5d", "c", "-0", "fca", "-", "4", "3d", "1", "-", "b2", "1", "2", "-", "dc", "2f", "420", "9c", "8b", "2", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "6", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "version", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "1", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "version", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "1.0", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "40", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "git", "hub", "\\u", "branch", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "git", "hub", "\\u", "hook", "\\u", "build", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "git", "hub", "\\u", "hook", "\\u", "uuid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "6", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "git", "hub", "\\u", "last", "\\u", "commit", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "40", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "git", "hub", "\\u", "last", "\\u", "sync", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "git", "hub", "\\u", "repo", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "modifi", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "optimis", "ation", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "s", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "nativ", "e", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "10", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sd", "k", "\\u", "version", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "1", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "10", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "\\u", "def", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "APP", "\\u", "RESOURCES", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "resource", "file", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "project", "',", " ", "'", "file", "\\u", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Reso", "urc", "e", "File", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "menu", "\\u", "icon", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "resource", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "ide", ".", "Project", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "resource", "identifi", "er", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "resource", "\\u", "file", "',", " ", "'", "resource", "\\u", "id", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Reso", "urc", "e", "Identifie", "r", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "character", "\\u", "regex", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "file", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "identifi", "ers", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "ide", ".", "Reso", "urc", "e", "File", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "track", "ing", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "sourcef", "ile", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "project", "',", " ", "'", "file", "\\u", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Sou", "rce", "File", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "modifi", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "source", "\\u", "files", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "ide", ".", "Project", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "template", "project", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Templa", "te", "Project", "'_", ",_", "'\\u", "ormbase", "s", "'_", ":_", "[_", "'", "ide", ".", "Project", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "project", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "ide", ".", "Project", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", "\\u", "kind", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "user", "git", "hub", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "Git", "hub", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "avat", "ar", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nonc", "e", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "6", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "token", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "git", "hub", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ide", ".", "users", "etti", "ngs", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "Sett", "ings", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "accept", "ed", "\\u", "term", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "autocomplete", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keybind", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "default", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "20", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tab", "\\u", "widt", "h", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "them", "e", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "mono", "kai", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "use", "\\u", "space", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "ide", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Project", ".", "project", "\\u", "type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "add", "\\u", "column_", "(_", "u", "'", "ide", "\\u", "project", "'_", ",_", "'", "project", "\\u", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "nativ", "e", "'_", ",_", "max", "\\u", "length_", "=_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Project", ".", "project", "\\u", "type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", "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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
johncadigan/scrapy-sci/wallpaper_demo/wallpaper/classifier_pipelines.py
[ { "content": " def __init__(self):\n \n self.status = Status()\n self.classifiers = []\n self.exporters = {}\n for classifier in self.status.classifiers.keys():\n CF = ClassifierFactory(self.status.classifiers[classifier]) \n CF.create_data_set(\"both\")\n lc = lc = CF.create_classifier(LogisticRegression(C=1e5), self.status.classifiers[classifier]['features']())\n lc.fit()\n self.classifiers.append((classifier, lc))\n \n self.classifiers = sorted(self.classifiers, key = lambda a: a[1].estimate_accuracy(5, verbose=True))\n print \"Classifier {0} needs the most improvement; selected for export\".format(self.classifiers[0][0])\n for classification in self.status.classifiers[self.classifiers[0][0]]['classifications']:\n f = file(\"{0}.json\".format(classification), \"wb\")\n self.exporters[classification] = JsonItemExporter(f)", "metadata": "root.ClassifiersPipeline.__init__", "header": "['class', 'ClassifiersPipeline', '(', 'object', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "lc ", "start_line": 26, "start_column": 12, "end_line": 26, "end_column": 14 } ]
[ { "span": "lc ", "start_line": 26, "start_column": 17, "end_line": 26, "end_column": 19 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Classif", "iers", "Pipeline_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "Status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classifiers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exporter", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "classifier_", "in_", "self_", "._", "status_", "._", "classifiers_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CF_", "=_", "Classif", "ier", "Factory_", "(_", "self_", "._", "status_", "._", "classifiers_", "[_", "classifier_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CF_", "._", "create", "\\u", "data\\u", "set_", "(_", "\"", "bot", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lc_", "=_", "lc_", "=_", "CF_", "._", "create", "\\u", "classifier_", "(_", "Logi", "stic", "Regression_", "(_", "C_", "=_", "1e", "5_", ")_", ",_", "self_", "._", "status_", "._", "classifiers_", "[_", "classifier_", "]_", "[_", "'", "features", "'_", "]_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lc_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classifiers_", "._", "append_", "(_", "(_", "classifier_", ",_", "lc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "classifiers_", "=_", "sorted_", "(_", "self_", "._", "classifiers_", ",_", "key_", "=_", "lambda_", "a_", ":_", "a_", "[_", "1_", "]_", "._", "estimate", "\\u", "accuracy_", "(_", "5_", ",_", "verbose_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Classif", "ier", " ", "{", "0", "}", " ", "need", "s", " ", "the", " ", "most", " ", "improvement", ";", " ", "selecte", "d", " ", "for", " ", "export", "\"_", "._", "format_", "(_", "self_", "._", "classifiers_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "classification_", "in_", "self_", "._", "status_", "._", "classifiers_", "[_", "self_", "._", "classifiers_", "[_", "0_", "]_", "[_", "0_", "]_", "]_", "[_", "'", "classificati", "ons", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "file_", "(_", "\"{", "0", "}.", "json", "\"_", "._", "format_", "(_", "classification_", ")_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exporter", "s_", "[_", "classification_", "]_", "=_", "Js", "on", "Item", "Exporter_", "(_", "f_", ")_", "\\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, 0, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
openstack/taskflow/taskflow/utils/threading_utils.py
[ { "content": " def start(self):\n \"\"\"Creates & starts all associated threads (that are not running).\"\"\"\n count = 0\n with self._lock:\n it = enumerate(self._threads)\n for i, (builder, thread, started) in it:\n if thread and started:\n continue\n if not thread:\n self._threads[i][1] = thread = builder.thread_factory()\n builder.before_start(thread)\n thread.start()\n count += 1\n try:\n builder.after_start(thread)\n finally:\n # Just incase the 'after_start' callback blows up make sure\n # we always set this...\n self._threads[i][2] = started = True\n return count", "metadata": "root.ThreadBundle.start", "header": "['class', 'ThreadBundle', '(', 'object', ')', ':', '___EOS___']", "index": 121 }, { "content": " def stop(self):\n \"\"\"Stops & joins all associated threads (that have been started).\"\"\"\n count = 0\n with self._lock:\n it = misc.reverse_enumerate(self._threads)\n for i, (builder, thread, started) in it:\n if not thread or not started:\n continue\n builder.before_join(thread)\n thread.join()\n count += 1\n try:\n builder.after_join(thread)\n finally:\n # Just incase the 'after_join' callback blows up make sure\n # we always set/reset these...\n self._threads[i][1] = thread = None\n self._threads[i][2] = started = False\n return count", "metadata": "root.ThreadBundle.stop", "header": "['class', 'ThreadBundle', '(', 'object', ')', ':', '___EOS___']", "index": 142 } ]
[ { "span": "started ", "start_line": 139, "start_column": 42, "end_line": 139, "end_column": 49 }, { "span": "thread ", "start_line": 158, "start_column": 42, "end_line": 158, "end_column": 48 }, { "span": "started ", "start_line": 159, "start_column": 42, "end_line": 159, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Thread", "Bundle_", "(_", "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_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "&", " ", "starts", " ", "all", " ", "associate", "d", " ", "thread", "s", " ", "(", "tha", "t", " ", "are", " ", "not", " ", "runn", "ing", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "it_", "=_", "enumerate_", "(_", "self_", "._", "\\u", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "(_", "builder_", ",_", "thread_", ",_", "started_", ")_", "in_", "it_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "thread_", "and_", "started_", ":_", "\\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_", "not_", "thread_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "threads_", "[_", "i_", "]_", "[_", "1_", "]_", "=_", "thread_", "=_", "builder_", "._", "thread", "\\u", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "builder_", "._", "bef", "ore", "\\u", "start_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "builder_", "._", "after", "\\u", "start_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "inca", "se", " ", "the", " ", "'", "after", "\\u", "start", "'", " ", "callback", " ", "blow", "s", " ", "up", " ", "make", " ", "sure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "alw", "ay", "s", " ", "set", " ", "this", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "threads_", "[_", "i_", "]_", "[_", "2_", "]_", "=_", "started_", "=_", "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_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Thread", "Bundle_", "(_", "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 ", " _", "\"\"\"", "Stops", " ", "&", " ", "joins", " ", "all", " ", "associate", "d", " ", "thread", "s", " ", "(", "tha", "t", " ", "have", " ", "bee", "n", " ", "start", "ed", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "it_", "=_", "misc_", "._", "reverse", "\\u", "enumerate_", "(_", "self_", "._", "\\u", "threads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "(_", "builder_", ",_", "thread_", ",_", "started_", ")_", "in_", "it_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "thread_", "or_", "not_", "started_", ":_", "\\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_", "builder_", "._", "bef", "ore", "\\u", "join_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "builder_", "._", "after", "\\u", "join_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "inca", "se", " ", "the", " ", "'", "after", "\\u", "join", "'", " ", "callback", " ", "blow", "s", " ", "up", " ", "make", " ", "sure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "alw", "ay", "s", " ", "set", "/", "reset", " ", "these", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "threads_", "[_", "i_", "]_", "[_", "1_", "]_", "=_", "thread_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "threads_", "[_", "i_", "]_", "[_", "2_", "]_", "=_", "started_", "=_", "False_", "\\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_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
caktus/django-timepiece/timepiece/crm/tests/test_businesses.py
[ { "content": " def test_get(self):\n \"\"\"GET should return the page with an unbound form.\"\"\"\n response = self._get()\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertTrue('form' in response.context)\n self.assertFalse(response.context['form'].is_bound)\n self.assertEquals(self.model.objects.count(), 0)", "metadata": "root.TestCreateBusiness.test_get", "header": "['class', 'TestCreateBusiness', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test_post_invalid(self):\n \"\"\"Invalid POST should not create a new object.\"\"\"\n self.post_data['name'] = ''\n response = self._post()\n self.assertEquals(self.model.objects.count(), 0)\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertTrue('form' in response.context)\n self.assertTrue(response.context['form'].is_bound)\n self.assertFalse(response.context['form'].is_valid())", "metadata": "root.TestCreateBusiness.test_post_invalid", "header": "['class', 'TestCreateBusiness', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def test_get(self):\n \"\"\"GET should return a confirmation page.\"\"\"\n response = self._get()\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertTrue('object' in response.context)\n self.assertEquals(response.context['object'], self.obj)\n self.assertEquals(self.model.objects.count(), 1)", "metadata": "root.TestDeleteBusiness.test_get", "header": "['class', 'TestDeleteBusiness', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 110 }, { "content": " def test_get(self):\n \"\"\"GET should return the page with an unbound form.\"\"\"\n response = self._get()\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertTrue('object' in response.context)\n self.assertEquals(response.context['object'], self.obj)\n self.assertTrue('form' in response.context)\n self.assertFalse(response.context['form'].is_bound)\n self.assertEquals(response.context['form'].instance, self.obj)\n self._assert_no_change()", "metadata": "root.TestEditBusiness.test_get", "header": "['class', 'TestEditBusiness', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 176 }, { "content": " def test_post_invalid(self):\n \"\"\"Invalid POST should not edit the object.\"\"\"\n self.post_data['name'] = ''\n response = self._post()\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertTrue('object' in response.context)\n self.assertEquals(response.context['object'], self.obj)\n self.assertTrue('form' in response.context)\n self.assertTrue(response.context['form'].is_bound)\n self.assertFalse(response.context['form'].is_valid())\n self.assertEquals(response.context['form'].instance, self.obj)\n self._assert_no_change()", "metadata": "root.TestEditBusiness.test_post_invalid", "header": "['class', 'TestEditBusiness', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 200 }, { "content": " def test_list_all(self):\n \"\"\"If no filters are provided, all objects should be listed.\"\"\"\n object_list = [self.factory.create() for i in range(3)]\n response = self._get()\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertEquals(response.context['object_list'].count(), 3)\n for obj in object_list:\n self.assertTrue(obj in response.context['object_list'])", "metadata": "root.TestListBusinesses.test_list_all", "header": "['class', 'TestListBusinesses', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 233 }, { "content": " def test_multiple_results(self):\n \"\"\"Page should render if there are multiple search results.\"\"\"\n obj_list = [self.factory.create(name='hello') for i in range(2)]\n response = self._get(get_kwargs={'search': 'hello'})\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertEquals(response.context['object_list'].count(), 2)\n for obj in obj_list:\n self.assertTrue(obj in response.context['object_list'])", "metadata": "root.TestListBusinesses.test_multiple_results", "header": "['class', 'TestListBusinesses', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 274 }, { "content": " def test_get(self):\n \"\"\"User should be able to view the object detail.\"\"\"\n response = self._get()\n self.assertEquals(response.status_code, 200)\n self.assertTemplateUsed(response, self.template_name)\n self.assertTrue('object' in response.context)\n self.assertEquals(response.context['object'], self.obj)", "metadata": "root.TestViewBusiness.test_get", "header": "['class', 'TestViewBusiness', '(', 'ViewTestMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 332 } ]
[ { "span": "self.assertTrue('form' in response.context)", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 51 }, { "span": "self.assertTrue('form' in response.context)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 51 }, { "span": "self.assertTrue('object' in response.context)", "start_line": 115, "start_column": 8, "end_line": 115, "end_column": 53 }, { "span": "self.assertTrue('object' in response.context)", "start_line": 181, "start_column": 8, "end_line": 181, "end_column": 53 }, { "span": "self.assertTrue('form' in response.context)", "start_line": 183, "start_column": 8, "end_line": 183, "end_column": 51 }, { "span": "self.assertTrue('object' in response.context)", "start_line": 206, "start_column": 8, "end_line": 206, "end_column": 53 }, { "span": "self.assertTrue('form' in response.context)", "start_line": 208, "start_column": 8, "end_line": 208, "end_column": 51 }, { "span": "self.assertTrue(obj in response.context['object_list'])", "start_line": 241, "start_column": 12, "end_line": 241, "end_column": 67 }, { "span": "self.assertTrue(obj in response.context['object_list'])", "start_line": 282, "start_column": 12, "end_line": 282, "end_column": 67 }, { "span": "self.assertTrue('object' in response.context)", "start_line": 337, "start_column": 8, "end_line": 337, "end_column": 53 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Creat", "e", "Bus", "iness", "_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "GET", " ", "shou", "ld", " ", "return", " ", "the", " ", "page", " ", "with", " ", "an", " ", "unbound", " ", "form", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "form", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "bound_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "model_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Creat", "e", "Bus", "iness", "_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Inva", "lid", " ", "POST", " ", "shou", "ld", " ", "not", " ", "create", " ", "a", " ", "new", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "data_", "[_", "'", "name", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "post_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "model_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "form", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "bound_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "Bus", "iness", "_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "GET", " ", "shou", "ld", " ", "return", " ", "a", " ", "confirmation", " ", "page", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "context_", "[_", "'", "object", "'_", "]_", ",_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "model_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Edit", "Bus", "iness", "_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "GET", " ", "shou", "ld", " ", "return", " ", "the", " ", "page", " ", "with", " ", "an", " ", "unbound", " ", "form", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "context_", "[_", "'", "object", "'_", "]_", ",_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "form", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "bound_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "instance_", ",_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "no", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Edit", "Bus", "iness", "_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Inva", "lid", " ", "POST", " ", "shou", "ld", " ", "not", " ", "edit", " ", "the", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "data_", "[_", "'", "name", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "post_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "context_", "[_", "'", "object", "'_", "]_", ",_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "form", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "bound_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "instance_", ",_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "no", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "List", "Bus", "iness", "es_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "no", " ", "filter", "s", " ", "are", " ", "provided", ",", " ", "all", " ", "object", "s", " ", "shou", "ld", " ", "be", " ", "liste", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "[_", "self_", "._", "factory_", "._", "create_", "(_", ")_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "context_", "[_", "'", "object\\u", "list", "'_", "]_", "._", "count_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "object\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "obj_", "in_", "response_", "._", "context_", "[_", "'", "object\\u", "list", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "List", "Bus", "iness", "es_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "results_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Page", " ", "shou", "ld", " ", "render", " ", "if", " ", "there", " ", "are", " ", "multiple", " ", "search", " ", "results", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "list_", "=_", "[_", "self_", "._", "factory_", "._", "create_", "(_", "name_", "=_", "'", "hell", "o", "'_", ")_", "for_", "i_", "in_", "range_", "(_", "2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "get_", "(_", "get", "\\u", "kwargs_", "=_", "{_", "'", "search", "'_", ":_", "'", "hell", "o", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "context_", "[_", "'", "object\\u", "list", "'_", "]_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "obj", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "obj_", "in_", "response_", "._", "context_", "[_", "'", "object\\u", "list", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "View", "Bus", "iness", "_", "(_", "View", "Test", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "User", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "view", " ", "the", " ", "object", " ", "deta", "il", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "self_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "'_", "in_", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE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aseException'
StackStorm/st2/st2reactor/st2reactor/rules/tester.py
[ { "content": " def evaluate(self):\n \"\"\"\n Evaluate trigger instance against the rule.\n\n :return: ``True`` if the rule matches, ``False`` otherwise.\n :rtype: ``boolean``\n \"\"\"\n\n rule_db = self._get_rule_db()\n trigger_instance_db, trigger_db = self._get_trigger_instance_db()\n\n # The trigger check needs to be performed here as that is not performed\n # by RulesMatcher.\n if rule_db.trigger != trigger_db.ref:\n LOG.info('rule.trigger \"%s\" and trigger.ref \"%s\" do not match.',\n rule_db.trigger, trigger_db.ref)\n return False\n\n # Check if rule matches criteria.\n matcher = RulesMatcher(trigger_instance=trigger_instance_db, trigger=trigger_db,\n rules=[rule_db], extra_info=True)\n matching_rules = matcher.get_matching_rules()\n\n # Rule does not match so early exit.\n if len(matching_rules) < 1:\n return False\n\n # Check if rule can be enforced\n try:\n enforcer = RuleEnforcer(trigger_instance=trigger_instance_db, rule=rule_db)\n params = enforcer.get_resolved_parameters()\n LOG.info('Action parameters resolved to:')\n for param in six.iteritems(params):\n LOG.info('\\t%s: %s', param[0], param[1])\n return True\n except (UndefinedError, ValueError) as e:\n LOG.error('Failed to resolve parameters\\n\\tOriginal error : %s', str(e))\n return False\n except:\n LOG.exception('Failed to resolve parameters.')\n return False", "metadata": "root.RuleTester.evaluate", "header": "['class', 'RuleTester', '(', 'object', ')', ':', '___EOS___']", "index": 54 } ]
[ { "span": "except:", "start_line": 92, "start_column": 8, "end_line": 92, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Rule", "Tester_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "evaluate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Evaluate", " ", "trigger", " ", "instance", " ", "against", " ", "the", " ", "rule", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "``", "Tru", "e", "``", " ", "if", " ", "the", " ", "rule", " ", "matche", "s", ",", " ", "``", "Fal", "se", "``", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "``", "boolean", "``", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "db_", "=_", "self_", "._", "\\u", "get", "\\u", "rule", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trigger", "\\u", "instance", "\\u", "db_", ",_", "trigger", "\\u", "db_", "=_", "self_", "._", "\\u", "get", "\\u", "trigger", "\\u", "instance", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "trigger", " ", "check", " ", "need", "s", " ", "to", " ", "be", " ", "perform", "ed", " ", "here", " ", "as", " ", "tha", "t", " ", "is", " ", "not", " ", "perform", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "Rule", "s", "Match", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rule", "\\u", "db_", "._", "trigger_", "!=_", "trigger", "\\u", "db_", "._", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "'", "rule", ".", "trigger", " ", "\"%", "s", "\"", " ", "and", " ", "trigger", ".", "ref", " ", "\"%", "s", "\"", " ", "do", " ", "not", " ", "match", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "db_", "._", "trigger_", ",_", "trigger", "\\u", "db_", "._", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "rule", " ", "matche", "s", " ", "crite", "ria", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "matcher_", "=_", "Rule", "s", "Matcher_", "(_", "trigger", "\\u", "instance_", "=_", "trigger", "\\u", "instance", "\\u", "db_", ",_", "trigger_", "=_", "trigger", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rules_", "=_", "[_", "rule", "\\u", "db_", "]_", ",_", "extra", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matchi", "ng", "\\u", "rules_", "=_", "matcher_", "._", "get", "\\u", "matchi", "ng", "\\u", "rules_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rule", " ", "doe", "s", " ", "not", " ", "match", " ", "so", " ", "ear", "ly", " ", "exit", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "matchi", "ng", "\\u", "rules_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "rule", " ", "can", " ", "be", " ", "enforce", "d_", "\\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 ", " _", "enforce", "r_", "=_", "Rule", "Enf", "orce", "r_", "(_", "trigger", "\\u", "instance_", "=_", "trigger", "\\u", "instance", "\\u", "db_", ",_", "rule_", "=_", "rule", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "enforce", "r_", "._", "get", "\\u", "resolve", "d\\u", "parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "'", "Action", " ", "parameter", "s", " ", "resolve", "d", " ", "to", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param_", "in_", "six_", "._", "iteritems_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "'\\\\", "t", "%", "s", ":", " ", "%", "s", "'_", ",_", "param_", "[_", "0_", "]_", ",_", "param_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Unde", "fined", "Error_", ",_", "Value", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "error_", "(_", "'", "Fail", "ed", " ", "to", " ", "resolve", " ", "parameter", "s", "\\\\", "n", "\\\\", "t", "Origina", "l", " ", "error", " ", ":", " ", "%", "s", "'_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'", "Fail", "ed", " ", "to", " ", "resolve", " ", "parameter", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ntoll/foox/test/species/test_fourth.py
[ { "content": "\"\"\"\nTests for the module that encompasses fourth species counterpoint.\n\"\"\"\nimport unittest\nfrom foox.species.fourth import (Genome, create_population, is_parallel,\n make_fitness_function, make_generate_function, make_halt_function,\n MAX_REWARD, REWARD_SUSPENSION)\nfrom foox.species.utils import is_suspension\n\n\n# The cantus firmus to use in the test suite.\nCANTUS_FIRMUS = [5, 7, 6, 5, 8, 7, 9, 8, 7, 6, 5]\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCreatePopulation(unittest.TestCase):\n \"\"\"\n Ensures the create_population function works as expected.\n \"\"\"\n\n\n\n", "metadata": "root.TestCreatePopulation", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def test_returns_valid_genomes(self):\n \"\"\"\n Checks the genomes returned by the create_population function are\n of the correct type.\n \"\"\"\n result = create_population(1, CANTUS_FIRMUS)\n self.assertEqual(Genome, type(result[0]))", "metadata": "root.TestCreatePopulation.test_returns_valid_genomes", "header": "['class', 'TestCreatePopulation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_returns_correct_number_of_genomes(self):\n \"\"\"\n Ensures the correct number of genomes are returned by the function.\n \"\"\"\n result = create_population(100, CANTUS_FIRMUS)\n self.assertEqual(100, len(result))", "metadata": "root.TestCreatePopulation.test_returns_correct_number_of_genomes", "header": "['class', 'TestCreatePopulation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_uses_only_valid_intervals(self):\n \"\"\"\n Tests that only valid consonant intervals are used.\n \"\"\"\n valid_intervals = [2, 4, 5, 7, 9, 11]\n result = create_population(20, CANTUS_FIRMUS)\n for genome in result:\n for i in range(len(genome.chromosome)):\n contrapunctus_note = genome.chromosome[i]\n cantus_firmus_note = CANTUS_FIRMUS[i]\n interval = contrapunctus_note - cantus_firmus_note\n self.assertIn(interval, valid_intervals)", "metadata": "root.TestCreatePopulation.test_uses_only_valid_intervals", "header": "['class', 'TestCreatePopulation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_solutions_have_correct_number_of_notes(self):\n \"\"\"\n Ensures that all solutions have the expected number of notes.\n \"\"\"\n result = create_population(20, CANTUS_FIRMUS)\n expected_length = len(CANTUS_FIRMUS)\n for genome in result:\n self.assertEqual(expected_length, len(genome.chromosome))", "metadata": "root.TestCreatePopulation.test_solutions_have_correct_number_of_notes", "header": "['class', 'TestCreatePopulation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": "class TestFitnessFunction(unittest.TestCase):\n \"\"\"\n Ensures that the fitness function works as expected.\n \"\"\"\n\n\n\n", "metadata": "root.TestFitnessFunction", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def test_make_fitness_function_returns_callable(self):\n \"\"\"\n Ensures the make_fitness_function returns a callable.\n \"\"\"\n result = make_fitness_function(CANTUS_FIRMUS)\n self.assertTrue(callable(result))", "metadata": "root.TestFitnessFunction.test_make_fitness_function_returns_callable", "header": "['class', 'TestFitnessFunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_fitness_function_returns_float(self):\n \"\"\"\n Makes sure the generated fitness function returns a fitness score as a\n float.\n \"\"\"\n fitness_function = make_fitness_function(CANTUS_FIRMUS)\n genome = Genome([1, 2, 3])\n result = fitness_function(genome)\n self.assertTrue(float, type(result))", "metadata": "root.TestFitnessFunction.test_fitness_function_returns_float", "header": "['class', 'TestFitnessFunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 69 }, { "content": " def test_fitness_function_sets_fitness_on_genome(self):\n \"\"\"\n Ensures the fitness score is set in the genome's fitness attribute and\n is the same as the returned fitness score.\n \"\"\"\n fitness_function = make_fitness_function(CANTUS_FIRMUS)\n genome = Genome([1, 2, 3])\n self.assertEqual(None, genome.fitness)\n result = fitness_function(genome)\n self.assertNotEqual(None, genome.fitness)\n self.assertEqual(result, genome.fitness)", "metadata": "root.TestFitnessFunction.test_fitness_function_sets_fitness_on_genome", "header": "['class', 'TestFitnessFunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_fitness_function_uses_cached_genome_fitness(self):\n \"\"\"\n Ensures the fitness function bails if there is already a score set for\n the genome.\n \"\"\"\n fitness_function = make_fitness_function(CANTUS_FIRMUS)\n genome = Genome([1, 2, 3])\n genome.fitness = 12345\n result = fitness_function(genome)\n self.assertEqual(12345, result)", "metadata": "root.TestFitnessFunction.test_fitness_function_uses_cached_genome_fitness", "header": "['class', 'TestFitnessFunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 91 }, { "content": "class TestHalt(unittest.TestCase):\n \"\"\"\n Ensure the halting function works as expected.\n \"\"\"\n\n\n", "metadata": "root.TestHalt", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def test_halt_expected(self):\n \"\"\"\n Ensure the function returns true if we're in a halting state.\n \"\"\"\n halt = make_halt_function([6, 5])\n g1 = Genome([6, 5])\n g1.fitness = MAX_REWARD\n population = [g1, ]\n result = halt(population, 1)\n self.assertTrue(result)", "metadata": "root.TestHalt.test_halt_expected", "header": "['class', 'TestHalt', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 108 }, { "content": " def test_halt_checks_suspension_count(self):\n \"\"\"\n If the solution contains suspensions the halt function should ensure\n that the MAX_REWARD is incremented by the number of suspensions\n (rewarded because they're part of a valid step wise motion).\n \"\"\"\n halt = make_halt_function([9, 8, 7, 6, 5])\n g1 = Genome([11, 10, 9, 8, 7])\n # only one our of two \"correct\" dissonances\n g1.fitness = MAX_REWARD + REWARD_SUSPENSION\n population = [g1, ]\n result = halt(population, 1)\n self.assertFalse(result)\n # Try again\n # two out of two \"correct\" dissonances\n g1.fitness = MAX_REWARD + (REWARD_SUSPENSION * 2)\n population = [g1, ]\n result = halt(population, 1)\n self.assertTrue(result)", "metadata": "root.TestHalt.test_halt_checks_suspension_count", "header": "['class', 'TestHalt', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 119 }, { "content": " def test_halt_not(self):\n \"\"\"\n Ensures if the fittest genome has fitness < MAX_REWARD then halt\n doesn't succeed.\n \"\"\"\n halt = make_halt_function([3, 2, 1])\n g1 = Genome([1, 2, 3])\n g1.fitness = MAX_REWARD - 0.1\n g2 = Genome([1, 2, 3])\n g2.fitness = 3\n g3 = Genome([1, 2, 3])\n g3.fitness = 2\n # Any fittest solution with fitness < MAX_REWARD means no halt.\n population = [g1, g2, g3]\n result = halt(population, 1)\n self.assertFalse(result)", "metadata": "root.TestHalt.test_halt_not", "header": "['class', 'TestHalt', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 139 }, { "content": "class TestGenome(unittest.TestCase):\n \"\"\"\n Ensures that the Genome class is overridden as expected.\n \"\"\"\n\n", "metadata": "root.TestGenome", "header": "['module', '___EOS___']", "index": 157 }, { "content": " def test_mutate_is_implemented(self):\n \"\"\"\n Ensures that we have a mutate method implemented.\n \"\"\"\n genome = Genome([1, 2, 3])\n self.assertNotEqual(NotImplemented, genome.mutate(2, 0.2, [1, 2, 3]))", "metadata": "root.TestGenome.test_mutate_is_implemented", "header": "['class', 'TestGenome', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test_mutate_bounded_by_arg_values(self):\n \"\"\"\n A rather contrived test but it proves that both the mutation_range and\n mutation_rate are used correctly given the context given by a cantus\n firmus.\n \"\"\"\n cantus_firmus = [1, 1, 1, 1, 1]\n # mutate every time.\n mutation_rate = 1\n # will always mutate to thirds above the cf note.\n mutation_range = 2\n genome = Genome([5, 6, 7, 8, 9])\n genome.mutate(mutation_range, mutation_rate, cantus_firmus)\n self.assertEqual([3, 3, 3, 3, 3], genome.chromosome)", "metadata": "root.TestGenome.test_mutate_bounded_by_arg_values", "header": "['class', 'TestGenome', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 169 } ]
[ { "span": "from foox.species.fourth import (Genome, create_population, is_parallel,\n make_fitness_function, make_generate_function, make_halt_function,\n MAX_REWARD, REWARD_SUSPENSION)", "start_line": 4, "start_column": 0, "end_line": 6, "end_column": 34 }, { "span": "from foox.species.utils import is_suspension", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", "s", " ", "for", " ", "the", " ", "module", " ", "tha", "t", " ", "enco", "mpa", "sses", " ", "fourth", " ", "specie", "s", " ", "counter", "point", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foo", "x_", "._", "species_", "._", "fourth", "_", "import_", "(_", "Genome", "_", ",_", "create", "\\u", "population_", ",_", "is", "\\u", "parallel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "fitness", "\\u", "function_", ",_", "make", "\\u", "generat", "e\\u", "function_", ",_", "make", "\\u", "halt", "\\u", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "RE", "WARD", "_", ",_", "RE", "WARD", "\\u", "SUS", "PEN", "SION", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foo", "x_", "._", "species_", "._", "utils_", "import_", "is", "\\u", "suspe", "nsion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "cant", "us", " ", "firm", "us", " ", "to", " ", "use", " ", "in", " ", "the", " ", "test", " ", "suit", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", "=_", "[_", "5_", ",_", "7_", ",_", "6_", ",_", "5_", ",_", "8_", ",_", "7_", ",_", "9_", ",_", "8_", ",_", "7_", ",_", "6_", ",_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Test", "Creat", "e", "Population_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "the", " ", "create", "\\u", "popul", "ation", " ", "function", " ", "works", " ", "as", " ", "expected", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Creat", "e", "Population_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "return", "s", "\\u", "valid", "\\u", "genomes", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "the", " ", "genomes", " ", "return", "ed", " ", "by", " ", "the", " ", "create", "\\u", "popul", "ation", " ", "function", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "correct", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "create", "\\u", "population_", "(_", "1_", ",_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Genome", "_", ",_", "type_", "(_", "result_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Creat", "e", "Population_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "return", "s", "\\u", "correct", "\\u", "number", "\\u", "of", "\\u", "genomes", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "the", " ", "correct", " ", "number", " ", "of", " ", "genomes", " ", "are", " ", "return", "ed", " ", "by", " ", "the", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "create", "\\u", "population_", "(_", "100_", ",_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "100_", ",_", "len_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Creat", "e", "Population_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "use", "s", "\\u", "only", "\\u", "valid", "\\u", "intervals_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "tha", "t", " ", "only", " ", "valid", " ", "conso", "nant", " ", "interval", "s", " ", "are", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "intervals_", "=_", "[_", "2_", ",_", "4_", ",_", "5_", ",_", "7_", ",_", "9_", ",_", "11_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "create", "\\u", "population_", "(_", "20_", ",_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "genome_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "genome_", "._", "chromosome_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contra", "punct", "us", "\\u", "note_", "=_", "genome_", "._", "chromosome_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cant", "us", "\\u", "firm", "us", "\\u", "note_", "=_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval_", "=_", "contra", "punct", "us", "\\u", "note_", "-_", "cant", "us", "\\u", "firm", "us", "\\u", "note_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "interval_", ",_", "valid", "\\u", "intervals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Creat", "e", "Population_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "solut", "ion", "s", "\\u", "have", "\\u", "correct", "\\u", "number", "\\u", "of", "\\u", "notes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "all", " ", "solut", "ion", "s", " ", "have", " ", "the", " ", "expected", " ", "number", " ", "of", " ", "note", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "create", "\\u", "population_", "(_", "20_", ",_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "length_", "=_", "len_", "(_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "genome_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "expected", "\\u", "length_", ",_", "len_", "(_", "genome_", "._", "chromosome_", ")_", ")_", "\\u\\u\\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", "Fit", "ness", "Function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "the", " ", "fitness", " ", "function", " ", "works", " ", "as", " ", "expected", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fit", "ness", "Function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "make", "\\u", "fitness", "\\u", "function", "\\u", "return", "s", "\\u", "callable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "the", " ", "make", "\\u", "fitness", "\\u", "function", " ", "return", "s", " ", "a", " ", "calla", "ble", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "make", "\\u", "fitness", "\\u", "function_", "(_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fit", "ness", "Function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fitness", "\\u", "function", "\\u", "return", "s", "\\u", "float_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "sure", " ", "the", " ", "generat", "ed", " ", "fitness", " ", "function", " ", "return", "s", " ", "a", " ", "fitness", " ", "score", " ", "as", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "float", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fitness", "\\u", "function_", "=_", "make", "\\u", "fitness", "\\u", "function_", "(_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genome_", "=_", "Genome", "_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "fitness", "\\u", "function_", "(_", "genome_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "float_", ",_", "type_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fit", "ness", "Function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fitness", "\\u", "function", "\\u", "sets", "\\u", "fitness", "\\u", "on", "\\u", "genome_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "the", " ", "fitness", " ", "score", " ", "is", " ", "set", " ", "in", " ", "the", " ", "geno", "me", "'", "s", " ", "fitness", " ", "attribute", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "the", " ", "same", " ", "as", " ", "the", " ", "return", "ed", " ", "fitness", " ", "score", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fitness", "\\u", "function_", "=_", "make", "\\u", "fitness", "\\u", "function_", "(_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genome_", "=_", "Genome", "_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "None_", ",_", "genome_", "._", "fitness_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "fitness", "\\u", "function_", "(_", "genome_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "None_", ",_", "genome_", "._", "fitness_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", ",_", "genome_", "._", "fitness_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fit", "ness", "Function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fitness", "\\u", "function", "\\u", "use", "s", "\\u", "cache", "d\\u", "geno", "me", "\\u", "fitness_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "the", " ", "fitness", " ", "function", " ", "bai", "ls", " ", "if", " ", "there", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "score", " ", "set", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "geno", "me", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fitness", "\\u", "function_", "=_", "make", "\\u", "fitness", "\\u", "function_", "(_", "CAN", "TU", "S", "\\u", "FIR", "MUS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genome_", "=_", "Genome", "_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genome_", "._", "fitness_", "=_", "12345_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "fitness", "\\u", "function_", "(_", "genome_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "12345_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Hal", "t_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "the", " ", "halt", "ing", " ", "function", " ", "works", " ", "as", " ", "expected", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Hal", "t_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "halt", "\\u", "expected_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "the", " ", "function", " ", "return", "s", " ", "true", " ", "if", " ", "we", "'", "re", " ", "in", " ", "a", " ", "halt", "ing", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "halt", "_", "=_", "make", "\\u", "halt", "\\u", "function_", "(_", "[_", "6_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "Genome", "_", "(_", "[_", "6_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "._", "fitness_", "=_", "MAX", "\\u", "RE", "WARD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "population_", "=_", "[_", "g1_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "halt", "_", "(_", "population_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Hal", "t_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "halt", "\\u", "checks", "\\u", "suspe", "nsion", "\\u", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "solut", "ion", " ", "contain", "s", " ", "suspe", "nsion", "s", " ", "the", " ", "halt", " ", "function", " ", "shou", "ld", " ", "ensure", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "MAX", "\\u", "RE", "WARD", " ", "is", " ", "increment", "ed", " ", "by", " ", "the", " ", "number", " ", "of", " ", "suspe", "nsion", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "reward", "ed", " ", "bec", "aus", "e", " ", "the", "y", "'", "re", " ", "part", " ", "of", " ", "a", " ", "valid", " ", "step", " ", "wis", "e", " ", "moti", "on", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "halt", "_", "=_", "make", "\\u", "halt", "\\u", "function_", "(_", "[_", "9_", ",_", "8_", ",_", "7_", ",_", "6_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "Genome", "_", "(_", "[_", "11_", ",_", "10_", ",_", "9_", ",_", "8_", ",_", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "one", " ", "our", " ", "of", " ", "two", " ", "\"", "correct", "\"", " ", "diss", "ona", "nces_", "\\u\\u\\uNL\\u\\u\\u_", "g1_", "._", "fitness_", "=_", "MAX", "\\u", "RE", "WARD", "_", "+_", "RE", "WARD", "\\u", "SUS", "PEN", "SION", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "population_", "=_", "[_", "g1_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "halt", "_", "(_", "population_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "two", " ", "out", " ", "of", " ", "two", " ", "\"", "correct", "\"", " ", "diss", "ona", "nces_", "\\u\\u\\uNL\\u\\u\\u_", "g1_", "._", "fitness_", "=_", "MAX", "\\u", "RE", "WARD", "_", "+_", "(_", "RE", "WARD", "\\u", "SUS", "PEN", "SION", "_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "population_", "=_", "[_", "g1_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "halt", "_", "(_", "population_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Hal", "t_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "halt", "\\u", "not_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "if", " ", "the", " ", "fit", "test", " ", "geno", "me", " ", "has", " ", "fitness", " ", "<", " ", "MAX", "\\u", "RE", "WARD", " ", "then", " ", "halt", "\\", "10", ";", " ", " ", " ", " ", "doe", "sn", "'", "t", " ", "succe", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "halt", "_", "=_", "make", "\\u", "halt", "\\u", "function_", "(_", "[_", "3_", ",_", "2_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "Genome", "_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "._", "fitness_", "=_", "MAX", "\\u", "RE", "WARD", "_", "-_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", "=_", "Genome", "_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", "._", "fitness_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g3", "_", "=_", "Genome", "_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g3", "_", "._", "fitness_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Any", " ", "fit", "test", " ", "solut", "ion", " ", "with", " ", "fitness", " ", "<", " ", "MAX", "\\u", "RE", "WARD", " ", "means", " ", "no", " ", "halt", "._", "\\u\\u\\uNL\\u\\u\\u_", "population_", "=_", "[_", "g1_", ",_", "g2_", ",_", "g3", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "halt", "_", "(_", "population_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Genome", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "the", " ", "Genome", " ", "class", " ", "is", " ", "overrid", "den", " ", "as", " ", "expected", ".", "\\", "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", "Genome", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "mutate", "\\u", "is", "\\u", "implemented", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "we", " ", "have", " ", "a", " ", "mutate", " ", "method", " ", "implemented", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genome_", "=_", "Genome", "_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "Not", "Implemented_", ",_", "genome_", "._", "mutate_", "(_", "2_", ",_", "0.2_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Genome", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mutate", "\\u", "bounded", "\\u", "by", "\\u", "arg", "\\u", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "rat", "her", " ", "contr", "ive", "d", " ", "test", " ", "but", " ", "it", " ", "prove", "s", " ", "tha", "t", " ", "bot", "h", " ", "the", " ", "mutat", "ion", "\\u", "range", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "mutat", "ion", "\\u", "rate", " ", "are", " ", "used", " ", "correct", "ly", " ", "give", "n", " ", "the", " ", "context", " ", "give", "n", " ", "by", " ", "a", " ", "cant", "us", "\\", "10", ";", " ", " ", " ", " ", "firm", "us", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cant", "us", "\\u", "firm", "us_", "=_", "[_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mutate", " ", "every", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "mutat", "ion", "\\u", "rate_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "will", " ", "alw", "ay", "s", " ", "mutate", " ", "to", " ", "third", "s", " ", "above", " ", "the", " ", "cf", " ", "note", "._", "\\u\\u\\uNL\\u\\u\\u_", "mutat", "ion", "\\u", "range_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genome_", "=_", "Genome", "_", "(_", "[_", "5_", ",_", "6_", ",_", "7_", ",_", "8_", ",_", "9_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genome_", "._", "mutate_", "(_", "mutat", "ion", "\\u", "range_", ",_", "mutat", "ion", "\\u", "rate_", ",_", "cant", "us", "\\u", "firm", "us_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "3_", ",_", "3_", ",_", "3_", ",_", "3_", ",_", "3_", "]_", ",_", "genome_", "._", "chromosome_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unreachable code
kivy/kivy/examples/svg/main-smaa.py
[ { "content": " def build(self):\n from kivy.garden.smaa import SMAA\n\n Window.bind(on_keyboard=self._on_keyboard_handler)\n\n self.smaa = SMAA()\n self.effects = [self.smaa, Widget()]\n self.effect_index = 0\n self.label = Label(text='SMAA', top=Window.height)\n self.effect = effect = self.effects[0]\n self.root = FloatLayout()\n self.root.add_widget(effect)\n\n if 0:\n from kivy.graphics import Color, Rectangle\n wid = Widget(size=Window.size)\n with wid.canvas:\n Color(1, 1, 1, 1)\n Rectangle(size=Window.size)\n effect.add_widget(wid)\n\n if 1:\n #from kivy.uix.image import Image\n #root.add_widget(Image(source='data/logo/kivy-icon-512.png',\n # size=(800, 600)))\n\n filenames = sys.argv[1:]\n if not filenames:\n filenames = glob(join(dirname(__file__), '*.svg'))\n\n for filename in filenames:\n svg = SvgWidget(filename)\n effect.add_widget(svg)\n\n effect.add_widget(self.label)\n svg.scale = 5.\n svg.center = Window.center\n\n if 0:\n wid = Scatter(size=Window.size)\n from kivy.graphics import Color, Triangle, Rectangle\n with wid.canvas:\n Color(0, 0, 0, 1)\n Rectangle(size=Window.size)\n Color(1, 1, 1, 1)\n w, h = Window.size\n cx, cy = w / 2., h / 2.\n Triangle(points=[cx - w * 0.25, cy - h * 0.25,\n cx, cy + h * 0.25,\n cx + w * 0.25, cy - h * 0.25])\n effect.add_widget(wid)\n\n if 0:\n from kivy.uix.button import Button\n from kivy.uix.slider import Slider\n effect.add_widget(Button(text='Hello World'))\n effect.add_widget(Slider(pos=(200, 200)))\n\n control_ui = Builder.load_string(smaa_ui)\n self.root.add_widget(control_ui)", "metadata": "root.SvgApp.build", "header": "['class', 'SvgApp', '(', 'App', ')', ':', '___EOS___']", "index": 78 } ]
[ { "span": "from kivy.graphics import Color, Rectangle", "start_line": 92, "start_column": 12, "end_line": 92, "end_column": 54 }, { "span": "wid = Scatter(size=Window.size)", "start_line": 117, "start_column": 12, "end_line": 117, "end_column": 43 }, { "span": "from kivy.uix.button import Button", "start_line": 131, "start_column": 12, "end_line": 131, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Svg", "App_", "(_", "App_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "kivy_", "._", "gard", "en_", "._", "sma", "a_", "import_", "SMA", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Window_", "._", "bind_", "(_", "on", "\\u", "keyboard_", "=_", "self_", "._", "\\u", "on", "\\u", "keyb", "oard", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sma", "a_", "=_", "SMA", "A_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "effects_", "=_", "[_", "self_", "._", "sma", "a_", ",_", "Widget_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "effect", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label_", "=_", "Label_", "(_", "text_", "=_", "'", "SMA", "A", "'_", ",_", "top_", "=_", "Window_", "._", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "effect_", "=_", "effect_", "=_", "self_", "._", "effects_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "=_", "Float", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "._", "add", "\\u", "widget_", "(_", "effect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "kivy_", "._", "graphics_", "import_", "Color_", ",_", "Rectangle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wid_", "=_", "Widget_", "(_", "size_", "=_", "Window_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "wid_", "._", "canvas_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Color_", "(_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Rectangle_", "(_", "size_", "=_", "Window_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "effect_", "._", "add", "\\u", "widget_", "(_", "wid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "ki", "vy", ".", "ui", "x", ".", "image", " ", "import", " ", "Image_", "\\u\\u\\uNL\\u\\u\\u_", "#", "root", ".", "add", "\\u", "widget", "(", "Image", "(", "source", "='", "data", "/", "logo", "/", "ki", "vy", "-", "icon", "-", "512", ".", "png", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "size", "=(", "800", ",", " ", "600", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filenames_", "=_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filenames_", "=_", "glob_", "(_", "join_", "(_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'*", ".", "svg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "svg_", "=_", "Svg", "Widget_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "effect_", "._", "add", "\\u", "widget_", "(_", "svg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "effect_", "._", "add", "\\u", "widget_", "(_", "self_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svg_", "._", "scale_", "=_", "5._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svg_", "._", "center_", "=_", "Window_", "._", "center_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wid_", "=_", "Scatter", "_", "(_", "size_", "=_", "Window_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kivy_", "._", "graphics_", "import_", "Color_", ",_", "Triangle", "_", ",_", "Rectangle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "wid_", "._", "canvas_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Color_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Rectangle_", "(_", "size_", "=_", "Window_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Color_", "(_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", ",_", "h_", "=_", "Window_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cx_", ",_", "cy_", "=_", "w_", "/_", "2._", ",_", "h_", "/_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Triangle", "_", "(_", "points_", "=_", "[_", "cx_", "-_", "w_", "*_", "0.25_", ",_", "cy_", "-_", "h_", "*_", "0.25_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cx_", ",_", "cy_", "+_", "h_", "*_", "0.25_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cx_", "+_", "w_", "*_", "0.25_", ",_", "cy_", "-_", "h_", "*_", "0.25_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "effect_", "._", "add", "\\u", "widget_", "(_", "wid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "kivy_", "._", "uix_", "._", "button_", "import_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kivy_", "._", "uix_", "._", "slider_", "import_", "Slider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "effect_", "._", "add", "\\u", "widget_", "(_", "Button_", "(_", "text_", "=_", "'", "Hell", "o", " ", "Wor", "ld", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "effect_", "._", "add", "\\u", "widget_", "(_", "Slider_", "(_", "pos_", "=_", "(_", "200_", ",_", "200_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "control", "\\u", "ui_", "=_", "Builder_", "._", "load", "\\u", "string_", "(_", "sma", "a", "\\u", "ui_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "._", "add", "\\u", "widget_", "(_", "control", "\\u", "ui_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/case/tests/test_rebuild.py
[ { "content": " def test_couch_action_equality(self):\n case_id = _post_util(create=True)\n _post_util(case_id=case_id, p1='p1', p2='p2')\n\n case = CommCareCase.get(case_id)\n self.assertEqual(2, len(case.actions)) # create + update\n self.assertTrue(case.actions[0] != case.actions[1])\n self.assertTrue(case.actions[1] == case.actions[1])\n\n orig = case.actions[1]\n copy = CommCareCaseAction.wrap(orig._doc.copy())\n self.assertTrue(copy != case.actions[0])\n self.assertTrue(copy == orig)\n\n copy.server_date = copy.server_date + timedelta(seconds=1)\n self.assertTrue(copy != orig)\n copy.server_date = orig.server_date\n self.assertTrue(copy == orig)\n\n copy.updated_unknown_properties['p1'] = 'not-p1'\n self.assertTrue(copy != orig)\n copy.updated_unknown_properties['p1'] = 'p1'\n self.assertTrue(copy == orig)\n copy.updated_unknown_properties['pnew'] = ''\n self.assertTrue(copy != orig)", "metadata": "root.CaseRebuildTest.test_couch_action_equality", "header": "['class', 'CaseRebuildTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 67 }, { "content": " @run_with_all_backends\n def test_form_archiving(self):\n now = datetime.utcnow()\n # make sure we timestamp everything so they have the right order\n case_id = _post_util(create=True, p1='p1-1', p2='p2-1',\n form_extras={'received_on': now})\n _post_util(case_id=case_id, p2='p2-2', p3='p3-2', p4='p4-2',\n form_extras={'received_on': now + timedelta(seconds=1)})\n _post_util(case_id=case_id, p4='p4-3', p5='p5-3', close=True,\n form_extras={'received_on': now + timedelta(seconds=2)})\n\n case_accessors = CaseAccessors(REBUILD_TEST_DOMAIN)\n case = case_accessors.get_case(case_id)\n closed_by = case.closed_by\n closed_on = case.closed_on\n self.assertNotEqual('', closed_by)\n self.assertNotEqual(None, closed_on)\n\n def _check_initial_state(case):\n self.assertTrue(case.closed)\n self.assertEqual(closed_by, case.closed_by)\n self.assertEqual(closed_on, case.closed_on)\n self.assertEqual(case.get_case_property('p1'), 'p1-1') # original\n self.assertEqual(case.get_case_property('p2'), 'p2-2') # updated in second post\n self.assertEqual(case.get_case_property('p3'), 'p3-2') # new in second post\n self.assertEqual(case.get_case_property('p4'), 'p4-3') # updated in third post\n self.assertEqual(case.get_case_property('p5'), 'p5-3') # new in third post\n if should_use_sql_backend(REBUILD_TEST_DOMAIN):\n # SQL stores one transaction per form\n self.assertEqual(3, len(primary_actions(case))) # create + update + close\n else:\n self.assertEqual(5, len(primary_actions(case))) # create + 3 updates + close\n\n _check_initial_state(case)\n\n # verify xform/action states\n [f1, f2, f3] = case.xform_ids\n if should_use_sql_backend(REBUILD_TEST_DOMAIN):\n [create, update, close] = case.actions\n self.assertEqual(f1, create.form_id)\n self.assertEqual(f2, update.form_id)\n self.assertEqual(f3, close.form_id)\n else:\n [create, u1, u2, u3, close] = case.actions\n self.assertEqual(f1, create.form_id)\n self.assertEqual(f1, u1.form_id)\n self.assertEqual(f2, u2.form_id)\n self.assertEqual(f3, u3.form_id)\n\n # todo: should this be the behavior for archiving the create form?\n form_acessors = FormAccessors(REBUILD_TEST_DOMAIN)\n f1_doc = form_acessors.get_form(f1)\n f1_doc.archive()\n case = case_accessors.get_case(case_id)\n\n if should_use_sql_backend(REBUILD_TEST_DOMAIN):\n self.assertEqual(2, len(primary_actions(case)))\n else:\n self.assertEqual(3, len(primary_actions(case)))\n\n [u2, u3] = case.xform_ids\n self.assertEqual(f2, u2)\n self.assertEqual(f3, u3)\n\n self.assertTrue(case.closed) # no change\n self.assertFalse('p1' in case.dynamic_case_properties()) # should disappear entirely\n self.assertEqual(case.get_case_property('p2'), 'p2-2') # no change\n self.assertEqual(case.get_case_property('p3'), 'p3-2') # no change\n self.assertEqual(case.get_case_property('p4'), 'p4-3') # no change\n self.assertEqual(case.get_case_property('p5'), 'p5-3') # no change\n\n def _reset(form_id):\n form_doc = form_acessors.get_form(form_id)\n form_doc.unarchive()\n case = case_accessors.get_case(case_id)\n _check_initial_state(case)\n\n _reset(f1)\n\n f2_doc = form_acessors.get_form(f2)\n f2_doc.archive()\n case = case_accessors.get_case(case_id)\n\n if should_use_sql_backend(REBUILD_TEST_DOMAIN):\n self.assertEqual(2, len(primary_actions(case)))\n else:\n self.assertEqual(4, len(primary_actions(case)))\n\n [u1, u3] = case.xform_ids\n self.assertEqual(f1, u1)\n self.assertEqual(f3, u3)\n\n self.assertTrue(case.closed) # no change\n self.assertEqual(case.get_case_property('p1'), 'p1-1') # original\n self.assertEqual(case.get_case_property('p2'), 'p2-1') # loses second form update\n self.assertFalse('p3' in case.dynamic_case_properties()) # should disappear entirely\n self.assertEqual(case.get_case_property('p4'), 'p4-3') # no change\n self.assertEqual(case.get_case_property('p5'), 'p5-3') # no change\n\n _reset(f2)\n\n f3_doc = form_acessors.get_form(f3)\n f3_doc.archive()\n case = case_accessors.get_case(case_id)\n\n if should_use_sql_backend(REBUILD_TEST_DOMAIN):\n self.assertEqual(2, len(primary_actions(case)))\n else:\n self.assertEqual(3, len(primary_actions(case)))\n\n [u1, u2] = case.xform_ids\n self.assertEqual(f1, u1)\n self.assertEqual(f2, u2)\n\n self.assertFalse(case.closed) # reopened!\n self.assertEqual('', case.closed_by)\n self.assertEqual(None, case.closed_on)\n self.assertEqual(case.get_case_property('p1'), 'p1-1') # original\n self.assertEqual(case.get_case_property('p2'), 'p2-2') # original\n self.assertEqual(case.get_case_property('p3'), 'p3-2') # new in second post\n self.assertEqual(case.get_case_property('p4'), 'p4-2') # loses third form update\n self.assertFalse('p5' in case.dynamic_case_properties()) # should disappear entirely\n _reset(f3)", "metadata": "root.CaseRebuildTest.test_form_archiving", "header": "['class', 'CaseRebuildTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 279 } ]
[ { "span": "self.assertTrue(case.actions[0] != case.actions[1])", "start_line": 73, "start_column": 8, "end_line": 73, "end_column": 59 }, { "span": "self.assertTrue(case.actions[1] == case.actions[1])", "start_line": 74, "start_column": 8, "end_line": 74, "end_column": 59 }, { "span": "self.assertTrue(copy != case.actions[0])", "start_line": 78, "start_column": 8, "end_line": 78, "end_column": 48 }, { "span": "self.assertTrue(copy == orig)", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 37 }, { "span": "self.assertTrue(copy != orig)", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 37 }, { "span": "self.assertTrue(copy == orig)", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 37 }, { "span": "self.assertTrue(copy != orig)", "start_line": 87, "start_column": 8, "end_line": 87, "end_column": 37 }, { "span": "self.assertTrue(copy == orig)", "start_line": 89, "start_column": 8, "end_line": 89, "end_column": 37 }, { "span": "self.assertTrue(copy != orig)", "start_line": 91, "start_column": 8, "end_line": 91, "end_column": 37 }, { "span": "self.assertFalse('p1' in case.dynamic_case_properties()) ", "start_line": 344, "start_column": 8, "end_line": 344, "end_column": 64 }, { "span": "self.assertFalse('p3' in case.dynamic_case_properties()) ", "start_line": 374, "start_column": 8, "end_line": 374, "end_column": 64 }, { "span": "self.assertFalse('p5' in case.dynamic_case_properties()) ", "start_line": 400, "start_column": 8, "end_line": 400, "end_column": 64 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Case", "Reb", "uild", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "couch", "\\u", "action", "\\u", "equality", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "case", "\\u", "id_", "=_", "\\u", "post", "\\u", "util_", "(_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "post", "\\u", "util_", "(_", "case", "\\u", "id_", "=_", "case", "\\u", "id_", ",_", "p1_", "=_", "'", "p1", "'_", ",_", "p2_", "=_", "'", "p2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "case_", "=_", "Comm", "Care", "Case_", "._", "get_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "case_", "._", "actions_", ")_", ")_", "#", " ", "create", " ", "+", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "case_", "._", "actions_", "[_", "0_", "]_", "!=_", "case_", "._", "actions_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "case_", "._", "actions_", "[_", "1_", "]_", "==_", "case_", "._", "actions_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "orig_", "=_", "case_", "._", "actions_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy_", "=_", "Comm", "Care", "Case", "Action_", "._", "wrap_", "(_", "orig_", "._", "\\u", "doc_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "copy_", "!=_", "case_", "._", "actions_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "copy_", "==_", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "copy_", "._", "server", "\\u", "date_", "=_", "copy_", "._", "server", "\\u", "date_", "+_", "timedelta_", "(_", "seconds_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "copy_", "!=_", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy_", "._", "server", "\\u", "date_", "=_", "orig_", "._", "server", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "copy_", "==_", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "copy_", "._", "update", "d\\u", "unknown", "\\u", "properties_", "[_", "'", "p1", "'_", "]_", "=_", "'", "not", "-", "p1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "copy_", "!=_", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy_", "._", "update", "d\\u", "unknown", "\\u", "properties_", "[_", "'", "p1", "'_", "]_", "=_", "'", "p1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "copy_", "==_", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy_", "._", "update", "d\\u", "unknown", "\\u", "properties_", "[_", "'", "pne", "w", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "copy_", "!=_", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Case", "Reb", "uild", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "run", "\\u", "with", "\\u", "all", "\\u", "backends_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "form", "\\u", "archi", "ving", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "timestamp", " ", "every", "thing", " ", "so", " ", "the", "y", " ", "have", " ", "the", " ", "right", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "\\u", "post", "\\u", "util_", "(_", "create_", "=_", "True_", ",_", "p1_", "=_", "'", "p1", "-1", "'_", ",_", "p2_", "=_", "'", "p2", "-1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "extras_", "=_", "{_", "'", "receive", "d\\u", "on", "'_", ":_", "now_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "post", "\\u", "util_", "(_", "case", "\\u", "id_", "=_", "case", "\\u", "id_", ",_", "p2_", "=_", "'", "p2", "-", "2", "'_", ",_", "p3_", "=_", "'", "p3", "-", "2", "'_", ",_", "p4_", "=_", "'", "p4", "-", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "extras_", "=_", "{_", "'", "receive", "d\\u", "on", "'_", ":_", "now_", "+_", "timedelta_", "(_", "seconds_", "=_", "1_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "post", "\\u", "util_", "(_", "case", "\\u", "id_", "=_", "case", "\\u", "id_", ",_", "p4_", "=_", "'", "p4", "-", "3", "'_", ",_", "p5", "_", "=_", "'", "p5", "-", "3", "'_", ",_", "close_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "extras_", "=_", "{_", "'", "receive", "d\\u", "on", "'_", ":_", "now_", "+_", "timedelta_", "(_", "seconds_", "=_", "2_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "accessor", "s_", "=_", "Case", "Accessor", "s_", "(_", "REB", "UI", "LD", "\\u", "TEST", "\\u", "DOMAIN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case_", "=_", "case", "\\u", "accessor", "s_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "d\\u", "by_", "=_", "case_", "._", "close", "d\\u", "by_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "d\\u", "on_", "=_", "case_", "._", "close", "d\\u", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "''_", ",_", "close", "d\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "None_", ",_", "close", "d\\u", "on_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "check", "\\u", "initial", "\\u", "state_", "(_", "case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "case_", "._", "closed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "close", "d\\u", "by_", ",_", "case_", "._", "close", "d\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "close", "d\\u", "on_", ",_", "case_", "._", "close", "d\\u", "on_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p1", "'_", ")_", ",_", "'", "p1", "-1", "'_", ")_", "#", " ", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p2", "'_", ")_", ",_", "'", "p2", "-", "2", "'_", ")_", "#", " ", "update", "d", " ", "in", " ", "second", " ", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p3", "'_", ")_", ",_", "'", "p3", "-", "2", "'_", ")_", "#", " ", "new", " ", "in", " ", "second", " ", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p4", "'_", ")_", ",_", "'", "p4", "-", "3", "'_", ")_", "#", " ", "update", "d", " ", "in", " ", "third", " ", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p5", "'_", ")_", ",_", "'", "p5", "-", "3", "'_", ")_", "#", " ", "new", " ", "in", " ", "third", " ", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shou", "ld", "\\u", "use", "\\u", "sql", "\\u", "backend_", "(_", "REB", "UI", "LD", "\\u", "TEST", "\\u", "DOMAIN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SQL", " ", "store", "s", " ", "one", " ", "transaction", " ", "per", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "#", " ", "create", " ", "+", " ", "update", " ", "+", " ", "close_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "5_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "#", " ", "create", " ", "+", " ", "3", " ", "update", "s", " ", "+", " ", "close_", "\\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", "check", "\\u", "initial", "\\u", "state_", "(_", "case_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "xform", "/", "action", " ", "states_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "f1_", ",_", "f2_", ",_", "f3_", "]_", "=_", "case_", "._", "xform", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shou", "ld", "\\u", "use", "\\u", "sql", "\\u", "backend_", "(_", "REB", "UI", "LD", "\\u", "TEST", "\\u", "DOMAIN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "create_", ",_", "update_", ",_", "close_", "]_", "=_", "case_", "._", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f1_", ",_", "create_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f2_", ",_", "update_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f3_", ",_", "close_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "create_", ",_", "u1_", ",_", "u2_", ",_", "u", "3_", ",_", "close_", "]_", "=_", "case_", "._", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f1_", ",_", "create_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f1_", ",_", "u1_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f2_", ",_", "u2_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f3_", ",_", "u", "3_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "todo", ":", " ", "shou", "ld", " ", "this", " ", "be", " ", "the", " ", "behavior", " ", "for", " ", "archi", "ving", " ", "the", " ", "create", " ", "form", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form", "\\u", "aces", "sor", "s_", "=_", "Form", "Accessor", "s_", "(_", "REB", "UI", "LD", "\\u", "TEST", "\\u", "DOMAIN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1", "\\u", "doc_", "=_", "form", "\\u", "aces", "sor", "s_", "._", "get", "\\u", "form_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1", "\\u", "doc_", "._", "archive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case_", "=_", "case", "\\u", "accessor", "s_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shou", "ld", "\\u", "use", "\\u", "sql", "\\u", "backend_", "(_", "REB", "UI", "LD", "\\u", "TEST", "\\u", "DOMAIN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "\\u\\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_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "u2_", ",_", "u", "3_", "]_", "=_", "case_", "._", "xform", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f2_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f3_", ",_", "u", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "case_", "._", "closed_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "p1", "'_", "in_", "case_", "._", "dynami", "c\\u", "case", "\\u", "properties_", "(_", ")_", ")_", "#", " ", "shou", "ld", " ", "disapp", "ear", " ", "entire", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p2", "'_", ")_", ",_", "'", "p2", "-", "2", "'_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p3", "'_", ")_", ",_", "'", "p3", "-", "2", "'_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p4", "'_", ")_", ",_", "'", "p4", "-", "3", "'_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p5", "'_", ")_", ",_", "'", "p5", "-", "3", "'_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "reset_", "(_", "form", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "doc_", "=_", "form", "\\u", "aces", "sor", "s_", "._", "get", "\\u", "form_", "(_", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "doc_", "._", "una", "rchi", "ve_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case_", "=_", "case", "\\u", "accessor", "s_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "check", "\\u", "initial", "\\u", "state_", "(_", "case_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "reset_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f2", "\\u", "doc_", "=_", "form", "\\u", "aces", "sor", "s_", "._", "get", "\\u", "form_", "(_", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2", "\\u", "doc_", "._", "archive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case_", "=_", "case", "\\u", "accessor", "s_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shou", "ld", "\\u", "use", "\\u", "sql", "\\u", "backend_", "(_", "REB", "UI", "LD", "\\u", "TEST", "\\u", "DOMAIN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "\\u\\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_", "._", "assert", "Equal_", "(_", "4_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "u1_", ",_", "u", "3_", "]_", "=_", "case_", "._", "xform", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f1_", ",_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f3_", ",_", "u", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "case_", "._", "closed_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p1", "'_", ")_", ",_", "'", "p1", "-1", "'_", ")_", "#", " ", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p2", "'_", ")_", ",_", "'", "p2", "-1", "'_", ")_", "#", " ", "lose", "s", " ", "second", " ", "form", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "p3", "'_", "in_", "case_", "._", "dynami", "c\\u", "case", "\\u", "properties_", "(_", ")_", ")_", "#", " ", "shou", "ld", " ", "disapp", "ear", " ", "entire", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p4", "'_", ")_", ",_", "'", "p4", "-", "3", "'_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p5", "'_", ")_", ",_", "'", "p5", "-", "3", "'_", ")_", "#", " ", "no", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "reset_", "(_", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f3", "\\u", "doc_", "=_", "form", "\\u", "aces", "sor", "s_", "._", "get", "\\u", "form_", "(_", "f3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f3", "\\u", "doc_", "._", "archive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case_", "=_", "case", "\\u", "accessor", "s_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shou", "ld", "\\u", "use", "\\u", "sql", "\\u", "backend_", "(_", "REB", "UI", "LD", "\\u", "TEST", "\\u", "DOMAIN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "\\u\\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_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "primary", "\\u", "actions_", "(_", "case_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "u1_", ",_", "u2_", "]_", "=_", "case_", "._", "xform", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f1_", ",_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f2_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "case_", "._", "closed_", ")_", "#", " ", "reo", "pene", "d", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "''_", ",_", "case_", "._", "close", "d\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "None_", ",_", "case_", "._", "close", "d\\u", "on_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p1", "'_", ")_", ",_", "'", "p1", "-1", "'_", ")_", "#", " ", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p2", "'_", ")_", ",_", "'", "p2", "-", "2", "'_", ")_", "#", " ", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p3", "'_", ")_", ",_", "'", "p3", "-", "2", "'_", ")_", "#", " ", "new", " ", "in", " ", "second", " ", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "case_", "._", "get", "\\u", "case", "\\u", "property_", "(_", "'", "p4", "'_", ")_", ",_", "'", "p4", "-", "2", "'_", ")_", "#", " ", "lose", "s", " ", "third", " ", "form", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "p5", "'_", "in_", "case_", "._", "dynami", "c\\u", "case", "\\u", "properties_", "(_", ")_", ")_", "#", " ", "shou", "ld", " ", "disapp", "ear", " ", "entire", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reset_", "(_", "f3_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,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content": "def rusage_user():\n try:\n from resource import getrusage, RUSAGE_SELF\n return getrusage(RUSAGE_SELF)[0]\n except:\n return 0", "metadata": "root.rusage_user", "header": "['module', '___EOS___']", "index": 3 }, { "content": "def rusage_system():\n try:\n from resource import getrusage, RUSAGE_SELF\n return getrusage(RUSAGE_SELF)[1]\n except:\n return 0", "metadata": "root.rusage_system", "header": "['module', '___EOS___']", "index": 11 } ]
[ { "span": "except:", "start_line": 7, "start_column": 4, "end_line": 7, "end_column": 11 }, { "span": "except:", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "rus", "age", "\\u", "user_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "resource_", "import_", "getr", "usage_", ",_", "RUS", "AGE", "\\u", "SELF", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "getr", "usage_", "(_", "RUS", "AGE", "\\u", "SELF", "_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rus", "age", "\\u", "system_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "resource_", "import_", "getr", "usage_", ",_", "RUS", "AGE", "\\u", "SELF", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "getr", "usage_", "(_", "RUS", "AGE", "\\u", "SELF", "_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
alklein/cosmo-ML/constants.py
[ { "content": "#!/usr/bin/env python \n\nimport os\nimport sys\nimport math\nimport numpy as np\n\nfrom random import *\nfrom numpy import log10\nfrom optparse import OptionParser, OptionGroup\n\n# constants for Via Lactea II and Aquarius A:\nID, D_GC, PVMAX, VMAX, RMAX, MTIDAL, RTIDAL, X, Y, Z, Vx, Vy, Vz, M300pc, M600pc = range(15)\nRad_ext, J_nfw, J_approx = range(8, 11)\nmm, rr, tt, pp, dd, jj = range(6)\nx_earth = 8.5 \nJ_D = 2.e12\nR_vir_VL = 402.\nR_vir_AQ = 433.\nkm_per_kpc = 3.086e16\n\n# Hy Trac cosmological parameters\nomega_matter = 0.27\nomega_lambda = 0.73\nomega_baryon = 0.045\nomega_rad = 8.53E-5\nhubble0 = 0.70\nns_init = 0.96\nsigma_8 = 0.80\nw_de = -1.0\n\n# Hy Trac sim indices\nID, X, Y, Z, VX, VY, VZ = range(7) # for halos and particles\nH_ID = 7 # for particles only\nN200a, M200a, R200a, s200a, N500a, M500a, R500a, s500a = range(7, 15) # for halos only\nN200c, M200c, R200c, s200c, N500c, M500c, R500c, s500c = range(15, 23) # for halos only\n\n# Hy Trac particle + halo counts\nNp = 128**3 # TODO: verify\nNh = 62897 # TODO: verify\n\n# Hy Trac sim parameters\nscalefactor = 1. # for z = 0\na = scalefactor\nbox = 200.\nNdm = 512.\nh0 = 0.7\nom = 0.27\nMpc2cm = 3.08560e+24\nH0_cgs = 3.24086e-18\n\n# Hy Trac conversion constants\nx_unit = box/Ndm\ntime_unit = 2/(3*H0_cgs*h0*(om**.5))*a**2 #[s?]#\nvel_unit = (x_unit/time_unit)/(1e5) #[km/s]#\n\nif __name__ == '__main__':\n print 'Indices:'\n print ID, X, Y, Z, VX, VY, VZ, \\\n N200a, M200a, R200a, s200a, N500a, M500a, R500a, s500a, \\\n N200c, M200c, R200c, s200c, N500c, M500c, R500c, s500c\n print 'Number of particles:',Np\n print 'Number of halos:',Nh\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import math", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 }, { "span": "import numpy as np", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 18 }, { "span": "from numpy import log10", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 23 }, { "span": "from optparse import OptionParser, OptionGroup", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", " ", " ", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "random_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "log10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", ",_", "Optio", "n", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "constant", "s", " ", "for", " ", "Via", " ", "Lac", "tea", " ", "II", " ", "and", " ", "Aq", "uar", "ius", " ", "A", ":_", "\\u\\u\\uNL\\u\\u\\u_", "ID_", ",_", "D", "\\u", "GC", "_", ",_", "PV", "MAX_", ",_", "VM", "AX", "_", ",_", "RM", "AX", "_", ",_", "MT", "IDA", "L_", ",_", "RT", "IDA", "L_", ",_", "X_", ",_", "Y_", ",_", "Z_", ",_", "Vx", "_", ",_", "Vy", "_", ",_", "Vz", "_", ",_", "M3", "00", "pc_", ",_", "M6", "00", "pc_", "=_", "range_", "(_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Rad", "\\u", "ext_", ",_", "J", "\\u", "nf", "w_", ",_", "J", "\\u", "approx_", "=_", "range_", "(_", "8_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mm_", ",_", "rr_", ",_", "tt_", ",_", "pp_", ",_", "dd_", ",_", "jj_", "=_", "range_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "earth", "_", "=_", "8.5", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J", "\\u", "D_", "=_", "2", ".", "e1", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R", "\\u", "vir", "\\u", "VL", "_", "=_", "402", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R", "\\u", "vir", "\\u", "AQ", "_", "=_", "433", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "km", "\\u", "per", "\\u", "kp", "c_", "=_", "3.0", "86", "e1", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hy", " ", "Trac", " ", "cosmo", "logical", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "omega", "\\u", "matte", "r_", "=_", "0.27", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "\\u", "lambda_", "=_", "0.73", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "\\u", "bar", "yon", "_", "=_", "0.04", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "\\u", "rad_", "=_", "8.5", "3", "E-", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hub", "ble", "0_", "=_", "0.70", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns", "\\u", "init_", "=_", "0.96", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sigma", "\\u", "8_", "=_", "0.80", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "de_", "=_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hy", " ", "Trac", " ", "sim", " ", "indices_", "\\u\\u\\uNL\\u\\u\\u_", "ID_", ",_", "X_", ",_", "Y_", ",_", "Z_", ",_", "VX", "_", ",_", "VY", "_", ",_", "VZ", "_", "=_", "range_", "(_", "7_", ")_", "#", " ", "for", " ", "halo", "s", " ", "and", " ", "particles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H", "\\u", "ID_", "=_", "7_", "#", " ", "for", " ", "partic", "les", " ", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N", "200", "a_", ",_", "M2", "00", "a_", ",_", "R2", "00", "a_", ",_", "s2", "00", "a_", ",_", "N", "500", "a_", ",_", "M", "500", "a_", ",_", "R", "500", "a_", ",_", "s5", "00", "a_", "=_", "range_", "(_", "7_", ",_", "15_", ")_", "#", " ", "for", " ", "halo", "s", " ", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N", "200", "c_", ",_", "M2", "00", "c_", ",_", "R2", "00", "c_", ",_", "s2", "00", "c_", ",_", "N", "500", "c_", ",_", "M", "500", "c_", ",_", "R", "500", "c_", ",_", "s5", "00", "c_", "=_", "range_", "(_", "15_", ",_", "23_", ")_", "#", " ", "for", " ", "halo", "s", " ", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hy", " ", "Trac", " ", "partic", "le", " ", "+", " ", "halo", " ", "counts_", "\\u\\u\\uNL\\u\\u\\u_", "Np", "_", "=_", "128_", "**_", "3_", "#", " ", "TOD", "O", ":", " ", "verify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Nh", "_", "=_", "628", "97_", "#", " ", "TOD", "O", ":", " ", "verify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hy", " ", "Trac", " ", "sim", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "factor_", "=_", "1._", "#", " ", "for", " ", "z", " ", "=", " ", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "scale", "factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "=_", "200.", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Nd", "m_", "=_", "512", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h0_", "=_", "0.7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "=_", "0.27", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mp", "c2", "cm_", "=_", "3.0", "856", "0e", "+", "24_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H", "0", "\\u", "cg", "s_", "=_", "3.2", "408", "6e", "-1", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hy", " ", "Trac", " ", "conve", "rsi", "on", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "unit_", "=_", "box_", "/_", "Nd", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "unit_", "=_", "2_", "/_", "(_", "3_", "*_", "H", "0", "\\u", "cg", "s_", "*_", "h0_", "*_", "(_", "om_", "**_", ".5_", ")_", ")_", "*_", "a_", "**_", "2_", "#[", "s", "?]", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vel", "\\u", "unit_", "=_", "(_", "x", "\\u", "unit_", "/_", "time", "\\u", "unit_", ")_", "/_", "(_", "1e", "5_", ")_", "#[", "km", "/", "s", "]", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Indic", "es", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "ID_", ",_", "X_", ",_", "Y_", ",_", "Z_", ",_", "VX", "_", ",_", "VY", "_", ",_", "VZ", "_", ",_", "N", "200", "a_", ",_", "M2", "00", "a_", ",_", "R2", "00", "a_", ",_", "s2", "00", "a_", ",_", "N", "500", "a_", ",_", "M", "500", "a_", ",_", "R", "500", "a_", ",_", "s5", "00", "a_", ",_", "N", "200", "c_", ",_", "M2", "00", "c_", ",_", "R2", "00", "c_", ",_", "s2", "00", "c_", ",_", "N", "500", "c_", ",_", "M", "500", "c_", ",_", "R", "500", "c_", ",_", "s5", "00", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Number", " ", "of", " ", "partic", "les", ":'_", ",_", "Np", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Number", " ", "of", " ", "halo", "s", ":'_", ",_", "Nh", "_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
open-cloud/xos/xos/services/onos/admin.py
[ { "content": "from django.contrib import admin\n\nfrom services.onos.models import *\nfrom django import forms\nfrom django.utils.safestring import mark_safe\nfrom django.contrib.auth.admin import UserAdmin\nfrom django.contrib.admin.widgets import FilteredSelectMultiple\nfrom django.contrib.auth.forms import ReadOnlyPasswordHashField\nfrom django.contrib.auth.signals import user_logged_in\nfrom django.utils import timezone\nfrom django.contrib.contenttypes import generic\nfrom suit.widgets import LinkedSelect\nfrom core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, TenantRootTenantInline, TenantRootPrivilegeInline, TenantAttrAsTabInline\nfrom core.middleware import get_request\n\nfrom functools import update_wrapper\nfrom django.contrib.admin.views.main import ChangeList\nfrom django.core.urlresolvers import reverse\nfrom django.contrib.admin.utils import quote\n\n\n\n\n\nadmin.site.register(ONOSService, ONOSServiceAdmin)\nadmin.site.register(ONOSApp, ONOSAppAdmin)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ONOSServiceForm(forms.ModelForm):\n rest_hostname = forms.CharField(required=False)\n rest_port = forms.CharField(required=False)\n no_container = forms.BooleanField(required=False)\n# external_hostname = forms.CharField(required=False)\n# external_container = forms.CharField(required=False)\n\n# self.fields['external_hostname'].initial = self.instance.external_hostname\n# self.fields['external_container'].initial = self.instance.external_hostname\n\n\n class Meta:\n model = ONOSService", "metadata": "root.ONOSServiceForm", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self,*args,**kwargs):\n super (ONOSServiceForm,self ).__init__(*args,**kwargs)\n if self.instance:\n # fields for the attributes\n self.fields['rest_hostname'].initial = self.instance.rest_hostname\n self.fields['rest_port'].initial = self.instance.rest_port\n self.fields['no_container'].initial = self.instance.no_container", "metadata": "root.ONOSServiceForm.__init__", "header": "['class', 'ONOSServiceForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 27 }, { "content": " def save(self, commit=True):\n self.instance.rest_hostname = self.cleaned_data.get(\"rest_hostname\")\n self.instance.rest_port = self.cleaned_data.get(\"rest_port\")\n self.instance.no_container = self.cleaned_data.get(\"no_container\")\n# self.instance.external_hostname = self.cleaned_data.get(\"external_hostname\")\n# self.instance.external_container = self.cleaned_data.get(\"external_container\")\n return super(ONOSServiceForm, self).save(commit=commit)", "metadata": "root.ONOSServiceForm.save", "header": "['class', 'ONOSServiceForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 37 }, { "content": "class ONOSServiceAdmin(ReadOnlyAwareAdmin):\n model = ONOSService\n verbose_name = \"ONOS Service\"\n verbose_name_plural = \"ONOS Services\"\n list_display = (\"backend_status_icon\", \"name\", \"enabled\")\n list_display_links = ('backend_status_icon', 'name', )\n fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description',\"view_url\",\"icon_url\", \"rest_hostname\", \"rest_port\", \"no_container\" ], 'classes':['suit-tab suit-tab-general']})]\n readonly_fields = ('backend_status_text', )\n inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline]\n form = ONOSServiceForm\n\n extracontext_registered_admins = True\n\n user_readonly_fields = [\"name\", \"enabled\", \"versionNumber\", \"description\"]\n\n suit_form_tabs =(('general', 'ONOS Service Details'),\n ('administration', 'Administration'),\n ('slices','Slices'),\n ('serviceattrs','Additional Attributes'),\n ('serviceprivileges','Privileges'),\n )\n\n suit_form_includes = (('onosadmin.html', 'top', 'administration'),\n )\n", "metadata": "root.ONOSServiceAdmin", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def queryset(self, request):\n return ONOSService.get_service_objects_by_user(request.user)", "metadata": "root.ONOSServiceAdmin.queryset", "header": "['class', 'ONOSServiceAdmin', '(', 'ReadOnlyAwareAdmin', ')', ':', '___EOS___']", "index": 73 }, { "content": "class ONOSAppForm(forms.ModelForm):\n creator = forms.ModelChoiceField(queryset=User.objects.all())\n name = forms.CharField()\n dependencies = forms.CharField(required=False)\n\n\n\n class Meta:\n model = ONOSApp", "metadata": "root.ONOSAppForm", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def __init__(self,*args,**kwargs):\n super (ONOSAppForm,self ).__init__(*args,**kwargs)\n self.fields['kind'].widget.attrs['readonly'] = True\n self.fields['provider_service'].queryset = ONOSService.get_service_objects().all()\n if self.instance:\n # fields for the attributes\n self.fields['creator'].initial = self.instance.creator\n self.fields['name'].initial = self.instance.name\n self.fields['dependencies'].initial = self.instance.dependencies\n if (not self.instance) or (not self.instance.pk):\n # default fields for an 'add' form\n self.fields['kind'].initial = ONOS_KIND\n self.fields['creator'].initial = get_request().user\n if ONOSService.get_service_objects().exists():\n self.fields[\"provider_service\"].initial = ONOSService.get_service_objects().all()[0]", "metadata": "root.ONOSAppForm.__init__", "header": "['class', 'ONOSAppForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 81 }, { "content": " def save(self, commit=True):\n self.instance.creator = self.cleaned_data.get(\"creator\")\n self.instance.name = self.cleaned_data.get(\"name\")\n self.instance.dependencies = self.cleaned_data.get(\"dependencies\")\n return super(ONOSAppForm, self).save(commit=commit)", "metadata": "root.ONOSAppForm.save", "header": "['class', 'ONOSAppForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 97 }, { "content": "class ONOSAppAdmin(ReadOnlyAwareAdmin):\n list_display = ('backend_status_icon', 'name', )\n list_display_links = ('backend_status_icon', 'name')\n fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'name', 'provider_service', 'subscriber_service', 'service_specific_attribute', \"dependencies\",\n 'creator'],\n 'classes':['suit-tab suit-tab-general']})]\n readonly_fields = ('backend_status_text', 'instance', 'service_specific_attribute')\n inlines = [TenantAttrAsTabInline]\n form = ONOSAppForm\n\n suit_form_tabs = (('general','Details'), ('tenantattrs', 'Attributes'))\n", "metadata": "root.ONOSAppAdmin", "header": "['module', '___EOS___']", "index": 106 }, { "content": " def queryset(self, request):\n return ONOSApp.get_tenant_objects_by_user(request.user)", "metadata": "root.ONOSAppAdmin.queryset", "header": "['class', 'ONOSAppAdmin', '(', 'ReadOnlyAwareAdmin', ')', ':', '___EOS___']", "index": 118 } ]
[ { "span": "from django.utils.safestring import mark_safe", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 45 }, { "span": "from django.contrib.auth.admin import UserAdmin", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 47 }, { "span": "from django.contrib.admin.widgets import FilteredSelectMultiple", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 63 }, { "span": "from django.contrib.auth.forms import ReadOnlyPasswordHashField", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 63 }, { "span": "from django.contrib.auth.signals import user_logged_in", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 54 }, { "span": "from django.utils import timezone", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 33 }, { "span": "from django.contrib.contenttypes import generic", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 47 }, { "span": "from suit.widgets import LinkedSelect", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 37 }, { "span": "from core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, TenantRootTenantInline, TenantRootPrivilegeInline, TenantAttrAsTabInline", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 209 }, { "span": "from functools import update_wrapper", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 36 }, { "span": "from django.contrib.admin.views.main import ChangeList", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 54 }, { "span": "from django.core.urlresolvers import reverse", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 44 }, { "span": "from django.contrib.admin.utils import quote", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "services_", "._", "ono", "s_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "safe", "string_", "import_", "mark", "\\u", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "admin_", "import_", "User", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "widgets_", "import_", "Filter", "ed", "Select", "Multiple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "forms_", "import_", "Read", "On", "ly", "Passw", "ord", "Hash", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "signals_", "import_", "user", "\\u", "logged", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "import_", "generic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "suit_", "._", "widgets_", "import_", "Linke", "d", "Select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "admin_", "import_", "Service", "App", "Admin_", ",_", "Slice", "Inline_", ",_", "Service", "Attr", "As", "Tab", "Inline_", ",_", "Read", "On", "ly", "Awa", "re", "Admin_", ",_", "XO", "ST", "abu", "lar", "Inline_", ",_", "Service", "Privilege", "Inline_", ",_", "Ten", "ant", "Roo", "t", "Ten", "ant", "Inline_", ",_", "Ten", "ant", "Roo", "t", "Privilege", "Inline_", ",_", "Ten", "ant", "Attr", "As", "Tab", "Inline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "middleware_", "import_", "get", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "update", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "views_", "._", "main_", "import_", "Change", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "utils_", "import_", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "admin_", "._", "site_", "._", "register_", "(_", "ON", "OSS", "ervice", "_", ",_", "ON", "OSS", "ervice", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "ON", "OS", "App_", ",_", "ON", "OS", "App", "Admin_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "ON", "OSS", "ervice", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rest", "\\u", "hostname_", "=_", "forms_", "._", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rest", "\\u", "port_", "=_", "forms_", "._", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "container_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "external", "\\u", "host", "name", " ", "=", " ", "forms", ".", "Char", "Field", "(", "require", "d", "=", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "external", "\\u", "container", " ", "=", " ", "forms", ".", "Char", "Field", "(", "require", "d", "=", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "fields", "['", "external", "\\u", "host", "name", "']", ".", "initial", " ", "=", " ", "self", ".", "instance", ".", "external", "\\u", "hostname_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "fields", "['", "external", "\\u", "container", "']", ".", "initial", " ", "=", " ", "self", ".", "instance", ".", "external", "\\u", "hostname_", "\\u\\u\\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_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "ON", "OSS", "ervice", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ON", "OSS", "ervice", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "ON", "OSS", "ervice", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fields", " ", "for", " ", "the", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "rest", "\\u", "host", "name", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "rest", "\\u", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "rest", "\\u", "port", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "rest", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "no", "\\u", "container", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "no", "\\u", "container_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ON", "OSS", "ervice", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\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_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "instance_", "._", "rest", "\\u", "hostname_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "rest", "\\u", "host", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "._", "rest", "\\u", "port_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "rest", "\\u", "port", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "._", "no", "\\u", "container_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "no", "\\u", "container", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "instance", ".", "external", "\\u", "host", "name", " ", "=", " ", "self", ".", "clean", "ed", "\\u", "data", ".", "get", "(\"", "external", "\\u", "host", "name", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "instance", ".", "external", "\\u", "container", " ", "=", " ", "self", ".", "clean", "ed", "\\u", "data", ".", "get", "(\"", "external", "\\u", "container", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "super_", "(_", "ON", "OSS", "ervice", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", "=_", "commit_", ")_", "\\u\\u\\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_", "ON", "OSS", "ervice", "Admin_", "(_", "Read", "On", "ly", "Awa", "re", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "ON", "OSS", "ervice", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "ON", "OS", " ", "Service", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "ON", "OS", " ", "Service", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", "\"", "enable", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "enable", "d", "'_", ",_", "'", "version", "Number", "'_", ",_", "'", "description", "'_", ",_", "\"", "view", "\\u", "url", "\"_", ",_", "\"", "icon", "\\u", "url", "\"_", ",_", "\"", "rest", "\\u", "host", "name", "\"_", ",_", "\"", "rest", "\\u", "port", "\"_", ",_", "\"", "no", "\\u", "container", "\"_", "]_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Slice", "Inline_", ",_", "Service", "Attr", "As", "Tab", "Inline_", ",_", "Service", "Privilege", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "ON", "OSS", "ervice", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "context", "\\u", "register", "ed", "\\u", "admins_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "name", "\"_", ",_", "\"", "enable", "d", "\"_", ",_", "\"", "version", "Number", "\"_", ",_", "\"", "description", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "ON", "OS", " ", "Service", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "administrati", "on", "'_", ",_", "'", "Administrati", "on", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slice", "s", "'_", ",_", "'", "Slice", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "service", "attr", "s", "'_", ",_", "'", "Addition", "al", " ", "Attribute", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "service", "privilege", "s", "'_", ",_", "'", "Privilege", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "includes_", "=_", "(_", "(_", "'", "ono", "sad", "min", ".", "html", "'_", ",_", "'", "top", "'_", ",_", "'", "administrati", "on", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "ON", "OSS", "ervice", "Admin_", "(_", "Read", "On", "ly", "Awa", "re", "Admin_", ")_", ":_", "\\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_", "ON", "OSS", "ervice", "_", "._", "get", "\\u", "service", "\\u", "object", "s", "\\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_", "ON", "OS", "App", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creator_", "=_", "forms_", "._", "Model", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "User_", "._", "objects_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependencies_", "=_", "forms_", "._", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "ON", "OS", "App_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ON", "OS", "App", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "ON", "OS", "App", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "kind", "'_", "]_", "._", "widget_", "._", "attrs_", "[_", "'", "read", "only", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "provide", "r", "\\u", "service", "'_", "]_", "._", "queryset_", "=_", "ON", "OSS", "ervice", "_", "._", "get", "\\u", "service", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fields", " ", "for", " ", "the", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "creat", "or", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "creator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "name", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "dependen", "cies", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "dependencies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "instance_", ")_", "or_", "(_", "not_", "self_", "._", "instance_", "._", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default", " ", "fields", " ", "for", " ", "an", " ", "'", "add", "'", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "kind", "'_", "]_", "._", "initial_", "=_", "ON", "OS", "\\u", "KIND", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "creat", "or", "'_", "]_", "._", "initial_", "=_", "get", "\\u", "request_", "(_", ")_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ON", "OSS", "ervice", "_", "._", "get", "\\u", "service", "\\u", "objects_", "(_", ")_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "\"", "provide", "r", "\\u", "service", "\"_", "]_", "._", "initial_", "=_", "ON", "OSS", "ervice", "_", "._", "get", "\\u", "service", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ON", "OS", "App", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "instance_", "._", "creator_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "creat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "._", "name_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "._", "dependencies_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "dependen", "cies", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "ON", "OS", "App", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", "=_", "commit_", ")_", "\\u\\u\\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_", "ON", "OS", "App", "Admin_", "(_", "Read", "On", "ly", "Awa", "re", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "kind", "'_", ",_", "'", "name", "'_", ",_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "subscribe", "r", "\\u", "service", "'_", ",_", "'", "service", "\\u", "specific", "\\u", "attribute", "'_", ",_", "\"", "dependen", "cies", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creat", "or", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "instance", "'_", ",_", "'", "service", "\\u", "specific", "\\u", "attribute", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Ten", "ant", "Attr", "As", "Tab", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "ON", "OS", "App", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Det", "ail", "s", "'_", ")_", ",_", "(_", "'", "tenan", "tat", "tr", "s", "'_", ",_", "'", "Attribute", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "ON", "OS", "App", "Admin_", "(_", "Read", "On", "ly", "Awa", "re", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\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iovisor/bcc/examples/networking/distributed_bridge/tunnel_mesh.py
[ { "content": "#!/usr/bin/env python\n# Copyright (c) PLUMgrid, Inc.\n# Licensed under the Apache License, Version 2.0 (the \"License\")\n\nfrom sys import argv\nfrom bcc import BPF\nfrom builtins import input\nfrom ctypes import c_int, c_uint\nfrom http.server import HTTPServer, SimpleHTTPRequestHandler\nimport json\nfrom netaddr import EUI, IPAddress\nfrom pyroute2 import IPRoute, NetNS, IPDB, NSPopen\nfrom socket import htons, AF_INET\nfrom threading import Thread\nfrom subprocess import call, Popen, PIPE\n\nnum_hosts = int(argv[1])\nhost_id = int(argv[2])\ndhcp = int(argv[3])\ngretap = int(argv[4])\n\nb = BPF(src_file=\"tunnel_mesh.c\")\ningress_fn = b.load_func(\"handle_ingress\", BPF.SCHED_CLS)\negress_fn = b.load_func(\"handle_egress\", BPF.SCHED_CLS)\ntunkey2if = b.get_table(\"tunkey2if\")\nif2tunkey = b.get_table(\"if2tunkey\")\nconf = b.get_table(\"conf\")\n\nipr = IPRoute()\nipdb = IPDB(nl=ipr)\n\nifc = ipdb.interfaces.eth0\n\n# ifcs to cleanup at the end\nifc_gc = []\n\n# dhcp server and client processes\nd_serv = []\nd_client = []\n\n\ntry:\n run()\n input(\"\")\nfinally:\n for v in ifc_gc: call([\"ip\", \"link\", \"del\", v])\n ipdb.release()\n for p in d_client: p.kill()\n for p in d_serv: p.kill()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def run():\n if gretap:\n with ipdb.create(ifname=\"gretap1\", kind=\"gretap\", gre_ikey=0, gre_okey=0,\n gre_local='172.16.1.%d' % (100 + host_id),\n gre_ttl=16, gre_collect_metadata=1) as vx:\n vx.up()\n ifc_gc.append(vx.ifname)\n else:\n with ipdb.create(ifname=\"vxlan0\", kind=\"vxlan\", vxlan_id=0,\n vxlan_link=ifc, vxlan_port=htons(4789),\n vxlan_collect_metadata=True,\n vxlan_learning=False) as vx:\n vx.up()\n ifc_gc.append(vx.ifname)\n\n conf[c_int(1)] = c_int(vx.index)\n\n ipr.tc(\"add\", \"ingress\", vx.index, \"ffff:\")\n ipr.tc(\"add-filter\", \"bpf\", vx.index, \":1\", fd=ingress_fn.fd,\n name=ingress_fn.name, parent=\"ffff:\", action=\"drop\", classid=1)\n\n for j in range(0, 2):\n vni = 10000 + j\n with ipdb.create(ifname=\"br%d\" % j, kind=\"bridge\") as br:\n for i in range(0, num_hosts):\n if i != host_id:\n v = ipdb.create(ifname=\"dummy%d%d\" % (j , i), kind=\"dummy\").up().commit()\n ipaddr = \"172.16.1.%d\" % (100 + i)\n tunkey2if_key = tunkey2if.Key(vni, IPAddress(ipaddr))\n tunkey2if_leaf = tunkey2if.Leaf(v.index)\n tunkey2if[tunkey2if_key] = tunkey2if_leaf\n\n if2tunkey_key = if2tunkey.Key(v.index)\n if2tunkey_leaf = if2tunkey.Leaf(vni, IPAddress(ipaddr))\n if2tunkey[if2tunkey_key] = if2tunkey_leaf\n\n ipr.tc(\"add\", \"sfq\", v.index, \"1:\")\n ipr.tc(\"add-filter\", \"bpf\", v.index, \":1\", fd=egress_fn.fd,\n name=egress_fn.name, parent=\"1:\", action=\"drop\", classid=1)\n br.add_port(v)\n br.up()\n ifc_gc.append(v.ifname)\n if dhcp == 0:\n ipaddr = \"99.1.%d.%d/24\" % (j, host_id + 1)\n br.add_ip(ipaddr)\n ifc_gc.append(br.ifname)\n\n # dhcp server only runs on host 0\n if dhcp == 1 and host_id == 0:\n for j in range(0, 2):\n v1 = \"dhcp%d_v1\" % j\n v2 = \"dhcp%d_v2\" % j\n br = ipdb.interfaces[\"br%d\" % j]\n with ipdb.create(ifname=v1, kind=\"veth\", peer=v2) as v:\n v.up()\n br.add_port(ipdb.interfaces[v1]).commit()\n dhcp_v2 = ipdb.interfaces[v2]\n dhcp_v2.add_ip(\"99.1.%d.1/24\" % j).up().commit()\n\n call([\"/bin/rm\", \"-f\", \"/tmp/dnsmasq.%d.leases\" % j])\n cmd = [\"dnsmasq\", \"-d\", \"--bind-interfaces\", \"--strict-order\",\n \"--conf-file=\",\n \"--dhcp-range\", \"99.1.%d.2,99.1.%d.254,255.255.255.0,12h\" % (j, j),\n \"--dhcp-no-override\", \"--except-interface=lo\",\n \"--interface=dhcp%d_v2\" % j,\n \"--dhcp-authoritative\",\n \"--dhcp-leasefile=/tmp/dnsmasq.%d.leases\" % j]\n d_serv.append(Popen(cmd, stdout=PIPE, stderr=PIPE))\n\n # dhcp client to assign ip address for each bridge\n if dhcp == 1:\n for j in range(0, 2):\n call([\"/bin/rm\", \"-rf\", \"/tmp/dhcp_%d_%d\" % (host_id, j)])\n call([\"mkdir\", \"/tmp/dhcp_%d_%d\" % (host_id, j)])\n call([\"touch\", \"/tmp/dhcp_%d_%d/dhclient.conf\" % (host_id, j)])\n call([\"touch\", \"/tmp/dhcp_%d_%d/dhclient.lease\" % (host_id, j)])\n cmd = [\"dhclient\", \"-d\", \"br%d\" % j,\n \"-cf\", \"/tmp/dhcp_%d_%d/dhclient.conf\" % (host_id, j),\n \"-lf\", \"/tmp/dhcp_%d_%d/dhclient.lease\" % (host_id, j)]\n d_client.append(Popen(cmd, stdout=PIPE, stderr=PIPE))\n\n # make sure we get address for eth0\n retry = -1\n while retry < 0:\n check = Popen([\"ip\", \"addr\", \"show\", \"br%d\" % j], stdout=PIPE, stderr=PIPE)\n out = check.stdout.read()\n checkip = \"99.1.%d\" % j\n retry = out.find(checkip)", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 40 } ]
[ { "span": "from ctypes import c_int, c_uint", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 32 }, { "span": "from http.server import HTTPServer, SimpleHTTPRequestHandler", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 60 }, { "span": "import json", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 11 }, { "span": "from netaddr import EUI, IPAddress", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 34 }, { "span": "from pyroute2 import IPRoute, NetNS, IPDB, NSPopen", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 50 }, { "span": "from socket import htons, AF_INET", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 33 }, { "span": "from threading import Thread", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "PLU", "Mgr", "id", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sys_", "import_", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bcc", "_", "import_", "BP", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "builtins_", "import_", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "c\\u", "int_", ",_", "c\\u", "uint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "http_", "._", "server_", "import_", "HTTP", "Server_", ",_", "Simple", "HTTP", "Request", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "netaddr_", "import_", "EU", "I_", ",_", "IPA", "ddress", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyro", "ute", "2_", "import_", "IP", "Route_", ",_", "Net", "NS_", ",_", "IP", "DB_", ",_", "NS", "Popen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "ht", "ons_", ",_", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "call_", ",_", "Popen_", ",_", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "hosts_", "=_", "int_", "(_", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "id_", "=_", "int_", "(_", "argv_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dhcp_", "=_", "int_", "(_", "argv_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gre", "tap_", "=_", "int_", "(_", "argv_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "BP", "F_", "(_", "src", "\\u", "file_", "=_", "\"", "tunnel", "\\u", "mesh", ".", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ingress", "\\u", "fn_", "=_", "b_", "._", "load", "\\u", "func_", "(_", "\"", "handle", "\\u", "ingress", "\"_", ",_", "BP", "F_", "._", "SCHE", "D", "\\u", "CLS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "egress", "\\u", "fn_", "=_", "b_", "._", "load", "\\u", "func_", "(_", "\"", "handle", "\\u", "egress", "\"_", ",_", "BP", "F_", "._", "SCHE", "D", "\\u", "CLS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tun", "key", "2i", "f_", "=_", "b_", "._", "get", "\\u", "table_", "(_", "\"", "tun", "key", "2i", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "2t", "unk", "ey_", "=_", "b_", "._", "get", "\\u", "table_", "(_", "\"", "if", "2t", "unk", "ey", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "b_", "._", "get", "\\u", "table_", "(_", "\"", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ipr", "_", "=_", "IP", "Route_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipd", "b_", "=_", "IP", "DB_", "(_", "nl_", "=_", "ipr", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ifc", "_", "=_", "ipd", "b_", "._", "interfaces_", "._", "eth", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ifc", "s", " ", "to", " ", "clean", "up", " ", "at", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "ifc", "\\u", "gc_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dhcp", " ", "server", " ", "and", " ", "client", " ", "processes_", "\\u\\u\\uNL\\u\\u\\u_", "d\\u", "serv_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "client_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input_", "(_", "\"\"_", ")_", "\\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 ", " _", "for_", "v_", "in_", "ifc", "\\u", "gc_", ":_", "call_", "(_", "[_", "\"", "ip", "\"_", ",_", "\"", "link", "\"_", ",_", "\"", "del", "\"_", ",_", "v_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipd", "b_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "d\\u", "client_", ":_", "p_", "._", "kill_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "d\\u", "serv_", ":_", "p_", "._", "kill_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "gre", "tap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "ipd", "b_", "._", "create_", "(_", "ifname_", "=_", "\"", "gre", "tap", "1", "\"_", ",_", "kind_", "=_", "\"", "gre", "tap", "\"_", ",_", "gre", "\\u", "ike", "y_", "=_", "0_", ",_", "gre", "\\u", "oke", "y_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gre", "\\u", "local_", "=_", "'", "172", ".1", "6.1", ".", "%", "d", "'_", "%_", "(_", "100_", "+_", "host", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gre", "\\u", "ttl_", "=_", "16_", ",_", "gre", "\\u", "collect", "\\u", "metadata_", "=_", "1_", ")_", "as_", "vx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vx_", "._", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifc", "\\u", "gc_", "._", "append_", "(_", "vx_", "._", "ifname_", ")_", "\\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 ", " _", "with_", "ipd", "b_", "._", "create_", "(_", "ifname_", "=_", "\"", "vxlan", "0", "\"_", ",_", "kind_", "=_", "\"", "vxlan", "\"_", ",_", "vxlan", "\\u", "id_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vxlan", "\\u", "link_", "=_", "ifc", "_", ",_", "vxlan", "\\u", "port_", "=_", "ht", "ons_", "(_", "478", "9_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vxlan", "\\u", "collect", "\\u", "metadata_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vxlan", "\\u", "learning_", "=_", "False_", ")_", "as_", "vx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vx_", "._", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifc", "\\u", "gc_", "._", "append_", "(_", "vx_", "._", "ifname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conf_", "[_", "c\\u", "int_", "(_", "1_", ")_", "]_", "=_", "c\\u", "int_", "(_", "vx_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ipr", "_", "._", "tc_", "(_", "\"", "add", "\"_", ",_", "\"", "ingress", "\"_", ",_", "vx_", "._", "index_", ",_", "\"", "fff", "f", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipr", "_", "._", "tc_", "(_", "\"", "add", "-", "filter", "\"_", ",_", "\"", "bpf", "\"_", ",_", "vx_", "._", "index_", ",_", "\":", "1", "\"_", ",_", "fd_", "=_", "ingress", "\\u", "fn_", "._", "fd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "ingress", "\\u", "fn_", "._", "name_", ",_", "parent_", "=_", "\"", "fff", "f", ":\"_", ",_", "action_", "=_", "\"", "drop", "\"_", ",_", "class", "id_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "0_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vni", "_", "=_", "10000_", "+_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "ipd", "b_", "._", "create_", "(_", "ifname_", "=_", "\"", "br", "%", "d", "\"_", "%_", "j_", ",_", "kind_", "=_", "\"", "bridge", "\"_", ")_", "as_", "br_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "num", "\\u", "hosts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "!=_", "host", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "ipd", "b_", "._", "create_", "(_", "ifname_", "=_", "\"", "dummy", "%", "d", "%", "d", "\"_", "%_", "(_", "j_", ",_", "i_", ")_", ",_", "kind_", "=_", "\"", "dummy", "\"_", ")_", "._", "up_", "(_", ")_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipaddr_", "=_", "\"", "172", ".1", "6.1", ".", "%", "d", "\"_", "%_", "(_", "100_", "+_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tun", "key", "2i", "f", "\\u", "key_", "=_", "tun", "key", "2i", "f_", "._", "Key_", "(_", "vni", "_", ",_", "IPA", "ddress", "_", "(_", "ipaddr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tun", "key", "2i", "f", "\\u", "leaf_", "=_", "tun", "key", "2i", "f_", "._", "Leaf_", "(_", "v_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tun", "key", "2i", "f_", "[_", "tun", "key", "2i", "f", "\\u", "key_", "]_", "=_", "tun", "key", "2i", "f", "\\u", "leaf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if", "2t", "unk", "ey", "\\u", "key_", "=_", "if", "2t", "unk", "ey_", "._", "Key_", "(_", "v_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "2t", "unk", "ey", "\\u", "leaf_", "=_", "if", "2t", "unk", "ey_", "._", "Leaf_", "(_", "vni", "_", ",_", "IPA", "ddress", "_", "(_", "ipaddr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "2t", "unk", "ey_", "[_", "if", "2t", "unk", "ey", "\\u", "key_", "]_", "=_", "if", "2t", "unk", "ey", "\\u", "leaf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ipr", "_", "._", "tc_", "(_", "\"", "add", "\"_", ",_", "\"", "sf", "q", "\"_", ",_", "v_", "._", "index_", ",_", "\"", "1", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipr", "_", "._", "tc_", "(_", "\"", "add", "-", "filter", "\"_", ",_", "\"", "bpf", "\"_", ",_", "v_", "._", "index_", ",_", "\":", "1", "\"_", ",_", "fd_", "=_", "egress", "\\u", "fn_", "._", "fd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "egress", "\\u", "fn_", "._", "name_", ",_", "parent_", "=_", "\"", "1", ":\"_", ",_", "action_", "=_", "\"", "drop", "\"_", ",_", "class", "id_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "br_", "._", "add", "\\u", "port_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "br_", "._", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifc", "\\u", "gc_", "._", "append_", "(_", "v_", "._", "ifname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dhcp_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "\"", "99.", "1", ".", "%", "d", ".", "%", "d", "/", "24", "\"_", "%_", "(_", "j_", ",_", "host", "\\u", "id_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "br_", "._", "add", "\\u", "ip_", "(_", "ipaddr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifc", "\\u", "gc_", "._", "append_", "(_", "br_", "._", "ifname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dhcp", " ", "server", " ", "only", " ", "runs", " ", "on", " ", "host", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dhcp_", "==_", "1_", "and_", "host", "\\u", "id_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "0_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v1_", "=_", "\"", "dhcp", "%", "d\\u", "v1", "\"_", "%_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2_", "=_", "\"", "dhcp", "%", "d\\u", "v2", "\"_", "%_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "br_", "=_", "ipd", "b_", "._", "interfaces_", "[_", "\"", "br", "%", "d", "\"_", "%_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "ipd", "b_", "._", "create_", "(_", "ifname_", "=_", "v1_", ",_", "kind_", "=_", "\"", "vet", "h", "\"_", ",_", "peer_", "=_", "v2_", ")_", "as_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "._", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "br_", "._", "add", "\\u", "port_", "(_", "ipd", "b_", "._", "interfaces_", "[_", "v1_", "]_", ")_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dhcp", "\\u", "v2_", "=_", "ipd", "b_", "._", "interfaces_", "[_", "v2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dhcp", "\\u", "v2_", "._", "add", "\\u", "ip_", "(_", "\"", "99.", "1", ".", "%", "d", ".1", "/", "24", "\"_", "%_", "j_", ")_", "._", "up_", "(_", ")_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "call_", "(_", "[_", "\"/", "bin", "/", "rm", "\"_", ",_", "\"-", "f", "\"_", ",_", "\"/", "tmp", "/", "dnsm", "asq", ".", "%", "d", ".", "lease", "s", "\"_", "%_", "j_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "dnsm", "asq", "\"_", ",_", "\"-", "d", "\"_", ",_", "\"--", "bind", "-", "interface", "s", "\"_", ",_", "\"--", "strict", "-", "order", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "conf", "-", "file", "=\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "dhcp", "-", "range", "\"_", ",_", "\"", "99.", "1", ".", "%", "d", ".2", ",", "99.", "1", ".", "%", "d", ".2", "5", "4", ",", "255.", "255.", "255.", "0", ",", "1", "2h", "\"_", "%_", "(_", "j_", ",_", "j_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "dhcp", "-", "no", "-", "override", "\"_", ",_", "\"--", "except", "-", "interface", "=", "lo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "interface", "=", "dhcp", "%", "d\\u", "v2", "\"_", "%_", "j_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "dhcp", "-", "authori", "tative", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "dhcp", "-", "lease", "file", "=", "/", "tmp", "/", "dnsm", "asq", ".", "%", "d", ".", "lease", "s", "\"_", "%_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "serv_", "._", "append_", "(_", "Popen_", "(_", "cmd_", ",_", "stdout_", "=_", "PIPE_", ",_", "stderr_", "=_", "PIPE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dhcp", " ", "client", " ", "to", " ", "assign", " ", "ip", " ", "address", " ", "for", " ", "each", " ", "bridge_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dhcp_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "0_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call_", "(_", "[_", "\"/", "bin", "/", "rm", "\"_", ",_", "\"-", "rf", "\"_", ",_", "\"/", "tmp", "/", "dhcp", "\\u", "%", "d\\u", "%", "d", "\"_", "%_", "(_", "host", "\\u", "id_", ",_", "j_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call_", "(_", "[_", "\"", "mkd", "ir", "\"_", ",_", "\"/", "tmp", "/", "dhcp", "\\u", "%", "d\\u", "%", "d", "\"_", "%_", "(_", "host", "\\u", "id_", ",_", "j_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call_", "(_", "[_", "\"", "touch", "\"_", ",_", "\"/", "tmp", "/", "dhcp", "\\u", "%", "d\\u", "%", "d", "/", "dh", "client", ".", "conf", "\"_", "%_", "(_", "host", "\\u", "id_", ",_", "j_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call_", "(_", "[_", "\"", "touch", "\"_", ",_", "\"/", "tmp", "/", "dhcp", "\\u", "%", "d\\u", "%", "d", "/", "dh", "client", ".", "lease", "\"_", "%_", "(_", "host", "\\u", "id_", ",_", "j_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "dh", "client", "\"_", ",_", "\"-", "d", "\"_", ",_", "\"", "br", "%", "d", "\"_", "%_", "j_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "cf", "\"_", ",_", "\"/", "tmp", "/", "dhcp", "\\u", "%", "d\\u", "%", "d", "/", "dh", "client", ".", "conf", "\"_", "%_", "(_", "host", "\\u", "id_", ",_", "j_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "lf", "\"_", ",_", "\"/", "tmp", "/", "dhcp", "\\u", "%", "d\\u", "%", "d", "/", "dh", "client", ".", "lease", "\"_", "%_", "(_", "host", "\\u", "id_", ",_", "j_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "client_", "._", "append_", "(_", "Popen_", "(_", "cmd_", ",_", "stdout_", "=_", "PIPE_", ",_", "stderr_", "=_", "PIPE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "get", " ", "address", " ", "for", " ", "eth", "0_", "\\u\\u\\uNL\\u\\u\\u_", "retry_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "retry_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "Popen_", "(_", "[_", "\"", "ip", "\"_", ",_", "\"", "addr", "\"_", ",_", "\"", "show", "\"_", ",_", "\"", "br", "%", "d", "\"_", "%_", "j_", "]_", ",_", "stdout_", "=_", "PIPE_", ",_", "stderr_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "check_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "ip_", "=_", "\"", "99.", "1", ".", "%", "d", "\"_", "%_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retry_", "=_", "out_", "._", "find_", "(_", "check", "ip_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
chrisglass/django_polymorphic/example/pexp/management/commands/polybench.py
[ { "content": "def print_timing(func, message='', iterations=1):\n def wrapper(*arg):\n results = []\n reset_queries()\n for i in xrange(iterations):\n t1 = time.time()\n x = func(*arg)\n t2 = time.time()\n results.append((t2 - t1) * 1000.0)\n res_sum = 0\n for r in results:\n res_sum += r\n median = res_sum / len(results)\n print '%s%-19s: %.0f ms, %i queries' % (\n message, func.func_name,\n median,\n len(connection.queries) / len(results)\n )\n sys.stdout.flush()\n return wrapper", "metadata": "root.print_timing", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def bench_load2(model):\n for o in model.objects.all():\n f1 = o.field1\n f2 = o.field2\n f3 = o.field3", "metadata": "root.bench_load2", "header": "['module', '___EOS___']", "index": 84 }, { "content": "def bench_load2_short(model):\n for i in xrange(num_objects / 100):\n for o in model.objects.all()[:100]:\n f1 = o.field1\n f2 = o.field2\n f3 = o.field3", "metadata": "root.bench_load2_short", "header": "['module', '___EOS___']", "index": 91 } ]
[ { "span": "x ", "start_line": 41, "start_column": 12, "end_line": 41, "end_column": 13 }, { "span": "f1 ", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 10 }, { "span": "f2 ", "start_line": 87, "start_column": 8, "end_line": 87, "end_column": 10 }, { "span": "f3 ", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 10 }, { "span": "f1 ", "start_line": 94, "start_column": 12, "end_line": 94, "end_column": 14 }, { "span": "f2 ", "start_line": 95, "start_column": 12, "end_line": 95, "end_column": 14 }, { "span": "f3 ", "start_line": 96, "start_column": 12, "end_line": 96, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "print", "\\u", "timing_", "(_", "func_", ",_", "message_", "=_", "''_", ",_", "iterations_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "wrapper_", "(_", "*_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "queries_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "iterations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "func_", "(_", "*_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "(_", "t2_", "-_", "t1_", ")_", "*_", "1000.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "sum_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "sum_", "+=_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "median_", "=_", "res", "\\u", "sum_", "/_", "len_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "s", "%", "-1", "9", "s", ":", " ", "%", ".0", "f", " ", "ms", ",", " ", "%", "i", " ", "querie", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "func_", "._", "func", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "median_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "connection_", "._", "queries_", ")_", "/_", "len_", "(_", "results_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bench", "\\u", "load", "2_", "(_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "o_", "in_", "model_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f1_", "=_", "o_", "._", "field", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "=_", "o_", "._", "field", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f3_", "=_", "o_", "._", "field", "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_", "bench", "\\u", "load", "2", "\\u", "short_", "(_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "num", "\\u", "objects_", "/_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "o_", "in_", "model_", "._", "objects_", "._", "all_", "(_", ")_", "[_", ":_", "100_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f1_", "=_", "o_", "._", "field", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "=_", "o_", "._", "field", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f3_", "=_", "o_", "._", "field", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
adblockplus/gyp/pylib/gyp/input.py
[ { "content": "def GetIncludedBuildFiles(build_file_path, aux_data, included=None):\n \"\"\"Return a list of all build files included into build_file_path.\n\n The returned list will contain build_file_path as well as all other files\n that it included, either directly or indirectly. Note that the list may\n contain files that were included into a conditional section that evaluated\n to false and was not merged into build_file_path's dict.\n\n aux_data is a dict containing a key for each build file or included build\n file. Those keys provide access to dicts whose \"included\" keys contain\n lists of all other files included by the build file.\n\n included should be left at its default None value by external callers. It\n is used for recursion.\n\n The returned list will not contain any duplicate entries. Each build file\n in the list will be relative to the current directory.\n \"\"\"\n\n if included == None:\n included = []\n\n if build_file_path in included:\n return included\n\n included.append(build_file_path)\n\n for included_build_file in aux_data[build_file_path].get('included', []):\n GetIncludedBuildFiles(included_build_file, aux_data, included)\n\n return included", "metadata": "root.GetIncludedBuildFiles", "header": "['module', '___EOS___']", "index": 142 }, { "content": "def EvalCondition(condition, conditions_key, phase, variables, build_file):\n \"\"\"Returns the dict that should be used or None if the result was\n that nothing should be used.\"\"\"\n if type(condition) is not list:\n raise GypError(conditions_key + ' must be a list')\n if len(condition) < 2:\n # It's possible that condition[0] won't work in which case this\n # attempt will raise its own IndexError. That's probably fine.\n raise GypError(conditions_key + ' ' + condition[0] +\n ' must be at least length 2, not ' + str(len(condition)))\n\n i = 0\n result = None\n while i < len(condition):\n cond_expr = condition[i]\n true_dict = condition[i + 1]\n if type(true_dict) is not dict:\n raise GypError('{} {} must be followed by a dictionary, not {}'.format(\n conditions_key, cond_expr, type(true_dict)))\n if len(condition) > i + 2 and type(condition[i + 2]) is dict:\n false_dict = condition[i + 2]\n i = i + 3\n if i != len(condition):\n raise GypError('{} {} has {} unexpected trailing items'.format(\n conditions_key, cond_expr, len(condition) - i))\n else:\n false_dict = None\n i = i + 2\n if result == None:\n result = EvalSingleCondition(\n cond_expr, true_dict, false_dict, phase, variables, build_file)\n\n return result", "metadata": "root.EvalCondition", "header": "['module', '___EOS___']", "index": 1032 }, { "content": " def DirectDependencies(self, dependencies=None):\n \"\"\"Returns a list of just direct dependencies.\"\"\"\n if dependencies == None:\n dependencies = []\n\n for dependency in self.dependencies:\n # Check for None, corresponding to the root node.\n if dependency.ref != None and dependency.ref not in dependencies:\n dependencies.append(dependency.ref)\n\n return dependencies", "metadata": "root.DependencyGraphNode.DirectDependencies", "header": "['class', 'DependencyGraphNode', '(', 'object', ')', ':', '___EOS___']", "index": 1599 }, { "content": " def _AddImportedDependencies(self, targets, dependencies=None):\n \"\"\"Given a list of direct dependencies, adds indirect dependencies that\n other dependencies have declared to export their settings.\n\n This method does not operate on self. Rather, it operates on the list\n of dependencies in the |dependencies| argument. For each dependency in\n that list, if any declares that it exports the settings of one of its\n own dependencies, those dependencies whose settings are \"passed through\"\n are added to the list. As new items are added to the list, they too will\n be processed, so it is possible to import settings through multiple levels\n of dependencies.\n\n This method is not terribly useful on its own, it depends on being\n \"primed\" with a list of direct dependencies such as one provided by\n DirectDependencies. DirectAndImportedDependencies is intended to be the\n public entry point.\n \"\"\"\n\n if dependencies == None:\n dependencies = []\n\n index = 0\n while index < len(dependencies):\n dependency = dependencies[index]\n dependency_dict = targets[dependency]\n # Add any dependencies whose settings should be imported to the list\n # if not already present. Newly-added items will be checked for\n # their own imports when the list iteration reaches them.\n # Rather than simply appending new items, insert them after the\n # dependency that exported them. This is done to more closely match\n # the depth-first method used by DeepDependencies.\n add_index = 1\n for imported_dependency in \\\n dependency_dict.get('export_dependent_settings', []):\n if imported_dependency not in dependencies:\n dependencies.insert(index + add_index, imported_dependency)\n add_index = add_index + 1\n index = index + 1\n\n return dependencies", "metadata": "root.DependencyGraphNode._AddImportedDependencies", "header": "['class', 'DependencyGraphNode', '(', 'object', ')', ':', '___EOS___']", "index": 1611 } ]
[ { "span": "included == None:", "start_line": 161, "start_column": 5, "end_line": 161, "end_column": 21 }, { "span": "result == None:", "start_line": 1060, "start_column": 7, "end_line": 1060, "end_column": 21 }, { "span": "dependencies == None:", "start_line": 1601, "start_column": 7, "end_line": 1601, "end_column": 27 }, { "span": "dependencies == None:", "start_line": 1629, "start_column": 7, "end_line": 1629, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Get", "Include", "d", "Build", "Files_", "(_", "build", "\\u", "file", "\\u", "path_", ",_", "aux", "\\u", "data_", ",_", "included_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "all", " ", "build", " ", "files", " ", "include", "d", " ", "int", "o", " ", "build", "\\u", "file", "\\u", "path", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "return", "ed", " ", "list", " ", "will", " ", "contain", " ", "build", "\\u", "file", "\\u", "path", " ", "as", " ", "well", " ", "as", " ", "all", " ", "other", " ", "files", "\\", "10", ";", " ", " ", "tha", "t", " ", "it", " ", "include", "d", ",", " ", "eit", "her", " ", "direct", "ly", " ", "or", " ", "indirect", "ly", ".", " ", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "list", " ", "may", "\\", "10", ";", " ", " ", "contain", " ", "files", " ", "tha", "t", " ", "wer", "e", " ", "include", "d", " ", "int", "o", " ", "a", " ", "conditional", " ", "section", " ", "tha", "t", " ", "evaluate", "d", "\\", "10", ";", " ", " ", "to", " ", "fal", "se", " ", "and", " ", "was", " ", "not", " ", "merge", "d", " ", "int", "o", " ", "build", "\\u", "file", "\\u", "path", "'", "s", " ", "dict", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "aux", "\\u", "data", " ", "is", " ", "a", " ", "dict", " ", "contain", "ing", " ", "a", " ", "key", " ", "for", " ", "each", " ", "build", " ", "file", " ", "or", " ", "include", "d", " ", "build", "\\", "10", ";", " ", " ", "file", ".", " ", " ", "Tho", "se", " ", "keys", " ", "provide", " ", "access", " ", "to", " ", "dict", "s", " ", "who", "se", " ", "\"", "include", "d", "\"", " ", "keys", " ", "contain", "\\", "10", ";", " ", " ", "lists", " ", "of", " ", "all", " ", "other", " ", "files", " ", "include", "d", " ", "by", " ", "the", " ", "build", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "include", "d", " ", "shou", "ld", " ", "be", " ", "left", " ", "at", " ", "its", " ", "default", " ", "Non", "e", " ", "value", " ", "by", " ", "external", " ", "caller", "s", ".", " ", " ", "It", "\\", "10", ";", " ", " ", "is", " ", "used", " ", "for", " ", "recursion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "return", "ed", " ", "list", " ", "will", " ", "not", " ", "contain", " ", "any", " ", "duplicat", "e", " ", "entri", "es", ".", " ", " ", "Ea", "ch", " ", "build", " ", "file", "\\", "10", ";", " ", " ", "in", " ", "the", " ", "list", " ", "will", " ", "be", " ", "relative", " ", "to", " ", "the", " ", "current", " ", "director", "y", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "included_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "included_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "build", "\\u", "file", "\\u", "path_", "in_", "included_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "included_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "included_", "._", "append_", "(_", "build", "\\u", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "include", "d\\u", "build", "\\u", "file_", "in_", "aux", "\\u", "data_", "[_", "build", "\\u", "file", "\\u", "path_", "]_", "._", "get_", "(_", "'", "include", "d", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Get", "Include", "d", "Build", "Files_", "(_", "include", "d\\u", "build", "\\u", "file_", ",_", "aux", "\\u", "data_", ",_", "included_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "included_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Eval", "Condition_", "(_", "condition_", ",_", "condition", "s", "\\u", "key_", ",_", "phase_", ",_", "variables_", ",_", "build", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "dict", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "used", " ", "or", " ", "Non", "e", " ", "if", " ", "the", " ", "result", " ", "was", "\\", "10", ";", " ", " ", "tha", "t", " ", "not", "hing", " ", "shou", "ld", " ", "be", " ", "used", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "condition_", ")_", "is_", "not_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Gy", "p", "Error_", "(_", "condition", "s", "\\u", "key_", "+_", "'", " ", "must", " ", "be", " ", "a", " ", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "condition_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "possib", "le", " ", "tha", "t", " ", "condition", "[", "0", "]", " ", "won", "'", "t", " ", "work", " ", "in", " ", "whi", "ch", " ", "case", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "will", " ", "raise", " ", "its", " ", "own", " ", "Index", "Error", ".", " ", " ", "Tha", "t", "'", "s", " ", "probab", "ly", " ", "fine", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Gy", "p", "Error_", "(_", "condition", "s", "\\u", "key_", "+_", "'", " ", "'_", "+_", "condition_", "[_", "0_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "length", " ", "2", ",", " ", "not", " ", "'_", "+_", "str_", "(_", "len_", "(_", "condition_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "len_", "(_", "condition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond", "\\u", "expr_", "=_", "condition_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "true", "\\u", "dict_", "=_", "condition_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "true", "\\u", "dict_", ")_", "is_", "not_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Gy", "p", "Error_", "(_", "'{}", " ", "{}", " ", "must", " ", "be", " ", "followe", "d", " ", "by", " ", "a", " ", "dictionar", "y", ",", " ", "not", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "condition", "s", "\\u", "key_", ",_", "cond", "\\u", "expr_", ",_", "type_", "(_", "true", "\\u", "dict_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "condition_", ")_", ">_", "i_", "+_", "2_", "and_", "type_", "(_", "condition_", "[_", "i_", "+_", "2_", "]_", ")_", "is_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fal", "se", "\\u", "dict_", "=_", "condition_", "[_", "i_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "i_", "+_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "!=_", "len_", "(_", "condition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Gy", "p", "Error_", "(_", "'{}", " ", "{}", " ", "has", " ", "{}", " ", "unexpected", " ", "trail", "ing", " ", "items", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "condition", "s", "\\u", "key_", ",_", "cond", "\\u", "expr_", ",_", "len_", "(_", "condition_", ")_", "-_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fal", "se", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "i_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "Eval", "Sing", "le", "Condition_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cond", "\\u", "expr_", ",_", "true", "\\u", "dict_", ",_", "fal", "se", "\\u", "dict_", ",_", "phase_", ",_", "variables_", ",_", "build", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Graph", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Direct", "Dependenc", "ies_", "(_", "self_", ",_", "dependencies_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "just", " ", "direct", " ", "dependen", "cies", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dependencies_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dependency_", "in_", "self_", "._", "dependencies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "Non", "e", ",", " ", "correspond", "ing", " ", "to", " ", "the", " ", "root", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dependency_", "._", "ref_", "!=_", "None_", "and_", "dependency_", "._", "ref_", "not_", "in_", "dependencies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "._", "append_", "(_", "dependency_", "._", "ref_", ")_", "\\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_", "dependencies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Graph", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Add", "Imported", "Dependenc", "ies_", "(_", "self_", ",_", "targets_", ",_", "dependencies_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "a", " ", "list", " ", "of", " ", "direct", " ", "dependen", "cies", ",", " ", "adds", " ", "indirect", " ", "dependen", "cies", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "dependen", "cies", " ", "have", " ", "declared", " ", "to", " ", "export", " ", "thei", "r", " ", "settings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "doe", "s", " ", "not", " ", "operate", " ", "on", " ", "self", ".", " ", " ", "Rat", "her", ",", " ", "it", " ", "operate", "s", " ", "on", " ", "the", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "dependen", "cies", " ", "in", " ", "the", " ", "|", "dependen", "cies", "|", " ", "argu", "ment", ".", " ", " ", "For", " ", "each", " ", "dependen", "cy", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "list", ",", " ", "if", " ", "any", " ", "declar", "es", " ", "tha", "t", " ", "it", " ", "export", "s", " ", "the", " ", "settings", " ", "of", " ", "one", " ", "of", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "own", " ", "dependen", "cies", ",", " ", "tho", "se", " ", "dependen", "cies", " ", "who", "se", " ", "settings", " ", "are", " ", "\"", "pass", "ed", " ", "through", "\"", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "list", ".", " ", " ", "As", " ", "new", " ", "items", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "list", ",", " ", "the", "y", " ", "too", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "process", "ed", ",", " ", "so", " ", "it", " ", "is", " ", "possib", "le", " ", "to", " ", "import", " ", "settings", " ", "through", " ", "multiple", " ", "level", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "dependen", "cies", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "not", " ", "terr", "ibl", "y", " ", "usef", "ul", " ", "on", " ", "its", " ", "own", ",", " ", "it", " ", "depend", "s", " ", "on", " ", "bei", "ng", "\\", "10", ";", " ", " ", " ", " ", "\"", "prim", "ed", "\"", " ", "with", " ", "a", " ", "list", " ", "of", " ", "direct", " ", "dependen", "cies", " ", "suc", "h", " ", "as", " ", "one", " ", "provided", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "Direct", "Dependenc", "ies", ".", " ", " ", "Direct", "And", "Imported", "Dependenc", "ies", " ", "is", " ", "inten", "ded", " ", "to", " ", "be", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "entry", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dependencies_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "index_", "<_", "len_", "(_", "dependencies_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependency_", "=_", "dependencies_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependen", "cy", "\\u", "dict_", "=_", "targets_", "[_", "dependency_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "dependen", "cies", " ", "who", "se", " ", "settings", " ", "shou", "ld", " ", "be", " ", "import", "ed", " ", "to", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "alr", "ead", "y", " ", "presen", "t", ".", " ", " ", "New", "ly", "-", "adde", "d", " ", "items", " ", "will", " ", "be", " ", "checke", "d", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thei", "r", " ", "own", " ", "import", "s", " ", "whe", "n", " ", "the", " ", "list", " ", "iterati", "on", " ", "reache", "s", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rat", "her", " ", "than", " ", "simp", "ly", " ", "appendi", "ng", " ", "new", " ", "items", ",", " ", "insert", " ", "them", " ", "after", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dependen", "cy", " ", "tha", "t", " ", "exported", " ", "them", ".", " ", " ", "Thi", "s", " ", "is", " ", "don", "e", " ", "to", " ", "more", " ", "close", "ly", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "depth", "-", "first", " ", "method", " ", "used", " ", "by", " ", "De", "ep", "Dependenc", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "index_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "import", "ed", "\\u", "dependency_", "in_", "dependen", "cy", "\\u", "dict_", "._", "get_", "(_", "'", "export", "\\u", "dependent", "\\u", "settings", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "import", "ed", "\\u", "dependency_", "not_", "in_", "dependencies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "._", "insert_", "(_", "index_", "+_", "add", "\\u", "index_", ",_", "import", "ed", "\\u", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "index_", "=_", "add", "\\u", "index_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
OpenMDAO/OpenMDAO/openmdao/core/component.py
[ { "content": "\"\"\" Defines the base class for a Component in OpenMDAO.\"\"\"\nfrom __future__ import print_function\n\nimport sys\nimport os\nimport re\nimport warnings\n\nfrom collections import OrderedDict\nfrom itertools import chain\nfrom six import iteritems, itervalues, iterkeys\n\nimport numpy as np\n\nfrom openmdao.core.basic_impl import BasicImpl\nfrom openmdao.core.system import System\nfrom openmdao.core.mpi_wrap import MPI\nfrom openmdao.core.vec_wrapper import _ByObjWrapper\nfrom openmdao.core.vec_wrapper_complex_step import ComplexStepSrcVecWrapper, \\\n ComplexStepTgtVecWrapper\nfrom openmdao.core.fileref import FileRef\nfrom openmdao.util.type_util import is_differentiable\n\n# Object to represent default value for `add_output`.\n_NotSet = object()\n\n# regex to check for valid variable names.\nnamecheck_rgx = re.compile(\n '([_a-zA-Z][_a-zA-Z0-9]*)+(\\:[_a-zA-Z][_a-zA-Z0-9]*)*')\n\ntrace = os.environ.get('OPENMDAO_TRACE')\nif trace:\n from openmdao.core.mpi_wrap import debug\n\nempty_arr = np.zeros(0)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Component(System):\n \"\"\" Base class for a Component system. The Component can declare\n variables and operates on its params to produce unknowns, which can be\n explicit outputs or implicit states.\n\n Options\n -------\n fd_options['force_fd'] : bool(False)\n Set to True to finite difference this system.\n fd_options['form'] : str('forward')\n Finite difference mode. (forward, backward, central) You can also set to 'complex_step' to peform the complex step method if your components support it.\n fd_options['step_size'] : float(1e-06)\n Default finite difference stepsize\n fd_options['step_type'] : str('absolute')\n Set to absolute, relative\n fd_options['extra_check_partials_form'] : None or str\n Finite difference mode: (\"forward\", \"backward\", \"central\", \"complex_step\")\n During check_partial_derivatives, you can optionally do a\n second finite difference with a different mode.\n fd_options['linearize'] : bool(False)\n Set to True if you want linearize to be called even though you are using FD.\n \"\"\"\n\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.Component", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def __init__(self):\n super(Component, self).__init__()\n self._post_setup_vars = False\n self._jacobian_cache = {}\n\n self._init_params_dict = OrderedDict() # for storage of initial var data\n self._init_unknowns_dict = OrderedDict() # for storage of initial var data\n\n # keep a list of nondifferentiable vars without user set 'pass_by_obj'\n # metadata for use later in check_setup\n self._pbo_warns = []\n self._run_apply = False", "metadata": "root.Component.__init__", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 60 }, { "content": " def _get_initial_val(self, val, shape):\n \"\"\" Determines initial value based on starting val and shape.\"\"\"\n if val is _NotSet:\n # Interpret a shape of 1 to mean scalar.\n if shape == 1:\n return 0.\n return np.zeros(shape)\n return val", "metadata": "root.Component._get_initial_val", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 73 }, { "content": " def _check_val(self, name, var_type, val, shape):\n \"\"\" Raises and exception if the user doesn't specify the right info\n in val and shape.\"\"\"\n if val is _NotSet and shape is None:\n msg = (\"Shape of {var_type} '{name}' must be specified because \"\n \"'val' is not set\")\n msg = msg.format(var_type=var_type, name=name)\n raise ValueError(msg)", "metadata": "root.Component._check_val", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 82 }, { "content": " def _add_variable(self, name, val, **kwargs):\n \"\"\" Contruct metadata for new variable.\n\n Args\n ----\n name : string\n Name of the variable.\n\n val : float or ndarray or object\n Initial value for the variable.\n\n **kwargs\n Arbitrary keyword arguments to be added to metadata.\n\n Raises\n ------\n RuntimeError\n If name is already in use or if setup has already been performed.\n\n NameError\n If name is not valid.\n\n ValueError\n If a valid value or shape is not specified.\n \"\"\"\n shape = kwargs.get('shape')\n self._check_varname(name)\n meta = kwargs.copy()\n\n if isinstance(val, FileRef):\n val._set_meta(kwargs)\n\n meta['val'] = val = self._get_initial_val(val, shape)\n\n if is_differentiable(val) and not meta.get('pass_by_obj'):\n if isinstance(val, np.ndarray):\n meta['size'] = val.size\n meta['shape'] = val.shape\n else:\n meta['size'] = 1\n meta['shape'] = 1\n else:\n if not meta.get('pass_by_obj'):\n self._pbo_warns.append((name, val))\n\n meta['size'] = 0\n meta['pass_by_obj'] = True\n\n if isinstance(shape, int) and shape > 1:\n meta['shape'] = (shape,)\n\n return meta", "metadata": "root.Component._add_variable", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 91 }, { "content": " def add_param(self, name, val=_NotSet, **kwargs):\n \"\"\" Add a `param` input to this component.\n\n Args\n ----\n name : string\n Name of the input.\n\n val : float or ndarray or object\n Initial value for the input.\n \"\"\"\n self._init_params_dict[name] = self._add_variable(name, val, **kwargs)", "metadata": "root.Component.add_param", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 144 }, { "content": " def add_output(self, name, val=_NotSet, **kwargs):\n \"\"\" Add an output to this component.\n\n Args\n ----\n name : string\n Name of the variable output.\n\n val : float or ndarray or object\n Initial value for the output. While the value is overwritten during\n execution, it is useful for infering size.\n \"\"\"\n shape = kwargs.get('shape')\n self._check_val(name, 'output', val, shape)\n self._init_unknowns_dict[name] = self._add_variable(name, val, **kwargs)", "metadata": "root.Component.add_output", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 157 }, { "content": " def add_state(self, name, val=_NotSet, **kwargs):\n \"\"\" Add an implicit state to this component.\n\n Args\n ----\n name : string\n Name of the state.\n\n val : float or ndarray\n Initial value for the state.\n \"\"\"\n shape = kwargs.get('shape')\n self._check_val(name, 'state', val, shape)\n args = self._add_variable(name, val, **kwargs)\n args['state'] = True\n self._init_unknowns_dict[name] = args\n self._run_apply = True", "metadata": "root.Component.add_state", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 173 }, { "content": " def set_var_indices(self, name, val=_NotSet, shape=None,\n src_indices=None):\n \"\"\" Sets the 'src_indices' metadata of an existing variable\n on this component, as well as its value, size, shape, and\n global size.\n\n This only works for numpy array variables.\n\n Args\n ----\n name : string\n Name of the variable.\n\n val : ndarray, optional\n Initial value for the variable.\n\n shape : tuple, optional\n Specifies the shape of the ndarray value\n\n src_indices : array of indices\n An index array indicating which entries in the distributed\n version of this variable are present in this process.\n\n \"\"\"\n meta = self._init_params_dict.get(name)\n if meta is None:\n meta = self._init_unknowns_dict[name]\n\n if src_indices is None:\n raise ValueError(\"You must provide src_indices for variable '%s'\" %\n name)\n\n if not isinstance(meta['val'], np.ndarray):\n raise ValueError(\"resize_var() can only be called for numpy \"\n \"array variables, but '%s' is of type %s\" %\n (name, type(meta['val'])))\n\n if val is _NotSet:\n if shape:\n val = np.zeros(shape, dtype=meta['val'].dtype)\n else:\n # assume value is a 1-D array\n val = np.zeros((len(src_indices),), dtype=meta['val'].dtype)\n\n if val.size != len(src_indices):\n raise ValueError(\"The size (%d) of the array '%s' doesn't match the \"\n \"size (%d) of the specified indices.\" %\n (val.size, name, len(src_indices)))\n meta['val'] = val\n meta['shape'] = val.shape\n meta['size'] = val.size\n meta['src_indices'] = src_indices", "metadata": "root.Component.set_var_indices", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 191 }, { "content": " def _check_varname(self, name):\n \"\"\" Verifies that a variable name is valid. Also checks for\n duplicates.\"\"\"\n if self._post_setup_vars:\n raise RuntimeError(\"%s: can't add variable '%s' because setup has already been called.\" %\n (self.pathname, name))\n if name in self._init_params_dict or name in self._init_unknowns_dict:\n raise RuntimeError(\"%s: variable '%s' already exists.\" %\n (self.pathname, name))\n\n match = namecheck_rgx.match(name)\n if match is None or match.group() != name:\n raise NameError(\"%s: '%s' is not a valid variable name.\" %\n (self.pathname, name))", "metadata": "root.Component._check_varname", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 244 }, { "content": " def setup_distrib(self):\n \"\"\"\n Override this in your Component to set specific indices that will be\n pulled from source variables to fill your parameters. This method\n should set the 'src_indices' metadata for any parameters or\n unknowns that require it.\n \"\"\"\n pass", "metadata": "root.Component.setup_distrib", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 259 }, { "content": " def _get_fd_params(self):\n \"\"\"\n Get the list of parameters that are needed to perform a\n finite difference on this `Component`.\n\n Returns\n -------\n list of str\n List of names of params for this `Component` .\n \"\"\"\n if self._fd_params is None:\n self._fd_params = [k for k, acc in iteritems(self.params._dat)\n if not acc.pbo]\n return self._fd_params", "metadata": "root.Component._get_fd_params", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 268 }, { "content": " def _get_fd_unknowns(self):\n \"\"\"\n Get the list of unknowns that are needed to perform a\n finite difference on this `Group`.\n\n Returns\n -------\n list of str\n List of names of unknowns for this `Component`.\n \"\"\"\n return [k for k, acc in iteritems(self.unknowns._dat)\n if not acc.pbo]", "metadata": "root.Component._get_fd_unknowns", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 283 }, { "content": " def _setup_variables(self, compute_indices=False):\n \"\"\"\n Returns copies of our params and unknowns dictionaries,\n re-keyed to use absolute variable names.\n\n Args\n ----\n\n compute_indices : bool, optional\n If True, call setup_distrib() to set values of\n 'src_indices' metadata.\n\n \"\"\"\n to_prom_name = self._sysdata.to_prom_name = {}\n to_abs_uname = self._sysdata.to_abs_uname = {}\n to_abs_pnames = self._sysdata.to_abs_pnames = OrderedDict()\n to_prom_uname = self._sysdata.to_prom_uname = OrderedDict()\n to_prom_pname = self._sysdata.to_prom_pname = OrderedDict()\n\n if MPI and compute_indices and self.is_active():\n if hasattr(self, 'setup_distrib_idxs'):\n warnings.simplefilter('always', DeprecationWarning)\n warnings.warn(\"setup_distrib_idxs is deprecated, use setup_distrib instead.\",\n DeprecationWarning,stacklevel=2)\n warnings.simplefilter('ignore', DeprecationWarning)\n\n self.setup_distrib_idxs()\n else:\n self.setup_distrib()\n # now update our distrib_size metadata for any distributed\n # unknowns\n sizes = []\n names = []\n for name, meta in iteritems(self._init_unknowns_dict):\n if 'src_indices' in meta:\n sizes.append(len(meta['src_indices']))\n names.append(name)\n if sizes:\n if trace: # pragma: no cover\n debug(\"allgathering src index sizes:\")\n allsizes = np.zeros((self.comm.size, len(sizes)), dtype=int)\n self.comm.Allgather(np.array(sizes, dtype=int), allsizes)\n for i, name in enumerate(names):\n self._init_unknowns_dict[name]['distrib_size'] = np.sum(allsizes[:, i])\n\n # key with absolute path names and add promoted names\n self._params_dict = OrderedDict()\n for name, meta in iteritems(self._init_params_dict):\n pathname = self._get_var_pathname(name)\n self._params_dict [pathname] = meta\n meta['pathname'] = pathname\n to_prom_pname[pathname] = name\n to_abs_pnames[name] = (pathname,)\n\n self._unknowns_dict = OrderedDict()\n for name, meta in iteritems(self._init_unknowns_dict):\n pathname = self._get_var_pathname(name)\n self._unknowns_dict[pathname] = meta\n meta['pathname'] = pathname\n to_prom_uname[pathname] = name\n to_abs_uname[name] = pathname\n\n to_prom_name.update(to_prom_uname)\n to_prom_name.update(to_prom_pname)\n\n self._post_setup_vars = True\n\n self._sysdata._params_dict = self._params_dict\n self._sysdata._unknowns_dict = self._unknowns_dict\n\n return self._params_dict, self._unknowns_dict", "metadata": "root.Component._setup_variables", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 296 }, { "content": " def _setup_communicators(self, comm, parent_dir):\n \"\"\"\n Assign communicator to this `Component`.\n\n Args\n ----\n comm : an MPI communicator (real or fake)\n The communicator being offered by the parent system.\n\n parent_dir : str\n The absolute directory of the parent, or '' if unspecified. Used to\n determine the absolute directory of all FileRefs.\n\n \"\"\"\n super(Component, self)._setup_communicators(comm, parent_dir)\n\n # set absolute directories of any FileRefs\n for meta in chain(itervalues(self._init_unknowns_dict),\n itervalues(self._init_params_dict)):\n val = meta['val']\n #if var is a FileRef, set its absolute directory\n if isinstance(val, FileRef):\n self._fileref_setup(val)\n\n if not self.is_active():\n for meta in itervalues(self._init_params_dict):\n meta['remote'] = True\n for meta in itervalues(self._init_unknowns_dict):\n meta['remote'] = True", "metadata": "root.Component._setup_communicators", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 368 }, { "content": " def _fileref_setup(self, fref):\n fref.parent_dir = self._sysdata.absdir\n d = fref._abspath()\n if self.is_active() and not os.path.exists(os.path.dirname(d)):\n if self.create_dirs:\n os.makedirs(os.path.dirname(d))\n else:\n raise RuntimeError(\"directory '%s' doesn't exist \"\n \"for FileRef('%s'). Set create_dirs=True \"\n \"in system '%s' to create the directory \"\n \"automatically.\" %\n (os.path.dirname(d),\n fref.fname, self.pathname))", "metadata": "root.Component._fileref_setup", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 398 }, { "content": " def _setup_vectors(self, param_owners, parent,\n top_unknowns=None, impl=None, alloc_derivs=True):\n \"\"\"\n Set up local `VecWrappers` to store this component's variables.\n\n Args\n ----\n param_owners : dict\n a dictionary mapping `System` pathnames to the pathnames of\n parameters they are reponsible for propagating. (ignored)\n\n parent : `Group`\n The parent `Group`.\n\n top_unknowns : `VecWrapper`, optional\n the `Problem` level unknowns `VecWrapper`\n\n impl : an implementation factory, optional\n Specifies the factory object used to create `VecWrapper` objects.\n\n alloc_derivs : bool(True)\n If True, allocate the derivative vectors.\n \"\"\"\n self.params = self.unknowns = self.resids = None\n self.dumat, self.dpmat, self.drmat = OrderedDict(), OrderedDict(), OrderedDict()\n self.connections = self._probdata.connections\n\n relevance = self._probdata.relevance\n\n if not self.is_active():\n return\n\n self._setup_prom_map()\n\n self._impl = impl\n\n # create map of relative name in parent to relative name in child\n self._relname_map = self._get_relname_map(parent._sysdata.to_prom_name)\n\n # at the Group level, we create a set of arrays for each variable of\n # interest, and we make them all subviews of the same shared array in\n # order to conserve memory. Components don't actually own their params,\n # so we just use an empty shared array for dp (with an offset of 0)\n self._shared_dp_vec = empty_arr\n self._shared_p_offsets = { None:0 }\n for vois in chain(relevance.inputs, relevance.outputs):\n for voi in vois:\n self._shared_p_offsets[voi] = 0\n\n # we don't get non-deriv vecs (u, p, r) unless we have a None group,\n # so force their creation here\n self._create_views(top_unknowns, parent, [], None)\n\n all_vois = set([None])\n if self._probdata.top_lin_gs: # only need voi vecs for lings\n # create storage for the relevant vecwrappers, keyed by\n # variable_of_interest\n for vois in relevance.groups:\n all_vois.update(vois)\n for voi in vois:\n self._create_views(top_unknowns, parent, [], voi)\n\n # create params vec entries for any unconnected params\n for meta in itervalues(self._params_dict):\n pathname = meta['pathname']\n name = self._sysdata._scoped_abs_name(pathname)\n if name not in self.params:\n self.params._add_unconnected_var(pathname, meta)", "metadata": "root.Component._setup_vectors", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 412 }, { "content": " def apply_nonlinear(self, params, unknowns, resids):\n \"\"\"\n Evaluates the residuals for this component. For explicit\n components, the residual is the output produced by the current params\n minus the previously calculated output. Thus, an explicit component\n must execute its solve nonlinear method. Implicit components should\n override this and calculate their residuals in place.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs and states. (u)\n\n resids : `VecWrapper`\n `VecWrapper` containing residuals. (r)\n \"\"\"\n\n # Note, we solve a slightly modified version of the unified\n # derivatives equations in OpenMDAO.\n # (dR/du) * (du/dr) = -I\n # The minus side on the right hand side comes from defining the\n # explicit residual to be ynew - yold instead of yold - ynew. The\n # advantage of this is that the derivative of an explicit residual is\n # the same sign as the derivative of the explicit unknown.\n\n # Since explicit comps don't put anything in resids, we can use it to\n # cache the old values of the unknowns.\n resids.vec[:] = -unknowns.vec\n\n self.solve_nonlinear(params, unknowns, resids)\n\n # Unknowns are restored to the old values too. apply_nonlinear does\n # not change the output vector.\n resids.vec[:] += unknowns.vec\n unknowns.vec[:] -= resids.vec", "metadata": "root.Component.apply_nonlinear", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 481 }, { "content": " def solve_nonlinear(self, params, unknowns, resids):\n \"\"\"\n Runs the component. The user is required to define this function in\n all components.\n\n Args\n ----\n params : `VecWrapper`, optional\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`, optional\n `VecWrapper` containing outputs and states. (u)\n\n resids : `VecWrapper`, optional\n `VecWrapper` containing residuals. (r)\n \"\"\"\n\n msg = \"Class '%s' does not implement 'solve_nonlinear'\"\n raise NotImplementedError(msg % self.__class__.__name__)", "metadata": "root.Component.solve_nonlinear", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 520 }, { "content": " def linearize(self, params, unknowns, resids):\n \"\"\"\n Returns Jacobian. Returns None unless component overides this method\n and returns something. J should be a dictionary whose keys are tuples\n of the form ('unknown', 'param') and whose values are ndarrays.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs and states. (u)\n\n resids : `VecWrapper`\n `VecWrapper` containing residuals. (r)\n\n Returns\n -------\n dict\n Dictionary whose keys are tuples of the form ('unknown', 'param')\n and whose values are ndarrays.\n \"\"\"\n return None", "metadata": "root.Component.linearize", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 540 }, { "content": " def apply_linear(self, params, unknowns, dparams, dunknowns, dresids, mode):\n \"\"\"\n Multiplies incoming vector by the Jacobian (fwd mode) or the\n transpose Jacobian (rev mode). If the user doesn't provide this\n method, then we just multiply by the cached jacobian.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs and states. (u)\n\n dparams : `VecWrapper`\n `VecWrapper` containing either the incoming vector in forward mode\n or the outgoing result in reverse mode. (dp)\n\n dunknowns : `VecWrapper`\n In forward mode, this `VecWrapper` contains the incoming vector for\n the states. In reverse mode, it contains the outgoing vector for\n the states. (du)\n\n dresids : `VecWrapper`\n `VecWrapper` containing either the outgoing result in forward mode\n or the incoming vector in reverse mode. (dr)\n\n mode : string\n Derivative mode, can be 'fwd' or 'rev'.\n \"\"\"\n self._apply_linear_jac(params, unknowns, dparams, dunknowns, dresids,\n mode)", "metadata": "root.Component.apply_linear", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 565 }, { "content": " def solve_linear(self, dumat, drmat, vois, mode=None):\n \"\"\"\n Single linear solution applied to whatever input is sitting in\n the rhs vector.\n\n Args\n ----\n dumat : dict of `VecWrappers`\n In forward mode, each `VecWrapper` contains the incoming vector\n for the states. There is one vector per quantity of interest for\n this problem. In reverse mode, it contains the outgoing vector for\n the states. (du)\n\n drmat : `dict of VecWrappers`\n `VecWrapper` containing either the outgoing result in forward mode\n or the incoming vector in reverse mode. There is one vector per\n quantity of interest for this problem. (dr)\n\n vois : list of strings\n List of all quantities of interest to key into the mats.\n\n mode : string\n Derivative mode, can be 'fwd' or 'rev', but generally should be\n called without mode so that the user can set the mode in this\n system's ln_solver.options.\n \"\"\"\n\n if mode == 'fwd':\n sol_vec, rhs_vec = self.dumat, self.drmat\n else:\n sol_vec, rhs_vec = self.drmat, self.dumat\n\n for voi in vois:\n sol_vec[voi].vec[:] = -rhs_vec[voi].vec", "metadata": "root.Component.solve_linear", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 598 }, { "content": " def dump(self, nest=0, out_stream=sys.stdout, verbose=False, dvecs=False,\n sizes=False):\n \"\"\"\n Writes a formated dump of this `Component` to file.\n\n Args\n ----\n nest : int, optional\n Starting nesting level. Defaults to 0.\n\n out_stream : an open file, optional\n Where output is written. Defaults to sys.stdout.\n\n verbose : bool, optional\n If True, output additional info beyond\n just the tree structure. Default is False.\n\n dvecs : bool, optional\n If True, show contents of du and dp vectors instead of\n u and p (the default).\n\n sizes : bool, optional\n If True, show sizes of vectors and comms. Default is False.\n \"\"\"\n klass = self.__class__.__name__\n if dvecs:\n ulabel, plabel, uvecname, pvecname = 'du', 'dp', 'dunknowns', 'dparams'\n else:\n ulabel, plabel, uvecname, pvecname = 'u', 'p', 'unknowns', 'params'\n\n uvec = getattr(self, uvecname)\n pvec = getattr(self, pvecname)\n\n template = \"%s %s '%s'\"\n out_stream.write(template % (\" \"*nest, klass, self.name))\n\n if sizes:\n commsz = self.comm.size if hasattr(self.comm, 'size') else 0\n template = \" req: %s usize:%d psize:%d commsize:%d\"\n out_stream.write(template % (self.get_req_procs(),\n uvec.vec.size,\n pvec.vec.size,\n commsz))\n out_stream.write(\"\\n\")\n\n if verbose: # pragma: no cover\n lens = [len(n) for n in uvec]\n nwid = max(lens) if lens else 12\n\n for v in uvec:\n if v in uvec._dat and uvec._dat[v].slice is not None:\n uslice = '{0}[{1[0]}:{1[1]}]'.format(ulabel,\n uvec._dat[v].slice)\n tem = \"{0}{1:<{nwid}} {2:<21} {3:>10}\\n\"\n out_stream.write(tem.format(\" \"*(nest+8), v, uslice,\n repr(uvec[v]), nwid=nwid))\n elif not dvecs: # deriv vecs don't have passing by obj\n tem = \"{0}{1:<{nwid}} (by_obj) ({2})\\n\"\n out_stream.write(tem.format(\" \"*(nest+8), v, repr(uvec[v]),\n nwid=nwid))\n\n out_stream.flush()", "metadata": "root.Component.dump", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 633 }, { "content": " def _get_relname_map(self, parent_proms):\n \"\"\"\n Args\n ----\n parent_proms : `dict`\n A dict mapping absolute names to promoted names in the parent\n system.\n\n Returns\n -------\n dict\n Maps promoted name in parent (owner of unknowns) to\n the corresponding promoted name in the child.\n \"\"\"\n # unknowns_dict is keyed on absolute pathname\n\n # use an ordered dict here so we can use this smaller dict when looping\n # during get_view.\n # (the order of this one matches the order in the parent)\n umap = OrderedDict()\n\n for key, meta in iteritems(self._init_unknowns_dict):\n # promoted and _init_unknowns_dict key are same\n umap[parent_proms['.'.join((self.pathname, key))]] = key\n\n return umap", "metadata": "root.Component._get_relname_map", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 696 }, { "content": " def complex_step_jacobian(self, params, unknowns, resids, total_derivs=False,\n fd_params=None, fd_states=None, fd_unknowns=None,\n poi_indices=None, qoi_indices=None):\n \"\"\" Return derivatives of all unknowns in this system w.r.t. all\n incoming params using complex step.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs and states. (u)\n\n resids : `VecWrapper`\n `VecWrapper` containing residuals. (r)\n\n total_derivs : bool, optional\n Should always be False, as componentwise derivatives only need partials.\n\n fd_params : list of strings, optional\n List of parameter name strings with respect to which derivatives\n are desired. This is used by problem to limit the derivatives that\n are taken.\n\n fd_unknowns : list of strings, optional\n List of output or state name strings for derivatives to be\n calculated. This is used by problem to limit the derivatives that\n are taken.\n\n fd_states : list of strings, optional\n List of state name strings for derivatives to be taken with respect to.\n This is used by problem to limit the derivatives that are taken.\n\n poi_indices: dict of list of integers, optional\n Should be an empty list, as there is no subcomponent relevance reduction.\n\n qoi_indices: dict of list of integers, optional\n Should be an empty list, as there is no subcomponent relevance reduction.\n\n Returns\n -------\n dict\n Dictionary whose keys are tuples of the form ('unknown', 'param')\n and whose values are ndarrays containing the derivative for that\n tuple pair.\n \"\"\"\n\n # Params and Unknowns that we provide at this level.\n if fd_params is None:\n fd_params = self._get_fd_params()\n if fd_unknowns is None:\n fd_unknowns = self._get_fd_unknowns()\n\n # Use settings in the system dict unless variables override.\n step_size = self.fd_options.get('step_size', 1.0e-6)\n\n jac = {}\n csparams = ComplexStepTgtVecWrapper(params)\n csunknowns = ComplexStepSrcVecWrapper(unknowns)\n csresids = ComplexStepSrcVecWrapper(resids)\n\n # Pull result from resids only if comp overrides apply_nonlinear\n states = self.states\n if len(states) > 0:\n resultvec = csresids\n else:\n resultvec = csunknowns\n\n # Manual override of states.\n if fd_states is not None:\n states = fd_states\n\n # Compute gradient for this param or state.\n for p_name in chain(fd_params, states):\n\n\n # States are stepped in unknowns, not params\n if p_name in states:\n stepvec = csunknowns\n target_input = unknowns._dat[p_name].val\n else:\n stepvec = csparams\n target_input = params._dat[p_name].val\n\n stepvec.set_complex_var(p_name)\n\n # promoted names and _init_params_dict keys are same\n mydict = self._init_params_dict.get(p_name, {})\n\n # Local settings for this var trump all\n fdstep = mydict.get('step_size', step_size)\n\n # Size our Inputs\n p_size = np.size(target_input)\n p_idxs = range(p_size)\n\n # Size our Outputs\n for u_name in fd_unknowns:\n u_size = np.size(unknowns[u_name])\n jac[u_name, p_name] = np.zeros((u_size, p_size))\n\n # apply Complex Step on each index in array\n for j, idx in enumerate(p_idxs):\n\n stepvec.step_complex(idx, fdstep)\n self.apply_nonlinear(csparams, csunknowns, csresids)\n\n stepvec.step_complex(idx, -fdstep)\n\n for u_name in fd_unknowns:\n result = resultvec.flat(u_name)\n jac[u_name, p_name][:, j] = result.imag/fdstep\n\n # Need to clear this out because our next input might be a\n # different vector (state vs param)\n stepvec.set_complex_var(None)\n\n return jac", "metadata": "root.Component.complex_step_jacobian", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 723 }, { "content": " def alloc_jacobian(self):\n \"\"\"\n Creates a jacobian dictionary with the keys pre-populated and correct\n array sizes allocated. caches the result in the component, and\n returns that cache if it finds it.\n\n Returns\n -----------\n dict\n pre-allocated jacobian dictionary\n \"\"\"\n\n if self._jacobian_cache is not None and len(self._jacobian_cache) > 0:\n return self._jacobian_cache\n\n self._jacobian_cache = jac = {}\n\n u_vec = self.unknowns\n p_vec = self.params\n states = self.states\n\n # Caching while caching\n p_size_storage = [(n, m['size']) for n,m in iteritems(p_vec)\n if not m.get('pass_by_obj') and not m.get('remote')]\n\n s_size_storage = []\n u_size_storage = []\n for n, meta in iteritems(u_vec):\n if meta.get('pass_by_obj') or meta.get('remote'):\n continue\n if meta.get('state'):\n s_size_storage.append((n, meta['size']))\n u_size_storage.append((n, meta['size']))\n\n for u_var, u_size in u_size_storage:\n for p_var, p_size in p_size_storage:\n jac[u_var, p_var] = np.zeros((u_size, p_size))\n\n for s_var, s_size in s_size_storage:\n jac[u_var, s_var] = np.zeros((u_size, s_size))\n\n return jac", "metadata": "root.Component.alloc_jacobian", "header": "['class', 'Component', '(', 'System', ')', ':', '___EOS___']", "index": 843 } ]
[ { "span": "from six import iteritems, itervalues, iterkeys", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 47 }, { "span": "from openmdao.core.basic_impl import BasicImpl", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 46 }, { "span": "from openmdao.core.vec_wrapper import _ByObjWrapper", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "Define", "s", " ", "the", " ", "base", " ", "class", " ", "for", " ", "a", " ", "Compo", "nent", " ", "in", " ", "Open", "MD", "AO", ".\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "import_", "iteritems_", ",_", "itervalues_", ",_", "iterkeys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "core_", "._", "basic", "\\u", "impl_", "import_", "Basic", "Impl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "core_", "._", "system_", "import_", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "core_", "._", "mpi", "\\u", "wrap_", "import_", "MPI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "core_", "._", "vec", "\\u", "wrapper_", "import_", "\\u", "By", "Obj", "Wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "core_", "._", "vec", "\\u", "wrapp", "er", "\\u", "complex", "\\u", "step_", "import_", "Comple", "x", "Step", "Sr", "c", "Vec", "Wrapper_", ",_", "Comple", "x", "Step", "Tg", "t", "Vec", "Wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "core_", "._", "filer", "ef_", "import_", "File", "Ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "util_", "._", "type", "\\u", "util_", "import_", "is", "\\u", "different", "iable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Object", " ", "to", " ", "represent", " ", "default", " ", "value", " ", "for", " ", "`", "add", "\\u", "output", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Not", "Set_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regex", " ", "to", " ", "check", " ", "for", " ", "valid", " ", "variab", "le", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "name", "check", "\\u", "rg", "x_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'([\\", "ua", "-", "z", "A", "-", "Z", "][\\", "ua", "-", "z", "A", "-", "Z", "0", "-", "9", "]*)", "+(", "\\\\:", "[\\u", "a", "-", "z", "A", "-", "Z", "][\\", "ua", "-", "z", "A", "-", "Z", "0", "-", "9", "]*)", "*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trace_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OPEN", "MD", "AO", "\\u", "TRACE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "trace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "openm", "dao_", "._", "core_", "._", "mpi", "\\u", "wrap_", "import_", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "empty", "\\u", "arr_", "=_", "np_", "._", "zeros_", "(_", "0_", ")_", "\\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_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Base", " ", "class", " ", "for", " ", "a", " ", "Compo", "nent", " ", "system", ".", " ", "The", " ", "Compo", "nent", " ", "can", " ", "declar", "e", "\\", "10", ";", " ", " ", " ", " ", "variab", "les", " ", "and", " ", "operate", "s", " ", "on", " ", "its", " ", "params", " ", "to", " ", "produce", " ", "unknown", "s", ",", " ", "whi", "ch", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "explicit", " ", "output", "s", " ", "or", " ", "implicit", " ", "state", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Optio", "ns", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "options", "['", "force", "\\u", "fd", "']", " ", ":", " ", " ", "bool", "(", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "to", " ", "Tru", "e", " ", "to", " ", "finite", " ", "difference", " ", "this", " ", "system", ".", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "options", "['", "form", "']", " ", ":", " ", " ", "str", "('", "forward", "')", "\\", "10", ";", " ", " ", " ", " ", "Fini", "te", " ", "difference", " ", "mode", ".", " ", "(", "forward", ",", " ", "back", "ward", ",", " ", "central", ")", " ", "You", " ", "can", " ", "als", "o", " ", "set", " ", "to", " ", "'", "complex", "\\u", "step", "'", " ", "to", " ", "pe", "form", " ", "the", " ", "complex", " ", "step", " ", "method", " ", "if", " ", "your", " ", "component", "s", " ", "support", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "options", "['", "step", "\\u", "size", "']", " ", ":", " ", " ", "float", "(", "1e-0", "6", ")", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "finite", " ", "difference", " ", "stepsize", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "options", "['", "step", "\\u", "type", "']", " ", ":", " ", " ", "str", "('", "abs", "olute", "')", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "to", " ", "abs", "olute", ",", " ", "relative", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "options", "['", "extra", "\\u", "check", "\\u", "partial", "s", "\\u", "form", "']", " ", ":", " ", " ", "Non", "e", " ", "or", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Fini", "te", " ", "difference", " ", "mode", ":", " ", "(\"", "forward", "\",", " ", "\"", "back", "ward", "\",", " ", "\"", "central", "\",", " ", "\"", "complex", "\\u", "step", "\")", "\\", "10", ";", " ", " ", " ", " ", "Dur", "ing", " ", "check", "\\u", "partial", "\\u", "derivatives", ",", " ", "you", " ", "can", " ", "option", "ally", " ", "do", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "second", " ", "finite", " ", "difference", " ", "with", " ", "a", " ", "different", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "options", "['", "linear", "ize", "']", " ", ":", " ", "bool", "(", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "to", " ", "Tru", "e", " ", "if", " ", "you", " ", "want", " ", "linear", "ize", " ", "to", " ", "be", " ", "call", "ed", " ", "even", " ", "tho", "ugh", " ", "you", " ", "are", " ", "usi", "ng", " ", "FD", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Component_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "post", "\\u", "setup", "\\u", "vars_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "jacobian", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", "=_", "Order", "ed", "Dict_", "(_", ")_", "#", " ", "for", " ", "storage", " ", "of", " ", "initial", " ", "var", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", "=_", "Order", "ed", "Dict_", "(_", ")_", "#", " ", "for", " ", "storage", " ", "of", " ", "initial", " ", "var", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keep", " ", "a", " ", "list", " ", "of", " ", "nond", "iff", "eren", "tia", "ble", " ", "vars", " ", "with", "out", " ", "user", " ", "set", " ", "'", "pass", "\\u", "by", "\\u", "obj", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "metadata", " ", "for", " ", "use", " ", "late", "r", " ", "in", " ", "check", "\\u", "setup_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "pbo", "\\u", "warns", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "apply_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "initial", "\\u", "val_", "(_", "self_", ",_", "val_", ",_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Det", "erm", "ine", "s", " ", "initial", " ", "value", " ", "based", " ", "on", " ", "startin", "g", " ", "val", " ", "and", " ", "shape", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "is_", "\\u", "Not", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Interpret", " ", "a", " ", "shape", " ", "of", " ", "1", " ", "to", " ", "mean", " ", "scala", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "shape_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "zeros_", "(_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "val_", "(_", "self_", ",_", "name_", ",_", "var", "\\u", "type_", ",_", "val_", ",_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Rai", "ses", " ", "and", " ", "exception", " ", "if", " ", "the", " ", "user", " ", "doe", "sn", "'", "t", " ", "speci", "fy", " ", "the", " ", "right", " ", "info", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "val", " ", "and", " ", "shape", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "is_", "\\u", "Not", "Set_", "and_", "shape_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "(_", "\"", "Shape", " ", "of", " ", "{", "var", "\\u", "type", "}", " ", "'{", "name", "}'", " ", "must", " ", "be", " ", "specified", " ", "bec", "aus", "e", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "val", "'", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "msg_", "._", "format_", "(_", "var", "\\u", "type_", "=_", "var", "\\u", "type_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\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", "add", "\\u", "variable_", "(_", "self_", ",_", "name_", ",_", "val_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Cont", "ruct", " ", "metadata", " ", "for", " ", "new", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "val", " ", ":", " ", "float", " ", "or", " ", "ndar", "ray", " ", "or", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "value", " ", "for", " ", "the", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "kwarg", "s", "\\", "10", ";", " ", " ", " ", " ", "Arbit", "rar", "y", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "to", " ", "be", " ", "adde", "d", " ", "to", " ", "metadata", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", "\\", "10", ";", " ", " ", " ", " ", "------", "\\", "10", ";", " ", " ", " ", " ", "Run", "time", "Error", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "name", " ", "is", " ", "alr", "ead", "y", " ", "in", " ", "use", " ", "or", " ", "if", " ", "setup", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "perform", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Name", "Error", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "name", " ", "is", " ", "not", " ", "valid", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Value", "Error", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "valid", " ", "value", " ", "or", " ", "shape", " ", "is", " ", "not", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "kwargs_", "._", "get_", "(_", "'", "shape", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "varname_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "kwargs_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "val_", ",_", "File", "Ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "\\u", "set\\u", "meta_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta_", "[_", "'", "val", "'_", "]_", "=_", "val_", "=_", "self_", "._", "\\u", "get", "\\u", "initial", "\\u", "val_", "(_", "val_", ",_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "different", "iable", "_", "(_", "val_", ")_", "and_", "not_", "meta_", "._", "get_", "(_", "'", "pass", "\\u", "by", "\\u", "obj", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "val_", ",_", "np_", "._", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "[_", "'", "size", "'_", "]_", "=_", "val_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "shape", "'_", "]_", "=_", "val_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "[_", "'", "size", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "shape", "'_", "]_", "=_", "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 ", " _", "if_", "not_", "meta_", "._", "get_", "(_", "'", "pass", "\\u", "by", "\\u", "obj", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "pbo", "\\u", "warns", "_", "._", "append_", "(_", "(_", "name_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta_", "[_", "'", "size", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "pass", "\\u", "by", "\\u", "obj", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "shape_", ",_", "int_", ")_", "and_", "shape_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "[_", "'", "shape", "'_", "]_", "=_", "(_", "shape_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "param_", "(_", "self_", ",_", "name_", ",_", "val_", "=_", "\\u", "Not", "Set_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "a", " ", "`", "param", "`", " ", "input", " ", "to", " ", "this", " ", "component", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "input", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "val", " ", ":", " ", "float", " ", "or", " ", "ndar", "ray", " ", "or", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "value", " ", "for", " ", "the", " ", "input", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", "[_", "name_", "]_", "=_", "self_", "._", "\\u", "add", "\\u", "variable_", "(_", "name_", ",_", "val_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "output_", "(_", "self_", ",_", "name_", ",_", "val_", "=_", "\\u", "Not", "Set_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "an", " ", "output", " ", "to", " ", "this", " ", "component", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "variab", "le", " ", "output", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "val", " ", ":", " ", "float", " ", "or", " ", "ndar", "ray", " ", "or", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "value", " ", "for", " ", "the", " ", "output", ".", " ", "Whi", "le", " ", "the", " ", "value", " ", "is", " ", "overwrit", "ten", " ", "dur", "ing", "\\", "10", ";", " ", " ", " ", " ", "executi", "on", ",", " ", "it", " ", "is", " ", "usef", "ul", " ", "for", " ", "infer", "ing", " ", "size", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "kwargs_", "._", "get_", "(_", "'", "shape", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "val_", "(_", "name_", ",_", "'", "output", "'_", ",_", "val_", ",_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", "[_", "name_", "]_", "=_", "self_", "._", "\\u", "add", "\\u", "variable_", "(_", "name_", ",_", "val_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "state_", "(_", "self_", ",_", "name_", ",_", "val_", "=_", "\\u", "Not", "Set_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "an", " ", "implicit", " ", "state", " ", "to", " ", "this", " ", "component", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "state", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "val", " ", ":", " ", "float", " ", "or", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "value", " ", "for", " ", "the", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "kwargs_", "._", "get_", "(_", "'", "shape", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "val_", "(_", "name_", ",_", "'", "state", "'_", ",_", "val_", ",_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "self_", "._", "\\u", "add", "\\u", "variable_", "(_", "name_", ",_", "val_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "'", "state", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", "[_", "name_", "]_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "apply_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "var", "\\u", "indices_", "(_", "self_", ",_", "name_", ",_", "val_", "=_", "\\u", "Not", "Set_", ",_", "shape_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src", "\\u", "indices_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", "s", " ", "the", " ", "'", "src", "\\u", "indice", "s", "'", " ", "metadata", " ", "of", " ", "an", " ", "exist", "ing", " ", "variab", "le", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "this", " ", "component", ",", " ", "as", " ", "well", " ", "as", " ", "its", " ", "value", ",", " ", "size", ",", " ", "shape", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "size", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "only", " ", "works", " ", "for", " ", "nump", "y", " ", "array", " ", "variab", "les", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "val", " ", ":", " ", "ndar", "ray", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "value", " ", "for", " ", "the", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "shape", " ", ":", " ", "tuple", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Specifie", "s", " ", "the", " ", "shape", " ", "of", " ", "the", " ", "ndar", "ray", " ", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "src", "\\u", "indice", "s", " ", ":", " ", "array", " ", "of", " ", "indice", "s", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "index", " ", "array", " ", "indicati", "ng", " ", "whi", "ch", " ", "entri", "es", " ", "in", " ", "the", " ", "distributed", "\\", "10", ";", " ", " ", " ", " ", "version", " ", "of", " ", "this", " ", "variab", "le", " ", "are", " ", "presen", "t", " ", "in", " ", "this", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "meta_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "src", "\\u", "indices_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "You", " ", "must", " ", "provide", " ", "src", "\\u", "indice", "s", " ", "for", " ", "variab", "le", " ", "'%", "s", "'\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "meta_", "[_", "'", "val", "'_", "]_", ",_", "np_", "._", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "resiz", "e\\u", "var", "()", " ", "can", " ", "only", " ", "be", " ", "call", "ed", " ", "for", " ", "nump", "y", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "array", " ", "variab", "les", ",", " ", "but", " ", "'%", "s", "'", " ", "is", " ", "of", " ", "type", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "name_", ",_", "type_", "(_", "meta_", "[_", "'", "val", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "val_", "is_", "\\u", "Not", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "np_", "._", "zeros_", "(_", "shape_", ",_", "dtype_", "=_", "meta_", "[_", "'", "val", "'_", "]_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assume", " ", "value", " ", "is", " ", "a", " ", "1", "-", "D", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "np_", "._", "zeros_", "(_", "(_", "len_", "(_", "src", "\\u", "indices_", ")_", ",_", ")_", ",_", "dtype_", "=_", "meta_", "[_", "'", "val", "'_", "]_", "._", "dtype_", ")_", "\\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_", "val_", "._", "size_", "!=_", "len_", "(_", "src", "\\u", "indices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "size", " ", "(%", "d", ")", " ", "of", " ", "the", " ", "array", " ", "'%", "s", "'", " ", "doe", "sn", "'", "t", " ", "match", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "size", " ", "(%", "d", ")", " ", "of", " ", "the", " ", "specified", " ", "indice", "s", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "val_", "._", "size_", ",_", "name_", ",_", "len_", "(_", "src", "\\u", "indices_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta_", "[_", "'", "val", "'_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "shape", "'_", "]_", "=_", "val_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "size", "'_", "]_", "=_", "val_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "src", "\\u", "indice", "s", "'_", "]_", "=_", "src", "\\u", "indices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "varname_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Verifie", "s", " ", "tha", "t", " ", "a", " ", "variab", "le", " ", "name", " ", "is", " ", "valid", ".", " ", "Al", "so", " ", "checks", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "duplicat", "es", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "post", "\\u", "setup", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"%", "s", ":", " ", "can", "'", "t", " ", "add", " ", "variab", "le", " ", "'%", "s", "'", " ", "bec", "aus", "e", " ", "setup", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "call", "ed", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "pathname_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", "or_", "name_", "in_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"%", "s", ":", " ", "variab", "le", " ", "'%", "s", "'", " ", "alr", "ead", "y", " ", "exist", "s", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "pathname_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "name", "check", "\\u", "rg", "x_", "._", "match_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", "is_", "None_", "or_", "match_", "._", "group_", "(_", ")_", "!=_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Name", "Error_", "(_", "\"%", "s", ":", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "variab", "le", " ", "name", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "pathname_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "distri", "b_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Override", " ", "this", " ", "in", " ", "your", " ", "Compo", "nent", " ", "to", " ", "set", " ", "specific", " ", "indice", "s", " ", "tha", "t", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "pull", "ed", " ", "from", " ", "source", " ", "variab", "les", " ", "to", " ", "fill", " ", "your", " ", "parameter", "s", ".", " ", " ", "Thi", "s", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "set", " ", "the", " ", "'", "src", "\\u", "indice", "s", "'", " ", "metadata", " ", "for", " ", "any", " ", "parameter", "s", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "unknown", "s", " ", "tha", "t", " ", "require", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "fd", "\\u", "params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "list", " ", "of", " ", "parameter", "s", " ", "tha", "t", " ", "are", " ", "need", "ed", " ", "to", " ", "perform", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "finite", " ", "difference", " ", "on", " ", "this", " ", "`", "Compo", "nent", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "names", " ", "of", " ", "params", " ", "for", " ", "this", " ", "`", "Compo", "nent", "`", " ", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "fd", "\\u", "params_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "fd", "\\u", "params_", "=_", "[_", "k_", "for_", "k_", ",_", "acc_", "in_", "iteritems_", "(_", "self_", "._", "params_", "._", "\\u", "dat_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "acc_", "._", "pbo", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "fd", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "fd", "\\u", "unknown", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "list", " ", "of", " ", "unknown", "s", " ", "tha", "t", " ", "are", " ", "need", "ed", " ", "to", " ", "perform", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "finite", " ", "difference", " ", "on", " ", "this", " ", "`", "Group", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "names", " ", "of", " ", "unknown", "s", " ", "for", " ", "this", " ", "`", "Compo", "nent", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "k_", "for_", "k_", ",_", "acc_", "in_", "iteritems_", "(_", "self_", "._", "unknown", "s_", "._", "\\u", "dat_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "acc_", "._", "pbo", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "variables_", "(_", "self_", ",_", "compute", "\\u", "indices_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "copie", "s", " ", "of", " ", "our", " ", "params", " ", "and", " ", "unknown", "s", " ", "dictionar", "ies", ",", "\\", "10", ";", " ", " ", " ", " ", "re", "-", "keyed", " ", "to", " ", "use", " ", "abs", "olute", " ", "variab", "le", " ", "names", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "compute", "\\u", "indice", "s", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "call", " ", "setup", "\\u", "distri", "b", "()", " ", "to", " ", "set", " ", "values", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "'", "src", "\\u", "indice", "s", "'", " ", "metadata", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "prom", "\\u", "name_", "=_", "self_", "._", "\\u", "sys", "data_", "._", "to", "\\u", "prom", "\\u", "name_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "abs", "\\u", "uname_", "=_", "self_", "._", "\\u", "sys", "data_", "._", "to", "\\u", "abs", "\\u", "uname_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "abs", "\\u", "pn", "ames_", "=_", "self_", "._", "\\u", "sys", "data_", "._", "to", "\\u", "abs", "\\u", "pn", "ames_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "prom", "\\u", "uname_", "=_", "self_", "._", "\\u", "sys", "data_", "._", "to", "\\u", "prom", "\\u", "uname_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "prom", "\\u", "pname_", "=_", "self_", "._", "\\u", "sys", "data_", "._", "to", "\\u", "prom", "\\u", "pname_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "MPI_", "and_", "compute", "\\u", "indices_", "and_", "self_", "._", "is", "\\u", "active_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'", "setup", "\\u", "distri", "b", "\\u", "idx", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ",_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\"", "setup", "\\u", "distri", "b", "\\u", "idx", "s", " ", "is", " ", "depre", "cated", ",", " ", "use", " ", "setup", "\\u", "distri", "b", " ", "inst", "ead", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "ignore", "'_", ",_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "distri", "b", "\\u", "idxs_", "(_", ")_", "\\u\\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_", "._", "setup", "\\u", "distri", "b_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "update", " ", "our", " ", "distri", "b", "\\u", "size", " ", "metadata", " ", "for", " ", "any", " ", "distributed", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unknown", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sizes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "meta_", "in_", "iteritems_", "(_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "src", "\\u", "indice", "s", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sizes_", "._", "append_", "(_", "len_", "(_", "meta_", "[_", "'", "src", "\\u", "indice", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sizes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "trace_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "debug_", "(_", "\"", "all", "gather", "ing", " ", "src", " ", "index", " ", "size", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alls", "izes", "_", "=_", "np_", "._", "zeros_", "(_", "(_", "self_", "._", "comm_", "._", "size_", ",_", "len_", "(_", "sizes_", ")_", ")_", ",_", "dtype_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comm_", "._", "All", "gather_", "(_", "np_", "._", "array_", "(_", "sizes_", ",_", "dtype_", "=_", "int_", ")_", ",_", "alls", "izes", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "name_", "in_", "enumerate_", "(_", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", "[_", "name_", "]_", "[_", "'", "distri", "b", "\\u", "size", "'_", "]_", "=_", "np_", "._", "sum_", "(_", "alls", "izes", "_", "[_", ":_", ",_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "key", " ", "with", " ", "abs", "olute", " ", "path", " ", "names", " ", "and", " ", "add", " ", "promote", "d", " ", "names_", "\\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_", "._", "\\u", "params", "\\u", "dict_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "meta_", "in_", "iteritems_", "(_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pathname_", "=_", "self_", "._", "\\u", "get", "\\u", "var", "\\u", "pathname_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "dict_", "[_", "pathname_", "]_", "=_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "path", "name", "'_", "]_", "=_", "pathname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "prom", "\\u", "pname_", "[_", "pathname_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "abs", "\\u", "pn", "ames_", "[_", "name_", "]_", "=_", "(_", "pathname_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "unknown", "s", "\\u", "dict_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "meta_", "in_", "iteritems_", "(_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pathname_", "=_", "self_", "._", "\\u", "get", "\\u", "var", "\\u", "pathname_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unknown", "s", "\\u", "dict_", "[_", "pathname_", "]_", "=_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "[_", "'", "path", "name", "'_", "]_", "=_", "pathname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "prom", "\\u", "uname_", "[_", "pathname_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "abs", "\\u", "uname_", "[_", "name_", "]_", "=_", "pathname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "prom", "\\u", "name_", "._", "update_", "(_", "to", "\\u", "prom", "\\u", "uname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "prom", "\\u", "name_", "._", "update_", "(_", "to", "\\u", "prom", "\\u", "pname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "post", "\\u", "setup", "\\u", "vars_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "sys", "data_", "._", "\\u", "params", "\\u", "dict_", "=_", "self_", "._", "\\u", "params", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sys", "data_", "._", "\\u", "unknown", "s", "\\u", "dict_", "=_", "self_", "._", "\\u", "unknown", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "params", "\\u", "dict_", ",_", "self_", "._", "\\u", "unknown", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "communicator", "s_", "(_", "self_", ",_", "comm_", ",_", "parent", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Assign", " ", "communicator", " ", "to", " ", "this", " ", "`", "Compo", "nent", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "comm", " ", ":", " ", "an", " ", "MPI", " ", "communicator", " ", "(", "real", " ", "or", " ", "fake", ")", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "communicator", " ", "bei", "ng", " ", "offered", " ", "by", " ", "the", " ", "parent", " ", "system", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "parent", "\\u", "dir", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "abs", "olute", " ", "director", "y", " ", "of", " ", "the", " ", "parent", ",", " ", "or", " ", "''", " ", "if", " ", "unspe", "cif", "ied", ".", " ", "Us", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "dete", "rmin", "e", " ", "the", " ", "abs", "olute", " ", "director", "y", " ", "of", " ", "all", " ", "File", "Refs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Component_", ",_", "self_", ")_", "._", "\\u", "setup", "\\u", "communicator", "s_", "(_", "comm_", ",_", "parent", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "abs", "olute", " ", "director", "ies", " ", "of", " ", "any", " ", "File", "Refs", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "meta_", "in_", "chain_", "(_", "itervalues_", "(_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "itervalues_", "(_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "meta_", "[_", "'", "val", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "var", " ", "is", " ", "a", " ", "File", "Ref", ",", " ", "set", " ", "its", " ", "abs", "olute", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "val_", ",_", "File", "Ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "filer", "ef", "\\u", "setup_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "active_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "meta_", "in_", "itervalues_", "(_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "[_", "'", "remote", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "meta_", "in_", "itervalues_", "(_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "[_", "'", "remote", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\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", "filer", "ef", "\\u", "setup_", "(_", "self_", ",_", "fre", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fre", "f_", "._", "parent", "\\u", "dir_", "=_", "self_", "._", "\\u", "sys", "data_", "._", "abs", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "fre", "f_", "._", "\\u", "abspath_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "active_", "(_", ")_", "and_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "d_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "create", "\\u", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "director", "y", " ", "'%", "s", "'", " ", "doe", "sn", "'", "t", " ", "exist", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "File", "Ref", "('", "%", "s", "')", ".", " ", "Set", " ", "create", "\\u", "dirs", "=", "Tru", "e", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "in", " ", "system", " ", "'%", "s", "'", " ", "to", " ", "create", " ", "the", " ", "director", "y", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "automati", "call", "y", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "d_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fre", "f_", "._", "fname_", ",_", "self_", "._", "pathname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\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", "setup", "\\u", "vectors_", "(_", "self_", ",_", "param", "\\u", "owners_", ",_", "parent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "\\u", "unknown", "s_", "=_", "None_", ",_", "impl_", "=_", "None_", ",_", "allo", "c\\u", "deriv", "s_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "up", " ", "local", " ", "`", "Vec", "Wrapper", "s", "`", " ", "to", " ", "store", " ", "this", " ", "component", "'", "s", " ", "variab", "les", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "owner", "s", " ", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "dictionar", "y", " ", "mapping", " ", "`", "System", "`", " ", "path", "names", " ", "to", " ", "the", " ", "path", "names", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "parameter", "s", " ", "the", "y", " ", "are", " ", "repon", "sib", "le", " ", "for", " ", "propagat", "ing", ".", " ", "(", "ignore", "d", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "parent", " ", ":", " ", "`", "Group", "`", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "parent", " ", "`", "Group", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "top", "\\u", "unknown", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "`", "Prob", "lem", "`", " ", "level", " ", "unknown", "s", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "impl", " ", ":", " ", "an", " ", "implementation", " ", "factor", "y", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Specifie", "s", " ", "the", " ", "factor", "y", " ", "object", " ", "used", " ", "to", " ", "create", " ", "`", "Vec", "Wrapper", "`", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "allo", "c\\u", "deriv", "s", " ", ":", " ", "bool", "(", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "allocate", " ", "the", " ", "deriv", "ative", " ", "vector", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "=_", "self_", "._", "unknown", "s_", "=_", "self_", "._", "resid", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dum", "at_", ",_", "self_", "._", "dp", "mat_", ",_", "self_", "._", "dr", "mat_", "=_", "Order", "ed", "Dict_", "(_", ")_", ",_", "Order", "ed", "Dict_", "(_", ")_", ",_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connections_", "=_", "self_", "._", "\\u", "prob", "data_", "._", "connections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "relevance", "_", "=_", "self_", "._", "\\u", "prob", "data_", "._", "relevance", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "active_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "prom", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "impl_", "=_", "impl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "map", " ", "of", " ", "relative", " ", "name", " ", "in", " ", "parent", " ", "to", " ", "relative", " ", "name", " ", "in", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "rel", "name", "\\u", "map_", "=_", "self_", "._", "\\u", "get", "\\u", "rel", "name", "\\u", "map_", "(_", "parent_", "._", "\\u", "sys", "data_", "._", "to", "\\u", "prom", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "the", " ", "Group", " ", "level", ",", " ", "we", " ", "create", " ", "a", " ", "set", " ", "of", " ", "arrays", " ", "for", " ", "each", " ", "variab", "le", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "interest", ",", " ", "and", " ", "we", " ", "make", " ", "them", " ", "all", " ", "subv", "iew", "s", " ", "of", " ", "the", " ", "same", " ", "shared", " ", "array", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "order", " ", "to", " ", "conserv", "e", " ", "memory", ".", " ", "Compo", "nent", "s", " ", "don", "'", "t", " ", "actual", "ly", " ", "own", " ", "thei", "r", " ", "params", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "just", " ", "use", " ", "an", " ", "empty", " ", "shared", " ", "array", " ", "for", " ", "dp", " ", "(", "with", " ", "an", " ", "offset", " ", "of", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "shared", "\\u", "dp", "\\u", "vec_", "=_", "empty", "\\u", "arr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "shared", "\\u", "p", "\\u", "offsets_", "=_", "{_", "None_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "voi", "s_", "in_", "chain_", "(_", "relevance", "_", "._", "inputs_", ",_", "relevance", "_", "._", "outputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "voi", "_", "in_", "voi", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "shared", "\\u", "p", "\\u", "offsets_", "[_", "voi", "_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "get", " ", "non", "-", "deriv", " ", "vec", "s", " ", "(", "u", ",", " ", "p", ",", " ", "r", ")", " ", "unl", "ess", " ", "we", " ", "have", " ", "a", " ", "Non", "e", " ", "group", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "force", " ", "thei", "r", " ", "creati", "on", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "create", "\\u", "views_", "(_", "top", "\\u", "unknown", "s_", ",_", "parent_", ",_", "[_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "voi", "s_", "=_", "set_", "(_", "[_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "prob", "data_", "._", "top", "\\u", "lin", "\\u", "gs_", ":_", "#", " ", "only", " ", "need", " ", "voi", " ", "vec", "s", " ", "for", " ", "ling", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "storage", " ", "for", " ", "the", " ", "rele", "van", "t", " ", "vec", "wrapp", "ers", ",", " ", "keyed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "le", "\\u", "of", "\\u", "interest_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "voi", "s_", "in_", "relevance", "_", "._", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "voi", "s_", "._", "update_", "(_", "voi", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "voi", "_", "in_", "voi", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "create", "\\u", "views_", "(_", "top", "\\u", "unknown", "s_", ",_", "parent_", ",_", "[_", "]_", ",_", "voi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "params", " ", "vec", " ", "entri", "es", " ", "for", " ", "any", " ", "uncon", "nect", "ed", " ", "params_", "\\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_", "meta_", "in_", "itervalues_", "(_", "self_", "._", "\\u", "params", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pathname_", "=_", "meta_", "[_", "'", "path", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "self_", "._", "\\u", "sys", "data_", "._", "\\u", "scoped", "\\u", "abs", "\\u", "name_", "(_", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "not_", "in_", "self_", "._", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "._", "\\u", "add", "\\u", "uncon", "nect", "ed", "\\u", "var_", "(_", "pathname_", ",_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\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_", "appl", "y", "\\u", "nonlinear", "_", "(_", "self_", ",_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Evaluate", "s", " ", "the", " ", "residu", "als", " ", "for", " ", "this", " ", "component", ".", " ", "For", " ", "explicit", "\\", "10", ";", " ", " ", " ", " ", "component", "s", ",", " ", "the", " ", "residu", "al", " ", "is", " ", "the", " ", "output", " ", "produce", "d", " ", "by", " ", "the", " ", "current", " ", "params", "\\", "10", ";", " ", " ", " ", " ", "minu", "s", " ", "the", " ", "previ", "ously", " ", "calculated", " ", "output", ".", " ", "Thu", "s", ",", " ", "an", " ", "explicit", " ", "component", "\\", "10", ";", " ", " ", " ", " ", "must", " ", "execute", " ", "its", " ", "solve", " ", "nonlinear", " ", "method", ".", " ", "Implicit", " ", "component", "s", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "override", " ", "this", " ", "and", " ", "calcul", "ate", " ", "thei", "r", " ", "residu", "als", " ", "in", " ", "place", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "params", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "parameter", "s", ".", " ", "(", "p", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unknown", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "output", "s", " ", "and", " ", "state", "s", ".", " ", "(", "u", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "resid", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "residu", "als", ".", " ", "(", "r", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ",", " ", "we", " ", "solve", " ", "a", " ", "slight", "ly", " ", "modifi", "ed", " ", "version", " ", "of", " ", "the", " ", "unifie", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derivatives", " ", "equation", "s", " ", "in", " ", "Open", "MD", "AO", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "d", "R", "/", "du", ")", " ", "*", " ", "(", "du", "/", "dr", ")", " ", "=", " ", "-", "I_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "minu", "s", " ", "side", " ", "on", " ", "the", " ", "right", " ", "hand", " ", "side", " ", "come", "s", " ", "from", " ", "defini", "ng", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "explicit", " ", "residu", "al", " ", "to", " ", "be", " ", "yne", "w", " ", "-", " ", "yo", "ld", " ", "inst", "ead", " ", "of", " ", "yo", "ld", " ", "-", " ", "yne", "w", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "advantage", " ", "of", " ", "this", " ", "is", " ", "tha", "t", " ", "the", " ", "deriv", "ative", " ", "of", " ", "an", " ", "explicit", " ", "residu", "al", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "same", " ", "sign", " ", "as", " ", "the", " ", "deriv", "ative", " ", "of", " ", "the", " ", "explicit", " ", "unknown", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "explicit", " ", "comps", " ", "don", "'", "t", " ", "put", " ", "anyt", "hing", " ", "in", " ", "resid", "s", ",", " ", "we", " ", "can", " ", "use", " ", "it", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cache", " ", "the", " ", "old", " ", "values", " ", "of", " ", "the", " ", "unknown", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "resid", "s_", "._", "vec_", "[_", ":_", "]_", "=_", "-_", "unknown", "s_", "._", "vec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "solve", "\\u", "nonlinear", "_", "(_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "know", "ns", " ", "are", " ", "restore", "d", " ", "to", " ", "the", " ", "old", " ", "values", " ", "too", ".", " ", "appl", "y", "\\u", "nonlinear", " ", "doe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "change", " ", "the", " ", "output", " ", "vector", "._", "\\u\\u\\uNL\\u\\u\\u_", "resid", "s_", "._", "vec_", "[_", ":_", "]_", "+=_", "unknown", "s_", "._", "vec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unknown", "s_", "._", "vec_", "[_", ":_", "]_", "-=_", "resid", "s_", "._", "vec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "solve", "\\u", "nonlinear", "_", "(_", "self_", ",_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "component", ".", " ", "The", " ", "user", " ", "is", " ", "require", "d", " ", "to", " ", "defin", "e", " ", "this", " ", "function", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "component", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "params", " ", ":", " ", "`", "Vec", "Wrapper", "`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "parameter", "s", ".", " ", "(", "p", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unknown", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "output", "s", " ", "and", " ", "state", "s", ".", " ", "(", "u", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "resid", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "residu", "als", ".", " ", "(", "r", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Class", " ", "'%", "s", "'", " ", "doe", "s", " ", "not", " ", "implement", " ", "'", "solve", "\\u", "nonlinear", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "msg_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "linear", "ize_", "(_", "self_", ",_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Jacob", "ian", ".", " ", "Return", "s", " ", "Non", "e", " ", "unl", "ess", " ", "component", " ", "over", "ides", " ", "this", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "return", "s", " ", "somet", "hing", ".", " ", "J", " ", "shou", "ld", " ", "be", " ", "a", " ", "dictionar", "y", " ", "who", "se", " ", "keys", " ", "are", " ", "tuple", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "form", " ", "('", "unknown", "',", " ", "'", "param", "')", " ", "and", " ", "who", "se", " ", "values", " ", "are", " ", "ndar", "rays", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "params", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "parameter", "s", ".", " ", "(", "p", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unknown", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "output", "s", " ", "and", " ", "state", "s", ".", " ", "(", "u", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "resid", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "residu", "als", ".", " ", "(", "r", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "who", "se", " ", "keys", " ", "are", " ", "tuple", "s", " ", "of", " ", "the", " ", "form", " ", "('", "unknown", "',", " ", "'", "param", "')", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "who", "se", " ", "values", " ", "are", " ", "ndar", "rays", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "linear_", "(_", "self_", ",_", "params_", ",_", "unknown", "s_", ",_", "dpa", "rams_", ",_", "dun", "know", "ns_", ",_", "dre", "sids", "_", ",_", "mode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Multipl", "ies", " ", "inco", "ming", " ", "vector", " ", "by", " ", "the", " ", "Jacob", "ian", " ", "(", "fw", "d", " ", "mode", ")", " ", "or", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "transpose", " ", "Jacob", "ian", " ", "(", "rev", " ", "mode", ").", " ", "If", " ", "the", " ", "user", " ", "doe", "sn", "'", "t", " ", "provide", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "method", ",", " ", "then", " ", "we", " ", "just", " ", "multipl", "y", " ", "by", " ", "the", " ", "cache", "d", " ", "jacobian", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "params", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "parameter", "s", ".", " ", "(", "p", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unknown", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "output", "s", " ", "and", " ", "state", "s", ".", " ", "(", "u", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dpa", "rams", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "eit", "her", " ", "the", " ", "inco", "ming", " ", "vector", " ", "in", " ", "forward", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "outgoing", " ", "result", " ", "in", " ", "reverse", " ", "mode", ".", " ", "(", "dp", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dun", "know", "ns", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "forward", " ", "mode", ",", " ", "this", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "s", " ", "the", " ", "inco", "ming", " ", "vector", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "state", "s", ".", " ", "In", " ", "reverse", " ", "mode", ",", " ", "it", " ", "contain", "s", " ", "the", " ", "outgoing", " ", "vector", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "state", "s", ".", " ", "(", "du", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dre", "sids", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "eit", "her", " ", "the", " ", "outgoing", " ", "result", " ", "in", " ", "forward", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "inco", "ming", " ", "vector", " ", "in", " ", "reverse", " ", "mode", ".", " ", "(", "dr", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "mode", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Derivati", "ve", " ", "mode", ",", " ", "can", " ", "be", " ", "'", "fw", "d", "'", " ", "or", " ", "'", "rev", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "appl", "y", "\\u", "linear", "\\u", "jac_", "(_", "params_", ",_", "unknown", "s_", ",_", "dpa", "rams_", ",_", "dun", "know", "ns_", ",_", "dre", "sids", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "solve", "\\u", "linear_", "(_", "self_", ",_", "dum", "at_", ",_", "dr", "mat_", ",_", "voi", "s_", ",_", "mode_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sing", "le", " ", "linear", " ", "solut", "ion", " ", "applied", " ", "to", " ", "what", "ever", " ", "input", " ", "is", " ", "sit", "ting", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "rhs", " ", "vector", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "dum", "at", " ", ":", " ", "dict", " ", "of", " ", "`", "Vec", "Wrapper", "s", "`", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "forward", " ", "mode", ",", " ", "each", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "s", " ", "the", " ", "inco", "ming", " ", "vector", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "the", " ", "state", "s", ".", " ", "There", " ", "is", " ", "one", " ", "vector", " ", "per", " ", "quanti", "ty", " ", "of", " ", "interest", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "problem", ".", " ", "In", " ", "reverse", " ", "mode", ",", " ", "it", " ", "contain", "s", " ", "the", " ", "outgoing", " ", "vector", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "state", "s", ".", " ", "(", "du", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dr", "mat", " ", ":", " ", "`", "dict", " ", "of", " ", "Vec", "Wrapper", "s", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "eit", "her", " ", "the", " ", "outgoing", " ", "result", " ", "in", " ", "forward", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "inco", "ming", " ", "vector", " ", "in", " ", "reverse", " ", "mode", ".", " ", "There", " ", "is", " ", "one", " ", "vector", " ", "per", "\\", "10", ";", " ", " ", " ", " ", "quanti", "ty", " ", "of", " ", "interest", " ", "for", " ", "this", " ", "problem", ".", " ", "(", "dr", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "voi", "s", " ", ":", " ", "list", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "all", " ", "quantities", " ", "of", " ", "interest", " ", "to", " ", "key", " ", "int", "o", " ", "the", " ", "mats", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "mode", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Derivati", "ve", " ", "mode", ",", " ", "can", " ", "be", " ", "'", "fw", "d", "'", " ", "or", " ", "'", "rev", "',", " ", "but", " ", "genera", "ll", "y", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "with", "out", " ", "mode", " ", "so", " ", "tha", "t", " ", "the", " ", "user", " ", "can", " ", "set", " ", "the", " ", "mode", " ", "in", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "system", "'", "s", " ", "ln", "\\u", "solve", "r", ".", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mode_", "==_", "'", "fw", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sol", "\\u", "vec_", ",_", "rhs", "\\u", "vec_", "=_", "self_", "._", "dum", "at_", ",_", "self_", "._", "dr", "mat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sol", "\\u", "vec_", ",_", "rhs", "\\u", "vec_", "=_", "self_", "._", "dr", "mat_", ",_", "self_", "._", "dum", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "voi", "_", "in_", "voi", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sol", "\\u", "vec_", "[_", "voi", "_", "]_", "._", "vec_", "[_", ":_", "]_", "=_", "-_", "rhs", "\\u", "vec_", "[_", "voi", "_", "]_", "._", "vec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\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_", "dump_", "(_", "self_", ",_", "nest_", "=_", "0_", ",_", "out", "\\u", "stream_", "=_", "sys_", "._", "stdout_", ",_", "verbose_", "=_", "False_", ",_", "dv", "ecs_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sizes_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", "s", " ", "a", " ", "formate", "d", " ", "dump", " ", "of", " ", "this", " ", "`", "Compo", "nent", "`", " ", "to", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "nest", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Start", "ing", " ", "nesting", " ", "level", ".", " ", " ", "Default", "s", " ", "to", " ", "0.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "out", "\\u", "stream", " ", ":", " ", "an", " ", "open", " ", "file", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "re", " ", "output", " ", "is", " ", "writt", "en", ".", " ", " ", "Default", "s", " ", "to", " ", "sys", ".", "stdout", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "verbo", "se", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "output", " ", "addition", "al", " ", "info", " ", "be", "yon", "d", "\\", "10", ";", " ", " ", " ", " ", "just", " ", "the", " ", "tree", " ", "structure", ".", " ", "Default", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dv", "ecs", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "show", " ", "content", "s", " ", "of", " ", "du", " ", "and", " ", "dp", " ", "vector", "s", " ", "inst", "ead", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "u", " ", "and", " ", "p", " ", "(", "the", " ", "default", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "size", "s", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "show", " ", "size", "s", " ", "of", " ", "vector", "s", " ", "and", " ", "comms", ".", " ", "Default", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "klass_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dv", "ecs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ula", "bel_", ",_", "pla", "bel_", ",_", "uve", "cname_", ",_", "pv", "ec", "name_", "=_", "'", "du", "'_", ",_", "'", "dp", "'_", ",_", "'", "dun", "know", "ns", "'_", ",_", "'", "dpa", "rams", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ula", "bel_", ",_", "pla", "bel_", ",_", "uve", "cname_", ",_", "pv", "ec", "name_", "=_", "'", "u", "'_", ",_", "'", "p", "'_", ",_", "'", "unknown", "s", "'_", ",_", "'", "params", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uve", "c_", "=_", "getattr_", "(_", "self_", ",_", "uve", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "ec_", "=_", "getattr_", "(_", "self_", ",_", "pv", "ec", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "\"%", "s", " ", "%", "s", " ", "'%", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "stream_", "._", "write_", "(_", "template_", "%_", "(_", "\"", " ", "\"_", "*_", "nest_", ",_", "klass_", ",_", "self_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sizes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comms", "z_", "=_", "self_", "._", "comm_", "._", "size_", "if_", "hasattr_", "(_", "self_", "._", "comm_", ",_", "'", "size", "'_", ")_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "\"", " ", " ", " ", " ", "req", ":", " ", "%", "s", " ", " ", "usi", "ze", ":", "%", "d", " ", " ", "psi", "ze", ":", "%", "d", " ", " ", "comms", "ize", ":", "%", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "stream_", "._", "write_", "(_", "template_", "%_", "(_", "self_", "._", "get", "\\u", "req", "\\u", "procs_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uve", "c_", "._", "vec_", "._", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pv", "ec_", "._", "vec_", "._", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comms", "z_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "stream_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "verbose_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lens_", "=_", "[_", "len_", "(_", "n_", ")_", "for_", "n_", "in_", "uve", "c_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nwi", "d_", "=_", "max_", "(_", "lens_", ")_", "if_", "lens_", "else_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", "in_", "uve", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "in_", "uve", "c_", "._", "\\u", "dat_", "and_", "uve", "c_", "._", "\\u", "dat_", "[_", "v_", "]_", "._", "slice_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "usl", "ice_", "=_", "'{", "0", "}[", "{", "1", "[", "0", "]}", ":", "{", "1", "[", "1", "]}", "]'_", "._", "format_", "(_", "ula", "bel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uve", "c_", "._", "\\u", "dat_", "[_", "v_", "]_", "._", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tem_", "=_", "\"{", "0", "}{", "1", ":", "<", "{", "nwi", "d", "}}", " ", "{", "2", ":", "<", "21", "}", " ", "{", "3", ":", ">", "10", "}\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "stream_", "._", "write_", "(_", "tem_", "._", "format_", "(_", "\"", " ", "\"_", "*_", "(_", "nest_", "+_", "8_", ")_", ",_", "v_", ",_", "usl", "ice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repr_", "(_", "uve", "c_", "[_", "v_", "]_", ")_", ",_", "nwi", "d_", "=_", "nwi", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "dv", "ecs_", ":_", "#", " ", "deriv", " ", "vec", "s", " ", "don", "'", "t", " ", "have", " ", "passi", "ng", " ", "by", " ", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tem_", "=_", "\"{", "0", "}{", "1", ":", "<", "{", "nwi", "d", "}}", " ", " ", "(", "by", "\\u", "obj", ")", " ", "({", "2", "})\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "stream_", "._", "write_", "(_", "tem_", "._", "format_", "(_", "\"", " ", "\"_", "*_", "(_", "nest_", "+_", "8_", ")_", ",_", "v_", ",_", "repr_", "(_", "uve", "c_", "[_", "v_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nwi", "d_", "=_", "nwi", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "stream_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "rel", "name", "\\u", "map_", "(_", "self_", ",_", "parent", "\\u", "prom", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "parent", "\\u", "prom", "s", " ", ":", " ", "`", "dict", "`", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dict", " ", "mapping", " ", "abs", "olute", " ", "names", " ", "to", " ", "promote", "d", " ", "names", " ", "in", " ", "the", " ", "parent", "\\", "10", ";", " ", " ", " ", " ", "system", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "Map", "s", " ", "promote", "d", " ", "name", " ", "in", " ", "parent", " ", "(", "owner", " ", "of", " ", "unknown", "s", ")", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "correspond", "ing", " ", "promote", "d", " ", "name", " ", "in", " ", "the", " ", "child", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unknown", "s", "\\u", "dict", " ", "is", " ", "keyed", " ", "on", " ", "abs", "olute", " ", "pathname_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "an", " ", "order", "ed", " ", "dict", " ", "here", " ", "so", " ", "we", " ", "can", " ", "use", " ", "this", " ", "small", "er", " ", "dict", " ", "whe", "n", " ", "looping", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dur", "ing", " ", "get", "\\u", "view", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "(", "the", " ", "order", " ", "of", " ", "this", " ", "one", " ", "matche", "s", " ", "the", " ", "order", " ", "in", " ", "the", " ", "parent", ")_", "\\u\\u\\uNL\\u\\u\\u_", "uma", "p_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "meta_", "in_", "iteritems_", "(_", "self_", "._", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "promote", "d", " ", "and", " ", "\\u", "init", "\\u", "unknown", "s", "\\u", "dict", " ", "key", " ", "are", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uma", "p_", "[_", "parent", "\\u", "prom", "s_", "[_", "'.'_", "._", "join_", "(_", "(_", "self_", "._", "pathname_", ",_", "key_", ")_", ")_", "]_", "]_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "uma", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "complex", "\\u", "step", "\\u", "jacobian", "_", "(_", "self_", ",_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ",_", "total", "\\u", "deriv", "s_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fd", "\\u", "params_", "=_", "None_", ",_", "fd", "\\u", "states_", "=_", "None_", ",_", "fd", "\\u", "unknown", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poi", "\\u", "indices_", "=_", "None_", ",_", "qo", "i", "\\u", "indices_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "derivatives", " ", "of", " ", "all", " ", "unknown", "s", " ", "in", " ", "this", " ", "system", " ", "w", ".", "r", ".", "t", ".", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "inco", "ming", " ", "params", " ", "usi", "ng", " ", "complex", " ", "step", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "params", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "parameter", "s", ".", " ", "(", "p", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unknown", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "output", "s", " ", "and", " ", "state", "s", ".", " ", "(", "u", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "resid", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "residu", "als", ".", " ", "(", "r", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "total", "\\u", "deriv", "s", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "alw", "ay", "s", " ", "be", " ", "Fal", "se", ",", " ", "as", " ", "component", "wis", "e", " ", "derivatives", " ", "only", " ", "need", " ", "partial", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "params", " ", ":", " ", "list", " ", "of", " ", "string", "s", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "parameter", " ", "name", " ", "string", "s", " ", "with", " ", "respec", "t", " ", "to", " ", "whi", "ch", " ", "derivatives", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "desi", "red", ".", " ", "Thi", "s", " ", "is", " ", "used", " ", "by", " ", "problem", " ", "to", " ", "limit", " ", "the", " ", "derivatives", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "take", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "unknown", "s", " ", ":", " ", "list", " ", "of", " ", "string", "s", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "output", " ", "or", " ", "state", " ", "name", " ", "string", "s", " ", "for", " ", "derivatives", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "calculated", ".", " ", "Thi", "s", " ", "is", " ", "used", " ", "by", " ", "problem", " ", "to", " ", "limit", " ", "the", " ", "derivatives", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "take", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "state", "s", " ", ":", " ", "list", " ", "of", " ", "string", "s", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "state", " ", "name", " ", "string", "s", " ", "for", " ", "derivatives", " ", "to", " ", "be", " ", "take", "n", " ", "with", " ", "respec", "t", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "by", " ", "problem", " ", "to", " ", "limit", " ", "the", " ", "derivatives", " ", "tha", "t", " ", "are", " ", "take", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "poi", "\\u", "indice", "s", ":", " ", "dict", " ", "of", " ", "list", " ", "of", " ", "integ", "ers", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "be", " ", "an", " ", "empty", " ", "list", ",", " ", "as", " ", "there", " ", "is", " ", "no", " ", "subco", "mpo", "nent", " ", "relevance", " ", "reduc", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "qo", "i", "\\u", "indice", "s", ":", " ", "dict", " ", "of", " ", "list", " ", "of", " ", "integ", "ers", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "be", " ", "an", " ", "empty", " ", "list", ",", " ", "as", " ", "there", " ", "is", " ", "no", " ", "subco", "mpo", "nent", " ", "relevance", " ", "reduc", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "who", "se", " ", "keys", " ", "are", " ", "tuple", "s", " ", "of", " ", "the", " ", "form", " ", "('", "unknown", "',", " ", "'", "param", "')", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "who", "se", " ", "values", " ", "are", " ", "ndar", "rays", " ", "contain", "ing", " ", "the", " ", "deriv", "ative", " ", "for", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "tuple", " ", "pair", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Param", "s", " ", "and", " ", "Un", "know", "ns", " ", "tha", "t", " ", "we", " ", "provide", " ", "at", " ", "this", " ", "level", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fd", "\\u", "params_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd", "\\u", "params_", "=_", "self_", "._", "\\u", "get", "\\u", "fd", "\\u", "params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fd", "\\u", "unknown", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd", "\\u", "unknown", "s_", "=_", "self_", "._", "\\u", "get", "\\u", "fd", "\\u", "unknown", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "settings", " ", "in", " ", "the", " ", "system", " ", "dict", " ", "unl", "ess", " ", "variab", "les", " ", "override", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "\\u", "size_", "=_", "self_", "._", "fd", "\\u", "options_", "._", "get_", "(_", "'", "step", "\\u", "size", "'_", ",_", "1.0e-", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jac_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csp", "arams_", "=_", "Comple", "x", "Step", "Tg", "t", "Vec", "Wrapper_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csu", "nk", "now", "ns_", "=_", "Comple", "x", "Step", "Sr", "c", "Vec", "Wrapper_", "(_", "unknown", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csr", "esi", "ds_", "=_", "Comple", "x", "Step", "Sr", "c", "Vec", "Wrapper_", "(_", "resid", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pul", "l", " ", "result", " ", "from", " ", "resid", "s", " ", "only", " ", "if", " ", "comp", " ", "override", "s", " ", "appl", "y", "\\u", "nonlinear", "_", "\\u\\u\\uNL\\u\\u\\u_", "states_", "=_", "self_", "._", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "states_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "vec_", "=_", "csr", "esi", "ds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "vec_", "=_", "csu", "nk", "now", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manu", "al", " ", "override", " ", "of", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fd", "\\u", "states_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "states_", "=_", "fd", "\\u", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "gradi", "ent", " ", "for", " ", "this", " ", "param", " ", "or", " ", "state", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p", "\\u", "name_", "in_", "chain_", "(_", "fd", "\\u", "params_", ",_", "states_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "State", "s", " ", "are", " ", "steppe", "d", " ", "in", " ", "unknown", "s", ",", " ", "not", " ", "params_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p", "\\u", "name_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "vec_", "=_", "csu", "nk", "now", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "input_", "=_", "unknown", "s_", "._", "\\u", "dat_", "[_", "p", "\\u", "name_", "]_", "._", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "vec_", "=_", "csp", "arams_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "input_", "=_", "params_", "._", "\\u", "dat_", "[_", "p", "\\u", "name_", "]_", "._", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "vec_", "._", "set\\u", "complex", "\\u", "var_", "(_", "p", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "promote", "d", " ", "names", " ", "and", " ", "\\u", "init", "\\u", "params", "\\u", "dict", " ", "keys", " ", "are", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "mydi", "ct_", "=_", "self_", "._", "\\u", "init", "\\u", "params", "\\u", "dict_", "._", "get_", "(_", "p", "\\u", "name_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "settings", " ", "for", " ", "this", " ", "var", " ", "tru", "mp", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "fds", "tep_", "=_", "mydi", "ct_", "._", "get_", "(_", "'", "step", "\\u", "size", "'_", ",_", "step", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Size", " ", "our", " ", "Inputs_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "size_", "=_", "np_", "._", "size_", "(_", "target", "\\u", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "idxs_", "=_", "range_", "(_", "p", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Size", " ", "our", " ", "Output", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u\\u", "name_", "in_", "fd", "\\u", "unknown", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u\\u", "size_", "=_", "np_", "._", "size_", "(_", "unknown", "s_", "[_", "u\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jac_", "[_", "u\\u", "name_", ",_", "p", "\\u", "name_", "]_", "=_", "np_", "._", "zeros_", "(_", "(_", "u\\u", "size_", ",_", "p", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appl", "y", " ", "Comple", "x", " ", "Step", " ", "on", " ", "each", " ", "index", " ", "in", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "j_", ",_", "idx_", "in_", "enumerate_", "(_", "p", "\\u", "idxs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "vec_", "._", "step", "\\u", "complex_", "(_", "idx_", ",_", "fds", "tep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "appl", "y", "\\u", "nonlinear", "_", "(_", "csp", "arams_", ",_", "csu", "nk", "now", "ns_", ",_", "csr", "esi", "ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "vec_", "._", "step", "\\u", "complex_", "(_", "idx_", ",_", "-_", "fds", "tep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u\\u", "name_", "in_", "fd", "\\u", "unknown", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "result", "vec_", "._", "flat_", "(_", "u\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jac_", "[_", "u\\u", "name_", ",_", "p", "\\u", "name_", "]_", "[_", ":_", ",_", "j_", "]_", "=_", "result_", "._", "imag_", "/_", "fds", "tep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "clear", " ", "this", " ", "out", " ", "bec", "aus", "e", " ", "our", " ", "next", " ", "input", " ", "mig", "ht", " ", "be", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "different", " ", "vector", " ", "(", "state", " ", "vs", " ", "param", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "vec_", "._", "set\\u", "complex", "\\u", "var_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "allo", "c\\u", "jacobian", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "jacobian", " ", "dictionar", "y", " ", "with", " ", "the", " ", "keys", " ", "pre", "-", "populate", "d", " ", "and", " ", "correct", "\\", "10", ";", " ", " ", " ", " ", "array", " ", "size", "s", " ", "allocated", ".", " ", "cache", "s", " ", "the", " ", "result", " ", "in", " ", "the", " ", "component", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "tha", "t", " ", "cache", " ", "if", " ", "it", " ", "find", "s", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-----------", "\\", "10", ";", " ", " ", " ", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "pre", "-", "allocated", " ", "jacobian", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "jacobian", "\\u", "cache_", "is_", "not_", "None_", "and_", "len_", "(_", "self_", "._", "\\u", "jacobian", "\\u", "cache_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "jacobian", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "jacobian", "\\u", "cache_", "=_", "jac_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u\\u", "vec_", "=_", "self_", "._", "unknown", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "vec_", "=_", "self_", "._", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "self_", "._", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Caching", " ", "whi", "le", " ", "caching", "_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "size", "\\u", "storage_", "=_", "[_", "(_", "n_", ",_", "m_", "[_", "'", "size", "'_", "]_", ")_", "for_", "n_", ",_", "m_", "in_", "iteritems_", "(_", "p", "\\u", "vec_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "m_", "._", "get_", "(_", "'", "pass", "\\u", "by", "\\u", "obj", "'_", ")_", "and_", "not_", "m_", "._", "get_", "(_", "'", "remote", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s", "\\u", "size", "\\u", "storage_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u\\u", "size", "\\u", "storage_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", ",_", "meta_", "in_", "iteritems_", "(_", "u\\u", "vec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "meta_", "._", "get_", "(_", "'", "pass", "\\u", "by", "\\u", "obj", "'_", ")_", "or_", "meta_", "._", "get_", "(_", "'", "remote", "'_", ")_", ":_", "\\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_", "meta_", "._", "get_", "(_", "'", "state", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s", "\\u", "size", "\\u", "storage_", "._", "append_", "(_", "(_", "n_", ",_", "meta_", "[_", "'", "size", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "u\\u", "size", "\\u", "storage_", "._", "append_", "(_", "(_", "n_", ",_", "meta_", "[_", "'", "size", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "u\\u", "var_", ",_", "u\\u", "size_", "in_", "u\\u", "size", "\\u", "storage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "p", "\\u", "var_", ",_", "p", "\\u", "size_", "in_", "p", "\\u", "size", "\\u", "storage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jac_", "[_", "u\\u", "var_", ",_", "p", "\\u", "var_", "]_", "=_", "np_", "._", "zeros_", "(_", "(_", "u\\u", "size_", ",_", "p", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "s", "\\u", "var_", ",_", "s", "\\u", "size_", "in_", "s", "\\u", "size", "\\u", "storage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jac_", "[_", "u\\u", "var_", ",_", "s", "\\u", "var_", "]_", "=_", "np_", "._", "zeros_", "(_", "(_", "u\\u", "size_", ",_", "s", "\\u", "size_", ")_", ")_", "\\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_", "jac_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 local variable
aaronlidman/openstreetPOIs/osmpois.py
[ { "content": "def tag_filter(tags):\n if args['require_key'] and args['require_key'] not in tags:\n for key in tags.keys():\n del tags[key]\n # \"functions should modify the dictionary in-place\"\n else:\n for key in tags.keys():\n if key not in wantedTags:\n del tags[key]\n else:\n if wantedTags[key] == '*' or tags[key] in wantedTags[key]:\n a = 1\n # placeholder, more to do here, combine keys, normalize values, etc...\n else:\n del tags[key]", "metadata": "root.tag_filter", "header": "['module', '___EOS___']", "index": 157 } ]
[ { "span": "a ", "start_line": 168, "start_column": 20, "end_line": 168, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag", "\\u", "filter_", "(_", "tags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "[_", "'", "require", "\\u", "key", "'_", "]_", "and_", "args_", "[_", "'", "require", "\\u", "key", "'_", "]_", "not_", "in_", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "tags_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "tags_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\"", "function", "s", " ", "shou", "ld", " ", "modif", "y", " ", "the", " ", "dictionar", "y", " ", "in", "-", "place", "\"_", "\\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 ", " _", "for_", "key_", "in_", "tags_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "not_", "in_", "want", "ed", "Tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "tags_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "want", "ed", "Tags_", "[_", "key_", "]_", "==_", "'*'_", "or_", "tags_", "[_", "key_", "]_", "in_", "want", "ed", "Tags_", "[_", "key_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "placehold", "er", ",", " ", "more", " ", "to", " ", "do", " ", "here", ",", " ", "combin", "e", " ", "keys", ",", " ", "normali", "ze", " ", "values", ",", " ", "etc", "..._", "\\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 ", " ", "_", "del_", "tags_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Suspicious unused loop iteration variable
wq/django-rest-pandas/rest_pandas/test.py
[ { "content": "def parse_csv(string):\n \"\"\"\n Rough port of wq/pandas.js to Python. Useful for validating CSV output\n generated by Django REST Pandas.\n \"\"\"\n if not string.startswith(','):\n data = []\n for row in csv.DictReader(StringIO(string)):\n for key, val in row.items():\n try:\n row[key] = float(val)\n except ValueError:\n pass\n data.append(row)\n return [{\n 'data': data\n }]\n\n reader = csv.reader(StringIO(string))\n val_cols = None\n val_start = None\n id_cols = None\n for row in reader:\n if row[0] == '' and not val_cols:\n val_start = row.count('')\n val_cols = row[val_start:]\n col_meta = [{} for v in val_cols]\n elif row[-1] != '' and val_cols and not id_cols:\n key = row[0]\n for i, meta in enumerate(row[val_start:]):\n col_meta[i].update(**{key: meta})\n elif row[-1] == '' and not id_cols:\n id_cols = row[:row.index('')]\n meta_index = {}\n meta_i = 0\n datasets = []\n for i, ds1 in enumerate(col_meta):\n if i in meta_index:\n continue\n meta_index[i] = meta_i\n meta_i += 1\n datasets.append(ds1)\n if i < len(col_meta):\n for j, ds2 in enumerate(col_meta[i + 1:]):\n if ds1 == ds2:\n meta_index[i + j + 1] = i\n for d in datasets:\n d['data'] = []\n elif val_cols and id_cols:\n ids = {\n key: val\n for key, val in zip(id_cols, row[:len(id_cols)])\n }\n records = {}\n for i, val in enumerate(row[len(id_cols):]):\n mi = meta_index[i]\n if mi not in records:\n data = ids.copy()\n else:\n data = records[mi]\n try:\n val = float(val)\n except ValueError:\n pass\n if val != '':\n data[val_cols[i]] = val\n records[mi] = data\n for mi, data in records.items():\n datasets[mi]['data'].append(data)\n return datasets", "metadata": "root.parse_csv", "header": "['module', '___EOS___']", "index": 4 } ]
[ { "span": "[{} for v in val_cols]", "start_line": 30, "start_column": 23, "end_line": 30, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "\\u", "csv_", "(_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rou", "gh", " ", "port", " ", "of", " ", "wq", "/", "panda", "s", ".", "js", " ", "to", " ", "Pyth", "on", ".", " ", " ", "Us", "efu", "l", " ", "for", " ", "validat", "ing", " ", "CSV", " ", "output", "\\", "10", ";", " ", " ", " ", " ", "generat", "ed", " ", "by", " ", "Dj", "ang", "o", " ", "REST", " ", "Pan", "das", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "string_", "._", "startswith_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "csv_", "._", "Dict", "Reader_", "(_", "String", "IO_", "(_", "string_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "val_", "in_", "row_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row_", "[_", "key_", "]_", "=_", "float_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "._", "append_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "data_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reader_", "=_", "csv_", "._", "reader_", "(_", "String", "IO_", "(_", "string_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val", "\\u", "cols_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val", "\\u", "start_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "cols_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "row_", "[_", "0_", "]_", "==_", "''_", "and_", "not_", "val", "\\u", "cols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val", "\\u", "start_", "=_", "row_", "._", "count_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val", "\\u", "cols_", "=_", "row_", "[_", "val", "\\u", "start_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "meta_", "=_", "[_", "{_", "}_", "for_", "v_", "in_", "val", "\\u", "cols_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "row_", "[_", "-_", "1_", "]_", "!=_", "''_", "and_", "val", "\\u", "cols_", "and_", "not_", "id", "\\u", "cols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "meta_", "in_", "enumerate_", "(_", "row_", "[_", "val", "\\u", "start_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "\\u", "meta_", "[_", "i_", "]_", "._", "update_", "(_", "**_", "{_", "key_", ":_", "meta_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "row_", "[_", "-_", "1_", "]_", "==_", "''_", "and_", "not_", "id", "\\u", "cols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id", "\\u", "cols_", "=_", "row_", "[_", ":_", "row_", "._", "index_", "(_", "''_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "\\u", "index_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "\\u", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datasets_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "ds", "1_", "in_", "enumerate_", "(_", "col", "\\u", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "in_", "meta", "\\u", "index_", ":_", "\\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_", "meta", "\\u", "index_", "[_", "i_", "]_", "=_", "meta", "\\u", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "\\u", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datasets_", "._", "append_", "(_", "ds", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "<_", "len_", "(_", "col", "\\u", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "j_", ",_", "ds", "2_", "in_", "enumerate_", "(_", "col", "\\u", "meta_", "[_", "i_", "+_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "ds", "1_", "==_", "ds", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "meta", "\\u", "index_", "[_", "i_", "+_", "j_", "+_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "d_", "in_", "datasets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "'", "data", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "val", "\\u", "cols_", "and_", "id", "\\u", "cols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ids_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "key_", ":_", "val_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "zip_", "(_", "id", "\\u", "cols_", ",_", "row_", "[_", ":_", "len_", "(_", "id", "\\u", "cols_", ")_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "val_", "in_", "enumerate_", "(_", "row_", "[_", "len_", "(_", "id", "\\u", "cols_", ")_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mi_", "=_", "meta", "\\u", "index_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mi_", "not_", "in_", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "ids_", "._", "copy_", "(_", ")_", "\\u\\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_", "=_", "records_", "[_", "mi_", "]_", "\\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 ", " ", "_", "val_", "=_", "float_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "val_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "val", "\\u", "cols_", "[_", "i_", "]_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "[_", "mi_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "mi_", ",_", "data_", "in_", "records_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datasets_", "[_", "mi_", "]_", "[_", "'", "data", "'_", "]_", "._", "append_", "(_", "data_", ")_", "\\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_", "datasets_" ]
[ 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
google/fplutil/disttools/__init__.py
[ { "content": "# Copyright 2014 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Source distribution scripts.\"\"\"\n\nimport push_package\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import push_package", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 19 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Sou", "rce", " ", "distribu", "tion", " ", "scripts", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "push", "\\u", "package_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1 ]
Unused local variable
neurodata/ndstore/test/test_ramon.py
[ { "content": " def test_anno_minmal(self):\n \"\"\"Upload a minimal and maximal annotation. Verify fields.\"\"\"\n \n # Create an in-memory HDF5 file\n tmpfile = tempfile.NamedTemporaryFile()\n h5fh = h5py.File ( tmpfile.name )\n # Create the top level annotation id namespace\n idgrp = h5fh.create_group ( str(0) )\n h5fh.flush()\n tmpfile.seek(0)\n \n p.annoid = putAnnotation(p, tmpfile)\n h5ret = getAnnotation(p)\n\n idgrpret = h5ret.get(str(p.annoid))\n assert idgrpret\n assert ( idgrpret['ANNOTATION_TYPE'][0] == 1 )\n assert not idgrpret.get('RESOLUTION')\n assert not idgrpret.get('XYZOFFSET')\n assert not idgrpret.get('VOXELS')\n assert not idgrpret.get('CUTOUT')\n mdgrpret = idgrpret['METADATA']\n assert mdgrpret\n assert ( mdgrpret['CONFIDENCE'][0] == 0.0 )\n assert ( mdgrpret['STATUS'][0] == 0 )\n assert ( mdgrpret['KVPAIRS'][:] == '' )\n assert ( mdgrpret['AUTHOR'][:] == 'unknown' )", "metadata": "root.Test_Ramon.test_anno_minmal", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 51 }, { "content": " def test_wrong_field ( self ):\n \n # Make an annotation \n makeAnno (p, 2)\n\n # Test the synapse type\n synapse_type = random.randint (0,100)\n f = setField(p, 'synapse_type', synapse_type)\n f = getField(p, 'synapse_type')\n assert synapse_type == int(f.read()) \n\n # Test the weight\n weight = random.random ()\n f = setField(p, 'weight', weight)\n f = getField(p, 'weight')\n assert weight - float(f.read()) < 0.001\n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read())\n \n # bad format to a number\n url = \"http://{}/ca/{}/{}/{}/setField/status/aa/\".format(SITE_HOST, 'unittest', 'unit_anno', p.annoid)\n with pytest.raises(urllib2.HTTPError): \n req = urllib2.Request ( url )\n f = urllib2.urlopen ( url )\n \n # request a missing field\n url = \"http://{}/ca/{}/{}/{}/getField/othernonesuch/\".format(SITE_HOST, 'unittest', 'unit_anno', p.annoid)\n with pytest.raises(urllib2.HTTPError): \n req = urllib2.Request ( url )\n f = urllib2.urlopen ( url )", "metadata": "root.Test_Ramon.test_wrong_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 396 } ]
[ { "span": "idgrp ", "start_line": 58, "start_column": 4, "end_line": 58, "end_column": 9 }, { "span": "req ", "start_line": 428, "start_column": 6, "end_line": 428, "end_column": 9 }, { "span": "f ", "start_line": 429, "start_column": 6, "end_line": 429, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "anno", "\\u", "min", "mal", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "minima", "l", " ", "and", " ", "maximal", " ", "annot", "ation", ".", " ", "Verify", " ", "fields", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "in", "-", "memory", " ", "HDF", "5", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "fh_", "=_", "h5py_", "._", "File_", "(_", "tmpfile_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "top", " ", "level", " ", "annot", "ation", " ", "id", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "=_", "h5", "fh_", "._", "create", "\\u", "group_", "(_", "str_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "fh_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "anno", "id_", "=_", "put", "Annotation_", "(_", "p_", ",_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "ret_", "=_", "get", "Annotation_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp", "ret_", "=_", "h5", "ret_", "._", "get_", "(_", "str_", "(_", "p_", "._", "anno", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "id", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "id", "grp", "ret_", "[_", "'", "ANNOTAT", "ION", "\\u", "TYPE", "'_", "]_", "[_", "0_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "RESOL", "UTION", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "XY", "ZO", "FF", "SET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "VO", "XE", "LS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "CUT", "OUT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp", "ret_", "=_", "id", "grp", "ret_", "[_", "'", "METAD", "ATA", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "md", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "CONF", "IDE", "NCE", "'_", "]_", "[_", "0_", "]_", "==_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "STATUS", "'_", "]_", "[_", "0_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "KV", "PAIR", "S", "'_", "]_", "[_", ":_", "]_", "==_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "AUTHOR", "'_", "]_", "[_", ":_", "]_", "==_", "'", "unknown", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrong", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "annot", "ation", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "Ann", "o_", "(_", "p_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "synapse", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "synapse", "\\u", "type_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ",_", "synapse", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "synapse", "\\u", "type_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "weight_", "\\u\\u\\uNL\\u\\u\\u_", "weight_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ",_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "weight_", "-_", "float_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "<_", "0.001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "bad", " ", "format", " ", "to", " ", "a", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://{}", "/", "ca", "/{}/", "{}/{}", "/", "set", "Field", "/", "status", "/", "aa", "/\"_", "._", "format_", "(_", "SITE", "\\u", "HOST_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "urllib2_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "request", " ", "a", " ", "missi", "ng", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "\"", "http", "://{}", "/", "ca", "/{}/", "{}/{}", "/", "get", "Field", "/", "other", "none", "suc", "h", "/\"_", "._", "format_", "(_", "SITE", "\\u", "HOST_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "urllib2_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
datafolklabs/cement/cement/core/output.py
[ { "content": " def _setup(app_obj):\n \"\"\"\n The _setup function is called during application initialization and\n must 'setup' the handler object making it ready for the framework\n or the application to make further calls to it.\n\n :param app_obj: The application object.\n\n \"\"\"", "metadata": "root.IOutput._setup", "header": "['class', 'IOutput', '(', 'interface', '.', 'Interface', ')', ':', '___EOS___']", "index": 58 } ]
[ { "span": "def _setup(app_obj):", "start_line": 58, "start_column": 4, "end_line": 58, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "IO", "utput_", "(_", "interface_", "._", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "setup_", "(_", "app", "\\u", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "\\u", "setup", " ", "function", " ", "is", " ", "call", "ed", " ", "dur", "ing", " ", "applica", "tion", " ", "initialization", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "must", " ", "'", "setup", "'", " ", "the", " ", "handler", " ", "object", " ", "mak", "ing", " ", "it", " ", "read", "y", " ", "for", " ", "the", " ", "frame", "work", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "applica", "tion", " ", "to", " ", "make", " ", "fur", "ther", " ", "calls", " ", "to", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "app", "\\u", "obj", ":", " ", "The", " ", "applica", "tion", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
zunzun/pyeq2/Examples/GUI/guifiles/CustomThreads.py
[ { "content": "\n# see the included wxThreadExample.py file\n\nimport os, sys, time, threading\nimport wx\nimport CustomEvents\n\n# ensure pyeq2 can be imported\nif -1 != sys.path[0].find('pyeq2-master'):raise Exception('Please rename git checkout directory from \"pyeq2-master\" to \"pyeq2\"')\nexampleFileDirectory = sys.path[0][:sys.path[0].rfind(os.sep)]\npyeq2IimportDirectory = os.path.join(os.path.join(exampleFileDirectory, '..'), '..')\nif pyeq2IimportDirectory not in sys.path:\n sys.path.append(pyeq2IimportDirectory)\n \nimport pyeq2\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FittingThread(threading.Thread):\n\n", "metadata": "root.FittingThread", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, notify_window, equation):\n threading.Thread.__init__(self)\n self._notify_window = notify_window\n self.equation = equation\n # This starts the thread running on creation, but you could\n # also make the GUI thread responsible for calling this\n self.start()", "metadata": "root.FittingThread.__init__", "header": "['class', 'FittingThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 18 }, { "content": " def run(self):\n\n statusString = 'Fitting data...'\n wx.PostEvent(self._notify_window, CustomEvents.ThreadStatusEvent(statusString))\n time.sleep(0.5) # allow users to see the update\n self.equation.Solve()\n \n statusString = 'Calculating model errors...'\n wx.PostEvent(self._notify_window, CustomEvents.ThreadStatusEvent(statusString))\n time.sleep(0.5) # allow users to see the update\n self.equation.CalculateModelErrors(self.equation.solvedCoefficients, self.equation.dataCache.allDataCacheDictionary)\n \n statusString = 'Calculating coefficient and fit statistics...'\n wx.PostEvent(self._notify_window, CustomEvents.ThreadStatusEvent(statusString))\n time.sleep(0.5) # allow users to see the update\n self.equation.CalculateCoefficientAndFitStatistics()\n\n statusString = 'Creating reports...'\n wx.PostEvent(self._notify_window, CustomEvents.ThreadStatusEvent(statusString))\n time.sleep(0.5) # allow users to see the update\n \n # the fitted equation is now the event data, not a status update string\n wx.PostEvent(self._notify_window, CustomEvents.ThreadStatusEvent(self.equation))", "metadata": "root.FittingThread.run", "header": "['class', 'FittingThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 27 } ]
[ { "span": "import pyeq2", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 12 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "the", " ", "include", "d", " ", "wx", "Thread", "Exam", "ple", ".", "py", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "time_", ",_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Custom", "Events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "pye", "q2", " ", "can", " ", "be", " ", "imported_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "-_", "1_", "!=_", "sys_", "._", "path_", "[_", "0_", "]_", "._", "find_", "(_", "'", "pye", "q2", "-", "master", "'_", ")_", ":_", "raise_", "Exception_", "(_", "'", "Ple", "ase", " ", "rename", " ", "git", " ", "check", "out", " ", "director", "y", " ", "from", " ", "\"", "pye", "q2", "-", "master", "\"", " ", "to", " ", "\"", "pye", "q2", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "example", "File", "Directory_", "=_", "sys_", "._", "path_", "[_", "0_", "]_", "[_", ":_", "sys_", "._", "path_", "[_", "0_", "]_", "._", "rfind_", "(_", "os_", "._", "sep_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "q2", "Ii", "mpor", "t", "Directory_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "join_", "(_", "example", "File", "Directory_", ",_", "'..'_", ")_", ",_", "'..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pye", "q2", "Ii", "mpor", "t", "Directory_", "not_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "append_", "(_", "pye", "q2", "Ii", "mpor", "t", "Directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "pye", "q2_", "\\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_", "Fitt", "ing", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fitt", "ing", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", ",_", "notif", "y", "\\u", "window_", ",_", "equation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notif", "y", "\\u", "window_", "=_", "notif", "y", "\\u", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "equation_", "=_", "equation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "starts", " ", "the", " ", "thread", " ", "runn", "ing", " ", "on", " ", "creati", "on", ",", " ", "but", " ", "you", " ", "coul", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "als", "o", " ", "make", " ", "the", " ", "GU", "I", " ", "thread", " ", "responsib", "le", " ", "for", " ", "calling", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fitt", "ing", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "String_", "=_", "'", "Fitt", "ing", " ", "data", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx_", "._", "Post", "Event_", "(_", "self_", "._", "\\u", "notif", "y", "\\u", "window_", ",_", "Custom", "Events_", "._", "Thread", "Status", "Event_", "(_", "status", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "#", " ", "allow", " ", "users", " ", "to", " ", "see", " ", "the", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "equation_", "._", "Solve", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status", "String_", "=_", "'", "Calculating", " ", "model", " ", "error", "s", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx_", "._", "Post", "Event_", "(_", "self_", "._", "\\u", "notif", "y", "\\u", "window_", ",_", "Custom", "Events_", "._", "Thread", "Status", "Event_", "(_", "status", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "#", " ", "allow", " ", "users", " ", "to", " ", "see", " ", "the", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "equation_", "._", "Calculat", "e", "Model", "Errors_", "(_", "self_", "._", "equation_", "._", "solved", "Coeff", "icient", "s_", ",_", "self_", "._", "equation_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status", "String_", "=_", "'", "Calculating", " ", "coefficient", " ", "and", " ", "fit", " ", "statistic", "s", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx_", "._", "Post", "Event_", "(_", "self_", "._", "\\u", "notif", "y", "\\u", "window_", ",_", "Custom", "Events_", "._", "Thread", "Status", "Event_", "(_", "status", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "#", " ", "allow", " ", "users", " ", "to", " ", "see", " ", "the", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "equation_", "._", "Calculat", "e", "Coeff", "icient", "And", "Fit", "Statistics_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status", "String_", "=_", "'", "Creat", "ing", " ", "report", "s", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx_", "._", "Post", "Event_", "(_", "self_", "._", "\\u", "notif", "y", "\\u", "window_", ",_", "Custom", "Events_", "._", "Thread", "Status", "Event_", "(_", "status", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "#", " ", "allow", " ", "users", " ", "to", " ", "see", " ", "the", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "fitted", " ", "equation", " ", "is", " ", "now", " ", "the", " ", "event", " ", "data", ",", " ", "not", " ", "a", " ", "status", " ", "update", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "wx_", "._", "Post", "Event_", "(_", "self_", "._", "\\u", "notif", "y", "\\u", "window_", ",_", "Custom", "Events_", "._", "Thread", "Status", "Event_", "(_", "self_", "._", "equation_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
retresco/Spyder/test/test_worker.py
[ { "content": "#\n# Copyright (c) 2011 Daniel Truemper [email protected]\n#\n# test_worker.py 11-Jan-2011\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\nimport logging\nfrom logging import StreamHandler\nimport sys\n\nimport unittest\n\nimport time\n\nimport zmq\nfrom zmq import Socket\nfrom zmq.eventloop.ioloop import IOLoop\nfrom zmq.eventloop.zmqstream import ZMQStream\n\nfrom spyder.core.constants import ZMQ_SPYDER_MGMT_WORKER\nfrom spyder.core.constants import ZMQ_SPYDER_MGMT_WORKER_QUIT\nfrom spyder.core.constants import ZMQ_SPYDER_MGMT_WORKER_QUIT_ACK\nfrom spyder.core.mgmt import ZmqMgmt\nfrom spyder.core.worker import ZmqWorker, AsyncZmqWorker\nfrom spyder.core.messages import DataMessage, MgmtMessage\nfrom spyder.thrift.gen.ttypes import CrawlUri\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ZmqTornadoIntegrationTest(unittest.TestCase):\n\n\n\n\n", "metadata": "root.ZmqTornadoIntegrationTest", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def setUp(self):\n\n # create the io_loop\n self._io_loop = IOLoop.instance()\n\n # and the context\n self._ctx = zmq.Context(1)\n\n # setup the mgmt sockets\n self._setup_mgmt_sockets()\n\n # setup the data sockets\n self._setup_data_sockets()\n\n # setup the management interface\n self._mgmt = ZmqMgmt( self._mgmt_sockets['worker_sub'],\n self._mgmt_sockets['worker_pub'], io_loop=self._io_loop)\n self._mgmt.start()\n self._mgmt.add_callback(ZMQ_SPYDER_MGMT_WORKER, self.on_mgmt_end)", "metadata": "root.ZmqTornadoIntegrationTest.setUp", "header": "['class', 'ZmqTornadoIntegrationTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def tearDown(self):\n # stop the mgmt\n self._mgmt.stop()\n\n # close all sockets\n for socket in self._mgmt_sockets.itervalues():\n socket.close()\n for socket in self._worker_sockets.itervalues():\n socket.close()\n\n # terminate the context\n self._ctx.term()", "metadata": "root.ZmqTornadoIntegrationTest.tearDown", "header": "['class', 'ZmqTornadoIntegrationTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def _setup_mgmt_sockets(self):\n\n self._mgmt_sockets = dict()\n\n # adress for the communication from master to worker(s)\n mgmt_master_worker = 'inproc://master/worker/coordination/'\n\n # connect the master with the worker\n # the master is a ZMQStream because we are sending msgs from the test\n sock = self._ctx.socket(zmq.PUB)\n sock.bind(mgmt_master_worker)\n self._mgmt_sockets['tmp1'] = sock\n self._mgmt_sockets['master_pub'] = ZMQStream(sock, self._io_loop)\n # the worker stream is created inside the ZmqMgmt class\n self._mgmt_sockets['worker_sub'] = self._ctx.socket(zmq.SUB)\n self._mgmt_sockets['worker_sub'].setsockopt(zmq.SUBSCRIBE, \"\")\n self._mgmt_sockets['worker_sub'].connect(mgmt_master_worker)\n\n # adress for the communication from worker(s) to master\n mgmt_worker_master = 'inproc://worker/master/coordination/'\n\n # connect the worker with the master\n self._mgmt_sockets['worker_pub'] = self._ctx.socket(zmq.PUB)\n self._mgmt_sockets['worker_pub'].bind(mgmt_worker_master)\n sock = self._ctx.socket(zmq.SUB)\n sock.setsockopt(zmq.SUBSCRIBE, \"\")\n sock.connect(mgmt_worker_master)\n self._mgmt_sockets['tmp2'] = sock\n self._mgmt_sockets['master_sub'] = ZMQStream(sock, self._io_loop)", "metadata": "root.ZmqTornadoIntegrationTest._setup_mgmt_sockets", "header": "['class', 'ZmqTornadoIntegrationTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def _setup_data_sockets(self):\n\n self._worker_sockets = dict()\n\n # address for master -> worker communication\n data_master_worker = 'inproc://master/worker/pipeline/'\n\n sock = self._ctx.socket(zmq.PUSH)\n sock.bind(data_master_worker)\n self._worker_sockets['tmp3'] = sock\n self._worker_sockets['master_push'] = ZMQStream(sock, self._io_loop)\n self._worker_sockets['worker_pull'] = self._ctx.socket(zmq.PULL)\n self._worker_sockets['worker_pull'].connect(data_master_worker)\n\n # address for worker -> master communication\n data_worker_master = 'inproc://worker/master/pipeline/'\n\n self._worker_sockets['worker_pub'] = self._ctx.socket(zmq.PUB)\n self._worker_sockets['worker_pub'].bind(data_worker_master)\n sock = self._ctx.socket(zmq.SUB)\n sock.setsockopt(zmq.SUBSCRIBE, \"\")\n sock.connect(data_worker_master)\n self._worker_sockets['tmp4'] = sock\n self._worker_sockets['master_sub'] = ZMQStream(sock, self._io_loop)", "metadata": "root.ZmqTornadoIntegrationTest._setup_data_sockets", "header": "['class', 'ZmqTornadoIntegrationTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 105 }, { "content": " def on_mgmt_end(self, _msg):\n self._io_loop.stop()", "metadata": "root.ZmqTornadoIntegrationTest.on_mgmt_end", "header": "['class', 'ZmqTornadoIntegrationTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 130 }, { "content": "class ZmqWorkerIntegrationTest(ZmqTornadoIntegrationTest):\n \n", "metadata": "root.ZmqWorkerIntegrationTest", "header": "['module', '___EOS___']", "index": 134 }, { "content": " def echo_processing(self, crawl_uri):\n death = MgmtMessage(topic=ZMQ_SPYDER_MGMT_WORKER,\n data=ZMQ_SPYDER_MGMT_WORKER_QUIT)\n self._mgmt_sockets['master_pub'].send_multipart(death.serialize())\n return crawl_uri", "metadata": "root.ZmqWorkerIntegrationTest.echo_processing", "header": "['class', 'ZmqWorkerIntegrationTest', '(', 'ZmqTornadoIntegrationTest', ')', ':', '___EOS___']", "index": 136 }, { "content": " def test_that_stopping_worker_via_mgmt_works(self):\n\n worker = ZmqWorker( self._worker_sockets['worker_pull'],\n self._worker_sockets['worker_pub'],\n self._mgmt,\n self.echo_processing,\n StreamHandler(sys.stdout),\n logging.DEBUG,\n self._io_loop)\n\n worker.start()\n\n curi = CrawlUri(url=\"http://localhost\")\n msg = DataMessage()\n msg.identity = \"me\"\n msg.curi = curi\n\n def assert_correct_data_answer(msg2):\n self.assertEqual(msg, DataMessage(msg2))\n\n self._worker_sockets['master_sub'].on_recv(assert_correct_data_answer)\n\n def assert_correct_mgmt_answer(msg3):\n self.assertEqual(ZMQ_SPYDER_MGMT_WORKER_QUIT_ACK, msg3.data)\n\n self._mgmt_sockets['master_sub'].on_recv(assert_correct_data_answer)\n\n self._worker_sockets['master_push'].send_multipart(msg.serialize())\n\n self._io_loop.start()", "metadata": "root.ZmqWorkerIntegrationTest.test_that_stopping_worker_via_mgmt_works", "header": "['class', 'ZmqWorkerIntegrationTest', '(', 'ZmqTornadoIntegrationTest', ')', ':', '___EOS___']", "index": 142 } ]
[ { "span": "import time", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 11 }, { "span": "from zmq import Socket", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 22 }, { "span": "from spyder.core.worker import ZmqWorker, AsyncZmqWorker", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", " ", "Dan", "iel", " ", "Tru", "emp", "er", " ", "true", "mpe", "d", "@", "google", "mail", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test\\u", "worker", ".", "py", " ", "11", "-", "Jan", "-", "2011_", "\\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_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logging_", "import_", "Stream", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zmq_", "import_", "Socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zmq_", "._", "eventl", "oop", "_", "._", "ioloop_", "import_", "IO", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zmq_", "._", "eventl", "oop", "_", "._", "zmq", "stream_", "import_", "ZM", "QS", "tream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "constants_", "import_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "constants_", "import_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "\\u", "QUIT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "constants_", "import_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "\\u", "QUI", "T", "\\u", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "mgmt_", "import_", "Zm", "q", "Mgmt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "worker_", "import_", "Zm", "q", "Worker_", ",_", "Async", "Zm", "q", "Worker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "messages_", "import_", "Data", "Message_", ",_", "Mgmt", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "thrift", "_", "._", "gen_", "._", "ttype", "s_", "import_", "Crawl", "Uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "io", "\\u", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "io", "\\u", "loop_", "=_", "IO", "Loop_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ctx_", "=_", "zmq_", "._", "Context_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "the", " ", "mg", "mt", " ", "sockets_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "mg", "mt", "\\u", "sockets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "the", " ", "data", " ", "sockets_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "data\\u", "sockets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "the", " ", "manage", "ment", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "mgmt_", "=_", "Zm", "q", "Mgmt", "_", "(_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "worker", "\\u", "sub", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pub", "'_", "]_", ",_", "io", "\\u", "loop_", "=_", "self_", "._", "\\u", "io", "\\u", "loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mgmt_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mgmt_", "._", "add", "\\u", "callback_", "(_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "_", ",_", "self_", "._", "on", "\\u", "mg", "mt", "\\u", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "stop", " ", "the", " ", "mgmt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mgmt_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "close", " ", "all", " ", "sockets_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "socket_", "in_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "socket_", "in_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "terminate", " ", "the", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "ctx_", "._", "term_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "mg", "mt", "\\u", "sockets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adress", " ", "for", " ", "the", " ", "communication", " ", "from", " ", "master", " ", "to", " ", "worker", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "mg", "mt", "\\u", "master", "\\u", "worker_", "=_", "'", "inpr", "oc", "://", "master", "/", "worker", "/", "coordin", "ation", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connect", " ", "the", " ", "master", " ", "with", " ", "the", " ", "worker_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "master", " ", "is", " ", "a", " ", "ZM", "QS", "tream", " ", "bec", "aus", "e", " ", "we", " ", "are", " ", "sendin", "g", " ", "msgs", " ", "from", " ", "the", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "sock_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "PUB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "bind_", "(_", "mg", "mt", "\\u", "master", "\\u", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "tmp1", "'_", "]_", "=_", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "master", "\\u", "pub", "'_", "]_", "=_", "ZM", "QS", "tream_", "(_", "sock_", ",_", "self_", "._", "\\u", "io", "\\u", "loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "worker", " ", "stream", " ", "is", " ", "created", " ", "insi", "de", " ", "the", " ", "Zm", "q", "Mgmt", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "worker", "\\u", "sub", "'_", "]_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "SUB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "worker", "\\u", "sub", "'_", "]_", "._", "setsockopt_", "(_", "zmq_", "._", "SUBSCRI", "BE_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "worker", "\\u", "sub", "'_", "]_", "._", "connect_", "(_", "mg", "mt", "\\u", "master", "\\u", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adress", " ", "for", " ", "the", " ", "communication", " ", "from", " ", "worker", "(", "s", ")", " ", "to", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "mg", "mt", "\\u", "worker", "\\u", "master_", "=_", "'", "inpr", "oc", "://", "worker", "/", "master", "/", "coordin", "ation", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connect", " ", "the", " ", "worker", " ", "with", " ", "the", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pub", "'_", "]_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "PUB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pub", "'_", "]_", "._", "bind_", "(_", "mg", "mt", "\\u", "worker", "\\u", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "SUB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "setsockopt_", "(_", "zmq_", "._", "SUBSCRI", "BE_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "connect_", "(_", "mg", "mt", "\\u", "worker", "\\u", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "tmp", "2", "'_", "]_", "=_", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "master", "\\u", "sub", "'_", "]_", "=_", "ZM", "QS", "tream_", "(_", "sock_", ",_", "self_", "._", "\\u", "io", "\\u", "loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "data\\u", "sockets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "worker", "\\u", "sockets_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "address", " ", "for", " ", "master", " ", "->", " ", "worker", " ", "communication", "_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "master", "\\u", "worker_", "=_", "'", "inpr", "oc", "://", "master", "/", "worker", "/", "pipeline", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sock_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "PUSH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "bind_", "(_", "data\\u", "master", "\\u", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "tmp", "3", "'_", "]_", "=_", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "master", "\\u", "push", "'_", "]_", "=_", "ZM", "QS", "tream_", "(_", "sock_", ",_", "self_", "._", "\\u", "io", "\\u", "loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pull", "'_", "]_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "PUL", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pull", "'_", "]_", "._", "connect_", "(_", "data\\u", "master", "\\u", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "address", " ", "for", " ", "worker", " ", "->", " ", "master", " ", "communication", "_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "worker", "\\u", "master_", "=_", "'", "inpr", "oc", "://", "worker", "/", "master", "/", "pipeline", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pub", "'_", "]_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "PUB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pub", "'_", "]_", "._", "bind_", "(_", "data\\u", "worker", "\\u", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "self_", "._", "\\u", "ctx_", "._", "socket_", "(_", "zmq_", "._", "SUB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "setsockopt_", "(_", "zmq_", "._", "SUBSCRI", "BE_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "connect_", "(_", "data\\u", "worker", "\\u", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "tmp", "4", "'_", "]_", "=_", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "master", "\\u", "sub", "'_", "]_", "=_", "ZM", "QS", "tream_", "(_", "sock_", ",_", "self_", "._", "\\u", "io", "\\u", "loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "mg", "mt", "\\u", "end_", "(_", "self_", ",_", "\\u", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "io", "\\u", "loop_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Zm", "q", "Worke", "r", "Integrati", "on", "Test_", "(_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", ")_", ":_", "\\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_", "Zm", "q", "Worke", "r", "Integrati", "on", "Test_", "(_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "echo", "\\u", "processing_", "(_", "self_", ",_", "crawl", "\\u", "uri_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "death", "_", "=_", "Mgmt", "Message_", "(_", "topic_", "=_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "\\u", "QUIT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "master", "\\u", "pub", "'_", "]_", "._", "send", "\\u", "multipart_", "(_", "death", "_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "crawl", "\\u", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zm", "q", "Worke", "r", "Integrati", "on", "Test_", "(_", "Zm", "q", "Tor", "nad", "o", "Integrati", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tha", "t", "\\u", "stopping", "\\u", "worker", "\\u", "via", "\\u", "mg", "mt", "\\u", "works_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "worker_", "=_", "Zm", "q", "Worker_", "(_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pull", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "worker", "\\u", "pub", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "mgmt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "echo", "\\u", "processing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stream", "Handler_", "(_", "sys_", "._", "stdout_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "DEBUG_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "io", "\\u", "loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "curi", "_", "=_", "Crawl", "Uri_", "(_", "url_", "=_", "\"", "http", "://", "local", "host", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "Data", "Message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "identity_", "=_", "\"", "me", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "curi", "_", "=_", "curi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "assert", "\\u", "correct", "\\u", "data\\u", "answer_", "(_", "msg", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "msg_", ",_", "Data", "Message_", "(_", "msg", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "master", "\\u", "sub", "'_", "]_", "._", "on", "\\u", "recv_", "(_", "assert", "\\u", "correct", "\\u", "data\\u", "answer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "assert", "\\u", "correct", "\\u", "mg", "mt", "\\u", "answer_", "(_", "msg", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "\\u", "QUI", "T", "\\u", "ACK_", ",_", "msg", "3_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "mg", "mt", "\\u", "sockets_", "[_", "'", "master", "\\u", "sub", "'_", "]_", "._", "on", "\\u", "recv_", "(_", "assert", "\\u", "correct", "\\u", "data\\u", "answer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "worker", "\\u", "sockets_", "[_", "'", "master", "\\u", "push", "'_", "]_", "._", "send", "\\u", "multipart_", "(_", "msg_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "io", "\\u", "loop_", "._", "start_", "(_", ")_", "\\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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etic(self):\n # Supported operations.\n self.assertEqual(Timestamp(123) + 456, 579)\n self.assertEqual(Timestamp(123) + Duration(456), 579)\n self.assertEqual(456 + Timestamp(123), 579)\n self.assertEqual(Duration(456) + Timestamp(123), 579)\n self.assertEqual(Timestamp(123) - 456, -333)\n self.assertEqual(Timestamp(123) - Duration(456), -333)\n self.assertEqual(Timestamp(1230) % 456, 318)\n self.assertEqual(Timestamp(1230) % Duration(456), 318)\n\n # Check that direct comparison of Timestamp and Duration is allowed.\n self.assertTrue(Duration(123) == Timestamp(123))\n self.assertTrue(Timestamp(123) == Duration(123))\n self.assertFalse(Duration(123) == Timestamp(1230))\n self.assertFalse(Timestamp(123) == Duration(1230))\n\n # Check return types.\n self.assertEqual((Timestamp(123) + 456).__class__, Timestamp)\n self.assertEqual((Timestamp(123) + Duration(456)).__class__, Timestamp)\n self.assertEqual((456 + Timestamp(123)).__class__, Timestamp)\n self.assertEqual((Duration(456) + Timestamp(123)).__class__, Timestamp)\n self.assertEqual((Timestamp(123) - 456).__class__, Timestamp)\n self.assertEqual((Timestamp(123) - Duration(456)).__class__, Timestamp)\n self.assertEqual((Timestamp(1230) % 456).__class__, Duration)\n self.assertEqual((Timestamp(1230) % Duration(456)).__class__, Duration)\n\n # Unsupported operations.\n with self.assertRaises(TypeError):\n self.assertEqual(Timestamp(123) * 456, 56088)\n with self.assertRaises(TypeError):\n self.assertEqual(Timestamp(123) * Duration(456), 56088)\n with self.assertRaises(TypeError):\n self.assertEqual(456 * Timestamp(123), 56088)\n with self.assertRaises(TypeError):\n self.assertEqual(Duration(456) * Timestamp(123), 56088)\n with self.assertRaises(TypeError):\n self.assertEqual(456 - Timestamp(123), 333)\n with self.assertRaises(TypeError):\n self.assertEqual(Duration(456) - Timestamp(123), 333)\n with self.assertRaises(TypeError):\n self.assertEqual(-Timestamp(123), -123)\n with self.assertRaises(TypeError):\n self.assertEqual(-Timestamp(123), -Duration(123))\n with self.assertRaises(TypeError):\n self.assertEqual(1230 % Timestamp(456), 318)\n with self.assertRaises(TypeError):\n self.assertEqual(Duration(1230) % Timestamp(456), 318)", "metadata": "root.TimestampTest.test_arithmetic", "header": "['class', 'TimestampTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 } ]
[ { "span": "self.assertTrue(Duration(123) == Timestamp(123))", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 52 }, { "span": "self.assertTrue(Timestamp(123) == Duration(123))", "start_line": 62, "start_column": 4, "end_line": 62, "end_column": 52 }, { "span": "self.assertFalse(Duration(123) == Timestamp(1230))", "start_line": 63, "start_column": 4, "end_line": 63, "end_column": 54 }, { "span": "self.assertFalse(Timestamp(123) == Duration(1230))", "start_line": 64, "start_column": 4, "end_line": 64, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Timest", "amp", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "arithmetic", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Supp", "orte", "d", " ", "operati", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123_", ")_", "+_", "456_", ",_", "579", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123_", ")_", "+_", "Duration_", "(_", "456_", ")_", ",_", "579", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "456_", "+_", "Timestamp_", "(_", "123_", ")_", ",_", "579", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Duration_", "(_", "456_", ")_", "+_", "Timestamp_", "(_", "123_", ")_", ",_", "579", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123_", ")_", "-_", "456_", ",_", "-_", "333_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123_", ")_", "-_", "Duration_", "(_", "456_", ")_", ",_", "-_", "333_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123", "0_", ")_", "%_", "456_", ",_", "318", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123", "0_", ")_", "%_", "Duration_", "(_", "456_", ")_", ",_", "318", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "direct", " ", "compa", "ris", "on", " ", "of", " ", "Timest", "amp", " ", "and", " ", "Dur", "ation", " ", "is", " ", "allow", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Duration_", "(_", "123_", ")_", "==_", "Timestamp_", "(_", "123_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Timestamp_", "(_", "123_", ")_", "==_", "Duration_", "(_", "123_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "Duration_", "(_", "123_", ")_", "==_", "Timestamp_", "(_", "123", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "Timestamp_", "(_", "123_", ")_", "==_", "Duration_", "(_", "123", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "return", " ", "types", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "Timestamp_", "(_", "123_", ")_", "+_", "456_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "Timestamp_", "(_", "123_", ")_", "+_", "Duration_", "(_", "456_", ")_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "456_", "+_", "Timestamp_", "(_", "123_", ")_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "Duration_", "(_", "456_", ")_", "+_", "Timestamp_", "(_", "123_", ")_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "Timestamp_", "(_", "123_", ")_", "-_", "456_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "Timestamp_", "(_", "123_", ")_", "-_", "Duration_", "(_", "456_", ")_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "Timestamp_", "(_", "123", "0_", ")_", "%_", "456_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "Timestamp_", "(_", "123", "0_", ")_", "%_", "Duration_", "(_", "456_", ")_", ")_", "._", "\\u\\u", "class\\u\\u_", ",_", "Duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unsu", "ppo", "rted", " ", "operati", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123_", ")_", "*_", "456_", ",_", "560", "88_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Timestamp_", "(_", "123_", ")_", "*_", "Duration_", "(_", "456_", ")_", ",_", "560", "88_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "456_", "*_", "Timestamp_", "(_", "123_", ")_", ",_", "560", "88_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Duration_", "(_", "456_", ")_", "*_", "Timestamp_", "(_", "123_", ")_", ",_", "560", "88_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "456_", "-_", "Timestamp_", "(_", "123_", ")_", ",_", "333_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Duration_", "(_", "456_", ")_", "-_", "Timestamp_", "(_", "123_", ")_", ",_", "333_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "-_", "Timestamp_", "(_", "123_", ")_", ",_", "-_", "123_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "-_", "Timestamp_", "(_", "123_", ")_", ",_", "-_", "Duration_", "(_", "123_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "123", "0_", "%_", "Timestamp_", "(_", "456_", ")_", ",_", "318", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Duration_", "(_", "123", "0_", ")_", "%_", "Timestamp_", "(_", "456_", ")_", ",_", "318", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison using is when operands support `__eq__`
GoogleCloudPlatform/gcloud-python/gcloud/bigtable/test_client.py
[ { "content": " def test_credentials_getter(self):\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n self.assertTrue(client.credentials is credentials)", "metadata": "root.TestClient.test_credentials_getter", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 149 }, { "content": " def test_constructor(self):\n from gcloud.bigtable.client import Client\n from gcloud.bigtable.client import DATA_SCOPE\n\n credentials = _Credentials()\n project = 'PROJECT'\n user_agent = 'USER_AGENT'\n client = Client(project=project, credentials=credentials,\n user_agent=user_agent)\n transformer = self._makeOne(client)\n self.assertTrue(transformer._credentials is credentials)\n self.assertEqual(transformer._user_agent, user_agent)\n self.assertEqual(credentials.scopes, [DATA_SCOPE])", "metadata": "root.Test_MetadataPlugin.test_constructor", "header": "['class', 'Test_MetadataPlugin', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 633 }, { "content": "class _Credentials(object):\n\n scopes = None\n\n\n\n", "metadata": "root._Credentials", "header": "['module', '___EOS___']", "index": 749 }, { "content": " def __init__(self, access_token=None):\n self._access_token = access_token\n self._tokens = []", "metadata": "root._Credentials.__init__", "header": "['class', '_Credentials', '(', 'object', ')', ':', '___EOS___']", "index": 753 }, { "content": " def get_access_token(self):\n from oauth2client.client import AccessTokenInfo\n token = AccessTokenInfo(access_token=self._access_token,\n expires_in=None)\n self._tokens.append(token)\n return token", "metadata": "root._Credentials.get_access_token", "header": "['class', '_Credentials', '(', 'object', ')', ':', '___EOS___']", "index": 757 }, { "content": " def create_scoped(self, scope):\n self.scopes = scope\n return self", "metadata": "root._Credentials.create_scoped", "header": "['class', '_Credentials', '(', 'object', ')', ':', '___EOS___']", "index": 764 }, { "content": " def __eq__(self, other):\n return self._access_token == other._access_token", "metadata": "root._Credentials.__eq__", "header": "['class', '_Credentials', '(', 'object', ')', ':', '___EOS___']", "index": 768 } ]
[ { "span": "client.credentials is credentials)", "start_line": 153, "start_column": 24, "end_line": 153, "end_column": 57 }, { "span": "transformer._credentials is credentials)", "start_line": 643, "start_column": 24, "end_line": 643, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Compari", "son_", "using_", "is_", "when_", "operands_", "support_", " _", "`_", "\\u\\u", "eq\\u\\u_", "`_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cred", "ential", "s", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "credentials_", "is_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Meta", "data", "Plugin_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "constructor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "DATA", "\\u", "SCOPE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "agent_", "=_", "'", "USER", "\\u", "AGE", "NT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Client_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "agent_", "=_", "user", "\\u", "agent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transformer_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "transformer_", "._", "\\u", "credentials_", "is_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "transformer_", "._", "\\u", "user", "\\u", "agent_", ",_", "user", "\\u", "agent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "credentials_", "._", "scopes_", ",_", "[_", "DATA", "\\u", "SCOPE", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Credentials_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scopes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Credentials_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "access", "\\u", "token_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "access", "\\u", "token_", "=_", "access", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "tokens_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Credentials_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "access", "\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "oauth2", "client_", "._", "client_", "import_", "Access", "Token", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "Access", "Token", "Info_", "(_", "access", "\\u", "token_", "=_", "self_", "._", "\\u", "access", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expir", "es", "\\u", "in_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "tokens_", "._", "append_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Credentials_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "scoped", "_", "(_", "self_", ",_", "scope_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scopes_", "=_", "scope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Credentials_", "(_", "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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
openstack/ironic-python-agent/ironic_python_agent/extensions/iscsi.py
[ { "content": "def _execute(cmd, error_msg, **kwargs):\n try:\n stdout, stderr = utils.execute(*cmd, **kwargs)\n except (processutils.ProcessExecutionError, OSError) as e:\n LOG.error(error_msg)\n raise errors.ISCSICommandError(error_msg, e.exit_code,\n e.stdout, e.stderr)", "metadata": "root._execute", "header": "['module', '___EOS___']", "index": 36 } ]
[ { "span": "stdout,", "start_line": 38, "start_column": 8, "end_line": 38, "end_column": 14 }, { "span": "stderr ", "start_line": 38, "start_column": 16, "end_line": 38, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "execute_", "(_", "cmd_", ",_", "error", "\\u", "msg_", ",_", "**_", "kwargs_", ")_", ":_", "\\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 ", " _", "stdout_", ",_", "stderr_", "=_", "utils_", "._", "execute_", "(_", "*_", "cmd_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "process", "utils_", "._", "Process", "Execut", "ion", "Error_", ",_", "OSE", "rror_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "error_", "(_", "error", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "ISCSI", "Command", "Error_", "(_", "error", "\\u", "msg_", ",_", "e_", "._", "exit", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "e_", "._", "stdout_", ",_", "e_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
retresco/Spyder/test/test_workerprocess_fetcher.py
[ { "content": "#\n# Copyright (c) 2011 Daniel Truemper [email protected]\n#\n# test_workerprocess_fetcher.py 19-Jan-2011\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nimport logging\nfrom logging import StreamHandler\nimport sys\n\nimport unittest\nimport time\n\nimport zmq\nfrom zmq.eventloop.ioloop import IOLoop\nfrom zmq.eventloop.zmqstream import ZMQStream\n\nfrom spyder.core.constants import CURI_OPTIONAL_TRUE\nfrom spyder.core.constants import CURI_EXTRACTION_FINISHED\nfrom spyder.core.constants import ZMQ_SPYDER_MGMT_WORKER\nfrom spyder.core.settings import Settings\nfrom spyder.core.worker import AsyncZmqWorker\nfrom spyder import workerprocess\n\nfrom spyder.processor.fetcher import FetchProcessor\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class WorkerExtractorTestCase(unittest.TestCase):\n", "metadata": "root.WorkerExtractorTestCase", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def test_that_creating_fetcher_works(self):\n ctx = zmq.Context()\n io_loop = IOLoop.instance()\n\n def stop_looping(_msg):\n io_loop.stop()\n\n settings = Settings()\n\n master_push = ctx.socket(zmq.PUSH)\n master_push.bind(settings.ZEROMQ_MASTER_PUSH)\n\n fetcher = workerprocess.create_worker_fetcher(settings, {}, ctx,\n StreamHandler(sys.stdout), io_loop)\n\n self.assertTrue(isinstance(fetcher._processing, FetchProcessor))\n self.assertTrue(isinstance(fetcher, AsyncZmqWorker))\n\n fetcher._insocket.close()\n fetcher._outsocket.close()\n master_push.close()\n ctx.term()", "metadata": "root.WorkerExtractorTestCase.test_that_creating_fetcher_works", "header": "['class', 'WorkerExtractorTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 } ]
[ { "span": "import logging", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 14 }, { "span": "import time", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 11 }, { "span": "from zmq.eventloop.zmqstream import ZMQStream", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 45 }, { "span": "from spyder.core.constants import CURI_OPTIONAL_TRUE", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 52 }, { "span": "from spyder.core.constants import CURI_EXTRACTION_FINISHED", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 58 }, { "span": "from spyder.core.constants import ZMQ_SPYDER_MGMT_WORKER", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", " ", "Dan", "iel", " ", "Tru", "emp", "er", " ", "true", "mpe", "d", "@", "google", "mail", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test\\u", "worker", "process", "\\u", "fetch", "er", ".", "py", " ", "1", "9", "-", "Jan", "-", "2011_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logging_", "import_", "Stream", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zmq_", "._", "eventl", "oop", "_", "._", "ioloop_", "import_", "IO", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zmq_", "._", "eventl", "oop", "_", "._", "zmq", "stream_", "import_", "ZM", "QS", "tream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "constants_", "import_", "CUR", "I", "\\u", "OPTIONAL", "\\u", "TRUE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "constants_", "import_", "CUR", "I", "\\u", "EXTRACT", "ION", "\\u", "FINISH", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "constants_", "import_", "ZM", "Q", "\\u", "SP", "YD", "ER", "\\u", "MG", "MT", "\\u", "WORKER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "settings_", "import_", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "._", "core_", "._", "worker_", "import_", "Async", "Zm", "q", "Worker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spy", "der_", "import_", "worker", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "spy", "der_", "._", "processor_", "._", "fetcher_", "import_", "Fe", "tch", "Processor_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Worke", "r", "Extract", "or", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Worke", "r", "Extract", "or", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "tha", "t", "\\u", "creati", "ng", "\\u", "fetch", "er", "\\u", "works_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "=_", "zmq_", "._", "Context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io", "\\u", "loop_", "=_", "IO", "Loop_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stop", "\\u", "looping", "_", "(_", "\\u", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io", "\\u", "loop_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "settings_", "=_", "Settings_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "push_", "=_", "ctx_", "._", "socket_", "(_", "zmq_", "._", "PUSH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master", "\\u", "push_", "._", "bind_", "(_", "settings_", "._", "ZERO", "MQ", "\\u", "MASTER", "\\u", "PUSH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fetcher_", "=_", "worker", "process_", "._", "create", "\\u", "worker", "\\u", "fetcher_", "(_", "settings_", ",_", "{_", "}_", ",_", "ctx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stream", "Handler_", "(_", "sys_", "._", "stdout_", ")_", ",_", "io", "\\u", "loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "fetcher_", "._", "\\u", "processing_", ",_", "Fe", "tch", "Processor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "fetcher_", ",_", "Async", "Zm", "q", "Worker_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fetcher_", "._", "\\u", "ins", "ocket", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetcher_", "._", "\\u", "outs", "ocket", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master", "\\u", "push_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "term_", "(_", ")_", "\\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, 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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 ]
Testing equality to None
tartavull/snn-rl/furtherFormulas/testingProcesses.py
[ { "content": "def evaluateClassifierPerf2(ADDSObj, testRun):\n\t# Negative results below are only set to be measured after a full spike interval has passed and had the opportunity to have created a spike\n\t# Only evaluate results for enough epochs to test each char in input (3 spike interv per char * 4 char = 12 spike intervals total)\n\t# the +1 in (totalSpikeIntervals+1) is to allow a last refractoryPointSwitch triggered negative spike evaluation to occur.\n\t# * A change was made to the scoring to not count the 0.0-0.1 second period because the input spike generator does not start until .1\n\t# seconds and the first occurences of output spikes should be monitored looking at .2 seconds to see if any occured in seconds .1-.2 .\t\n\n\t# Only assign neuron to first window it fires in\n\t# multiple neurons firing in the same window is not accounted for\n\t# TODO: properly constrict testing windows for scoring using testingSpikeWindows\n\n\tcurrentSpikeIntervalTime = timeAndRefrac.spikeIntervalCounter\n\tneuronsWithoutSpikes = 0\n\tcurrentWindow = math.floor(Decimal(format((currentSpikeIntervalTime-2), '.1f'))/Decimal(format(testingSpikesPerChar, '.1f')))\n\n\tif timeAndRefrac.refractoryPointSwitch == True:\n\t\tif (currentSpikeIntervalTime >= 2) and (currentSpikeIntervalTime <= (totalSpikeIntervals+1)):\n\t\t\tfor neuronIndex in range(dictionaryLongitude):\t\t\t\t\n\t\t\t\tif (ADDSObj.UmSpikeFired[neuronIndex] == 1*mV):\n\t\t\t\t\tif (testRun.firedSpikes[currentSpikeIntervalTime]) == None:\n\t\t\t\t\t\ttestRun.firedSpikes[currentSpikeIntervalTime] = np.array([neuronIndex])\n\t\t\t\t\telse:\n\t\t\t\t\t\tfiredSpikes2 = []\n\t\t\t\t\t\tfor elemIndex in range(len(testRun.firedSpikes)): \n\t\t\t\t\t\t\tif elemIndex == currentSpikeIntervalTime: \n\t\t\t\t\t\t\t\tnewElem = testRun.firedSpikes[elemIndex].tolist()\n\t\t\t\t\t\t\t\tnewElem.append([neuronIndex])\n\t\t\t\t\t\t\t\tfiredSpikes2.append(np.array(newElem))\n\t\t\t\t\t\t\telse: \n\t\t\t\t\t\t\t\tfiredSpikes2.append(testRun.firedSpikes[elemIndex])\n\t\t\t\t\t\ttestRun.firedSpikes = np.array(firedSpikes2)\n\n\t\t\t\t\tneuronAssignedToWindow = False\n\t\t\t\t\tfor neuronWindowAssignment in testRun.assignedSpikeWindows:\n\t\t\t\t\t\tif neuronWindowAssignment == currentWindow:\n\t\t\t\t\t\t\tneuronAssignedToWindow = True\n\n\t\t\t\t\tif neuronAssignedToWindow == False and testRun.assignedSpikeWindows[neuronIndex] == None:\n\t\t\t\t\t\ttestRun.assignedSpikeWindows[neuronIndex] = currentWindow\n\n\t\t\t\t\tif testRun.assignedSpikeWindows[neuronIndex] == currentWindow:\n\t\t\t\t\t\ttestRun.truePositiveSpikeResults = testRun.truePositiveSpikeResults + 1\t\n\t\t\t\t\t\t#print 'TP found\\t','self.testSpikeIntervalCounter-1\\t',timeAndRefrac.spikeIntervalCounter-1,'neuronIndex\\t',neuronIndex\n\t\t\t\t\telse:\n\t\t\t\t\t\ttestRun.falsePositiveSpikeResults = testRun.falsePositiveSpikeResults + 1\n\t\t\t\telif (ADDSObj.UmSpikeFired[neuronIndex] == 0*mV):\n\t\t\t\t\ttestRun.trueNegativeSpikeResults = testRun.trueNegativeSpikeResults + 1\n\t\t\t\t\tneuronsWithoutSpikes += 1\n\n\t\t\t\tif neuronsWithoutSpikes == dictionaryLongitude:\n\t\t\t\t\ttestRun.trueNegativeSpikeResults = testRun.trueNegativeSpikeResults - 1\n\t\t\tcorrectNeuronFound = False\n\t\t\t#print 'ADDSObj.t',ADDSObj.t,'testRun.firedSpikes', testRun.firedSpikes\n\t\t\tfor spikedNeurons in testRun.firedSpikes:\n\t\t\t\tif len(spikedNeurons) > 1 or spikedNeurons != [None]:\n\t\t\t\t\tfor spikedNeuronNumber in spikedNeurons:\n\t\t\t\t\t\tif spikedNeuronNumber != None and currentWindow == testRun.assignedSpikeWindows[spikedNeuronNumber]:\n\t\t\t\t\t\t\tcorrectNeuronFound = True\n\t\t\tif correctNeuronFound == False:\n\t\t\t\ttestRun.falseNegativeSpikeResults = testRun.falseNegativeSpikeResults + 1\n\t\tfor neuronIndex in range(dictionaryLongitude):\t\t\t\t\t\t\t\t\t\t\t\n\t\t\tADDSObj.UmSpikeFired[neuronIndex] = 0*mV\n\n\treturn ADDSObj.UmSpikeFired, testRun\t", "metadata": "root.evaluateClassifierPerf2", "header": "['module', '___EOS___']", "index": 73 } ]
[ { "span": "(testRun.firedSpikes[currentSpikeIntervalTime]) == None:", "start_line": 92, "start_column": 8, "end_line": 92, "end_column": 63 }, { "span": "testRun.assignedSpikeWindows[neuronIndex] == None:", "start_line": 110, "start_column": 44, "end_line": 110, "end_column": 93 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "evaluate", "Classif", "ier", "Perf", "2_", "(_", "ADD", "SO", "bj_", ",_", "test", "Run_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Nega", "tiv", "e", " ", "results", " ", "belo", "w", " ", "are", " ", "only", " ", "set", " ", "to", " ", "be", " ", "measure", "d", " ", "after", " ", "a", " ", "full", " ", "spike", " ", "interval", " ", "has", " ", "pass", "ed", " ", "and", " ", "had", " ", "the", " ", "opportunit", "y", " ", "to", " ", "have", " ", "created", " ", "a", " ", "spike", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "evaluate", " ", "results", " ", "for", " ", "eno", "ugh", " ", "epoch", "s", " ", "to", " ", "test", " ", "each", " ", "char", " ", "in", " ", "input", " ", "(", "3", " ", "spike", " ", "interv", " ", "per", " ", "char", " ", "*", " ", "4", " ", "char", " ", "=", " ", "1", "2", " ", "spike", " ", "interval", "s", " ", "total", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "+", "1", " ", "in", " ", "(", "total", "Spike", "Intervals", "+", "1", ")", " ", "is", " ", "to", " ", "allow", " ", "a", " ", "last", " ", "refra", "ctor", "y", "Point", "Switch", " ", "trigger", "ed", " ", "negati", "ve", " ", "spike", " ", "evaluat", "ion", " ", "to", " ", "occur", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "A", " ", "change", " ", "was", " ", "made", " ", "to", " ", "the", " ", "scor", "ing", " ", "to", " ", "not", " ", "count", " ", "the", " ", "0.", "0", "-0", ".1", " ", "second", " ", "period", " ", "bec", "aus", "e", " ", "the", " ", "input", " ", "spike", " ", "generat", "or", " ", "doe", "s", " ", "not", " ", "start", " ", "unti", "l", " ", ".1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "second", "s", " ", "and", " ", "the", " ", "first", " ", "occure", "nce", "s", " ", "of", " ", "output", " ", "spike", "s", " ", "shou", "ld", " ", "be", " ", "monitored", " ", "look", "ing", " ", "at", " ", ".2", " ", "second", "s", " ", "to", " ", "see", " ", "if", " ", "any", " ", "occure", "d", " ", "in", " ", "second", "s", " ", ".1", "-.", "2", " ", ".", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "assign", " ", "neuro", "n", " ", "to", " ", "first", " ", "window", " ", "it", " ", "fires", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multiple", " ", "neuro", "ns", " ", "fir", "ing", " ", "in", " ", "the", " ", "same", " ", "window", " ", "is", " ", "not", " ", "account", "ed", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "proper", "ly", " ", "constr", "ict", " ", "testi", "ng", " ", "windows", " ", "for", " ", "scor", "ing", " ", "usi", "ng", " ", "testi", "ng", "Spike", "Windows_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "current", "Spike", "Interv", "al", "Time_", "=_", "time", "And", "Refr", "ac_", "._", "spike", "Interv", "al", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neuro", "ns", "With", "out", "Spike", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "Window_", "=_", "math_", "._", "floor_", "(_", "Decimal_", "(_", "format_", "(_", "(_", "current", "Spike", "Interv", "al", "Time_", "-_", "2_", ")_", ",_", "'.", "1f", "'_", ")_", ")_", "/_", "Decimal_", "(_", "format_", "(_", "testi", "ng", "Spike", "s", "Per", "Char_", ",_", "'.", "1f", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "time", "And", "Refr", "ac_", "._", "refra", "ctor", "y", "Point", "Switch_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "(_", "current", "Spike", "Interv", "al", "Time_", ">=_", "2_", ")_", "and_", "(_", "current", "Spike", "Interv", "al", "Time_", "<=_", "(_", "total", "Spike", "Intervals", "_", "+_", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "neuro", "n", "Index_", "in_", "range_", "(_", "dictionar", "y", "Long", "itude_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "(_", "ADD", "SO", "bj_", "._", "Um", "Spike", "Fire", "d_", "[_", "neuro", "n", "Index_", "]_", "==_", "1_", "*_", "m", "V_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "(_", "test", "Run_", "._", "fired", "Spike", "s_", "[_", "current", "Spike", "Interv", "al", "Time_", "]_", ")_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "test", "Run_", "._", "fired", "Spike", "s_", "[_", "current", "Spike", "Interv", "al", "Time_", "]_", "=_", "np_", "._", "array_", "(_", "[_", "neuro", "n", "Index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "fired", "Spike", "s2_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "elem", "Index_", "in_", "range_", "(_", "len_", "(_", "test", "Run_", "._", "fired", "Spike", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "if_", "elem", "Index_", "==_", "current", "Spike", "Interv", "al", "Time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "new", "Elem_", "=_", "test", "Run_", "._", "fired", "Spike", "s_", "[_", "elem", "Index_", "]_", "._", "tolist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Elem_", "._", "append_", "(_", "[_", "neuro", "n", "Index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fired", "Spike", "s2_", "._", "append_", "(_", "np_", "._", "array_", "(_", "new", "Elem_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "fired", "Spike", "s2_", "._", "append_", "(_", "test", "Run_", "._", "fired", "Spike", "s_", "[_", "elem", "Index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test", "Run_", "._", "fired", "Spike", "s_", "=_", "np_", "._", "array_", "(_", "fired", "Spike", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "neuro", "n", "Assign", "ed", "To", "Window_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neuro", "n", "Window", "Assignment_", "in_", "test", "Run_", "._", "assign", "ed", "Spike", "Windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "neuro", "n", "Window", "Assignment_", "==_", "current", "Window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "neuro", "n", "Assign", "ed", "To", "Window_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "neuro", "n", "Assign", "ed", "To", "Window_", "==_", "False_", "and_", "test", "Run_", "._", "assign", "ed", "Spike", "Windows_", "[_", "neuro", "n", "Index_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "test", "Run_", "._", "assign", "ed", "Spike", "Windows_", "[_", "neuro", "n", "Index_", "]_", "=_", "current", "Window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test", "Run_", "._", "assign", "ed", "Spike", "Windows_", "[_", "neuro", "n", "Index_", "]_", "==_", "current", "Window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "test", "Run_", "._", "true", "Posi", "tiv", "e", "Spike", "Results_", "=_", "test", "Run_", "._", "true", "Posi", "tiv", "e", "Spike", "Results_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "TP", " ", "found", "\\\\", "t", "','", "self", ".", "test", "Spike", "Interv", "al", "Counter", "-1", "\\\\", "t", "',", "time", "And", "Refr", "ac", ".", "spike", "Interv", "al", "Counter", "-1", ",'", "neuro", "n", "Index", "\\\\", "t", "',", "neuro", "n", "Index_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "test", "Run_", "._", "fal", "se", "Posi", "tiv", "e", "Spike", "Results_", "=_", "test", "Run_", "._", "fal", "se", "Posi", "tiv", "e", "Spike", "Results_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "ADD", "SO", "bj_", "._", "Um", "Spike", "Fire", "d_", "[_", "neuro", "n", "Index_", "]_", "==_", "0_", "*_", "m", "V_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "test", "Run_", "._", "true", "Nega", "tiv", "e", "Spike", "Results_", "=_", "test", "Run_", "._", "true", "Nega", "tiv", "e", "Spike", "Results_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neuro", "ns", "With", "out", "Spike", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "neuro", "ns", "With", "out", "Spike", "s_", "==_", "dictionar", "y", "Long", "itude_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "test", "Run_", "._", "true", "Nega", "tiv", "e", "Spike", "Results_", "=_", "test", "Run_", "._", "true", "Nega", "tiv", "e", "Spike", "Results_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "correct", "Neuron", "Found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "ADD", "SO", "bj", ".", "t", "',", "ADD", "SO", "bj", ".", "t", ",'", "test", "Run", ".", "fired", "Spike", "s", "',", " ", "test", "Run", ".", "fired", "Spike", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "spike", "d", "Neuron", "s_", "in_", "test", "Run_", "._", "fired", "Spike", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "len_", "(_", "spike", "d", "Neuron", "s_", ")_", ">_", "1_", "or_", "spike", "d", "Neuron", "s_", "!=_", "[_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "for_", "spike", "d", "Neuron", "Number_", "in_", "spike", "d", "Neuron", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "spike", "d", "Neuron", "Number_", "!=_", "None_", "and_", "current", "Window_", "==_", "test", "Run_", "._", "assign", "ed", "Spike", "Windows_", "[_", "spike", "d", "Neuron", "Number_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "correct", "Neuron", "Found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "correct", "Neuron", "Found_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "test", "Run_", "._", "fal", "se", "Nega", "tiv", "e", "Spike", "Results_", "=_", "test", "Run_", "._", "fal", "se", "Nega", "tiv", "e", "Spike", "Results_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "neuro", "n", "Index_", "in_", "range_", "(_", "dictionar", "y", "Long", "itude_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ADD", "SO", "bj_", "._", "Um", "Spike", "Fire", "d_", "[_", "neuro", "n", "Index_", "]_", "=_", "0_", "*_", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ADD", "SO", "bj_", "._", "Um", "Spike", "Fire", "d_", ",_", "test", "Run_", "\\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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
andrewf/pcap2har/pcap2har/httpsession.py
[ { "content": " def __init__(self, request, response):\n self.request = request\n self.response = response\n self.pageref = None\n self.ts_start = ms_from_dpkt_time(request.ts_connect)\n if request.ts_connect is None:\n self.startedDateTime = None\n else:\n self.startedDateTime = datetime.utcfromtimestamp(request.ts_connect)\n # calculate other timings\n self.time_blocked = -1\n self.time_dnsing = -1\n self.time_connecting = (\n ms_from_dpkt_time_diff(request.ts_start, request.ts_connect))\n self.time_sending = (\n ms_from_dpkt_time_diff(request.ts_end, request.ts_start))\n if response is not None:\n self.time_waiting = (\n ms_from_dpkt_time_diff(response.ts_start, request.ts_end))\n self.time_receiving = (\n ms_from_dpkt_time_diff(response.ts_end, response.ts_start))\n endedDateTime = datetime.utcfromtimestamp(response.ts_end)\n self.total_time = ms_from_dpkt_time_diff(response.ts_end, request.ts_connect)\n else:\n # this can happen if the request never gets a response\n self.time_waiting = -1\n self.time_receiving = -1\n self.total_time = -1", "metadata": "root.Entry.__init__", "header": "['class', 'Entry', '(', 'object', ')', ':', '___EOS___']", "index": 33 } ]
[ { "span": "endedDateTime ", "start_line": 54, "start_column": 12, "end_line": 54, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Entry_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request_", "=_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pager", "ef_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ts", "\\u", "start_", "=_", "ms", "\\u", "from", "\\u", "dp", "kt", "\\u", "time_", "(_", "request_", "._", "ts", "\\u", "connect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "ts", "\\u", "connect_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "ed", "Date", "Time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "ed", "Date", "Time_", "=_", "datetime_", "._", "utc", "fromtimestamp_", "(_", "request_", "._", "ts", "\\u", "connect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "other", " ", "timings", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "time", "\\u", "blocked_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "\\u", "dns", "ing_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "\\u", "connecti", "ng_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ms", "\\u", "from", "\\u", "dp", "kt", "\\u", "time", "\\u", "diff_", "(_", "request_", "._", "ts", "\\u", "start_", ",_", "request_", "._", "ts", "\\u", "connect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "\\u", "sendin", "g_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ms", "\\u", "from", "\\u", "dp", "kt", "\\u", "time", "\\u", "diff_", "(_", "request_", "._", "ts", "\\u", "end_", ",_", "request_", "._", "ts", "\\u", "start_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "time", "\\u", "waiting_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ms", "\\u", "from", "\\u", "dp", "kt", "\\u", "time", "\\u", "diff_", "(_", "response_", "._", "ts", "\\u", "start_", ",_", "request_", "._", "ts", "\\u", "end_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "\\u", "receiv", "ing_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ms", "\\u", "from", "\\u", "dp", "kt", "\\u", "time", "\\u", "diff_", "(_", "response_", "._", "ts", "\\u", "end_", ",_", "response_", "._", "ts", "\\u", "start_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ende", "d", "Date", "Time_", "=_", "datetime_", "._", "utc", "fromtimestamp_", "(_", "response_", "._", "ts", "\\u", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "\\u", "time_", "=_", "ms", "\\u", "from", "\\u", "dp", "kt", "\\u", "time", "\\u", "diff_", "(_", "response_", "._", "ts", "\\u", "end_", ",_", "request_", "._", "ts", "\\u", "connect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "can", " ", "happ", "en", " ", "if", " ", "the", " ", "request", " ", "neve", "r", " ", "gets", " ", "a", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "time", "\\u", "waiting_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "\\u", "receiv", "ing_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "\\u", "time_", "=_", "-_", "1_", "\\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 ]
Unused import
nfscan/ocr-process-service/validation/cnpj.py
[ { "content": "__author__ = 'paulo.rodenas'\n\nimport random\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Cnpj:\n \"\"\"\n Utilty class defines certain methods related to Brazilian CNPJs validation\n \"\"\"\n\n\n\n", "metadata": "root.Cnpj", "header": "['module', '___EOS___']", "index": 5 }, { "content": " @staticmethod\n def validate(cnpj):\n \"\"\"\n Method to validate brazilian cnpjs\n Tests:\n\n >>> print Cnpj.validate('61882613000194')\n True\n >>> print Cnpj.validate('61882613000195')\n False\n >>> print Cnpj.validate('53.612.734/0001-98')\n True\n >>> print Cnpj.validate('69.435.154/0001-02')\n True\n >>> print Cnpj.validate('69.435.154/0001-01')\n False\n \"\"\"\n\n # cleaning the cnpj\n cnpj = cnpj.replace(\"-\", \"\")\n cnpj = cnpj.replace(\".\", \"\")\n cnpj = cnpj.replace(\"/\", \"\")\n\n # verifying the length of the cnpj\n if len(cnpj) != 14:\n return False\n\n # finding out the digits\n base_cnpj = cnpj[:-2]\n verificadores = cnpj[-2:]\n\n calculated_digits = Cnpj.calculate_last_digits(base_cnpj)\n\n # returnig\n return bool(verificadores == calculated_digits[0] + calculated_digits[1])", "metadata": "root.Cnpj.validate", "header": "['class', 'Cnpj', ':', '___EOS___']", "index": 10 }, { "content": " @staticmethod\n def calculate_last_digits(cnpj):\n \"\"\"\n Method to calculate the last two cnpj's digits to make it a valid cnpj\n :param cnpj: a base cnpj without the last two digits containing 12 characters\n :return:\n \"\"\"\n\n # verifying the length of the cnpj\n if len(cnpj) != 12:\n raise Exception('It should have 12 characters')\n\n # defining some variables\n lista_validacao_um = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]\n lista_validacao_dois = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]\n\n\n # calculating the first digit\n soma = 0\n id = 0\n for numero in cnpj:\n\n # to do not raise indexerrors\n try:\n lista_validacao_um[id]\n except:\n break\n\n soma += int(numero) * int(lista_validacao_um[id])\n id += 1\n\n soma %= 11\n if soma < 2:\n digito_um = 0\n else:\n digito_um = 11 - soma\n\n digito_um = str(digito_um) # converting to string, for later comparison\n\n # calculating the second digit\n # suming the two lists\n soma = 0\n id = 0\n cnpj += digito_um\n\n # suming the two lists\n for numero in cnpj:\n\n # to do not raise indexerrors\n try:\n lista_validacao_dois[id]\n except:\n break\n\n soma += int(numero) * int(lista_validacao_dois[id])\n id += 1\n\n # defining the digit\n soma = soma % 11\n if soma < 2:\n digito_dois = 0\n else:\n digito_dois = 11 - soma\n\n digito_dois = str(digito_dois)\n\n return [digito_um, digito_dois]", "metadata": "root.Cnpj.calculate_last_digits", "header": "['class', 'Cnpj', ':', '___EOS___']", "index": 46 }, { "content": " @staticmethod\n def format(cnpj):\n \"\"\"\n Method to format cnpj numbers.\n Tests:\n\n >>> print Cnpj.format('53612734000198')\n 53.612.734/0001-98\n \"\"\"\n return \"%s.%s.%s/%s-%s\" % (\n cnpj[0:2], cnpj[2:5], cnpj[5:8], cnpj[8:12], cnpj[12:14] )", "metadata": "root.Cnpj.format", "header": "['class', 'Cnpj', ':', '___EOS___']", "index": 115 } ]
[ { "span": "import random", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "paul", "o", ".", "rod", "ena", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cn", "pj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ut", "ilt", "y", " ", "class", " ", "defin", "es", " ", "cert", "ain", " ", "method", "s", " ", "relate", "d", " ", "to", " ", "Brazil", "ian", " ", "CN", "PJ", "s", " ", "validation", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cn", "pj_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "validate_", "(_", "cn", "pj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "to", " ", "validat", "e", " ", "bra", "zil", "ian", " ", "cn", "pj", "s", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "Cn", "pj", ".", "validat", "e", "('", "618", "826", "1300", "019", "4", "')", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "Cn", "pj", ".", "validat", "e", "('", "618", "826", "1300", "019", "5", "')", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "Cn", "pj", ".", "validat", "e", "('", "53.", "612", ".7", "3", "4", "/", "0001", "-", "98", "')", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "Cn", "pj", ".", "validat", "e", "('", "69.", "435", ".1", "5", "4", "/", "0001", "-0", "2", "')", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "Cn", "pj", ".", "validat", "e", "('", "69.", "435", ".1", "5", "4", "/", "0001", "-0", "1", "')", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clean", "ing", " ", "the", " ", "cn", "pj_", "\\u\\u\\uNL\\u\\u\\u_", "cn", "pj_", "=_", "cn", "pj_", "._", "replace_", "(_", "\"-\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cn", "pj_", "=_", "cn", "pj_", "._", "replace_", "(_", "\".\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cn", "pj_", "=_", "cn", "pj_", "._", "replace_", "(_", "\"/\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", "ing", " ", "the", " ", "length", " ", "of", " ", "the", " ", "cn", "pj_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "cn", "pj_", ")_", "!=_", "14_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "finding", " ", "out", " ", "the", " ", "digits_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base", "\\u", "cn", "pj_", "=_", "cn", "pj_", "[_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verif", "ica", "dor", "es_", "=_", "cn", "pj_", "[_", "-_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "calculated", "\\u", "digits_", "=_", "Cn", "pj_", "._", "calcul", "ate", "\\u", "last", "\\u", "digits_", "(_", "base", "\\u", "cn", "pj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", "ig_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bool_", "(_", "verif", "ica", "dor", "es_", "==_", "calculated", "\\u", "digits_", "[_", "0_", "]_", "+_", "calculated", "\\u", "digits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cn", "pj_", ":_", "\\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_", "calcul", "ate", "\\u", "last", "\\u", "digits_", "(_", "cn", "pj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "to", " ", "calcul", "ate", " ", "the", " ", "last", " ", "two", " ", "cn", "pj", "'", "s", " ", "digit", "s", " ", "to", " ", "make", " ", "it", " ", "a", " ", "valid", " ", "cn", "pj", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cn", "pj", ":", " ", "a", " ", "base", " ", "cn", "pj", " ", "with", "out", " ", "the", " ", "last", " ", "two", " ", "digit", "s", " ", "contain", "ing", " ", "1", "2", " ", "character", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", "ing", " ", "the", " ", "length", " ", "of", " ", "the", " ", "cn", "pj_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "cn", "pj_", ")_", "!=_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "It", " ", "shou", "ld", " ", "have", " ", "1", "2", " ", "character", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defini", "ng", " ", "some", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lista", "\\u", "valida", "ca", "o", "\\u", "um_", "=_", "[_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", ",_", "9_", ",_", "8_", ",_", "7_", ",_", "6_", ",_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista", "\\u", "valida", "ca", "o", "\\u", "doi", "s_", "=_", "[_", "6_", ",_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", ",_", "9_", ",_", "8_", ",_", "7_", ",_", "6_", ",_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calculati", "ng", " ", "the", " ", "first", " ", "digit_", "\\u\\u\\uNL\\u\\u\\u_", "soma", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "numero_", "in_", "cn", "pj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "do", " ", "not", " ", "raise", " ", "indexer", "ror", "s_", "\\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 ", " _", "lista", "\\u", "valida", "ca", "o", "\\u", "um_", "[_", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "+=_", "int_", "(_", "numero_", ")_", "*_", "int_", "(_", "lista", "\\u", "valida", "ca", "o", "\\u", "um_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "%=_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "soma", "_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digit", "o", "\\u", "um_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digit", "o", "\\u", "um_", "=_", "11_", "-_", "soma", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "digit", "o", "\\u", "um_", "=_", "str_", "(_", "digit", "o", "\\u", "um_", ")_", "#", " ", "convert", "ing", " ", "to", " ", "string", ",", " ", "for", " ", "late", "r", " ", "comparison_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calculati", "ng", " ", "the", " ", "second", " ", "digit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", "ing", " ", "the", " ", "two", " ", "lists_", "\\u\\u\\uNL\\u\\u\\u_", "soma", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cn", "pj_", "+=_", "digit", "o", "\\u", "um_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", "ing", " ", "the", " ", "two", " ", "lists_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "numero_", "in_", "cn", "pj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "do", " ", "not", " ", "raise", " ", "indexer", "ror", "s_", "\\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 ", " _", "lista", "\\u", "valida", "ca", "o", "\\u", "doi", "s_", "[_", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "+=_", "int_", "(_", "numero_", ")_", "*_", "int_", "(_", "lista", "\\u", "valida", "ca", "o", "\\u", "doi", "s_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defini", "ng", " ", "the", " ", "digit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "=_", "soma", "_", "%_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "soma", "_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digit", "o", "\\u", "doi", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digit", "o", "\\u", "doi", "s_", "=_", "11_", "-_", "soma", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "digit", "o", "\\u", "doi", "s_", "=_", "str_", "(_", "digit", "o", "\\u", "doi", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "digit", "o", "\\u", "um_", ",_", "digit", "o", "\\u", "doi", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cn", "pj_", ":_", "\\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_", "format_", "(_", "cn", "pj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "to", " ", "format", " ", "cn", "pj", " ", "numbers", ".", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "Cn", "pj", ".", "format", "('", "536", "127", "3400", "019", "8", "')", "\\", "10", ";", " ", " ", " ", " ", "53.", "612", ".7", "3", "4", "/", "0001", "-", "98", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", ".", "%", "s", ".", "%", "s", "/", "%", "s", "-%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cn", "pj_", "[_", "0_", ":_", "2_", "]_", ",_", "cn", "pj_", "[_", "2_", ":_", "5_", "]_", ",_", "cn", "pj_", "[_", "5_", ":_", "8_", "]_", ",_", "cn", "pj_", "[_", "8_", ":_", "12_", "]_", ",_", "cn", "pj_", "[_", "12_", ":_", "14_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Unused local variable
StackStorm/st2/st2client/st2client/commands/action.py
[ { "content": " def _get_task_error(self, task):\n \"\"\"\n Retrieve error message from the provided task.\n\n :return: (error, traceback)\n \"\"\"\n if not task:\n return None, None\n\n result = task['result']\n\n if isinstance(result, dict):\n stderr = result.get('stderr', None)\n error = result.get('error', None)\n traceback = result.get('traceback', None)\n error = error if error else stderr\n else:\n stderr = None\n error = None\n traceback = None\n\n return error, traceback", "metadata": "root.ActionRunCommandMixin._get_task_error", "header": "['class', 'ActionRunCommandMixin', '(', 'object', ')', ':', '___EOS___']", "index": 437 }, { "content": " def _get_action_parameters_from_args(self, action, runner, args):\n \"\"\"\n Build a dictionary with parameters which will be passed to the action by\n parsing parameters passed to the CLI.\n\n :param args: CLI argument.\n :type args: ``object``\n\n :rtype: ``dict``\n \"\"\"\n action_ref_or_id = action.ref\n\n def read_file(file_path):\n if not os.path.exists(file_path):\n raise ValueError('File \"%s\" doesn\\'t exist' % (file_path))\n\n if not os.path.isfile(file_path):\n raise ValueError('\"%s\" is not a file' % (file_path))\n\n with open(file_path, 'rb') as fp:\n content = fp.read()\n\n return content\n\n def transform_object(value):\n # Also support simple key1=val1,key2=val2 syntax\n if value.startswith('{'):\n # Assume it's JSON\n result = value = json.loads(value)\n else:\n pairs = value.split(',')\n\n result = {}\n for pair in pairs:\n split = pair.split('=', 1)\n\n if len(split) != 2:\n continue\n\n key, value = split\n result[key] = value\n return result\n\n transformer = {\n 'array': (lambda cs_x: [v.strip() for v in cs_x.split(',')]),\n 'boolean': (lambda x: ast.literal_eval(x.capitalize())),\n 'integer': int,\n 'number': float,\n 'object': transform_object,\n 'string': str\n }\n\n def normalize(name, value):\n if name in runner.runner_parameters:\n param = runner.runner_parameters[name]\n if 'type' in param and param['type'] in transformer:\n return transformer[param['type']](value)\n\n if name in action.parameters:\n param = action.parameters[name]\n if 'type' in param and param['type'] in transformer:\n return transformer[param['type']](value)\n return value\n\n result = {}\n\n if not args.parameters:\n return result\n\n for idx in range(len(args.parameters)):\n arg = args.parameters[idx]\n if '=' in arg:\n k, v = arg.split('=', 1)\n\n # Attribute for files are prefixed with \"@\"\n if k.startswith('@'):\n k = k[1:]\n is_file = True\n else:\n is_file = False\n\n try:\n if is_file:\n # Files are handled a bit differently since we ship the content\n # over the wire\n file_path = os.path.normpath(pjoin(os.getcwd(), v))\n file_name = os.path.basename(file_path)\n content = read_file(file_path=file_path)\n\n if action_ref_or_id == 'core.http':\n # Special case for http runner\n result['_file_name'] = file_name\n result['file_content'] = content\n else:\n result[k] = content\n else:\n result[k] = normalize(k, v)\n except Exception as e:\n # TODO: Move transformers in a separate module and handle\n # exceptions there\n if 'malformed string' in str(e):\n message = ('Invalid value for boolean parameter. '\n 'Valid values are: true, false')\n raise ValueError(message)\n else:\n raise e\n else:\n result['cmd'] = ' '.join(args.parameters[idx:])\n break\n\n # Special case for http runner\n if 'file_content' in result:\n if 'method' not in result:\n # Default to POST if a method is not provided\n result['method'] = 'POST'\n\n if 'file_name' not in result:\n # File name not provided, use default file name\n result['file_name'] = result['_file_name']\n\n del result['_file_name']\n\n if args.inherit_env:\n result['env'] = self._get_inherited_env_vars()\n\n return result", "metadata": "root.ActionRunCommandMixin._get_action_parameters_from_args", "header": "['class', 'ActionRunCommandMixin', '(', 'object', ')', ':', '___EOS___']", "index": 460 } ]
[ { "span": "stderr ", "start_line": 454, "start_column": 12, "end_line": 454, "end_column": 18 }, { "span": "value ", "start_line": 488, "start_column": 25, "end_line": 488, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Action", "Run", "Command", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "task", "\\u", "error_", "(_", "self_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "error", " ", "message", " ", "from", " ", "the", " ", "provided", " ", "task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "(", "error", ",", " ", "traceback", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "task_", ":_", "\\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_", "result_", "=_", "task_", "[_", "'", "result", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "result_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stderr_", "=_", "result_", "._", "get_", "(_", "'", "std", "err", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "result_", "._", "get_", "(_", "'", "error", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "=_", "result_", "._", "get_", "(_", "'", "traceback", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "error_", "if_", "error_", "else_", "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 ", " _", "stderr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "error_", ",_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Run", "Command", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "action", "\\u", "parameter", "s", "\\u", "from", "\\u", "args_", "(_", "self_", ",_", "action_", ",_", "runner_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", " ", "a", " ", "dictionar", "y", " ", "with", " ", "parameter", "s", " ", "whi", "ch", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", "the", " ", "action", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "pars", "ing", " ", "parameter", "s", " ", "pass", "ed", " ", "to", " ", "the", " ", "CLI", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "CLI", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "args", ":", " ", "``", "object", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "``", "dict", "``", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "ref", "\\u", "or", "\\u", "id_", "=_", "action_", "._", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "read", "\\u", "file_", "(_", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "File", " ", "\"%", "s", "\"", " ", "doe", "sn", "\\\\'", "t", " ", "exist", "'_", "%_", "(_", "file", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "not", " ", "a", " ", "file", "'_", "%_", "(_", "file", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "rb", "'_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "fp_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "transform", "\\u", "object_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "so", " ", "support", " ", "simple", " ", "key", "1", "=", "val", "1", ",", "key", "2", "=", "val", "2", " ", "syntax_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "startswith_", "(_", "'{'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "it", "'", "s", " ", "JSON_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "value_", "=_", "json_", "._", "loads_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pairs_", "=_", "value_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pair_", "in_", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "split_", "=_", "pair_", "._", "split_", "(_", "'='_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "split_", ")_", "!=_", "2_", ":_", "\\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_", "key_", ",_", "value_", "=_", "split_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transformer_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "array", "'_", ":_", "(_", "lambda_", "cs", "\\u", "x_", ":_", "[_", "v_", "._", "strip_", "(_", ")_", "for_", "v_", "in_", "cs", "\\u", "x_", "._", "split_", "(_", "','_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "boolean", "'_", ":_", "(_", "lambda_", "x_", ":_", "ast_", "._", "literal", "\\u", "eval_", "(_", "x_", "._", "capitalize_", "(_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "integ", "er", "'_", ":_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "number", "'_", ":_", "float_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "transform", "\\u", "object_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "string", "'_", ":_", "str_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "normalize_", "(_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "runner_", "._", "runn", "er", "\\u", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "runner_", "._", "runn", "er", "\\u", "parameters_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "type", "'_", "in_", "param_", "and_", "param_", "[_", "'", "type", "'_", "]_", "in_", "transformer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "transformer_", "[_", "param_", "[_", "'", "type", "'_", "]_", "]_", "(_", "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_", "if_", "name_", "in_", "action_", "._", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "action_", "._", "parameters_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "type", "'_", "in_", "param_", "and_", "param_", "[_", "'", "type", "'_", "]_", "in_", "transformer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "transformer_", "[_", "param_", "[_", "'", "type", "'_", "]_", "]_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "idx_", "in_", "range_", "(_", "len_", "(_", "args_", "._", "parameters_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "args_", "._", "parameters_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'='_", "in_", "arg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", ",_", "v_", "=_", "arg_", "._", "split_", "(_", "'='_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attribute", " ", "for", " ", "files", " ", "are", " ", "prefixed", " ", "with", " ", "\"@\"_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "k_", "._", "startswith_", "(_", "'@'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "k_", "=_", "k_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "file_", "=_", "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 ", " ", "_", "is", "\\u", "file_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "is", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Files", " ", "are", " ", "handle", "d", " ", "a", " ", "bit", " ", "different", "ly", " ", "sinc", "e", " ", "we", " ", "ship", " ", "the", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "over", " ", "the", " ", "wire_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "pjoin_", "(_", "os_", "._", "getcwd_", "(_", ")_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "read", "\\u", "file_", "(_", "file", "\\u", "path_", "=_", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "action", "\\u", "ref", "\\u", "or", "\\u", "id_", "==_", "'", "core", ".", "http", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", " ", "case", " ", "for", " ", "http", " ", "runner_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "[_", "'\\u", "file", "\\u", "name", "'_", "]_", "=_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "file", "\\u", "content", "'_", "]_", "=_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "[_", "k_", "]_", "=_", "content_", "\\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 ", " ", " _", "result_", "[_", "k_", "]_", "=_", "normalize_", "(_", "k_", ",_", "v_", ")_", "\\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_", "#", " ", "TOD", "O", ":", " ", "Move", " ", "transformers", " ", "in", " ", "a", " ", "separate", " ", "module", " ", "and", " ", "handle_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", "s", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "mal", "formed", " ", "string", "'_", "in_", "str_", "(_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "message_", "=_", "(_", "'", "Inva", "lid", " ", "value", " ", "for", " ", "boolean", " ", "parameter", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Valid", " ", "values", " ", "are", ":", " ", "true", ",", " ", "fal", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "message_", ")_", "\\u\\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_", "e_", "\\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 ", " _", "result_", "[_", "'", "cmd", "'_", "]_", "=_", "'", " ", "'_", "._", "join_", "(_", "args_", "._", "parameters_", "[_", "idx_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Special", " ", "case", " ", "for", " ", "http", " ", "runner_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "file", "\\u", "content", "'_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "method", "'_", "not_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Default", " ", "to", " ", "POST", " ", "if", " ", "a", " ", "method", " ", "is", " ", "not", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "method", "'_", "]_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "file", "\\u", "name", "'_", "not_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "File", " ", "name", " ", "not", " ", "provided", ",", " ", "use", " ", "default", " ", "file", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "file", "\\u", "name", "'_", "]_", "=_", "result_", "[_", "'\\u", "file", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "result_", "[_", "'\\u", "file", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "inherit", "\\u", "env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uIN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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 ]
Unused local variable
sympy/sympy/sympy/physics/mechanics/tests/test_lagrange.py
[ { "content": "def test_dub_pen():\n\n # The system considered is the double pendulum. Like in the\n # test of the simple pendulum above, we begin by creating the generalized\n # coordinates and the simple generalized speeds and accelerations which\n # will be used later. Following this we create frames and points necessary\n # for the kinematics. The procedure isn't explicitly explained as this is\n # similar to the simple pendulum. Also this is documented on the pydy.org\n # website.\n q1, q2 = dynamicsymbols('q1 q2')\n q1d, q2d = dynamicsymbols('q1 q2', 1)\n q1dd, q2dd = dynamicsymbols('q1 q2', 2)\n u1, u2 = dynamicsymbols('u1 u2')\n u1d, u2d = dynamicsymbols('u1 u2', 1)\n l, m, g = symbols('l m g')\n\n N = ReferenceFrame('N')\n A = N.orientnew('A', 'Axis', [q1, N.z])\n B = N.orientnew('B', 'Axis', [q2, N.z])\n\n A.set_ang_vel(N, q1d * A.z)\n B.set_ang_vel(N, q2d * A.z)\n\n O = Point('O')\n P = O.locatenew('P', l * A.x)\n R = P.locatenew('R', l * B.x)\n\n O.set_vel(N, 0)\n P.v2pt_theory(O, N, A)\n R.v2pt_theory(P, N, B)\n\n ParP = Particle('ParP', P, m)\n ParR = Particle('ParR', R, m)\n\n ParP.potential_energy = - m * g * l * cos(q1)\n ParR.potential_energy = - m * g * l * cos(q1) - m * g * l * cos(q2)\n L = Lagrangian(N, ParP, ParR)\n lm = LagrangesMethod(L, [q1, q2])\n lm.form_lagranges_equations()\n\n assert simplify(l*m*(2*g*sin(q1) + l*sin(q1)*sin(q2)*q2dd\n + l*sin(q1)*cos(q2)*q2d**2 - l*sin(q2)*cos(q1)*q2d**2\n + l*cos(q1)*cos(q2)*q2dd + 2*l*q1dd) - lm.eom[0]) == 0\n assert simplify(l*m*(g*sin(q2) + l*sin(q1)*sin(q2)*q1dd\n - l*sin(q1)*cos(q2)*q1d**2 + l*sin(q2)*cos(q1)*q1d**2\n + l*cos(q1)*cos(q2)*q1dd + l*q2dd) - lm.eom[1]) == 0", "metadata": "root.test_dub_pen", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def test_rolling_disc():\n # Rolling Disc Example\n # Here the rolling disc is formed from the contact point up, removing the\n # need to introduce generalized speeds. Only 3 configuration and 3\n # speed variables are need to describe this system, along with the\n # disc's mass and radius, and the local gravity.\n q1, q2, q3 = dynamicsymbols('q1 q2 q3')\n q1d, q2d, q3d = dynamicsymbols('q1 q2 q3', 1)\n r, m, g = symbols('r m g')\n\n # The kinematics are formed by a series of simple rotations. Each simple\n # rotation creates a new frame, and the next rotation is defined by the new\n # frame's basis vectors. This example uses a 3-1-2 series of rotations, or\n # Z, X, Y series of rotations. Angular velocity for this is defined using\n # the second frame's basis (the lean frame).\n N = ReferenceFrame('N')\n Y = N.orientnew('Y', 'Axis', [q1, N.z])\n L = Y.orientnew('L', 'Axis', [q2, Y.x])\n R = L.orientnew('R', 'Axis', [q3, L.y])\n\n # This is the translational kinematics. We create a point with no velocity\n # in N; this is the contact point between the disc and ground. Next we form\n # the position vector from the contact point to the disc's center of mass.\n # Finally we form the velocity and acceleration of the disc.\n C = Point('C')\n C.set_vel(N, 0)\n Dmc = C.locatenew('Dmc', r * L.z)\n Dmc.v2pt_theory(C, N, R)\n\n # Forming the inertia dyadic.\n I = inertia(L, m / 4 * r**2, m / 2 * r**2, m / 4 * r**2)\n BodyD = RigidBody('BodyD', Dmc, R, m, (I, Dmc))\n\n # Finally we form the equations of motion, using the same steps we did\n # before. Supply the Lagrangian, the generalized speeds.\n BodyD.potential_energy = - m * g * r * cos(q2)\n Lag = Lagrangian(N, BodyD)\n q = [q1, q2, q3]\n q1 = Function('q1')\n q2 = Function('q2')\n q3 = Function('q3')\n l = LagrangesMethod(Lag, q)\n l.form_lagranges_equations()\n RHS = l.rhs()\n RHS.simplify()\n t = symbols('t')\n\n assert (l.mass_matrix[3:6] == [0, 5*m*r**2/4, 0])\n assert RHS[4].simplify() == (\n (-8*g*sin(q2(t)) + r*(5*sin(2*q2(t))*Derivative(q1(t), t) +\n 12*cos(q2(t))*Derivative(q3(t), t))*Derivative(q1(t), t))/(10*r))\n assert RHS[5] == (-5*cos(q2(t))*Derivative(q1(t), t) + 6*tan(q2(t)\n )*Derivative(q3(t), t) + 4*Derivative(q1(t), t)/cos(q2(t))\n )*Derivative(q2(t), t)", "metadata": "root.test_rolling_disc", "header": "['module', '___EOS___']", "index": 174 } ]
[ { "span": "u1,", "start_line": 138, "start_column": 4, "end_line": 138, "end_column": 6 }, { "span": "u2 ", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 10 }, { "span": "u1d,", "start_line": 139, "start_column": 4, "end_line": 139, "end_column": 7 }, { "span": "u2d ", "start_line": 139, "start_column": 9, "end_line": 139, "end_column": 12 }, { "span": "q1d,", "start_line": 181, "start_column": 4, "end_line": 181, "end_column": 7 }, { "span": "q2d,", "start_line": 181, "start_column": 9, "end_line": 181, "end_column": 12 }, { "span": "q3d ", "start_line": 181, "start_column": 14, "end_line": 181, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dub", "\\u", "pen_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "system", " ", "consider", "ed", " ", "is", " ", "the", " ", "double", " ", "pend", "ulum", ".", " ", "Lik", "e", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "of", " ", "the", " ", "simple", " ", "pend", "ulum", " ", "above", ",", " ", "we", " ", "begin", " ", "by", " ", "creati", "ng", " ", "the", " ", "generaliz", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coordinate", "s", " ", "and", " ", "the", " ", "simple", " ", "generaliz", "ed", " ", "speeds", " ", "and", " ", "acceleration", "s", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "be", " ", "used", " ", "late", "r", ".", " ", "Follow", "ing", " ", "this", " ", "we", " ", "create", " ", "frames", " ", "and", " ", "points", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "kine", "matics", ".", " ", "The", " ", "procedure", " ", "isn", "'", "t", " ", "explicit", "ly", " ", "explaine", "d", " ", "as", " ", "this", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "similar", " ", "to", " ", "the", " ", "simple", " ", " ", "pend", "ulum", ".", " ", "Al", "so", " ", "this", " ", "is", " ", "documente", "d", " ", "on", " ", "the", " ", "pyd", "y", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "webs", "ite", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q1_", ",_", "q2_", "=_", "dynamics", "ymbo", "ls_", "(_", "'", "q1", " ", "q2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q1", "d_", ",_", "q2", "d_", "=_", "dynamics", "ymbo", "ls_", "(_", "'", "q1", " ", "q2", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q1", "dd_", ",_", "q2", "dd_", "=_", "dynamics", "ymbo", "ls_", "(_", "'", "q1", " ", "q2", "'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u1_", ",_", "u2_", "=_", "dynamics", "ymbo", "ls_", "(_", "'", "u1", " ", "u2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u1", "d_", ",_", "u2", "d_", "=_", "dynamics", "ymbo", "ls_", "(_", "'", "u1", " ", "u2", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", ",_", "m_", ",_", "g_", "=_", "symbols_", "(_", "'", "l", " ", "m", " ", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "=_", "Reference", "Frame_", "(_", "'", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "N_", "._", "orient", "new_", "(_", "'", "A", "'_", ",_", "'", "Axi", "s", "'_", ",_", "[_", "q1_", ",_", "N_", "._", "z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B_", "=_", "N_", "._", "orient", "new_", "(_", "'", "B", "'_", ",_", "'", "Axi", "s", "'_", ",_", "[_", "q2_", ",_", "N_", "._", "z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "._", "set\\u", "ang", "\\u", "vel_", "(_", "N_", ",_", "q1", "d_", "*_", "A_", "._", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B_", "._", "set\\u", "ang", "\\u", "vel_", "(_", "N_", ",_", "q2", "d_", "*_", "A_", "._", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "O_", "=_", "Point_", "(_", "'", "O", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "O_", "._", "locat", "ene", "w_", "(_", "'", "P", "'_", ",_", "l_", "*_", "A_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "=_", "P_", "._", "locat", "ene", "w_", "(_", "'", "R", "'_", ",_", "l_", "*_", "B_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "O_", "._", "set\\u", "vel_", "(_", "N_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "v2", "pt", "\\u", "theory", "_", "(_", "O_", ",_", "N_", ",_", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "._", "v2", "pt", "\\u", "theory", "_", "(_", "P_", ",_", "N_", ",_", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Par", "P_", "=_", "Particle_", "(_", "'", "Par", "P", "'_", ",_", "P_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Par", "R_", "=_", "Particle_", "(_", "'", "Par", "R", "'_", ",_", "R_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Par", "P_", "._", "potenti", "al", "\\u", "energy_", "=_", "-_", "m_", "*_", "g_", "*_", "l_", "*_", "cos_", "(_", "q1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Par", "R_", "._", "potenti", "al", "\\u", "energy_", "=_", "-_", "m_", "*_", "g_", "*_", "l_", "*_", "cos_", "(_", "q1_", ")_", "-_", "m_", "*_", "g_", "*_", "l_", "*_", "cos_", "(_", "q2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Lag", "rang", "ian_", "(_", "N_", ",_", "Par", "P_", ",_", "Par", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lm_", "=_", "Lag", "ranges", "Method_", "(_", "L_", ",_", "[_", "q1_", ",_", "q2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lm_", "._", "form", "\\u", "lag", "ranges", "\\u", "equation", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "simplify_", "(_", "l_", "*_", "m_", "*_", "(_", "2_", "*_", "g_", "*_", "sin_", "(_", "q1_", ")_", "+_", "l_", "*_", "sin_", "(_", "q1_", ")_", "*_", "sin_", "(_", "q2_", ")_", "*_", "q2", "dd_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "l_", "*_", "sin_", "(_", "q1_", ")_", "*_", "cos_", "(_", "q2_", ")_", "*_", "q2", "d_", "**_", "2_", "-_", "l_", "*_", "sin_", "(_", "q2_", ")_", "*_", "cos_", "(_", "q1_", ")_", "*_", "q2", "d_", "**_", "2_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "l_", "*_", "cos_", "(_", "q1_", ")_", "*_", "cos_", "(_", "q2_", ")_", "*_", "q2", "dd_", "+_", "2_", "*_", "l_", "*_", "q1", "dd_", ")_", "-_", "lm_", "._", "eom", "_", "[_", "0_", "]_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "simplify_", "(_", "l_", "*_", "m_", "*_", "(_", "g_", "*_", "sin_", "(_", "q2_", ")_", "+_", "l_", "*_", "sin_", "(_", "q1_", ")_", "*_", "sin_", "(_", "q2_", ")_", "*_", "q1", "dd_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "l_", "*_", "sin_", "(_", "q1_", ")_", "*_", "cos_", "(_", "q2_", ")_", "*_", "q1", "d_", "**_", "2_", "+_", "l_", "*_", "sin_", "(_", "q2_", ")_", "*_", "cos_", "(_", "q1_", ")_", "*_", "q1", "d_", "**_", "2_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "l_", "*_", "cos_", "(_", "q1_", ")_", "*_", "cos_", "(_", "q2_", ")_", "*_", "q1", "dd_", "+_", "l_", "*_", "q2", "dd_", ")_", "-_", "lm_", "._", "eom", "_", "[_", "1_", "]_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rolling", "\\u", "disc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Roll", "ing", " ", "Disc", " ", "Example_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Her", "e", " ", "the", " ", "rolling", " ", "disc", " ", "is", " ", "formed", " ", "from", " ", "the", " ", "contact", " ", "point", " ", "up", ",", " ", "remo", "ving", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "introduce", " ", "generaliz", "ed", " ", "speeds", ".", " ", "On", "ly", " ", "3", " ", "configura", "tion", " ", "and", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "speed", " ", "variab", "les", " ", "are", " ", "need", " ", "to", " ", "descri", "be", " ", "this", " ", "system", ",", " ", "along", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disc", "'", "s", " ", "mass", " ", "and", " ", "radi", "us", ",", " ", "and", " ", "the", " ", "local", " ", "gravity", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q1_", ",_", "q2_", ",_", "q3_", "=_", "dynamics", "ymbo", "ls_", "(_", "'", "q1", " ", "q2", " ", "q", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q1", "d_", ",_", "q2", "d_", ",_", "q", "3d_", "=_", "dynamics", "ymbo", "ls_", "(_", "'", "q1", " ", "q2", " ", "q", "3", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", ",_", "m_", ",_", "g_", "=_", "symbols_", "(_", "'", "r", " ", "m", " ", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "kine", "matics", " ", "are", " ", "formed", " ", "by", " ", "a", " ", "series", " ", "of", " ", "simple", " ", "rotations", ".", " ", "Ea", "ch", " ", "simple_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rotati", "on", " ", "create", "s", " ", "a", " ", "new", " ", "frame", ",", " ", "and", " ", "the", " ", "next", " ", "rotati", "on", " ", "is", " ", "defin", "ed", " ", "by", " ", "the", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "frame", "'", "s", " ", "basi", "s", " ", "vector", "s", ".", " ", "Thi", "s", " ", "example", " ", "use", "s", " ", "a", " ", "3", "-1", "-", "2", " ", "series", " ", "of", " ", "rotations", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Z", ",", " ", "X", ",", " ", "Y", " ", "series", " ", "of", " ", "rotations", ".", " ", "Angul", "ar", " ", "velo", "city", " ", "for", " ", "this", " ", "is", " ", "defin", "ed", " ", "using_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "second", " ", "frame", "'", "s", " ", "basi", "s", " ", "(", "the", " ", "lean", " ", "frame", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "=_", "Reference", "Frame_", "(_", "'", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "N_", "._", "orient", "new_", "(_", "'", "Y", "'_", ",_", "'", "Axi", "s", "'_", ",_", "[_", "q1_", ",_", "N_", "._", "z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Y_", "._", "orient", "new_", "(_", "'", "L", "'_", ",_", "'", "Axi", "s", "'_", ",_", "[_", "q2_", ",_", "Y_", "._", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "=_", "L_", "._", "orient", "new_", "(_", "'", "R", "'_", ",_", "'", "Axi", "s", "'_", ",_", "[_", "q3_", ",_", "L_", "._", "y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "translatio", "nal", " ", "kine", "matics", ".", " ", "We", " ", "create", " ", "a", " ", "point", " ", "with", " ", "no", " ", "velocity_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "N", ";", " ", "this", " ", "is", " ", "the", " ", "contact", " ", "point", " ", "bet", "ween", " ", "the", " ", "disc", " ", "and", " ", "ground", ".", " ", "Ne", "xt", " ", "we", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "position", " ", "vector", " ", "from", " ", "the", " ", "contact", " ", "point", " ", "to", " ", "the", " ", "disc", "'", "s", " ", "center", " ", "of", " ", "mass", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", " ", "we", " ", "form", " ", "the", " ", "velo", "city", " ", "and", " ", "acceleration", " ", "of", " ", "the", " ", "disc", "._", "\\u\\u\\uNL\\u\\u\\u_", "C_", "=_", "Point_", "(_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "._", "set\\u", "vel_", "(_", "N_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Dm", "c_", "=_", "C_", "._", "locat", "ene", "w_", "(_", "'", "Dm", "c", "'_", ",_", "r_", "*_", "L_", "._", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Dm", "c_", "._", "v2", "pt", "\\u", "theory", "_", "(_", "C_", ",_", "N_", ",_", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Form", "ing", " ", "the", " ", "inertia", " ", "dy", "adic", "._", "\\u\\u\\uNL\\u\\u\\u_", "I_", "=_", "inertia", "_", "(_", "L_", ",_", "m_", "/_", "4_", "*_", "r_", "**_", "2_", ",_", "m_", "/_", "2_", "*_", "r_", "**_", "2_", ",_", "m_", "/_", "4_", "*_", "r_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Bod", "y", "D_", "=_", "Rig", "id", "Body_", "(_", "'", "Bod", "y", "D", "'_", ",_", "Dm", "c_", ",_", "R_", ",_", "m_", ",_", "(_", "I_", ",_", "Dm", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", " ", "we", " ", "form", " ", "the", " ", "equation", "s", " ", "of", " ", "moti", "on", ",", " ", "usi", "ng", " ", "the", " ", "same", " ", "step", "s", " ", "we", " ", "did_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", ".", " ", "Suppl", "y", " ", "the", " ", "Lag", "rang", "ian", ",", " ", "the", " ", "generaliz", "ed", " ", "speeds", "._", "\\u\\u\\uNL\\u\\u\\u_", "Bod", "y", "D_", "._", "potenti", "al", "\\u", "energy_", "=_", "-_", "m_", "*_", "g_", "*_", "r_", "*_", "cos_", "(_", "q2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Lag", "_", "=_", "Lag", "rang", "ian_", "(_", "N_", ",_", "Bod", "y", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "[_", "q1_", ",_", "q2_", ",_", "q3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q1_", "=_", "Function_", "(_", "'", "q1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "Function_", "(_", "'", "q2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q3_", "=_", "Function_", "(_", "'", "q", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "Lag", "ranges", "Method_", "(_", "Lag", "_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "form", "\\u", "lag", "ranges", "\\u", "equation", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RHS", "_", "=_", "l_", "._", "rhs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RHS", "_", "._", "simplify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "symbols_", "(_", "'", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "l_", "._", "mass", "\\u", "matrix_", "[_", "3_", ":_", "6_", "]_", "==_", "[_", "0_", ",_", "5_", "*_", "m_", "*_", "r_", "**_", "2_", "/_", "4_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "RHS", "_", "[_", "4_", "]_", "._", "simplify_", "(_", ")_", "==_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "-_", "8_", "*_", "g_", "*_", "sin_", "(_", "q2_", "(_", "t_", ")_", ")_", "+_", "r_", "*_", "(_", "5_", "*_", "sin_", "(_", "2_", "*_", "q2_", "(_", "t_", ")_", ")_", "*_", "Derivati", "ve_", "(_", "q1_", "(_", "t_", ")_", ",_", "t_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "12_", "*_", "cos_", "(_", "q2_", "(_", "t_", ")_", ")_", "*_", "Derivati", "ve_", "(_", "q3_", "(_", "t_", ")_", ",_", "t_", ")_", ")_", "*_", "Derivati", "ve_", "(_", "q1_", "(_", "t_", ")_", ",_", "t_", ")_", ")_", "/_", "(_", "10_", "*_", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "RHS", "_", "[_", "5_", "]_", "==_", "(_", "-_", "5_", "*_", "cos_", "(_", "q2_", "(_", "t_", ")_", ")_", "*_", "Derivati", "ve_", "(_", "q1_", "(_", "t_", ")_", ",_", "t_", ")_", "+_", "6_", "*_", "tan_", "(_", "q2_", "(_", "t_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "*_", "Derivati", "ve_", "(_", "q3_", "(_", "t_", ")_", ",_", "t_", ")_", "+_", "4_", "*_", "Derivati", "ve_", "(_", "q1_", "(_", "t_", ")_", ",_", "t_", ")_", "/_", "cos_", "(_", "q2_", "(_", "t_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "*_", "Derivati", "ve_", "(_", "q2_", "(_", "t_", ")_", ",_", "t_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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used import
JustinSGray/Hyperloop/src/hyperloop/tube_wall_temp.py
[ { "content": "\"\"\"\n tubeModel.py - \n Determines the steady state temperature of the hyperloop tube.\n Calculates Q released/absorbed by hyperloop tube due to:\n Internal Convection, Tube Conduction, Ambient Natural Convection, Solar Flux In, Radiation Out\n \n -original calculations from Jeff Berton, ported and extended by Jeff Chin\n\n Compatible with OpenMDAO v0.8.1\n\"\"\"\nfrom math import log, pi, sqrt, e\n\nfrom openmdao.main.api import Assembly, Component\nfrom openmdao.lib.drivers.api import BroydenSolver \nfrom openmdao.lib.datatypes.api import Float, Bool\nfrom openmdao.main.api import convert_units as cu\n\nfrom pycycle.api import FlowStationVar\n\n\n\n#run stand-alone component\nif __name__ == \"__main__\":\n\n from openmdao.main.api import set_as_top\n\n\n\n test = TubeHeatBalance()\n set_as_top(test)\n\n #set input values\n test.tm.nozzle_air.setTotalTP(1710, 0.304434211)\n test.tm.nozzle_air.W = 1.08\n test.tm.bearing_air.W = 0.\n test.tm.diameter_outer_tube = 2.22504#, units = 'm', iotype='in', desc='Tube out diameter') #7.3ft\n test.tm.length_tube = 482803.#, units = 'm', iotype='in', desc='Length of entire Hyperloop') #300 miles, 1584000ft\n test.tm.num_pods = 34.#, units = 'K', iotype='in', desc='Number of Pods in the Tube at a given time') #\n test.tm.temp_boundary = 340#, units = 'K', iotype='in', desc='Average Temperature of the tube') #\n test.tm.temp_outside_ambient = 305.6#, units = 'K', iotype='in', desc='Average Temperature of the outside air') #\n\n test.run()\n\n print \"-----Completed Tube Heat Flux Model Calculations---\"\n print \"\"\n print \"CompressQ-{} SolarQ-{} RadQ-{} ConvecQ-{}\".format(test.tm.total_heat_rate_pods, test.tm.q_total_solar, test.tm.q_rad_tot, test.tm.total_q_nat_conv )\n print \"Equilibrium Wall Temperature: {} K or {} F\".format(test.tm.temp_boundary, cu(test.tm.temp_boundary,'degK','degF'))\n print \"Ambient Temperature: {} K or {} F\".format(test.tm.temp_outside_ambient, cu(test.tm.temp_outside_ambient,'degK','degF'))\n print \"Q Out = {} W ==> Q In = {} W ==> Error: {}%\".format(test.tm.q_total_out,test.tm.q_total_in,((test.tm.q_total_out-test.tm.q_total_in)/test.tm.q_total_out)*100)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TubeWallTemp(Component):\n \"\"\" Calculates Q released/absorbed by the hyperloop tube \"\"\"\n #--Inputs--\n #Hyperloop Parameters/Design Variables\n diameter_outer_tube = Float(2.23, units = 'm', iotype='in', desc='tube outer diameter') #7.3ft\n length_tube = Float(482803, units = 'm', iotype='in', desc='Length of entire Hyperloop') #300 miles, 1584000ft\n num_pods = Float(34, units = 'K', iotype='in', desc='Number of Pods in the Tube at a given time') #\n temp_boundary = Float(322.0, units = 'K', iotype='in', desc='Average Temperature of the tube wall') #\n temp_outside_ambient = Float(305.6, units = 'K', iotype='in', desc='Average Temperature of the outside air') #\n nozzle_air = FlowStationVar(iotype=\"in\", desc=\"air exiting the pod nozzle\", copy=None)\n bearing_air = FlowStationVar(iotype=\"in\", desc=\"air exiting the air bearings\", copy=None)\n #constants\n solar_insolation = Float(1000., iotype=\"in\", units = 'W/m**2', desc='solar irradiation at sea level on a clear day') #\n nn_incidence_factor = Float(0.7, iotype=\"in\", desc='Non-normal incidence factor') #\n surface_reflectance = Float(0.5, desc='Solar Reflectance Index') #\n q_per_area_solar = Float(350., units = 'W/m**2', desc='Solar Heat Rate Absorbed per Area') #\n q_total_solar = Float(375989751., iotype=\"in\", units = 'W', desc='Solar Heat Absorbed by Tube') #\n emissivity_tube = Float(0.5, iotype=\"in\", units = 'W', desc='Emmissivity of the Tube') #\n sb_constant = Float(0.00000005670373, iotype=\"in\", units = 'W/((m**2)*(K**4))', desc='Stefan-Boltzmann Constant') #\n\n #--Outputs--\n area_rad = Float(337486.1, units = 'm**2', iotype='out', desc='Tube Radiating Area') # \n #Required for Natural Convection Calcs\n GrDelTL3 = Float(1946216.7, units = '1/((ft**3)*F)', iotype='out', desc='Heat Radiated to the outside') #\n Pr = Float(0.707, iotype='out', desc='Prandtl') #\n Gr = Float(12730351223., iotype='out', desc='Grashof #') #\n Ra = Float(8996312085., iotype='out', desc='Rayleigh #') #\n Nu = Float(232.4543713, iotype='out', desc='Nusselt #') #\n k = Float(0.02655, units = 'W/(m*K)', iotype='out', desc='Thermal conductivity') #\n h = Float(0.845464094, units = 'W/((m**2)*K)', iotype='out', desc='Heat Radiated to the outside') #\n area_convection = Float(3374876.115, units = 'W', iotype='out', desc='Convection Area') #\n #Natural Convection\n q_per_area_nat_conv = Float(7.9, units = 'W/(m**2)', iotype='out', desc='Heat Radiated per Area to the outside') #\n total_q_nat_conv = Float(286900419., units = 'W', iotype='out', desc='Total Heat Radiated to the outside via Natural Convection') #\n #Exhausted from Pods\n heat_rate_pod = Float(519763, units = 'W', iotype='out', desc='Heating Due to a Single Pods') #\n total_heat_rate_pods = Float(17671942., units = 'W', iotype='out', desc='Heating Due to a All Pods') #\n #Radiated Out\n q_rad_per_area = Float(31.6, units = 'W/(m**2)', iotype='out', desc='Heat Radiated to the outside') #\n q_rad_tot = Float(106761066.5, units = 'W', iotype='out', desc='Heat Radiated to the outside') #\n #Radiated In\n viewing_angle = Float(1074256, units = 'm**2', iotype='out', desc='Effective Area hit by Sun') #\n #Total Heating\n q_total_out = Float(286900419., units = 'W', iotype='out', desc='Total Heat Released via Radiation and Natural Convection') #\n q_total_in = Float(286900419., units = 'W', iotype='out', desc='Total Heat Absorbed/Added via Pods and Solar Absorption') #\n #Residual (for solver)\n ss_temp_residual = Float(units = 'K', iotype='out', desc='Residual of T_released - T_absorbed')\n ", "metadata": "root.TubeWallTemp", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def execute(self):\n \"\"\"Calculate Various Paramters\"\"\"\n \n bearing_q = cu(self.bearing_air.W,'lbm/s','kg/s') * cu(self.bearing_air.Cp,'Btu/(lbm*degR)','J/(kg*K)') * (cu(self.bearing_air.Tt,'degR','degK') - self.temp_boundary)\n nozzle_q = cu(self.nozzle_air.W,'lbm/s','kg/s') * cu(self.nozzle_air.Cp,'Btu/(lbm*degR)','J/(kg*K)') * (cu(self.nozzle_air.Tt,'degR','degK') - self.temp_boundary)\n #Q = mdot * cp * deltaT \n self.heat_rate_pod = nozzle_q +bearing_q \n #Total Q = Q * (number of pods)\n self.total_heat_rate_pods = self.heat_rate_pod*self.num_pods\n\n #Determine thermal resistance of outside via Natural Convection or forced convection\n if(self.temp_outside_ambient < 400):\n self.GrDelTL3 = 41780000000000000000*((self.temp_outside_ambient)**(-4.639)) #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)\n else:\n self.GrDelTL3 = 4985000000000000000*((self.temp_outside_ambient)**(-4.284)) #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)\n \n #Prandtl Number\n #Pr = viscous diffusion rate/ thermal diffusion rate = Cp * dyanamic viscosity / thermal conductivity\n #Pr << 1 means thermal diffusivity dominates\n #Pr >> 1 means momentum diffusivity dominates\n if (self.temp_outside_ambient < 400):\n self.Pr = 1.23*(self.temp_outside_ambient**(-0.09685)) #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)\n else:\n self.Pr = 0.59*(self.temp_outside_ambient**(0.0239))\n #Grashof Number\n #Relationship between buoyancy and viscosity\n #Laminar = Gr < 10^8\n #Turbulent = Gr > 10^9\n self.Gr = self.GrDelTL3*(self.temp_boundary-self.temp_outside_ambient)*(self.diameter_outer_tube**3)\n #Rayleigh Number \n #Buoyancy driven flow (natural convection)\n self.Ra = self.Pr * self.Gr\n #Nusselt Number\n #Nu = convecive heat transfer / conductive heat transfer\n if (self.Ra<=10**12): #valid in specific flow regime\n self.Nu = (0.6 + 0.387*self.Ra**(1./6.)/(1 + (0.559/self.Pr)**(9./16.))**(8./27.))**2 #3rd Ed. of Introduction to Heat Transfer by Incropera and DeWitt, equations (9.33) and (9.34) on page 465\n if(self.temp_outside_ambient < 400):\n self.k = 0.0001423*(self.temp_outside_ambient**(0.9138)) #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)\n else:\n self.k = 0.0002494*(self.temp_outside_ambient**(0.8152))\n #h = k*Nu/Characteristic Length\n self.h = (self.k * self.Nu)/ self.diameter_outer_tube\n #Convection Area = Surface Area\n self.area_convection = pi * self.length_tube * self.diameter_outer_tube \n #Determine heat radiated per square meter (Q)\n self.q_per_area_nat_conv = self.h*(self.temp_boundary-self.temp_outside_ambient)\n #Determine total heat radiated over entire tube (Qtotal)\n self.total_q_nat_conv = self.q_per_area_nat_conv * self.area_convection\n #Determine heat incoming via Sun radiation (Incidence Flux)\n #Sun hits an effective rectangular cross section\n self.area_viewing = self.length_tube* self.diameter_outer_tube\n self.q_per_area_solar = (1-self.surface_reflectance)* self.nn_incidence_factor * self.solar_insolation\n self.q_total_solar = self.q_per_area_solar * self.area_viewing\n #Determine heat released via radiation\n #Radiative area = surface area\n self.area_rad = self.area_convection\n #P/A = SB*emmisitivity*(T^4 - To^4)\n self.q_rad_per_area = self.sb_constant*self.emissivity_tube*((self.temp_boundary**4) - (self.temp_outside_ambient**4))\n #P = A * (P/A)\n self.q_rad_tot = self.area_rad * self.q_rad_per_area\n #------------\n #Sum Up\n self.q_total_out = self.q_rad_tot + self.total_q_nat_conv\n self.q_total_in = self.q_total_solar + self.total_heat_rate_pods\n \n self.ss_temp_residual = (self.q_total_out - self.q_total_in)/1e6", "metadata": "root.TubeWallTemp.execute", "header": "['class', 'TubeWallTemp', '(', 'Component', ')', ':', '___EOS___']", "index": 68 }, { "content": " class TubeHeatBalance(Assembly):\n", "metadata": "root.TubeHeatBalance", "header": "['module', '___EOS___']", "index": 141 }, { "content": " def configure(self):\n\n tm = self.add('tm', TubeWallTemp())\n #tm.bearing_air.setTotalTP()\n driver = self.add('driver',BroydenSolver())\n driver.add_parameter('tm.temp_boundary',low=0.,high=10000.)\n driver.add_constraint('tm.ss_temp_residual=0')\n\n driver.workflow.add(['tm'])", "metadata": "root.TubeHeatBalance.configure", "header": "['class', 'TubeHeatBalance', '(', 'Assembly', ')', ':', '___EOS___']", "index": 143 } ]
[ { "span": "from math import log, pi, sqrt, e", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 33 }, { "span": "from openmdao.lib.datatypes.api import Float, Bool", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "tube", "Model", ".", "py", " ", "-", " ", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", "s", " ", "the", " ", "stead", "y", " ", "state", " ", "tempe", "ratur", "e", " ", "of", " ", "the", " ", "hyper", "loop", " ", "tube", ".", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "es", " ", "Q", " ", "released", "/", "absor", "bed", " ", "by", " ", "hyper", "loop", " ", "tube", " ", "due", " ", "to", ":", "\\", "10", ";", " ", " ", " ", " ", "Intern", "al", " ", "Conve", "ction", ",", " ", "Tu", "be", " ", "Conduct", "ion", ",", " ", "Ambi", "ent", " ", "Nat", "ural", " ", "Conve", "ction", ",", " ", "Sol", "ar", " ", "Flux", " ", "In", ",", " ", "Radia", "tion", " ", "Out", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "-", "original", " ", "calculati", "ons", " ", "from", " ", "Je", "ff", " ", "Bert", "on", ",", " ", "porte", "d", " ", "and", " ", "extend", "ed", " ", "by", " ", "Je", "ff", " ", "Chin", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Compatible", " ", "with", " ", "Open", "MD", "AO", " ", "v", "0.", "8.1", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "log_", ",_", "pi_", ",_", "sqrt_", ",_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "api_", "import_", "Asse", "mbly", "_", ",_", "Component_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "lib_", "._", "drivers_", "._", "api_", "import_", "Bro", "yde", "n", "Solver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "lib_", "._", "datatypes_", "._", "api_", "import_", "Float_", ",_", "Bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "api_", "import_", "convert", "\\u", "units_", "as_", "cu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyc", "ycle", "_", "._", "api_", "import_", "Flow", "Station", "Var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "run", " ", "stand", "-", "alo", "ne", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "openm", "dao_", "._", "main_", "._", "api_", "import_", "set\\u", "as", "\\u", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "test_", "=_", "Tu", "be", "Heat", "Balance", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "as", "\\u", "top_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "input", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "test_", "._", "tm_", "._", "no", "zzle", "\\u", "air_", "._", "set", "Total", "TP_", "(_", "171", "0_", ",_", "0.30", "443", "421", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "tm_", "._", "no", "zzle", "\\u", "air_", "._", "W_", "=_", "1.0", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "tm_", "._", "bearing", "\\u", "air_", "._", "W_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "tm_", "._", "diam", "eter", "\\u", "outer", "\\u", "tube", "_", "=_", "2.2", "250", "4_", "#", ",", " ", "unit", "s", " ", "=", " ", "'", "m", "',", " ", "iot", "ype", "='", "in", "',", " ", "desc", "='", "Tu", "be", " ", "out", " ", "diam", "eter", "')", " ", "#", "7.3", "ft_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "tm_", "._", "length", "\\u", "tube", "_", "=_", "482", "803", "._", "#", ",", " ", "unit", "s", " ", "=", " ", "'", "m", "',", " ", "iot", "ype", "='", "in", "',", " ", "desc", "='", "Length", " ", "of", " ", "entire", " ", "Hyper", "loop", "')", " ", "#", "300", " ", "mile", "s", ",", " ", "158", "4000", "ft_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "tm_", "._", "num", "\\u", "pods", "_", "=_", "34.", "_", "#", ",", " ", "unit", "s", " ", "=", " ", "'", "K", "',", " ", "iot", "ype", "='", "in", "',", " ", "desc", "='", "Number", " ", "of", " ", "Pod", "s", " ", "in", " ", "the", " ", "Tu", "be", " ", "at", " ", "a", " ", "give", "n", " ", "time", "')", " ", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "tm_", "._", "temp", "\\u", "boundary_", "=_", "340_", "#", ",", " ", "unit", "s", " ", "=", " ", "'", "K", "',", " ", "iot", "ype", "='", "in", "',", " ", "desc", "='", "Average", " ", "Tempe", "ratur", "e", " ", "of", " ", "the", " ", "tube", "')", " ", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "tm_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "=_", "305", ".6_", "#", ",", " ", "unit", "s", " ", "=", " ", "'", "K", "',", " ", "iot", "ype", "='", "in", "',", " ", "desc", "='", "Average", " ", "Tempe", "ratur", "e", " ", "of", " ", "the", " ", "outsi", "de", " ", "air", "')", " ", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"----", "-", "Complete", "d", " ", "Tu", "be", " ", "Heat", " ", "Flux", " ", "Model", " ", "Calculat", "ion", "s", "---\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Compress", "Q", "-{}", " ", "Sol", "ar", "Q", "-{}", " ", "Rad", "Q", "-{}", " ", "Conve", "c", "Q", "-{}", "\"_", "._", "format_", "(_", "test_", "._", "tm_", "._", "total", "\\u", "heat", "\\u", "rate", "\\u", "pods", "_", ",_", "test_", "._", "tm_", "._", "q", "\\u", "total", "\\u", "solar", "_", ",_", "test_", "._", "tm_", "._", "q", "\\u", "rad", "\\u", "tot_", ",_", "test_", "._", "tm_", "._", "total", "\\u", "q", "\\u", "nat", "\\u", "conv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Equi", "libr", "ium", " ", "Wall", " ", "Tempe", "ratur", "e", ":", " ", "{}", " ", "K", " ", "or", " ", "{}", " ", "F", "\"_", "._", "format_", "(_", "test_", "._", "tm_", "._", "temp", "\\u", "boundary_", ",_", "cu_", "(_", "test_", "._", "tm_", "._", "temp", "\\u", "boundary_", ",_", "'", "deg", "K", "'_", ",_", "'", "deg", "F", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Ambi", "ent", " ", "Tempe", "ratur", "e", ":", " ", " ", "{}", " ", "K", " ", "or", " ", "{}", " ", "F", "\"_", "._", "format_", "(_", "test_", "._", "tm_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", ",_", "cu_", "(_", "test_", "._", "tm_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", ",_", "'", "deg", "K", "'_", ",_", "'", "deg", "F", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Q", " ", "Out", " ", "=", " ", "{}", " ", "W", " ", " ", "==", ">", " ", " ", "Q", " ", "In", " ", "=", " ", "{}", " ", "W", " ", "==", ">", " ", "Error", ":", " ", "{}", "%\"_", "._", "format_", "(_", "test_", "._", "tm_", "._", "q", "\\u", "total", "\\u", "out_", ",_", "test_", "._", "tm_", "._", "q", "\\u", "total", "\\u", "in_", ",_", "(_", "(_", "test_", "._", "tm_", "._", "q", "\\u", "total", "\\u", "out_", "-_", "test_", "._", "tm_", "._", "q", "\\u", "total", "\\u", "in_", ")_", "/_", "test_", "._", "tm_", "._", "q", "\\u", "total", "\\u", "out_", ")_", "*_", "100_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Tu", "be", "Wall", "Temp_", "(_", "Component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Calculat", "es", " ", "Q", " ", "released", "/", "absor", "bed", " ", "by", " ", "the", " ", "hyper", "loop", " ", "tube", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "-", "Inp", "uts", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Hyper", "loop", " ", "Parameter", "s", "/", "Desig", "n", " ", "Variables_", "\\u\\u\\uNL\\u\\u\\u_", "diam", "eter", "\\u", "outer", "\\u", "tube", "_", "=_", "Float_", "(_", "2.2", "3_", ",_", "units_", "=_", "'", "m", "'_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ",_", "desc_", "=_", "'", "tube", " ", "outer", " ", "diam", "eter", "'_", ")_", "#", "7.3", "ft_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length", "\\u", "tube", "_", "=_", "Float_", "(_", "482", "803", "_", ",_", "units_", "=_", "'", "m", "'_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ",_", "desc_", "=_", "'", "Length", " ", "of", " ", "entire", " ", "Hyper", "loop", "'_", ")_", "#", "300", " ", "mile", "s", ",", " ", "158", "4000", "ft_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "pods", "_", "=_", "Float_", "(_", "34_", ",_", "units_", "=_", "'", "K", "'_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ",_", "desc_", "=_", "'", "Number", " ", "of", " ", "Pod", "s", " ", "in", " ", "the", " ", "Tu", "be", " ", "at", " ", "a", " ", "give", "n", " ", "time", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "boundary_", "=_", "Float_", "(_", "322", ".0_", ",_", "units_", "=_", "'", "K", "'_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ",_", "desc_", "=_", "'", "Average", " ", "Tempe", "ratur", "e", " ", "of", " ", "the", " ", "tube", " ", "wall", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "=_", "Float_", "(_", "305", ".6_", ",_", "units_", "=_", "'", "K", "'_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ",_", "desc_", "=_", "'", "Average", " ", "Tempe", "ratur", "e", " ", "of", " ", "the", " ", "outsi", "de", " ", "air", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "zzle", "\\u", "air_", "=_", "Flow", "Station", "Var_", "(_", "iot", "ype_", "=_", "\"", "in", "\"_", ",_", "desc_", "=_", "\"", "air", " ", "exit", "ing", " ", "the", " ", "pod", " ", "no", "zzle", "\"_", ",_", "copy_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bearing", "\\u", "air_", "=_", "Flow", "Station", "Var_", "(_", "iot", "ype_", "=_", "\"", "in", "\"_", ",_", "desc_", "=_", "\"", "air", " ", "exit", "ing", " ", "the", " ", "air", " ", "bearing", "s", "\"_", ",_", "copy_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "solar", "\\u", "ins", "ola", "tion_", "=_", "Float_", "(_", "1000._", ",_", "iot", "ype_", "=_", "\"", "in", "\"_", ",_", "units_", "=_", "'", "W", "/", "m", "**", "2", "'_", ",_", "desc_", "=_", "'", "solar", " ", "irr", "adi", "ation", " ", "at", " ", "sea", " ", "level", " ", "on", " ", "a", " ", "clear", " ", "day", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "\\u", "inci", "denc", "e\\u", "factor_", "=_", "Float_", "(_", "0.7_", ",_", "iot", "ype_", "=_", "\"", "in", "\"_", ",_", "desc_", "=_", "'", "Non", "-", "normal", " ", "inci", "denc", "e", " ", "factor", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "surf", "ace", "\\u", "reflect", "ance_", "=_", "Float_", "(_", "0.5_", ",_", "desc_", "=_", "'", "Sol", "ar", " ", "Reflect", "anc", "e", " ", "Index", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "per", "\\u", "area", "\\u", "solar", "_", "=_", "Float_", "(_", "350", "._", ",_", "units_", "=_", "'", "W", "/", "m", "**", "2", "'_", ",_", "desc_", "=_", "'", "Sol", "ar", " ", "Heat", " ", "Rat", "e", " ", "Abs", "orb", "ed", " ", "per", " ", "Area", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "total", "\\u", "solar", "_", "=_", "Float_", "(_", "375", "989", "751", "._", ",_", "iot", "ype_", "=_", "\"", "in", "\"_", ",_", "units_", "=_", "'", "W", "'_", ",_", "desc_", "=_", "'", "Sol", "ar", " ", "Heat", " ", "Abs", "orb", "ed", " ", "by", " ", "Tu", "be", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "emis", "si", "vity", "\\u", "tube", "_", "=_", "Float_", "(_", "0.5_", ",_", "iot", "ype_", "=_", "\"", "in", "\"_", ",_", "units_", "=_", "'", "W", "'_", ",_", "desc_", "=_", "'", "Em", "missi", "vity", " ", "of", " ", "the", " ", "Tu", "be", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sb", "\\u", "constant_", "=_", "Float_", "(_", "0.0000000", "567", "037", "3_", ",_", "iot", "ype_", "=_", "\"", "in", "\"_", ",_", "units_", "=_", "'", "W", "/(", "(", "m", "**", "2", ")*", "(", "K", "**", "4", "))'_", ",_", "desc_", "=_", "'", "Ste", "fan", "-", "Bol", "tz", "man", "n", " ", "Const", "ant", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-", "Output", "s", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "area", "\\u", "rad_", "=_", "Float_", "(_", "337", "486", ".1_", ",_", "units_", "=_", "'", "m", "**", "2", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Tu", "be", " ", "Radia", "ting", " ", "Area", "'_", ")_", "#", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Requ", "ired", " ", "for", " ", "Nat", "ural", " ", "Conve", "ction", " ", "Calc", "s_", "\\u\\u\\uNL\\u\\u\\u_", "Gr", "Del", "TL", "3_", "=_", "Float_", "(_", "194", "621", "6.7", "_", ",_", "units_", "=_", "'", "1", "/(", "(", "ft", "**", "3", ")*", "F", ")'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Heat", " ", "Radia", "ted", " ", "to", " ", "the", " ", "outsi", "de", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pr", "_", "=_", "Float_", "(_", "0.70", "7_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Pra", "ndt", "l", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Gr", "_", "=_", "Float_", "(_", "127", "303", "512", "23.", "_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Gra", "sho", "f", " ", "#'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ra", "_", "=_", "Float_", "(_", "899", "631", "208", "5._", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Ray", "lei", "gh", " ", "#'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Nu", "_", "=_", "Float_", "(_", "232", ".4", "543", "713", "_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Nu", "sse", "lt", " ", "#'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "Float_", "(_", "0.02", "655", "_", ",_", "units_", "=_", "'", "W", "/(", "m", "*", "K", ")'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "The", "rmal", " ", "conduct", "ivity", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "Float_", "(_", "0.84", "546", "409", "4_", ",_", "units_", "=_", "'", "W", "/(", "(", "m", "**", "2", ")*", "K", ")'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Heat", " ", "Radia", "ted", " ", "to", " ", "the", " ", "outsi", "de", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "area", "\\u", "conve", "ction_", "=_", "Float_", "(_", "337", "487", "6.1", "15_", ",_", "units_", "=_", "'", "W", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Conve", "ction", " ", "Area", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Nat", "ural", " ", "Conve", "ction_", "\\u\\u\\uNL\\u\\u\\u_", "q", "\\u", "per", "\\u", "area", "\\u", "nat", "\\u", "conv_", "=_", "Float_", "(_", "7.9", "_", ",_", "units_", "=_", "'", "W", "/(", "m", "**", "2", ")'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Heat", " ", "Radia", "ted", " ", "per", " ", "Area", " ", "to", " ", "the", " ", "outsi", "de", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "q", "\\u", "nat", "\\u", "conv_", "=_", "Float_", "(_", "286", "900", "419", "._", ",_", "units_", "=_", "'", "W", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Total", " ", "Heat", " ", "Radia", "ted", " ", "to", " ", "the", " ", "outsi", "de", " ", "via", " ", "Nat", "ural", " ", "Conve", "ction", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Ex", "haus", "ted", " ", "from", " ", "Pod", "s_", "\\u\\u\\uNL\\u\\u\\u_", "heat", "\\u", "rate", "\\u", "pod_", "=_", "Float_", "(_", "519", "763", "_", ",_", "units_", "=_", "'", "W", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Heat", "ing", " ", "Du", "e", " ", "to", " ", "a", " ", "Sing", "le", " ", "Pod", "s", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "heat", "\\u", "rate", "\\u", "pods", "_", "=_", "Float_", "(_", "176", "719", "42.", "_", ",_", "units_", "=_", "'", "W", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Heat", "ing", " ", "Du", "e", " ", "to", " ", "a", " ", "All", " ", "Pod", "s", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Radia", "ted", " ", "Out_", "\\u\\u\\uNL\\u\\u\\u_", "q", "\\u", "rad", "\\u", "per", "\\u", "area_", "=_", "Float_", "(_", "31.", "6_", ",_", "units_", "=_", "'", "W", "/(", "m", "**", "2", ")'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Heat", " ", "Radia", "ted", " ", "to", " ", "the", " ", "outsi", "de", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "rad", "\\u", "tot_", "=_", "Float_", "(_", "106", "761", "066", ".5_", ",_", "units_", "=_", "'", "W", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Heat", " ", "Radia", "ted", " ", "to", " ", "the", " ", "outsi", "de", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Radia", "ted", " ", "In_", "\\u\\u\\uNL\\u\\u\\u_", "viewin", "g", "\\u", "angle_", "=_", "Float_", "(_", "107", "425", "6_", ",_", "units_", "=_", "'", "m", "**", "2", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Effe", "ctive", " ", "Area", " ", "hit", " ", "by", " ", "Sun", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Total", " ", "Heat", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "q", "\\u", "total", "\\u", "out_", "=_", "Float_", "(_", "286", "900", "419", "._", ",_", "units_", "=_", "'", "W", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Total", " ", "Heat", " ", "Release", "d", " ", "via", " ", "Radia", "tion", " ", "and", " ", "Nat", "ural", " ", "Conve", "ction", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "total", "\\u", "in_", "=_", "Float_", "(_", "286", "900", "419", "._", ",_", "units_", "=_", "'", "W", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Total", " ", "Heat", " ", "Abs", "orb", "ed", "/", "Added", " ", "via", " ", "Pod", "s", " ", "and", " ", "Sol", "ar", " ", "Abs", "orp", "tion", "'_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Resid", "ual", " ", "(", "for", " ", "solve", "r", ")_", "\\u\\u\\uNL\\u\\u\\u_", "ss", "\\u", "temp", "\\u", "residual_", "=_", "Float_", "(_", "units_", "=_", "'", "K", "'_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ",_", "desc_", "=_", "'", "Resid", "ual", " ", "of", " ", "T", "\\u", "released", " ", "-", " ", "T", "\\u", "absor", "bed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Tu", "be", "Wall", "Temp_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "e", " ", "Vari", "ous", " ", "Param", "ters", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bearing", "\\u", "q_", "=_", "cu_", "(_", "self_", "._", "bearing", "\\u", "air_", "._", "W_", ",_", "'", "lb", "m", "/", "s", "'_", ",_", "'", "kg", "/", "s", "'_", ")_", "*_", "cu_", "(_", "self_", "._", "bearing", "\\u", "air_", "._", "Cp", "_", ",_", "'", "Bt", "u", "/(", "lb", "m", "*", "deg", "R", ")'_", ",_", "'", "J", "/(", "kg", "*", "K", ")'_", ")_", "*_", "(_", "cu_", "(_", "self_", "._", "bearing", "\\u", "air_", "._", "Tt", "_", ",_", "'", "deg", "R", "'_", ",_", "'", "deg", "K", "'_", ")_", "-_", "self_", "._", "temp", "\\u", "boundary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "zzle", "\\u", "q_", "=_", "cu_", "(_", "self_", "._", "no", "zzle", "\\u", "air_", "._", "W_", ",_", "'", "lb", "m", "/", "s", "'_", ",_", "'", "kg", "/", "s", "'_", ")_", "*_", "cu_", "(_", "self_", "._", "no", "zzle", "\\u", "air_", "._", "Cp", "_", ",_", "'", "Bt", "u", "/(", "lb", "m", "*", "deg", "R", ")'_", ",_", "'", "J", "/(", "kg", "*", "K", ")'_", ")_", "*_", "(_", "cu_", "(_", "self_", "._", "no", "zzle", "\\u", "air_", "._", "Tt", "_", ",_", "'", "deg", "R", "'_", ",_", "'", "deg", "K", "'_", ")_", "-_", "self_", "._", "temp", "\\u", "boundary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Q", " ", "=", " ", "mdo", "t", " ", "*", " ", "cp", " ", "*", " ", "delta", "T", " _", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "heat", "\\u", "rate", "\\u", "pod_", "=_", "no", "zzle", "\\u", "q_", "+_", "bearing", "\\u", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Total", " ", "Q", " ", "=", " ", "Q", " ", "*", " ", "(", "number", " ", "of", " ", "pods", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "total", "\\u", "heat", "\\u", "rate", "\\u", "pods", "_", "=_", "self_", "._", "heat", "\\u", "rate", "\\u", "pod_", "*_", "self_", "._", "num", "\\u", "pods", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Det", "erm", "ine", " ", "thermal", " ", "resistance", " ", "of", " ", "outsi", "de", " ", "via", " ", "Nat", "ural", " ", "Conve", "ction", " ", "or", " ", "forced", " ", "conve", "ction_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "<_", "400_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Gr", "Del", "TL", "3_", "=_", "417", "8000000", "000000000", "0_", "*_", "(_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", ")_", "**_", "(_", "-_", "4.6", "39_", ")_", ")_", "#", "SI", " ", "unit", "s", " ", "(", "https", "://", "mda", "o", ".", "gr", "c", ".", "nasa", ".", "gov", "/", "publications", "/", "Bert", "on", "-", "The", "sis", ".", "pdf", " ", "pg", "5", "1", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Gr", "Del", "TL", "3_", "=_", "498", "5000000", "000000000", "_", "*_", "(_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", ")_", "**_", "(_", "-_", "4.2", "84_", ")_", ")_", "#", "SI", " ", "unit", "s", " ", "(", "https", "://", "mda", "o", ".", "gr", "c", ".", "nasa", ".", "gov", "/", "publications", "/", "Bert", "on", "-", "The", "sis", ".", "pdf", " ", "pg", "5", "1", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pra", "ndt", "l", " ", "Number_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pr", " ", "=", " ", "visc", "ous", " ", "diffusion", " ", "rate", "/", " ", "thermal", " ", "diffusion", " ", "rate", " ", "=", " ", "Cp", " ", "*", " ", "dy", "ana", "mic", " ", "visc", "osity", " ", "/", " ", "thermal", " ", "conduct", "ivity", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pr", " ", "<<", " ", "1", " ", "means", " ", "thermal", " ", "diff", "usi", "vity", " ", "domina", "tes_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pr", " ", ">>", " ", "1", " ", "means", " ", "moment", "um", " ", "diff", "usi", "vity", " ", "domina", "tes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "<_", "400_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pr", "_", "=_", "1.23", "_", "*_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "**_", "(_", "-_", "0.09", "685", "_", ")_", ")_", "#", "SI", " ", "unit", "s", " ", "(", "https", "://", "mda", "o", ".", "gr", "c", ".", "nasa", ".", "gov", "/", "publications", "/", "Bert", "on", "-", "The", "sis", ".", "pdf", " ", "pg", "5", "1", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pr", "_", "=_", "0.59", "_", "*_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "**_", "(_", "0.02", "39_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Gra", "sho", "f", " ", "Number_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Relationship", " ", "bet", "ween", " ", "bu", "oy", "ancy", " ", "and", " ", "visc", "osity", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Lam", "inar", " ", "=", " ", "Gr", " ", "<", " ", "10", "^", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Turb", "ulen", "t", " ", "=", " ", "Gr", " ", ">", " ", "10", "^", "9_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Gr", "_", "=_", "self_", "._", "Gr", "Del", "TL", "3_", "*_", "(_", "self_", "._", "temp", "\\u", "boundary_", "-_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", ")_", "*_", "(_", "self_", "._", "diam", "eter", "\\u", "outer", "\\u", "tube", "_", "**_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Ray", "lei", "gh", " ", "Number", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "Bu", "oy", "ancy", " ", "drive", "n", " ", "flow", " ", "(", "natur", "al", " ", "conve", "ction", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Ra", "_", "=_", "self_", "._", "Pr", "_", "*_", "self_", "._", "Gr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Nu", "sse", "lt", " ", "Number_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Nu", " ", "=", " ", "conve", "ci", "ve", " ", "heat", " ", "transfer", " ", "/", " ", "conduct", "ive", " ", "heat", " ", "transfer_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "Ra", "_", "<=_", "10_", "**_", "12_", ")_", ":_", "#", "valid", " ", "in", " ", "specific", " ", "flow", " ", "regi", "me_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Nu", "_", "=_", "(_", "0.6_", "+_", "0.38", "7_", "*_", "self_", "._", "Ra", "_", "**_", "(_", "1._", "/_", "6._", ")_", "/_", "(_", "1_", "+_", "(_", "0.55", "9_", "/_", "self_", "._", "Pr", "_", ")_", "**_", "(_", "9._", "/_", "16.", "_", ")_", ")_", "**_", "(_", "8._", "/_", "27.", "_", ")_", ")_", "**_", "2_", "#", "3", "rd", " ", "Ed", ".", " ", "of", " ", "Introduc", "tion", " ", "to", " ", "Heat", " ", "Transfer", " ", "by", " ", "Inc", "rope", "ra", " ", "and", " ", "De", "Wi", "tt", ",", " ", "equation", "s", " ", "(", "9.3", "3", ")", " ", "and", " ", "(", "9.3", "4", ")", " ", "on", " ", "page", " ", "465", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "<_", "400_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "k_", "=_", "0.0001", "423", "_", "*_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "**_", "(_", "0.91", "38_", ")_", ")_", "#", "SI", " ", "unit", "s", " ", "(", "https", "://", "mda", "o", ".", "gr", "c", ".", "nasa", ".", "gov", "/", "publications", "/", "Bert", "on", "-", "The", "sis", ".", "pdf", " ", "pg", "5", "1", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "k_", "=_", "0.0002", "494", "_", "*_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "**_", "(_", "0.81", "52_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "h", " ", "=", " ", "k", "*", "Nu", "/", "Characteristic", " ", "Length_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h_", "=_", "(_", "self_", "._", "k_", "*_", "self_", "._", "Nu", "_", ")_", "/_", "self_", "._", "diam", "eter", "\\u", "outer", "\\u", "tube", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Conve", "ction", " ", "Area", " ", "=", " ", "Surf", "ace", " ", "Area_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "area", "\\u", "conve", "ction_", "=_", "pi_", "*_", "self_", "._", "length", "\\u", "tube", "_", "*_", "self_", "._", "diam", "eter", "\\u", "outer", "\\u", "tube", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Det", "erm", "ine", " ", "heat", " ", "radi", "ated", " ", "per", " ", "square", " ", "mete", "r", " ", "(", "Q", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "q", "\\u", "per", "\\u", "area", "\\u", "nat", "\\u", "conv_", "=_", "self_", "._", "h_", "*_", "(_", "self_", "._", "temp", "\\u", "boundary_", "-_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Det", "erm", "ine", " ", "total", " ", "heat", " ", "radi", "ated", " ", "over", " ", "entire", " ", "tube", " ", "(", "Qt", "otal", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "total", "\\u", "q", "\\u", "nat", "\\u", "conv_", "=_", "self_", "._", "q", "\\u", "per", "\\u", "area", "\\u", "nat", "\\u", "conv_", "*_", "self_", "._", "area", "\\u", "conve", "ction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Det", "erm", "ine", " ", "heat", " ", "inco", "ming", " ", "via", " ", "Sun", " ", "radiation", " ", "(", "Inciden", "ce", " ", "Flux", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Sun", " ", "hits", " ", "an", " ", "effective", " ", "rectangular", " ", "cross", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "area", "\\u", "viewin", "g_", "=_", "self_", "._", "length", "\\u", "tube", "_", "*_", "self_", "._", "diam", "eter", "\\u", "outer", "\\u", "tube", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "q", "\\u", "per", "\\u", "area", "\\u", "solar", "_", "=_", "(_", "1_", "-_", "self_", "._", "surf", "ace", "\\u", "reflect", "ance_", ")_", "*_", "self_", "._", "nn", "\\u", "inci", "denc", "e\\u", "factor_", "*_", "self_", "._", "solar", "\\u", "ins", "ola", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "q", "\\u", "total", "\\u", "solar", "_", "=_", "self_", "._", "q", "\\u", "per", "\\u", "area", "\\u", "solar", "_", "*_", "self_", "._", "area", "\\u", "viewin", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Det", "erm", "ine", " ", "heat", " ", "released", " ", "via", " ", "radiation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Radia", "tiv", "e", " ", "area", " ", "=", " ", "surf", "ace", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "area", "\\u", "rad_", "=_", "self_", "._", "area", "\\u", "conve", "ction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "P", "/", "A", " ", "=", " ", "SB", "*", "emm", "isi", "tiv", "it", "y", "*(", "T", "^", "4", " ", "-", " ", "To", "^", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "q", "\\u", "rad", "\\u", "per", "\\u", "area_", "=_", "self_", "._", "sb", "\\u", "constant_", "*_", "self_", "._", "emis", "si", "vity", "\\u", "tube", "_", "*_", "(_", "(_", "self_", "._", "temp", "\\u", "boundary_", "**_", "4_", ")_", "-_", "(_", "self_", "._", "temp", "\\u", "outsi", "de", "\\u", "ambient", "_", "**_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "P", " ", "=", " ", "A", " ", "*", " ", "(", "P", "/", "A", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "q", "\\u", "rad", "\\u", "tot_", "=_", "self_", "._", "area", "\\u", "rad_", "*_", "self_", "._", "q", "\\u", "rad", "\\u", "per", "\\u", "area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Sum", " ", "Up_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "q", "\\u", "total", "\\u", "out_", "=_", "self_", "._", "q", "\\u", "rad", "\\u", "tot_", "+_", "self_", "._", "total", "\\u", "q", "\\u", "nat", "\\u", "conv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "q", "\\u", "total", "\\u", "in_", "=_", "self_", "._", "q", "\\u", "total", "\\u", "solar", "_", "+_", "self_", "._", "total", "\\u", "heat", "\\u", "rate", "\\u", "pods", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ss", "\\u", "temp", "\\u", "residual_", "=_", "(_", "self_", "._", "q", "\\u", "total", "\\u", "out_", "-_", "self_", "._", "q", "\\u", "total", "\\u", "in_", ")_", "/_", "1e6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Tu", "be", "Heat", "Balance", "_", "(_", "Asse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Tu", "be", "Heat", "Balance", "_", "(_", "Asse", "mbly", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "configure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tm_", "=_", "self_", "._", "add_", "(_", "'", "tm", "'_", ",_", "Tu", "be", "Wall", "Temp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "tm", ".", "bearing", "\\u", "air", ".", "set", "Total", "TP", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "self_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Bro", "yde", "n", "Solver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "tm", ".", "temp", "\\u", "bound", "ary", "'_", ",_", "low_", "=_", "0._", ",_", "high_", "=_", "10000", "._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "tm", ".", "ss", "\\u", "temp", "\\u", "residu", "al", "=", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "tm", "'_", "]_", ")_", "\\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,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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 ]
Unused import
eBay/bayesian-belief-networks/bayesian/test/test_undirected_graph.py
[ { "content": "import pytest\n\nimport os\n\nfrom bayesian.bbn import *\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def pytest_funcarg__sprinkler_graph(request):\n '''The Sprinkler Example as a moralized undirected graph\n to be used in tests.\n '''\n cloudy = Node('Cloudy')\n sprinkler = Node('Sprinkler')\n rain = Node('Rain')\n wet_grass = Node('WetGrass')\n cloudy.neighbours = [\n sprinkler, rain]\n sprinkler.neighbours = [cloudy, wet_grass]\n rain.neighbours = [cloudy, wet_grass]\n wet_grass.neighbours = [\n sprinkler,\n rain]\n graph = UndirectedGraph([\n cloudy,\n sprinkler,\n rain,\n wet_grass])\n return graph", "metadata": "root.pytest_funcarg__sprinkler_graph", "header": "['module', '___EOS___']", "index": 7 }, { "content": "class TestUndirectedGraph():\n", "metadata": "root.TestUndirectedGraph", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def test_get_graphviz_source(self, sprinkler_graph):\n gv_src = '''graph G {\n graph [ dpi = 300 bgcolor=\"transparent\" rankdir=\"LR\"];\n Cloudy [ shape=\"ellipse\" color=\"blue\"];\n Sprinkler [ shape=\"ellipse\" color=\"blue\"];\n Rain [ shape=\"ellipse\" color=\"blue\"];\n WetGrass [ shape=\"ellipse\" color=\"blue\"];\n Rain -- WetGrass;\n Sprinkler -- WetGrass;\n Cloudy -- Sprinkler;\n Cloudy -- Rain;\n}\n'''\n assert sprinkler_graph.get_graphviz_source() == gv_src", "metadata": "root.TestUndirectedGraph.test_get_graphviz_source", "header": "['class', 'TestUndirectedGraph', '(', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "import pytest", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 13 }, { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pytest_", "\\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_", "from_", "bayes", "ian_", "._", "bb", "n_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "pytest", "\\u", "func", "arg", "\\u\\u", "spri", "nk", "ler", "\\u", "graph_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "The", " ", "Sprin", "kle", "r", " ", "Exam", "ple", " ", "as", " ", "a", " ", "mor", "alize", "d", " ", "undi", "rect", "ed", " ", "graph", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "used", " ", "in", " ", "tests", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cloud", "y_", "=_", "Node_", "(_", "'", "Cloud", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spri", "nk", "ler_", "=_", "Node_", "(_", "'", "Sprin", "kle", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rain_", "=_", "Node_", "(_", "'", "Rain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wet", "\\u", "grass", "_", "=_", "Node_", "(_", "'", "We", "t", "Gra", "ss", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cloud", "y_", "._", "neighbours_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "spri", "nk", "ler_", ",_", "rain_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spri", "nk", "ler_", "._", "neighbours_", "=_", "[_", "cloud", "y_", ",_", "wet", "\\u", "grass", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rain_", "._", "neighbours_", "=_", "[_", "cloud", "y_", ",_", "wet", "\\u", "grass", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wet", "\\u", "grass", "_", "._", "neighbours_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "spri", "nk", "ler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rain_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Und", "irect", "ed", "Graph_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "cloud", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spri", "nk", "ler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wet", "\\u", "grass", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Und", "irect", "ed", "Graph_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Und", "irect", "ed", "Graph_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "get", "\\u", "graphviz", "\\u", "source_", "(_", "self_", ",_", "spri", "nk", "ler", "\\u", "graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gv", "\\u", "src_", "=_", "'''", "graph", " ", "G", " ", "{", "\\", "10", ";", " ", " ", "graph", " ", "[", " ", "dp", "i", " ", "=", " ", "300", " ", "bg", "color", "=\"", "transp", "arent", "\"", " ", "rank", "dir", "=\"", "LR", "\"]", ";", "\\", "10", ";", " ", " ", "Cloud", "y", " ", "[", " ", "shape", "=\"", "ellips", "e", "\"", " ", "color", "=\"", "blue", "\"]", ";", "\\", "10", ";", " ", " ", "Sprin", "kle", "r", " ", "[", " ", "shape", "=\"", "ellips", "e", "\"", " ", "color", "=\"", "blue", "\"]", ";", "\\", "10", ";", " ", " ", "Rain", " ", "[", " ", "shape", "=\"", "ellips", "e", "\"", " ", "color", "=\"", "blue", "\"]", ";", "\\", "10", ";", " ", " ", "We", "t", "Gra", "ss", " ", "[", " ", "shape", "=\"", "ellips", "e", "\"", " ", "color", "=\"", "blue", "\"]", ";", "\\", "10", ";", " ", " ", "Rain", " ", "--", " ", "We", "t", "Gra", "ss", ";", "\\", "10", ";", " ", " ", "Sprin", "kle", "r", " ", "--", " ", "We", "t", "Gra", "ss", ";", "\\", "10", ";", " ", " ", "Cloud", "y", " ", "--", " ", "Sprin", "kle", "r", ";", "\\", "10", ";", " ", " ", "Cloud", "y", " ", "--", " ", "Rain", ";", "\\", "10", ";}", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "spri", "nk", "ler", "\\u", "graph_", "._", "get", "\\u", "graphviz", "\\u", "source_", "(_", ")_", "==_", "gv", "\\u", "src_" ]
[ 4, 4, 4, 4, 4, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
neuropoly/spinalcordtoolbox/testing/test_sct_get_centerline.py
[ { "content": "def test(path_data='', parameters=''):\n\n if not parameters:\n parameters = '-i t2/t2.nii.gz -c t2 -p auto'\n\n # parameters\n folder_data = 't2/'\n file_data = ['t2.nii.gz', 't2_centerline_init.nii.gz', 't2_centerline_labels.nii.gz', 't2_seg_manual.nii.gz']\n\n parser = sct_get_centerline.get_parser()\n dict_param = parser.parse(parameters.split(), check_file_exist=False)\n contrast = dict_param['-c']\n dict_param_with_path = parser.add_path_to_file(dict_param, path_data, input_file=True)\n param_with_path = parser.dictionary_to_string(dict_param_with_path)\n\n # Check if input files exist\n if not (os.path.isfile(dict_param_with_path['-i'])):\n status = 200\n output = 'ERROR: the file(s) provided to test function do not exist in folder: ' + path_data\n return status, output, DataFrame(data={'status': status, 'output': output, 'mse': float('nan'), 'dist_max': float('nan')}, index=[path_data])\n\n cmd = 'sct_get_centerline '+param_with_path\n status, output = sct.run(cmd, 0)\n scad_centerline = Image(contrast+\"_centerline.nii.gz\")\n manual_seg = Image(path_data + folder_data + contrast +'_seg_manual.nii.gz')\n\n max_distance = 0\n standard_deviation = 0\n average = 0\n root_mean_square = 0\n overall_distance = 0\n max_distance = 0\n overall_std = 0\n rmse = 0\n\n try:\n if status == 0:\n manual_seg.change_orientation()\n scad_centerline.change_orientation()\n from scipy.ndimage.measurements import center_of_mass\n # find COM\n iterator = range(manual_seg.data.shape[2])\n com_x = [0 for ix in iterator]\n com_y = [0 for iy in iterator]\n\n for iz in iterator:\n com_x[iz], com_y[iz] = center_of_mass(manual_seg.data[:, :, iz])\n max_distance = {}\n distance = {}\n for iz in range(1, scad_centerline.data.shape[2]-1):\n ind1 = np.argmax(scad_centerline.data[:, :, iz])\n X,Y = ind2sub(scad_centerline.data[:, :, iz].shape,ind1)\n com_phys = np.array(manual_seg.transfo_pix2phys([[com_x[iz], com_y[iz], iz]]))\n scad_phys = np.array(scad_centerline.transfo_pix2phys([[X, Y, iz]]))\n distance_magnitude = np.linalg.norm([com_phys[0][0]-scad_phys[0][0], com_phys[0][1]-scad_phys[0][1], 0])\n if math.isnan(distance_magnitude):\n print \"Value is nan\"\n else:\n distance[iz] = distance_magnitude\n\n max_distance = max(distance.values())\n standard_deviation = np.std(np.array(distance.values()))\n average = sum(distance.values())/len(distance)\n root_mean_square = np.sqrt(np.mean(np.square(distance.values())))\n overall_distance = average\n max_distance = max(distance.values())\n overall_std = standard_deviation\n rmse = root_mean_square\n\n except Exception, e:\n sct.printv(\"Exception found while testing scad integrity\")\n output = e.message\n\n result_mse, result_dist_max = rmse, max_distance\n results = DataFrame(data={'status': status, 'output': output, 'mse': result_mse, 'dist_max': result_dist_max}, index=[path_data])\n\n # define command\n cmd = 'sct_get_centerline -i ' + path_data + folder_data + file_data[0] \\\n + ' -p labels ' \\\n + ' -l ' + path_data + folder_data + file_data[2] \\\n + ' -v 1'\n output += '\\n====================================================================================================\\n'+cmd+'\\n====================================================================================================\\n\\n' # copy command\n s, o = commands.getstatusoutput(cmd)\n status += s\n output += o\n\n return status, output, results", "metadata": "root.test", "header": "['module', '___EOS___']", "index": 26 } ]
[ { "span": "overall_distance ", "start_line": 90, "start_column": 12, "end_line": 90, "end_column": 28 }, { "span": "overall_std ", "start_line": 92, "start_column": 12, "end_line": 92, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "path", "\\u", "data_", "=_", "''_", ",_", "parameters_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameters_", "=_", "'-", "i", " ", "t2", "/", "t2", ".", "ni", "i", ".", "gz", " ", "-", "c", " ", "t2", " ", "-", "p", " ", "auto", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "folder", "\\u", "data_", "=_", "'", "t2", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "data_", "=_", "[_", "'", "t2", ".", "ni", "i", ".", "gz", "'_", ",_", "'", "t2", "\\u", "center", "line", "\\u", "init", ".", "ni", "i", ".", "gz", "'_", ",_", "'", "t2", "\\u", "center", "line", "\\u", "labels", ".", "ni", "i", ".", "gz", "'_", ",_", "'", "t2", "\\u", "seg", "\\u", "manu", "al", ".", "ni", "i", ".", "gz", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "sct", "\\u", "get", "\\u", "center", "line_", "._", "get", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict", "\\u", "param_", "=_", "parser_", "._", "parse_", "(_", "parameters_", "._", "split_", "(_", ")_", ",_", "check", "\\u", "file", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contrast", "_", "=_", "dict", "\\u", "param_", "[_", "'-", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict", "\\u", "param", "\\u", "with", "\\u", "path_", "=_", "parser_", "._", "add", "\\u", "path", "\\u", "to", "\\u", "file_", "(_", "dict", "\\u", "param_", ",_", "path", "\\u", "data_", ",_", "input", "\\u", "file_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "with", "\\u", "path_", "=_", "parser_", "._", "dictionar", "y", "\\u", "to", "\\u", "string_", "(_", "dict", "\\u", "param", "\\u", "with", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "input", " ", "files", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "os_", "._", "path_", "._", "isfile_", "(_", "dict", "\\u", "param", "\\u", "with", "\\u", "path_", "[_", "'-", "i", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "'", "ERROR", ":", " ", "the", " ", "file", "(", "s", ")", " ", "provided", " ", "to", " ", "test", " ", "function", " ", "do", " ", "not", " ", "exist", " ", "in", " ", "folder", ":", " ", "'_", "+_", "path", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "status_", ",_", "output_", ",_", "Data", "Frame_", "(_", "data_", "=_", "{_", "'", "status", "'_", ":_", "status_", ",_", "'", "output", "'_", ":_", "output_", ",_", "'", "mse", "'_", ":_", "float_", "(_", "'", "nan", "'_", ")_", ",_", "'", "dist", "\\u", "max", "'_", ":_", "float_", "(_", "'", "nan", "'_", ")_", "}_", ",_", "index_", "=_", "[_", "path", "\\u", "data_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "'", "sct", "\\u", "get", "\\u", "center", "line", " ", "'_", "+_", "param", "\\u", "with", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sca", "d\\u", "center", "line_", "=_", "Image_", "(_", "contrast", "_", "+_", "\"\\u", "center", "line", ".", "ni", "i", ".", "gz", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manu", "al", "\\u", "seg_", "=_", "Image_", "(_", "path", "\\u", "data_", "+_", "folder", "\\u", "data_", "+_", "contrast", "_", "+_", "'\\u", "seg", "\\u", "manu", "al", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "distance_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "standard", "\\u", "deviation", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "average_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "\\u", "mean", "\\u", "square_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "distance_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "distance_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "std_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "status_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manu", "al", "\\u", "seg_", "._", "change", "\\u", "orientation_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sca", "d\\u", "center", "line_", "._", "change", "\\u", "orientation_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "ndimage_", "._", "measurements_", "import_", "center", "\\u", "of", "\\u", "mass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "COM", "_", "\\u\\u\\uNL\\u\\u\\u_", "iterator_", "=_", "range_", "(_", "manu", "al", "\\u", "seg_", "._", "data_", "._", "shape_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "com", "\\u", "x_", "=_", "[_", "0_", "for_", "ix_", "in_", "iterator_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "com", "\\u", "y_", "=_", "[_", "0_", "for_", "iy_", "in_", "iterator_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "iz_", "in_", "iterator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "com", "\\u", "x_", "[_", "iz_", "]_", ",_", "com", "\\u", "y_", "[_", "iz_", "]_", "=_", "center", "\\u", "of", "\\u", "mass_", "(_", "manu", "al", "\\u", "seg_", "._", "data_", "[_", ":_", ",_", ":_", ",_", "iz_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "\\u", "distance_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distance_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iz_", "in_", "range_", "(_", "1_", ",_", "sca", "d\\u", "center", "line_", "._", "data_", "._", "shape_", "[_", "2_", "]_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ind1", "_", "=_", "np_", "._", "argmax_", "(_", "sca", "d\\u", "center", "line_", "._", "data_", "[_", ":_", ",_", ":_", ",_", "iz_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", ",_", "Y_", "=_", "ind2", "sub_", "(_", "sca", "d\\u", "center", "line_", "._", "data_", "[_", ":_", ",_", ":_", ",_", "iz_", "]_", "._", "shape_", ",_", "ind1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "com", "\\u", "phys", "_", "=_", "np_", "._", "array_", "(_", "manu", "al", "\\u", "seg_", "._", "transf", "o", "\\u", "pix", "2p", "hys", "_", "(_", "[_", "[_", "com", "\\u", "x_", "[_", "iz_", "]_", ",_", "com", "\\u", "y_", "[_", "iz_", "]_", ",_", "iz_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sca", "d\\u", "phys", "_", "=_", "np_", "._", "array_", "(_", "sca", "d\\u", "center", "line_", "._", "transf", "o", "\\u", "pix", "2p", "hys", "_", "(_", "[_", "[_", "X_", ",_", "Y_", ",_", "iz_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distance", "\\u", "magnitude_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "[_", "com", "\\u", "phys", "_", "[_", "0_", "]_", "[_", "0_", "]_", "-_", "sca", "d\\u", "phys", "_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "com", "\\u", "phys", "_", "[_", "0_", "]_", "[_", "1_", "]_", "-_", "sca", "d\\u", "phys", "_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "math_", "._", "isnan_", "(_", "distance", "\\u", "magnitude_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Value", " ", "is", " ", "nan", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "distance_", "[_", "iz_", "]_", "=_", "distance", "\\u", "magnitude_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "\\u", "distance_", "=_", "max_", "(_", "distance_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "standard", "\\u", "deviation", "_", "=_", "np_", "._", "std_", "(_", "np_", "._", "array_", "(_", "distance_", "._", "values_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "average_", "=_", "sum_", "(_", "distance_", "._", "values_", "(_", ")_", ")_", "/_", "len_", "(_", "distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "\\u", "mean", "\\u", "square_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "mean_", "(_", "np_", "._", "square_", "(_", "distance_", "._", "values_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "distance_", "=_", "average_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "distance_", "=_", "max_", "(_", "distance_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "std_", "=_", "standard", "\\u", "deviation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "_", "=_", "root", "\\u", "mean", "\\u", "square_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "\"", "Except", "ion", " ", "found", " ", "whi", "le", " ", "testi", "ng", " ", "sca", "d", " ", "integrity", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "\\u", "mse_", ",_", "result", "\\u", "dist", "\\u", "max_", "=_", "rmse", "_", ",_", "max", "\\u", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "Data", "Frame_", "(_", "data_", "=_", "{_", "'", "status", "'_", ":_", "status_", ",_", "'", "output", "'_", ":_", "output_", ",_", "'", "mse", "'_", ":_", "result", "\\u", "mse_", ",_", "'", "dist", "\\u", "max", "'_", ":_", "result", "\\u", "dist", "\\u", "max_", "}_", ",_", "index_", "=_", "[_", "path", "\\u", "data_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "'", "sct", "\\u", "get", "\\u", "center", "line", " ", "-", "i", " ", "'_", "+_", "path", "\\u", "data_", "+_", "folder", "\\u", "data_", "+_", "file", "\\u", "data_", "[_", "0_", "]_", "+_", "'", " ", "-", "p", " ", "labels", " ", "'_", "+_", "'", " ", "-", "l", " ", "'_", "+_", "path", "\\u", "data_", "+_", "folder", "\\u", "data_", "+_", "file", "\\u", "data_", "[_", "2_", "]_", "+_", "'", " ", "-", "v", " ", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "+=_", "'\\\\", "n", "==============", "==============", "==============", "==============", "==============", "==============", "==============", "==", "\\\\", "n", "'_", "+_", "cmd_", "+_", "'\\\\", "n", "==============", "==============", "==============", "==============", "==============", "==============", "==============", "==", "\\\\", "n", "\\\\", "n", "'_", "#", " ", "copy", " ", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", ",_", "o_", "=_", "commands_", "._", "getstatus", "output_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "+=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "+=_", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "status_", ",_", "output_", ",_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
dimagi/commcare-hq/corehq/apps/app_manager/xml_utils.py
[ { "content": " def render(self, depth=0):\n children = []\n next_depth = depth + 1 if self.name else depth\n for child in self.children:\n if isinstance(child, XMLObject):\n child = child.render(depth+1)\n else:\n #child = \" \"*(depth+1) + unicode(child)\n child = unicode(child)\n children.append(child)\n #children = u\"\\n\".join(children)\n children = u\"\".join(children)\n\n if self.name:\n options = u\"\".join([u' %s=\"%s\"' % (opt, val) for (opt, val) in self.options.items()])\n if (not children) and self.collapsable:\n return u\"<%s%s />\" % (self.name, options)\n else:\n return u\"<%(name)s%(options)s>%(children)s</%(name)s>\" % {\n 'name':self.name, 'options':options, 'children':children}\n else:\n return children", "metadata": "root.XMLTag.render", "header": "['class', 'XMLTag', '(', 'XMLObject', ')', ':', '___EOS___']", "index": 37 } ]
[ { "span": "next_depth ", "start_line": 39, "start_column": 8, "end_line": 39, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "XML", "Tag_", "(_", "XML", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "depth_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "children_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "depth_", "=_", "depth_", "+_", "1_", "if_", "self_", "._", "name_", "else_", "depth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "self_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "child_", ",_", "XML", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "child_", "._", "render_", "(_", "depth_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "child", " ", "=", " ", "\"", " ", " ", "\"*", "(", "depth", "+", "1", ")", " ", "+", " ", "unicode", "(", "child", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "unicode_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "children_", "._", "append_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "child", "ren", " ", "=", " ", "u", "\"\\\\", "n", "\".", "join", "(", "child", "ren", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "children_", "=_", "u", "\"\"_", "._", "join_", "(_", "children_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "u", "\"\"_", "._", "join_", "(_", "[_", "u", "'", " ", "%", "s", "=\"", "%", "s", "\"'_", "%_", "(_", "opt_", ",_", "val_", ")_", "for_", "(_", "opt_", ",_", "val_", ")_", "in_", "self_", "._", "options_", "._", "items_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "children_", ")_", "and_", "self_", "._", "colla", "ps", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "u", "\"<", "%", "s", "%", "s", " ", "/>\"_", "%_", "(_", "self_", "._", "name_", ",_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "u", "\"<", "%", "(", "name", ")", "s", "%", "(", "options", ")", "s", ">", "%", "(", "child", "ren", ")", "s", "</", "%", "(", "name", ")", "s", ">\"_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "self_", "._", "name_", ",_", "'", "options", "'_", ":_", "options_", ",_", "'", "child", "ren", "'_", ":_", "children_", "}_", "\\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_", "children_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
django/django/django/template/base.py
[ { "content": " def tokenize(self):\n \"\"\"\n Split a template string into tokens and annotates each token with its\n start and end position in the source. This is slower than the default\n lexer so we only use it when debug is True.\n \"\"\"\n lineno = 1\n result = []\n upto = 0\n for match in tag_re.finditer(self.template_string):\n start, end = match.span()\n if start > upto:\n token_string = self.template_string[upto:start]\n result.append(self.create_token(token_string, (upto, start), lineno, in_tag=False))\n lineno += token_string.count('\\n')\n upto = start\n token_string = self.template_string[start:end]\n result.append(self.create_token(token_string, (start, end), lineno, in_tag=True))\n lineno += token_string.count('\\n')\n upto = end\n last_bit = self.template_string[upto:]\n if last_bit:\n result.append(self.create_token(last_bit, (upto, upto + len(last_bit)), lineno, in_tag=False))\n return result", "metadata": "root.DebugLexer.tokenize", "header": "['class', 'DebugLexer', '(', 'Lexer', ')', ':', '___EOS___']", "index": 421 } ]
[ { "span": "upto ", "start_line": 436, "start_column": 16, "end_line": 436, "end_column": 20 } ]
[ { "span": "upto ", "start_line": 440, "start_column": 12, "end_line": 440, "end_column": 16 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Deb", "ug", "Lexer_", "(_", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "tokenize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Split", " ", "a", " ", "template", " ", "string", " ", "int", "o", " ", "token", "s", " ", "and", " ", "annot", "ates", " ", "each", " ", "token", " ", "with", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "start", " ", "and", " ", "end", " ", "position", " ", "in", " ", "the", " ", "source", ".", " ", "Thi", "s", " ", "is", " ", "slowe", "r", " ", "than", " ", "the", " ", "default", "\\", "10", ";", " ", " ", " ", " ", "lexer", " ", "so", " ", "we", " ", "only", " ", "use", " ", "it", " ", "whe", "n", " ", "debug", " ", "is", " ", "Tru", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upto", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "match_", "in_", "tag", "\\u", "re_", "._", "finditer_", "(_", "self_", "._", "template", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "end_", "=_", "match_", "._", "span_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start_", ">_", "upto", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token", "\\u", "string_", "=_", "self_", "._", "template", "\\u", "string_", "[_", "upto", "_", ":_", "start_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "self_", "._", "create", "\\u", "token_", "(_", "token", "\\u", "string_", ",_", "(_", "upto", "_", ",_", "start_", ")_", ",_", "lineno_", ",_", "in", "\\u", "tag_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "+=_", "token", "\\u", "string_", "._", "count_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upto", "_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "token", "\\u", "string_", "=_", "self_", "._", "template", "\\u", "string_", "[_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "self_", "._", "create", "\\u", "token_", "(_", "token", "\\u", "string_", ",_", "(_", "start_", ",_", "end_", ")_", ",_", "lineno_", ",_", "in", "\\u", "tag_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "+=_", "token", "\\u", "string_", "._", "count_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upto", "_", "=_", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "bit_", "=_", "self_", "._", "template", "\\u", "string_", "[_", "upto", "_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "bit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "self_", "._", "create", "\\u", "token_", "(_", "last", "\\u", "bit_", ",_", "(_", "upto", "_", ",_", "upto", "_", "+_", "len_", "(_", "last", "\\u", "bit_", ")_", ")_", ",_", "lineno_", ",_", "in", "\\u", "tag_", "=_", "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, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tropo/tropo-webapi-python/samples/gh-5.hello_cgi.py
[ { "content": "#!/usr/bin/python\n\n# Hello, World CGI script.\n# Addresses gh-5.\n# Steps:\n# 1. edit Apache httpd.conf file\n# Alias /tropo/ \"/path/to/examples/\"\n# <Directory \"/path/to/examples\">\n# Options +ExecCGI\n# SetHandler cgi-script\n# Allow from all\n# AllowOverride All\n# </Directory>\n# 2. Create Web API app in Tropo and assign it the url \n# http://my_webserver.com/tropo/g-5.hello_cgi.py\n# 3. Place this file in examples folder and chmod it executable\n# 4. Dial up Tropo app, and hear \"Hello, World ...\"\n\nimport cgi\nfrom tropo import Tropo\n\n\n\n\nprint \"Content-type: text/json\"\nprint\nprint \n\nhello()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def hello():\n t = Tropo()\n t.say(['hello world! I am a C G I script.'])\n json = t.RenderJson()\n print json\n return json", "metadata": "root.hello", "header": "['module', '___EOS___']", "index": 21 } ]
[ { "span": "import cgi", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hell", "o", ",", " ", "Wor", "ld", " ", "CGI", " ", "script", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Address", "es", " ", "gh", "-", "5._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "edit", " ", "Ap", "ache", " ", "http", "d", ".", "conf", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Ali", "as", " ", "/", "trop", "o", "/", " ", "\"/", "path", "/", "to", "/", "example", "s", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "Director", "y", " ", "\"/", "path", "/", "to", "/", "example", "s", "\">", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Optio", "ns", " ", "+", "Exe", "c", "CGI", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Set", "Handle", "r", " ", "cgi", "-", "script_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "All", "ow", " ", "from", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "All", "ow", "Override", " ", "All_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "</", "Director", "y", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "2", ".", " ", "Creat", "e", " ", "Web", " ", "API", " ", "app", " ", "in", " ", "Trop", "o", " ", "and", " ", "assign", " ", "it", " ", "the", " ", "url", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "my", "\\u", "webse", "rver", ".", "com", "/", "trop", "o", "/", "g", "-", "5", ".", "hell", "o", "\\u", "cgi", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "3", ".", " ", "Place", " ", "this", " ", "file", " ", "in", " ", "example", "s", " ", "folder", " ", "and", " ", "chm", "od", " ", "it", " ", "executable_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "4", ".", " ", "Dial", " ", "up", " ", "Trop", "o", " ", "app", ",", " ", "and", " ", "hear", " ", "\"", "Hell", "o", ",", " ", "Wor", "ld", " ", "...\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trop", "o_", "import_", "Trop", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Conten", "t", "-", "type", ":", " ", "text", "/", "json", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hello_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "hello_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "Trop", "o_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "say_", "(_", "[_", "'", "hell", "o", " ", "world", "!", " ", "I", " ", "am", " ", "a", " ", "C", " ", "G", " ", "I", " ", "script", ".'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "=_", "t_", "._", "Render", "Json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "\\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, 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py
[ { "content": " def test_get_hosts_from_dynamic_inventory(self):\n cmd = [\"echo\", json_example]\n actual = healthchecks.get_hosts_from_dynamic_inventory(cmd)\n expected = [ \"52.53.226.175\", \"54.183.112.122\", \"52.53.236.230\" ]\n self.assertEqual(expected, actual)\n\n # Just make sure this doesn't traceback or anything\n cmd = [\"python2\", \"plugins/inventory/terraform.py\", \"--list\"]\n actual = healthchecks.get_hosts_from_dynamic_inventory(cmd)", "metadata": "root.TestHealthChecks.test_get_hosts_from_dynamic_inventory", "header": "['class', 'TestHealthChecks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 381 } ]
[ { "span": "actual ", "start_line": 389, "start_column": 8, "end_line": 389, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Health", "Check", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "host", "s", "\\u", "from", "\\u", "dynami", "c\\u", "inventory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "[_", "\"", "echo", "\"_", ",_", "json", "\\u", "example_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "healthcheck", "s_", "._", "get", "\\u", "host", "s", "\\u", "from", "\\u", "dynami", "c\\u", "inventory_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "\"", "52.", "53.", "226", ".1", "7", "5", "\"_", ",_", "\"", "54.", "183", ".1", "12.", "122", "\"_", ",_", "\"", "52.", "53.", "236", ".2", "30", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ju", "st", " ", "make", " ", "sure", " ", "this", " ", "doe", "sn", "'", "t", " ", "traceback", " ", "or", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "python", "2", "\"_", ",_", "\"", "plugin", "s", "/", "inventor", "y", "/", "terra", "form", ".", "py", "\"_", ",_", "\"--", "list", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "healthcheck", "s_", "._", "get", "\\u", "host", "s", "\\u", "from", "\\u", "dynami", "c\\u", "inventory_", "(_", "cmd_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pgiri/asyncoro/py2/asyncoro/discoronode.py
[ { "content": "#!/usr/bin/python\n\n\"\"\"This file is part of asyncoro; see http://asyncoro.sourceforge.net for\ndetails.\n\nThis program can be used to start discoro server processes so discoro scheduler\n(see 'discoro.py') can send computations to these server processes for executing\ndistributed communicating proceses (coroutines). All coroutines in a server\nexecute in the same thread, so multiple CPUs are not used by one server. If CPU\nintensive computations are to be run on systems with multiple processors, then\nthis program should be run with multiple instances (see below for '-c' option to\nthis program).\n\nSee 'discoro_client*.py' files for example use cases.\n\"\"\"\n\n__author__ = \"Giridhar Pemmasani ([email protected])\"\n__copyright__ = \"Copyright (c) 2014 Giridhar Pemmasani\"\n__license__ = \"MIT\"\n__url__ = \"http://asyncoro.sourceforge.net\"\n\n\n\n\n\n\nif __name__ == '__main__':\n\n \"\"\"\n See http://asyncoro.sourceforge.net/discoro.html#node-servers for details on\n options to start this program.\n \"\"\"\n\n import sys\n import time\n import argparse\n import multiprocessing\n import socket\n import os\n import collections\n import hashlib\n import logging\n try:\n import readline\n except:\n pass\n import asyncoro.disasyncoro as asyncoro\n\n try:\n import psutil\n except ImportError:\n print('\\n \\'psutil\\' module is not available; '\n 'CPU, memory, disk status will not be sent!\\n')\n psutil = None\n else:\n psutil.cpu_percent(0.1)\n\n parser = argparse.ArgumentParser()\n parser.add_argument('-c', '--cpus', dest='cpus', type=int, default=0,\n help='number of CPUs/discoro instances to run; '\n 'if negative, that many CPUs are not used')\n parser.add_argument('-i', '--ip_addr', dest='node', default=None,\n help='IP address or host name of this node')\n parser.add_argument('--ext_ip_addr', dest='ext_ip_addr', default=None,\n help='External IP address to use (needed in case of NAT firewall/gateway)')\n parser.add_argument('-u', '--udp_port', dest='udp_port', type=int, default=51350,\n help='UDP port number to use')\n parser.add_argument('--tcp_ports', dest='tcp_ports', action='append', default=[],\n help='TCP port numbers to use')\n parser.add_argument('-n', '--name', dest='name', default=None,\n help='(symbolic) name given to AsynCoro schdulers on this node')\n parser.add_argument('--dest_path', dest='dest_path', default=None,\n help='path prefix to where files sent by peers are stored')\n parser.add_argument('--max_file_size', dest='max_file_size', default=None, type=int,\n help='maximum file size of any file transferred')\n parser.add_argument('-s', '--secret', dest='secret', default='',\n help='authentication secret for handshake with peers')\n parser.add_argument('--certfile', dest='certfile', default=None,\n help='file containing SSL certificate')\n parser.add_argument('--keyfile', dest='keyfile', default=None,\n help='file containing SSL key')\n parser.add_argument('--serve', dest='serve', default=-1, type=int,\n help='number of clients to serve before exiting')\n parser.add_argument('--min_pulse_interval', dest='min_pulse_interval', default=0, type=int,\n help='minimum pulse interval clients can use in number of seconds')\n parser.add_argument('--max_pulse_interval', dest='max_pulse_interval', default=0, type=int,\n help='maximum pulse interval clients can use in number of seconds')\n parser.add_argument('--daemon', action='store_true', dest='daemon', default=False,\n help='if given, input is not read from terminal')\n parser.add_argument('--phoenix', action='store_true', dest='phoenix', default=False,\n help='if given, server processes from previous run will be killed '\n 'and new server process started')\n parser.add_argument('--discover_peers', action='store_true', dest='discover_peers',\n default=False,\n help='if given, peers are discovered during startup')\n parser.add_argument('--peer', dest='peers', action='append', default=[],\n help='peer location (in the form node:TCPport) to communicate')\n parser.add_argument('-d', '--debug', action='store_true', dest='loglevel', default=False,\n help='if given, debug messages are printed')\n _discoro_config = vars(parser.parse_args(sys.argv[1:]))\n\n if _discoro_config['min_pulse_interval'] and _discoro_config['min_pulse_interval'] < 1:\n raise Exception('min_pulse_interval must be at least 1')\n if (_discoro_config['max_pulse_interval'] and _discoro_config['min_pulse_interval'] and\n _discoro_config['max_pulse_interval'] < _discoro_config['min_pulse_interval']):\n raise Exception('max_pulse_interval must be at least min_pulse_interval')\n\n _discoro_cpus = multiprocessing.cpu_count()\n if _discoro_config['cpus'] > 0:\n if _discoro_config['cpus'] > _discoro_cpus:\n raise Exception('CPU count must be <= %s' % _discoro_cpus)\n _discoro_cpus = _discoro_config['cpus']\n elif _discoro_config['cpus'] < 0:\n if -_discoro_config['cpus'] >= _discoro_cpus:\n raise Exception('CPU count must be > -%s' % _discoro_cpus)\n _discoro_cpus += _discoro_config['cpus']\n del _discoro_config['cpus']\n\n _discoro_tcp_ports = set()\n tcp_port = tcp_ports = None\n for tcp_port in _discoro_config.pop('tcp_ports', []):\n tcp_ports = tcp_port.split('-')\n if len(tcp_ports) == 1:\n _discoro_tcp_ports.add(int(tcp_ports[0]))\n elif len(tcp_ports) == 2:\n _discoro_tcp_ports = _discoro_tcp_ports.union(range(int(tcp_ports[0]),\n int(tcp_ports[1]) + 1))\n else:\n raise Exception('Invalid TCP port range \"%s\"' % tcp_ports)\n _discoro_tcp_ports = sorted(_discoro_tcp_ports)\n\n if _discoro_tcp_ports:\n for tcp_port in range(_discoro_tcp_ports[-1] + 1,\n _discoro_tcp_ports[-1] + 1 +\n (_discoro_cpus + 1) - len(_discoro_tcp_ports)):\n _discoro_tcp_ports.append(tcp_port)\n else:\n _discoro_tcp_ports = [0] * (_discoro_cpus + 1)\n\n _discoro_peers, _discoro_config['peers'] = _discoro_config['peers'], []\n peer = None\n for peer in _discoro_peers:\n peer = peer.split(':')\n if len(peer) != 2:\n raise Exception('peer %s is not valid' % ':'.join(peer))\n _discoro_config['peers'].append(asyncoro.Location(peer[0], peer[1]))\n del peer\n _discoro_peers = _discoro_config['peers']\n\n _discoro_name = _discoro_config['name']\n if not _discoro_name:\n _discoro_name = socket.gethostname()\n if not _discoro_name:\n _discoro_name = 'discoro_server'\n\n _discoro_daemon = _discoro_config.pop('daemon', False)\n if not _discoro_daemon:\n try:\n if os.getpgrp() != os.tcgetpgrp(sys.stdin.fileno()):\n _discoro_daemon = True\n except:\n pass\n _discoro_auth = hashlib.sha1(os.urandom(10).encode('hex')).hexdigest()\n\n _discoro_server_infos = []\n _discoro_ServerInfo = collections.namedtuple('DiscoroServerInfo', ['Proc', 'Queue'])\n _discoro_mp_queue = None\n for _discoro_server_id in range(1, _discoro_cpus+1):\n _discoro_config['name'] = '%s-%s' % (_discoro_name, _discoro_server_id)\n _discoro_config['tcp_port'] = _discoro_tcp_ports[_discoro_server_id]\n _discoro_mp_queue = multiprocessing.Queue()\n _discoro_server_info = _discoro_ServerInfo(\n multiprocessing.Process(target=_discoro_process,\n args=(dict(_discoro_config), _discoro_server_id,\n _discoro_mp_queue, _discoro_auth)),\n _discoro_mp_queue)\n _discoro_server_infos.append(_discoro_server_info)\n _discoro_server_info.Proc.start()\n\n\n _discoro_server_id = 0\n _discoro_config['name'] = '%s-%s' % (_discoro_name, _discoro_server_id)\n _discoro_config['tcp_port'] = _discoro_tcp_ports[_discoro_server_id]\n _discoro_config.pop('phoenix', False)\n _discoro_config.pop('serve', -1)\n _discoro_config.pop('peers', [])\n _discoro_config.pop('min_pulse_interval')\n _discoro_config.pop('max_pulse_interval')\n _discoro_config['discover_peers'] = False\n if _discoro_config['loglevel']:\n asyncoro.logger.setLevel(logging.DEBUG)\n else:\n asyncoro.logger.setLevel(logging.INFO)\n del _discoro_config['loglevel']\n _discoro_scheduler = asyncoro.AsynCoro(**_discoro_config)\n _discoro_timer_coro = asyncoro.Coro(_discoro_timer_proc)\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': 'start', 'auth': _discoro_auth,\n 'timer_coro': _discoro_timer_coro})\n\n # delete variables not needed anymore\n del _discoro_mp_queue, _discoro_tcp_ports, tcp_port, tcp_ports, _discoro_config\n del parser, argparse, multiprocessing, socket, collections, os\n\n if not _discoro_daemon:\n\n asyncoro.Coro(_discoro_cmd_reader)\n else:\n _discoro_cmd = None\n\n while 1:\n try:\n for _discoro_server_info in _discoro_server_infos:\n if _discoro_server_info.Proc.is_alive():\n _discoro_server_info.Proc.join()\n break\n except:\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': 'terminate', 'auth': _discoro_auth})\n\n exit(0)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _discoro_proc():\n # coroutine\n \"\"\"Server process receives computations and runs coroutines for it.\n \"\"\"\n\n import os\n import shutil\n import traceback\n import sys\n import time\n\n try:\n import psutil\n except:\n psutil = None\n\n import asyncoro.disasyncoro as asyncoro\n from asyncoro import Coro\n from asyncoro.discoro import MinPulseInterval, MaxPulseInterval, \\\n DiscoroNodeInfo, DiscoroNodeAvailInfo\n\n class Nonlocals(object):\n def __init__(self, **kwargs):\n self.__dict__.update(kwargs)\n\n _discoro_coro = asyncoro.AsynCoro.cur_coro()\n _discoro_config = yield _discoro_coro.receive()\n assert _discoro_config['req'] == 'config'\n _discoro_timer_coro = _discoro_config['timer_coro']\n yield asyncoro.AsynCoro.instance().peer(_discoro_timer_coro.location)\n\n if _discoro_config['min_pulse_interval'] > 0:\n MinPulseInterval = _discoro_config['min_pulse_interval']\n if _discoro_config['max_pulse_interval'] > 0:\n MaxPulseInterval = _discoro_config['max_pulse_interval']\n\n _discoro_coro.register('discoro_server')\n _discoro_name = asyncoro.AsynCoro.instance().name\n asyncoro.AsynCoro.instance().dest_path = os.path.join('discoro', _discoro_name)\n _discoro_dest_path = asyncoro.AsynCoro.instance().dest_path\n _discoro_pid_path = os.path.join(_discoro_dest_path, '..', '%s.pid' % _discoro_name)\n _discoro_pid_path = os.path.normpath(_discoro_pid_path)\n # TODO: is file locking necessary?\n if os.path.exists(_discoro_pid_path):\n with open(_discoro_pid_path, 'r') as _discoro_req:\n _discoro_var = _discoro_req.read()\n _discoro_var = int(_discoro_var)\n if not _discoro_config['phoenix']:\n print('\\n Another discoronode seems to be running;\\n'\n ' make sure server with PID %d quit and remove \"%s\"\\n' %\n (_discoro_var, _discoro_pid_path))\n _discoro_var = os.getpid()\n\n import signal\n try:\n os.kill(_discoro_var, signal.SIGTERM)\n except:\n pass\n else:\n time.sleep(0.1)\n try:\n if os.waitpid(_discoro_var, os.WNOHANG)[0] != _discoro_var:\n asyncoro.logger.warning('Killing process %d failed', _discoro_var)\n except:\n pass\n del signal\n if os.path.isdir(_discoro_dest_path):\n shutil.rmtree(_discoro_dest_path)\n os.makedirs(_discoro_dest_path)\n os.chdir(_discoro_dest_path)\n sys.path.insert(0, _discoro_dest_path)\n with open(_discoro_pid_path, 'w') as _discoro_var:\n _discoro_var.write('%s' % os.getpid())\n\n def _discoro_peer(peer, coro=None):\n yield asyncoro.AsynCoro.instance().peer(peer)\n\n for _discoro_var in _discoro_config.pop('peers', []):\n Coro(_discoro_peer, _discoro_var)\n del _discoro_peer\n\n for _discoro_var in ['req', 'phoenix', 'min_pulse_interval', 'max_pulse_interval']:\n del _discoro_config[_discoro_var]\n\n asyncoro.logger.info('discoro server \"%s\" started at %s; '\n 'computation files will be saved in \"%s\"',\n _discoro_name, _discoro_coro.location, _discoro_dest_path)\n _discoro_req = _discoro_client = _discoro_auth = _discoro_msg = None\n _discoro_pulse_coro = _discoro_peer_status = _discoro_zombie_timeout = None\n _discoro_monitor_coro = _discoro_monitor_proc = _discoro_schedule_coro = None\n _discoro_computation = _discoro_func = _discoro_var = None\n _discoro_job_coros = set()\n _discoro_nonlocals = Nonlocals(busy_time=time.time())\n _discoro_globals = {}\n _discoro_locals = {}\n _discoro_modules = dict(sys.modules)\n _discoro_globals.update(globals())\n _discoro_locals.update(locals())\n\n def _discoro_peer_status(coro=None):\n coro.set_daemon()\n while 1:\n status = yield coro.receive()\n if isinstance(status, asyncoro.PeerStatus) and \\\n status.status == asyncoro.PeerStatus.Offline and \\\n _discoro_pulse_coro and _discoro_pulse_coro.location == status.location:\n asyncoro.logger.debug('scheduler at %s quit; closing computation %s',\n status.location, _discoro_computation._auth)\n _discoro_coro.send({'req': 'close', 'auth': _discoro_config['auth']})\n\n def _discoro_monitor_proc(coro=None):\n coro.set_daemon()\n while 1:\n msg = yield coro.receive(timeout=_discoro_zombie_timeout)\n if isinstance(msg, asyncoro.MonitorException):\n _discoro_nonlocals.busy_time = time.time()\n asyncoro.logger.debug('job %s done', msg.args[0])\n _discoro_job_coros.discard(msg.args[0])\n elif ((not _discoro_job_coros) and _discoro_zombie_timeout and\n ((time.time() - _discoro_nonlocals.busy_time) > _discoro_zombie_timeout)):\n asyncoro.logger.debug('%s: zombie computation \"%s\"',\n coro.location, _discoro_computation._auth)\n _discoro_coro.send({'req': 'close', 'auth': _discoro_config['auth']})\n\n def _discoro_schedule_proc(client, job_coro, coro=None):\n if (yield client.deliver(job_coro, timeout=5)) == 1:\n Coro._asyncoro._add(job_coro)\n else:\n _discoro_job_coros.discard(job_coro)\n\n _discoro_monitor_coro = Coro(_discoro_monitor_proc)\n asyncoro.AsynCoro.instance().peer_status(Coro(_discoro_peer_status))\n\n while 1:\n _discoro_msg = yield _discoro_coro.receive()\n if not isinstance(_discoro_msg, dict):\n continue\n _discoro_req = _discoro_msg.get('req', None)\n\n if _discoro_req == 'run':\n _discoro_client = _discoro_msg.get('client', None)\n _discoro_auth = _discoro_msg.get('auth', None)\n _discoro_func = _discoro_msg.get('func', None)\n if not isinstance(_discoro_client, Coro) or not _discoro_computation or \\\n _discoro_auth != _discoro_computation._auth:\n asyncoro.logger.warning('invalid run: %s', type(_discoro_func))\n if isinstance(_discoro_client, Coro):\n _discoro_client.send(None)\n continue\n try:\n _discoro_func = asyncoro.unserialize(_discoro_func)\n if _discoro_func.code:\n exec(_discoro_func.code) in globals()\n job_coro = Coro(globals()[_discoro_func.name],\n *(_discoro_func.args), **(_discoro_func.kwargs))\n except:\n asyncoro.logger.debug('invalid computation to run')\n job_coro = (sys.exc_info()[0], getattr(_discoro_func, 'name', _discoro_func),\n traceback.format_exc())\n _discoro_client.send(job_coro)\n else:\n asyncoro.logger.debug('job %s created', job_coro)\n _discoro_job_coros.add(job_coro)\n job_coro.notify(_discoro_monitor_coro)\n _discoro_var = _discoro_msg.get('notify', None)\n if isinstance(_discoro_var, Coro):\n job_coro.notify(_discoro_var)\n if Coro._asyncoro._remove(job_coro) == 0:\n Coro(_discoro_schedule_proc, _discoro_client, job_coro)\n _discoro_nonlocals.busy_time = time.time()\n del job_coro\n elif _discoro_req == 'setup':\n _discoro_client = _discoro_msg.get('client', None)\n _discoro_pulse_coro = _discoro_msg.get('pulse_coro', None)\n if not isinstance(_discoro_client, Coro) or not isinstance(_discoro_pulse_coro, Coro):\n continue\n if _discoro_computation is not None:\n asyncoro.logger.debug('invalid \"setup\" - busy')\n _discoro_client.send(-1)\n continue\n os.chdir(_discoro_dest_path)\n try:\n _discoro_computation = _discoro_msg['computation']\n exec('import asyncoro.disasyncoro as asyncoro') in globals()\n if _discoro_computation._code:\n exec(_discoro_computation._code) in globals()\n except:\n _discoro_computation = None\n asyncoro.logger.warning('invalid computation')\n asyncoro.logger.debug(traceback.format_exc())\n _discoro_client.send(-1)\n continue\n if isinstance(_discoro_computation.pulse_interval, int) and \\\n MinPulseInterval <= _discoro_computation.pulse_interval <= MaxPulseInterval:\n _discoro_computation.pulse_interval = _discoro_computation.pulse_interval\n else:\n _discoro_computation.pulse_interval = MinPulseInterval\n _discoro_timer_coro.send({'pulse_coro': _discoro_pulse_coro,\n 'interval': _discoro_computation.pulse_interval,\n 'disk_path': _discoro_dest_path})\n _discoro_nonlocals.busy_time = time.time()\n _discoro_zombie_timeout = _discoro_computation.zombie_period\n asyncoro.logger.debug('computation \"%s\" from %s with zombie period %s',\n _discoro_computation._auth, _discoro_msg['client'].location,\n _discoro_zombie_timeout)\n if not _discoro_zombie_timeout:\n _discoro_zombie_timeout = None\n _discoro_monitor_coro.send(None)\n _discoro_client.send(0)\n elif _discoro_req == 'close':\n _discoro_auth = _discoro_msg.get('auth', None)\n if not _discoro_computation or (_discoro_auth != _discoro_computation._auth and\n _discoro_auth != _discoro_config['auth']):\n continue\n asyncoro.logger.debug('%s deleting computation \"%s\"',\n _discoro_coro.location, _discoro_computation._auth)\n if _discoro_auth != _discoro_computation._auth and _discoro_pulse_coro:\n _discoro_pulse_coro.send({'status': 'ServerClosed',\n 'location': _discoro_coro.location})\n for _discoro_var in _discoro_job_coros:\n _discoro_var.terminate()\n _discoro_job_coros.clear()\n\n for _discoro_var in list(globals()):\n if _discoro_var not in _discoro_globals:\n globals().pop(_discoro_var, None)\n globals().update(_discoro_globals)\n\n for _discoro_var in sys.modules.keys():\n if _discoro_var not in _discoro_modules:\n sys.modules.pop(_discoro_var, None)\n sys.modules.update(_discoro_modules)\n\n for _discoro_var in os.listdir(_discoro_dest_path):\n _discoro_var = os.path.join(_discoro_dest_path, _discoro_var)\n if os.path.isdir(_discoro_var) and not os.path.islink(_discoro_var):\n shutil.rmtree(_discoro_var, ignore_errors=True)\n else:\n os.remove(_discoro_var)\n if not os.path.isdir(_discoro_dest_path):\n try:\n os.remove(_discoro_dest_path)\n except:\n pass\n os.makedirs(_discoro_dest_path)\n if not os.path.isfile(_discoro_pid_path):\n try:\n if os.path.islink(_discoro_pid_path):\n os.remove(_discoro_pid_path)\n else:\n shutil.rmtree(_discoro_pid_path)\n with open(_discoro_pid_path, 'w') as _discoro_var:\n _discoro_var.write('%s' % os.getpid())\n except:\n asyncoro.logger.warning('PID file \"%s\" is invalid', _discoro_pid_path)\n os.chdir(_discoro_dest_path)\n asyncoro.AsynCoro.instance().dest_path = _discoro_dest_path\n _discoro_computation = _discoro_client = _discoro_pulse_coro = None\n if _discoro_config['serve'] > 0:\n _discoro_config['serve'] -= 1\n if _discoro_config['serve'] == 0:\n break\n _discoro_timer_coro.send({'pulse_coro': _discoro_pulse_coro, 'interval': None,\n 'disk_path': ''})\n _discoro_zombie_timeout = None\n elif _discoro_req == 'node_info':\n if psutil:\n _discoro_var = DiscoroNodeAvailInfo(_discoro_coro.location.addr,\n 100.0 - psutil.cpu_percent(),\n psutil.virtual_memory().available,\n psutil.disk_usage(_discoro_dest_path).free,\n 100.0 - psutil.swap_memory().percent)\n else:\n _discoro_var = None\n # _discoro_name is host name followed by '-' and ID\n _discoro_var = DiscoroNodeInfo(_discoro_name[:_discoro_name.rfind('-')],\n _discoro_coro.location.addr, _discoro_var)\n _discoro_client = _discoro_msg.get('client', None)\n if isinstance(_discoro_client, Coro):\n _discoro_client.send(_discoro_var)\n elif _discoro_req == 'status':\n if _discoro_msg.get('auth', None) != _discoro_config['auth']:\n asyncoro.logger.debug('ignoring info: %s', _discoro_msg.get('auth'))\n continue\n if _discoro_pulse_coro:\n print(' Server \"%s\" @ %s running %d coroutines for %s' %\n (_discoro_name, _discoro_coro.location, len(_discoro_job_coros),\n _discoro_pulse_coro.location))\n else:\n print(' Server \"%s\" @ %s not used by any computation' %\n (_discoro_name, _discoro_coro.location))\n elif _discoro_req == 'quit':\n if _discoro_msg.get('auth', None) != _discoro_config['auth']:\n asyncoro.logger.debug('ignoring quit: %s', _discoro_msg.get('auth'))\n continue\n if _discoro_pulse_coro:\n _discoro_pulse_coro.send({'status': 'ServerClosed',\n 'location': _discoro_coro.location})\n break\n elif _discoro_req == 'terminate':\n if _discoro_msg.get('auth', None) != _discoro_config['auth']:\n asyncoro.logger.debug('ignoring terminate: %s', _discoro_msg.get('auth'))\n continue\n if _discoro_pulse_coro:\n _discoro_pulse_coro.send({'status': 'ServerTerminated',\n 'location': _discoro_coro.location})\n if _discoro_computation:\n msg = {'req': 'close', 'auth': _discoro_computation._auth}\n _discoro_config['serve'] = 1\n _discoro_coro.send(msg)\n else:\n break\n else:\n asyncoro.logger.warning('invalid command \"%s\" ignored', _discoro_req)\n _discoro_client = _discoro_msg.get('client', None)\n if not isinstance(_discoro_client, Coro):\n continue\n _discoro_client.send(-1)\n\n # wait until all computations are done; process only 'close'\n while _discoro_job_coros:\n _discoro_msg = yield _discoro_coro.receive()\n if not isinstance(_discoro_msg, dict):\n continue\n _discoro_req = _discoro_msg.get('req', None)\n\n if _discoro_req == 'close':\n _discoro_auth = _discoro_msg.get('auth', None)\n if not _discoro_computation or _discoro_auth != _discoro_computation._auth:\n continue\n asyncoro.logger.debug('%s deleting computation \"%s\"',\n _discoro_coro.location, _discoro_computation._auth)\n\n for _discoro_var in list(globals()):\n if _discoro_var not in _discoro_globals:\n globals().pop(_discoro_var, None)\n globals().update(_discoro_globals)\n\n break\n else:\n asyncoro.logger.warning('invalid command \"%s\" ignored', _discoro_req)\n _discoro_client = _discoro_msg.get('client', None)\n if not isinstance(_discoro_client, Coro):\n continue\n _discoro_client.send(-1)\n\n for _discoro_var in os.listdir(_discoro_dest_path):\n _discoro_var = os.path.join(_discoro_dest_path, _discoro_var)\n if os.path.isdir(_discoro_var) and not os.path.islink(_discoro_var):\n shutil.rmtree(_discoro_var, ignore_errors=True)\n else:\n os.remove(_discoro_var)\n if os.path.isfile(_discoro_pid_path):\n os.remove(_discoro_pid_path)\n _discoro_config['mp_queue'].put({'req': 'quit', 'auth': _discoro_config['auth']})\n asyncoro.logger.debug('discoro server \"%s\" @ %s terminated',\n _discoro_name, _discoro_coro.location)", "metadata": "root._discoro_proc", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def _discoro_process(_discoro_config, _discoro_server_id, _discoro_mp_queue, _discoro_auth):\n import os\n import logging\n import asyncoro.disasyncoro as asyncoro\n\n if _discoro_config['loglevel']:\n asyncoro.logger.setLevel(logging.DEBUG)\n else:\n asyncoro.logger.setLevel(logging.INFO)\n del _discoro_config['loglevel']\n\n _discoro_config_msg = {'req': 'config', 'id': _discoro_server_id,\n 'phoenix': _discoro_config.pop('phoenix', False),\n 'serve': _discoro_config.pop('serve', -1),\n 'peers': _discoro_config.pop('peers', []),\n 'min_pulse_interval': _discoro_config.pop('min_pulse_interval'),\n 'max_pulse_interval': _discoro_config.pop('max_pulse_interval'),\n 'auth': _discoro_auth, 'mp_queue': _discoro_mp_queue}\n _discoro_scheduler = asyncoro.AsynCoro(**_discoro_config)\n _discoro_coro = asyncoro.Coro(_discoro_proc)\n # delete variables created in main\n for _discoro_var in globals().keys():\n if _discoro_var.startswith('_discoro_'):\n globals().pop(_discoro_var)\n\n del logging, os, _discoro_config, _discoro_var\n\n req_queue, _discoro_mp_queue = _discoro_mp_queue, None\n\n while 1:\n try:\n req = req_queue.get()\n except KeyboardInterrupt:\n req = {'req': 'terminate', 'auth': _discoro_auth}\n req_queue.put(req)\n asyncoro.logger.debug('%s terminating', asyncoro.AsynCoro.instance()._location)\n\n if not isinstance(req, dict) or req.get('auth') != _discoro_auth:\n asyncoro.logger.warning('Ignoring invalid request: \"%s\"', type(req))\n continue\n\n cmd = req.get('req')\n if cmd == 'status' or cmd == 'close':\n _discoro_coro.send(req)\n elif cmd == 'start':\n _discoro_config_msg['timer_coro'] = req.get('timer_coro', None)\n _discoro_coro.send(_discoro_config_msg)\n del _discoro_config_msg\n elif cmd == 'quit' or cmd == 'terminate':\n _discoro_coro.send(req)\n break\n\n _discoro_scheduler.finish()", "metadata": "root._discoro_process", "header": "['module', '___EOS___']", "index": 381 }, { "content": " def _discoro_timer_proc(coro=None):\n from asyncoro.discoro import DiscoroNodeAvailInfo\n coro.set_daemon()\n last_pulse = last_proc_check = time.time()\n interval = pulse_coro = None\n for peer in _discoro_peers:\n yield asyncoro.AsynCoro.instance().peer(peer)\n while 1:\n msg = yield coro.receive(timeout=interval)\n now = time.time()\n if msg:\n pulse_coro = msg.get('pulse_coro', None)\n interval = msg.get('interval', None)\n disk_path = msg.get('disk_path', '.')\n if not isinstance(pulse_coro, asyncoro.Coro):\n interval = None\n continue\n last_pulse = now\n continue\n # TODO: monitor servers\n if not pulse_coro:\n continue\n\n msg = {'location': coro.location}\n if psutil:\n msg['node_status'] = DiscoroNodeAvailInfo(\n coro.location.addr, 100.0 - psutil.cpu_percent(),\n psutil.virtual_memory().available, psutil.disk_usage(disk_path).free,\n 100.0 - psutil.swap_memory().percent)\n\n if (yield pulse_coro.deliver(msg, timeout=2)) == 1:\n last_pulse = now\n elif (now - last_pulse) > (5 * interval):\n asyncoro.logger.warning('scheduler is not reachable; closing computation')\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': 'close', 'auth': _discoro_auth})\n\n if (now - last_proc_check) > (3 * interval):\n last_proc_check = now\n for _discoro_server_info in _discoro_server_infos:\n if not _discoro_server_info.Proc.is_alive():\n # TODO: inform scheduler, start new process\n asyncoro.logger.warning('Process %s is dead?: %s',\n _discoro_server_info.Proc.pid,\n _discoro_server_info.Proc.exitcode)", "metadata": "root._discoro_timer_proc", "header": "['module', '___EOS___']", "index": 589 }, { "content": " def _discoro_cmd_reader(coro=None):\n coro.set_daemon()\n async_threads = asyncoro.AsyncThreadPool(1)\n while 1:\n yield coro.sleep(0.25)\n try:\n _discoro_cmd = yield async_threads.async_task(\n raw_input,\n '\\nEnter \"status\" to get status\\n'\n ' \"close\" to close current computation (kill any running jobs)\\n'\n ' \"quit\" to stop accepting new jobs and quit when done\\n'\n ' \"terminate\" to kill current jobs and quit: ')\n except:\n _discoro_cmd = 'terminate'\n else:\n _discoro_cmd = _discoro_cmd.strip().lower()\n\n print('')\n if _discoro_cmd == 'status' or _discoro_cmd == 'close':\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': _discoro_cmd, 'auth': _discoro_auth})\n elif _discoro_cmd in ('quit', 'terminate'):\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': _discoro_cmd, 'auth': _discoro_auth})\n break", "metadata": "root._discoro_cmd_reader", "header": "['module', '___EOS___']", "index": 660 } ]
[ { "span": "import readline", "start_line": 453, "start_column": 8, "end_line": 453, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "async", "oro", ";", " ", "see", " ", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", " ", "for", "\\", "10", ";", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "program", " ", "can", " ", "be", " ", "used", " ", "to", " ", "start", " ", "disco", "ro", " ", "server", " ", "process", "es", " ", "so", " ", "disco", "ro", " ", "schedule", "r", "\\", "10", ";", "(", "see", " ", "'", "disco", "ro", ".", "py", "')", " ", "can", " ", "send", " ", "computation", "s", " ", "to", " ", "these", " ", "server", " ", "process", "es", " ", "for", " ", "executi", "ng", "\\", "10", ";", "distributed", " ", "communicati", "ng", " ", "proce", "ses", " ", "(", "coroutine", "s", ").", " ", "All", " ", "coroutine", "s", " ", "in", " ", "a", " ", "server", "\\", "10", ";", "execute", " ", "in", " ", "the", " ", "same", " ", "thread", ",", " ", "so", " ", "multiple", " ", "CPU", "s", " ", "are", " ", "not", " ", "used", " ", "by", " ", "one", " ", "server", ".", " ", "If", " ", "CPU", "\\", "10", ";", "inten", "sive", " ", "computation", "s", " ", "are", " ", "to", " ", "be", " ", "run", " ", "on", " ", "system", "s", " ", "with", " ", "multiple", " ", "process", "ors", ",", " ", "then", "\\", "10", ";", "this", " ", "program", " ", "shou", "ld", " ", "be", " ", "run", " ", "with", " ", "multiple", " ", "instance", "s", " ", "(", "see", " ", "belo", "w", " ", "for", " ", "'-", "c", "'", " ", "option", " ", "to", "\\", "10", ";", "this", " ", "program", ").", "\\", "10", ";", "\\", "10", ";", "See", " ", "'", "disco", "ro", "\\u", "client", "*.", "py", "'", " ", "files", " ", "for", " ", "example", " ", "use", " ", "case", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Gir", "id", "har", " ", "Pe", "mma", "sani", " ", "(", "pg", "iri", "@", "ya", "hoo", ".", "com", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Gir", "id", "har", " ", "Pe", "mma", "sani", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "MIT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "url", "\\u\\u_", "=_", "\"", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", "/", "disco", "ro", ".", "html", "#", "node", "-", "server", "s", " ", "for", " ", "deta", "il", "s", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "options", " ", "to", " ", "start", " ", "this", " ", "program", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "readline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "async", "oro", "_", "._", "disas", "ync", "oro", "_", "as_", "async", "oro", "_", "\\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_", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", " ", " ", " ", "\\\\'", "psu", "til", "\\\\'", " ", "module", " ", "is", " ", "not", " ", "avail", "able", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CPU", ",", " ", "memory", ",", " ", "disk", " ", "status", " ", "will", " ", "not", " ", "be", " ", "sent", "!\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psutil_", "=_", "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 ", " _", "psutil_", "._", "cpu", "\\u", "percent_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "c", "'_", ",_", "'--", "cpus", "'_", ",_", "dest_", "=_", "'", "cpus", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "number", " ", "of", " ", "CPU", "s", "/", "disco", "ro", " ", "instance", "s", " ", "to", " ", "run", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "if", " ", "negati", "ve", ",", " ", "tha", "t", " ", "many", " ", "CPU", "s", " ", "are", " ", "not", " ", "used", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "i", "'_", ",_", "'--", "ip", "\\u", "addr", "'_", ",_", "dest_", "=_", "'", "node", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "IP", " ", "address", " ", "or", " ", "host", " ", "name", " ", "of", " ", "this", " ", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "ext", "\\u", "ip", "\\u", "addr", "'_", ",_", "dest_", "=_", "'", "ext", "\\u", "ip", "\\u", "addr", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Exter", "nal", " ", "IP", " ", "address", " ", "to", " ", "use", " ", "(", "need", "ed", " ", "in", " ", "case", " ", "of", " ", "NAT", " ", "firew", "all", "/", "gateway", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "u", "'_", ",_", "'--", "ud", "p", "\\u", "port", "'_", ",_", "dest_", "=_", "'", "ud", "p", "\\u", "port", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "513", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "UD", "P", " ", "port", " ", "number", " ", "to", " ", "use", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "tcp", "\\u", "port", "s", "'_", ",_", "dest_", "=_", "'", "tcp", "\\u", "port", "s", "'_", ",_", "action_", "=_", "'", "append", "'_", ",_", "default_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "TC", "P", " ", "port", " ", "numbers", " ", "to", " ", "use", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "n", "'_", ",_", "'--", "name", "'_", ",_", "dest_", "=_", "'", "name", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'(", "symbolic", ")", " ", "name", " ", "give", "n", " ", "to", " ", "As", "yn", "Cor", "o", " ", "sch", "dul", "ers", " ", "on", " ", "this", " ", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "dest", "\\u", "path", "'_", ",_", "dest_", "=_", "'", "dest", "\\u", "path", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "path", " ", "prefix", " ", "to", " ", "where", " ", "files", " ", "sent", " ", "by", " ", "peer", "s", " ", "are", " ", "store", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "max", "\\u", "file", "\\u", "size", "'_", ",_", "dest_", "=_", "'", "max", "\\u", "file", "\\u", "size", "'_", ",_", "default_", "=_", "None_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "maxim", "um", " ", "file", " ", "size", " ", "of", " ", "any", " ", "file", " ", "transferred", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "s", "'_", ",_", "'--", "secret", "'_", ",_", "dest_", "=_", "'", "secret", "'_", ",_", "default_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "authenticat", "ion", " ", "secret", " ", "for", " ", "handshake", " ", "with", " ", "peer", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "certfile", "'_", ",_", "dest_", "=_", "'", "certfile", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "file", " ", "contain", "ing", " ", "SS", "L", " ", "certifica", "te", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "keyfile", "'_", ",_", "dest_", "=_", "'", "keyfile", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "file", " ", "contain", "ing", " ", "SS", "L", " ", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "serve", "'_", ",_", "dest_", "=_", "'", "serve", "'_", ",_", "default_", "=_", "-_", "1_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "number", " ", "of", " ", "clients", " ", "to", " ", "serve", " ", "bef", "ore", " ", "exit", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "min", "\\u", "pulse", "\\u", "interval", "'_", ",_", "dest_", "=_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "minim", "um", " ", "pulse", " ", "interval", " ", "clients", " ", "can", " ", "use", " ", "in", " ", "number", " ", "of", " ", "second", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "max", "\\u", "pulse", "\\u", "interval", "'_", ",_", "dest_", "=_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "maxim", "um", " ", "pulse", " ", "interval", " ", "clients", " ", "can", " ", "use", " ", "in", " ", "number", " ", "of", " ", "second", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "daemon", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "daemon", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "input", " ", "is", " ", "not", " ", "read", " ", "from", " ", "termina", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "phoe", "nix", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "phoe", "nix", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "server", " ", "process", "es", " ", "from", " ", "previ", "ous", " ", "run", " ", "will", " ", "be", " ", "kille", "d", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", " ", "new", " ", "server", " ", "process", " ", "start", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "discove", "r", "\\u", "peer", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "discove", "r", "\\u", "peer", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "peer", "s", " ", "are", " ", "discovere", "d", " ", "dur", "ing", " ", "start", "up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "peer", "'_", ",_", "dest_", "=_", "'", "peer", "s", "'_", ",_", "action_", "=_", "'", "append", "'_", ",_", "default_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "peer", " ", "location", " ", "(", "in", " ", "the", " ", "form", " ", "node", ":", "TC", "Pp", "ort", ")", " ", "to", " ", "communi", "cate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "'--", "debug", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "logl", "evel", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "debug", " ", "message", "s", " ", "are", " ", "printed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "=_", "vars_", "(_", "parser_", "._", "parse", "\\u", "args_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "and_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "min", "\\u", "pulse", "\\u", "interval", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", "and_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", "<_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "max", "\\u", "pulse", "\\u", "interval", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "min", "\\u", "pulse", "\\u", "interval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "cpus_", "=_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">_", "\\u", "disco", "ro", "\\u", "cpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "CPU", " ", "count", " ", "must", " ", "be", " ", "<=", " ", "%", "s", "'_", "%_", "\\u", "disco", "ro", "\\u", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "cpus_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "-_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">=_", "\\u", "disco", "ro", "\\u", "cpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "CPU", " ", "count", " ", "must", " ", "be", " ", ">", " ", "-%", "s", "'_", "%_", "\\u", "disco", "ro", "\\u", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "cpus_", "+=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tcp", "\\u", "port_", "=_", "tcp", "\\u", "ports_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tcp", "\\u", "port_", "in_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "tcp", "\\u", "port", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tcp", "\\u", "ports_", "=_", "tcp", "\\u", "port_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tcp", "\\u", "ports_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "._", "add_", "(_", "int_", "(_", "tcp", "\\u", "ports_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "tcp", "\\u", "ports_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "._", "union_", "(_", "range_", "(_", "int_", "(_", "tcp", "\\u", "ports_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "tcp", "\\u", "ports_", "[_", "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 ", " _", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "TC", "P", " ", "port", " ", "range", " ", "\"%", "s", "\"'_", "%_", "tcp", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "sorted_", "(_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tcp", "\\u", "port_", "in_", "range_", "(_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "-_", "1_", "]_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "-_", "1_", "]_", "+_", "1_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "cpus_", "+_", "1_", ")_", "-_", "len_", "(_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "._", "append_", "(_", "tcp", "\\u", "port_", ")_", "\\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 ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "[_", "0_", "]_", "*_", "(_", "\\u", "disco", "ro", "\\u", "cpus_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "peers_", ",_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "peer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "peer_", "in_", "\\u", "disco", "ro", "\\u", "peers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer_", "=_", "peer_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "peer_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "peer", " ", "%", "s", " ", "is", " ", "not", " ", "valid", "'_", "%_", "':'_", "._", "join_", "(_", "peer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", "._", "append_", "(_", "async", "oro", "_", "._", "Location_", "(_", "peer_", "[_", "0_", "]_", ",_", "peer_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "peer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "peers_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "name_", "=_", "socket_", "._", "gethostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "name_", "=_", "'", "disco", "ro", "\\u", "server", "'_", "\\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", "disco", "ro", "\\u", "daemon_", "=_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "daemon", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "daemon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "getp", "grp_", "(_", ")_", "!=_", "os_", "._", "tc", "getp", "grp_", "(_", "sys_", "._", "stdin_", "._", "fileno_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "auth_", "=_", "hashlib_", "._", "sha1_", "(_", "os_", "._", "urandom_", "(_", "10_", ")_", "._", "encode_", "(_", "'", "hex", "'_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "Server", "Info_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "Disco", "ro", "Server", "Info", "'_", ",_", "[_", "'", "Proc", "'_", ",_", "'", "Queue", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "in_", "range_", "(_", "1_", ",_", "\\u", "disco", "ro", "\\u", "cpus_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "name", "'_", "]_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "tcp", "\\u", "port", "'_", "]_", "=_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", "=_", "multiprocessing_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "=_", "\\u", "disco", "ro", "\\u", "Server", "Info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "\\u", "disco", "ro", "\\u", "process_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "dict_", "(_", "\\u", "disco", "ro", "\\u", "config_", ")_", ",_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ",_", "\\u", "disco", "ro", "\\u", "auth_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", "._", "append_", "(_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "name", "'_", "]_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "tcp", "\\u", "port", "'_", "]_", "=_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "phoe", "nix", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "serve", "'_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "peer", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "discove", "r", "\\u", "peer", "s", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "scheduler_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "(_", "**_", "\\u", "disco", "ro", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "=_", "async", "oro", "_", "._", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "proc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "'", "start", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timer", "\\u", "coro", "'_", ":_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "variab", "les", " ", "not", " ", "need", "ed", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ",_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ",_", "tcp", "\\u", "port_", ",_", "tcp", "\\u", "ports_", ",_", "\\u", "disco", "ro", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "parser_", ",_", "argparse_", ",_", "multiprocessing_", ",_", "socket_", ",_", "collections_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "daemon_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "async", "oro", "_", "._", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "cmd", "\\u", "reader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "cmd_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\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 ", " _", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "'", "terminate", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", ")_", "\\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_", "exit_", "(_", "0_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "proc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "coroutine_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Server", " ", "process", " ", "receive", "s", " ", "computation", "s", " ", "and", " ", "runs", " ", "coroutine", "s", " ", "for", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\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_", "psutil_", "\\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 ", " _", "psutil_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "async", "oro", "_", "._", "disas", "ync", "oro", "_", "as_", "async", "oro", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "async", "oro", "_", "import_", "Cor", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "async", "oro", "_", "._", "disco", "ro_", "import_", "Min", "Pul", "se", "Interval_", ",_", "Max", "Pul", "se", "Interval_", ",_", "Disco", "ro", "Node", "Info_", ",_", "Disco", "ro", "Node", "Avail", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Non", "locals_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "update_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "=_", "yield_", "\\u", "disco", "ro", "\\u", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "req", "'_", "]_", "==_", "'", "config", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "timer", "\\u", "coro", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "peer_", "(_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Min", "Pul", "se", "Interval_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Max", "Pul", "se", "Interval_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "register_", "(_", "'", "disco", "ro", "\\u", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "dest", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'", "disco", "ro", "'_", ",_", "\\u", "disco", "ro", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "dest", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ",_", "'..'_", ",_", "'%", "s", ".", "pid", "'_", "%_", "\\u", "disco", "ro", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "file", " ", "locking", " ", "necessar", "y", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "\\u", "disco", "ro", "\\u", "req_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "\\u", "disco", "ro", "\\u", "req_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "int_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "phoe", "nix", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", " ", " ", " ", "Ano", "ther", " ", "disco", "ron", "ode", " ", "see", "ms", " ", "to", " ", "be", " ", "runn", "ing", ";\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", "make", " ", "sure", " ", "server", " ", "with", " ", "PID", " ", "%", "d", " ", "quit", " ", "and", " ", "remove", " ", "\"%", "s", "\"\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "kill_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "signal_", "._", "SIGTERM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "wait", "pid_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "os_", "._", "WN", "OH", "ANG", "_", ")_", "[_", "0_", "]_", "!=_", "\\u", "disco", "ro", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "Kill", "ing", " ", "process", " ", "%", "d", " ", "fail", "ed", "'_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ",_", "'", "w", "'_", ")_", "as_", "\\u", "disco", "ro", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "._", "write_", "(_", "'%", "s", "'_", "%_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "peer_", "(_", "peer_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "peer_", "(_", "peer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "peer", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "peer_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "peer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "[_", "'", "req", "'_", ",_", "'", "phoe", "nix", "'_", ",_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ",_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "\\u", "disco", "ro", "\\u", "config_", "[_", "\\u", "disco", "ro", "\\u", "var_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "info_", "(_", "'", "disco", "ro", " ", "server", " ", "\"%", "s", "\"", " ", "start", "ed", " ", "at", " ", "%", "s", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "computation", " ", "files", " ", "will", " ", "be", " ", "saved", " ", "in", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "req_", "=_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "peer", "\\u", "status_", "=_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "proc_", "=_", "\\u", "disco", "ro", "\\u", "schedule", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "\\u", "disco", "ro", "\\u", "func_", "=_", "\\u", "disco", "ro", "\\u", "var_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "=_", "Non", "locals_", "(_", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "globals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "locals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "modules_", "=_", "dict_", "(_", "sys_", "._", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "globals_", "._", "update_", "(_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "locals_", "._", "update_", "(_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "peer", "\\u", "status_", "(_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "yield_", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "status_", ",_", "async", "oro", "_", "._", "Peer", "Status_", ")_", "and_", "status_", "._", "status_", "==_", "async", "oro", "_", "._", "Peer", "Status_", "._", "Off", "line_", "and_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "and_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "location_", "==_", "status_", "._", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "schedule", "r", " ", "at", " ", "%", "s", " ", "quit", ";", " ", "clos", "ing", " ", "computation", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "req", "'_", ":_", "'", "close", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "proc_", "(_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "yield_", "coro_", "._", "receive_", "(_", "timeout_", "=_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "msg_", ",_", "async", "oro", "_", "._", "Monitor", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "job", " ", "%", "s", " ", "don", "e", "'_", ",_", "msg_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "discard_", "(_", "msg_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "(_", "not_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ")_", "and_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", ")_", ">_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'%", "s", ":", " ", "zombie", " ", "computation", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "req", "'_", ":_", "'", "close", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "schedule", "\\u", "proc_", "(_", "client_", ",_", "job", "\\u", "coro_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "yield_", "client_", "._", "deliver", "_", "(_", "job", "\\u", "coro_", ",_", "timeout_", "=_", "5_", ")_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cor", "o_", "._", "\\u", "async", "oro", "_", "._", "\\u", "add_", "(_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "discard_", "(_", "job", "\\u", "coro_", ")_", "\\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", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", "=_", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "proc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "peer", "\\u", "status_", "(_", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "peer", "\\u", "status_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "msg_", "=_", "yield_", "\\u", "disco", "ro", "\\u", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "msg_", ",_", "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_", "\\u", "disco", "ro", "\\u", "req_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "req", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "run", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "func_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "func", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", "or_", "not_", "\\u", "disco", "ro", "\\u", "computation", "_", "or_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "run", ":", " ", "%", "s", "'_", ",_", "type_", "(_", "\\u", "disco", "ro", "\\u", "func_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "func_", "=_", "async", "oro", "_", "._", "unse", "rial", "ize_", "(_", "\\u", "disco", "ro", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "func_", "._", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exec_", "(_", "\\u", "disco", "ro", "\\u", "func_", "._", "code_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "\\u", "coro_", "=_", "Cor", "o_", "(_", "globals_", "(_", ")_", "[_", "\\u", "disco", "ro", "\\u", "func_", "._", "name_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "(_", "\\u", "disco", "ro", "\\u", "func_", "._", "args_", ")_", ",_", "**_", "(_", "\\u", "disco", "ro", "\\u", "func_", "._", "kwargs_", ")_", ")_", "\\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 ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "invalid", " ", "computation", " ", "to", " ", "run", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "coro_", "=_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ",_", "getattr_", "(_", "\\u", "disco", "ro", "\\u", "func_", ",_", "'", "name", "'_", ",_", "\\u", "disco", "ro", "\\u", "func_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "job", " ", "%", "s", " ", "created", "'_", ",_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "add_", "(_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "coro_", "._", "notify_", "(_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "notif", "y", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job", "\\u", "coro_", "._", "notify_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Cor", "o_", "._", "\\u", "async", "oro", "_", "._", "\\u", "remove_", "(_", "job", "\\u", "coro_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "schedule", "\\u", "proc_", ",_", "\\u", "disco", "ro", "\\u", "client_", ",_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "job", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "setup", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "pulse", "\\u", "coro", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", "or_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ",_", "Cor", "o_", ")_", ":_", "\\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_", "\\u", "disco", "ro", "\\u", "computation", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "invalid", " ", "\"", "setup", "\"", " ", "-", " ", "bus", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "[_", "'", "computation", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "'", "import", " ", "async", "oro", ".", "disas", "ync", "oro", " ", "as", " ", "async", "oro", "'_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exec_", "(_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "code_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "computation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", ",_", "int_", ")_", "and_", "Min", "Pul", "se", "Interval_", "<=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "<=_", "Max", "Pul", "se", "Interval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "=_", "Min", "Pul", "se", "Interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "pulse", "\\u", "coro", "'_", ":_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interval", "'_", ":_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "path", "'_", ":_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "zombie", "\\u", "period_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "computation", " ", "\"%", "s", "\"", " ", "from", " ", "%", "s", " ", "with", " ", "zombie", " ", "period", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "[_", "'", "client", "'_", "]_", "._", "location_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", "._", "send_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "computation", "_", "or_", "(_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ")_", ":_", "\\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_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'%", "s", " ", "delet", "ing", " ", "computation", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", "and_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "status", "'_", ":_", "'", "Server", "Clos", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "list_", "(_", "globals_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "var_", "not_", "in_", "\\u", "disco", "ro", "\\u", "globals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "globals_", "(_", ")_", "._", "pop_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "globals_", "(_", ")_", "._", "update_", "(_", "\\u", "disco", "ro", "\\u", "globals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "sys_", "._", "modules_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "var_", "not_", "in_", "\\u", "disco", "ro", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sys_", "._", "modules_", "._", "pop_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "modules_", "._", "update_", "(_", "\\u", "disco", "ro", "\\u", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "os_", "._", "listdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "and_", "not_", "os_", "._", "path_", "._", "islink_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "ignore", "\\u", "errors_", "=_", "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 ", " ", "_", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "os_", "._", "path_", "._", "islink_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\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 ", " ", " _", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ",_", "'", "w", "'_", ")_", "as_", "\\u", "disco", "ro", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disco", "ro", "\\u", "var_", "._", "write_", "(_", "'%", "s", "'_", "%_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "PID", " ", "file", " ", "\"%", "s", "\"", " ", "is", " ", "invalid", "'_", ",_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "dest", "\\u", "path_", "=_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "pulse", "\\u", "coro", "'_", ":_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ",_", "'", "interval", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "path", "'_", ":_", "''_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "node", "\\u", "info", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "psutil_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "Disco", "ro", "Node", "Avail", "Info_", "(_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "._", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "-_", "psutil_", "._", "cpu", "\\u", "percent_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "psutil_", "._", "virtual", "\\u", "memory_", "(_", ")_", "._", "available_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "psutil_", "._", "disk", "\\u", "usage_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "._", "free_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "-_", "psutil_", "._", "swap", "\\u", "memory_", "(_", ")_", "._", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "disco", "ro", "\\u", "name", " ", "is", " ", "host", " ", "name", " ", "followe", "d", " ", "by", " ", "'-'", " ", "and", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "Disco", "ro", "Node", "Info_", "(_", "\\u", "disco", "ro", "\\u", "name_", "[_", ":_", "\\u", "disco", "ro", "\\u", "name_", "._", "rfind_", "(_", "'-'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "._", "addr_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "status", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "ign", "orin", "g", " ", "info", ":", " ", "%", "s", "'_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", " ", " ", "Server", " ", "\"%", "s", "\"", " ", "@", " ", "%", "s", " ", "runn", "ing", " ", "%", "d", " ", "coroutine", "s", " ", "for", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "len_", "(_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "location_", ")_", ")_", "\\u\\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_", "(_", "'", " ", " ", "Server", " ", "\"%", "s", "\"", " ", "@", " ", "%", "s", " ", "not", " ", "used", " ", "by", " ", "any", " ", "computation", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "quit", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "ign", "orin", "g", " ", "quit", ":", " ", "%", "s", "'_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "status", "'_", ":_", "'", "Server", "Clos", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "terminate", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "ign", "orin", "g", " ", "terminate", ":", " ", "%", "s", "'_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "status", "'_", ":_", "'", "Server", "Terminate", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "computation", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "{_", "'", "req", "'_", ":_", "'", "close", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "command", " ", "\"%", "s", "\"", " ", "ignore", "d", "'_", ",_", "\\u", "disco", "ro", "\\u", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\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_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", " ", "unti", "l", " ", "all", " ", "computation", "s", " ", "are", " ", "don", "e", ";", " ", "process", " ", "only", " ", "'", "close", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "msg_", "=_", "yield_", "\\u", "disco", "ro", "\\u", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "msg_", ",_", "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_", "\\u", "disco", "ro", "\\u", "req_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "req", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "computation", "_", "or_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ":_", "\\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_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'%", "s", " ", "delet", "ing", " ", "computation", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "list_", "(_", "globals_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "var_", "not_", "in_", "\\u", "disco", "ro", "\\u", "globals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "globals_", "(_", ")_", "._", "pop_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "globals_", "(_", ")_", "._", "update_", "(_", "\\u", "disco", "ro", "\\u", "globals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "command", " ", "\"%", "s", "\"", " ", "ignore", "d", "'_", ",_", "\\u", "disco", "ro", "\\u", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\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_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "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_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "os_", "._", "listdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "and_", "not_", "os_", "._", "path_", "._", "islink_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "ignore", "\\u", "errors_", "=_", "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 ", " _", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "mp", "\\u", "queue", "'_", "]_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "'", "quit", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "disco", "ro", " ", "server", " ", "\"%", "s", "\"", " ", "@", " ", "%", "s", " ", "terminate", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "process_", "(_", "\\u", "disco", "ro", "\\u", "config_", ",_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ",_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ",_", "\\u", "disco", "ro", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "async", "oro", "_", "._", "disas", "ync", "oro", "_", "as_", "async", "oro", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config", "\\u", "msg_", "=_", "{_", "'", "req", "'_", ":_", "'", "config", "'_", ",_", "'", "id", "'_", ":_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phoe", "nix", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "phoe", "nix", "'_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "serve", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "serve", "'_", ",_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "peer", "s", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "peer", "s", "'_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", ",_", "'", "mp", "\\u", "queue", "'_", ":_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "scheduler_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "(_", "**_", "\\u", "disco", "ro", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "=_", "async", "oro", "_", "._", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "proc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "variab", "les", " ", "created", " ", "in", " ", "main_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "globals_", "(_", ")_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "var_", "._", "startswith_", "(_", "'\\u", "disco", "ro", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "globals_", "(_", ")_", "._", "pop_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "logging_", ",_", "os_", ",_", "\\u", "disco", "ro", "\\u", "config_", ",_", "\\u", "disco", "ro", "\\u", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req", "\\u", "queue_", ",_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", "=_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "req", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "{_", "'", "req", "'_", ":_", "'", "terminate", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "queue_", "._", "put_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'%", "s", " ", "termina", "ting", "'_", ",_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "\\u", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "req_", ",_", "dict_", ")_", "or_", "req_", "._", "get_", "(_", "'", "auth", "'_", ")_", "!=_", "\\u", "disco", "ro", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "Ignor", "ing", " ", "invalid", " ", "request", ":", " ", "\"%", "s", "\"'_", ",_", "type_", "(_", "req_", ")_", ")_", "\\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_", "cmd_", "=_", "req_", "._", "get_", "(_", "'", "req", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmd_", "==_", "'", "status", "'_", "or_", "cmd_", "==_", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "==_", "'", "start", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "config", "\\u", "msg_", "[_", "'", "timer", "\\u", "coro", "'_", "]_", "=_", "req_", "._", "get_", "(_", "'", "timer", "\\u", "coro", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "\\u", "disco", "ro", "\\u", "config", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "config", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "==_", "'", "quit", "'_", "or_", "cmd_", "==_", "'", "terminate", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "scheduler_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "proc_", "(_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "async", "oro", "_", "._", "disco", "ro_", "import_", "Disco", "ro", "Node", "Avail", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "pulse_", "=_", "last", "\\u", "proc", "\\u", "check_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval_", "=_", "pulse", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "peer_", "in_", "\\u", "disco", "ro", "\\u", "peers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "peer_", "(_", "peer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "yield_", "coro_", "._", "receive_", "(_", "timeout_", "=_", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pulse", "\\u", "coro_", "=_", "msg_", "._", "get_", "(_", "'", "pulse", "\\u", "coro", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval_", "=_", "msg_", "._", "get_", "(_", "'", "interval", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "path_", "=_", "msg_", "._", "get_", "(_", "'", "disk", "\\u", "path", "'_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "pulse", "\\u", "coro_", ",_", "async", "oro", "_", "._", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "interval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "pulse_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "monit", "or", " ", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "pulse", "\\u", "coro_", ":_", "\\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_", "msg_", "=_", "{_", "'", "location", "'_", ":_", "coro_", "._", "location_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "psutil_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "[_", "'", "node", "\\u", "status", "'_", "]_", "=_", "Disco", "ro", "Node", "Avail", "Info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "location_", "._", "addr_", ",_", "100.0_", "-_", "psutil_", "._", "cpu", "\\u", "percent_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "psutil_", "._", "virtual", "\\u", "memory_", "(_", ")_", "._", "available_", ",_", "psutil_", "._", "disk", "\\u", "usage_", "(_", "disk", "\\u", "path_", ")_", "._", "free_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "-_", "psutil_", "._", "swap", "\\u", "memory_", "(_", ")_", "._", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "yield_", "pulse", "\\u", "coro_", "._", "deliver", "_", "(_", "msg_", ",_", "timeout_", "=_", "2_", ")_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "pulse_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "now_", "-_", "last", "\\u", "pulse_", ")_", ">_", "(_", "5_", "*_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "schedule", "r", " ", "is", " ", "not", " ", "reachable", ";", " ", "clos", "ing", " ", "computation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "'", "close", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", ")_", "\\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_", "(_", "now_", "-_", "last", "\\u", "proc", "\\u", "check_", ")_", ">_", "(_", "3_", "*_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "proc", "\\u", "check_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "inform", " ", "schedule", "r", ",", " ", "start", " ", "new", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "Process", " ", "%", "s", " ", "is", " ", "dead", "?:", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "pid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "exitcode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "disco", "ro", "\\u", "cmd", "\\u", "reader_", "(_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "\\u", "threads_", "=_", "async", "oro", "_", "._", "Async", "Thread", "Pool_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "coro_", "._", "sleep_", "(_", "0.25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "cmd_", "=_", "yield_", "async", "\\u", "threads_", "._", "async", "\\u", "task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "raw", "\\u", "input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "Enter", " ", "\"", "status", "\"", " ", "to", " ", "get", " ", "status", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "close", "\"", " ", "to", " ", "close", " ", "current", " ", "computation", " ", "(", "kill", " ", "any", " ", "runn", "ing", " ", "jobs", ")\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "quit", "\"", " ", "to", " ", "stop", " ", "accept", "ing", " ", "new", " ", "jobs", " ", "and", " ", "quit", " ", "whe", "n", " ", "don", "e", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "terminate", "\"", " ", "to", " ", "kill", " ", "current", " ", "jobs", " ", "and", " ", "quit", ":", " ", "'_", ")_", "\\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 ", " ", "_", "\\u", "disco", "ro", "\\u", "cmd_", "=_", "'", "terminate", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "cmd_", "=_", "\\u", "disco", "ro", "\\u", "cmd_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "cmd_", "==_", "'", "status", "'_", "or_", "\\u", "disco", "ro", "\\u", "cmd_", "==_", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "\\u", "disco", "ro", "\\u", "cmd_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "cmd_", "in_", "(_", "'", "quit", "'_", ",_", "'", "terminate", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "\\u", "disco", "ro", "\\u", "cmd_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
EasyEngine/easyengine/ee/core/aptget.py
[ { "content": "\"\"\"EasyEngine package installation using apt-get module.\"\"\"\nimport apt\nimport apt_pkg\nimport sys\nimport subprocess\nfrom ee.core.logging import Log\nfrom ee.core.apt_repo import EERepo\nfrom sh import apt_get\nfrom sh import ErrorReturnCode\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EEAptGet():\n \"\"\"Generic apt-get intialisation\"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.EEAptGet", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def update(self):\n \"\"\"\n Similar to `apt-get update`\n \"\"\"\n try:\n with open('/var/log/ee/ee.log', 'a') as f:\n proc = subprocess.Popen('apt-get update',\n shell=True,\n stdin=None, stdout=f,\n stderr=subprocess.PIPE,\n executable=\"/bin/bash\")\n proc.wait()\n output, error_output = proc.communicate()\n\n # Check what is error in error_output\n if \"NO_PUBKEY\" in str(error_output):\n # Split the output\n Log.info(self, \"Fixing missing GPG keys, please wait...\")\n error_list = str(error_output).split(\"\\\\n\")\n\n # Use a loop to add misising keys\n for single_error in error_list:\n if \"NO_PUBKEY\" in single_error:\n key = single_error.rsplit(None, 1)[-1]\n EERepo.add_key(self, key, keyserver=\"hkp://pgp.mit.edu\")\n\n proc = subprocess.Popen('apt-get update',\n shell=True,\n stdin=None, stdout=f, stderr=f,\n executable=\"/bin/bash\")\n proc.wait()\n\n if proc.returncode == 0:\n return True\n else:\n Log.info(self, Log.FAIL + \"Oops Something went wrong!!\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n except Exception as e:\n Log.error(self, \"apt-get update exited with error\")", "metadata": "root.EEAptGet.update", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 14 }, { "content": " def check_upgrade(self):\n \"\"\"\n Similar to `apt-get upgrade`\n \"\"\"\n try:\n check_update = subprocess.Popen(['apt-get upgrade -s | grep '\n '\\\"^Inst\\\" | wc -l'],\n stdout=subprocess.PIPE,\n shell=True).communicate()[0]\n if check_update == b'0\\n':\n Log.error(self, \"No package updates available\")\n Log.info(self, \"Following package updates are available:\")\n subprocess.Popen(\"apt-get -s dist-upgrade | grep \\\"^Inst\\\"\",\n shell=True, executable=\"/bin/bash\",\n stdout=sys.stdout).communicate()\n\n except Exception as e:\n Log.error(self, \"Unable to check for packages upgrades\")", "metadata": "root.EEAptGet.check_upgrade", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 56 }, { "content": " def dist_upgrade(self):\n \"\"\"\n Similar to `apt-get upgrade`\n \"\"\"\n try:\n with open('/var/log/ee/ee.log', 'a') as f:\n proc = subprocess.Popen(\"DEBIAN_FRONTEND=noninteractive \"\n \"apt-get dist-upgrade -o \"\n \"Dpkg::Options::=\\\"--force-confdef\\\"\"\n \" -o \"\n \"Dpkg::Options::=\\\"--force-confold\\\"\"\n \" -y \",\n shell=True, stdin=None,\n stdout=f, stderr=f,\n executable=\"/bin/bash\")\n proc.wait()\n\n if proc.returncode == 0:\n return True\n else:\n Log.info(self, Log.FAIL + \"Oops Something went \"\n \"wrong!!\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n except Exception as e:\n Log.error(self, \"Error while installing packages, \"\n \"apt-get exited with error\")", "metadata": "root.EEAptGet.dist_upgrade", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 75 }, { "content": " def install(self, packages):\n all_packages = ' '.join(packages)\n try:\n with open('/var/log/ee/ee.log', 'a') as f:\n proc = subprocess.Popen(\"DEBIAN_FRONTEND=noninteractive \"\n \"apt-get install -o \"\n \"Dpkg::Options::=\\\"--force-confdef\\\"\"\n \" -o \"\n \"Dpkg::Options::=\\\"--force-confold\\\"\"\n \" -y {0}\"\n .format(all_packages), shell=True,\n stdin=None, stdout=f, stderr=f,\n executable=\"/bin/bash\")\n proc.wait()\n\n if proc.returncode == 0:\n return True\n else:\n Log.info(self, Log.FAIL + \"Oops Something went \"\n \"wrong!!\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n except Exception as e:\n Log.info(self, Log.FAIL + \"Oops Something went \"\n \"wrong!!\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")", "metadata": "root.EEAptGet.install", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 103 }, { "content": " def remove(self, packages, auto=False, purge=False):\n all_packages = ' '.join(packages)\n try:\n with open('/var/log/ee/ee.log', 'a') as f:\n if purge:\n proc = subprocess.Popen('apt-get purge -y {0}'\n .format(all_packages), shell=True,\n stdin=None, stdout=f, stderr=f,\n executable=\"/bin/bash\")\n else:\n proc = subprocess.Popen('apt-get remove -y {0}'\n .format(all_packages), shell=True,\n stdin=None, stdout=f, stderr=f,\n executable=\"/bin/bash\")\n proc.wait()\n if proc.returncode == 0:\n return True\n else:\n Log.info(self, Log.FAIL + \"Oops Something went \"\n \"wrong!!\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n except Exception as e:\n Log.error(self, \"Error while installing packages, \"\n \"apt-get exited with error\")", "metadata": "root.EEAptGet.remove", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 132 }, { "content": " def auto_clean(self):\n \"\"\"\n Similar to `apt-get autoclean`\n \"\"\"\n try:\n orig_out = sys.stdout\n sys.stdout = open(self.app.config.get('log.logging', 'file'),\n encoding='utf-8', mode='a')\n apt_get.autoclean(\"-y\")\n sys.stdout = orig_out\n except ErrorReturnCode as e:\n Log.debug(self, \"{0}\".format(e))\n Log.error(self, \"Unable to apt-get autoclean\")", "metadata": "root.EEAptGet.auto_clean", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 159 }, { "content": " def auto_remove(self):\n \"\"\"\n Similar to `apt-get autoremove`\n \"\"\"\n try:\n Log.debug(self, \"Running apt-get autoremove\")\n apt_get.autoremove(\"-y\")\n except ErrorReturnCode as e:\n Log.debug(self, \"{0}\".format(e))\n Log.error(self, \"Unable to apt-get autoremove\")", "metadata": "root.EEAptGet.auto_remove", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 173 }, { "content": " def is_installed(self, package_name):\n \"\"\"\n Checks if package is available in cache and is installed or not\n returns True if installed otherwise returns False\n \"\"\"\n apt_cache = apt.cache.Cache()\n apt_cache.open()\n if (package_name.strip() in apt_cache and\n apt_cache[package_name.strip()].is_installed):\n # apt_cache.close()\n return True\n # apt_cache.close()\n return False", "metadata": "root.EEAptGet.is_installed", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 184 }, { "content": " def download_only(self,package_name,repo_url=None,repo_key=None):\n \"\"\"\n Similar to `apt-get install --download-only PACKAGE_NAME`\n \"\"\"\n packages = ' '.join(package_name)\n try:\n with open('/var/log/ee/ee.log', 'a') as f:\n if repo_url is not None:\n EERepo.add(self, repo_url=repo_url)\n if repo_key is not None:\n EERepo.add_key(self, repo_key)\n proc = subprocess.Popen(\"apt-get update && DEBIAN_FRONTEND=noninteractive \"\n \"apt-get install -o \"\n \"Dpkg::Options::=\\\"--force-confdef\\\"\"\n \" -o \"\n \"Dpkg::Options::=\\\"--force-confold\\\"\"\n \" -y --download-only {0}\"\n .format(packages), shell=True,\n stdin=None, stdout=f, stderr=f,\n executable=\"/bin/bash\")\n proc.wait()\n\n if proc.returncode == 0:\n return True\n else:\n Log.error(self,\"Error in fetching dpkg package.\\nReverting changes ..\",False)\n if repo_url is not None:\n EERepo.remove(self, repo_url=repo_url)\n return False\n except Exception as e:\n Log.error(self, \"Error while downloading packages, \"\n \"apt-get exited with error\")", "metadata": "root.EEAptGet.download_only", "header": "['class', 'EEAptGet', '(', ')', ':', '___EOS___']", "index": 198 } ]
[ { "span": "import apt_pkg", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Eas", "y", "Engine", " ", "package", " ", "installation", " ", "usi", "ng", " ", "apt", "-", "get", " ", "module", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "apt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "apt", "\\u", "pkg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "logging_", "import_", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "apt", "\\u", "repo_", "import_", "EE", "Repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sh_", "import_", "apt", "\\u", "get_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sh_", "import_", "Error", "Return", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Gene", "ric", " ", "apt", "-", "get", " ", "inti", "alis", "ation", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "`", "apt", "-", "get", " ", "update", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "'_", ",_", "'", "a", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "'", "apt", "-", "get", " ", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", ",_", "error", "\\u", "output_", "=_", "proc_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "what", " ", "is", " ", "error", " ", "in", " ", "error", "\\u", "output_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "NO", "\\u", "PUB", "KEY", "\"_", "in_", "str_", "(_", "error", "\\u", "output_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Split", " ", "the", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Fix", "ing", " ", "missi", "ng", " ", "GPG", " ", "keys", ",", " ", "plea", "se", " ", "wait", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "list_", "=_", "str_", "(_", "error", "\\u", "output_", ")_", "._", "split_", "(_", "\"\\\\\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "a", " ", "loop", " ", "to", " ", "add", " ", "mis", "ising", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "single", "\\u", "error_", "in_", "error", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\"", "NO", "\\u", "PUB", "KEY", "\"_", "in_", "single", "\\u", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "key_", "=_", "single", "\\u", "error_", "._", "rsplit_", "(_", "None_", ",_", "1_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Repo_", "._", "add", "\\u", "key_", "(_", "self_", ",_", "key_", ",_", "keyse", "rver_", "=_", "\"", "hk", "p", "://", "pgp", ".", "mit", ".", "edu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "'", "apt", "-", "get", " ", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "f_", ",_", "stderr_", "=_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proc_", "._", "returncode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "apt", "-", "get", " ", "update", " ", "exit", "ed", " ", "with", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\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_", "check", "\\u", "upgrade_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "`", "apt", "-", "get", " ", "upgrade", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "update_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "apt", "-", "get", " ", "upgrade", " ", "-", "s", " ", "|", " ", "grep", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\"", "^", "Ins", "t", "\\\\\"", " ", "|", " ", "wc", " ", "-", "l", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ")_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "update_", "==_", "b", "'", "0", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "No", " ", "package", " ", "update", "s", " ", "avail", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Follow", "ing", " ", "package", " ", "update", "s", " ", "are", " ", "avail", "able", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "Popen_", "(_", "\"", "apt", "-", "get", " ", "-", "s", " ", "dist", "-", "upgrade", " ", "|", " ", "grep", " ", "\\\\\"", "^", "Ins", "t", "\\\\\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ",_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "sys_", "._", "stdout_", ")_", "._", "communicate_", "(_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Una", "ble", " ", "to", " ", "check", " ", "for", " ", "package", "s", " ", "upgrade", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\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_", "dist", "\\u", "upgrade_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "`", "apt", "-", "get", " ", "upgrade", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "'_", ",_", "'", "a", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "\"", "DEB", "IAN", "\\u", "FRONT", "END", "=", "non", "interactive", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apt", "-", "get", " ", "dist", "-", "upgrade", " ", "-", "o", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dp", "kg", "::", "Optio", "ns", "::", "=\\\\\"", "--", "force", "-", "confd", "ef", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "-", "o", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dp", "kg", "::", "Optio", "ns", "::", "=\\\\\"", "--", "force", "-", "conf", "old", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "-", "y", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ",_", "stdin_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "f_", ",_", "stderr_", "=_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proc_", "._", "returncode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wrong", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Error", " ", "whi", "le", " ", "install", "ing", " ", "package", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apt", "-", "get", " ", "exit", "ed", " ", "with", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\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_", "install_", "(_", "self_", ",_", "packages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "packages_", "=_", "'", " ", "'_", "._", "join_", "(_", "packages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "'_", ",_", "'", "a", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "\"", "DEB", "IAN", "\\u", "FRONT", "END", "=", "non", "interactive", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apt", "-", "get", " ", "install", " ", "-", "o", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dp", "kg", "::", "Optio", "ns", "::", "=\\\\\"", "--", "force", "-", "confd", "ef", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "-", "o", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dp", "kg", "::", "Optio", "ns", "::", "=\\\\\"", "--", "force", "-", "conf", "old", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "-", "y", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "all", "\\u", "packages_", ")_", ",_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "f_", ",_", "stderr_", "=_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proc_", "._", "returncode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wrong", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wrong", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove_", "(_", "self_", ",_", "packages_", ",_", "auto_", "=_", "False_", ",_", "purge_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "packages_", "=_", "'", " ", "'_", "._", "join_", "(_", "packages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "'_", ",_", "'", "a", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "purge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "'", "apt", "-", "get", " ", "pur", "ge", " ", "-", "y", " ", "{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "all", "\\u", "packages_", ")_", ",_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "f_", ",_", "stderr_", "=_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "'", "apt", "-", "get", " ", "remove", " ", "-", "y", " ", "{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "all", "\\u", "packages_", ")_", ",_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "f_", ",_", "stderr_", "=_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proc_", "._", "returncode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wrong", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Error", " ", "whi", "le", " ", "install", "ing", " ", "package", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apt", "-", "get", " ", "exit", "ed", " ", "with", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\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_", "auto", "\\u", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "`", "apt", "-", "get", " ", "autocl", "ean", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "\\u", "out_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "open_", "(_", "self_", "._", "app_", "._", "config_", "._", "get_", "(_", "'", "log", ".", "logg", "ing", "'_", ",_", "'", "file", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apt", "\\u", "get_", "._", "autocl", "ean_", "(_", "\"-", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "orig", "\\u", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Error", "Return", "Code_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Una", "ble", " ", "to", " ", "apt", "-", "get", " ", "autocl", "ean", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\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_", "auto", "\\u", "remove_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "`", "apt", "-", "get", " ", "autore", "move", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "\"", "Run", "ning", " ", "apt", "-", "get", " ", "autore", "move", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apt", "\\u", "get_", "._", "autore", "move_", "(_", "\"-", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Error", "Return", "Code_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Una", "ble", " ", "to", " ", "apt", "-", "get", " ", "autore", "move", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\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", "installed_", "(_", "self_", ",_", "package", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "if", " ", "package", " ", "is", " ", "avail", "able", " ", "in", " ", "cache", " ", "and", " ", "is", " ", "install", "ed", " ", "or", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "Tru", "e", " ", "if", " ", "install", "ed", " ", "other", "wis", "e", " ", "return", "s", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apt", "\\u", "cache_", "=_", "apt", "_", "._", "cache_", "._", "Cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apt", "\\u", "cache_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "package", "\\u", "name_", "._", "strip_", "(_", ")_", "in_", "apt", "\\u", "cache_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "apt", "\\u", "cache_", "[_", "package", "\\u", "name_", "._", "strip_", "(_", ")_", "]_", "._", "is", "\\u", "installed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "apt", "\\u", "cache", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "apt", "\\u", "cache", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Ap", "t", "Get_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "only_", "(_", "self_", ",_", "package", "\\u", "name_", ",_", "repo", "\\u", "url_", "=_", "None_", ",_", "repo", "\\u", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "`", "apt", "-", "get", " ", "install", " ", "--", "download", "-", "only", " ", "PACKAG", "E", "\\u", "NAME", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "packages_", "=_", "'", " ", "'_", "._", "join_", "(_", "package", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "'_", ",_", "'", "a", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "repo", "\\u", "url_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "EE", "Repo_", "._", "add_", "(_", "self_", ",_", "repo", "\\u", "url_", "=_", "repo", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "repo", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "EE", "Repo_", "._", "add", "\\u", "key_", "(_", "self_", ",_", "repo", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "\"", "apt", "-", "get", " ", "update", " ", "&&", " ", "DEB", "IAN", "\\u", "FRONT", "END", "=", "non", "interactive", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apt", "-", "get", " ", "install", " ", "-", "o", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dp", "kg", "::", "Optio", "ns", "::", "=\\\\\"", "--", "force", "-", "confd", "ef", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "-", "o", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dp", "kg", "::", "Optio", "ns", "::", "=\\\\\"", "--", "force", "-", "conf", "old", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "-", "y", " ", " ", "--", "download", "-", "only", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "packages_", ")_", ",_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "f_", ",_", "stderr_", "=_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proc_", "._", "returncode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Error", " ", "in", " ", "fetch", "ing", " ", "dpkg", " ", "package", ".\\\\", "n", "Rever", "ting", " ", "change", "s", " ", "..\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "repo", "\\u", "url_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "EE", "Repo_", "._", "remove_", "(_", "self_", ",_", "repo", "\\u", "url_", "=_", "repo", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Error", " ", "whi", "le", " ", "download", "ing", " ", "package", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apt", "-", "get", " ", "exit", "ed", " ", "with", " ", "error", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Unused import
tailhook/pyzza/backport/fix_dictcomp.py
[ { "content": "from lib2to3 import fixer_base, pytree\nfrom lib2to3.pgen2 import token\nfrom lib2to3.fixer_util import Name, Call, LParen, RParen, ArgList, Dot\n\n\"\"\"\nFixes:\n {a:b for a,b in abc}\ninto:\n dict((a,b) for a, b in abc)\n\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FixDictcomp(fixer_base.BaseFix):\n PATTERN = \"\"\"\n atom< '{' dictsetmaker< key=any ':' value=any\n cfor=comp_for<any*> > '}' >\n \"\"\"", "metadata": "root.FixDictcomp", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def transform(self, node, results):\n syms = self.syms\n results['key'].remove()\n results['cfor'].remove()\n results['value'].remove()\n res = pytree.Node(syms.power,\n [Name('dict', prefix=node.prefix),\n pytree.Node(syms.trailer,\n [pytree.Leaf(token.LPAR, '('),\n pytree.Node(syms.argument,\n [pytree.Node(syms.atom,\n [pytree.Leaf(token.LPAR, '('),\n pytree.Node(syms.testlist_gexp,\n [results['key'],\n pytree.Leaf(token.COMMA, ','),\n results['value']]),\n pytree.Leaf(token.RPAR, ')')]),\n results['cfor']]),\n pytree.Leaf(token.RPAR, ')')])])\n return res", "metadata": "root.FixDictcomp.transform", "header": "['class', 'FixDictcomp', '(', 'fixer_base', '.', 'BaseFix', ')', ':', '___EOS___']", "index": 16 } ]
[ { "span": "from lib2to3.fixer_util import Name, Call, LParen, RParen, ArgList, Dot", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 71 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "lib", "2t", "o3", "_", "import_", "fixer", "\\u", "base_", ",_", "pyt", "ree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lib", "2t", "o3", "_", "._", "pge", "n2_", "import_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lib", "2t", "o3", "_", "._", "fixer", "\\u", "util_", "import_", "Name_", ",_", "Call_", ",_", "LP", "are", "n_", ",_", "RP", "are", "n_", ",_", "Arg", "List_", ",_", "Dot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Fix", "es", ":", "\\", "10", ";", " ", " ", " ", " ", "{", "a", ":", "b", " ", "for", " ", "a", ",", "b", " ", "in", " ", "abc", "}", "\\", "10", ";", "int", "o", ":", "\\", "10", ";", " ", " ", " ", " ", "dict", "((", "a", ",", "b", ")", " ", "for", " ", "a", ",", " ", "b", " ", "in", " ", "abc", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Fix", "Dict", "comp_", "(_", "fixer", "\\u", "base_", "._", "Base", "Fix", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PATTERN_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "atom", "<", " ", "'{", "'", " ", "dict", "set", "maker", "<", " ", "key", "=", "any", " ", "':", "'", " ", "value", "=", "any", "\\", "10", ";", " ", " ", " ", " ", "cf", "or", "=", "comp", "\\u", "for", "<", "any", "*>", " ", ">", " ", "'}", "'", " ", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fix", "Dict", "comp_", "(_", "fixer", "\\u", "base_", "._", "Base", "Fix", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "transform_", "(_", "self_", ",_", "node_", ",_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syms_", "=_", "self_", "._", "syms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "[_", "'", "key", "'_", "]_", "._", "remove_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "[_", "'", "cf", "or", "'_", "]_", "._", "remove_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "[_", "'", "value", "'_", "]_", "._", "remove_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "pyt", "ree_", "._", "Node_", "(_", "syms_", "._", "power_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "Name_", "(_", "'", "dict", "'_", ",_", "prefix_", "=_", "node_", "._", "prefix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pyt", "ree_", "._", "Node_", "(_", "syms_", "._", "trailer", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "pyt", "ree_", "._", "Leaf_", "(_", "token_", "._", "LPAR", "_", ",_", "'('_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pyt", "ree_", "._", "Node_", "(_", "syms_", "._", "argument_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "pyt", "ree_", "._", "Node_", "(_", "syms_", "._", "atom_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "pyt", "ree_", "._", "Leaf_", "(_", "token_", "._", "LPAR", "_", ",_", "'('_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pyt", "ree_", "._", "Node_", "(_", "syms_", "._", "testl", "ist", "\\u", "gex", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "results_", "[_", "'", "key", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pyt", "ree_", "._", "Leaf_", "(_", "token_", "._", "COMMA", "_", ",_", "','_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "[_", "'", "value", "'_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pyt", "ree_", "._", "Leaf_", "(_", "token_", "._", "RPA", "R_", ",_", "')'_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "[_", "'", "cf", "or", "'_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pyt", "ree_", "._", "Leaf_", "(_", "token_", "._", "RPA", "R_", ",_", "')'_", ")_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Unnecessary 'else' clause in loop
bokeh/bokeh/bokeh/core/properties.py
[ { "content": " def from_json(self, json, models=None):\n for tp in self.type_params:\n try:\n return tp.from_json(json, models)\n except DeserializationError:\n pass\n else:\n raise DeserializationError(\"%s couldn't deserialize %s\" % (self, json))", "metadata": "root.Either.from_json", "header": "['class', 'Either', '(', 'ParameterizedPropertyDescriptor', ')', ':', '___EOS___']", "index": 1310 } ]
[ { "span": "for tp in self.type_params:", "start_line": 1311, "start_column": 8, "end_line": 1311, "end_column": 35 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "class_", "Ei", "ther_", "(_", "Parameteri", "zed", "Proper", "ty", "Descriptor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "json_", "(_", "self_", ",_", "json_", ",_", "models_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tp_", "in_", "self_", "._", "type", "\\u", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tp_", "._", "from", "\\u", "json_", "(_", "json_", ",_", "models_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Deserializ", "ation", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Deserializ", "ation", "Error_", "(_", "\"%", "s", " ", "coul", "dn", "'", "t", " ", "deserialize", " ", "%", "s", "\"_", "%_", "(_", "self_", ",_", "json_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
An assert statement has a side-effect
ionelmc/python-aspectlib/tests/test_integrations.py
[ { "content": "def test_mock_builtin():\n with aspectlib.weave(open, mock('foobar')):\n assert open('???') == 'foobar'\n\n assert open(__file__) != 'foobar'", "metadata": "root.test_mock_builtin", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def test_mock_builtin_os():\n print(os.open.__name__)\n with aspectlib.weave('os.open', mock('foobar')):\n assert os.open('???') == 'foobar'\n\n assert os.open(__file__, 0) != 'foobar'", "metadata": "root.test_mock_builtin_os", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def test_socket_meth(meth=socket.socket.close):\n calls = []\n with aspectlib.weave(meth, record(calls=calls)):\n s = socket.socket()\n assert s.close() is None\n assert calls == [(s, (), {})]\n del calls[:]\n\n s = socket.socket()\n assert s.close() is None\n assert calls == []", "metadata": "root.test_socket_meth", "header": "['module', '___EOS___']", "index": 93 } ]
[ { "span": "assert open('???') == 'foobar'", "start_line": 32, "start_column": 8, "end_line": 32, "end_column": 38 }, { "span": "assert open(__file__) != 'foobar'", "start_line": 34, "start_column": 4, "end_line": 34, "end_column": 37 }, { "span": "assert os.open('???') == 'foobar'", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 41 }, { "span": "assert os.open(__file__, 0) != 'foobar'", "start_line": 42, "start_column": 4, "end_line": 42, "end_column": 43 }, { "span": "assert s.close() is None", "start_line": 97, "start_column": 8, "end_line": 97, "end_column": 32 }, { "span": "assert s.close() is None", "start_line": 102, "start_column": 4, "end_line": 102, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "mock", "\\u", "builtin_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "open_", ",_", "mock_", "(_", "'", "fooba", "r", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "open_", "(_", "'?", "??", "'_", ")_", "==_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "open_", "(_", "\\u\\u", "file\\u\\u_", ")_", "!=_", "'", "fooba", "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_", "def_", "test\\u", "mock", "\\u", "bui", "lti", "n", "\\u", "os_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "os_", "._", "open_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "'", "os", ".", "open", "'_", ",_", "mock_", "(_", "'", "fooba", "r", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "os_", "._", "open_", "(_", "'?", "??", "'_", ")_", "==_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "os_", "._", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "0_", ")_", "!=_", "'", "fooba", "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_", "def_", "test\\u", "socket", "\\u", "meth_", "(_", "meth_", "=_", "socket_", "._", "socket_", "._", "close_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "meth_", ",_", "record_", "(_", "calls_", "=_", "calls_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "s_", "._", "close_", "(_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "calls_", "==_", "[_", "(_", "s_", ",_", "(_", ")_", ",_", "{_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "calls_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "s_", "._", "close_", "(_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "calls_", "==_", "[_", "]_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 ]
Modification of parameter with default
maraoz/proofofexistence/pycoin/tx/script/vm.py
[ { "content": "def eval_script(script, signature_hash, hash_type, stack=[]):\n altstack = []\n if len(script) > 10000:\n return False\n\n pc = 0\n begin_code_hash = pc\n if_condition = None # or True or False\n\n try:\n while pc < len(script):\n opcode, data, pc = get_opcode(script, pc)\n if len(data) > 0:\n stack.append(data)\n continue\n\n # deal with if_condition first\n\n if if_condition is not None:\n # TODO: fix IF (which doesn't properly nest)\n if opcode == opcodes.OP_ELSE:\n if_condition = not if_condition\n continue\n if opcode == opcodes.OP_ENDIF:\n if_condition = None\n continue\n if not if_condition:\n continue\n if opcode in (opcodes.OP_IF, opcodes.OP_NOTIF):\n if_condition = (stack.pop() == VCH_TRUE)\n continue\n\n if opcode == opcodes.OP_CODESEPARATOR:\n begin_code_hash = pc - 1\n continue\n\n if opcode in INVALID_OPCODE_VALUES:\n raise ScriptError(\"invalid opcode %s at %d\" % (opcodes.INT_TO_OPCODE[opcode], pc-1))\n\n if opcode in MICROCODE_LOOKUP:\n MICROCODE_LOOKUP[opcode](stack)\n if opcode in VERIFY_OPS:\n v = stack.pop()\n if v != VCH_TRUE:\n raise ScriptError(\"VERIFY failed at %d\" % (pc-1))\n continue\n\n if opcode == opcodes.OP_TOALTSTACK:\n altstack.append(stack.pop())\n continue\n\n if opcode == opcodes.OP_FROMALTSTACK:\n stack.append(altstack.pop())\n continue\n\n if opcode >= opcodes.OP_1NEGATE and opcode <= opcodes.OP_16:\n stack.append(opcode + 1 - opcodes.OP_1)\n continue\n\n if opcode in (opcodes.OP_ELSE, opcodes.OP_ENDIF):\n raise ScriptError(\"%s without OP_IF\" % opcodes.INT_TO_OPCODE[opcode])\n\n if opcode in (opcodes.OP_CHECKSIG, opcodes.OP_CHECKSIGVERIFY):\n public_key_blob = stack.pop()\n sig_blob = stack.pop()\n v = check_signature(script, signature_hash, public_key_blob, sig_blob, hash_type)\n stack.append(v)\n if opcode == opcodes.OP_CHECKSIGVERIFY:\n if stack.pop() != VCH_TRUE:\n raise ScriptError(\"VERIFY failed at %d\" % pc-1)\n continue\n\n # BRAIN DAMAGE -- does it always get down here for each verify op? I think not\n if opcode in VERIFY_OPS:\n v = stack.pop()\n if v != VCH_TRUE:\n raise ScriptError(\"VERIFY failed at %d\" % pc-1)\n\n logging.error(\"can't execute opcode %s\", opcode)\n\n except Exception:\n logging.exception(\"script failed\")\n\n return len(stack) != 0", "metadata": "root.eval_script", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "stack.", "start_line": 79, "start_column": 16, "end_line": 79, "end_column": 21 }, { "span": "stack.", "start_line": 95, "start_column": 32, "end_line": 95, "end_column": 37 } ]
[ { "span": "stack=", "start_line": 66, "start_column": 51, "end_line": 66, "end_column": 56 } ]
1
true
[ "[CLS]_", "Modifica", "tion_", "of_", "parameter_", "with_", "default_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "eval", "\\u", "script_", "(_", "script_", ",_", "signa", "ture", "\\u", "hash_", ",_", "hash", "\\u", "type_", ",_", "stack_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alts", "tack_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "script_", ")_", ">_", "10000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pc_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "begin", "\\u", "code", "\\u", "hash_", "=_", "pc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "\\u", "condition_", "=_", "None_", "#", " ", "or", " ", "Tru", "e", " ", "or", " ", "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 ", " _", "while_", "pc_", "<_", "len_", "(_", "script_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", ",_", "data_", ",_", "pc_", "=_", "get", "\\u", "opcode_", "(_", "script_", ",_", "pc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "data_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deal", " ", "with", " ", "if", "\\u", "condition", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "if", "\\u", "condition_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "fix", " ", "IF", " ", "(", "whi", "ch", " ", "doe", "sn", "'", "t", " ", "proper", "ly", " ", "nest", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opcode_", "==_", "opcodes_", "._", "OP", "\\u", "ELS", "E_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if", "\\u", "condition_", "=_", "not_", "if", "\\u", "condition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "==_", "opcodes_", "._", "OP", "\\u", "ENDI", "F_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if", "\\u", "condition_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "if", "\\u", "condition_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "in_", "(_", "opcodes_", "._", "OP", "\\u", "IF_", ",_", "opcodes_", "._", "OP", "\\u", "NOTIF", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if", "\\u", "condition_", "=_", "(_", "stack_", "._", "pop_", "(_", ")_", "==_", "VC", "H", "\\u", "TRUE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "==_", "opcodes_", "._", "OP", "\\u", "CODE", "SEPARATOR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "begin", "\\u", "code", "\\u", "hash_", "=_", "pc_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "in_", "INVALID", "\\u", "OPCODE", "\\u", "VALUES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Script", "Error_", "(_", "\"", "invalid", " ", "opcode", " ", "%", "s", " ", "at", " ", "%", "d", "\"_", "%_", "(_", "opcodes_", "._", "INT", "\\u", "TO", "\\u", "OPCODE", "_", "[_", "opcode_", "]_", ",_", "pc_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "in_", "MICRO", "CODE", "\\u", "LOOKUP", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MICRO", "CODE", "\\u", "LOOKUP", "_", "[_", "opcode_", "]_", "(_", "stack_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opcode_", "in_", "VERIFY", "\\u", "OPS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "stack_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "!=_", "VC", "H", "\\u", "TRUE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Script", "Error_", "(_", "\"", "VERIFY", " ", "fail", "ed", " ", "at", " ", "%", "d", "\"_", "%_", "(_", "pc_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "==_", "opcodes_", "._", "OP", "\\u", "TO", "ALT", "STACK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alts", "tack_", "._", "append_", "(_", "stack_", "._", "pop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "==_", "opcodes_", "._", "OP", "\\u", "FROM", "ALT", "STACK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack_", "._", "append_", "(_", "alts", "tack_", "._", "pop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", ">=_", "opcodes_", "._", "OP", "\\u", "1", "NEGAT", "E_", "and_", "opcode_", "<=_", "opcodes_", "._", "OP", "\\u", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack_", "._", "append_", "(_", "opcode_", "+_", "1_", "-_", "opcodes_", "._", "OP", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "in_", "(_", "opcodes_", "._", "OP", "\\u", "ELS", "E_", ",_", "opcodes_", "._", "OP", "\\u", "ENDI", "F_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Script", "Error_", "(_", "\"%", "s", " ", "with", "out", " ", "OP", "\\u", "IF", "\"_", "%_", "opcodes_", "._", "INT", "\\u", "TO", "\\u", "OPCODE", "_", "[_", "opcode_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "in_", "(_", "opcodes_", "._", "OP", "\\u", "CHECKS", "IG", "_", ",_", "opcodes_", "._", "OP", "\\u", "CHECKS", "IG", "VERIFY", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "public", "\\u", "key", "\\u", "blob_", "=_", "stack_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "\\u", "blob_", "=_", "stack_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "check", "\\u", "signature_", "(_", "script_", ",_", "signa", "ture", "\\u", "hash_", ",_", "public", "\\u", "key", "\\u", "blob_", ",_", "sig", "\\u", "blob_", ",_", "hash", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stack_", "._", "append_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opcode_", "==_", "opcodes_", "._", "OP", "\\u", "CHECKS", "IG", "VERIFY", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "stack_", "._", "pop_", "(_", ")_", "!=_", "VC", "H", "\\u", "TRUE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Script", "Error_", "(_", "\"", "VERIFY", " ", "fail", "ed", " ", "at", " ", "%", "d", "\"_", "%_", "pc_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BRAI", "N", " ", "DA", "MAGE", " ", "--", " ", "doe", "s", " ", "it", " ", "alw", "ay", "s", " ", "get", " ", "down", " ", "here", " ", "for", " ", "each", " ", "verify", " ", "op", "?", " ", "I", " ", "think", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opcode_", "in_", "VERIFY", "\\u", "OPS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "stack_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "!=_", "VC", "H", "\\u", "TRUE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Script", "Error_", "(_", "\"", "VERIFY", " ", "fail", "ed", " ", "at", " ", "%", "d", "\"_", "%_", "pc_", "-_", "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_", "logging_", "._", "error_", "(_", "\"", "can", "'", "t", " ", "execute", " ", "opcode", " ", "%", "s", "\"_", ",_", "opcode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "exception_", "(_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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 ]
Comparison using is when operands support `__eq__`
amrdraz/kodr/app/brython/www/src/Lib/test/test_userdict.py
[ { "content": "class UserDictTest(mapping_tests.TestHashMappingProtocol):\n type2test = collections.UserDict\n\n", "metadata": "root.UserDictTest", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def test_all(self):\n # Test constructors\n u = collections.UserDict()\n u0 = collections.UserDict(d0)\n u1 = collections.UserDict(d1)\n u2 = collections.UserDict(d2)\n\n uu = collections.UserDict(u)\n uu0 = collections.UserDict(u0)\n uu1 = collections.UserDict(u1)\n uu2 = collections.UserDict(u2)\n\n # keyword arg constructor\n self.assertEqual(collections.UserDict(one=1, two=2), d2)\n # item sequence constructor\n self.assertEqual(collections.UserDict([('one',1), ('two',2)]), d2)\n self.assertEqual(collections.UserDict(dict=[('one',1), ('two',2)]), d2)\n # both together\n self.assertEqual(collections.UserDict([('one',1), ('two',2)], two=3, three=5), d3)\n\n # alternate constructor\n self.assertEqual(collections.UserDict.fromkeys('one two'.split()), d4)\n self.assertEqual(collections.UserDict().fromkeys('one two'.split()), d4)\n self.assertEqual(collections.UserDict.fromkeys('one two'.split(), 1), d5)\n self.assertEqual(collections.UserDict().fromkeys('one two'.split(), 1), d5)\n self.assertTrue(u1.fromkeys('one two'.split()) is not u1)\n self.assertIsInstance(u1.fromkeys('one two'.split()), collections.UserDict)\n self.assertIsInstance(u2.fromkeys('one two'.split()), collections.UserDict)\n\n # Test __repr__\n self.assertEqual(str(u0), str(d0))\n self.assertEqual(repr(u1), repr(d1))\n self.assertEqual(repr(u2), repr(d2))\n\n # Test rich comparison and __len__\n all = [d0, d1, d2, u, u0, u1, u2, uu, uu0, uu1, uu2]\n for a in all:\n for b in all:\n self.assertEqual(a == b, len(a) == len(b))\n\n # Test __getitem__\n self.assertEqual(u2[\"one\"], 1)\n self.assertRaises(KeyError, u1.__getitem__, \"two\")\n\n # Test __setitem__\n u3 = collections.UserDict(u2)\n u3[\"two\"] = 2\n u3[\"three\"] = 3\n\n # Test __delitem__\n del u3[\"three\"]\n self.assertRaises(KeyError, u3.__delitem__, \"three\")\n\n # Test clear\n u3.clear()\n self.assertEqual(u3, {})\n\n # Test copy()\n u2a = u2.copy()\n self.assertEqual(u2a, u2)\n u2b = collections.UserDict(x=42, y=23)\n u2c = u2b.copy() # making a copy of a UserDict is special cased\n self.assertEqual(u2b, u2c)\n\n class MyUserDict(collections.UserDict):\n def display(self): print(self)\n\n m2 = MyUserDict(u2)\n m2a = m2.copy()\n self.assertEqual(m2a, m2)\n\n # SF bug #476616 -- copy() of UserDict subclass shared data\n m2['foo'] = 'bar'\n self.assertNotEqual(m2a, m2)\n\n # Test keys, items, values\n self.assertEqual(u2.keys(), d2.keys())\n self.assertEqual(u2.items(), d2.items())\n self.assertEqual(list(u2.values()), list(d2.values()))\n\n # Test \"in\".\n for i in u2.keys():\n self.assertIn(i, u2)\n self.assertEqual(i in u1, i in d1)\n self.assertEqual(i in u0, i in d0)\n\n # Test update\n t = collections.UserDict()\n t.update(u2)\n self.assertEqual(t, u2)\n\n # Test get\n for i in u2.keys():\n self.assertEqual(u2.get(i), u2[i])\n self.assertEqual(u1.get(i), d1.get(i))\n self.assertEqual(u0.get(i), d0.get(i))\n\n # Test \"in\" iteration.\n for i in range(20):\n u2[i] = str(i)\n ikeys = []\n for k in u2:\n ikeys.append(k)\n keys = u2.keys()\n self.assertEqual(set(ikeys), set(keys))\n\n # Test setdefault\n t = collections.UserDict()\n self.assertEqual(t.setdefault(\"x\", 42), 42)\n self.assertIn(\"x\", t)\n self.assertEqual(t.setdefault(\"x\", 23), 42)\n\n # Test pop\n t = collections.UserDict(x=42)\n self.assertEqual(t.pop(\"x\"), 42)\n self.assertRaises(KeyError, t.pop, \"x\")\n self.assertEqual(t.pop(\"x\", 1), 1)\n t[\"x\"] = 42\n self.assertEqual(t.pop(\"x\", 1), 42)\n\n # Test popitem\n t = collections.UserDict(x=42)\n self.assertEqual(t.popitem(), (\"x\", 42))\n self.assertRaises(KeyError, t.popitem)", "metadata": "root.UserDictTest.test_all", "header": "['class', 'UserDictTest', '(', 'mapping_tests', '.', 'TestHashMappingProtocol', ')', ':', '___EOS___']", "index": 15 } ]
[ { "span": "u1.fromkeys('one two'.split()) is not u1)", "start_line": 40, "start_column": 24, "end_line": 40, "end_column": 64 } ]
[]
1
false
[ "[CLS]_", "Compari", "son_", "using_", "is_", "when_", "operands_", "support_", " _", "`_", "\\u\\u", "eq\\u\\u_", "`_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "User", "Dict", "Test_", "(_", "mapping", "\\u", "tests_", "._", "Test", "Hash", "Map", "ping", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "2te", "st_", "=_", "collections_", "._", "User", "Dict_", "\\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_", "User", "Dict", "Test_", "(_", "mapping", "\\u", "tests_", "._", "Test", "Hash", "Map", "ping", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "construct", "ors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u_", "=_", "collections_", "._", "User", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u0", "_", "=_", "collections_", "._", "User", "Dict_", "(_", "d0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u1_", "=_", "collections_", "._", "User", "Dict_", "(_", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2_", "=_", "collections_", "._", "User", "Dict_", "(_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uu", "_", "=_", "collections_", "._", "User", "Dict_", "(_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "0_", "=_", "collections_", "._", "User", "Dict_", "(_", "u0", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "1_", "=_", "collections_", "._", "User", "Dict_", "(_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "2_", "=_", "collections_", "._", "User", "Dict_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keyw", "ord", " ", "arg", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "one_", "=_", "1_", ",_", "two_", "=_", "2_", ")_", ",_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "item", " ", "sequence", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "[_", "(_", "'", "one", "'_", ",_", "1_", ")_", ",_", "(_", "'", "two", "'_", ",_", "2_", ")_", "]_", ")_", ",_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "dict_", "=_", "[_", "(_", "'", "one", "'_", ",_", "1_", ")_", ",_", "(_", "'", "two", "'_", ",_", "2_", ")_", "]_", ")_", ",_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bot", "h", " ", "together_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "[_", "(_", "'", "one", "'_", ",_", "1_", ")_", ",_", "(_", "'", "two", "'_", ",_", "2_", ")_", "]_", ",_", "two_", "=_", "3_", ",_", "three_", "=_", "5_", ")_", ",_", "d3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alternat", "e", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "d4", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", ")_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "d4", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ",_", "1_", ")_", ",_", "d5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", ")_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ",_", "1_", ")_", ",_", "d5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "u1_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", "is_", "not_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "u1_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "collections_", "._", "User", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "u2_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "collections_", "._", "User", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "repr\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "u0", "_", ")_", ",_", "str_", "(_", "d0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repr_", "(_", "u1_", ")_", ",_", "repr_", "(_", "d1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repr_", "(_", "u2_", ")_", ",_", "repr_", "(_", "d2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "rich", " ", "compa", "ris", "on", " ", "and", " ", "\\u\\u", "len\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all_", "=_", "[_", "d0_", ",_", "d1_", ",_", "d2_", ",_", "u_", ",_", "u0", "_", ",_", "u1_", ",_", "u2_", ",_", "uu", "_", ",_", "uu", "0_", ",_", "uu", "1_", ",_", "uu", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a_", "in_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "b_", "in_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "a_", "==_", "b_", ",_", "len_", "(_", "a_", ")_", "==_", "len_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "getitem\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "[_", "\"", "one", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "u1_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "\"", "two", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "setitem\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "3_", "=_", "collections_", "._", "User", "Dict_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u", "3_", "[_", "\"", "two", "\"_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u", "3_", "[_", "\"", "three", "\"_", "]_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "delitem\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "u", "3_", "[_", "\"", "three", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "u", "3_", "._", "\\u\\u", "delitem\\u\\u_", ",_", "\"", "three", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "clear_", "\\u\\u\\uNL\\u\\u\\u_", "u", "3_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u", "3_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "copy", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "u2", "a_", "=_", "u2_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2", "a_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2", "b_", "=_", "collections_", "._", "User", "Dict_", "(_", "x_", "=_", "42_", ",_", "y_", "=_", "23_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2", "c_", "=_", "u2", "b_", "._", "copy_", "(_", ")_", "#", " ", "mak", "ing", " ", "a", " ", "copy", " ", "of", " ", "a", " ", "User", "Dict", " ", "is", " ", "special", " ", "case", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2", "b_", ",_", "u2", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "My", "User", "Dict_", "(_", "collections_", "._", "User", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "display_", "(_", "self_", ")_", ":_", "print_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m2_", "=_", "My", "User", "Dict_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "a_", "=_", "m2_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m2", "a_", ",_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SF", " ", "bug", " ", "#", "476", "616", " ", "--", " ", "copy", "()", " ", "of", " ", "User", "Dict", " ", "subclass", " ", "shared", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "m2_", "[_", "'", "foo", "'_", "]_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "m2", "a_", ",_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "keys", ",", " ", "items", ",", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "keys_", "(_", ")_", ",_", "d2_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "items_", "(_", ")_", ",_", "d2_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "u2_", "._", "values_", "(_", ")_", ")_", ",_", "list_", "(_", "d2_", "._", "values_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\"", "in", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "u2_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "In_", "(_", "i_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "i_", "in_", "u1_", ",_", "i_", "in_", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "i_", "in_", "u0", "_", ",_", "i_", "in_", "d0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "update_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "get_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "u2_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "get_", "(_", "i_", ")_", ",_", "u2_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u1_", "._", "get_", "(_", "i_", ")_", ",_", "d1_", "._", "get_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u0", "_", "._", "get_", "(_", "i_", ")_", ",_", "d0_", "._", "get_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\"", "in", "\"", " ", "iterati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u2_", "[_", "i_", "]_", "=_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ike", "ys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "u2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ike", "ys_", "._", "append_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "=_", "u2_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "ike", "ys_", ")_", ",_", "set_", "(_", "keys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "setdefault_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "setdefault_", "(_", "\"", "x", "\"_", ",_", "42_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "x", "\"_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "setdefault_", "(_", "\"", "x", "\"_", ",_", "23_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "pop_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", "x_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "pop_", "(_", "\"", "x", "\"_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "t_", "._", "pop_", ",_", "\"", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "pop_", "(_", "\"", "x", "\"_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "[_", "\"", "x", "\"_", "]_", "=_", "42_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "pop_", "(_", "\"", "x", "\"_", ",_", "1_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "popi", "tem_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", "x_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "popi", "tem_", "(_", ")_", ",_", "(_", "\"", "x", "\"_", ",_", "42_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "t_", "._", "popi", "tem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
pbs/agora-proc/tests/test_stats.py
[ { "content": " def test_add_duration_event(self):\n \"\"\"\n Test that only the correct MEDIA_EVENTS\n that have timestamps are added to the\n duration_events list\n \"\"\"\n for key, events in self.events.items():\n stats = PBSVideoStats()\n for event in events:\n stats.add_event(event)\n\n results = stats.duration_events\n for edata in results:\n self.assertTrue(edata.get('etype') in stats.MEDIA_EVENTS)\n self.assertTrue(edata.get('edate') is not None)", "metadata": "root.PBSVideoStatsTestcase.test_add_duration_event", "header": "['class', 'PBSVideoStatsTestcase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 118 }, { "content": " def test_sort_duration_events_in_order(self):\n \"\"\"\n Test that we're sorting the duration_event timestamps\n (added in chronological order) correctly\n \"\"\"\n for key, events in self.events.items():\n stats = PBSVideoStats()\n for event in events:\n stats.add_event(event)\n\n stats._calculate_duration()\n results = stats.duration_events\n for count, edata in enumerate(results):\n if count + 1 < len(results):\n self.assertTrue(\n edata.get('edate') <= results[count + 1].get('edate'))", "metadata": "root.PBSVideoStatsTestcase.test_sort_duration_events_in_order", "header": "['class', 'PBSVideoStatsTestcase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 134 }, { "content": " def test_sort_duration_events_reverse_order(self):\n \"\"\"\n Test that we're sorting the duration_event timestamps\n (added in reversed order) correctly\n \"\"\"\n for key, events in self.events.items():\n stats = PBSVideoStats()\n for event in reversed(events):\n stats.add_event(event)\n\n stats._calculate_duration()\n results = stats.duration_events\n for count, edata in enumerate(results):\n if count + 1 < len(results):\n self.assertTrue(\n edata.get('edate') <= results[count + 1].get('edate'))", "metadata": "root.PBSVideoStatsTestcase.test_sort_duration_events_reverse_order", "header": "['class', 'PBSVideoStatsTestcase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 151 }, { "content": " def test_buffering_length(self):\n \"\"\"\n Verify that we're summing the time a stream spends buffering.\n \"\"\"\n streams_with_buffer_length = 0\n enum = -1\n for key, events in self.events.items():\n enum += 1\n stats = PBSVideoStats()\n stream_buffer_length = None\n open_start_buffer = False\n is_valid_buffering = True\n media_buffering_start_time = None\n media_buffering_start_location = None\n for event in events:\n stats.add_event(event)\n event_type = event.get('event_type')\n if not event_type:\n is_valid_buffering = False\n break\n if event_type == 'MediaBufferingStart':\n if open_start_buffer:\n # two MediaBufferingStart events in a row\n # toss stream\n is_valid_buffering = False\n break\n open_start_buffer = True\n media_buffering_start_time = parse(event.get('event_date'))\n media_buffering_start_location = event.get('x_video_location')\n if event_type == 'MediaBufferingEnd':\n if not open_start_buffer:\n # two MediaBufferingEnd events in a row\n # toss stream\n is_valid_buffering = False\n break\n open_start_buffer = False\n # verify that we didn't scrub video\n if event.get('x_video_location') != media_buffering_start_location:\n is_valid_buffering = False\n break\n # subtract MediaBufferingEnd timestamp from\n # MediaBufferingStart timestamp\n if not stream_buffer_length:\n stream_buffer_length = 0\n media_buffering_end_time = parse(event.get('event_date'))\n buffer_delta = media_buffering_end_time - media_buffering_start_time\n stream_buffer_length += self._total_seconds(buffer_delta)\n if is_valid_buffering:\n results = stats.summary()\n results_buffering_length = results.get('buffering_length')\n self.assertEqual(results_buffering_length, stream_buffer_length)\n if stream_buffer_length is not None:\n self.assertTrue(\n results_buffering_length >= 0,\n '%s is not a positive number' % results_buffering_length)\n streams_with_buffer_length += 1\n self.assertTrue(streams_with_buffer_length > 0)", "metadata": "root.PBSVideoStatsTestcase.test_buffering_length", "header": "['class', 'PBSVideoStatsTestcase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 198 } ]
[ { "span": "self.assertTrue(edata.get('etype') in stats.MEDIA_EVENTS)", "start_line": 131, "start_column": 16, "end_line": 131, "end_column": 73 }, { "span": "self.assertTrue(edata.get('edate') is not None)", "start_line": 132, "start_column": 16, "end_line": 132, "end_column": 63 }, { "span": "self.assertTrue(\n edata.get('edate') <= results[count + 1].get('edate'))", "start_line": 148, "start_column": 20, "end_line": 149, "end_column": 78 }, { "span": "self.assertTrue(\n edata.get('edate') <= results[count + 1].get('edate'))", "start_line": 165, "start_column": 20, "end_line": 166, "end_column": 78 }, { "span": "self.assertTrue(streams_with_buffer_length > 0)", "start_line": 254, "start_column": 8, "end_line": 254, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "PBS", "Vid", "eo", "Stat", "s", "Test", "case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "duration", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "only", " ", "the", " ", "correct", " ", "MEDIA", "\\u", "EVENTS", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "have", " ", "timestamp", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "duration", "\\u", "events", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "events_", "in_", "self_", "._", "events_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "=_", "PBS", "Vid", "eo", "Stats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "events_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "._", "add", "\\u", "event_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "stats_", "._", "duration", "\\u", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "edat", "a_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "edat", "a_", "._", "get_", "(_", "'", "etype", "'_", ")_", "in_", "stats_", "._", "MEDIA", "\\u", "EVENTS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "edat", "a_", "._", "get_", "(_", "'", "edat", "e", "'_", ")_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PBS", "Vid", "eo", "Stat", "s", "Test", "case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sort", "\\u", "duration", "\\u", "events", "\\u", "in", "\\u", "order_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "we", "'", "re", " ", "sorting", " ", "the", " ", "duration", "\\u", "event", " ", "timestamp", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "adde", "d", " ", "in", " ", "chrono", "logical", " ", "order", ")", " ", "correct", "ly", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "events_", "in_", "self_", "._", "events_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "=_", "PBS", "Vid", "eo", "Stats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "events_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "._", "add", "\\u", "event_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stats_", "._", "\\u", "calcul", "ate", "\\u", "duration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "stats_", "._", "duration", "\\u", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "count_", ",_", "edat", "a_", "in_", "enumerate_", "(_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "count_", "+_", "1_", "<_", "len_", "(_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "edat", "a_", "._", "get_", "(_", "'", "edat", "e", "'_", ")_", "<=_", "results_", "[_", "count_", "+_", "1_", "]_", "._", "get_", "(_", "'", "edat", "e", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PBS", "Vid", "eo", "Stat", "s", "Test", "case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sort", "\\u", "duration", "\\u", "events", "\\u", "reverse", "\\u", "order_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "we", "'", "re", " ", "sorting", " ", "the", " ", "duration", "\\u", "event", " ", "timestamp", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "adde", "d", " ", "in", " ", "reverse", "d", " ", "order", ")", " ", "correct", "ly", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "events_", "in_", "self_", "._", "events_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "=_", "PBS", "Vid", "eo", "Stats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "reversed_", "(_", "events_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "._", "add", "\\u", "event_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stats_", "._", "\\u", "calcul", "ate", "\\u", "duration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "stats_", "._", "duration", "\\u", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "count_", ",_", "edat", "a_", "in_", "enumerate_", "(_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "count_", "+_", "1_", "<_", "len_", "(_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "edat", "a_", "._", "get_", "(_", "'", "edat", "e", "'_", ")_", "<=_", "results_", "[_", "count_", "+_", "1_", "]_", "._", "get_", "(_", "'", "edat", "e", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PBS", "Vid", "eo", "Stat", "s", "Test", "case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bufferi", "ng", "\\u", "length_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verify", " ", "tha", "t", " ", "we", "'", "re", " ", "summ", "ing", " ", "the", " ", "time", " ", "a", " ", "stream", " ", "spend", "s", " ", "bufferi", "ng", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "s", "\\u", "with", "\\u", "buffer", "\\u", "length_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enum_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "events_", "in_", "self_", "._", "events_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enum_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "PBS", "Vid", "eo", "Stats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "buffer", "\\u", "length_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "\\u", "start", "\\u", "buffer_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "valid", "\\u", "bufferi", "ng_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media", "\\u", "bufferi", "ng", "\\u", "start", "\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media", "\\u", "bufferi", "ng", "\\u", "start", "\\u", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "events_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "._", "add", "\\u", "event_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "type_", "=_", "event_", "._", "get_", "(_", "'", "event", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "event", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "\\u", "valid", "\\u", "bufferi", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "\\u", "type_", "==_", "'", "Media", "Buffer", "ing", "Start", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "open", "\\u", "start", "\\u", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "two", " ", "Media", "Buffer", "ing", "Start", " ", "events", " ", "in", " ", "a", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tos", "s", " ", "stream_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "is", "\\u", "valid", "\\u", "bufferi", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open", "\\u", "start", "\\u", "buffer_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media", "\\u", "bufferi", "ng", "\\u", "start", "\\u", "time_", "=_", "parse_", "(_", "event_", "._", "get_", "(_", "'", "event", "\\u", "date", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media", "\\u", "bufferi", "ng", "\\u", "start", "\\u", "location_", "=_", "event_", "._", "get_", "(_", "'", "x", "\\u", "video", "\\u", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "\\u", "type_", "==_", "'", "Media", "Buffer", "ing", "End", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "open", "\\u", "start", "\\u", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "two", " ", "Media", "Buffer", "ing", "End", " ", "events", " ", "in", " ", "a", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tos", "s", " ", "stream_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "is", "\\u", "valid", "\\u", "bufferi", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open", "\\u", "start", "\\u", "buffer_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "tha", "t", " ", "we", " ", "did", "n", "'", "t", " ", "scrub", " ", "video_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "event_", "._", "get_", "(_", "'", "x", "\\u", "video", "\\u", "location", "'_", ")_", "!=_", "media", "\\u", "bufferi", "ng", "\\u", "start", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "is", "\\u", "valid", "\\u", "bufferi", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "subtract", " ", "Media", "Buffer", "ing", "End", " ", "timestamp", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Media", "Buffer", "ing", "Start", " ", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "stream", "\\u", "buffer", "\\u", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "stream", "\\u", "buffer", "\\u", "length_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "media", "\\u", "bufferi", "ng", "\\u", "end", "\\u", "time_", "=_", "parse_", "(_", "event_", "._", "get_", "(_", "'", "event", "\\u", "date", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buffer", "\\u", "delta_", "=_", "media", "\\u", "bufferi", "ng", "\\u", "end", "\\u", "time_", "-_", "media", "\\u", "bufferi", "ng", "\\u", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "buffer", "\\u", "length_", "+=_", "self_", "._", "\\u", "total", "\\u", "seconds_", "(_", "buffer", "\\u", "delta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "valid", "\\u", "bufferi", "ng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "stats_", "._", "summary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "\\u", "bufferi", "ng", "\\u", "length_", "=_", "results_", "._", "get_", "(_", "'", "bufferi", "ng", "\\u", "length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "results", "\\u", "bufferi", "ng", "\\u", "length_", ",_", "stream", "\\u", "buffer", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stream", "\\u", "buffer", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "results", "\\u", "bufferi", "ng", "\\u", "length_", ">=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "is", " ", "not", " ", "a", " ", "posit", "ive", " ", "number", "'_", "%_", "results", "\\u", "bufferi", "ng", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "s", "\\u", "with", "\\u", "buffer", "\\u", "length_", "+=_", "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_", "self_", "._", "assert", "True_", "(_", "stream", "s", "\\u", "with", "\\u", "buffer", "\\u", "length_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
pyjs/pyjs/pyjs/lib_trans/pycompiler/__init__.py
[ { "content": "\"\"\"Package for parsing and compiling Python source code\n\nThere are several functions defined at the top level that are imported\nfrom modules contained in the package.\n\nparse(buf, mode=\"exec\") -> AST\n Converts a string containing Python source code to an abstract\n syntax tree (AST). The AST is defined in compiler.ast.\n\nparseFile(path) -> AST\n The same as parse(open(path))\n\nwalk(ast, visitor, verbose=None)\n Does a pre-order walk over the ast using the visitor instance.\n See compiler.visitor for details.\n\ncompile(source, filename, mode, flags=None, dont_inherit=None)\n Returns a code object. A replacement for the builtin compile() function.\n\ncompileFile(filename)\n Generates a .pyc file by compiling filename.\n\"\"\"\n\nfrom pycompiler.transformer import parse, parseFile\nfrom pycompiler.visitor import walk\n#from pycompiler.pycodegen import compile, compileFile\nfrom pycompiler import ast\nfrom pycompiler import transformer\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from pycompiler.transformer import parse, parseFile", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 51 }, { "span": "from pycompiler.visitor import walk", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 35 }, { "span": "from pycompiler import ast", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 26 }, { "span": "from pycompiler import transformer", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Packa", "ge", " ", "for", " ", "pars", "ing", " ", "and", " ", "compil", "ing", " ", "Pyth", "on", " ", "source", " ", "code", "\\", "10", ";", "\\", "10", ";", "There", " ", "are", " ", "sever", "al", " ", "function", "s", " ", "defin", "ed", " ", "at", " ", "the", " ", "top", " ", "level", " ", "tha", "t", " ", "are", " ", "import", "ed", "\\", "10", ";", "from", " ", "module", "s", " ", "contain", "ed", " ", "in", " ", "the", " ", "package", ".", "\\", "10", ";", "\\", "10", ";", "parse", "(", "buf", ",", " ", "mode", "=\"", "exec", "\")", " ", "->", " ", "AST", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "string", " ", "contain", "ing", " ", "Pyth", "on", " ", "source", " ", "code", " ", "to", " ", "an", " ", "abstract", "\\", "10", ";", " ", " ", " ", " ", "synta", "x", " ", "tree", " ", "(", "AST", ").", " ", " ", "The", " ", "AST", " ", "is", " ", "defin", "ed", " ", "in", " ", "compiler", ".", "ast", ".", "\\", "10", ";", "\\", "10", ";", "parse", "File", "(", "path", ")", " ", "->", " ", "AST", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "same", " ", "as", " ", "parse", "(", "open", "(", "path", "))\\", "10", ";", "\\", "10", ";", "walk", "(", "ast", ",", " ", "visitor", ",", " ", "verbo", "se", "=", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Do", "es", " ", "a", " ", "pre", "-", "order", " ", "walk", " ", "over", " ", "the", " ", "ast", " ", "usi", "ng", " ", "the", " ", "visitor", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "compiler", ".", "visitor", " ", "for", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "compile", "(", "source", ",", " ", "filename", ",", " ", "mode", ",", " ", "flags", "=", "Non", "e", ",", " ", "don", "t", "\\u", "inherit", "=", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "code", " ", "object", ".", " ", " ", "A", " ", "replace", "ment", " ", "for", " ", "the", " ", "bui", "lti", "n", " ", "compile", "()", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", "compile", "File", "(", "filename", ")", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "a", " ", ".", "pyc", " ", "file", " ", "by", " ", "compil", "ing", " ", "filename", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyco", "mpi", "ler_", "._", "transformer_", "import_", "parse_", ",_", "parse", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyco", "mpi", "ler_", "._", "visitor_", "import_", "walk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "pyco", "mpi", "ler", ".", "pyco", "deg", "en", " ", "import", " ", "compile", ",", " ", "compile", "File_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyco", "mpi", "ler_", "import_", "ast_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyco", "mpi", "ler_", "import_", "transformer_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1 ]
Unused import
esrlabs/git-repo/subcmds/push.py
[ { "content": "#\n# Copyright (C) 2008 The Android Open Source Project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import print_function\nimport copy\nimport re\nimport sys\n\nfrom command import InteractiveCommand\nfrom editor import Editor\nfrom error import GitError, HookError, UploadError\nfrom git_command import GitCommand\nfrom project import RepoHook\n\nfrom git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M\n\nfrom pyversion import is_python3\n# pylint:disable=W0622\nif not is_python3():\n input = raw_input\nelse:\n unicode = str\n# pylint:enable=W0622\n\nUNUSUAL_COMMIT_THRESHOLD = 5\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _ConfirmManyPushs(multiple_branches=False):\n if multiple_branches:\n print('ATTENTION: One or more branches has an unusually high number '\n 'of commits.')\n else:\n print('ATTENTION: You are pushing an unusually high number of commits.')\n print('YOU PROBABLY DO NOT MEAN TO DO THIS. (Did you rebase across '\n 'branches?)')\n answer = input(\"If you are sure you intend to do this, type 'yes': \").strip()\n return answer == \"yes\"", "metadata": "root._ConfirmManyPushs", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def _die(fmt, *args):\n msg = fmt % args\n print('error: %s' % msg, file=sys.stderr)\n sys.exit(1)", "metadata": "root._die", "header": "['module', '___EOS___']", "index": 49 }, { "content": "class Push(InteractiveCommand):\n common = True\n helpSummary = \"Push changes (bypass code review)\"\n helpUsage = \"\"\"\n%prog [<project>]...\n\"\"\"\n helpDescription = \"\"\"\nThe '%prog' command is used to push changes to its remote branch.\nIt searches for topic branches in local projects that have not yet\nbeen pushed (or published for review). If multiple topic branches\nare found, '%prog' opens an editor to allow the user to select\nwhich branches to push.\n\n'%prog' searches for pushable changes in all projects listed at\nthe command line. Projects can be specified either by name, or by\na relative or absolute path to the project's local directory. If no\nprojects are specified, '%prog' will search for pushadable changes\nin all projects listed in the manifest.\n\n\"\"\"\n\n\n\n\n\n\n", "metadata": "root.Push", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def _Options(self, p):\n p.add_option('--br',\n type='string', action='store', dest='branch',\n help='Branch to push.')\n p.add_option('--cbr', '--current-branch',\n dest='current_branch', action='store_true',\n help='Push current git branch.')\n p.add_option('-D', '--destination', '--dest',\n type='string', action='store', dest='dest_branch',\n metavar='BRANCH',\n help='Push on this target branch.')\n\n # Options relating to push hook. Note that verify and no-verify are NOT\n # opposites of each other, which is why they store to different locations.\n # We are using them to match 'git commit' syntax.\n #\n # Combinations:\n # - no-verify=False, verify=False (DEFAULT):\n # If stdout is a tty, can prompt about running push hooks if needed.\n # If user denies running hooks, the push is cancelled. If stdout is\n # not a tty and we would need to prompt about push hooks, push is\n # cancelled.\n # - no-verify=False, verify=True:\n # Always run push hooks with no prompt.\n # - no-verify=True, verify=False:\n # Never run push hooks, but push anyway (AKA bypass hooks).\n # - no-verify=True, verify=True:\n # Invalid\n p.add_option('--no-verify',\n dest='bypass_hooks', action='store_true',\n help='Do not run the push hook.')\n p.add_option('--verify',\n dest='allow_all_hooks', action='store_true',\n help='Run the push hook without prompting.')", "metadata": "root.Push._Options", "header": "['class', 'Push', '(', 'InteractiveCommand', ')', ':', '___EOS___']", "index": 75 }, { "content": " def _SingleBranch(self, opt, branch):\n project = branch.project\n name = branch.name\n remote = project.GetBranch(name).remote\n\n date = branch.date\n commit_list = branch.commits\n\n destination = opt.dest_branch or project.dest_branch or project.revisionExpr\n print('Push project %s/ to remote branch %s:' % (project.relpath, destination))\n print(' branch %s (%2d commit%s, %s):' % (\n name,\n len(commit_list),\n len(commit_list) != 1 and 's' or '',\n date))\n for commit in commit_list:\n print(' %s' % commit)\n\n sys.stdout.write('to %s (y/N)? ' % remote.name)\n answer = sys.stdin.readline().strip().lower()\n answer = answer in ('y', 'yes', '1', 'true', 't')\n\n if answer:\n if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD:\n answer = _ConfirmManyPushs()\n\n if answer:\n self._Push(opt, [branch])\n else:\n _die(\"push aborted by user\")", "metadata": "root.Push._SingleBranch", "header": "['class', 'Push', '(', 'InteractiveCommand', ')', ':', '___EOS___']", "index": 110 }, { "content": " def _MultipleBranches(self, opt, pending):\n projects = {}\n branches = {}\n\n script = []\n script.append('# Uncomment the branches to push:')\n for project, avail in pending:\n script.append('#')\n script.append('# project %s/:' % project.relpath)\n\n b = {}\n for branch in avail:\n if branch is None:\n continue\n name = branch.name\n date = branch.date\n commit_list = branch.commits\n\n if b:\n script.append('#')\n destination = opt.dest_branch or project.dest_branch or project.revisionExpr\n script.append('# branch %s (%2d commit%s, %s) to remote branch %s:' % (\n name,\n len(commit_list),\n len(commit_list) != 1 and 's' or '',\n date,\n destination))\n for commit in commit_list:\n script.append('# %s' % commit)\n b[name] = branch\n\n projects[project.relpath] = project\n branches[project.name] = b\n script.append('')\n\n script = [ x.encode('utf-8')\n if issubclass(type(x), unicode)\n else x\n for x in script ]\n\n script = Editor.EditString(\"\\n\".join(script)).split(\"\\n\")\n\n project_re = re.compile(r'^#?\\s*project\\s*([^\\s]+)/:$')\n branch_re = re.compile(r'^\\s*branch\\s*([^\\s(]+)\\s*\\(.*')\n\n project = None\n todo = []\n\n for line in script:\n m = project_re.match(line)\n if m:\n name = m.group(1)\n project = projects.get(name)\n if not project:\n _die('project %s not available for push', name)\n continue\n\n m = branch_re.match(line)\n if m:\n name = m.group(1)\n if not project:\n _die('project for branch %s not in script', name)\n branch = branches[project.name].get(name)\n if not branch:\n _die('branch %s not in %s', name, project.relpath)\n todo.append(branch)\n if not todo:\n _die(\"nothing uncommented for push\")\n\n many_commits = False\n for branch in todo:\n if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD:\n many_commits = True\n break\n if many_commits:\n if not _ConfirmManyPushs(multiple_branches=True):\n _die(\"push aborted by user\")\n\n self._Push(opt, todo)", "metadata": "root.Push._MultipleBranches", "header": "['class', 'Push', '(', 'InteractiveCommand', ')', ':', '___EOS___']", "index": 141 }, { "content": " def _Push(self, opt, todo):\n have_errors = False\n for branch in todo:\n try:\n # Check if there are local changes that may have been forgotten\n changes = branch.project.UncommitedFiles()\n if changes:\n sys.stdout.write('Uncommitted changes in ' + branch.project.name)\n sys.stdout.write(' (did you forget to amend?):\\n')\n sys.stdout.write('\\n'.join(changes) + '\\n')\n sys.stdout.write('Continue pushing? (y/N) ')\n a = sys.stdin.readline().strip().lower()\n if a not in ('y', 'yes', 't', 'true', 'on'):\n print(\"skipping push\", file=sys.stderr)\n branch.uploaded = False\n branch.error = 'User aborted'\n continue\n\n destination = opt.dest_branch or branch.project.dest_branch\n\n # Make sure our local branch is not setup to track a different remote branch\n merge_branch = self._GetMergeBranch(branch.project)\n if destination:\n full_dest = 'refs/heads/%s' % destination\n if not opt.dest_branch and merge_branch and merge_branch != full_dest:\n print('merge branch %s does not match destination branch %s'\n % (merge_branch, full_dest))\n print('skipping push.')\n print('Please use `--destination %s` if this is intentional'\n % destination)\n branch.uploaded = False\n continue\n\n self.Push(branch, dest_branch=destination)\n branch.uploaded = True\n except UploadError as e:\n branch.error = e\n branch.uploaded = False\n have_errors = True\n\n print(file=sys.stderr)\n print('----------------------------------------------------------------------', file=sys.stderr)\n\n if have_errors:\n for branch in todo:\n if not branch.uploaded:\n if len(str(branch.error)) <= 30:\n fmt = ' (%s)'\n else:\n fmt = '\\n (%s)'\n print(('[FAILED] %-15s %-15s' + fmt) % (\n branch.project.relpath + '/', \\\n branch.name, \\\n str(branch.error)),\n file=sys.stderr)\n print()\n\n for branch in todo:\n if branch.uploaded:\n print('[OK ] %-15s %s' % (\n branch.project.relpath + '/',\n branch.name),\n file=sys.stderr)\n\n if have_errors:\n sys.exit(1)", "metadata": "root.Push._Push", "header": "['class', 'Push', '(', 'InteractiveCommand', ')', ':', '___EOS___']", "index": 221 }, { "content": " def Push(self, branch_base, branch=None,\n dest_branch=None):\n \"\"\"Pushs the named branch.\n \"\"\"\n project = branch_base.project\n if branch is None:\n branch = project.CurrentBranch\n if branch is None:\n raise GitError('not currently on a branch')\n\n branch = project.GetBranch(branch)\n if not branch.LocalMerge:\n raise GitError('branch %s does not track a remote' % branch.name)\n\n if dest_branch is None:\n dest_branch = project.dest_branch\n if dest_branch is None:\n dest_branch = branch.merge\n if not dest_branch.startswith(R_HEADS):\n dest_branch = R_HEADS + dest_branch\n\n if not branch.remote.projectname:\n branch.remote.projectname = project.name\n branch.remote.Save()\n\n remote = branch.remote.name\n cmd = ['push']\n cmd.append(remote)\n\n if dest_branch.startswith(R_HEADS):\n dest_branch = dest_branch[len(R_HEADS):]\n\n push_type = 'heads'\n ref_spec = '%s:refs/%s/%s' % (R_HEADS + branch.name, push_type,\n dest_branch)\n cmd.append(ref_spec)\n\n if GitCommand(project, cmd, bare=True).Wait() != 0:\n raise UploadError('Push failed')", "metadata": "root.Push.Push", "header": "['class', 'Push', '(', 'InteractiveCommand', ')', ':', '___EOS___']", "index": 288 }, { "content": " def _GetMergeBranch(self, project):\n p = GitCommand(project,\n ['rev-parse', '--abbrev-ref', 'HEAD'],\n capture_stdout = True,\n capture_stderr = True)\n p.Wait()\n local_branch = p.stdout.strip()\n p = GitCommand(project,\n ['config', '--get', 'branch.%s.merge' % local_branch],\n capture_stdout = True,\n capture_stderr = True)\n p.Wait()\n merge_branch = p.stdout.strip()\n return merge_branch", "metadata": "root.Push._GetMergeBranch", "header": "['class', 'Push', '(', 'InteractiveCommand', ')', ':', '___EOS___']", "index": 328 }, { "content": " def Execute(self, opt, args):\n self.opt = opt\n project_list = self.GetProjects(args)\n pending = []\n branch = None\n\n if opt.branch:\n branch = opt.branch\n\n for project in project_list:\n if opt.current_branch:\n cbr = project.CurrentBranch\n up_branch = project.GetUploadableBranch(cbr)\n if up_branch:\n avail = [up_branch]\n else:\n avail = None\n print('ERROR: Current branch (%s) not pushable. '\n 'You may be able to type '\n '\"git branch --set-upstream-to m/master\" to fix '\n 'your branch.' % str(cbr),\n file=sys.stderr)\n else:\n avail = project.GetUploadableBranches(branch)\n if avail:\n pending.append((project, avail))\n\n if pending and (not opt.bypass_hooks):\n hook = RepoHook('pre-push', self.manifest.repo_hooks_project,\n self.manifest.topdir, abort_if_user_denies=True)\n pending_proj_names = [project.name for (project, avail) in pending]\n pending_worktrees = [project.worktree for (project, avail) in pending]\n try:\n hook.Run(opt.allow_all_hooks, project_list=pending_proj_names,\n worktree_list=pending_worktrees)\n except HookError as e:\n print(\"ERROR: %s\" % str(e), file=sys.stderr)\n return\n\n if not pending:\n print(\"no branches ready for push\", file=sys.stderr)\n elif len(pending) == 1 and len(pending[0][1]) == 1:\n self._SingleBranch(opt, pending[0][1][0])\n else:\n self._MultipleBranches(opt, pending)", "metadata": "root.Push.Execute", "header": "['class', 'Push', '(', 'InteractiveCommand', ')', ':', '___EOS___']", "index": 343 } ]
[ { "span": "import copy", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 11 }, { "span": "from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2008", " ", "The", " ", "And", "roid", " ", "Open", " ", "Sou", "rce", " ", "Project_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "command_", "import_", "Interact", "ive", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "editor_", "import_", "Editor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "error_", "import_", "Git", "Error_", ",_", "Hook", "Error_", ",_", "Upload", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "git", "\\u", "command_", "import_", "Git", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "project_", "import_", "Rep", "o", "Hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "git", "\\u", "refs_", "import_", "Git", "Refs", "_", ",_", "HEAD_", ",_", "R", "\\u", "HEAD", "S_", ",_", "R", "\\u", "TAGS_", ",_", "R", "\\u", "PUB", "_", ",_", "R", "\\u", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyv", "ersion_", "import_", "is", "\\u", "python", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", "disable", "=", "W", "062", "2_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "python", "3_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input_", "=_", "raw", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", "enable", "=", "W", "062", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "UN", "US", "UAL", "\\u", "COMMIT", "\\u", "THRESHOLD_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Confirm", "Many", "Push", "s_", "(_", "multiple", "\\u", "branches_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "multiple", "\\u", "branches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ATTE", "NTI", "ON", ":", " ", "One", " ", "or", " ", "more", " ", "branch", "es", " ", "has", " ", "an", " ", "unu", "sua", "ll", "y", " ", "high", " ", "number", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "of", " ", "commit", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ATTE", "NTI", "ON", ":", " ", "You", " ", "are", " ", "push", "ing", " ", "an", " ", "unu", "sua", "ll", "y", " ", "high", " ", "number", " ", "of", " ", "commit", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "YOU", " ", "PROB", "AB", "LY", " ", "DO", " ", "NOT", " ", "MEAN", " ", "TO", " ", "DO", " ", "THIS", ".", " ", "(", "Di", "d", " ", "you", " ", "rebase", " ", "acro", "ss", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "branch", "es", "?)'", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "input_", "(_", "\"", "If", " ", "you", " ", "are", " ", "sure", " ", "you", " ", "inten", "d", " ", "to", " ", "do", " ", "this", ",", " ", "type", " ", "'", "ye", "s", "':", " ", "\"_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "answer_", "==_", "\"", "ye", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "die_", "(_", "fmt_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "fmt_", "%_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "error", ":", " ", "%", "s", "'_", "%_", "msg_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "common_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help", "Summary_", "=_", "\"", "Push", " ", "change", "s", " ", "(", "bypass", " ", "code", " ", "review", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help", "Usage_", "=_", "\"\"\"", "\\", "10", ";", "%", "prog", " ", "[", "<", "project", ">]", "...", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help", "Description_", "=_", "\"\"\"", "\\", "10", ";", "The", " ", "'%", "prog", "'", " ", "command", " ", "is", " ", "used", " ", "to", " ", "push", " ", "change", "s", " ", "to", " ", "its", " ", "remote", " ", "branch", ".", "\\", "10", ";", "It", " ", "searche", "s", " ", "for", " ", "topic", " ", "branch", "es", " ", "in", " ", "local", " ", "project", "s", " ", "tha", "t", " ", "have", " ", "not", " ", "ye", "t", "\\", "10", ";", "bee", "n", " ", "pushed", " ", "(", "or", " ", "publi", "shed", " ", "for", " ", "review", ").", " ", " ", "If", " ", "multiple", " ", "topic", " ", "branch", "es", "\\", "10", ";", "are", " ", "found", ",", " ", "'%", "prog", "'", " ", "opens", " ", "an", " ", "editor", " ", "to", " ", "allow", " ", "the", " ", "user", " ", "to", " ", "select", "\\", "10", ";", "whi", "ch", " ", "branch", "es", " ", "to", " ", "push", ".", "\\", "10", ";", "\\", "10", ";'", "%", "prog", "'", " ", "searche", "s", " ", "for", " ", "push", "able", " ", "change", "s", " ", "in", " ", "all", " ", "project", "s", " ", "liste", "d", " ", "at", "\\", "10", ";", "the", " ", "command", " ", "line", ".", " ", " ", "Project", "s", " ", "can", " ", "be", " ", "specified", " ", "eit", "her", " ", "by", " ", "name", ",", " ", "or", " ", "by", "\\", "10", ";", "a", " ", "relative", " ", "or", " ", "abs", "olute", " ", "path", " ", "to", " ", "the", " ", "project", "'", "s", " ", "local", " ", "director", "y", ".", " ", "If", " ", "no", "\\", "10", ";", "project", "s", " ", "are", " ", "specified", ",", " ", "'%", "prog", "'", " ", "will", " ", "search", " ", "for", " ", "push", "ada", "ble", " ", "change", "s", "\\", "10", ";", "in", " ", "all", " ", "project", "s", " ", "liste", "d", " ", "in", " ", "the", " ", "manifest", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Options_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "._", "add", "\\u", "option_", "(_", "'--", "br", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "string", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "dest_", "=_", "'", "branch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Branc", "h", " ", "to", " ", "push", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add", "\\u", "option_", "(_", "'--", "cb", "r", "'_", ",_", "'--", "current", "-", "branch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "current", "\\u", "branch", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Push", " ", "current", " ", "git", " ", "branch", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add", "\\u", "option_", "(_", "'-", "D", "'_", ",_", "'--", "destinat", "ion", "'_", ",_", "'--", "dest", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "string", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "dest_", "=_", "'", "dest", "\\u", "branch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "BRANCH", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Push", " ", "on", " ", "this", " ", "target", " ", "branch", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "ns", " ", "relati", "ng", " ", "to", " ", "push", " ", "hook", ".", " ", " ", "Not", "e", " ", "tha", "t", " ", "verify", " ", "and", " ", "no", "-", "verify", " ", "are", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "opposite", "s", " ", "of", " ", "each", " ", "other", ",", " ", "whi", "ch", " ", "is", " ", "wh", "y", " ", "the", "y", " ", "store", " ", "to", " ", "different", " ", "location", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "are", " ", "usi", "ng", " ", "them", " ", "to", " ", "match", " ", "'", "git", " ", "commit", "'", " ", "synta", "x", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Combinat", "ion", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "no", "-", "verify", "=", "Fal", "se", ",", " ", "verify", "=", "Fal", "se", " ", "(", "DEF", "AUL", "T", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "If", " ", "stdout", " ", "is", " ", "a", " ", "tt", "y", ",", " ", "can", " ", "prompt", " ", "abo", "ut", " ", "runn", "ing", " ", "push", " ", "hook", "s", " ", "if", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "If", " ", "user", " ", "deni", "es", " ", "runn", "ing", " ", "hook", "s", ",", " ", "the", " ", "push", " ", "is", " ", "cancel", "led", ".", " ", " ", "If", " ", "stdout", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "not", " ", "a", " ", "tt", "y", " ", "and", " ", "we", " ", "wou", "ld", " ", "need", " ", "to", " ", "prompt", " ", "abo", "ut", " ", "push", " ", "hook", "s", ",", " ", "push", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "cancel", "led", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "no", "-", "verify", "=", "Fal", "se", ",", " ", "verify", "=", "Tru", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Al", "way", "s", " ", "run", " ", "push", " ", "hook", "s", " ", "with", " ", "no", " ", "prompt", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "no", "-", "verify", "=", "Tru", "e", ",", " ", "verify", "=", "Fal", "se", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Never", " ", "run", " ", "push", " ", "hook", "s", ",", " ", "but", " ", "push", " ", "anyway", " ", "(", "AK", "A", " ", "bypass", " ", "hook", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "no", "-", "verify", "=", "Tru", "e", ",", " ", "verify", "=", "Tru", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Invalid_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "add", "\\u", "option_", "(_", "'--", "no", "-", "verify", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "bypass", "\\u", "hook", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Do", " ", "not", " ", "run", " ", "the", " ", "push", " ", "hook", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add", "\\u", "option_", "(_", "'--", "verify", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "allow", "\\u", "all", "\\u", "hook", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Run", " ", "the", " ", "push", " ", "hook", " ", "with", "out", " ", "prompt", "ing", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Sing", "le", "Branch_", "(_", "self_", ",_", "opt_", ",_", "branch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "branch_", "._", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote_", "=_", "project_", "._", "Get", "Branch_", "(_", "name_", ")_", "._", "remote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "branch_", "._", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commit", "\\u", "list_", "=_", "branch_", "._", "commits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "destination_", "=_", "opt_", "._", "dest", "\\u", "branch_", "or_", "project_", "._", "dest", "\\u", "branch_", "or_", "project_", "._", "revis", "ion", "Expr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Push", " ", "project", " ", "%", "s", "/", " ", "to", " ", "remote", " ", "branch", " ", "%", "s", ":'_", "%_", "(_", "project_", "._", "relpath_", ",_", "destination_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "branch", " ", "%", "s", " ", "(%", "2d", " ", "commit", "%", "s", ",", " ", "%", "s", "):'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "commit", "\\u", "list_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "commit", "\\u", "list_", ")_", "!=_", "1_", "and_", "'", "s", "'_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "commit_", "in_", "commit", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", " ", " ", " ", " ", " ", "%", "s", "'_", "%_", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", "to", " ", "%", "s", " ", "(", "y", "/", "N", ")?", " ", "'_", "%_", "remote_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "sys_", "._", "stdin_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "answer_", "in_", "(_", "'", "y", "'_", ",_", "'", "ye", "s", "'_", ",_", "'", "1", "'_", ",_", "'", "true", "'_", ",_", "'", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "answer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "branch_", "._", "commits_", ")_", ">_", "UN", "US", "UAL", "\\u", "COMMIT", "\\u", "THRESHOLD_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "answer_", "=_", "\\u", "Confirm", "Many", "Push", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Push", "_", "(_", "opt_", ",_", "[_", "branch_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "die_", "(_", "\"", "push", " ", "abort", "ed", " ", "by", " ", "user", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Multipl", "e", "Branc", "hes", "_", "(_", "self_", ",_", "opt_", ",_", "pending_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "projects_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branches_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "._", "append_", "(_", "'#", " ", "Unco", "mmen", "t", " ", "the", " ", "branch", "es", " ", "to", " ", "push", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "project_", ",_", "avail_", "in_", "pending_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script_", "._", "append_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "._", "append_", "(_", "'#", " ", "project", " ", "%", "s", "/", ":'_", "%_", "project_", "._", "relpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "branch_", "in_", "avail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "branch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "branch_", "._", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commit", "\\u", "list_", "=_", "branch_", "._", "commits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script_", "._", "append_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "destination_", "=_", "opt_", "._", "dest", "\\u", "branch_", "or_", "project_", "._", "dest", "\\u", "branch_", "or_", "project_", "._", "revis", "ion", "Expr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "._", "append_", "(_", "'#", " ", " ", "branch", " ", "%", "s", " ", "(%", "2d", " ", "commit", "%", "s", ",", " ", "%", "s", ")", " ", "to", " ", "remote", " ", "branch", " ", "%", "s", ":'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "commit", "\\u", "list_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "commit", "\\u", "list_", ")_", "!=_", "1_", "and_", "'", "s", "'_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destination_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "commit_", "in_", "commit", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script_", "._", "append_", "(_", "'#", " ", " ", " ", " ", " ", "%", "s", "'_", "%_", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "[_", "name_", "]_", "=_", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "projects_", "[_", "project_", "._", "relpath_", "]_", "=_", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branches_", "[_", "project_", "._", "name_", "]_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "[_", "x_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "issubclass_", "(_", "type_", "(_", "x_", ")_", ",_", "unicode_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "x_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "script_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "Editor_", "._", "Edit", "String_", "(_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "script_", ")_", ")_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "#", "?\\\\", "s", "*", "project", "\\\\", "s", "*([", "^", "\\\\", "s", "]+)", "/", ":$", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "\\\\", "s", "*", "branch", "\\\\", "s", "*([", "^", "\\\\", "s", "(", "]+)\\\\", "s", "*\\\\", "(.", "*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "todo_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "script_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "project", "\\u", "re_", "._", "match_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "projects_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "project_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "die_", "(_", "'", "project", " ", "%", "s", " ", "not", " ", "avail", "able", " ", "for", " ", "push", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "branch", "\\u", "re_", "._", "match_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "project_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "die_", "(_", "'", "project", " ", "for", " ", "branch", " ", "%", "s", " ", "not", " ", "in", " ", "script", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "branch_", "=_", "branches_", "[_", "project_", "._", "name_", "]_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "die_", "(_", "'", "branch", " ", "%", "s", " ", "not", " ", "in", " ", "%", "s", "'_", ",_", "name_", ",_", "project_", "._", "relpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "todo_", "._", "append_", "(_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "todo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "die_", "(_", "\"", "not", "hing", " ", "uncomm", "ente", "d", " ", "for", " ", "push", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "many", "\\u", "commits_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "branch_", "in_", "todo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "branch_", "._", "commits_", ")_", ">_", "UN", "US", "UAL", "\\u", "COMMIT", "\\u", "THRESHOLD_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "many", "\\u", "commits_", "=_", "True_", "\\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_", "if_", "many", "\\u", "commits_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u", "Confirm", "Many", "Push", "s_", "(_", "multiple", "\\u", "branches_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "die_", "(_", "\"", "push", " ", "abort", "ed", " ", "by", " ", "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_", "self_", "._", "\\u", "Push", "_", "(_", "opt_", ",_", "todo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Push", "_", "(_", "self_", ",_", "opt_", ",_", "todo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "have", "\\u", "errors_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "branch_", "in_", "todo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "there", " ", "are", " ", "local", " ", "change", "s", " ", "tha", "t", " ", "may", " ", "have", " ", "bee", "n", " ", "forgo", "tte", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changes_", "=_", "branch_", "._", "project_", "._", "Unco", "mmi", "ted", "Files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "'", "Unco", "mmi", "tted", " ", "change", "s", " ", "in", " ", "'_", "+_", "branch_", "._", "project_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", " ", "(", "did", " ", "you", " ", "forget", " ", "to", " ", "amend", "?)", ":\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "changes_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", "Continu", "e", " ", "push", "ing", "?", " ", "(", "y", "/", "N", ")", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "sys_", "._", "stdin_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "not_", "in_", "(_", "'", "y", "'_", ",_", "'", "ye", "s", "'_", ",_", "'", "t", "'_", ",_", "'", "true", "'_", ",_", "'", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "skip", "ping", " ", "push", "\"_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "._", "uploade", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "._", "error_", "=_", "'", "User", " ", "abort", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "destination_", "=_", "opt_", "._", "dest", "\\u", "branch_", "or_", "branch_", "._", "project_", "._", "dest", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "our", " ", "local", " ", "branch", " ", "is", " ", "not", " ", "setup", " ", "to", " ", "track", " ", "a", " ", "different", " ", "remote", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "branch_", "=_", "self_", "._", "\\u", "Get", "Merge", "Branch_", "(_", "branch_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "destination_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "dest_", "=_", "'", "refs", "/", "head", "s", "/", "%", "s", "'_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "opt_", "._", "dest", "\\u", "branch_", "and_", "merge", "\\u", "branch_", "and_", "merge", "\\u", "branch_", "!=_", "full", "\\u", "dest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "merge", " ", "branch", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "match", " ", "destinat", "ion", " ", "branch", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "merge", "\\u", "branch_", ",_", "full", "\\u", "dest_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "skip", "ping", " ", "push", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Ple", "ase", " ", "use", " ", "`-", "-", "destinat", "ion", " ", "%", "s", "`", " ", "if", " ", "this", " ", "is", " ", "intent", "ional", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "._", "uploade", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Push", "_", "(_", "branch_", ",_", "dest", "\\u", "branch_", "=_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "._", "uploade", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Upload", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch_", "._", "error_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "._", "uploade", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "have", "\\u", "errors_", "=_", "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_", "print_", "(_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "-------", "'_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "have", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "branch_", "in_", "todo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "branch_", "._", "uploade", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "str_", "(_", "branch_", "._", "error_", ")_", ")_", "<=_", "30_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "'", " ", "(%", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "'\\\\", "n", " ", " ", " ", "(%", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "(_", "'[", "FAIL", "ED", "]", " ", "%", "-1", "5", "s", " ", "%", "-1", "5", "s", "'_", "+_", "fmt_", ")_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "._", "project_", "._", "relpath_", "+_", "'/'_", ",_", "branch_", "._", "name_", ",_", "str_", "(_", "branch_", "._", "error_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "branch_", "in_", "todo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "branch_", "._", "uploade", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'[", "OK", " ", " ", " ", " ", "]", " ", "%", "-1", "5", "s", " ", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "._", "project_", "._", "relpath_", "+_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "._", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "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_", "have", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Push", "_", "(_", "self_", ",_", "branch", "\\u", "base_", ",_", "branch_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "\\u", "branch_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Push", "s", " ", "the", " ", "named", " ", "branch", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "branch", "\\u", "base_", "._", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "branch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch_", "=_", "project_", "._", "Curr", "ent", "Branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "branch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Git", "Error_", "(_", "'", "not", " ", "currentl", "y", " ", "on", " ", "a", " ", "branch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "branch_", "=_", "project_", "._", "Get", "Branch_", "(_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "branch_", "._", "Local", "Merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Git", "Error_", "(_", "'", "branch", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "track", " ", "a", " ", "remote", "'_", "%_", "branch_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dest", "\\u", "branch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "branch_", "=_", "project_", "._", "dest", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dest", "\\u", "branch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "branch_", "=_", "branch_", "._", "merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "dest", "\\u", "branch_", "._", "startswith_", "(_", "R", "\\u", "HEAD", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "branch_", "=_", "R", "\\u", "HEAD", "S_", "+_", "dest", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "branch_", "._", "remote_", "._", "project", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch_", "._", "remote_", "._", "project", "name_", "=_", "project_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "._", "remote_", "._", "Save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote_", "=_", "branch_", "._", "remote_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "push", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "remote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dest", "\\u", "branch_", "._", "startswith_", "(_", "R", "\\u", "HEAD", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "branch_", "=_", "dest", "\\u", "branch_", "[_", "len_", "(_", "R", "\\u", "HEAD", "S_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "push", "\\u", "type_", "=_", "'", "head", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "spec_", "=_", "'%", "s", ":", "refs", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "R", "\\u", "HEAD", "S_", "+_", "branch_", "._", "name_", ",_", "push", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "ref", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "Git", "Command_", "(_", "project_", ",_", "cmd_", ",_", "bare", "_", "=_", "True_", ")_", "._", "Wait_", "(_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Upload", "Error_", "(_", "'", "Push", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Merge", "Branch_", "(_", "self_", ",_", "project_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Git", "Command_", "(_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "rev", "-", "parse", "'_", ",_", "'--", "abbrev", "-", "ref", "'_", ",_", "'", "HEAD", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "captur", "e\\u", "stdout_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "captur", "e\\u", "stderr_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "Wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "branch_", "=_", "p_", "._", "stdout_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Git", "Command_", "(_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "config", "'_", ",_", "'--", "get", "'_", ",_", "'", "branch", ".", "%", "s", ".", "merge", "'_", "%_", "local", "\\u", "branch_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "captur", "e\\u", "stdout_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "captur", "e\\u", "stderr_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "Wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "\\u", "branch_", "=_", "p_", "._", "stdout_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "merge", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Push", "_", "(_", "Interact", "ive", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Execute_", "(_", "self_", ",_", "opt_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "opt_", "=_", "opt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "list_", "=_", "self_", "._", "Get", "Project", "s_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pending_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opt_", "._", "branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch_", "=_", "opt_", "._", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "project_", "in_", "project", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "._", "current", "\\u", "branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cb", "r_", "=_", "project_", "._", "Curr", "ent", "Branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "up", "\\u", "branch_", "=_", "project_", "._", "Get", "Upload", "able", "Branch_", "(_", "cb", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "up", "\\u", "branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "avail_", "=_", "[_", "up", "\\u", "branch_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "avail_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "ERROR", ":", " ", "Curr", "ent", " ", "branch", " ", "(%", "s", ")", " ", "not", " ", "push", "able", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", " ", "may", " ", "be", " ", "able", " ", "to", " ", "type", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "git", " ", "branch", " ", "--", "set", "-", "ups", "tream", "-", "to", " ", "m", "/", "master", "\"", " ", "to", " ", "fix", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "your", " ", "branch", ".'_", "%_", "str_", "(_", "cb", "r_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\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 ", " _", "avail_", "=_", "project_", "._", "Get", "Upload", "able", "Branc", "hes", "_", "(_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "avail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pending_", "._", "append_", "(_", "(_", "project_", ",_", "avail_", ")_", ")_", "\\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_", "pending_", "and_", "(_", "not_", "opt_", "._", "bypass", "\\u", "hooks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hook_", "=_", "Rep", "o", "Hook_", "(_", "'", "pre", "-", "push", "'_", ",_", "self_", "._", "manifest_", "._", "repo", "\\u", "hook", "s", "\\u", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manifest_", "._", "topdi", "r_", ",_", "abort", "\\u", "if", "\\u", "user", "\\u", "deni", "es_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "ing", "\\u", "proj", "\\u", "names_", "=_", "[_", "project_", "._", "name_", "for_", "(_", "project_", ",_", "avail_", ")_", "in_", "pending_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "ing", "\\u", "work", "trees_", "=_", "[_", "project_", "._", "work", "tree_", "for_", "(_", "project_", ",_", "avail_", ")_", "in_", "pending_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hook_", "._", "Run_", "(_", "opt_", "._", "allow", "\\u", "all", "\\u", "hooks_", ",_", "project", "\\u", "list_", "=_", "pend", "ing", "\\u", "proj", "\\u", "names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "work", "tree", "\\u", "list_", "=_", "pend", "ing", "\\u", "work", "trees_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Hook", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "ERROR", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "e_", ")_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "pending_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "no", " ", "branch", "es", " ", "read", "y", " ", "for", " ", "push", "\"_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "pending_", ")_", "==_", "1_", "and_", "len_", "(_", "pending_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Sing", "le", "Branch_", "(_", "opt_", ",_", "pending_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Multipl", "e", "Branc", "hes", "_", "(_", "opt_", ",_", "pending_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Implicit string concatenation in a list
b3mb4m/shellsploit-framework/shell/core/SHELLoptions.py
[ { "content": "def controlset( choice, argv1=\"None\", argv2=\"None\", argv3=\"None\", argv4=\"None\"):\n\tif choice[:9] == \"backdoors\":\n\t\tif len(argv1) >= len(argv2):\n\t\t\tif len(argv1) == 0:\n\t\t\t\tpadd = 8\n\t\t\telif len(argv1) == 1:\n\t\t\t\tpadd = 8\n\t\t\telif len(argv1) == 2:\n\t\t\t\tpadd = 8\n\t\t\telse:\n\t\t\t\tpadd = len(argv1)+5\n\t\telse:\n\t\t\tpadd = len(argv2)+5\n\n\t\tprint (bcolors.GREEN+\"\"\"\n\tModule options ({0}):\n\n\t\\tName\\t\\t{1}\\tRequired\\tDescription\n\t\\t----\\t\\t{2}\\t--------\\t-----------\n\t\\tLHOST\\t\\t{3}\\t\\tyes\\t\\tConnection Host\n\t\\tLPORT\\t\\t{4}\\t\\tyes\\t\\tConnection Port\n\t\"\"\".format(choice,\"Current Setting\".ljust(padd),\"---------------\".ljust(padd),\n\t\targv1.ljust(padd),argv2.ljust(padd))) \t\t\t\n\n\n\targv3 = str(argv3)\n\t#Standalone Shellcodes\n\tlist = [\n\t\"freebsd_x64/binsh_spawn\",\n\t\"linux86/binsh_spawn\",\n\t\"linux86/bindash_spawn\",\n\t\"linux64/binsh_spawn\",\n\t\"linux/binsh_spawn\",\n\t\"osx64/binsh_spawn\",\n\t\"freebsd_x86/binsh_spawn\",\n\t\"linux_arm/binsh_spawn\",\n\t\"linux_mips/binsh_spawn\",\n\t\"solarisx86/binsh_spawn\",\n\t\"osx86/binsh_spawn\"]\n\n\t#Dependent a file \n\tlist2 = [ \n\t\"linux/read\",\n\t\"FreeBSDx86/read\",\n\t\"linux86/read\",\n\t\"solarisx86/read\",\n\t\"linux86/chmod\",\n\t\"linux64/read\",\n\t\"linux_arm/chmod\",\n\t\"linux86/mkdir\",\n\t\"linux_arm/chmod\"]\n\n\tlist3 = [\n\t\"windows/tcp_bind\",\n\t\"linux86/tcp_bind\",\n\t\"solarisx86/tcp_bind\",\n\t\"linux/tcp_bind\",\n\t\"linux64/tcp_bind\",\n\t\"osx86/tcp_bind\",\n\t\"osx64/tcp_bind\",\n\t\"freebsd_x86/tcp_bind\"]\n\n\tlist4 = [\n\t\"windows/reverse_tcp\",\n\t\"freebsd_x86/reverse_tcp\",\n\t\"freebsd_x64/reverse_tcp\",\n\t\"freebsd_x86/reverse_tcp2\",\n\t\"linux/reverse_tcp\",\n\t\"linux86/reverse_tcp\",\n\t\"linux64/reverse_tcp\",\n\t\"osx64/reverse_tcp\",\n\t\"linux_mips/reverse_tcp\",\n\t\"osx86/reverse_tcp\",\n\t\"solarisx86/reverse_tcp\",\n\t]\n\n\t#Execve\n\tlist5 = [\n\t\t\"linux_arm/exec\",\n\t\t\"freebsd_x86/exec\"\n\t\t\"linux86/exec\",\n\t\t\"windows/exec\",\n\t]\n\n\n\tif len(argv1) >= len(argv2):\n\t\tif len(argv1) == 0:\n\t\t\tpadd = 8\n\t\telif len(argv1) == 1:\n\t\t\tpadd = 8\n\t\telif len(argv1) == 2:\n\t\t\tpadd = 8\n\t\telse:\n\t\t\tpadd = len(argv1)+5\n\telse:\n\t\tpadd = len(argv2)+5\n\n\tif choice in list:\n\t\tprint (bcolors.GREEN+\"\"\"\nModule options ({0}):\n\n\\tName\\t\\t{1}\\t\\tRequired\\tDescription\n\\t----\\t\\t{2}\\t\\t--------\\t-----------\n\\tencoder\\t\\t{3}\\t\\tno\\t\\tEncoder type\t\n\\titeration\\t{4}\\t\\tno\\t\\tIteration times\n\"\"\".format(choice,\"Current Setting\".ljust(padd),\"---------------\".ljust(padd),\n\targv1.ljust(padd),argv2.ljust(padd)))\n\n\telif choice in list2:\n\t\tprint (bcolors.GREEN+\"\"\"\nModule options ({0}):\n\n\\tName\\t\\t{1}\\t\\tRequired\\tDescription\n\\t----\\t\\t{2}\\t\\t--------\\t-----------\n\\tfile\\t\\t{3}\\t\\tyes\\t\\tFile name&path\n\\tencoder\\t\\t{4}\\t\\tno\\t\\tEncoder type\t\n\\titeration\\t{5}\\t\\tno\\t\\tIteration times\n\"\"\".format(choice,\"Current Setting\".ljust(padd),\"---------------\".ljust(padd),\n\targv1.ljust(padd),argv2.ljust(padd),argv3.ljust(padd)))\n\n\telif choice in list3:\n\t\tprint (bcolors.GREEN+\"\"\"\nModule options ({0}):\n\n\\tName\\t\\t{1}\\t\\tRequired\\tDescription\n\\t----\\t\\t{2}\\t\\t--------\\t-----------\n\\tport\\t\\t{3}\\t\\tyes\\t\\tThe listen port\n\\tencoder\\t\\t{4}\\t\\tno\\t\\tEncoder type\t\n\\titeration\\t{5}\\t\\tno\\t\\tIteration times\n\"\"\".format(choice,\"Current Setting\".ljust(padd),\"---------------\".ljust(padd),\n\targv1.ljust(padd),argv2.ljust(padd),argv3.ljust(padd),argv4.ljust(padd)))\n\t\n\telif choice in list4:\n\t\tif len(argv2) >= len(argv3):\n\t\t\tif len(argv2) == 0:\n\t\t\t\tpadd = 8\n\t\t\telif len(argv2) == 1:\n\t\t\t\tpadd = 8\n\t\t\telif len(argv2) == 2:\n\t\t\t\tpadd = 8\n\t\t\telse:\n\t\t\t\tpadd = len(argv2)+5\n\t\telse:\n\t\t\tpadd = len(argv3)+5\n\n\n\t\tinfo_ = \"port\"\n\t\tinfo__ = \"host\\t\\t\"\n\t\tinfodesc_ = \"Connect PORT\"\n\t\tinfodesc__ = \"Connect HOST\" \n\n\n\t\tprint (bcolors.GREEN+\"\"\"\nModule options ({0}):\n\n\\tName\\t\\t{1}\\t\\tRequired\\tDescription\n\\t----\\t\\t{2}\\t\\t--------\\t-----------\n\\t{3}\\t\\t{4}\\t\\tyes\\t\\t{5}\n\\t{6}{7}\\t\\tyes\\t\\t{8}\n\\tencoder\\t\\t{9}\\t\\tno\\t\\tEncoder type\t\t\n\\titeration\\t{10}\\t\\tno\\t\\tIteration times\n\"\"\".format(choice,\"Current Setting\".ljust(padd),\"---------------\".ljust(padd),\n\tinfo_,argv1.ljust(padd),infodesc_,info__,argv2.ljust(padd),infodesc__,argv3.ljust(padd),argv4.ljust(padd)))\n\n\t\n\telif choice in list5:\n\t\tif len(argv3) >= len(argv2):\n\t\t\tif len(argv3) == 0:\n\t\t\t\tpadd = 8\n\t\t\telif len(argv3) == 1:\n\t\t\t\tpadd = 8\n\t\t\telif len(argv3) == 2:\n\t\t\t\tpadd = 8\n\t\t\telse:\n\t\t\t\tpadd = len(argv3)+5\n\t\telse:\n\t\t\tpadd = len(argv2)+5\n\t\t\n\t\tprint (bcolors.GREEN+\"\"\"\nModule options ({0}):\n\n\\tName\\t\\t{1}\\t\\tRequired\\tDescription\n\\t----\\t\\t{2}\\t\\t--------\\t-----------\n\\tcommand\\t\\t{3}\\t\\tyes\\t\\tCommand to execute\n\\tencoder\\t\\t{4}\\t\\tno\\t\\tEncoder type\t\n\\titeration\\t{5}\\t\\tno\\t\\tIteration times\n\"\"\".format(choice,\"Current Setting\".ljust(padd),\"---------------\".ljust(padd),\n\targv3.ljust(padd),argv2.ljust(padd),argv1.ljust(padd)))\n\n\n\telse:\n\t\tif choice == \"windows/messagebox\":\n\t\t\tprint (bcolors.GREEN+\"\"\"\n\tModule options ({0}):\n\n\t\\tName\\t\\tCurrent Setting\\t\\tRequired\\tDescription\n\t\\t----\\t\\t--------------\\t\\t--------\\t-----------\n\t\\tmessage\\t\\t{1}\\t\\t\\tyes\\t\\tFile name/path to remove\n\t\\tencoder\\t\\t{2}\\t\\t\\tno\\t\\tEncoder type\t\t\n\t\\titeration\\t{3}\\t\\t\\tno\\t\\tIteration times\n\t\"\"\".format(choice,argv1,argv2,argv3))\n\n\t\telif choice == \"windows/download&execute\":\n\t\t\tprint (bcolors.GREEN+\"\"\"\n\tModule options ({0}):\n\n\t\\tName\\t\\tCurrent Setting\\t\\tRequired\\tDescription\n\t\\t----\\t\\t--------------\\t\\t--------\\t-----------\n\t\\tlink\\t\\t{1}\\t\\t\\tyes\\t\\tSource to download exe\n\t\\tfilename\\t{2}\\t\\t\\tyes\\t\\tFile name\n\t\\tencoder\\t\\t{3}\\t\\t\\tno\\t\\tEncoder type\t\t\n\t\\titeration\\t{4}\\t\\t\\tno\\t\\tIteration times\n\t\"\"\".format(choice,argv3,argv4,argv2,argv1))\n\n\n\t\telif choice == \"linux86/download&exec\":\n\t\t\t#Temporary settings ..\n\t\t\tif len(argv1) >= len(argv2):\n\t\t\t\tif len(argv1) == 0:\n\t\t\t\t\tpadd = 8\n\t\t\t\telif len(argv1) == 1:\n\t\t\t\t\tpadd = 8\n\t\t\t\telif len(argv1) == 2:\n\t\t\t\t\tpadd = 8\n\t\t\t\telse:\n\t\t\t\t\tpadd = len(argv1)+5\n\t\t\telse:\n\t\t\t\tpadd = len(argv2)+5\n\n\t\t\tprint (bcolors.GREEN+\"\"\"\nModule options ({0}):\n\n\\tName\\t\\t{1}\\t\\tRequired\\tDescription\n\\t----\\t\\t{2}\\t\\t--------\\t-----------\n\\turl\\t\\t{3}\\t\\tyes\\t\\tFile name&path\n\\tencoder\\t\\t{4}\\t\\tno\\t\\tEncoder type\t\n\\titeration\\t{5}\\t\\tno\\t\\tIteration times\n\"\"\".format(choice,\"Current Setting\".ljust(padd),\"---------------\".ljust(padd),\n\targv1.ljust(padd),argv2.ljust(padd),argv3.ljust(padd)))\n\n\n\n\n\n\t\t#Will be change\n\t\telif choice == \"freebsd_x64/tcp_bind\":\n\t\t\tprint (bcolors.GREEN+\"\"\"\n\tModule options ({0}):\n\n\t\\tName\\t\\tCurrent Setting\\t\\tRequired\\tDescription\n\t\\t----\\t\\t--------------\\t\\t--------\\t-----------\n\t\\tpassword\\t{1}\\t\\t\\tyes\\t\\tPassword for connection\n\t\\tPORT\\t\\t{2}\\t\\t\\tyes\\t\\tPort to bind connection\n\t\\tencoder\\t\\t{3}\\t\\t\\tno\\t\\tEncoder type\t\t\n\t\\titeration\\t{4}\\t\\t\\tno\\t\\tIteration times\n\t\"\"\".format(choice,argv4,argv3,argv2,argv1))", "metadata": "root.controlset", "header": "['module', '___EOS___']", "index": 12 } ]
[ { "span": "\"freebsd_x86/exec\"\n\t\t\"linux86/exec\",", "start_line": 91, "start_column": 2, "end_line": 92, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "controls", "et_", "(_", "choice_", ",_", "argv", "1_", "=_", "\"", "Non", "e", "\"_", ",_", "argv", "2_", "=_", "\"", "Non", "e", "\"_", ",_", "argv", "3_", "=_", "\"", "Non", "e", "\"_", ",_", "argv", "4_", "=_", "\"", "Non", "e", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "choice_", "[_", ":_", "9_", "]_", "==_", "\"", "backd", "oor", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "len_", "(_", "argv", "1_", ")_", ">=_", "len_", "(_", "argv", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "len_", "(_", "argv", "1_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "1_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "1_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "1_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "2_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "\t", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";", "\t", "\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";", "\t", "\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";", "\t", "\\\\", "t", "LH", "OST", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "Connect", "ion", " ", "Host", "\\", "10", ";", "\t", "\\\\", "t", "LP", "ORT", "\\\\", "t", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "Connect", "ion", " ", "Port", "\\", "10", ";", "\t", "\"\"\"_", "._", "format_", "(_", "choice_", ",_", "\"", "Curr", "ent", " ", "Sett", "ing", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\"-------", "--------", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "argv", "1_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "2_", "._", "ljust_", "(_", "padd", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "argv", "3_", "=_", "str_", "(_", "argv", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Stand", "alo", "ne", " ", "Shel", "lco", "des_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "freeb", "sd", "\\u", "x6", "4", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "bind", "ash", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "64", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "x6", "4", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "freeb", "sd", "\\u", "x8", "6", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "\\u", "arm", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "\\u", "mips", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "solar", "is", "x8", "6", "/", "bins", "h", "\\u", "spawn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "x8", "6", "/", "bins", "h", "\\u", "spawn", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Dependent", " ", "a", " ", "file", " _", "\\u\\u\\uNL\\u\\u\\u_", "list2_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "/", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Free", "BS", "Dx", "86", "/", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "solar", "is", "x8", "6", "/", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "chm", "od", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "64", "/", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "\\u", "arm", "/", "chm", "od", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "mkd", "ir", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "\\u", "arm", "/", "chm", "od", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "3_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "windows", "/", "tcp", "\\u", "bind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "tcp", "\\u", "bind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "solar", "is", "x8", "6", "/", "tcp", "\\u", "bind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "/", "tcp", "\\u", "bind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "64", "/", "tcp", "\\u", "bind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "x8", "6", "/", "tcp", "\\u", "bind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "x6", "4", "/", "tcp", "\\u", "bind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "freeb", "sd", "\\u", "x8", "6", "/", "tcp", "\\u", "bind", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "4_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "windows", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "freeb", "sd", "\\u", "x8", "6", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "freeb", "sd", "\\u", "x6", "4", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "freeb", "sd", "\\u", "x8", "6", "/", "reverse", "\\u", "tcp", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "64", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "x6", "4", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "\\u", "mips", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "x8", "6", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "solar", "is", "x8", "6", "/", "reverse", "\\u", "tcp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Exe", "cve", "_", "\\u\\u\\uNL\\u\\u\\u_", "list", "5_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "\\u", "arm", "/", "exec", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "freeb", "sd", "\\u", "x8", "6", "/", "exec", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "linux", "86", "/", "exec", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "windows", "/", "exec", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "argv", "1_", ")_", ">=_", "len_", "(_", "argv", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "len_", "(_", "argv", "1_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "1_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "1_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "1_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "padd", "_", "=_", "len_", "(_", "argv", "2_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice_", "in_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\\", "10", ";\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "choice_", ",_", "\"", "Curr", "ent", " ", "Sett", "ing", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\"-------", "--------", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "argv", "1_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "2_", "._", "ljust_", "(_", "padd", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "in_", "list2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";\\\\", "tfi", "le", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "File", " ", "name", "&", "path", "\\", "10", ";\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\\", "10", ";\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "5", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "choice_", ",_", "\"", "Curr", "ent", " ", "Sett", "ing", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\"-------", "--------", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "argv", "1_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "2_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "3_", "._", "ljust_", "(_", "padd", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "in_", "list", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";\\\\", "tpo", "rt", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "The", " ", "listen", " ", "port", "\\", "10", ";\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\\", "10", ";\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "5", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "choice_", ",_", "\"", "Curr", "ent", " ", "Sett", "ing", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\"-------", "--------", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "argv", "1_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "2_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "3_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "4_", "._", "ljust_", "(_", "padd", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "in_", "list", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "len_", "(_", "argv", "2_", ")_", ">=_", "len_", "(_", "argv", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "len_", "(_", "argv", "2_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "2_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "2_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "2_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "3_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u_", "=_", "\"", "port", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u\\u_", "=_", "\"", "host", "\\\\", "t", "\\\\", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "desc", "\\u_", "=_", "\"", "Connect", " ", "PORT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "desc", "\\u\\u_", "=_", "\"", "Connect", " ", "HOST", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "{", "5", "}", "\\", "10", ";\\\\", "t", "{", "6", "}{", "7", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "{", "8", "}", "\\", "10", ";\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "9", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\t", "\\", "10", ";\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "10", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "choice_", ",_", "\"", "Curr", "ent", " ", "Sett", "ing", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\"-------", "--------", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u_", ",_", "argv", "1_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "info", "desc", "\\u_", ",_", "info", "\\u\\u_", ",_", "argv", "2_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "info", "desc", "\\u\\u_", ",_", "argv", "3_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "4_", "._", "ljust_", "(_", "padd", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "in_", "list", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "len_", "(_", "argv", "3_", ")_", ">=_", "len_", "(_", "argv", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "len_", "(_", "argv", "3_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "3_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "3_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "3_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "2_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";\\\\", "tco", "mmand", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "Command", " ", "to", " ", "execute", "\\", "10", ";\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\\", "10", ";\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "5", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "choice_", ",_", "\"", "Curr", "ent", " ", "Sett", "ing", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\"-------", "--------", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "argv", "3_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "2_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "1_", "._", "ljust_", "(_", "padd", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "choice_", "==_", "\"", "windows", "/", "message", "box", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "\t", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";", "\t", "\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "Curr", "ent", " ", "Sett", "ing", "\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";", "\t", "\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "--------------", "\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";", "\t", "\\\\", "tme", "ssa", "ge", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "File", " ", "name", "/", "path", " ", "to", " ", "remove", "\\", "10", ";", "\t", "\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\t", "\\", "10", ";", "\t", "\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";", "\t", "\"\"\"_", "._", "format_", "(_", "choice_", ",_", "argv", "1_", ",_", "argv", "2_", ",_", "argv", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "windows", "/", "download", "&", "execute", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "\t", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";", "\t", "\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "Curr", "ent", " ", "Sett", "ing", "\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";", "\t", "\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "--------------", "\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";", "\t", "\\\\", "tli", "nk", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "Sou", "rce", " ", "to", " ", "download", " ", "exe", "\\", "10", ";", "\t", "\\\\", "tfi", "lename", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "File", " ", "name", "\\", "10", ";", "\t", "\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\t", "\\", "10", ";", "\t", "\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";", "\t", "\"\"\"_", "._", "format_", "(_", "choice_", ",_", "argv", "3_", ",_", "argv", "4_", ",_", "argv", "2_", ",_", "argv", "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_", "elif_", "choice_", "==_", "\"", "linux", "86", "/", "download", "&", "exec", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Tempora", "ry", " ", "settings", " ", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "len_", "(_", "argv", "1_", ")_", ">=_", "len_", "(_", "argv", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "len_", "(_", "argv", "1_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "1_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "argv", "1_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "padd", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "1_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "padd", "_", "=_", "len_", "(_", "argv", "2_", ")_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";\\\\", "tur", "l", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "File", " ", "name", "&", "path", "\\", "10", ";\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\\", "10", ";\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "5", "}\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "choice_", ",_", "\"", "Curr", "ent", " ", "Sett", "ing", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\"-------", "--------", "\"_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "argv", "1_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "2_", "._", "ljust_", "(_", "padd", "_", ")_", ",_", "argv", "3_", "._", "ljust_", "(_", "padd", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Wil", "l", " ", "be", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "freeb", "sd", "\\u", "x6", "4", "/", "tcp", "\\u", "bind", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "bcolors_", "._", "GREEN_", "+_", "\"\"\"", "\\", "10", ";", "\t", "Modul", "e", " ", "options", " ", "({", "0", "}):", "\\", "10", ";", "\\", "10", ";", "\t", "\\\\", "t", "Name", "\\\\", "t", "\\\\", "t", "Curr", "ent", " ", "Sett", "ing", "\\\\", "t", "\\\\", "t", "Requ", "ired", "\\\\", "t", "Descripti", "on", "\\", "10", ";", "\t", "\\\\", "t", "----", "\\\\", "t", "\\\\", "t", "--------------", "\\\\", "t", "\\\\", "t", "--------", "\\\\", "t", "-----------", "\\", "10", ";", "\t", "\\\\", "tpa", "ssword", "\\\\", "t", "{", "1", "}\\\\", "t", "\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "Passw", "ord", " ", "for", " ", "connecti", "on", "\\", "10", ";", "\t", "\\\\", "t", "PORT", "\\\\", "t", "\\\\", "t", "{", "2", "}\\\\", "t", "\\\\", "t", "\\\\", "ty", "es", "\\\\", "t", "\\\\", "t", "Port", " ", "to", " ", "bind", " ", "connecti", "on", "\\", "10", ";", "\t", "\\\\", "ten", "coder", "\\\\", "t", "\\\\", "t", "{", "3", "}\\\\", "t", "\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Encode", "r", " ", "type", "\t", "\t", "\\", "10", ";", "\t", "\\\\", "tit", "eratio", "n", "\\\\", "t", "{", "4", "}\\\\", "t", "\\\\", "t", "\\\\", "tno", "\\\\", "t", "\\\\", "t", "Iterat", "ion", " ", "times", "\\", "10", ";", "\t", "\"\"\"_", "._", "format_", "(_", "choice_", ",_", "argv", "4_", ",_", "argv", "3_", ",_", "argv", "2_", ",_", "argv", "1_", ")_", ")_" ]
[ 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,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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 ]
Unused local variable
chriskiehl/pyrobot/pyrobot.py
[ { "content": " def add_to_clipboard(self, string):\n '''\n Copy text into clip board for later pasting.\n '''\n # This is more or less ripped right for MSDN.\n GHND = 0x0042\n # Allocate at\n hGlobalMemory = kernel32.GlobalAlloc(GHND, len(bytes(string))+1)\n # Lock it\n lpGlobalMemory = kernel32.GlobalLock(hGlobalMemory)\n # copy it\n lpGlobalMemory = kernel32.lstrcpy(lpGlobalMemory, string)\n # unlock it\n kernel32.GlobalUnlock(lpGlobalMemory)\n # open it\n user32.OpenClipboard(None)\n # empty it\n user32.EmptyClipboard()\n # add it\n hClipMemory = user32.SetClipboardData(1, hGlobalMemory) # 1 = CF_TEXT\n # close it\n user32.CloseClipboard()\n # Technologic", "metadata": "root.Robot.add_to_clipboard", "header": "['class', 'Robot', '(', 'object', ')', ':', '___EOS___']", "index": 489 }, { "content": " def _get_screen_buffer(self, bounds=None):\n # Grabs a DC to the entire virtual screen, but only copies to\n # the bitmap the the rect defined by the user.\n\n SM_XVIRTUALSCREEN = 76 # coordinates for the left side of the virtual screen.\n SM_YVIRTUALSCREEN = 77 # coordinates for the right side of the virtual screen.\n SM_CXVIRTUALSCREEN = 78 # width of the virtual screen\n SM_CYVIRTUALSCREEN = 79 # height of the virtual screen\n\n hDesktopWnd = user32.GetDesktopWindow() #Entire virtual Screen\n\n left = user32.GetSystemMetrics(SM_XVIRTUALSCREEN)\n top = user32.GetSystemMetrics(SM_YVIRTUALSCREEN)\n width = user32.GetSystemMetrics(SM_CXVIRTUALSCREEN)\n height = user32.GetSystemMetrics(SM_CYVIRTUALSCREEN)\n\n if bounds:\n left, top, right, bottom = bounds\n width = right - left\n height = bottom - top\n\n hDesktopDC = user32.GetWindowDC(hDesktopWnd)\n if not hDesktopDC: print('GetDC Failed'); sys.exit()\n\n hCaptureDC = gdi.CreateCompatibleDC(hDesktopDC)\n if not hCaptureDC: print('CreateCompatibleBitmap Failed'); sys.exit()\n\n hCaptureBitmap = gdi.CreateCompatibleBitmap(hDesktopDC, width, height)\n if not hCaptureBitmap: print('CreateCompatibleBitmap Failed'); sys.exit()\n\n gdi.SelectObject(hCaptureDC, hCaptureBitmap)\n\n SRCCOPY = 0x00CC0020\n gdi.BitBlt(\n hCaptureDC,\n 0, 0,\n width, height,\n hDesktopDC,\n left, top,\n 0x00CC0020\n )\n return hCaptureBitmap", "metadata": "root.Robot._get_screen_buffer", "header": "['class', 'Robot', '(', 'object', ')', ':', '___EOS___']", "index": 544 }, { "content": " def _make_image_from_buffer(self, hCaptureBitmap):\n from PIL import Image\n bmp_info = BITMAPINFO()\n bmp_header = BITMAPFILEHEADER()\n hdc = user32.GetDC(None)\n\n bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER)\n\n DIB_RGB_COLORS = 0\n gdi.GetDIBits(hdc,\n hCaptureBitmap,\n 0,0,\n None, byref(bmp_info),\n DIB_RGB_COLORS\n )\n\n bmp_info.bmiHeader.biSizeImage = int(bmp_info.bmiHeader.biWidth *abs(bmp_info.bmiHeader.biHeight) * (bmp_info.bmiHeader.biBitCount+7)/8);\n size = (bmp_info.bmiHeader.biWidth, bmp_info.bmiHeader.biHeight )\n # print(size)\n pBuf = (c_char * bmp_info.bmiHeader.biSizeImage)()\n\n gdi.GetBitmapBits(hCaptureBitmap, bmp_info.bmiHeader.biSizeImage, pBuf)\n\n return Image.frombuffer('RGB', size, pBuf, 'raw', 'BGRX', 0, 1)", "metadata": "root.Robot._make_image_from_buffer", "header": "['class', 'Robot', '(', 'object', ')', ':', '___EOS___']", "index": 587 }, { "content": " def _key_control(self, key, action):\n ip = INPUT()\n\n INPUT_KEYBOARD = 0x00000001\n ip.type = INPUT_KEYBOARD\n ip.ki.wScan = 0\n ip.ki.time = 0\n a = user32.GetMessageExtraInfo()\n b = cast(a, POINTER(c_ulong))\n # ip.ki.dwExtraInfo\n\n ip.ki.wVk = key\n ip.ki.dwFlags = action\n user32.SendInput(1, byref(ip), sizeof(INPUT))", "metadata": "root.Robot._key_control", "header": "['class', 'Robot', '(', 'object', ')', ':', '___EOS___']", "index": 639 }, { "content": " def start_program(self, full_path):\n '''\n Starts a windows applications. Currently, you must pass in\n the full path to the exe, otherwise it will fail.\n\n TODO:\n * return Handle to started program.\n * Search on program name\n '''\n\n class STARTUPINFO(ctypes.Structure):\n _fields_ = [\n ('cb', c_ulong),\n ('lpReserved', POINTER(c_char)),\n ('lpDesktop', POINTER(c_char)),\n ('lpTitle', POINTER(c_char)),\n ('dwX', c_ulong),\n ('dwY', c_ulong),\n ('dwXSize', c_ulong),\n ('dwYSize', c_ulong),\n ('dwXCountChars', c_ulong),\n ('dwYCountChars', c_ulong),\n ('dwFillAttribute', c_ulong),\n ('dwFlags', c_ulong),\n ('wShowWindow', c_ushort),\n ('cbReserved2', c_ushort),\n ('lpReserved2', POINTER(c_ubyte)),\n ('hStdInput', c_void_p),\n ('hStdOutput', c_void_p),\n ('hStdError', c_void_p)\n ]\n class PROCESS_INFORMATION(ctypes.Structure):\n _fields_ = [\n ('hProcess', c_void_p),\n ('hThread', c_void_p),\n ('dwProcessId', c_ulong),\n ('dwThreadId', c_ulong),\n ]\n NORMAL_PRIORITY_CLASS = 0x00000020\n\n startupinfo = STARTUPINFO()\n processInformation = PROCESS_INFORMATION()\n\n kernel32.CreateProcessA(\n full_path,\n None,\n None,\n None,\n True,\n 0,\n None,\n None,\n byref(startupinfo),\n byref(processInformation)\n )", "metadata": "root.Robot.start_program", "header": "['class', 'Robot', '(', 'object', ')', ':', '___EOS___']", "index": 725 } ]
[ { "span": "hClipMemory ", "start_line": 508, "start_column": 4, "end_line": 508, "end_column": 15 }, { "span": "SRCCOPY ", "start_line": 576, "start_column": 4, "end_line": 576, "end_column": 11 }, { "span": "bmp_header ", "start_line": 590, "start_column": 4, "end_line": 590, "end_column": 14 }, { "span": "b ", "start_line": 647, "start_column": 4, "end_line": 647, "end_column": 5 }, { "span": "NORMAL_PRIORITY_CLASS ", "start_line": 763, "start_column": 4, "end_line": 763, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Robot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "to", "\\u", "clipboard_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Copy", " ", "text", " ", "int", "o", " ", "clip", " ", "board", " ", "for", " ", "late", "r", " ", "past", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "more", " ", "or", " ", "less", " ", "rip", "ped", " ", "right", " ", "for", " ", "MS", "DN", "._", "\\u\\u\\uNL\\u\\u\\u_", "GH", "ND_", "=_", "0x004", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Allocate", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Global", "Memory_", "=_", "kernel32_", "._", "Global", "Alloc", "_", "(_", "GH", "ND_", ",_", "len_", "(_", "bytes_", "(_", "string_", ")_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Lock", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "lp", "Global", "Memory_", "=_", "kernel32_", "._", "Global", "Lock_", "(_", "h", "Global", "Memory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "copy", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "lp", "Global", "Memory_", "=_", "kernel32_", "._", "lst", "rcp", "y_", "(_", "lp", "Global", "Memory_", ",_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unlock", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "kernel32_", "._", "Global", "Unlock", "_", "(_", "lp", "Global", "Memory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "open", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "user3", "2_", "._", "Open", "Clipboard", "_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "empty", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "user3", "2_", "._", "Emp", "ty", "Clipboard", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Clip", "Memory_", "=_", "user3", "2_", "._", "Set", "Clipboard", "Data_", "(_", "1_", ",_", "h", "Global", "Memory_", ")_", "#", " ", "1", " ", "=", " ", "CF", "\\u", "TEXT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "user3", "2_", "._", "Clos", "e", "Clipboard", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Techno", "logic_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Robot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "screen", "\\u", "buffer_", "(_", "self_", ",_", "bounds_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Grab", "s", " ", "a", " ", "DC", " ", "to", " ", "the", " ", "entire", " ", "virtual", " ", "screen", ",", " ", "but", " ", "only", " ", "copie", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "bitmap", " ", "the", " ", "the", " ", "rect", " ", "defin", "ed", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SM", "\\u", "XV", "IR", "TU", "ALS", "CRE", "EN_", "=_", "76_", "#", " ", "coordinate", "s", " ", "for", " ", "the", " ", "left", " ", "side", " ", "of", " ", "the", " ", "virtual", " ", "screen", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SM", "\\u", "YV", "IR", "TU", "ALS", "CRE", "EN_", "=_", "77_", "#", " ", "coordinate", "s", " ", "for", " ", "the", " ", "right", " ", "side", " ", "of", " ", "the", " ", "virtual", " ", "screen", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SM", "\\u", "CX", "VIRTUAL", "SCREEN", "_", "=_", "78_", "#", " ", "widt", "h", " ", "of", " ", "the", " ", "virtual", " ", "screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SM", "\\u", "CY", "VIRTUAL", "SCREEN", "_", "=_", "79_", "#", " ", "height", " ", "of", " ", "the", " ", "virtual", " ", "screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Des", "kto", "p", "Wn", "d_", "=_", "user3", "2_", "._", "Get", "Des", "kto", "p", "Window_", "(_", ")_", "#", "Ent", "ire", " ", "virtual", " ", "Screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "left_", "=_", "user3", "2_", "._", "Get", "System", "Metrics_", "(_", "SM", "\\u", "XV", "IR", "TU", "ALS", "CRE", "EN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "=_", "user3", "2_", "._", "Get", "System", "Metrics_", "(_", "SM", "\\u", "YV", "IR", "TU", "ALS", "CRE", "EN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "user3", "2_", "._", "Get", "System", "Metrics_", "(_", "SM", "\\u", "CX", "VIRTUAL", "SCREEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "user3", "2_", "._", "Get", "System", "Metrics_", "(_", "SM", "\\u", "CY", "VIRTUAL", "SCREEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bounds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", ",_", "top_", ",_", "right_", ",_", "bottom_", "=_", "bounds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "right_", "-_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "bottom_", "-_", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h", "Des", "kto", "p", "DC_", "=_", "user3", "2_", "._", "Get", "Window", "DC_", "(_", "h", "Des", "kto", "p", "Wn", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "h", "Des", "kto", "p", "DC_", ":_", "print_", "(_", "'", "Get", "DC", " ", "Fail", "ed", "'_", ")_", ";_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Captur", "e", "DC_", "=_", "gdi", "_", "._", "Creat", "e", "Compatible", "DC_", "(_", "h", "Des", "kto", "p", "DC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "h", "Captur", "e", "DC_", ":_", "print_", "(_", "'", "Creat", "e", "Compatible", "Bit", "map", " ", "Fail", "ed", "'_", ")_", ";_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Captur", "e", "Bitmap_", "=_", "gdi", "_", "._", "Creat", "e", "Compatible", "Bitmap_", "(_", "h", "Des", "kto", "p", "DC_", ",_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "h", "Captur", "e", "Bitmap_", ":_", "print_", "(_", "'", "Creat", "e", "Compatible", "Bit", "map", " ", "Fail", "ed", "'_", ")_", ";_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gdi", "_", "._", "Select", "Object_", "(_", "h", "Captur", "e", "DC_", ",_", "h", "Captur", "e", "Bitmap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SR", "CC", "OP", "Y_", "=_", "0x00", "CC", "0020", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gdi", "_", "._", "Bit", "Bl", "t_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Captur", "e", "DC_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "width_", ",_", "height_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Des", "kto", "p", "DC_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "left_", ",_", "top_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0x00", "CC", "0020", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "h", "Captur", "e", "Bitmap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Robot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "image", "\\u", "from", "\\u", "buffer_", "(_", "self_", ",_", "h", "Captur", "e", "Bitmap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm", "p", "\\u", "info_", "=_", "BITMAP", "INFO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm", "p", "\\u", "header_", "=_", "BITMAP", "FILE", "HEADER_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "c_", "=_", "user3", "2_", "._", "Get", "DC_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Size_", "=_", "sizeof_", "(_", "BITMAP", "INFO", "HEADER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DI", "B", "\\u", "RGB", "\\u", "COLORS_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gdi", "_", "._", "Get", "DI", "Bits_", "(_", "hd", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Captur", "e", "Bitmap_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "byref_", "(_", "bm", "p", "\\u", "info_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DI", "B", "\\u", "RGB", "\\u", "COLORS_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Size", "Image_", "=_", "int_", "(_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Width_", "*_", "abs_", "(_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Height_", ")_", "*_", "(_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Bit", "Count_", "+_", "7_", ")_", "/_", "8_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "(_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Width_", ",_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(", "size", ")_", "\\u\\u\\uNL\\u\\u\\u_", "p", "Buf_", "=_", "(_", "c\\u", "char_", "*_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Size", "Image_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gdi", "_", "._", "Get", "Bit", "map", "Bits_", "(_", "h", "Captur", "e", "Bitmap_", ",_", "bm", "p", "\\u", "info_", "._", "bmi", "Header_", "._", "bi", "Size", "Image_", ",_", "p", "Buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Image_", "._", "from", "buffer_", "(_", "'", "RGB", "'_", ",_", "size_", ",_", "p", "Buf_", ",_", "'", "raw", "'_", ",_", "'", "BG", "RX", "'_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Robot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "key", "\\u", "control_", "(_", "self_", ",_", "key_", ",_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip_", "=_", "INPUT_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INPUT", "\\u", "KEYB", "OARD", "_", "=_", "0x0000000", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "type_", "=_", "INPUT", "\\u", "KEYB", "OARD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "ki_", "._", "w", "Scan_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "ki_", "._", "time_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "user3", "2_", "._", "Get", "Messag", "e", "Extra", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "cast_", "(_", "a_", ",_", "POINTER_", "(_", "c\\u", "ulong_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ip", ".", "ki", ".", "dw", "Extra", "Info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "ki_", "._", "w", "V", "k_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "ki_", "._", "dw", "Flags_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user3", "2_", "._", "Sen", "d", "Input_", "(_", "1_", ",_", "byref_", "(_", "ip_", ")_", ",_", "sizeof_", "(_", "INPUT_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Robot_", "(_", "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_", "start", "\\u", "program_", "(_", "self_", ",_", "full", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Start", "s", " ", "a", " ", "windows", " ", "applica", "tion", "s", ".", " ", "Curr", "ent", "ly", ",", " ", "you", " ", "must", " ", "pass", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "full", " ", "path", " ", "to", " ", "the", " ", "exe", ",", " ", "other", "wis", "e", " ", "it", " ", "will", " ", "fail", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", ":", "\\", "10", ";", " ", " ", "*", " ", "return", " ", "Handle", " ", "to", " ", "start", "ed", " ", "program", ".", "\\", "10", ";", " ", " ", "*", " ", "Sear", "ch", " ", "on", " ", "program", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "START", "UP", "INFO_", "(_", "ctypes_", "._", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "cb", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lp", "Reserve", "d", "'_", ",_", "POINTER_", "(_", "c\\u", "char_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lp", "Des", "kto", "p", "'_", ",_", "POINTER_", "(_", "c\\u", "char_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lp", "Tit", "le", "'_", ",_", "POINTER_", "(_", "c\\u", "char_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "X", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "Y", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "XS", "ize", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "YS", "ize", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "XC", "ount", "Char", "s", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "YC", "ount", "Char", "s", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "Fil", "l", "Attribute", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "Fla", "gs", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "w", "Show", "Window", "'_", ",_", "c\\u", "ushort", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "cb", "Reserve", "d2", "'_", ",_", "c\\u", "ushort", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lp", "Reserve", "d2", "'_", ",_", "POINTER_", "(_", "c\\u", "ubyte_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "h", "Std", "Inp", "ut", "'_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "h", "Std", "Output", "'_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "h", "Std", "Error", "'_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "PROCESS", "\\u", "INFORMATION", "_", "(_", "ctypes_", "._", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "h", "Process", "'_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "h", "Thread", "'_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "Process", "Id", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dw", "Thread", "Id", "'_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NORMA", "L", "\\u", "PRIORITY", "\\u", "CLASS_", "=_", "0x000000", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "upi", "nfo_", "=_", "START", "UP", "INFO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Information_", "=_", "PROCESS", "\\u", "INFORMATION", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kernel32_", "._", "Creat", "e", "Process", "A_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "\\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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
jimklo/LRSignature/src/LRSignature/tests/utils.py
[ { "content": " def tearDown(self):\n self.rm_rf(self.gnupghome)\n pass", "metadata": "root.Test.tearDown", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 104 } ]
[ { "span": "pass", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rm", "\\u", "rf_", "(_", "self_", "._", "gnup", "gh", "ome_", ")_", "\\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, 0, 2 ]
Imprecise assert
letsencrypt/letsencrypt/acme/acme/jose/interfaces_test.py
[ { "content": " def test_to_json_other(self):\n mock_value = object()\n self.assertTrue(self.Basic(mock_value).to_json() is mock_value)", "metadata": "root.JSONDeSerializableTest.test_to_json_other", "header": "['class', 'JSONDeSerializableTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# pylint: disable=too-many-instance-attributes', '___NL___', '___EOS___']", "index": 66 }, { "content": " def test_json_dump_default(self):\n from acme.jose.interfaces import JSONDeSerializable\n\n self.assertEqual(\n 'foo1', JSONDeSerializable.json_dump_default(self.basic1))\n\n jobj = JSONDeSerializable.json_dump_default(self.seq)\n self.assertEqual(len(jobj), 2)\n self.assertTrue(jobj[0] is self.basic1)\n self.assertTrue(jobj[1] is self.basic2)", "metadata": "root.JSONDeSerializableTest.test_json_dump_default", "header": "['class', 'JSONDeSerializableTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# pylint: disable=too-many-instance-attributes', '___NL___', '___EOS___']", "index": 95 } ]
[ { "span": "self.assertTrue(self.Basic(mock_value).to_json() is mock_value)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 71 }, { "span": "self.assertTrue(jobj[0] is self.basic1)", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 47 }, { "span": "self.assertTrue(jobj[1] is self.basic2)", "start_line": 104, "start_column": 8, "end_line": 104, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "JSO", "ND", "e", "Serializa", "ble", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "too", "-", "many", "-", "instance", "-", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "to", "\\u", "json", "\\u", "other_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "value_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "Basic_", "(_", "mock", "\\u", "value_", ")_", "._", "to", "\\u", "json_", "(_", ")_", "is_", "mock", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSO", "ND", "e", "Serializa", "ble", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "too", "-", "many", "-", "instance", "-", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "json", "\\u", "dump", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "acm", "e_", "._", "jos", "e_", "._", "interfaces_", "import_", "JSO", "ND", "e", "Serializa", "ble_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "1", "'_", ",_", "JSO", "ND", "e", "Serializa", "ble_", "._", "json", "\\u", "dump", "\\u", "default_", "(_", "self_", "._", "basic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job", "j_", "=_", "JSO", "ND", "e", "Serializa", "ble_", "._", "json", "\\u", "dump", "\\u", "default_", "(_", "self_", "._", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "job", "j_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "job", "j_", "[_", "0_", "]_", "is_", "self_", "._", "basic", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "job", "j_", "[_", "1_", "]_", "is_", "self_", "._", "basic", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Imprecise assert
datastax/python-driver/tests/unit/test_orderedmap.py
[ { "content": " def test_contains(self):\n keys = ['first', 'middle', 'last']\n\n om = OrderedMap()\n\n om = OrderedMap(zip(keys, range(len(keys))))\n\n for k in keys:\n self.assertTrue(k in om)\n self.assertFalse(k not in om)\n\n self.assertTrue('notthere' not in om)\n self.assertFalse('notthere' in om)", "metadata": "root.OrderedMapTest.test_contains", "header": "['class', 'OrderedMapTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_equal(self):\n d1 = {'one': 1}\n d12 = {'one': 1, 'two': 2}\n om1 = OrderedMap({'one': 1})\n om12 = OrderedMap([('one', 1), ('two', 2)])\n om21 = OrderedMap([('two', 2), ('one', 1)])\n\n self.assertEqual(om1, d1)\n self.assertEqual(om12, d12)\n self.assertEqual(om21, d12)\n self.assertNotEqual(om1, om12)\n self.assertNotEqual(om12, om1)\n self.assertNotEqual(om12, om21)\n self.assertNotEqual(om1, d12)\n self.assertNotEqual(om12, d1)\n self.assertNotEqual(om1, EMPTY)\n\n self.assertFalse(OrderedMap([('three', 3), ('four', 4)]) == d12)", "metadata": "root.OrderedMapTest.test_equal", "header": "['class', 'OrderedMapTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 86 } ]
[ { "span": "self.assertTrue(k in om)", "start_line": 50, "start_column": 12, "end_line": 50, "end_column": 36 }, { "span": "self.assertFalse(k not in om)", "start_line": 51, "start_column": 12, "end_line": 51, "end_column": 41 }, { "span": "self.assertTrue('notthere' not in om)", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 45 }, { "span": "self.assertFalse('notthere' in om)", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 42 }, { "span": "self.assertFalse(OrderedMap([('three', 3), ('four', 4)]) == d12)", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 72 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Order", "ed", "Map", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "contains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "[_", "'", "first", "'_", ",_", "'", "middle", "'_", ",_", "'", "last", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "om_", "=_", "Order", "ed", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "om_", "=_", "Order", "ed", "Map_", "(_", "zip_", "(_", "keys_", ",_", "range_", "(_", "len_", "(_", "keys_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "k_", "in_", "om_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "k_", "not_", "in_", "om_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "not", "there", "'_", "not_", "in_", "om_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "not", "there", "'_", "in_", "om_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "ed", "Map", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "equal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d1_", "=_", "{_", "'", "one", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1", "2_", "=_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om", "1_", "=_", "Order", "ed", "Map_", "(_", "{_", "'", "one", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om", "12_", "=_", "Order", "ed", "Map_", "(_", "[_", "(_", "'", "one", "'_", ",_", "1_", ")_", ",_", "(_", "'", "two", "'_", ",_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om", "21_", "=_", "Order", "ed", "Map_", "(_", "[_", "(_", "'", "two", "'_", ",_", "2_", ")_", ",_", "(_", "'", "one", "'_", ",_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "om", "1_", ",_", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "om", "12_", ",_", "d1", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "om", "21_", ",_", "d1", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "om", "1_", ",_", "om", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "om", "12_", ",_", "om", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "om", "12_", ",_", "om", "21_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "om", "1_", ",_", "d1", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "om", "12_", ",_", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "om", "1_", ",_", "EMPTY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "Order", "ed", "Map_", "(_", "[_", "(_", "'", "three", "'_", ",_", "3_", ")_", ",_", "(_", "'", "four", "'_", ",_", "4_", ")_", "]_", ")_", "==_", "d1", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Testing equality to None
dkotfis/NeuRL/src/qnn.py
[ { "content": " def __call__(self,s,a=None):\n \"\"\" implement here the returned Qvalue of state (s) and action(a)\n e.g. Q.GetValue(s,a) is equivalent to Q(s,a)\n \"\"\"\n if a==None:\n return self.GetValue(s)\n return self.GetValue(s,a)", "metadata": "root.QNN.__call__", "header": "['class', 'QNN', '(', ')', ':', '___EOS___']", "index": 27 }, { "content": " def GetValue(self, s, a=None):\n \"\"\" Return the Q(s,a) value of state (s) for action (a)\n or all values for Q(s)\n \"\"\"\n out = self.NN.propagate(s)\n if (a==None):\n return out\n return out[a]", "metadata": "root.QNN.GetValue", "header": "['class', 'QNN', '(', ')', ':', '___EOS___']", "index": 47 } ]
[ { "span": "a==None:", "start_line": 31, "start_column": 11, "end_line": 31, "end_column": 18 }, { "span": "a==None)", "start_line": 52, "start_column": 12, "end_line": 52, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "QN", "N_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "s_", ",_", "a_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "implement", " ", "here", " ", "the", " ", "return", "ed", " ", "Qv", "alu", "e", " ", "of", " ", "state", " ", "(", "s", ")", " ", "and", " ", "action", "(", "a", ")", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "Q", ".", "Get", "Value", "(", "s", ",", "a", ")", " ", "is", " ", "equivalent", " ", "to", " ", "Q", "(", "s", ",", "a", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "Get", "Value_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "Get", "Value_", "(_", "s_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QN", "N_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Value_", "(_", "self_", ",_", "s_", ",_", "a_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "Q", "(", "s", ",", "a", ")", " ", "value", " ", "of", " ", "state", " ", "(", "s", ")", " ", "for", " ", "action", " ", "(", "a", ")", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "all", " ", "values", " ", "for", " ", "Q", "(", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "self_", "._", "NN_", "._", "propagate_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "a_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "[_", "a_", "]_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Newmu/dcgan_code/mnist/load.py
[ { "content": "import sys\nsys.path.append('..')\n\nimport numpy as np\nimport os\nfrom time import time\nfrom collections import Counter\nimport random\nfrom matplotlib import pyplot as plt\n\nfrom lib.data_utils import shuffle\nfrom lib.config import data_dir\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def mnist():\n fd = open(os.path.join(data_dir,'train-images.idx3-ubyte'))\n loaded = np.fromfile(file=fd,dtype=np.uint8)\n trX = loaded[16:].reshape((60000,28*28)).astype(float)\n\n fd = open(os.path.join(data_dir,'train-labels.idx1-ubyte'))\n loaded = np.fromfile(file=fd,dtype=np.uint8)\n trY = loaded[8:].reshape((60000))\n\n fd = open(os.path.join(data_dir,'t10k-images.idx3-ubyte'))\n loaded = np.fromfile(file=fd,dtype=np.uint8)\n teX = loaded[16:].reshape((10000,28*28)).astype(float)\n\n fd = open(os.path.join(data_dir,'t10k-labels.idx1-ubyte'))\n loaded = np.fromfile(file=fd,dtype=np.uint8)\n teY = loaded[8:].reshape((10000))\n \n trY = np.asarray(trY)\n teY = np.asarray(teY)\n\n return trX, teX, trY, teY", "metadata": "root.mnist", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def mnist_with_valid_set():\n trX, teX, trY, teY = mnist()\n\n trX, trY = shuffle(trX, trY)\n vaX = trX[50000:]\n vaY = trY[50000:]\n trX = trX[:50000]\n trY = trY[:50000]\n\n return trX, vaX, teX, trY, vaY, teY", "metadata": "root.mnist_with_valid_set", "header": "['module', '___EOS___']", "index": 35 } ]
[ { "span": "from time import time", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 21 }, { "span": "from collections import Counter", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 31 }, { "span": "import random", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 13 }, { "span": "from matplotlib import pyplot as plt", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "'..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "import_", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lib_", "._", "data\\u", "utils_", "import_", "shuffle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lib_", "._", "config_", "import_", "data\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mnist_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "data\\u", "dir_", ",_", "'", "train", "-", "images", ".", "idx", "3", "-", "ub", "yte", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loaded_", "=_", "np_", "._", "fromfile_", "(_", "file_", "=_", "fd_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "X_", "=_", "loaded_", "[_", "16_", ":_", "]_", "._", "reshape_", "(_", "(_", "60000", "_", ",_", "28_", "*_", "28_", ")_", ")_", "._", "astype_", "(_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fd_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "data\\u", "dir_", ",_", "'", "train", "-", "labels", ".", "idx", "1", "-", "ub", "yte", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loaded_", "=_", "np_", "._", "fromfile_", "(_", "file_", "=_", "fd_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "Y_", "=_", "loaded_", "[_", "8_", ":_", "]_", "._", "reshape_", "(_", "(_", "60000", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fd_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "data\\u", "dir_", ",_", "'", "t1", "0", "k", "-", "images", ".", "idx", "3", "-", "ub", "yte", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loaded_", "=_", "np_", "._", "fromfile_", "(_", "file_", "=_", "fd_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "te", "X_", "=_", "loaded_", "[_", "16_", ":_", "]_", "._", "reshape_", "(_", "(_", "10000_", ",_", "28_", "*_", "28_", ")_", ")_", "._", "astype_", "(_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fd_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "data\\u", "dir_", ",_", "'", "t1", "0", "k", "-", "labels", ".", "idx", "1", "-", "ub", "yte", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loaded_", "=_", "np_", "._", "fromfile_", "(_", "file_", "=_", "fd_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "te", "Y_", "=_", "loaded_", "[_", "8_", ":_", "]_", "._", "reshape_", "(_", "(_", "10000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tr", "Y_", "=_", "np_", "._", "asarray_", "(_", "tr", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "te", "Y_", "=_", "np_", "._", "asarray_", "(_", "te", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tr", "X_", ",_", "te", "X_", ",_", "tr", "Y_", ",_", "te", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mni", "st", "\\u", "with", "\\u", "valid", "\\u", "set_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr", "X_", ",_", "te", "X_", ",_", "tr", "Y_", ",_", "te", "Y_", "=_", "mnist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tr", "X_", ",_", "tr", "Y_", "=_", "shuffle_", "(_", "tr", "X_", ",_", "tr", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "va", "X_", "=_", "tr", "X_", "[_", "50000_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "va", "Y_", "=_", "tr", "Y_", "[_", "50000_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "X_", "=_", "tr", "X_", "[_", ":_", "50000_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "Y_", "=_", "tr", "Y_", "[_", ":_", "50000_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tr", "X_", ",_", "va", "X_", ",_", "te", "X_", ",_", "tr", "Y_", ",_", "va", "Y_", ",_", "te", "Y_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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namedwizardtests/tests.py
[ { "content": " def setUp(self):\n self.testuser, created = User.objects.get_or_create(username='testuser1')\n self.wizard_step_data[0]['form1-user'] = self.testuser.pk", "metadata": "root.NamedWizardTests.setUp", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 16 } ]
[ { "span": "created ", "start_line": 17, "start_column": 23, "end_line": 17, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\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_", "._", "testu", "ser_", ",_", "created_", "=_", "User_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "username_", "=_", "'", "testu", "ser", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", "[_", "'", "form", "1", "-", "user", "'_", "]_", "=_", "self_", "._", "testu", "ser_", "._", "pk_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rackspace/pyrax/tests/unit/test_autoscale.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport random\nimport unittest\n\nfrom mock import patch\nfrom mock import MagicMock as Mock\n\nimport pyrax\nimport pyrax.autoscale\nfrom pyrax.autoscale import AutoScaleClient\nfrom pyrax.autoscale import AutoScalePolicy\nfrom pyrax.autoscale import AutoScaleWebhook\nfrom pyrax.autoscale import ScalingGroup\nfrom pyrax.autoscale import ScalingGroupManager\nimport pyrax.exceptions as exc\nimport pyrax.utils as utils\n\nfrom pyrax import fakes\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AutoscaleTest(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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.AutoscaleTest", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self, *args, **kwargs):\n super(AutoscaleTest, self).__init__(*args, **kwargs)", "metadata": "root.AutoscaleTest.__init__", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def setUp(self):\n self.identity = fakes.FakeIdentity()\n self.scaling_group = fakes.FakeScalingGroup(self.identity)", "metadata": "root.AutoscaleTest.setUp", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def tearDown(self):\n pass", "metadata": "root.AutoscaleTest.tearDown", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_make_policies(self):\n sg = self.scaling_group\n p1 = utils.random_unicode()\n p2 = utils.random_unicode()\n sg.scalingPolicies = [{\"name\": p1}, {\"name\": p2}]\n sg._make_policies()\n self.assertEqual(len(sg.policies), 2)\n polnames = [pol.name for pol in sg.policies]\n self.assert_(p1 in polnames)\n self.assert_(p2 in polnames)", "metadata": "root.AutoscaleTest.test_make_policies", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_get_state(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get_state = Mock()\n sg.get_state()\n mgr.get_state.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_get_state", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_pause(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.pause = Mock()\n sg.pause()\n mgr.pause.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_pause", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_resume(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.resume = Mock()\n sg.resume()\n mgr.resume.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_resume", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_update(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.update = Mock()\n name = utils.random_unicode()\n cooldown = utils.random_unicode()\n min_entities = utils.random_unicode()\n max_entities = utils.random_unicode()\n metadata = utils.random_unicode()\n sg.update(name=name, cooldown=cooldown, min_entities=min_entities,\n max_entities=max_entities, metadata=metadata)\n mgr.update.assert_called_once_with(sg, name=name, cooldown=cooldown,\n min_entities=min_entities, max_entities=max_entities,\n metadata=metadata)", "metadata": "root.AutoscaleTest.test_update", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 66 }, { "content": " def test_update_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.update_metadata = Mock()\n metadata = utils.random_unicode()\n sg.update_metadata(metadata)\n mgr.update_metadata.assert_called_once_with(sg, metadata=metadata)", "metadata": "root.AutoscaleTest.test_update_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_get_configuration(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get_configuration = Mock()\n sg.get_configuration()\n mgr.get_configuration.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_get_configuration", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 89 }, { "content": " def test_get_launch_config(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get_launch_config = Mock()\n sg.get_launch_config()\n mgr.get_launch_config.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_get_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 96 }, { "content": " def test_update_launch_config(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.update_launch_config = Mock()\n server_name = utils.random_unicode()\n flavor = utils.random_unicode()\n image = utils.random_unicode()\n disk_config = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = utils.random_unicode()\n networks = utils.random_unicode()\n load_balancers = utils.random_unicode()\n key_name = utils.random_unicode()\n config_drive = utils.random_unicode()\n user_data = utils.random_unicode()\n sg.update_launch_config(server_name=server_name, flavor=flavor,\n image=image, disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers, key_name=key_name,\n config_drive=config_drive, user_data=user_data)\n mgr.update_launch_config.assert_called_once_with(sg,\n server_name=server_name, flavor=flavor, image=image,\n disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers, key_name=key_name,\n config_drive=config_drive, user_data=user_data)", "metadata": "root.AutoscaleTest.test_update_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 103 }, { "content": " def test_update_launch_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.update_launch_metadata = Mock()\n metadata = utils.random_unicode()\n sg.update_launch_metadata(metadata)\n mgr.update_launch_metadata.assert_called_once_with(sg, metadata)", "metadata": "root.AutoscaleTest.test_update_launch_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 130 }, { "content": " def test_add_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n name = utils.random_unicode()\n policy_type = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n is_percent = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n args = utils.random_unicode()\n mgr.add_policy = Mock()\n sg.add_policy(name, policy_type, cooldown, change,\n is_percent=is_percent, desired_capacity=desired_capacity,\n args=args)\n mgr.add_policy.assert_called_once_with(sg, name, policy_type, cooldown,\n change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)", "metadata": "root.AutoscaleTest.test_add_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def test_list_policies(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.list_policies = Mock()\n sg.list_policies()\n mgr.list_policies.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_list_policies", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def test_get_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n mgr.get_policy = Mock()\n sg.get_policy(pol)\n mgr.get_policy.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_get_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 163 }, { "content": " def test_update_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n policy = utils.random_unicode()\n name = utils.random_unicode()\n policy_type = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n is_percent = utils.random_unicode()\n args = utils.random_unicode()\n mgr.update_policy = Mock()\n sg.update_policy(policy, name=name, policy_type=policy_type,\n cooldown=cooldown, change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)\n mgr.update_policy.assert_called_once_with(scaling_group=sg,\n policy=policy, name=name, policy_type=policy_type,\n cooldown=cooldown, change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)", "metadata": "root.AutoscaleTest.test_update_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 171 }, { "content": " def test_execute_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n mgr.execute_policy = Mock()\n sg.execute_policy(pol)\n mgr.execute_policy.assert_called_once_with(scaling_group=sg,\n policy=pol)", "metadata": "root.AutoscaleTest.test_execute_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 191 }, { "content": " def test_delete_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n mgr.delete_policy = Mock()\n sg.delete_policy(pol)\n mgr.delete_policy.assert_called_once_with(scaling_group=sg,\n policy=pol)", "metadata": "root.AutoscaleTest.test_delete_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 200 }, { "content": " def test_add_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.add_webhook = Mock()\n sg.add_webhook(pol, name, metadata=metadata)\n mgr.add_webhook.assert_called_once_with(sg, pol, name,\n metadata=metadata)", "metadata": "root.AutoscaleTest.test_add_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 209 }, { "content": " def test_list_webhooks(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n mgr.list_webhooks = Mock()\n sg.list_webhooks(pol)\n mgr.list_webhooks.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_list_webhooks", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_update_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.update_webhook = Mock()\n sg.update_webhook(pol, hook, name=name, metadata=metadata)\n mgr.update_webhook.assert_called_once_with(scaling_group=sg, policy=pol,\n webhook=hook, name=name, metadata=metadata)", "metadata": "root.AutoscaleTest.test_update_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 228 }, { "content": " def test_update_webhook_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.update_webhook_metadata = Mock()\n sg.update_webhook_metadata(pol, hook, metadata=metadata)\n mgr.update_webhook_metadata.assert_called_once_with(sg, pol, hook,\n metadata)", "metadata": "root.AutoscaleTest.test_update_webhook_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 240 }, { "content": " def test_delete_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n mgr.delete_webhook = Mock()\n sg.delete_webhook(pol, hook)\n mgr.delete_webhook.assert_called_once_with(sg, pol, hook)", "metadata": "root.AutoscaleTest.test_delete_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 251 }, { "content": " def test_policy_count(self):\n sg = self.scaling_group\n num = random.randint(1, 100)\n sg.policies = [\"x\"] * num\n self.assertEqual(sg.policy_count, num)", "metadata": "root.AutoscaleTest.test_policy_count", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 261 }, { "content": " def test_name(self):\n sg = self.scaling_group\n name = utils.random_unicode()\n newname = utils.random_unicode()\n sg.groupConfiguration = {\"name\": name}\n self.assertEqual(sg.name, name)\n sg.name = newname\n self.assertEqual(sg.name, newname)", "metadata": "root.AutoscaleTest.test_name", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 267 }, { "content": " def test_cooldown(self):\n sg = self.scaling_group\n cooldown = utils.random_unicode()\n newcooldown = utils.random_unicode()\n sg.groupConfiguration = {\"cooldown\": cooldown}\n self.assertEqual(sg.cooldown, cooldown)\n sg.cooldown = newcooldown\n self.assertEqual(sg.cooldown, newcooldown)", "metadata": "root.AutoscaleTest.test_cooldown", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 276 }, { "content": " def test_metadata(self):\n sg = self.scaling_group\n metadata = utils.random_unicode()\n newmetadata = utils.random_unicode()\n sg.groupConfiguration = {\"metadata\": metadata}\n self.assertEqual(sg.metadata, metadata)\n sg.metadata = newmetadata\n self.assertEqual(sg.metadata, newmetadata)", "metadata": "root.AutoscaleTest.test_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 285 }, { "content": " def test_min_entities(self):\n sg = self.scaling_group\n min_entities = utils.random_unicode()\n newmin_entities = utils.random_unicode()\n sg.groupConfiguration = {\"minEntities\": min_entities}\n self.assertEqual(sg.min_entities, min_entities)\n sg.min_entities = newmin_entities\n self.assertEqual(sg.min_entities, newmin_entities)", "metadata": "root.AutoscaleTest.test_min_entities", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 294 }, { "content": " def test_max_entities(self):\n sg = self.scaling_group\n max_entities = utils.random_unicode()\n newmax_entities = utils.random_unicode()\n sg.groupConfiguration = {\"maxEntities\": max_entities}\n self.assertEqual(sg.max_entities, max_entities)\n sg.max_entities = newmax_entities\n self.assertEqual(sg.max_entities, newmax_entities)", "metadata": "root.AutoscaleTest.test_max_entities", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 303 }, { "content": " def test_mgr_get_state(self):\n sg = self.scaling_group\n mgr = sg.manager\n id1 = utils.random_unicode()\n id2 = utils.random_unicode()\n ac = utils.random_unicode()\n dc = utils.random_unicode()\n pc = utils.random_unicode()\n paused = utils.random_unicode()\n statedict = {\"group\": {\n \"active\": [{\"id\": id1}, {\"id\": id2}],\n \"activeCapacity\": ac,\n \"desiredCapacity\": dc,\n \"pendingCapacity\": pc,\n \"paused\": paused,\n }}\n expected = {\n \"active\": [id1, id2],\n \"active_capacity\": ac,\n \"desired_capacity\": dc,\n \"pending_capacity\": pc,\n \"paused\": paused,\n }\n mgr.api.method_get = Mock(return_value=(None, statedict))\n ret = mgr.get_state(sg)\n self.assertEqual(ret, expected)", "metadata": "root.AutoscaleTest.test_mgr_get_state", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 312 }, { "content": " def test_mgr_pause(self):\n sg = self.scaling_group\n mgr = sg.manager\n uri = \"/%s/%s/pause\" % (mgr.uri_base, sg.id)\n mgr.api.method_post = Mock(return_value=(None, None))\n mgr.pause(sg)\n mgr.api.method_post.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_pause", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 339 }, { "content": " def test_mgr_resume(self):\n sg = self.scaling_group\n mgr = sg.manager\n uri = \"/%s/%s/resume\" % (mgr.uri_base, sg.id)\n mgr.api.method_post = Mock(return_value=(None, None))\n mgr.resume(sg)\n mgr.api.method_post.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_resume", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 347 }, { "content": " def test_mgr_get_configuration(self):\n sg = self.scaling_group\n mgr = sg.manager\n uri = \"/%s/%s/config\" % (mgr.uri_base, sg.id)\n conf = utils.random_unicode()\n resp_body = {\"groupConfiguration\": conf}\n mgr.api.method_get = Mock(return_value=(None, resp_body))\n ret = mgr.get_configuration(sg)\n mgr.api.method_get.assert_called_once_with(uri)\n self.assertEqual(ret, conf)", "metadata": "root.AutoscaleTest.test_mgr_get_configuration", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 355 }, { "content": " def test_mgr_update(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n uri = \"/%s/%s/config\" % (mgr.uri_base, sg.id)\n sg.name = utils.random_unicode()\n sg.cooldown = utils.random_unicode()\n sg.min_entities = utils.random_unicode()\n sg.max_entities = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.api.method_put = Mock(return_value=(None, None))\n expected_body = {\"name\": sg.name,\n \"cooldown\": sg.cooldown,\n \"minEntities\": sg.min_entities,\n \"maxEntities\": sg.max_entities,\n \"metadata\": metadata,\n }\n mgr.update(sg.id, metadata=metadata)\n mgr.api.method_put.assert_called_once_with(uri, body=expected_body)", "metadata": "root.AutoscaleTest.test_mgr_update", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 366 }, { "content": " def test_mgr_replace(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n uri = \"/%s/%s/config\" % (mgr.uri_base, sg.id)\n sg.name = utils.random_unicode()\n sg.cooldown = utils.random_unicode()\n sg.min_entities = utils.random_unicode()\n sg.max_entities = utils.random_unicode()\n metadata = utils.random_unicode()\n\n new_name = utils.random_unicode()\n new_cooldown = utils.random_unicode()\n new_min = utils.random_unicode()\n new_max = utils.random_unicode()\n mgr.api.method_put = Mock(return_value=(None, None))\n expected_body = {\n \"name\": new_name,\n \"cooldown\": new_cooldown,\n \"minEntities\": new_min,\n \"maxEntities\": new_max,\n \"metadata\": {}\n }\n mgr.replace(sg.id, new_name, new_cooldown, new_min, new_max)\n mgr.api.method_put.assert_called_once_with(uri, body=expected_body)", "metadata": "root.AutoscaleTest.test_mgr_replace", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 386 }, { "content": " def test_mgr_update_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n sg.metadata = {\"orig\": \"orig\"}\n metadata = {\"new\": \"new\"}\n expected = sg.metadata.copy()\n expected.update(metadata)\n mgr.update = Mock()\n mgr.update_metadata(sg.id, metadata)\n mgr.update.assert_called_once_with(sg, metadata=expected)", "metadata": "root.AutoscaleTest.test_mgr_update_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 412 }, { "content": " def test_mgr_get_launch_config(self):\n sg = self.scaling_group\n mgr = sg.manager\n typ = utils.random_unicode()\n lbs = utils.random_unicode()\n name = utils.random_unicode()\n flv = utils.random_unicode()\n img = utils.random_unicode()\n dconfig = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = utils.random_unicode()\n networks = utils.random_unicode()\n key_name = utils.random_unicode()\n launchdict = {\"launchConfiguration\":\n {\"type\": typ,\n \"args\": {\n \"loadBalancers\": lbs,\n \"server\": {\n \"name\": name,\n \"flavorRef\": flv,\n \"imageRef\": img,\n \"OS-DCF:diskConfig\": dconfig,\n \"metadata\": metadata,\n \"personality\": personality,\n \"networks\": networks,\n \"key_name\": key_name,\n },\n },\n },\n }\n expected = {\n \"type\": typ,\n \"load_balancers\": lbs,\n \"name\": name,\n \"flavor\": flv,\n \"image\": img,\n \"disk_config\": dconfig,\n \"metadata\": metadata,\n \"personality\": personality,\n \"networks\": networks,\n \"key_name\": key_name,\n }\n mgr.api.method_get = Mock(return_value=(None, launchdict))\n uri = \"/%s/%s/launch\" % (mgr.uri_base, sg.id)\n ret = mgr.get_launch_config(sg)\n mgr.api.method_get.assert_called_once_with(uri)\n self.assertEqual(ret, expected)", "metadata": "root.AutoscaleTest.test_mgr_get_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 424 }, { "content": " def test_mgr_update_launch_config(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n typ = utils.random_unicode()\n lbs = utils.random_unicode()\n name = utils.random_unicode()\n flv = utils.random_unicode()\n img = utils.random_unicode()\n dconfig = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = utils.random_unicode()\n networks = utils.random_unicode()\n sg.launchConfiguration = {}\n body = {\"type\": \"launch_server\",\n \"args\": {\n \"server\": {\n \"name\": name,\n \"imageRef\": img,\n \"flavorRef\": flv,\n \"OS-DCF:diskConfig\": dconfig,\n \"personality\": mgr._encode_personality(personality),\n \"networks\": networks,\n \"metadata\": metadata,\n },\n \"loadBalancers\": lbs,\n },\n }\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/launch\" % (mgr.uri_base, sg.id)\n mgr.update_launch_config(sg.id, server_name=name, flavor=flv, image=img,\n disk_config=dconfig, metadata=metadata,\n personality=personality, networks=networks, load_balancers=lbs)\n mgr.api.method_put.assert_called_once_with(uri, body=body)", "metadata": "root.AutoscaleTest.test_mgr_update_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 472 }, { "content": " def test_mgr_update_launch_config_unset_personality(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n typ = utils.random_unicode()\n lbs = utils.random_unicode()\n name = utils.random_unicode()\n flv = utils.random_unicode()\n img = utils.random_unicode()\n dconfig = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = [{\n \"path\": \"/foo/bar\",\n \"contents\": \"cHlyYXg=\"\n }]\n networks = utils.random_unicode()\n sg.launchConfiguration = {\n \"type\": \"launch_server\",\n \"args\": {\n \"server\": {\n \"name\": name,\n \"imageRef\": img,\n \"flavorRef\": flv,\n \"OS-DCF:diskConfig\": dconfig,\n \"personality\": personality,\n \"networks\": networks,\n \"metadata\": metadata,\n },\n \"loadBalancers\": lbs,\n },\n }\n body = {\n \"type\": \"launch_server\",\n \"args\": {\n \"server\": {\n \"name\": name,\n \"imageRef\": img,\n \"flavorRef\": flv,\n \"OS-DCF:diskConfig\": dconfig,\n \"networks\": networks,\n \"metadata\": metadata,\n },\n \"loadBalancers\": lbs,\n },\n }\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/launch\" % (mgr.uri_base, sg.id)\n mgr.update_launch_config(sg.id, server_name=name, flavor=flv, image=img,\n disk_config=dconfig, metadata=metadata,\n personality=[], networks=networks, load_balancers=lbs)\n mgr.api.method_put.assert_called_once_with(uri, body=body)", "metadata": "root.AutoscaleTest.test_mgr_update_launch_config_unset_personality", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 507 }, { "content": " def test_mgr_update_launch_config_no_personality(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n typ = utils.random_unicode()\n lbs = utils.random_unicode()\n name = utils.random_unicode()\n flv = utils.random_unicode()\n img = utils.random_unicode()\n dconfig = utils.random_unicode()\n metadata = utils.random_unicode()\n networks = utils.random_unicode()\n sg.launchConfiguration = {}\n body = {\"type\": \"launch_server\",\n \"args\": {\n \"server\": {\n \"name\": name,\n \"imageRef\": img,\n \"flavorRef\": flv,\n \"OS-DCF:diskConfig\": dconfig,\n \"networks\": networks,\n \"metadata\": metadata,\n },\n \"loadBalancers\": lbs,\n },\n }\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/launch\" % (mgr.uri_base, sg.id)\n mgr.update_launch_config(sg.id, server_name=name, flavor=flv, image=img,\n disk_config=dconfig, metadata=metadata,\n networks=networks, load_balancers=lbs)\n mgr.api.method_put.assert_called_once_with(uri, body=body)", "metadata": "root.AutoscaleTest.test_mgr_update_launch_config_no_personality", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 559 }, { "content": " def test_mgr_update_launch_config_no_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n typ = utils.random_unicode()\n lbs = utils.random_unicode()\n name = utils.random_unicode()\n flv = utils.random_unicode()\n img = utils.random_unicode()\n dconfig = utils.random_unicode()\n networks = utils.random_unicode()\n sg.launchConfiguration = {}\n body = {\"type\": \"launch_server\",\n \"args\": {\n \"server\": {\n \"name\": name,\n \"imageRef\": img,\n \"flavorRef\": flv,\n \"OS-DCF:diskConfig\": dconfig,\n \"networks\": networks,\n },\n \"loadBalancers\": lbs,\n },\n }\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/launch\" % (mgr.uri_base, sg.id)\n mgr.update_launch_config(sg.id, server_name=name, flavor=flv, image=img,\n disk_config=dconfig, networks=networks, load_balancers=lbs)\n mgr.api.method_put.assert_called_once_with(uri, body=body)", "metadata": "root.AutoscaleTest.test_mgr_update_launch_config_no_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 592 }, { "content": " def test_mgr_update_launch_config_key_name(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n typ = utils.random_unicode()\n lbs = utils.random_unicode()\n name = utils.random_unicode()\n flv = utils.random_unicode()\n img = utils.random_unicode()\n dconfig = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = utils.random_unicode()\n networks = utils.random_unicode()\n key_name = utils.random_unicode()\n sg.launchConfiguration = {}\n body = {\"type\": \"launch_server\",\n \"args\": {\n \"server\": {\n \"name\": name,\n \"imageRef\": img,\n \"flavorRef\": flv,\n \"OS-DCF:diskConfig\": dconfig,\n \"networks\": networks,\n \"metadata\": metadata,\n \"key_name\": key_name,\n \"personality\": mgr._encode_personality(personality),\n },\n \"loadBalancers\": lbs,\n },\n }\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/launch\" % (mgr.uri_base, sg.id)\n mgr.update_launch_config(sg.id, server_name=name, flavor=flv, image=img,\n disk_config=dconfig, metadata=metadata,\n personality=personality, networks=networks, load_balancers=lbs,\n key_name=key_name)\n mgr.api.method_put.assert_called_once_with(uri, body=body)", "metadata": "root.AutoscaleTest.test_mgr_update_launch_config_key_name", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 622 }, { "content": " def test_mgr_replace_launch_config(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n typ = utils.random_unicode()\n lbs = utils.random_unicode()\n name = utils.random_unicode()\n flv = utils.random_unicode()\n img = utils.random_unicode()\n dconfig = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = utils.random_unicode()\n networks = utils.random_unicode()\n\n sg.launchConfiguration = {\n \"type\": typ,\n \"args\": {\n \"server\": {\n \"name\": name,\n \"imageRef\": img,\n \"flavorRef\": flv,\n \"OS-DCF:diskConfig\": dconfig,\n \"personality\": personality,\n \"networks\": networks,\n \"metadata\": metadata,\n },\n \"loadBalancers\": lbs,\n },\n }\n new_typ = utils.random_unicode()\n new_name = utils.random_unicode()\n new_flv = utils.random_unicode()\n new_img = utils.random_unicode()\n\n expected = {\n \"type\": new_typ,\n \"args\": {\n \"server\": {\n \"name\": new_name,\n \"imageRef\": new_img,\n \"flavorRef\": new_flv,\n },\n \"loadBalancers\": []\n }\n }\n\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/launch\" % (mgr.uri_base, sg.id)\n\n mgr.replace_launch_config(sg.id, launch_config_type=new_typ,\n server_name=new_name, flavor=new_flv, image=new_img)\n mgr.api.method_put.assert_called_once_with(uri, body=expected)", "metadata": "root.AutoscaleTest.test_mgr_replace_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 660 }, { "content": " def test_mgr_update_launch_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n orig_meta = {\"orig\": \"orig\"}\n new_meta = {\"new\": \"new\"}\n sg.launchConfiguration = {\"args\": {\"server\": {\"metadata\": orig_meta}}}\n expected = orig_meta.copy()\n expected.update(new_meta)\n mgr.update_launch_config = Mock()\n mgr.update_launch_metadata(sg.id, new_meta)\n mgr.update_launch_config.assert_called_once_with(sg, metadata=expected)", "metadata": "root.AutoscaleTest.test_mgr_update_launch_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 713 }, { "content": " def test_mgr_add_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n ret_body = {\"policies\": [{}]}\n mgr.api.method_post = Mock(return_value=(None, ret_body))\n uri = \"/%s/%s/policies\" % (mgr.uri_base, sg.id)\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n for is_percent in (True, False):\n post_body = {\"name\": name, \"cooldown\": cooldown, \"type\": ptype}\n if is_percent:\n post_body[\"changePercent\"] = change\n else:\n post_body[\"change\"] = change\n ret = mgr.add_policy(sg, name, ptype, cooldown, change,\n is_percent=is_percent)\n mgr.api.method_post.assert_called_with(uri, body=[post_body])\n self.assert_(isinstance(ret, AutoScalePolicy))", "metadata": "root.AutoscaleTest.test_mgr_add_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 726 }, { "content": " def test_mgr_create_policy_body(self):\n sg = self.scaling_group\n mgr = sg.manager\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n args = utils.random_unicode()\n change = utils.random_unicode()\n expected_pct = {\"name\": name,\n \"cooldown\": cooldown,\n \"type\": ptype,\n \"desiredCapacity\": desired_capacity,\n \"args\": args\n }\n expected_nopct = expected_pct.copy()\n expected_pct[\"changePercent\"] = change\n expected_nopct[\"change\"] = change\n ret_pct = mgr._create_policy_body(name, ptype, cooldown, change=change,\n is_percent=True, desired_capacity=desired_capacity, args=args)\n ret_nopct = mgr._create_policy_body(name, ptype, cooldown,\n change=change, is_percent=False,\n desired_capacity=desired_capacity, args=args)\n self.assertEqual(ret_nopct, expected_nopct)\n self.assertEqual(ret_pct, expected_pct)", "metadata": "root.AutoscaleTest.test_mgr_create_policy_body", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 747 }, { "content": " def test_mgr_add_policy_desired_capacity(self):\n sg = self.scaling_group\n mgr = sg.manager\n ret_body = {\"policies\": [{}]}\n mgr.api.method_post = Mock(return_value=(None, ret_body))\n uri = \"/%s/%s/policies\" % (mgr.uri_base, sg.id)\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n post_body = {\n \"name\": name,\n \"cooldown\": cooldown,\n \"type\": ptype,\n \"desiredCapacity\": desired_capacity,\n }\n ret = mgr.add_policy(sg, name, ptype, cooldown,\n desired_capacity=desired_capacity)\n mgr.api.method_post.assert_called_with(uri, body=[post_body])\n self.assert_(isinstance(ret, AutoScalePolicy))", "metadata": "root.AutoscaleTest.test_mgr_add_policy_desired_capacity", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 773 }, { "content": " def test_mgr_list_policies(self):\n sg = self.scaling_group\n mgr = sg.manager\n ret_body = {\"policies\": [{}]}\n mgr.api.method_get = Mock(return_value=(None, ret_body))\n uri = \"/%s/%s/policies\" % (mgr.uri_base, sg.id)\n ret = mgr.list_policies(sg)\n mgr.api.method_get.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_list_policies", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 794 }, { "content": " def test_mgr_get_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n ret_body = {\"policy\": {}}\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n mgr.api.method_get = Mock(return_value=(None, ret_body))\n ret = mgr.get_policy(sg, pol)\n self.assert_(isinstance(ret, AutoScalePolicy))\n mgr.api.method_get.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_get_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 803 }, { "content": " def test_mgr_replace_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol_id = utils.random_unicode()\n info = {\n \"name\": utils.random_unicode(),\n \"type\": utils.random_unicode(),\n \"cooldown\": utils.random_unicode(),\n \"change\": utils.random_unicode(),\n \"args\": utils.random_unicode(),\n }\n policy = fakes.FakeAutoScalePolicy(mgr, info, sg)\n mgr.get_policy = Mock(return_value=policy)\n\n new_name = utils.random_unicode()\n new_type = utils.random_unicode()\n new_cooldown = utils.random_unicode()\n new_change_percent = utils.random_unicode()\n\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol_id)\n expected = {\n \"name\": new_name,\n \"type\": new_type,\n \"cooldown\": new_cooldown,\n \"changePercent\": new_change_percent,\n }\n ret = mgr.replace_policy(sg, pol_id, name=new_name,\n policy_type=new_type, cooldown=new_cooldown,\n change=new_change_percent, is_percent=True)\n mgr.api.method_put.assert_called_with(uri, body=expected)", "metadata": "root.AutoscaleTest.test_mgr_replace_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 814 }, { "content": " def test_mgr_update_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n args = utils.random_unicode()\n mgr.get_policy = Mock(return_value=fakes.FakeAutoScalePolicy(mgr, {},\n sg))\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n for is_percent in (True, False):\n put_body = {\"name\": name, \"cooldown\": cooldown, \"type\": ptype,\n \"args\": args}\n if is_percent:\n put_body[\"changePercent\"] = change\n else:\n put_body[\"change\"] = change\n ret = mgr.update_policy(sg, pol, name=name, policy_type=ptype,\n cooldown=cooldown, change=change, is_percent=is_percent,\n args=args)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 846 }, { "content": " def test_mgr_update_policy_desired_to_desired(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n args = utils.random_unicode()\n new_desired_capacity = 10\n old_info = {\"desiredCapacity\": 0}\n mgr.get_policy = Mock(\n return_value=fakes.FakeAutoScalePolicy(mgr, old_info, sg))\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n put_body = {\"name\": name, \"cooldown\": cooldown, \"type\": ptype,\n \"desiredCapacity\": new_desired_capacity}\n ret = mgr.update_policy(sg, pol, name=name, policy_type=ptype,\n cooldown=cooldown, desired_capacity=new_desired_capacity)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_policy_desired_to_desired", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 871 }, { "content": " def test_mgr_update_policy_change_to_desired(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n args = utils.random_unicode()\n new_desired_capacity = 10\n old_info = {\"change\": -1}\n mgr.get_policy = Mock(\n return_value=fakes.FakeAutoScalePolicy(mgr, old_info, sg))\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n put_body = {\"name\": name, \"cooldown\": cooldown, \"type\": ptype,\n \"desiredCapacity\": new_desired_capacity}\n ret = mgr.update_policy(sg, pol, name=name, policy_type=ptype,\n cooldown=cooldown, desired_capacity=new_desired_capacity)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_policy_change_to_desired", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 892 }, { "content": " def test_mgr_update_policy_desired_to_change(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n args = utils.random_unicode()\n new_change = 1\n old_info = {\"desiredCapacity\": 0}\n mgr.get_policy = Mock(\n return_value=fakes.FakeAutoScalePolicy(mgr, old_info, sg))\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n put_body = {\"name\": name, \"cooldown\": cooldown, \"type\": ptype,\n \"change\": new_change}\n ret = mgr.update_policy(sg, pol, name=name, policy_type=ptype,\n cooldown=cooldown, change=new_change)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_policy_desired_to_change", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 913 }, { "content": " def test_mgr_update_policy_maintain_desired_capacity(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n args = utils.random_unicode()\n new_name = utils.random_unicode()\n old_capacity = 0\n old_info = {\n \"type\": ptype,\n \"desiredCapacity\": old_capacity,\n \"cooldown\": cooldown,\n }\n mgr.get_policy = Mock(\n return_value=fakes.FakeAutoScalePolicy(mgr, old_info, sg))\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n put_body = {\"name\": new_name, \"cooldown\": cooldown, \"type\": ptype,\n \"desiredCapacity\": old_capacity}\n ret = mgr.update_policy(sg, pol, name=new_name)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_policy_maintain_desired_capacity", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 934 }, { "content": " def test_mgr_update_policy_maintain_is_percent(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n new_name = utils.random_unicode()\n old_percent = 10\n old_info = {\n \"type\": ptype,\n \"changePercent\": old_percent,\n \"cooldown\": cooldown,\n }\n mgr.get_policy = Mock(\n return_value=fakes.FakeAutoScalePolicy(mgr, old_info, sg))\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n put_body = {\"name\": new_name, \"cooldown\": cooldown, \"type\": ptype,\n \"changePercent\": old_percent}\n ret = mgr.update_policy(sg, pol, name=new_name)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_policy_maintain_is_percent", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 959 }, { "content": " def test_mgr_update_policy_maintain_is_absolute(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n name = utils.random_unicode()\n ptype = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n new_name = utils.random_unicode()\n old_change = 10\n old_info = {\n \"type\": ptype,\n \"change\": old_change,\n \"cooldown\": cooldown,\n }\n mgr.get_policy = Mock(\n return_value=fakes.FakeAutoScalePolicy(mgr, old_info, sg))\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n put_body = {\"name\": new_name, \"cooldown\": cooldown, \"type\": ptype,\n \"change\": old_change}\n ret = mgr.update_policy(sg, pol, name=new_name)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_policy_maintain_is_absolute", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 982 }, { "content": " def test_mgr_execute_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n uri = \"/%s/%s/policies/%s/execute\" % (mgr.uri_base, sg.id, pol)\n mgr.api.method_post = Mock(return_value=(None, None))\n mgr.execute_policy(sg, pol)\n mgr.api.method_post.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_execute_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1006 }, { "content": " def test_mgr_delete_policy(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n uri = \"/%s/%s/policies/%s\" % (mgr.uri_base, sg.id, pol)\n mgr.api.method_delete = Mock(return_value=(None, None))\n mgr.delete_policy(sg, pol)\n mgr.api.method_delete.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_delete_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1015 }, { "content": " def test_mgr_add_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = utils.random_unicode()\n ret_body = {\"webhooks\": [{}]}\n mgr.api.method_post = Mock(return_value=(None, ret_body))\n uri = \"/%s/%s/policies/%s/webhooks\" % (mgr.uri_base, sg.id, pol)\n mgr.get_policy = Mock(return_value=fakes.FakeAutoScalePolicy(mgr, {},\n sg))\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n post_body = {\"name\": name, \"metadata\": metadata}\n ret = mgr.add_webhook(sg, pol, name, metadata=metadata)\n mgr.api.method_post.assert_called_with(uri, body=[post_body])\n self.assert_(isinstance(ret, AutoScaleWebhook))", "metadata": "root.AutoscaleTest.test_mgr_add_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1024 }, { "content": " def test_mgr_list_webhooks(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n ret_body = {\"webhooks\": [{}]}\n mgr.api.method_get = Mock(return_value=(None, ret_body))\n mgr.get_policy = Mock(return_value=fakes.FakeAutoScalePolicy(mgr, {},\n sg))\n uri = \"/%s/%s/policies/%s/webhooks\" % (mgr.uri_base, sg.id, pol.id)\n ret = mgr.list_webhooks(sg, pol)\n mgr.api.method_get.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_list_webhooks", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1040 }, { "content": " def test_mgr_get_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n ret_body = {\"webhook\": {}}\n uri = \"/%s/%s/policies/%s/webhooks/%s\" % (mgr.uri_base, sg.id, pol.id,\n hook)\n mgr.api.method_get = Mock(return_value=(None, ret_body))\n ret = mgr.get_webhook(sg, pol, hook)\n self.assert_(isinstance(ret, AutoScaleWebhook))\n mgr.api.method_get.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_get_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1052 }, { "content": " def test_mgr_replace_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n info = {\"name\": utils.random_unicode(),\n \"metadata\": utils.random_unicode()}\n hook_obj = fakes.FakeAutoScaleWebhook(mgr, info, pol, sg)\n new_name = utils.random_unicode()\n new_metadata = utils.random_unicode()\n mgr.get_webhook = Mock(return_value=hook_obj)\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s/webhooks/%s\" % (mgr.uri_base, sg.id, pol.id,\n hook)\n expected = {\"name\": new_name, \"metadata\": {}}\n ret = mgr.replace_webhook(sg, pol, hook, name=new_name)\n mgr.api.method_put.assert_called_with(uri, body=expected)", "metadata": "root.AutoscaleTest.test_mgr_replace_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1065 }, { "content": " def test_mgr_update_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n hook_obj = fakes.FakeAutoScaleWebhook(mgr, {}, pol, sg)\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.get_webhook = Mock(return_value=hook_obj)\n mgr.api.method_put = Mock(return_value=(None, None))\n uri = \"/%s/%s/policies/%s/webhooks/%s\" % (mgr.uri_base, sg.id, pol.id,\n hook)\n put_body = {\"name\": name, \"metadata\": metadata}\n ret = mgr.update_webhook(sg, pol, hook, name=name, metadata=metadata)\n mgr.api.method_put.assert_called_with(uri, body=put_body)", "metadata": "root.AutoscaleTest.test_mgr_update_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1083 }, { "content": " def test_mgr_update_webhook_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n hook_obj = fakes.FakeAutoScaleWebhook(mgr, {}, pol, sg)\n hook_obj.metadata = {\"orig\": \"orig\"}\n metadata = {\"new\": \"new\"}\n expected = hook_obj.metadata.copy()\n expected.update(metadata)\n uri = \"/%s/%s/policies/%s/webhooks/%s\" % (mgr.uri_base, sg.id, pol.id,\n hook)\n mgr.update_webhook = Mock()\n mgr.get_webhook = Mock(return_value=hook_obj)\n mgr.update_webhook_metadata(sg, pol, hook, metadata)\n mgr.update_webhook.assert_called_once_with(sg, pol, hook_obj,\n metadata=expected)", "metadata": "root.AutoscaleTest.test_mgr_update_webhook_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1099 }, { "content": " def test_mgr_delete_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n hook_obj = fakes.FakeAutoScaleWebhook(mgr, {}, pol, sg)\n uri = \"/%s/%s/policies/%s/webhooks/%s\" % (mgr.uri_base, sg.id, pol.id,\n hook)\n mgr.api.method_delete = Mock(return_value=(None, None))\n mgr.get_webhook = Mock(return_value=hook_obj)\n mgr.delete_webhook(sg, pol, hook)\n mgr.api.method_delete.assert_called_once_with(uri)", "metadata": "root.AutoscaleTest.test_mgr_delete_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1117 }, { "content": " def test_mgr_resolve_lbs_dict(self):\n sg = self.scaling_group\n mgr = sg.manager\n key = utils.random_unicode()\n val = utils.random_unicode()\n lb_dict = {key: val}\n ret = mgr._resolve_lbs(lb_dict)\n self.assertEqual(ret, [lb_dict])", "metadata": "root.AutoscaleTest.test_mgr_resolve_lbs_dict", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1130 }, { "content": " def test_mgr_resolve_lbs_clb(self):\n sg = self.scaling_group\n mgr = sg.manager\n clb = fakes.FakeLoadBalancer(None, {})\n ret = mgr._resolve_lbs(clb)\n expected = {\"loadBalancerId\": clb.id, \"port\": clb.port}\n self.assertEqual(ret, [expected])", "metadata": "root.AutoscaleTest.test_mgr_resolve_lbs_clb", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1139 }, { "content": " def test_mgr_resolve_lbs_tuple(self):\n sg = self.scaling_group\n mgr = sg.manager\n fake_id = utils.random_unicode()\n fake_port = utils.random_unicode()\n lbs = (fake_id, fake_port)\n ret = mgr._resolve_lbs(lbs)\n expected = {\"loadBalancerId\": fake_id, \"port\": fake_port}\n self.assertEqual(ret, [expected])", "metadata": "root.AutoscaleTest.test_mgr_resolve_lbs_tuple", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1147 }, { "content": " def test_mgr_resolve_lbs_id(self):\n sg = self.scaling_group\n mgr = sg.manager\n clb = fakes.FakeLoadBalancer(None, {})\n sav = pyrax.cloud_loadbalancers\n\n class PyrCLB(object):\n def get(self, *args, **kwargs):\n return clb\n\n pyrax.cloud_loadbalancers = PyrCLB()\n ret = mgr._resolve_lbs(\"fakeid\")\n expected = {\"loadBalancerId\": clb.id, \"port\": clb.port}\n self.assertEqual(ret, [expected])\n pyrax.cloud_loadbalancers = sav", "metadata": "root.AutoscaleTest.test_mgr_resolve_lbs_id", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1157 }, { "content": " def test_mgr_resolve_lbs_id_fail(self):\n sg = self.scaling_group\n mgr = sg.manager\n pyclb = pyrax.cloudloadbalancers\n pyclb.get = Mock(side_effect=Exception())\n self.assertRaises(exc.InvalidLoadBalancer, mgr._resolve_lbs, \"bogus\")", "metadata": "root.AutoscaleTest.test_mgr_resolve_lbs_id_fail", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1173 }, { "content": " def test_mgr_create_body(self):\n sg = self.scaling_group\n mgr = sg.manager\n name = utils.random_unicode()\n cooldown = utils.random_unicode()\n min_entities = utils.random_unicode()\n max_entities = utils.random_unicode()\n launch_config_type = utils.random_unicode()\n flavor = utils.random_unicode()\n disk_config = None\n metadata = None\n personality = [{\"path\": \"/tmp/testing\", \"contents\": \"testtest\"}]\n scaling_policies = None\n networks = utils.random_unicode()\n lb = fakes.FakeLoadBalancer()\n load_balancers = (lb.id, lb.port)\n server_name = utils.random_unicode()\n image = utils.random_unicode()\n group_metadata = utils.random_unicode()\n key_name = utils.random_unicode()\n expected = {\n \"groupConfiguration\": {\n \"cooldown\": cooldown,\n \"maxEntities\": max_entities,\n \"minEntities\": min_entities,\n \"name\": name,\n \"metadata\": group_metadata},\n \"launchConfiguration\": {\n \"args\": {\n \"loadBalancers\": [{\"loadBalancerId\": lb.id,\n \"port\": lb.port}],\n \"server\": {\n \"flavorRef\": flavor,\n \"imageRef\": image,\n \"metadata\": {},\n \"name\": server_name,\n \"personality\": [{\"path\": \"/tmp/testing\",\n \"contents\": \"dGVzdHRlc3Q=\"}],\n \"networks\": networks,\n \"key_name\": key_name}\n },\n \"type\": launch_config_type},\n \"scalingPolicies\": []}\n\n self.maxDiff = 1000000\n ret = mgr._create_body(name, cooldown, min_entities, max_entities,\n launch_config_type, server_name, image, flavor,\n disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers,\n scaling_policies=scaling_policies,\n group_metadata=group_metadata, key_name=key_name)\n self.assertEqual(ret, expected)", "metadata": "root.AutoscaleTest.test_mgr_create_body", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1180 }, { "content": " def test_mgr_create_body_disk_config(self):\n sg = self.scaling_group\n mgr = sg.manager\n name = utils.random_unicode()\n cooldown = utils.random_unicode()\n min_entities = utils.random_unicode()\n max_entities = utils.random_unicode()\n launch_config_type = utils.random_unicode()\n flavor = utils.random_unicode()\n disk_config = utils.random_unicode()\n metadata = None\n personality = None\n scaling_policies = None\n networks = utils.random_unicode()\n lb = fakes.FakeLoadBalancer()\n load_balancers = (lb.id, lb.port)\n server_name = utils.random_unicode()\n image = utils.random_unicode()\n group_metadata = utils.random_unicode()\n key_name = utils.random_unicode()\n expected = {\n \"groupConfiguration\": {\n \"cooldown\": cooldown,\n \"maxEntities\": max_entities,\n \"minEntities\": min_entities,\n \"name\": name,\n \"metadata\": group_metadata},\n \"launchConfiguration\": {\n \"args\": {\n \"loadBalancers\": [{\"loadBalancerId\": lb.id,\n \"port\": lb.port}],\n \"server\": {\n \"OS-DCF:diskConfig\": disk_config,\n \"flavorRef\": flavor,\n \"imageRef\": image,\n \"metadata\": {},\n \"name\": server_name,\n \"networks\": networks,\n \"key_name\": key_name}\n },\n \"type\": launch_config_type},\n \"scalingPolicies\": []}\n\n self.maxDiff = 1000000\n ret = mgr._create_body(name, cooldown, min_entities, max_entities,\n launch_config_type, server_name, image, flavor,\n disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers,\n scaling_policies=scaling_policies,\n group_metadata=group_metadata, key_name=key_name)\n self.assertEqual(ret, expected)", "metadata": "root.AutoscaleTest.test_mgr_create_body_disk_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1234 }, { "content": " def test_policy_init(self):\n sg = self.scaling_group\n mgr = sg.manager\n mgr.get = Mock(return_value=sg)\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg.id)\n self.assert_(pol.scaling_group is sg)", "metadata": "root.AutoscaleTest.test_policy_init", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1287 }, { "content": " def test_policy_get(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n mgr.get_policy = Mock(return_value=pol)\n pol.get()\n mgr.get_policy.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_policy_get", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1294 }, { "content": " def test_policy_delete(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n mgr.delete_policy = Mock()\n pol.delete()\n mgr.delete_policy.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_policy_delete", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1302 }, { "content": " def test_policy_update(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n name = utils.random_unicode()\n policy_type = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n is_percent = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n args = utils.random_unicode()\n mgr.update_policy = Mock()\n pol.update(name=name, policy_type=policy_type, cooldown=cooldown,\n change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)\n mgr.update_policy.assert_called_once_with(scaling_group=sg,\n policy=pol, name=name, policy_type=policy_type,\n cooldown=cooldown, change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)", "metadata": "root.AutoscaleTest.test_policy_update", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1310 }, { "content": " def test_policy_execute(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n mgr.execute_policy = Mock()\n pol.execute()\n mgr.execute_policy.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_policy_execute", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1330 }, { "content": " def test_policy_add_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n mgr.add_webhook = Mock()\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n pol.add_webhook(name, metadata=metadata)\n mgr.add_webhook.assert_called_once_with(sg, pol, name,\n metadata=metadata)", "metadata": "root.AutoscaleTest.test_policy_add_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1338 }, { "content": " def test_policy_list_webhooks(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n mgr.list_webhooks = Mock()\n pol.list_webhooks()\n mgr.list_webhooks.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_policy_list_webhooks", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1349 }, { "content": " def test_policy_get_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n mgr.get_webhook = Mock()\n pol.get_webhook(hook)\n mgr.get_webhook.assert_called_once_with(sg, pol, hook)", "metadata": "root.AutoscaleTest.test_policy_get_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1357 }, { "content": " def test_policy_update_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.update_webhook = Mock()\n pol.update_webhook(hook, name=name, metadata=metadata)\n mgr.update_webhook.assert_called_once_with(sg, policy=pol, webhook=hook,\n name=name, metadata=metadata)", "metadata": "root.AutoscaleTest.test_policy_update_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1366 }, { "content": " def test_policy_update_webhook_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.update_webhook_metadata = Mock()\n pol.update_webhook_metadata(hook, metadata=metadata)\n mgr.update_webhook_metadata.assert_called_once_with(sg, pol, hook,\n metadata)", "metadata": "root.AutoscaleTest.test_policy_update_webhook_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1378 }, { "content": " def test_policy_delete_webhook(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = utils.random_unicode()\n mgr.delete_webhook = Mock()\n pol.delete_webhook(hook)\n mgr.delete_webhook.assert_called_once_with(sg, pol, hook)", "metadata": "root.AutoscaleTest.test_policy_delete_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1389 }, { "content": " def test_webhook_get(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = fakes.FakeAutoScaleWebhook(mgr, {}, pol, sg)\n pol.get_webhook = Mock()\n hook.get()\n pol.get_webhook.assert_called_once_with(hook)", "metadata": "root.AutoscaleTest.test_webhook_get", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1398 }, { "content": " def test_webhook_update(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = fakes.FakeAutoScaleWebhook(mgr, {}, pol, sg)\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n pol.update_webhook = Mock()\n hook.update(name=name, metadata=metadata)\n pol.update_webhook.assert_called_once_with(hook, name=name,\n metadata=metadata)", "metadata": "root.AutoscaleTest.test_webhook_update", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1407 }, { "content": " def test_webhook_update_metadata(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = fakes.FakeAutoScaleWebhook(mgr, {}, pol, sg)\n metadata = utils.random_unicode()\n pol.update_webhook_metadata = Mock()\n hook.update_metadata(metadata=metadata)\n pol.update_webhook_metadata.assert_called_once_with(hook,\n metadata)", "metadata": "root.AutoscaleTest.test_webhook_update_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1419 }, { "content": " def test_webhook_delete(self):\n sg = self.scaling_group\n mgr = sg.manager\n pol = fakes.FakeAutoScalePolicy(mgr, {}, sg)\n hook = fakes.FakeAutoScaleWebhook(mgr, {}, pol, sg)\n pol.delete_webhook = Mock()\n hook.delete()\n pol.delete_webhook.assert_called_once_with(hook)", "metadata": "root.AutoscaleTest.test_webhook_delete", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1430 }, { "content": " def test_clt_get_state(self):\n clt = fakes.FakeAutoScaleClient()\n sg = self.scaling_group\n mgr = clt._manager\n mgr.get_state = Mock()\n clt.get_state(sg)\n mgr.get_state.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_clt_get_state", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1439 }, { "content": " def test_clt_pause(self):\n clt = fakes.FakeAutoScaleClient()\n sg = self.scaling_group\n mgr = clt._manager\n mgr.pause = Mock()\n clt.pause(sg)\n mgr.pause.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_clt_pause", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1447 }, { "content": " def test_clt_resume(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n mgr.resume = Mock()\n clt.resume(sg)\n mgr.resume.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_clt_resume", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1455 }, { "content": " def test_clt_replace(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n name = utils.random_unicode()\n cooldown = utils.random_unicode()\n min_entities = utils.random_unicode()\n max_entities = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.replace = Mock()\n clt.replace(sg, name, cooldown, min_entities, max_entities,\n metadata=metadata)\n mgr.replace.assert_called_once_with(sg, name, cooldown, min_entities,\n max_entities, metadata=metadata)", "metadata": "root.AutoscaleTest.test_clt_replace", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1463 }, { "content": " def test_clt_update(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n name = utils.random_unicode()\n cooldown = utils.random_unicode()\n min_entities = utils.random_unicode()\n max_entities = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.update = Mock()\n clt.update(sg, name=name, cooldown=cooldown, min_entities=min_entities,\n max_entities=max_entities, metadata=metadata)\n mgr.update.assert_called_once_with(sg, name=name, cooldown=cooldown,\n min_entities=min_entities, max_entities=max_entities,\n metadata=metadata)", "metadata": "root.AutoscaleTest.test_clt_update", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1478 }, { "content": " def test_clt_update_metadata(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n metadata = utils.random_unicode()\n mgr.update_metadata = Mock()\n clt.update_metadata(sg, metadata)\n mgr.update_metadata.assert_called_once_with(sg, metadata)", "metadata": "root.AutoscaleTest.test_clt_update_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1494 }, { "content": " def test_clt_get_configuration(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n mgr.get_configuration = Mock()\n clt.get_configuration(sg)\n mgr.get_configuration.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_clt_get_configuration", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1503 }, { "content": " def test_clt_get_launch_config(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n mgr.get_launch_config = Mock()\n clt.get_launch_config(sg)\n mgr.get_launch_config.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_clt_get_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1511 }, { "content": " def test_clt_replace_launch_config(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n mgr.replace_launch_config = Mock()\n launch_config_type = utils.random_unicode()\n server_name = utils.random_unicode()\n image = utils.random_unicode()\n flavor = utils.random_unicode()\n disk_config = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = utils.random_unicode()\n networks = utils.random_unicode()\n load_balancers = utils.random_unicode()\n key_name = utils.random_unicode()\n clt.replace_launch_config(sg, launch_config_type, server_name, image,\n flavor, disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers, key_name=key_name)\n mgr.replace_launch_config.assert_called_once_with(sg,\n launch_config_type, server_name, image, flavor,\n disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers, key_name=key_name)", "metadata": "root.AutoscaleTest.test_clt_replace_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1519 }, { "content": " def test_clt_update_launch_config(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n mgr.update_launch_config = Mock()\n server_name = utils.random_unicode()\n flavor = utils.random_unicode()\n image = utils.random_unicode()\n disk_config = utils.random_unicode()\n metadata = utils.random_unicode()\n personality = utils.random_unicode()\n networks = utils.random_unicode()\n load_balancers = utils.random_unicode()\n key_name = utils.random_unicode()\n user_data = utils.random_unicode()\n config_drive = utils.random_unicode()\n clt.update_launch_config(sg, server_name=server_name, flavor=flavor,\n image=image, disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers, key_name=key_name,\n config_drive=config_drive, user_data=user_data)\n mgr.update_launch_config.assert_called_once_with(sg,\n server_name=server_name, flavor=flavor, image=image,\n disk_config=disk_config, metadata=metadata,\n personality=personality, networks=networks,\n load_balancers=load_balancers, key_name=key_name,\n config_drive=config_drive, user_data=user_data)", "metadata": "root.AutoscaleTest.test_clt_update_launch_config", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1544 }, { "content": " def test_clt_update_launch_metadata(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n mgr.update_launch_metadata = Mock()\n metadata = utils.random_unicode()\n clt.update_launch_metadata(sg, metadata)\n mgr.update_launch_metadata.assert_called_once_with(sg, metadata)", "metadata": "root.AutoscaleTest.test_clt_update_launch_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1572 }, { "content": " def test_clt_add_policy(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n name = utils.random_unicode()\n policy_type = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n is_percent = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n args = utils.random_unicode()\n mgr.add_policy = Mock()\n clt.add_policy(sg, name, policy_type, cooldown, change,\n is_percent=is_percent, desired_capacity=desired_capacity,\n args=args)\n mgr.add_policy.assert_called_once_with(sg, name, policy_type, cooldown,\n change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)", "metadata": "root.AutoscaleTest.test_clt_add_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1581 }, { "content": " def test_clt_list_policies(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n mgr.list_policies = Mock()\n clt.list_policies(sg)\n mgr.list_policies.assert_called_once_with(sg)", "metadata": "root.AutoscaleTest.test_clt_list_policies", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1600 }, { "content": " def test_clt_get_policy(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n mgr.get_policy = Mock()\n clt.get_policy(sg, pol)\n mgr.get_policy.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_clt_get_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1608 }, { "content": " def test_clt_replace_policy(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n name = utils.random_unicode()\n policy_type = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n is_percent = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n args = utils.random_unicode()\n mgr.replace_policy = Mock()\n clt.replace_policy(sg, pol, name, policy_type, cooldown, change=change,\n is_percent=is_percent, desired_capacity=desired_capacity,\n args=args)\n mgr.replace_policy.assert_called_once_with(sg, pol, name, policy_type,\n cooldown, change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)", "metadata": "root.AutoscaleTest.test_clt_replace_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1617 }, { "content": " def test_clt_update_policy(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n name = utils.random_unicode()\n policy_type = utils.random_unicode()\n cooldown = utils.random_unicode()\n change = utils.random_unicode()\n is_percent = utils.random_unicode()\n desired_capacity = utils.random_unicode()\n args = utils.random_unicode()\n mgr.update_policy = Mock()\n clt.update_policy(sg, pol, name=name, policy_type=policy_type,\n cooldown=cooldown, change=change, is_percent=is_percent,\n desired_capacity=desired_capacity, args=args)\n mgr.update_policy.assert_called_once_with(sg, pol, name=name,\n policy_type=policy_type, cooldown=cooldown, change=change,\n is_percent=is_percent, desired_capacity=desired_capacity,\n args=args)", "metadata": "root.AutoscaleTest.test_clt_update_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1637 }, { "content": " def test_clt_execute_policy(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n mgr.execute_policy = Mock()\n clt.execute_policy(sg, pol)\n mgr.execute_policy.assert_called_once_with(scaling_group=sg, policy=pol)", "metadata": "root.AutoscaleTest.test_clt_execute_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1658 }, { "content": " def test_clt_delete_policy(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n mgr.delete_policy = Mock()\n clt.delete_policy(sg, pol)\n mgr.delete_policy.assert_called_once_with(scaling_group=sg, policy=pol)", "metadata": "root.AutoscaleTest.test_clt_delete_policy", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1667 }, { "content": " def test_clt_add_webhook(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.add_webhook = Mock()\n clt.add_webhook(sg, pol, name, metadata=metadata)\n mgr.add_webhook.assert_called_once_with(sg, pol, name,\n metadata=metadata)", "metadata": "root.AutoscaleTest.test_clt_add_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1676 }, { "content": " def test_clt_list_webhooks(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n mgr.list_webhooks = Mock()\n clt.list_webhooks(sg, pol)\n mgr.list_webhooks.assert_called_once_with(sg, pol)", "metadata": "root.AutoscaleTest.test_clt_list_webhooks", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1688 }, { "content": " def test_clt_get_webhook(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n mgr.get_webhook = Mock()\n clt.get_webhook(sg, pol, hook)\n mgr.get_webhook.assert_called_once_with(sg, pol, hook)", "metadata": "root.AutoscaleTest.test_clt_get_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1697 }, { "content": " def test_clt_replace_webhook(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.replace_webhook = Mock()\n clt.replace_webhook(sg, pol, hook, name, metadata=metadata)\n mgr.replace_webhook.assert_called_once_with(sg, pol, hook, name,\n metadata=metadata)", "metadata": "root.AutoscaleTest.test_clt_replace_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1707 }, { "content": " def test_clt_update_webhook(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n name = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.update_webhook = Mock()\n clt.update_webhook(sg, pol, hook, name=name, metadata=metadata)\n mgr.update_webhook.assert_called_once_with(scaling_group=sg, policy=pol,\n webhook=hook, name=name, metadata=metadata)", "metadata": "root.AutoscaleTest.test_clt_update_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1720 }, { "content": " def test_clt_update_webhook_metadata(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n metadata = utils.random_unicode()\n mgr.update_webhook_metadata = Mock()\n clt.update_webhook_metadata(sg, pol, hook, metadata)\n mgr.update_webhook_metadata.assert_called_once_with(sg, pol, hook,\n metadata)", "metadata": "root.AutoscaleTest.test_clt_update_webhook_metadata", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1733 }, { "content": " def test_clt_delete_webhook(self):\n clt = fakes.FakeAutoScaleClient()\n mgr = clt._manager\n sg = self.scaling_group\n pol = utils.random_unicode()\n hook = utils.random_unicode()\n mgr.delete_webhook = Mock()\n clt.delete_webhook(sg, pol, hook)\n mgr.delete_webhook.assert_called_once_with(sg, pol, hook)", "metadata": "root.AutoscaleTest.test_clt_delete_webhook", "header": "['class', 'AutoscaleTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1745 } ]
[ { "span": "from mock import patch", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 22 }, { "span": "from pyrax.autoscale import AutoScaleClient", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 43 }, { "span": "from pyrax.autoscale import ScalingGroup", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 40 }, { "span": "from pyrax.autoscale import ScalingGroupManager", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mag", "ic", "Mock_", "as_", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyra", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyra", "x_", "._", "autoscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyra", "x_", "._", "autoscale", "_", "import_", "Auto", "Scale", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyra", "x_", "._", "autoscale", "_", "import_", "Auto", "Scale", "Policy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyra", "x_", "._", "autoscale", "_", "import_", "Auto", "Scale", "Web", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyra", "x_", "._", "autoscale", "_", "import_", "Sca", "ling", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyra", "x_", "._", "autoscale", "_", "import_", "Sca", "ling", "Group", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyra", "x_", "._", "exceptions_", "as_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyra", "x_", "._", "utils_", "as_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyra", "x_", "import_", "fakes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u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u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\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\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Autos", "cale", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "identity_", "=_", "fakes_", "._", "Fake", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scal", "ing", "\\u", "group_", "=_", "fakes_", "._", "Fake", "Sca", "ling", "Group_", "(_", "self_", "._", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "make", "\\u", "policies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "scal", "ing", "Polic", "ies_", "=_", "[_", "{_", "\"", "name", "\"_", ":_", "p1_", "}_", ",_", "{_", "\"", "name", "\"_", ":_", "p2_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "\\u", "make", "\\u", "policies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "sg_", "._", "policies_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol", "names_", "=_", "[_", "pol_", "._", "name_", "for_", "pol_", "in_", "sg_", "._", "policies_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "p1_", "in_", "pol", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "p2_", "in_", "pol", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "state_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "get", "\\u", "state_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "state_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "pause_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "pause_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "pause_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "resume_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "resume_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "resume_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "resume_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "update_", "(_", "name_", "=_", "name_", ",_", "cooldown", "_", "=_", "cooldown", "_", ",_", "min", "\\u", "entities_", "=_", "min", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "entities_", "=_", "max", "\\u", "entities_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "name_", "=_", "name_", ",_", "cooldown", "_", "=_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "entities_", "=_", "min", "\\u", "entities_", ",_", "max", "\\u", "entities_", "=_", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "update", "\\u", "metadata_", "(_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "configuration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "configuration_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "get", "\\u", "configuration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "configuration_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "launch", "\\u", "config_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "get", "\\u", "launch", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "launch", "\\u", "config_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "config_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "drive_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "data_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "update", "\\u", "launch", "\\u", "config_", "(_", "server", "\\u", "name_", "=_", "server", "\\u", "name_", ",_", "flavor_", "=_", "flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "=_", "image_", ",_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "drive_", "=_", "config", "\\u", "drive_", ",_", "user", "\\u", "data_", "=_", "user", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "name_", "=_", "server", "\\u", "name_", ",_", "flavor_", "=_", "flavor_", ",_", "image_", "=_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "drive_", "=_", "config", "\\u", "drive_", ",_", "user", "\\u", "data_", "=_", "user", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "launch", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "update", "\\u", "launch", "\\u", "metadata_", "(_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "percent_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "add", "\\u", "policy_", "(_", "name_", ",_", "policy", "\\u", "type_", ",_", "cooldown", "_", ",_", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "name_", ",_", "policy", "\\u", "type_", ",_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "policies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "policies_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "list", "\\u", "policies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "policies_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "get", "\\u", "policy_", "(_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "percent_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "update", "\\u", "policy_", "(_", "policy_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "policy", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy_", "=_", "policy_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "policy", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "execute", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "execute", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "execute", "\\u", "policy_", "(_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "execute", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy_", "=_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "delete", "\\u", "policy_", "(_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy_", "=_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "add", "\\u", "webhook_", "(_", "pol_", ",_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "webho", "oks", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "webho", "oks", "_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "list", "\\u", "webho", "oks", "_", "(_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "webho", "oks", "_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "update", "\\u", "webhook_", "(_", "pol_", ",_", "hook_", ",_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "policy_", "=_", "pol_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webhook_", "=_", "hook_", ",_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "pol_", ",_", "hook_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "delete", "\\u", "webhook_", "(_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "=_", "random_", "._", "randint_", "(_", "1_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "policies_", "=_", "[_", "\"", "x", "\"_", "]_", "*_", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "policy", "\\u", "count_", ",_", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newname_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "group", "Configuration_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "name_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "name_", "=_", "newname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "name_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cooldown", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newco", "old", "own_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "group", "Configuration_", "=_", "{_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "cooldown", "_", ",_", "cooldown", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "cooldown", "_", "=_", "newco", "old", "own_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "cooldown", "_", ",_", "newco", "old", "own_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newm", "eta", "data_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "group", "Configuration_", "=_", "{_", "\"", "metadata", "\"_", ":_", "metadata_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "metadata_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "metadata_", "=_", "newm", "eta", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "metadata_", ",_", "newm", "eta", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "min", "\\u", "entities_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newm", "in", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "group", "Configuration_", "=_", "{_", "\"", "min", "Entit", "ies", "\"_", ":_", "min", "\\u", "entities_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "min", "\\u", "entities_", ",_", "min", "\\u", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "min", "\\u", "entities_", "=_", "newm", "in", "\\u", "entities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "min", "\\u", "entities_", ",_", "newm", "in", "\\u", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "max", "\\u", "entities_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newm", "ax", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "group", "Configuration_", "=_", "{_", "\"", "max", "Entit", "ies", "\"_", ":_", "max", "\\u", "entities_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "max", "\\u", "entities_", ",_", "max", "\\u", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "max", "\\u", "entities_", "=_", "newm", "ax", "\\u", "entities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sg_", "._", "max", "\\u", "entities_", ",_", "newm", "ax", "\\u", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "get", "\\u", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id1_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id2_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pc_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paused_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state", "dict_", "=_", "{_", "\"", "group", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\"_", ":_", "[_", "{_", "\"", "id", "\"_", ":_", "id1_", "}_", ",_", "{_", "\"", "id", "\"_", ":_", "id2_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "Capacit", "y", "\"_", ":_", "ac_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "dc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pend", "ing", "Capacit", "y", "\"_", ":_", "pc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "paus", "ed", "\"_", ":_", "paused_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\"_", ":_", "[_", "id1_", ",_", "id2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\\u", "capacit", "y", "\"_", ":_", "ac_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "\\u", "capacit", "y", "\"_", ":_", "dc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pend", "ing", "\\u", "capacit", "y", "\"_", ":_", "pc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "paus", "ed", "\"_", ":_", "paused_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "state", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "get", "\\u", "state_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "pause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "paus", "e", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "pause_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "resume_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "resum", "e", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "resume_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "get", "\\u", "configuration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "config", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp", "\\u", "body_", "=_", "{_", "\"", "group", "Configura", "tion", "\"_", ":_", "conf_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "resp", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "get", "\\u", "configuration_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "config", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "sg_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "sg_", "._", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "min", "Entit", "ies", "\"_", ":_", "sg_", "._", "min", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Entit", "ies", "\"_", ":_", "sg_", "._", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update_", "(_", "sg_", "._", "id_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "expected", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "replace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "config", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "min_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "max_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "new", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "new", "\\u", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "min", "Entit", "ies", "\"_", ":_", "new", "\\u", "min_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Entit", "ies", "\"_", ":_", "new", "\\u", "max_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "{_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace_", "(_", "sg_", "._", "id_", ",_", "new", "\\u", "name_", ",_", "new", "\\u", "cooldown", "_", ",_", "new", "\\u", "min_", ",_", "new", "\\u", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "expected", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "metadata_", "=_", "{_", "\"", "orig", "\"_", ":_", "\"", "orig", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "{_", "\"", "new", "\"_", ":_", "\"", "new", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "sg_", "._", "metadata_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "._", "update_", "(_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "metadata_", "(_", "sg_", "._", "id_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "metadata_", "=_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "get", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "nfig_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launch", "dict_", "=_", "{_", "\"", "launch", "Configura", "tion", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "type", "\"_", ":_", "typ_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "personality", "\"_", ":_", "personality", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\\u", "name", "\"_", ":_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "typ_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "\\u", "balancer", "s", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "personality", "\"_", ":_", "personality", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\\u", "name", "\"_", ":_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "launch", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "launch", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "get", "\\u", "launch", "\\u", "config_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "nfig_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "launch", "Configuration_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\"", "type", "\"_", ":_", "\"", "launch", "\\u", "server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "personality", "\"_", ":_", "mgr_", "._", "\\u", "encode", "\\u", "personality", "_", "(_", "personality", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "launch", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "(_", "sg_", "._", "id_", ",_", "server", "\\u", "name_", "=_", "name_", ",_", "flavor_", "=_", "fl", "v_", ",_", "image_", "=_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "dco", "nfig_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "load", "\\u", "balancer", "s_", "=_", "lb", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "launch", "\\u", "config", "\\u", "unse", "t", "\\u", "personality", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "nfig_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "path", "\"_", ":_", "\"/", "foo", "/", "bar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "content", "s", "\"_", ":_", "\"", "c", "Hl", "y", "YX", "g", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "launch", "Configuration_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "launch", "\\u", "server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "personality", "\"_", ":_", "personality", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "launch", "\\u", "server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "launch", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "(_", "sg_", "._", "id_", ",_", "server", "\\u", "name_", "=_", "name_", ",_", "flavor_", "=_", "fl", "v_", ",_", "image_", "=_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "dco", "nfig_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "[_", "]_", ",_", "networks_", "=_", "networks_", ",_", "load", "\\u", "balancer", "s_", "=_", "lb", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "launch", "\\u", "config", "\\u", "no", "\\u", "personality", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "nfig_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "launch", "Configuration_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\"", "type", "\"_", ":_", "\"", "launch", "\\u", "server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "launch", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "(_", "sg_", "._", "id_", ",_", "server", "\\u", "name_", "=_", "name_", ",_", "flavor_", "=_", "fl", "v_", ",_", "image_", "=_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "dco", "nfig_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "networks_", "=_", "networks_", ",_", "load", "\\u", "balancer", "s_", "=_", "lb", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "launch", "\\u", "config", "\\u", "no", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "nfig_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "launch", "Configuration_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\"", "type", "\"_", ":_", "\"", "launch", "\\u", "server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "launch", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "(_", "sg_", "._", "id_", ",_", "server", "\\u", "name_", "=_", "name_", ",_", "flavor_", "=_", "fl", "v_", ",_", "image_", "=_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "dco", "nfig_", ",_", "networks_", "=_", "networks_", ",_", "load", "\\u", "balancer", "s_", "=_", "lb", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "launch", "\\u", "config", "\\u", "key", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "nfig_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "launch", "Configuration_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\"", "type", "\"_", ":_", "\"", "launch", "\\u", "server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\\u", "name", "\"_", ":_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "personality", "\"_", ":_", "mgr_", "._", "\\u", "encode", "\\u", "personality", "_", "(_", "personality", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "launch", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "(_", "sg_", "._", "id_", ",_", "server", "\\u", "name_", "=_", "name_", ",_", "flavor_", "=_", "fl", "v_", ",_", "image_", "=_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "dco", "nfig_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "load", "\\u", "balancer", "s_", "=_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "replace", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "nfig_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sg_", "._", "launch", "Configuration_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "typ_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "dco", "nfig_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "personality", "\"_", ":_", "personality", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "lb", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "typ_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "fl", "v_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "img_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "new", "\\u", "typ_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "new", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "new", "\\u", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "new", "\\u", "fl", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "launch", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "._", "replace", "\\u", "launch", "\\u", "config_", "(_", "sg_", "._", "id_", ",_", "launch", "\\u", "config", "\\u", "type_", "=_", "new", "\\u", "typ_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "name_", "=_", "new", "\\u", "name_", ",_", "flavor_", "=_", "new", "\\u", "fl", "v_", ",_", "image_", "=_", "new", "\\u", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "launch", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "\\u", "meta_", "=_", "{_", "\"", "orig", "\"_", ":_", "\"", "orig", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "meta_", "=_", "{_", "\"", "new", "\"_", ":_", "\"", "new", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "._", "launch", "Configuration_", "=_", "{_", "\"", "args", "\"_", ":_", "{_", "\"", "server", "\"_", ":_", "{_", "\"", "metadata", "\"_", ":_", "orig", "\\u", "meta_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "orig", "\\u", "meta_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "._", "update_", "(_", "new", "\\u", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "metadata_", "(_", "sg_", "._", "id_", ",_", "new", "\\u", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "metadata_", "=_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "add", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "body_", "=_", "{_", "\"", "poli", "cies", "\"_", ":_", "[_", "{_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "ret", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "is", "\\u", "percent_", "in_", "(_", "True_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "percent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "body_", "[_", "\"", "change", "Perce", "nt", "\"_", "]_", "=_", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "body_", "[_", "\"", "change", "\"_", "]_", "=_", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "add", "\\u", "policy_", "(_", "sg_", ",_", "name_", ",_", "ptype_", ",_", "cooldown", "_", ",_", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "[_", "post", "\\u", "body_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "ret_", ",_", "Auto", "Scale", "Policy_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "create", "\\u", "policy", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "pct_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "desi", "red", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "args_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "nop", "ct_", "=_", "expected", "\\u", "pct_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "pct_", "[_", "\"", "change", "Perce", "nt", "\"_", "]_", "=_", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "nop", "ct_", "[_", "\"", "change", "\"_", "]_", "=_", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "pct_", "=_", "mgr_", "._", "\\u", "create", "\\u", "policy", "\\u", "body_", "(_", "name_", ",_", "ptype_", ",_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "percent_", "=_", "True_", ",_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "nop", "ct_", "=_", "mgr_", "._", "\\u", "create", "\\u", "policy", "\\u", "body_", "(_", "name_", ",_", "ptype_", ",_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret", "\\u", "nop", "ct_", ",_", "expected", "\\u", "nop", "ct_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret", "\\u", "pct_", ",_", "expected", "\\u", "pct_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "add", "\\u", "policy", "\\u", "desi", "red", "\\u", "capacity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "body_", "=_", "{_", "\"", "poli", "cies", "\"_", ":_", "[_", "{_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "ret", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "desi", "red", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "add", "\\u", "policy_", "(_", "sg_", ",_", "name_", ",_", "ptype_", ",_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "[_", "post", "\\u", "body_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "ret_", ",_", "Auto", "Scale", "Policy_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "list", "\\u", "policies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "body_", "=_", "{_", "\"", "poli", "cies", "\"_", ":_", "[_", "{_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "ret", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "list", "\\u", "policies_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "get", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "body_", "=_", "{_", "\"", "policy", "\"_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "ret", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "get", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "ret_", ",_", "Auto", "Scale", "Policy_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "replace", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol", "\\u", "id_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "change", "\"_", ":_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "info_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "change", "\\u", "percent_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "new", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "new", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "new", "\\u", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "change", "Perce", "nt", "\"_", ":_", "new", "\\u", "change", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "replace", "\\u", "policy_", "(_", "sg_", ",_", "pol", "\\u", "id_", ",_", "name_", "=_", "new", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "type_", "=_", "new", "\\u", "type_", ",_", "cooldown", "_", "=_", "new", "\\u", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "new", "\\u", "change", "\\u", "percent_", ",_", "is", "\\u", "percent_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "is", "\\u", "percent_", "in_", "(_", "True_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "args_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "percent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "put", "\\u", "body_", "[_", "\"", "change", "Perce", "nt", "\"_", "]_", "=_", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "put", "\\u", "body_", "[_", "\"", "change", "\"_", "]_", "=_", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "policy", "\\u", "desi", "red", "\\u", "to", "\\u", "desired_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "desi", "red", "\\u", "capacity_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "info_", "=_", "{_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "old", "\\u", "info_", ",_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "new", "\\u", "desi", "red", "\\u", "capacity_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "desi", "red", "\\u", "capacity_", "=_", "new", "\\u", "desi", "red", "\\u", "capacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "policy", "\\u", "change", "\\u", "to", "\\u", "desired_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "desi", "red", "\\u", "capacity_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "info_", "=_", "{_", "\"", "change", "\"_", ":_", "-_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "old", "\\u", "info_", ",_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "new", "\\u", "desi", "red", "\\u", "capacity_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "desi", "red", "\\u", "capacity_", "=_", "new", "\\u", "desi", "red", "\\u", "capacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "policy", "\\u", "desi", "red", "\\u", "to", "\\u", "change_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "change_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "info_", "=_", "{_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "old", "\\u", "info_", ",_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "change", "\"_", ":_", "new", "\\u", "change_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "change_", "=_", "new", "\\u", "change_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "policy", "\\u", "maintain", "\\u", "desi", "red", "\\u", "capacity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "capacity_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "old", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "old", "\\u", "info_", ",_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "new", "\\u", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "desi", "red", "Capacit", "y", "\"_", ":_", "old", "\\u", "capacity_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "new", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "policy", "\\u", "maintain", "\\u", "is", "\\u", "percent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "percent_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "change", "Perce", "nt", "\"_", ":_", "old", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "old", "\\u", "info_", ",_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "new", "\\u", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "change", "Perce", "nt", "\"_", ":_", "old", "\\u", "percent_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "new", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "policy", "\\u", "maintain", "\\u", "is", "\\u", "absolute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptype_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "change_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "change", "\"_", ":_", "old", "\\u", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "old", "\\u", "info_", ",_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "new", "\\u", "name_", ",_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\"", "type", "\"_", ":_", "ptype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "change", "\"_", ":_", "old", "\\u", "change_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "new", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "execute", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "execute", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "execute", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "delete", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "delete_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "delete_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "add", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "body_", "=_", "{_", "\"", "webho", "oks", "\"_", ":_", "[_", "{_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "ret", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "webho", "oks", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\"", "metadata", "\"_", ":_", "metadata_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "add", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "post_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "[_", "post", "\\u", "body_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "ret_", ",_", "Auto", "Scale", "Web", "hook_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "list", "\\u", "webho", "oks", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "body_", "=_", "{_", "\"", "webho", "oks", "\"_", ":_", "[_", "{_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "ret", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "webho", "oks", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "list", "\\u", "webho", "oks", "_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "get", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "body_", "=_", "{_", "\"", "webho", "ok", "\"_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "webho", "oks", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "ret", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "get", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "ret_", ",_", "Auto", "Scale", "Web", "hook_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "replace", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "{_", "\"", "name", "\"_", ":_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook", "\\u", "obj_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "info_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "hook", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "webho", "oks", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\"", "name", "\"_", ":_", "new", "\\u", "name_", ",_", "\"", "metadata", "\"_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "replace", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "name_", "=_", "new", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook", "\\u", "obj_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "{_", "}_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "hook", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "webho", "oks", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "body_", "=_", "{_", "\"", "name", "\"_", ":_", "name_", ",_", "\"", "metadata", "\"_", ":_", "metadata_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "update", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "put_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "uri_", ",_", "body_", "=_", "put", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook", "\\u", "obj_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "{_", "}_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook", "\\u", "obj_", "._", "metadata_", "=_", "{_", "\"", "orig", "\"_", ":_", "\"", "orig", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "{_", "\"", "new", "\"_", ":_", "\"", "new", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "hook", "\\u", "obj_", "._", "metadata_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "._", "update_", "(_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "webho", "oks", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "hook", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook", "\\u", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "delete", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook", "\\u", "obj_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "{_", "}_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/%", "s", "/", "%", "s", "/", "poli", "cies", "/", "%", "s", "/", "webho", "oks", "/", "%", "s", "\"_", "%_", "(_", "mgr_", "._", "uri", "\\u", "base_", ",_", "sg_", "._", "id_", ",_", "pol_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "delete_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "hook", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "api_", "._", "method", "\\u", "delete_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "resolve", "\\u", "lb", "s", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "dict_", "=_", "{_", "key_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "\\u", "resolve", "\\u", "lb", "s_", "(_", "lb", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "[_", "lb", "\\u", "dict_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "resolve", "\\u", "lb", "s", "\\u", "cl", "b_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl", "b_", "=_", "fakes_", "._", "Fake", "Load", "Balance", "r_", "(_", "None_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "\\u", "resolve", "\\u", "lb", "s_", "(_", "cl", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\"", "load", "Balance", "r", "Id", "\"_", ":_", "cl", "b_", "._", "id_", ",_", "\"", "port", "\"_", ":_", "cl", "b_", "._", "port_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "[_", "expected_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "resolve", "\\u", "lb", "s", "\\u", "tuple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "id_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "port_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "s_", "=_", "(_", "fake", "\\u", "id_", ",_", "fake", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "\\u", "resolve", "\\u", "lb", "s_", "(_", "lb", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\"", "load", "Balance", "r", "Id", "\"_", ":_", "fake", "\\u", "id_", ",_", "\"", "port", "\"_", ":_", "fake", "\\u", "port_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "[_", "expected_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "resolve", "\\u", "lb", "s", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl", "b_", "=_", "fakes_", "._", "Fake", "Load", "Balance", "r_", "(_", "None_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sav", "_", "=_", "pyra", "x_", "._", "cloud", "\\u", "loadbalancer", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Pyr", "CL", "B_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cl", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyra", "x_", "._", "cloud", "\\u", "loadbalancer", "s_", "=_", "Pyr", "CL", "B_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "\\u", "resolve", "\\u", "lb", "s_", "(_", "\"", "fake", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\"", "load", "Balance", "r", "Id", "\"_", ":_", "cl", "b_", "._", "id_", ",_", "\"", "port", "\"_", ":_", "cl", "b_", "._", "port_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "[_", "expected_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyra", "x_", "._", "cloud", "\\u", "loadbalancer", "s_", "=_", "sav", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "resolve", "\\u", "lb", "s", "\\u", "id", "\\u", "fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyc", "lb_", "=_", "pyra", "x_", "._", "cloud", "loadbalancer", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyc", "lb_", "._", "get_", "=_", "Mock_", "(_", "side", "\\u", "effect_", "=_", "Exception_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Inva", "lid", "Load", "Balance", "r_", ",_", "mgr_", "._", "\\u", "resolve", "\\u", "lb", "s_", ",_", "\"", "bog", "us", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "create", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launch", "\\u", "config", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "config_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "[_", "{_", "\"", "path", "\"_", ":_", "\"/", "tmp", "/", "testi", "ng", "\"_", ",_", "\"", "content", "s", "\"_", ":_", "\"", "testt", "est", "\"_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scal", "ing", "\\u", "policies_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "fakes_", "._", "Fake", "Load", "Balance", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "(_", "lb_", "._", "id_", ",_", "lb_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "group", "Configura", "tion", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Entit", "ies", "\"_", ":_", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "min", "Entit", "ies", "\"_", ":_", "min", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "group", "\\u", "metadata_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "launch", "Configura", "tion", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "[_", "{_", "\"", "load", "Balance", "r", "Id", "\"_", ":_", "lb_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "lb_", "._", "port_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "server", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "personality", "\"_", ":_", "[_", "{_", "\"", "path", "\"_", ":_", "\"/", "tmp", "/", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "content", "s", "\"_", ":_", "\"", "d", "GV", "zd", "HR", "lc", "3", "Q", "=\"_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\\u", "name", "\"_", ":_", "key", "\\u", "name_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "launch", "\\u", "config", "\\u", "type_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "scal", "ing", "Polic", "ies", "\"_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "1000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "\\u", "create", "\\u", "body_", "(_", "name_", ",_", "cooldown", "_", ",_", "min", "\\u", "entities_", ",_", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "launch", "\\u", "config", "\\u", "type_", ",_", "server", "\\u", "name_", ",_", "image_", ",_", "flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scal", "ing", "\\u", "policies_", "=_", "scal", "ing", "\\u", "policies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "metadata_", "=_", "group", "\\u", "metadata_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mgr", "\\u", "create", "\\u", "body", "\\u", "disk", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launch", "\\u", "config", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "config_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scal", "ing", "\\u", "policies_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "fakes_", "._", "Fake", "Load", "Balance", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "(_", "lb_", "._", "id_", ",_", "lb_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "group", "Configura", "tion", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cooldown", "\"_", ":_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Entit", "ies", "\"_", ":_", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "min", "Entit", "ies", "\"_", ":_", "min", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "group", "\\u", "metadata_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "launch", "Configura", "tion", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "Balance", "rs", "\"_", ":_", "[_", "{_", "\"", "load", "Balance", "r", "Id", "\"_", ":_", "lb_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "lb_", "._", "port_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OS", "-", "DC", "F", ":", "disk", "Config", "\"_", ":_", "disk", "\\u", "config_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "Ref", "\"_", ":_", "flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "Ref", "\"_", ":_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "metadata", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "server", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\\u", "name", "\"_", ":_", "key", "\\u", "name_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "launch", "\\u", "config", "\\u", "type_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "scal", "ing", "Polic", "ies", "\"_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "1000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "mgr_", "._", "\\u", "create", "\\u", "body_", "(_", "name_", ",_", "cooldown", "_", ",_", "min", "\\u", "entities_", ",_", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "launch", "\\u", "config", "\\u", "type_", ",_", "server", "\\u", "name_", ",_", "image_", ",_", "flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scal", "ing", "\\u", "policies_", "=_", "scal", "ing", "\\u", "policies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "metadata_", "=_", "group", "\\u", "metadata_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "pol_", "._", "scal", "ing", "\\u", "group_", "is_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "percent_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "update_", "(_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "policy", "\\u", "type_", ",_", "cooldown", "_", "=_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy_", "=_", "pol_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "policy", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "execute", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "execute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "execute", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "add", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "add", "\\u", "webhook_", "(_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "list", "\\u", "webho", "oks", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "webho", "oks", "_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "list", "\\u", "webho", "oks", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "webho", "oks", "_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "get", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "get", "\\u", "webhook_", "(_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "update", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "update", "\\u", "webhook_", "(_", "hook_", ",_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "policy_", "=_", "pol_", ",_", "webhook_", "=_", "hook_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "hook_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "policy", "\\u", "delete", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "delete", "\\u", "webhook_", "(_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "webho", "ok", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "{_", "}_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "get", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "get", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "webho", "ok", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "{_", "}_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "update", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "._", "update_", "(_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "update", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "hook_", ",_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "webho", "ok", "\\u", "update", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "{_", "}_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "._", "update", "\\u", "metadata_", "(_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "hook_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "webho", "ok", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "sg_", "._", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Policy_", "(_", "mgr_", ",_", "{_", "}_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Web", "hook_", "(_", "mgr_", ",_", "{_", "}_", ",_", "pol_", ",_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "delete", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "._", "delete", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "get", "\\u", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "state_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "get", "\\u", "state_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "state_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "pause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "pause_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "pause_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "pause_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "resume_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "resume_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "resume_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "resume_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "replace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "replace_", "(_", "sg_", ",_", "name_", ",_", "cooldown", "_", ",_", "min", "\\u", "entities_", ",_", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "name_", ",_", "cooldown", "_", ",_", "min", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "entities_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "entities_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "update_", "(_", "sg_", ",_", "name_", "=_", "name_", ",_", "cooldown", "_", "=_", "cooldown", "_", ",_", "min", "\\u", "entities_", "=_", "min", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "entities_", "=_", "max", "\\u", "entities_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "name_", "=_", "name_", ",_", "cooldown", "_", "=_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "entities_", "=_", "min", "\\u", "entities_", ",_", "max", "\\u", "entities_", "=_", "max", "\\u", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "update", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "update", "\\u", "metadata_", "(_", "sg_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "get", "\\u", "configuration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "configuration_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "get", "\\u", "configuration_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "configuration_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "get", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "launch", "\\u", "config_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "get", "\\u", "launch", "\\u", "config_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "launch", "\\u", "config_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "replace", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace", "\\u", "launch", "\\u", "config_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launch", "\\u", "config", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "config_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "replace", "\\u", "launch", "\\u", "config_", "(_", "sg_", ",_", "launch", "\\u", "config", "\\u", "type_", ",_", "server", "\\u", "name_", ",_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flavor_", ",_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace", "\\u", "launch", "\\u", "config_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "launch", "\\u", "config", "\\u", "type_", ",_", "server", "\\u", "name_", ",_", "image_", ",_", "flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "update", "\\u", "launch", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "config_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "data_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "drive_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "update", "\\u", "launch", "\\u", "config_", "(_", "sg_", ",_", "server", "\\u", "name_", "=_", "server", "\\u", "name_", ",_", "flavor_", "=_", "flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "=_", "image_", ",_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "drive_", "=_", "config", "\\u", "drive_", ",_", "user", "\\u", "data_", "=_", "user", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "config_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "name_", "=_", "server", "\\u", "name_", ",_", "flavor_", "=_", "flavor_", ",_", "image_", "=_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "config_", "=_", "disk", "\\u", "config_", ",_", "metadata_", "=_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "personality", "_", "=_", "personality", "_", ",_", "networks_", "=_", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancer", "s_", "=_", "load", "\\u", "balancer", "s_", ",_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "drive_", "=_", "config", "\\u", "drive_", ",_", "user", "\\u", "data_", "=_", "user", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "update", "\\u", "launch", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "update", "\\u", "launch", "\\u", "metadata_", "(_", "sg_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "launch", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "add", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "percent_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "add", "\\u", "policy_", "(_", "sg_", ",_", "name_", ",_", "policy", "\\u", "type_", ",_", "cooldown", "_", ",_", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "name_", ",_", "policy", "\\u", "type_", ",_", "cooldown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "list", "\\u", "policies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "policies_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "list", "\\u", "policies_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "policies_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "get", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "get", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "replace", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "percent_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "replace", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", ",_", "policy", "\\u", "type_", ",_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "name_", ",_", "policy", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "update", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "\\u", "type_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cooldown", "_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "percent_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "update", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "name_", ",_", "policy", "\\u", "type_", "=_", "policy", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cooldown", "_", "=_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "type_", "=_", "policy", "\\u", "type_", ",_", "cooldown", "_", "=_", "cooldown", "_", ",_", "change_", "=_", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "percent_", "=_", "is", "\\u", "percent_", ",_", "desi", "red", "\\u", "capacity_", "=_", "desi", "red", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "execute", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "execute", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "execute", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "execute", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "policy_", "=_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "delete", "\\u", "policy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "policy_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "delete", "\\u", "policy_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "policy_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "policy_", "=_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "add", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "add", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "add", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "list", "\\u", "webho", "oks", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "webho", "oks", "_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "list", "\\u", "webho", "oks", "_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "list", "\\u", "webho", "oks", "_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "get", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "get", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "get", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "replace", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "replace", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "replace", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "update", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "update", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "scal", "ing", "\\u", "group_", "=_", "sg_", ",_", "policy_", "=_", "pol_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webhook_", "=_", "hook_", ",_", "name_", "=_", "name_", ",_", "metadata_", "=_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "update", "\\u", "webho", "ok", "\\u", "metadata_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Autos", "cale", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clt", "\\u", "delete", "\\u", "webhook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "fakes_", "._", "Fake", "Auto", "Scale", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "clt", "_", "._", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sg_", "=_", "self_", "._", "scal", "ing", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pol_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook_", "=_", "utils_", "._", "random", "\\u", "unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "webhook_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "delete", "\\u", "webhook_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "delete", "\\u", "webhook_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "sg_", ",_", "pol_", ",_", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
gbeced/pyalgotrade/testcases/yahoo_test.py
[ { "content": " def testDownloadAndParseWeekly(self):\n instrument = \"aapl\"\n\n with common.TmpDir() as tmp_path:\n path = os.path.join(tmp_path, \"aapl-weekly-2013.csv\")\n yahoofinance.download_weekly_bars(instrument, 2013, path)\n bf = yahoofeed.Feed(frequency=bar.Frequency.WEEK)\n bf.addBarsFromCSV(instrument, path)\n bf.loadAll()\n self.assertEqual(round(bf[instrument][-1].getOpen(), 2), 557.46)\n self.assertEqual(round(bf[instrument][-1].getHigh(), 2), 561.28)\n self.assertEqual(round(bf[instrument][-1].getLow(), 2), 540.43)\n self.assertEqual(round(bf[instrument][-1].getClose(), 2), 540.98)\n self.assertTrue(bf[instrument][-1].getVolume() in (9852500, 9855900, 68991600))", "metadata": "root.ToolsTestCase.testDownloadAndParseWeekly", "header": "['class', 'ToolsTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def testBuildWeeklyFeed(self):\n with common.TmpDir() as tmpPath:\n instrument = \"aapl\"\n bf = yahoofinance.build_feed([instrument], 2013, 2013, storage=tmpPath, frequency=bar.Frequency.WEEK)\n bf.loadAll()\n self.assertEqual(round(bf[instrument][-1].getOpen(), 2), 557.46)\n self.assertEqual(round(bf[instrument][-1].getHigh(), 2), 561.28)\n self.assertEqual(round(bf[instrument][-1].getLow(), 2), 540.43)\n self.assertEqual(round(bf[instrument][-1].getClose(), 2), 540.98)\n self.assertTrue(bf[instrument][-1].getVolume() in (9852500, 9855900, 68991600))", "metadata": "root.ToolsTestCase.testBuildWeeklyFeed", "header": "['class', 'ToolsTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 65 } ]
[ { "span": "self.assertTrue(bf[instrument][-1].getVolume() in (9852500, 9855900, 68991600))", "start_line": 55, "start_column": 12, "end_line": 55, "end_column": 91 }, { "span": "self.assertTrue(bf[instrument][-1].getVolume() in (9852500, 9855900, 68991600))", "start_line": 74, "start_column": 12, "end_line": 74, "end_column": 91 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Tool", "s", "Test", "Case_", "(_", "common_", "._", "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", "Down", "load", "And", "Pars", "e", "Week", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instrument_", "=_", "\"", "aa", "pl", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "common_", "._", "Tm", "p", "Dir_", "(_", ")_", "as_", "tmp", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmp", "\\u", "path_", ",_", "\"", "aa", "pl", "-", "week", "ly", "-", "2013", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ya", "hoo", "finance", "_", "._", "download", "\\u", "week", "ly", "\\u", "bars_", "(_", "instrument_", ",_", "2013_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "=_", "ya", "hoo", "feed_", "._", "Feed_", "(_", "frequency_", "=_", "bar_", "._", "Frequency_", "._", "WEEK", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "._", "add", "Bar", "s", "Fro", "m", "CSV_", "(_", "instrument_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "._", "load", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Open_", "(_", ")_", ",_", "2_", ")_", ",_", "557", ".4", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "High_", "(_", ")_", ",_", "2_", ")_", ",_", "561", ".2", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Low_", "(_", ")_", ",_", "2_", ")_", ",_", "540", ".4", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Close_", "(_", ")_", ",_", "2_", ")_", ",_", "540", ".9", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Volume_", "(_", ")_", "in_", "(_", "985", "2500_", ",_", "985", "590", "0_", ",_", "689", "916", "00_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tool", "s", "Test", "Case_", "(_", "common_", "._", "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", "Build", "Week", "ly", "Feed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "common_", "._", "Tm", "p", "Dir_", "(_", ")_", "as_", "tmp", "Path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instrument_", "=_", "\"", "aa", "pl", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "=_", "ya", "hoo", "finance", "_", "._", "build", "\\u", "feed_", "(_", "[_", "instrument_", "]_", ",_", "2013_", ",_", "2013_", ",_", "storage_", "=_", "tmp", "Path_", ",_", "frequency_", "=_", "bar_", "._", "Frequency_", "._", "WEEK", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "._", "load", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Open_", "(_", ")_", ",_", "2_", ")_", ",_", "557", ".4", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "High_", "(_", ")_", ",_", "2_", ")_", ",_", "561", ".2", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Low_", "(_", ")_", ",_", "2_", ")_", ",_", "540", ".4", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "round_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Close_", "(_", ")_", ",_", "2_", ")_", ",_", "540", ".9", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "bf_", "[_", "instrument_", "]_", "[_", "-_", "1_", "]_", "._", "get", "Volume_", "(_", ")_", "in_", "(_", "985", "2500_", ",_", "985", "590", "0_", ",_", "689", "916", "00_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
`__eq__` not overridden when adding attributes
Yelp/paasta/paasta_tools/utils.py
[ { "content": "class InstanceConfig(dict):\n\n\n\n\n\n\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.InstanceConfig", "header": "['module', '___EOS___']", "index": 78 }, { "content": " def __init__(self, cluster, instance, service, config_dict, branch_dict):\n self.config_dict = config_dict\n self.branch_dict = branch_dict\n self.cluster = cluster\n self.instance = instance\n self.service = service\n config_interpolation_keys = ('deploy_group',)\n interpolation_facts = self.__get_interpolation_facts()\n for key in config_interpolation_keys:\n if key in self.config_dict:\n self.config_dict[key] = self.config_dict[key].format(**interpolation_facts)", "metadata": "root.InstanceConfig.__init__", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 80 }, { "content": " def __get_interpolation_facts(self):\n return {\n 'cluster': self.cluster,\n 'instance': self.instance,\n 'service': self.service,\n }", "metadata": "root.InstanceConfig.__get_interpolation_facts", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 92 }, { "content": " def get_cluster(self):\n return self.cluster", "metadata": "root.InstanceConfig.get_cluster", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 99 }, { "content": " def get_instance(self):\n return self.instance", "metadata": "root.InstanceConfig.get_instance", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 102 }, { "content": " def get_service(self):\n return self.service", "metadata": "root.InstanceConfig.get_service", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 105 }, { "content": " def get_branch(self):\n return SPACER.join((self.get_cluster(), self.get_instance()))", "metadata": "root.InstanceConfig.get_branch", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 108 }, { "content": " def get_deploy_group(self):\n return self.config_dict.get('deploy_group', self.get_branch())", "metadata": "root.InstanceConfig.get_deploy_group", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 111 }, { "content": " def get_mem(self):\n \"\"\"Gets the memory required from the service's configuration.\n\n Defaults to 1024 (1G) if no value specified in the config.\n\n :returns: The amount of memory specified by the config, 1024 if not specified\"\"\"\n mem = self.config_dict.get('mem', 1024)\n return mem", "metadata": "root.InstanceConfig.get_mem", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 114 }, { "content": " def get_mem_swap(self):\n \"\"\"Gets the memory-swap value. This value is passed to the docker\n container to ensure that the total memory limit (memory + swap) is the\n same value as the 'mem' key in soa-configs. Note - this value *has* to\n be >= to the mem key, so we always round up to the closest MB.\n \"\"\"\n mem = self.get_mem()\n mem_swap = int(math.ceil(mem))\n return \"%sm\" % mem_swap", "metadata": "root.InstanceConfig.get_mem_swap", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 123 }, { "content": " def get_cpus(self):\n \"\"\"Gets the number of cpus required from the service's configuration.\n\n Defaults to .25 (1/4 of a cpu) if no value specified in the config.\n\n :returns: The number of cpus specified in the config, .25 if not specified\"\"\"\n cpus = self.config_dict.get('cpus', .25)\n return cpus", "metadata": "root.InstanceConfig.get_cpus", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 133 }, { "content": " def get_disk(self):\n \"\"\"Gets the amount of disk space required from the service's configuration.\n\n Defaults to 1024 (1G) if no value is specified in the config.\n\n :returns: The amount of disk space specified by the config, 1024 if not specified\"\"\"\n disk = self.config_dict.get('disk', 1024)\n return disk", "metadata": "root.InstanceConfig.get_disk", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 142 }, { "content": " def get_cmd(self):\n \"\"\"Get the docker cmd specified in the service's configuration.\n\n Defaults to null if not specified in the config.\n\n :returns: A string specified in the config, None if not specified\"\"\"\n return self.config_dict.get('cmd', None)", "metadata": "root.InstanceConfig.get_cmd", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 151 }, { "content": " def get_env_dictionary(self):\n \"\"\"A dictionary of key/value pairs that represent environment variables\n to be injected to the container environment\"\"\"\n env = {\n \"PAASTA_SERVICE\": self.service,\n \"PAASTA_INSTANCE\": self.instance,\n \"PAASTA_CLUSTER\": self.cluster,\n }\n user_env = self.config_dict.get('env', {})\n env.update(user_env)\n return env", "metadata": "root.InstanceConfig.get_env_dictionary", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 159 }, { "content": " def get_env(self):\n \"\"\"Basic get_env that simply returns the basic env, other classes\n might need to override this getter for more implementation-specific\n env getting\"\"\"\n return self.get_env_dictionary()", "metadata": "root.InstanceConfig.get_env", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 171 }, { "content": " def get_args(self):\n \"\"\"Get the docker args specified in the service's configuration.\n\n If not specified in the config and if cmd is not specified, defaults to an empty array.\n If not specified in the config but cmd is specified, defaults to null.\n If specified in the config and if cmd is also specified, throws an exception. Only one may be specified.\n\n :param service_config: The service instance's configuration dictionary\n :returns: An array of args specified in the config,\n ``[]`` if not specified and if cmd is not specified,\n otherwise None if not specified but cmd is specified\"\"\"\n if self.get_cmd() is None:\n return self.config_dict.get('args', [])\n else:\n args = self.config_dict.get('args', None)\n if args is None:\n return args\n else:\n # TODO validation stuff like this should be moved into a check_* like in chronos tools\n raise InvalidInstanceConfig('Instance configuration can specify cmd or args, but not both.')", "metadata": "root.InstanceConfig.get_args", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 177 }, { "content": " def get_monitoring(self):\n \"\"\"Get monitoring overrides defined for the given instance\"\"\"\n return self.config_dict.get('monitoring', {})", "metadata": "root.InstanceConfig.get_monitoring", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 198 }, { "content": " def get_deploy_blacklist(self):\n \"\"\"The deploy blacklist is a list of lists, where the lists indicate\n which locations the service should not be deployed\"\"\"\n return self.config_dict.get('deploy_blacklist', [])", "metadata": "root.InstanceConfig.get_deploy_blacklist", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 202 }, { "content": " def get_deploy_whitelist(self):\n \"\"\"The deploy whitelist is a list of lists, where the lists indicate\n which locations are explicitly allowed. The blacklist will supersede\n this if a host matches both the white and blacklists.\"\"\"\n return self.config_dict.get('deploy_whitelist', [])", "metadata": "root.InstanceConfig.get_deploy_whitelist", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 207 }, { "content": " def get_monitoring_blacklist(self):\n \"\"\"The monitoring_blacklist is a list of tuples, where the tuples indicate\n which locations the user doesn't care to be monitored\"\"\"\n return self.config_dict.get('monitoring_blacklist', self.get_deploy_blacklist())", "metadata": "root.InstanceConfig.get_monitoring_blacklist", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 213 }, { "content": " def get_docker_image(self):\n \"\"\"Get the docker image name (with tag) for a given service branch from\n a generated deployments.json file.\"\"\"\n return self.branch_dict.get('docker_image', '')", "metadata": "root.InstanceConfig.get_docker_image", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 218 }, { "content": " def get_desired_state(self):\n \"\"\"Get the desired state (either 'start' or 'stop') for a given service\n branch from a generated deployments.json file.\"\"\"\n return self.branch_dict.get('desired_state', 'start')", "metadata": "root.InstanceConfig.get_desired_state", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 223 }, { "content": " def get_force_bounce(self):\n \"\"\"Get the force_bounce token for a given service branch from a generated\n deployments.json file. This is a token that, when changed, indicates that\n the instance should be recreated and bounced, even if no other\n parameters have changed. This may be None or a string, generally a\n timestamp.\n \"\"\"\n return self.branch_dict.get('force_bounce', None)", "metadata": "root.InstanceConfig.get_force_bounce", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 228 }, { "content": " def check_cpus(self):\n cpus = self.get_cpus()\n if cpus is not None:\n if not isinstance(cpus, (float, int)):\n return False, 'The specified cpus value \"%s\" is not a valid float or int.' % cpus\n return True, ''", "metadata": "root.InstanceConfig.check_cpus", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 237 }, { "content": " def check_mem(self):\n mem = self.get_mem()\n if mem is not None:\n if not isinstance(mem, (float, int)):\n return False, 'The specified mem value \"%s\" is not a valid float or int.' % mem\n return True, ''", "metadata": "root.InstanceConfig.check_mem", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 244 }, { "content": " def check_disk(self):\n disk = self.get_disk()\n if disk is not None:\n if not isinstance(disk, (float, int)):\n return False, 'The specified disk value \"%s\" is not a valid float or int.' % disk\n return True, ''", "metadata": "root.InstanceConfig.check_disk", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 251 }, { "content": " def check(self, param):\n check_methods = {\n 'cpus': self.check_cpus,\n 'mem': self.check_mem,\n }\n if param in check_methods:\n return check_methods[param]()\n else:\n return False, 'Your Chronos config specifies \"%s\", an unsupported parameter.' % param", "metadata": "root.InstanceConfig.check", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 258 }, { "content": " def validate(self):\n error_msgs = []\n for param in ['cpus', 'mem']:\n check_passed, check_msg = self.check(param)\n if not check_passed:\n error_msgs.append(check_msg)\n return error_msgs", "metadata": "root.InstanceConfig.validate", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 268 }, { "content": " def get_extra_volumes(self):\n \"\"\"Extra volumes are a specially formatted list of dictionaries that should\n be bind mounted in a container The format of the dictionaries should\n conform to the `Mesos container volumes spec\n <https://mesosphere.github.io/marathon/docs/native-docker.html>`_\"\"\"\n return self.config_dict.get('extra_volumes', [])", "metadata": "root.InstanceConfig.get_extra_volumes", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 276 }, { "content": " def get_pool(self):\n \"\"\"Which pool of nodes this job should run on. This can be used to mitigate noisy neighbors, by putting\n particularly noisy or noise-sensitive jobs into different pools.\n\n This is implemented with an attribute \"pool\" on each mesos slave and by adding a constraint to Marathon/Chronos\n application defined by this instance config.\n\n Eventually this may be implemented with Mesos roles, once a framework can register under multiple roles.\n\n :returns: the \"pool\" attribute in your config dict, or the string \"default\" if not specified.\"\"\"\n return self.config_dict.get('pool', 'default')", "metadata": "root.InstanceConfig.get_pool", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 283 }, { "content": " def get_net(self):\n \"\"\"\n :returns: the docker networking mode the container should be started with.\n \"\"\"\n return self.config_dict.get('net', 'bridge')", "metadata": "root.InstanceConfig.get_net", "header": "['class', 'InstanceConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 295 }, { "content": "class SystemPaastaConfig(dict):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SystemPaastaConfig", "header": "['module', '___EOS___']", "index": 709 }, { "content": " def __init__(self, config, directory):\n self.directory = directory\n super(SystemPaastaConfig, self).__init__(config)", "metadata": "root.SystemPaastaConfig.__init__", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 711 }, { "content": " def get_zk_hosts(self):\n \"\"\"Get the zk_hosts defined in this hosts's cluster config file.\n Strips off the zk:// prefix, if it exists, for use with Kazoo.\n\n :returns: The zk_hosts specified in the paasta configuration\n \"\"\"\n try:\n hosts = self['zookeeper']\n except KeyError:\n raise PaastaNotConfiguredError('Could not find zookeeper connection string in configuration directory: %s'\n % self.directory)\n\n # how do python strings not have a method for doing this\n if hosts.startswith('zk://'):\n return hosts[len('zk://'):]\n return hosts", "metadata": "root.SystemPaastaConfig.get_zk_hosts", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 715 }, { "content": " def get_docker_registry(self):\n \"\"\"Get the docker_registry defined in this host's cluster config file.\n\n :returns: The docker_registry specified in the paasta configuration\n \"\"\"\n try:\n return self['docker_registry']\n except KeyError:\n raise PaastaNotConfiguredError('Could not find docker registry in configuration directory: %s'\n % self.directory)", "metadata": "root.SystemPaastaConfig.get_docker_registry", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 732 }, { "content": " def get_volumes(self):\n \"\"\"Get the volumes defined in this host's volumes config file.\n\n :returns: The list of volumes specified in the paasta configuration\n \"\"\"\n try:\n return self['volumes']\n except KeyError:\n raise PaastaNotConfiguredError('Could not find volumes in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_volumes", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 743 }, { "content": " def get_cluster(self):\n \"\"\"Get the cluster defined in this host's cluster config file.\n\n :returns: The name of the cluster defined in the paasta configuration\n \"\"\"\n try:\n return self['cluster']\n except KeyError:\n raise PaastaNotConfiguredError('Could not find cluster in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_cluster", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 753 }, { "content": " def get_scribe_map(self):\n \"\"\"Get the scribe_map out of the paasta config\n\n :returns: The scribe_map dictionary\n \"\"\"\n try:\n return self['scribe_map']\n except KeyError:\n raise PaastaNotConfiguredError('Could not find scribe_map in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_scribe_map", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 763 }, { "content": " def get_fsm_cluster_map(self):\n try:\n return self['fsm_cluster_map']\n except KeyError:\n raise PaastaNotConfiguredError(\n 'Could not find fsm_cluster_map in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_fsm_cluster_map", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 773 }, { "content": " def get_dashboard_links(self):\n try:\n return self['dashboard_links']\n except KeyError:\n raise PaastaNotConfiguredError(\n 'Could not find dashboard_links in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_dashboard_links", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 780 }, { "content": " def get_fsm_deploy_pipeline(self):\n try:\n return self['fsm_deploy_pipeline']\n except KeyError:\n raise PaastaNotConfiguredError(\n 'Could not find fsm_deploy_pipeline in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_fsm_deploy_pipeline", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 787 }, { "content": " def get_log_writer(self):\n \"\"\"Get the log_writer configuration out of global paasta config\n\n :returns: The log_writer dictionary.\n \"\"\"\n try:\n return self['log_writer']\n except KeyError:\n raise PaastaNotConfiguredError('Could not find log_writer in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_log_writer", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 794 }, { "content": " def get_log_reader(self):\n \"\"\"Get the log_reader configuration out of global paasta config\n\n :returns: the log_reader dictionary.\n \"\"\"\n try:\n return self['log_reader']\n except KeyError:\n raise PaastaNotConfiguredError('Could not find log_reader in configuration directory: %s' % self.directory)", "metadata": "root.SystemPaastaConfig.get_log_reader", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 804 }, { "content": " def get_sensu_host(self):\n \"\"\"Get the host that we should send sensu events to.\n\n :returns: the sensu_host string, or localhost if not specified.\n \"\"\"\n return self.get('sensu_host', 'localhost')", "metadata": "root.SystemPaastaConfig.get_sensu_host", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 814 }, { "content": " def get_sensu_port(self):\n \"\"\"Get the port that we should send sensu events to.\n\n :returns: the sensu_port value as an integer, or 3030 if not specified.\n \"\"\"\n return int(self.get('sensu_port', 3030))", "metadata": "root.SystemPaastaConfig.get_sensu_port", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 821 }, { "content": " def get_dockercfg_location(self):\n \"\"\"Get the location of the dockerfile, as a URI.\n\n :returns: the URI specified, or file:///root/.dockercfg if not specified.\n \"\"\"\n return self.get('dockercfg_location', DEFAULT_DOCKERCFG_LOCATION)", "metadata": "root.SystemPaastaConfig.get_dockercfg_location", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 828 }, { "content": " def get_synapse_port(self):\n \"\"\"Get the port that haproxy-synapse exposes its status on. Defaults to 3212.\n\n :returns: the haproxy-synapse status port.\"\"\"\n return int(self.get('synapse_port', 3212))", "metadata": "root.SystemPaastaConfig.get_synapse_port", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 835 }, { "content": " def get_default_synapse_host(self):\n \"\"\"Get the default host we should interrogate for haproxy-synapse state.\n\n :returns: A hostname that is running haproxy-synapse.\"\"\"\n return self.get('synapse_host', 'localhost')", "metadata": "root.SystemPaastaConfig.get_default_synapse_host", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 841 }, { "content": " def get_synapse_haproxy_url_format(self):\n \"\"\"Get a format string for the URL to query for haproxy-synapse state. This format string gets two keyword\n arguments, host and port. Defaults to \"http://{host:s}:{port:d}/;csv;norefresh\".\n\n :returns: A format string for constructing the URL of haproxy-synapse's status page.\"\"\"\n return self.get('synapse_haproxy_url_format', DEFAULT_SYNAPSE_HAPROXY_URL_FORMAT)", "metadata": "root.SystemPaastaConfig.get_synapse_haproxy_url_format", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 847 }, { "content": " def get_cluster_autoscaling_resources(self):\n return self.get('cluster_autoscaling_resources', {})", "metadata": "root.SystemPaastaConfig.get_cluster_autoscaling_resources", "header": "['class', 'SystemPaastaConfig', '(', 'dict', ')', ':', '___EOS___']", "index": 854 } ]
[ { "span": "class InstanceConfig(dict):", "start_line": 78, "start_column": 0, "end_line": 78, "end_column": 27 }, { "span": "class SystemPaastaConfig(dict):", "start_line": 709, "start_column": 0, "end_line": 709, "end_column": 31 } ]
[ { "span": "self.config_dict ", "start_line": 81, "start_column": 8, "end_line": 81, "end_column": 24 }, { "span": "self.branch_dict ", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 24 }, { "span": "self.cluster ", "start_line": 83, "start_column": 8, "end_line": 83, "end_column": 20 }, { "span": "self.instance ", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 21 }, { "span": "self.service ", "start_line": 85, "start_column": 8, "end_line": 85, "end_column": 20 }, { "span": "self.directory ", "start_line": 712, "start_column": 8, "end_line": 712, "end_column": 22 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Config_", "(_", "dict_", ")_", ":_", "\\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_", ",_", "cluster_", ",_", "instance_", ",_", "service_", ",_", "config", "\\u", "dict_", ",_", "branch", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config", "\\u", "dict_", "=_", "config", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "branch", "\\u", "dict_", "=_", "branch", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cluster_", "=_", "cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "=_", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "service_", "=_", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "interpolati", "on", "\\u", "keys_", "=_", "(_", "'", "deploy", "\\u", "group", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interpolati", "on", "\\u", "facts_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "interpolati", "on", "\\u", "facts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "config", "\\u", "interpolati", "on", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "self_", "._", "config", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config", "\\u", "dict_", "[_", "key_", "]_", "=_", "self_", "._", "config", "\\u", "dict_", "[_", "key_", "]_", "._", "format_", "(_", "**_", "interpolati", "on", "\\u", "facts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "interpolati", "on", "\\u", "facts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cluster", "'_", ":_", "self_", "._", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "'_", ":_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "'_", ":_", "self_", "._", "service_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cluster_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "instance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "service_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "branch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SPACE", "R_", "._", "join_", "(_", "(_", "self_", "._", "get", "\\u", "cluster_", "(_", ")_", ",_", "self_", "._", "get", "\\u", "instance_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "deploy", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "deploy", "\\u", "group", "'_", ",_", "self_", "._", "get", "\\u", "branch_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "mem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "the", " ", "memory", " ", "require", "d", " ", "from", " ", "the", " ", "service", "'", "s", " ", "configura", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "1024", " ", "(", "1", "G", ")", " ", "if", " ", "no", " ", "value", " ", "specified", " ", "in", " ", "the", " ", "config", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "amo", "unt", " ", "of", " ", "memory", " ", "specified", " ", "by", " ", "the", " ", "config", ",", " ", "1024", " ", "if", " ", "not", " ", "specified", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem_", "=_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "mem", "'_", ",_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "mem", "\\u", "swap_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "the", " ", "memory", "-", "swap", " ", "value", ".", " ", "Thi", "s", " ", "value", " ", "is", " ", "pass", "ed", " ", "to", " ", "the", " ", "docker", "\\", "10", ";", " ", " ", " ", " ", "container", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "total", " ", "memory", " ", "limit", " ", "(", "memory", " ", "+", " ", "swap", ")", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "value", " ", "as", " ", "the", " ", "'", "mem", "'", " ", "key", " ", "in", " ", "soa", "-", "configs", ".", " ", "Not", "e", " ", "-", " ", "this", " ", "value", " ", "*", "has", "*", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "be", " ", ">=", " ", "to", " ", "the", " ", "mem", " ", "key", ",", " ", "so", " ", "we", " ", "alw", "ay", "s", " ", "round", " ", "up", " ", "to", " ", "the", " ", "closest", " ", "MB", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem_", "=_", "self_", "._", "get", "\\u", "mem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem", "\\u", "swap_", "=_", "int_", "(_", "math_", "._", "ceil_", "(_", "mem_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "sm", "\"_", "%_", "mem", "\\u", "swap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cpus_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "the", " ", "number", " ", "of", " ", "cpus", " ", "require", "d", " ", "from", " ", "the", " ", "service", "'", "s", " ", "configura", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", ".2", "5", " ", "(", "1", "/", "4", " ", "of", " ", "a", " ", "cpu", ")", " ", "if", " ", "no", " ", "value", " ", "specified", " ", "in", " ", "the", " ", "config", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "number", " ", "of", " ", "cpus", " ", "specified", " ", "in", " ", "the", " ", "config", ",", " ", ".2", "5", " ", "if", " ", "not", " ", "specified", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpus_", "=_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "cpus", "'_", ",_", ".25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "disk_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "the", " ", " ", "amo", "unt", " ", "of", " ", "disk", " ", "space", " ", "require", "d", " ", "from", " ", "the", " ", "service", "'", "s", " ", "configura", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "1024", " ", "(", "1", "G", ")", " ", "if", " ", "no", " ", "value", " ", "is", " ", "specified", " ", "in", " ", "the", " ", "config", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "amo", "unt", " ", "of", " ", "disk", " ", "space", " ", "specified", " ", "by", " ", "the", " ", "config", ",", " ", "1024", " ", "if", " ", "not", " ", "specified", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "=_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "disk", "'_", ",_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "disk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cmd_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "docker", " ", "cmd", " ", "specified", " ", "in", " ", "the", " ", "service", "'", "s", " ", "configura", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "null", " ", "if", " ", "not", " ", "specified", " ", "in", " ", "the", " ", "config", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "A", " ", "string", " ", "specified", " ", "in", " ", "the", " ", "config", ",", " ", "Non", "e", " ", "if", " ", "not", " ", "specified", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "cmd", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "env", "\\u", "dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "dictionar", "y", " ", "of", " ", "key", "/", "value", " ", "pair", "s", " ", "tha", "t", " ", "represent", " ", "environ", "ment", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "injected", " ", "to", " ", "the", " ", "container", " ", "environ", "ment", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "PA", "AST", "A", "\\u", "SERV", "ICE", "\"_", ":_", "self_", "._", "service_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "PA", "AST", "A", "\\u", "INSTANCE", "\"_", ":_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "PA", "AST", "A", "\\u", "CLUSTER", "\"_", ":_", "self_", "._", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "env_", "=_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "env", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "update_", "(_", "user", "\\u", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "env_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Basic", " ", "get", "\\u", "env", " ", "tha", "t", " ", "simp", "ly", " ", "return", "s", " ", "the", " ", "basic", " ", "env", ",", " ", "other", " ", "classe", "s", "\\", "10", ";", " ", " ", " ", " ", "mig", "ht", " ", "need", " ", "to", " ", "override", " ", "this", " ", "getter", " ", "for", " ", "more", " ", "implementation", "-", "specific", "\\", "10", ";", " ", " ", " ", " ", "env", " ", "getti", "ng", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get", "\\u", "env", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "docker", " ", "args", " ", "specified", " ", "in", " ", "the", " ", "service", "'", "s", " ", "configura", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "not", " ", "specified", " ", "in", " ", "the", " ", "config", " ", "and", " ", "if", " ", "cmd", " ", "is", " ", "not", " ", "specified", ",", " ", "default", "s", " ", "to", " ", "an", " ", "empty", " ", "array", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "not", " ", "specified", " ", "in", " ", "the", " ", "config", " ", "but", " ", "cmd", " ", "is", " ", "specified", ",", " ", "default", "s", " ", "to", " ", "null", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "specified", " ", "in", " ", "the", " ", "config", " ", "and", " ", "if", " ", "cmd", " ", "is", " ", "als", "o", " ", "specified", ",", " ", "throw", "s", " ", "an", " ", "exception", ".", " ", "On", "ly", " ", "one", " ", "may", " ", "be", " ", "specified", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "service", "\\u", "config", ":", " ", "The", " ", "service", " ", "instance", "'", "s", " ", "configura", "tion", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "An", " ", "array", " ", "of", " ", "args", " ", "specified", " ", "in", " ", "the", " ", "config", ",", "\\", "10", ";", " ", " ", " ", " ", "``[", "]``", " ", "if", " ", "not", " ", "specified", " ", "and", " ", "if", " ", "cmd", " ", "is", " ", "not", " ", "specified", ",", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", " ", "Non", "e", " ", "if", " ", "not", " ", "specified", " ", "but", " ", "cmd", " ", "is", " ", "specified", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "get", "\\u", "cmd_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "args", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "args", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "validation", " ", "stu", "ff", " ", "like", " ", "this", " ", "shou", "ld", " ", "be", " ", "moved", " ", "int", "o", " ", "a", " ", "check", "\\u*", " ", "like", " ", "in", " ", "chrono", "s", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Insta", "nce", "Config_", "(_", "'", "Insta", "nce", " ", "configura", "tion", " ", "can", " ", "speci", "fy", " ", "cmd", " ", "or", " ", "args", ",", " ", "but", " ", "not", " ", "bot", "h", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\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_", "get", "\\u", "monitorin", "g_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "monitorin", "g", " ", "override", "s", " ", "defin", "ed", " ", "for", " ", "the", " ", "give", "n", " ", "instance", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "monitorin", "g", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "deploy", "\\u", "blacklist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "deploy", " ", "blacklist", " ", "is", " ", "a", " ", "list", " ", "of", " ", "lists", ",", " ", "where", " ", "the", " ", "lists", " ", "indicat", "e", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "location", "s", " ", "the", " ", "service", " ", "shou", "ld", " ", "not", " ", "be", " ", "deploye", "d", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "deploy", "\\u", "blacklist", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "deploy", "\\u", "whitelist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "deploy", " ", "whitelist", " ", "is", " ", "a", " ", "list", " ", "of", " ", "lists", ",", " ", "where", " ", "the", " ", "lists", " ", "indicat", "e", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "location", "s", " ", "are", " ", "explicit", "ly", " ", "allow", "ed", ".", " ", " ", "The", " ", "blacklist", " ", "will", " ", "supers", "ede", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "if", " ", "a", " ", "host", " ", "matche", "s", " ", "bot", "h", " ", "the", " ", "white", " ", "and", " ", "blacklist", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "deploy", "\\u", "whitelist", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "monitorin", "g", "\\u", "blacklist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "monitorin", "g", "\\u", "blacklist", " ", "is", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", ",", " ", "where", " ", "the", " ", "tuple", "s", " ", "indicat", "e", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "location", "s", " ", "the", " ", "user", " ", "doe", "sn", "'", "t", " ", "care", " ", "to", " ", "be", " ", "monitored", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "monitorin", "g", "\\u", "blacklist", "'_", ",_", "self_", "._", "get", "\\u", "deploy", "\\u", "blacklist_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "docker", "\\u", "image_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "docker", " ", "image", " ", "name", " ", "(", "with", " ", "tag", ")", " ", "for", " ", "a", " ", "give", "n", " ", "service", " ", "branch", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "generat", "ed", " ", "deployments", ".", "json", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "branch", "\\u", "dict_", "._", "get_", "(_", "'", "docker", "\\u", "image", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "desi", "red", "\\u", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "desi", "red", " ", "state", " ", "(", "eit", "her", " ", "'", "start", "'", " ", "or", " ", "'", "stop", "')", " ", "for", " ", "a", " ", "give", "n", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "branch", " ", "from", " ", "a", " ", "generat", "ed", " ", "deployments", ".", "json", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "branch", "\\u", "dict_", "._", "get_", "(_", "'", "desi", "red", "\\u", "state", "'_", ",_", "'", "start", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "force", "\\u", "bounce", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "force", "\\u", "bounce", " ", "token", " ", "for", " ", "a", " ", "give", "n", " ", "service", " ", "branch", " ", "from", " ", "a", " ", "generat", "ed", "\\", "10", ";", " ", " ", " ", " ", "deployments", ".", "json", " ", "file", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "token", " ", "tha", "t", ",", " ", "whe", "n", " ", "change", "d", ",", " ", "indicat", "es", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "instance", " ", "shou", "ld", " ", "be", " ", "recreate", "d", " ", "and", " ", "bounce", "d", ",", " ", "even", " ", "if", " ", "no", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "parameter", "s", " ", "have", " ", "change", "d", ".", " ", "Thi", "s", " ", "may", " ", "be", " ", "Non", "e", " ", "or", " ", "a", " ", "string", ",", " ", "genera", "ll", "y", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "timestamp", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "branch", "\\u", "dict_", "._", "get_", "(_", "'", "force", "\\u", "bounce", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "cpus_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpus_", "=_", "self_", "._", "get", "\\u", "cpus_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cpus_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "cpus_", ",_", "(_", "float_", ",_", "int_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "'", "The", " ", "specified", " ", "cpus", " ", "value", " ", "\"%", "s", "\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "float", " ", "or", " ", "int", ".'_", "%_", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "mem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mem_", "=_", "self_", "._", "get", "\\u", "mem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mem_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "mem_", ",_", "(_", "float_", ",_", "int_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "'", "The", " ", "specified", " ", "mem", " ", "value", " ", "\"%", "s", "\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "float", " ", "or", " ", "int", ".'_", "%_", "mem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "disk_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "disk_", "=_", "self_", "._", "get", "\\u", "disk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "disk_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "disk_", ",_", "(_", "float_", ",_", "int_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "'", "The", " ", "specified", " ", "disk", " ", "value", " ", "\"%", "s", "\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "float", " ", "or", " ", "int", ".'_", "%_", "disk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check_", "(_", "self_", ",_", "param_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "methods_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpus", "'_", ":_", "self_", "._", "check", "\\u", "cpus_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mem", "'_", ":_", "self_", "._", "check", "\\u", "mem_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "param_", "in_", "check", "\\u", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "check", "\\u", "methods_", "[_", "param_", "]_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "'", "You", "r", " ", "Chro", "nos", " ", "config", " ", "speci", "fie", "s", " ", "\"%", "s", "\",", " ", "an", " ", "unsup", "porte", "d", " ", "parameter", ".'_", "%_", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\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_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "msgs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param_", "in_", "[_", "'", "cpus", "'_", ",_", "'", "mem", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "passed_", ",_", "check", "\\u", "msg_", "=_", "self_", "._", "check_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check", "\\u", "passed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "msgs_", "._", "append_", "(_", "check", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "error", "\\u", "msgs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "extra", "\\u", "volumes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Extra", " ", "volume", "s", " ", "are", " ", "a", " ", "special", "ly", " ", "format", "ted", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "tha", "t", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "bind", " ", "mounte", "d", " ", "in", " ", "a", " ", "container", " ", "The", " ", "format", " ", "of", " ", "the", " ", "dictionar", "ies", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "conform", " ", "to", " ", "the", " ", "`", "Mes", "os", " ", "container", " ", "volume", "s", " ", "spec", "\\", "10", ";", " ", " ", " ", " ", "<", "https", "://", "mesos", "pher", "e", ".", "git", "hub", ".", "io", "/", "marathon", "/", "docs", "/", "nativ", "e-", "docker", ".", "html", ">`\\u", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "extra", "\\u", "volume", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "pool_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Whi", "ch", " ", "pool", " ", "of", " ", "nodes", " ", "this", " ", "job", " ", "shou", "ld", " ", "run", " ", "on", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "mit", "igat", "e", " ", "noisy", " ", "neighbor", "s", ",", " ", "by", " ", "put", "ting", "\\", "10", ";", " ", " ", " ", " ", "partic", "ular", "ly", " ", "noisy", " ", "or", " ", "noise", "-", "sensi", "tiv", "e", " ", "jobs", " ", "int", "o", " ", "different", " ", "pools", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "implemented", " ", "with", " ", "an", " ", "attribute", " ", "\"", "pool", "\"", " ", "on", " ", "each", " ", "mesos", " ", "slave", " ", "and", " ", "by", " ", "addin", "g", " ", "a", " ", "constraint", " ", "to", " ", "Mar", "athon", "/", "Chro", "nos", "\\", "10", ";", " ", " ", " ", " ", "applica", "tion", " ", "defin", "ed", " ", "by", " ", "this", " ", "instance", " ", "config", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Event", "ual", "ly", " ", "this", " ", "may", " ", "be", " ", "implemented", " ", "with", " ", "Mes", "os", " ", "role", "s", ",", " ", "onc", "e", " ", "a", " ", "frame", "work", " ", "can", " ", "register", " ", "under", " ", "multiple", " ", "role", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "\"", "pool", "\"", " ", "attribute", " ", "in", " ", "your", " ", "config", " ", "dict", ",", " ", "or", " ", "the", " ", "string", " ", "\"", "default", "\"", " ", "if", " ", "not", " ", "specified", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "pool", "'_", ",_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "net_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "docker", " ", "networking", " ", "mode", " ", "the", " ", "container", " ", "shou", "ld", " ", "be", " ", "start", "ed", " ", "with", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "config", "\\u", "dict_", "._", "get_", "(_", "'", "net", "'_", ",_", "'", "bridge", "'_", ")_", "\\u\\u\\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_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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_", ",_", "config_", ",_", "directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "directory_", "=_", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "System", "Pa", "asta", "Config_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "zk", "\\u", "hosts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "zk", "\\u", "host", "s", " ", "defin", "ed", " ", "in", " ", "this", " ", "host", "s", "'", "s", " ", "cluster", " ", "config", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "Strip", "s", " ", "off", " ", "the", " ", "zk", "://", " ", "prefix", ",", " ", "if", " ", "it", " ", "exist", "s", ",", " ", "for", " ", "use", " ", "with", " ", "Ka", "zoo", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "zk", "\\u", "host", "s", " ", "specified", " ", "in", " ", "the", " ", "paasta", " ", "configura", "tion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hosts_", "=_", "self_", "[_", "'", "zookeeper", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "zookeeper", " ", "connecti", "on", " ", "string", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "how", " ", "do", " ", "python", " ", "string", "s", " ", "not", " ", "have", " ", "a", " ", "method", " ", "for", " ", "doi", "ng", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hosts_", "._", "startswith_", "(_", "'", "zk", "://'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hosts_", "[_", "len_", "(_", "'", "zk", "://'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "hosts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "docker", "\\u", "registry_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "docker", "\\u", "registr", "y", " ", "defin", "ed", " ", "in", " ", "this", " ", "host", "'", "s", " ", "cluster", " ", "config", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "docker", "\\u", "registr", "y", " ", "specified", " ", "in", " ", "the", " ", "paasta", " ", "configura", "tion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "'", "docker", "\\u", "registr", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "docker", " ", "registr", "y", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "volumes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "volume", "s", " ", "defin", "ed", " ", "in", " ", "this", " ", "host", "'", "s", " ", "volume", "s", " ", "config", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "list", " ", "of", " ", "volume", "s", " ", "specified", " ", "in", " ", "the", " ", "paasta", " ", "configura", "tion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "'", "volume", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "volume", "s", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "cluster_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "cluster", " ", "defin", "ed", " ", "in", " ", "this", " ", "host", "'", "s", " ", "cluster", " ", "config", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "cluster", " ", "defin", "ed", " ", "in", " ", "the", " ", "paasta", " ", "configura", "tion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "'", "cluster", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "cluster", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "scri", "be", "\\u", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "scri", "be", "\\u", "map", " ", "out", " ", "of", " ", "the", " ", "paasta", " ", "config", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "scri", "be", "\\u", "map", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "'", "scri", "be", "\\u", "map", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "scri", "be", "\\u", "map", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "fsm", "\\u", "cluster", "\\u", "map_", "(_", "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_", "[_", "'", "fsm", "\\u", "cluster", "\\u", "map", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "fsm", "\\u", "cluster", "\\u", "map", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "dash", "board", "\\u", "links_", "(_", "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_", "[_", "'", "dash", "board", "\\u", "link", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "dash", "board", "\\u", "link", "s", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "fsm", "\\u", "deploy", "\\u", "pipeline_", "(_", "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_", "[_", "'", "fsm", "\\u", "deploy", "\\u", "pipeline", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "fsm", "\\u", "deploy", "\\u", "pipeline", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "log", "\\u", "writer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "log", "\\u", "writer", " ", "configura", "tion", " ", "out", " ", "of", " ", "global", " ", "paasta", " ", "config", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "The", " ", "log", "\\u", "writer", " ", "dictionar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "'", "log", "\\u", "writer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "log", "\\u", "writer", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "log", "\\u", "reader_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "log", "\\u", "reader", " ", "configura", "tion", " ", "out", " ", "of", " ", "global", " ", "paasta", " ", "config", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "log", "\\u", "reader", " ", "dictionar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "'", "log", "\\u", "reader", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Pa", "asta", "Not", "Configure", "d", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "log", "\\u", "reader", " ", "in", " ", "configura", "tion", " ", "director", "y", ":", " ", "%", "s", "'_", "%_", "self_", "._", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\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", "sens", "u\\u", "host_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "host", " ", "tha", "t", " ", "we", " ", "shou", "ld", " ", "send", " ", "sens", "u", " ", "events", " ", "to", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "sens", "u\\u", "host", " ", "string", ",", " ", "or", " ", "local", "host", " ", "if", " ", "not", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "'", "sens", "u\\u", "host", "'_", ",_", "'", "local", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sens", "u\\u", "port_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "port", " ", "tha", "t", " ", "we", " ", "shou", "ld", " ", "send", " ", "sens", "u", " ", "events", " ", "to", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "sens", "u\\u", "port", " ", "value", " ", "as", " ", "an", " ", "integ", "er", ",", " ", "or", " ", "303", "0", " ", "if", " ", "not", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "self_", "._", "get_", "(_", "'", "sens", "u\\u", "port", "'_", ",_", "303", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "docker", "cfg", "\\u", "location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "location", " ", "of", " ", "the", " ", "dockerfile", ",", " ", "as", " ", "a", " ", "URI", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "URI", " ", "specified", ",", " ", "or", " ", "file", ":///", "root", "/.", "docker", "cfg", " ", "if", " ", "not", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "'", "docker", "cfg", "\\u", "location", "'_", ",_", "DEF", "AUL", "T", "\\u", "DOCKER", "CF", "G", "\\u", "LOCATION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "synapse", "\\u", "port_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "port", " ", "tha", "t", " ", "haproxy", "-", "synapse", " ", "expos", "es", " ", "its", " ", "status", " ", "on", ".", " ", "Default", "s", " ", "to", " ", "321", "2", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "haproxy", "-", "synapse", " ", "status", " ", "port", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "self_", "._", "get_", "(_", "'", "synapse", "\\u", "port", "'_", ",_", "321", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "synapse", "\\u", "host_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "default", " ", "host", " ", "we", " ", "shou", "ld", " ", "inter", "rog", "ate", " ", "for", " ", "haproxy", "-", "synapse", " ", "state", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "A", " ", "host", "name", " ", "tha", "t", " ", "is", " ", "runn", "ing", " ", "haproxy", "-", "synapse", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "'", "synapse", "\\u", "host", "'_", ",_", "'", "local", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "synapse", "\\u", "haproxy", "\\u", "url", "\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "format", " ", "string", " ", "for", " ", "the", " ", "URL", " ", "to", " ", "query", " ", "for", " ", "haproxy", "-", "synapse", " ", "state", ".", " ", "Thi", "s", " ", "format", " ", "string", " ", "gets", " ", "two", " ", "keyw", "ord", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", "s", ",", " ", "host", " ", "and", " ", "port", ".", " ", "Default", "s", " ", "to", " ", "\"", "http", "://", "{", "host", ":", "s", "}:", "{", "port", ":", "d", "}/", ";", "csv", ";", "nore", "fresh", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "A", " ", "format", " ", "string", " ", "for", " ", "constructi", "ng", " ", "the", " ", "URL", " ", "of", " ", "haproxy", "-", "synapse", "'", "s", " ", "status", " ", "page", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "'", "synapse", "\\u", "haproxy", "\\u", "url", "\\u", "format", "'_", ",_", "DEF", "AUL", "T", "\\u", "SYN", "APS", "E", "\\u", "HA", "PROX", "Y", "\\u", "URL", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Pa", "asta", "Config_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cluster", "\\u", "autoscaling", "\\u", "resources_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get_", "(_", "'", "cluster", "\\u", "autoscaling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[ { "content": "#!/usr/bin/python\n\n\"\"\"\nCheck HTTP JSON Nagios Plugin\n\nGeneric Nagios plugin which checks json values from a given endpoint against argument specified rules\nand determines the status and performance data for that service.\n\"\"\"\n\nimport httplib, urllib, urllib2, base64\nimport json\nimport argparse\nimport sys\nfrom pprint import pprint\nfrom urllib2 import HTTPError\nfrom urllib2 import URLError\n\n# TEST = False\n\n\nOK_CODE = 0\nWARNING_CODE = 1\nCRITICAL_CODE = 2\nUNKNOWN_CODE = 3\n\n\n\n\n\n\n\nif __name__ == \"__main__\" and len(sys.argv) >= 2 and sys.argv[1] == 'UnitTest':\n\timport unittest\n\tunittest.main()\n\texit(0)\n\n\"\"\"Program entry point\"\"\"\nif __name__ == \"__main__\":\n\targs = parseArgs()\n\tnagios = NagiosHelper()\n\tif args.ssl:\n\t\turl = \"https://%s\" % args.host\n\telse:\n\t\turl = \"http://%s\" % args.host\n\tif args.port: url += \":%s\" % args.port\n\tif args.path: url += \"/%s\" % args.path\n\tdebugPrint(args.debug, \"url:%s\" % url)\n\t# Attempt to reach the endpoint\n\ttry:\n\t\treq = urllib2.Request(url)\n\t\tif args.auth:\n\t\t\tbase64str = base64.encodestring(args.auth).replace('\\n', '')\n\t\t\treq.add_header('Authorization', 'Basic %s' % base64str)\n\t\tif args.headers:\n\t\t\theaders=json.loads(args.headers)\n\t\t\tdebugPrint(args.debug, \"Headers:\\n %s\" % headers)\n\t\t\tfor header in headers:\n\t\t\t\treq.add_header(header, headers[header])\n\t\tif args.timeout and args.data:\n\t\t\tresponse = urllib2.urlopen(req, timeout=args.timeout, data=args.data)\n\t\telif args.timeout:\n\t\t\tresponse = urllib2.urlopen(req, timeout=args.timeout)\n\t\telif args.data:\n\t\t\tresponse = urllib2.urlopen(req, data=args.data)\n\t\telse:\n\t\t\tresponse = urllib2.urlopen(req)\n\texcept HTTPError as e:\n\t\tnagios.append_unknown(\"HTTPError[%s], url:%s\" % (str(e.code), url))\n\texcept URLError as e:\n\t\tnagios.append_critical(\"URLError[%s], url:%s\" % (str(e.reason), url))\n\telse:\n\t\tjsondata = response.read()\n\t\tdata = json.loads(jsondata)\n\t\tdebugPrint(args.debug, 'json:')\n\t\tdebugPrint(args.debug, data, True)\n\t\t# Apply rules to returned JSON data\n\t\tprocessor = JsonRuleProcessor(data, args)\n\t\tnagios.append_warning(processor.checkWarning())\n\t\tnagios.append_critical(processor.checkCritical())\n\t\tnagios.append_metrics(processor.checkMetrics())\n\t# Print Nagios specific string and exit appropriately\n\tprint nagios.getMessage()\n\texit(nagios.getCode())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "\tdef getMessage(self):\n\t\t\"\"\"Build a status-prefixed message with optional performance data generated externally\"\"\"\n\t\ttext = \"%s: Status %s.\" % (self.message_prefixes[self.getCode()], self.message_prefixes[self.getCode()])\n\t\ttext += self.warning_message\n\t\ttext += self.critical_message\n\t\ttext += self.unknown_message\n\t\tif self.performance_data:\n\t\t\ttext += \"|%s\" % self.performance_data\n\t\treturn text", "metadata": "root.NagiosHelper.getMessage", "header": "['class', 'NagiosHelper', ':', '___EOS___']", "index": 33 }, { "content": "\tdef getCode(self):\n\t\tcode = OK_CODE\n\t\tif (self.warning_message != ''):\n\t\t\tcode = WARNING_CODE\n\t\tif (self.critical_message != ''):\n\t\t\tcode = CRITICAL_CODE\n\t\tif (self.unknown_message != ''):\n\t\t\tcode = UNKNOWN_CODE\n\t\treturn code", "metadata": "root.NagiosHelper.getCode", "header": "['class', 'NagiosHelper', ':', '___EOS___']", "index": 43 }, { "content": "\tdef append_warning(self, warning_message):\n\t\tself.warning_message += warning_message", "metadata": "root.NagiosHelper.append_warning", "header": "['class', 'NagiosHelper', ':', '___EOS___']", "index": 53 }, { "content": "\tdef append_critical(self, critical_message):\n\t\tself.critical_message += critical_message", "metadata": "root.NagiosHelper.append_critical", "header": "['class', 'NagiosHelper', ':', '___EOS___']", "index": 55 }, { "content": "\tdef append_unknown(self, unknown_message):\n\t\tself.critical_message += unknown_message", "metadata": "root.NagiosHelper.append_unknown", "header": "['class', 'NagiosHelper', ':', '___EOS___']", "index": 57 }, { "content": "\tdef append_metrics(self, (performance_data, warning_message, critical_message)):\n\t\tself.performance_data += performance_data\n\t\tself.append_warning(warning_message)\n\t\tself.append_critical(critical_message)", "metadata": "root.NagiosHelper.append_metrics", "header": "['class', 'NagiosHelper', ':', '___EOS___']", "index": 59 }, { "content": "\tdef __init__(self, json_data, rules_args):\n\t\tself.data = json_data\n\t\tself.rules = rules_args\n\t\tseparator = '.'\n\t\tif self.rules.separator: separator = self.rules.separator\n\t\tself.helper = JsonHelper(self.data, separator)\n\t\tdebugPrint(rules_args.debug, \"rules:%s\" % rules_args)\n\t\tdebugPrint(rules_args.debug, \"separator:%s\" % separator)", "metadata": "root.JsonRuleProcessor.__init__", "header": "['class', 'JsonRuleProcessor', ':', '___EOS___']", "index": 140 }, { "content": "\tdef checkWarning(self):\n\t\tfailure = ''\n\t\tif self.rules.key_threshold_warning != None:\n\t\t\tfailure += self.checkThresholds(self.rules.key_threshold_warning)\n\t\tif self.rules.key_value_list != None:\n\t\t\tfailure += self.checkEquality(self.rules.key_value_list)\n\t\tif self.rules.key_list != None:\n\t\t\tfailure += self.checkExists(self.rules.key_list)\n\t\treturn failure", "metadata": "root.JsonRuleProcessor.checkWarning", "header": "['class', 'JsonRuleProcessor', ':', '___EOS___']", "index": 206 }, { "content": "\tdef checkCritical(self):\n\t\tfailure = ''\n\t\tif self.rules.key_threshold_critical != None:\n\t\t\tfailure += self.checkThresholds(self.rules.key_threshold_critical)\n\t\tif self.rules.key_value_list_critical != None:\n\t\t\tfailure += self.checkEquality(self.rules.key_value_list_critical)\n\t\tif self.rules.key_list_critical != None:\n\t\t\tfailure += self.checkExists(self.rules.key_list_critical)\n\t\treturn failure", "metadata": "root.JsonRuleProcessor.checkCritical", "header": "['class', 'JsonRuleProcessor', ':', '___EOS___']", "index": 216 }, { "content": "\tdef checkMetrics(self):\n\t\t\"\"\"Return a Nagios specific performance metrics string given keys and parameter definitions\"\"\"\n\t\tmetrics = ''\n\t\twarning = ''\n\t\tcritical = ''\n\t\tif self.rules.metric_list != None:\n\t\t\tfor metric in self.rules.metric_list:\n\t\t\t\tkey = metric\n\t\t\t\tminimum = maximum = warn_range = crit_range = None\n\t\t\t\tuom = ''\n\t\t\t\tif ',' in metric:\n\t\t\t\t\tvals = metric.split(',')\n\t\t\t\t\tif len(vals) == 2:\n\t\t\t\t\t\tkey,uom = vals\n\t\t\t\t\tif len(vals) == 4:\n\t\t\t\t\t\tkey,uom,warn_range,crit_range = vals\n\t\t\t\t\tif len(vals) == 6:\n\t\t\t\t\t\tkey,uom,warn_range,crit_range,minimum,maximum = vals\n\t\t\t\tkey, alias = _getKeyAlias(key)\n\t\t\t\tif self.helper.exists(key):\n\t\t\t\t\tmetrics += \"'%s'=%s\" % (alias, self.helper.get(key))\n\t\t\t\t\tif uom: metrics += uom\n\t\t\t\t\tif warn_range != None:\n\t\t\t\t\t\twarning += self.checkThreshold(key, alias, warn_range)\n\t\t\t\t\t\tmetrics += \";%s\" % warn_range\n\t\t\t\t\tif crit_range != None:\n\t\t\t\t\t\tcritical += self.checkThreshold(key, alias, crit_range)\n\t\t\t\t\t\tmetrics += \";%s\" % crit_range\n\t\t\t\t\tif minimum != None:\n\t\t\t\t\t\tcritical += self.checkThreshold(key, alias, minimum + ':')\n\t\t\t\t\t\tmetrics += \";%s\" % minimum\n\t\t\t\t\tif maximum != None:\n\t\t\t\t\t\tcritical += self.checkThreshold(key, alias, '~:' + maximum)\n\t\t\t\t\t\tmetrics += \";%s\" % maximum\n\t\t\t\tmetrics += ' '\n\t\treturn (\"%s\" % metrics, warning, critical)", "metadata": "root.JsonRuleProcessor.checkMetrics", "header": "['class', 'JsonRuleProcessor', ':', '___EOS___']", "index": 226 }, { "content": "def parseArgs():\n\tparser = argparse.ArgumentParser(description=\n\t\t\t'Nagios plugin which checks json values from a given endpoint against argument specified rules\\\n\t\t\tand determines the status and performance data for that service')\n\n # parser.add_argument('-v', '--verbose', action='store_true', help='Verbose Output')\n\tparser.add_argument('-d', '--debug', action='store_true', help='Debug mode.')\n\tparser.add_argument('-s', '--ssl', action='store_true', help='HTTPS mode.')\n\tparser.add_argument('-H', '--host', dest='host', required=True, help='Host.')\n\tparser.add_argument('-P', '--port', dest='port', help='TCP port')\n\tparser.add_argument('-p', '--path', dest='path', help='Path.')\n\tparser.add_argument('-t', '--timeout', type=int, help='Connection timeout (seconds)')\n\tparser.add_argument('-B', '--basic-auth', dest='auth', help='Basic auth string \"username:password\"')\n\tparser.add_argument('-D', '--data', dest='data', help='The http payload to send as a POST')\n\tparser.add_argument('-A', '--headers', dest='headers', help='The http headers in JSON format.')\n\tparser.add_argument('-f', '--field_separator', dest='separator',\n\t\thelp='Json Field separator, defaults to \".\" ; Select element in an array with \"(\" \")\"')\n\tparser.add_argument('-w', '--warning', dest='key_threshold_warning', nargs='*',\n\t\thelp='Warning threshold for these values (key1[>alias],WarnRange key2[>alias],WarnRange). WarnRange is in the format [@]start:end, more information at nagios-plugins.org/doc/guidelines.html.')\n\tparser.add_argument('-c', '--critical', dest='key_threshold_critical', nargs='*',\n\t\thelp='Critical threshold for these values (key1[>alias],CriticalRange key2[>alias],CriticalRange. CriticalRange is in the format [@]start:end, more information at nagios-plugins.org/doc/guidelines.html.')\n\tparser.add_argument('-e', '--key_exists', dest='key_list', nargs='*',\n\t\thelp='Checks existence of these keys to determine status. Return warning if key is not present.')\n\tparser.add_argument('-E', '--key_exists_critical', dest='key_list_critical', nargs='*',\n\t\thelp='Same as -e but return critical if key is not present.')\n\tparser.add_argument('-q', '--key_equals', dest='key_value_list', nargs='*',\n\t\thelp='Checks equality of these keys and values (key[>alias],value key2,value2) to determine status.\\\n\t\tMultiple key values can be delimited with colon (key,value1:value2). Return warning if equality check fails')\n\tparser.add_argument('-Q', '--key_equals_critical', dest='key_value_list_critical', nargs='*',\n\t\thelp='Same as -q but return critical if equality check fails.')\n\tparser.add_argument('-m', '--key_metric', dest='metric_list', nargs='*',\n\t\thelp='Gathers the values of these keys (key[>alias],UnitOfMeasure,WarnRange,CriticalRange,Min,Max) for Nagios performance data.\\\n\t\tMore information about Range format and units of measure for nagios can be found at nagios-plugins.org/doc/guidelines.html\\\n\t\tAdditional formats for this parameter are: (key[>alias]), (key[>alias],UnitOfMeasure), (key[>alias],UnitOfMeasure,WarnRange,CriticalRange).')\n\n\treturn parser.parse_args()", "metadata": "root.parseArgs", "header": "['module', '___EOS___']", "index": 263 }, { "content": "def debugPrint(debug_flag, message, pretty_flag=False):\n\tif debug_flag:\n\t\tif pretty_flag:\n\t\t\tpprint(message)\n\t\telse:\n\t\t\tprint message", "metadata": "root.debugPrint", "header": "['module', '___EOS___']", "index": 300 }, { "content": "\t\tdef check_data(self, args, jsondata, code):\n\t\t\tdata = json.loads(jsondata)\n\t\t\tnagios = NagiosHelper()\n\t\t\tprocessor = JsonRuleProcessor(data, args)\n\t\t\tnagios.append_warning(processor.checkWarning())\n\t\t\tnagios.append_critical(processor.checkCritical())\n\t\t\tnagios.append_metrics(processor.checkMetrics())\n\t\t\tself.assertEqual(code, nagios.getCode())", "metadata": "root.UnitTest.check_data", "header": "['class', 'UnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 329 } ]
[ { "span": "nagios.append_metrics(processor.checkMetrics())", "start_line": 438, "start_column": 2, "end_line": 438, "end_column": 49 }, { "span": "nagios.append_metrics(processor.checkMetrics())", "start_line": 335, "start_column": 3, "end_line": 335, "end_column": 50 } ]
[ { "span": "def append_metrics(self, (performance_data, warning_message, critical_message)):", "start_line": 59, "start_column": 1, "end_line": 59, "end_column": 81 } ]
1
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "call_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Check", " ", "HTTP", " ", "JSO", "N", " ", "Nag", "ios", " ", "Plug", "in", "\\", "10", ";", "\\", "10", ";", "Gene", "ric", " ", "Nag", "ios", " ", "plugin", " ", "whi", "ch", " ", "checks", " ", "json", " ", "values", " ", "from", " ", "a", " ", "give", "n", " ", "endpoint", " ", "against", " ", "argu", "ment", " ", "specified", " ", "rule", "s", "\\", "10", ";", "and", " ", "dete", "rmin", "es", " ", "the", " ", "status", " ", "and", " ", "perform", "anc", "e", " ", "data", " ", "for", " ", "tha", "t", " ", "service", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "httplib_", ",_", "urllib_", ",_", "urllib2_", ",_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib2_", "import_", "HTTP", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib2_", "import_", "URL", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TEST", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OK", "\\u", "CODE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WARN", "ING", "\\u", "CODE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CRIT", "ICAL", "\\u", "CODE_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNK", "NOW", "N", "\\u", "CODE_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\"_", "and_", "len_", "(_", "sys_", "._", "argv_", ")_", ">=_", "2_", "and_", "sys_", "._", "argv_", "[_", "1_", "]_", "==_", "'", "Unit", "Test", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "Program", " ", "entry", " ", "point", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "args_", "=_", "parse", "Args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "=_", "Nag", "ios", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "ssl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "url_", "=_", "\"", "https", "://", "%", "s", "\"_", "%_", "args_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "url_", "=_", "\"", "http", "://", "%", "s", "\"_", "%_", "args_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "port_", ":_", "url_", "+=_", "\":", "%", "s", "\"_", "%_", "args_", "._", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "path_", ":_", "url_", "+=_", "\"/%", "s", "\"_", "%_", "args_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Print_", "(_", "args_", "._", "debug_", ",_", "\"", "url", ":", "%", "s", "\"_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "reach", " ", "the", " ", "endpoint_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "base64", "str_", "=_", "base64_", "._", "encodes", "tring_", "(_", "args_", "._", "auth_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "add", "\\u", "header_", "(_", "'", "Authoriz", "ation", "'_", ",_", "'", "Basic", " ", "%", "s", "'_", "%_", "base64", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "headers_", "=_", "json_", "._", "loads_", "(_", "args_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Print_", "(_", "args_", "._", "debug_", ",_", "\"", "Head", "ers", ":\\\\", "n", " ", "%", "s", "\"_", "%_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "header_", "in_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "req_", "._", "add", "\\u", "header_", "(_", "header_", ",_", "headers_", "[_", "header_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "timeout_", "and_", "args_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ",_", "timeout_", "=_", "args_", "._", "timeout_", ",_", "data_", "=_", "args_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ",_", "timeout_", "=_", "args_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ",_", "data_", "=_", "args_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "nagios", "_", "._", "append", "\\u", "unknown_", "(_", "\"", "HTTP", "Error", "[", "%", "s", "],", " ", "url", ":", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", "._", "code_", ")_", ",_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "nagios", "_", "._", "append", "\\u", "critical_", "(_", "\"", "URL", "Error", "[", "%", "s", "],", " ", "url", ":", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", "._", "reason_", ")_", ",_", "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\t", "\t_", "jsondata_", "=_", "response_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "jsondata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Print_", "(_", "args_", "._", "debug_", ",_", "'", "json", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Print_", "(_", "args_", "._", "debug_", ",_", "data_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Apply", " ", "rule", "s", " ", "to", " ", "return", "ed", " ", "JSO", "N", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "=_", "Js", "on", "Rule", "Processor_", "(_", "data_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "._", "append", "\\u", "warning_", "(_", "processor_", "._", "check", "Warning_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "._", "append", "\\u", "critical_", "(_", "processor_", "._", "check", "Crit", "ical_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "._", "append", "\\u", "metrics_", "(_", "processor_", "._", "check", "Metrics_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Print", " ", "Nag", "ios", " ", "specific", " ", "string", " ", "and", " ", "exit", " ", "appropr", "iate", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "nagios", "_", "._", "get", "Message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "nagios", "_", "._", "get", "Code_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Nag", "ios", "Helper_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Build", " ", "a", " ", "status", "-", "prefixed", " ", "message", " ", "with", " ", "option", "al", " ", "perform", "anc", "e", " ", "data", " ", "generat", "ed", " ", "external", "ly", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "\"%", "s", ":", " ", "Status", " ", "%", "s", ".\"_", "%_", "(_", "self_", "._", "message", "\\u", "prefixes_", "[_", "self_", "._", "get", "Code_", "(_", ")_", "]_", ",_", "self_", "._", "message", "\\u", "prefixes_", "[_", "self_", "._", "get", "Code_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "self_", "._", "warn", "ing", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "self_", "._", "critic", "al", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "self_", "._", "unknown", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "perform", "anc", "e\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "text_", "+=_", "\"|", "%", "s", "\"_", "%_", "self_", "._", "perform", "anc", "e\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nag", "ios", "Helper_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Code_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "code_", "=_", "OK", "\\u", "CODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "warn", "ing", "\\u", "message_", "!=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code_", "=_", "WARN", "ING", "\\u", "CODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "critic", "al", "\\u", "message_", "!=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code_", "=_", "CRIT", "ICAL", "\\u", "CODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "unknown", "\\u", "message_", "!=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code_", "=_", "UNK", "NOW", "N", "\\u", "CODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nag", "ios", "Helper_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "\\u", "warning_", "(_", "self_", ",_", "warn", "ing", "\\u", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "warn", "ing", "\\u", "message_", "+=_", "warn", "ing", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nag", "ios", "Helper_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "\\u", "critical_", "(_", "self_", ",_", "critic", "al", "\\u", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "critic", "al", "\\u", "message_", "+=_", "critic", "al", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nag", "ios", "Helper_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "\\u", "unknown_", "(_", "self_", ",_", "unknown", "\\u", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "critic", "al", "\\u", "message_", "+=_", "unknown", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nag", "ios", "Helper_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "\\u", "metrics_", "(_", "self_", ",_", "(_", "perform", "anc", "e\\u", "data_", ",_", "warn", "ing", "\\u", "message_", ",_", "critic", "al", "\\u", "message_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "perform", "anc", "e\\u", "data_", "+=_", "perform", "anc", "e\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "\\u", "warning_", "(_", "warn", "ing", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "\\u", "critical_", "(_", "critic", "al", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Rule", "Processor_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "json", "\\u", "data_", ",_", "rule", "s", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "data_", "=_", "json", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rules_", "=_", "rule", "s", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "separator_", "=_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "separator_", ":_", "separator_", "=_", "self_", "._", "rules_", "._", "separator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "=_", "Js", "on", "Helper_", "(_", "self_", "._", "data_", ",_", "separator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Print_", "(_", "rule", "s", "\\u", "args_", "._", "debug_", ",_", "\"", "rule", "s", ":", "%", "s", "\"_", "%_", "rule", "s", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Print_", "(_", "rule", "s", "\\u", "args_", "._", "debug_", ",_", "\"", "separator", ":", "%", "s", "\"_", "%_", "separator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Rule", "Processor_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Warning_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "failure_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "key", "\\u", "threshol", "d\\u", "warning_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "failure_", "+=_", "self_", "._", "check", "Thresh", "olds", "_", "(_", "self_", "._", "rules_", "._", "key", "\\u", "threshol", "d\\u", "warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "key", "\\u", "value", "\\u", "list_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "failure_", "+=_", "self_", "._", "check", "Equali", "ty_", "(_", "self_", "._", "rules_", "._", "key", "\\u", "value", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "key", "\\u", "list_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "failure_", "+=_", "self_", "._", "check", "Exists_", "(_", "self_", "._", "rules_", "._", "key", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "failure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Rule", "Processor_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Crit", "ical_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "failure_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "key", "\\u", "threshol", "d\\u", "critical_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "failure_", "+=_", "self_", "._", "check", "Thresh", "olds", "_", "(_", "self_", "._", "rules_", "._", "key", "\\u", "threshol", "d\\u", "critical_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "key", "\\u", "value", "\\u", "list", "\\u", "critical_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "failure_", "+=_", "self_", "._", "check", "Equali", "ty_", "(_", "self_", "._", "rules_", "._", "key", "\\u", "value", "\\u", "list", "\\u", "critical_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "key", "\\u", "list", "\\u", "critical_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "failure_", "+=_", "self_", "._", "check", "Exists_", "(_", "self_", "._", "rules_", "._", "key", "\\u", "list", "\\u", "critical_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "failure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Rule", "Processor_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Metrics_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "a", " ", "Nag", "ios", " ", "specific", " ", "perform", "anc", "e", " ", "metric", "s", " ", "string", " ", "give", "n", " ", "keys", " ", "and", " ", "parameter", " ", "definit", "ion", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warning_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "critical_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rules_", "._", "metric", "\\u", "list_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "metric_", "in_", "self_", "._", "rules_", "._", "metric", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "key_", "=_", "metric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minimum_", "=_", "maximum_", "=_", "warn", "\\u", "range_", "=_", "crit", "\\u", "range_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uo", "m_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "','_", "in_", "metric_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "vals_", "=_", "metric_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "vals_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "key_", ",_", "uo", "m_", "=_", "vals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "vals_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "key_", ",_", "uo", "m_", ",_", "warn", "\\u", "range_", ",_", "crit", "\\u", "range_", "=_", "vals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "vals_", ")_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "key_", ",_", "uo", "m_", ",_", "warn", "\\u", "range_", ",_", "crit", "\\u", "range_", ",_", "minimum_", ",_", "maximum_", "=_", "vals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", ",_", "alias_", "=_", "\\u", "get", "Key", "Alias_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "helper_", "._", "exists_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "metrics_", "+=_", "\"'", "%", "s", "'=", "%", "s", "\"_", "%_", "(_", "alias_", ",_", "self_", "._", "helper_", "._", "get_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uo", "m_", ":_", "metrics_", "+=_", "uo", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "warn", "\\u", "range_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "warning_", "+=_", "self_", "._", "check", "Threshold_", "(_", "key_", ",_", "alias_", ",_", "warn", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "+=_", "\";", "%", "s", "\"_", "%_", "warn", "\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "crit", "\\u", "range_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "critical_", "+=_", "self_", "._", "check", "Threshold_", "(_", "key_", ",_", "alias_", ",_", "crit", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "+=_", "\";", "%", "s", "\"_", "%_", "crit", "\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "minimum_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "critical_", "+=_", "self_", "._", "check", "Threshold_", "(_", "key_", ",_", "alias_", ",_", "minimum_", "+_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "+=_", "\";", "%", "s", "\"_", "%_", "minimum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "maximum_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "critical_", "+=_", "self_", "._", "check", "Threshold_", "(_", "key_", ",_", "alias_", ",_", "'", "~", ":'_", "+_", "maximum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "+=_", "\";", "%", "s", "\"_", "%_", "maximum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metrics_", "+=_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "\"%", "s", "\"_", "%_", "metrics_", ",_", "warning_", ",_", "critical_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Args_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nag", "ios", " ", "plugin", " ", "whi", "ch", " ", "checks", " ", "json", " ", "values", " ", "from", " ", "a", " ", "give", "n", " ", "endpoint", " ", "against", " ", "argu", "ment", " ", "specified", " ", "rule", "s", "\\\\", "\\", "10", ";", "\t\t\t", "and", " ", "dete", "rmin", "es", " ", "the", " ", "status", " ", "and", " ", "perform", "anc", "e", " ", "data", " ", "for", " ", "tha", "t", " ", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parser", ".", "add", "\\u", "argu", "ment", "('", "-", "v", "',", " ", "'--", "verbo", "se", "',", " ", "action", "='", "store", "\\u", "true", "',", " ", "help", "='", "Verbos", "e", " ", "Output", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "'--", "debug", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "help_", "=_", "'", "Deb", "ug", " ", "mode", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "s", "'_", ",_", "'--", "ssl", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "help_", "=_", "'", "HTTP", "S", " ", "mode", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "H", "'_", ",_", "'--", "host", "'_", ",_", "dest_", "=_", "'", "host", "'_", ",_", "required_", "=_", "True_", ",_", "help_", "=_", "'", "Host", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "P", "'_", ",_", "'--", "port", "'_", ",_", "dest_", "=_", "'", "port", "'_", ",_", "help_", "=_", "'", "TC", "P", " ", "port", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "p", "'_", ",_", "'--", "path", "'_", ",_", "dest_", "=_", "'", "path", "'_", ",_", "help_", "=_", "'", "Path", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "t", "'_", ",_", "'--", "timeo", "ut", "'_", ",_", "type_", "=_", "int_", ",_", "help_", "=_", "'", "Connect", "ion", " ", "timeo", "ut", " ", "(", "second", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "B", "'_", ",_", "'--", "basic", "-", "auth", "'_", ",_", "dest_", "=_", "'", "auth", "'_", ",_", "help_", "=_", "'", "Basic", " ", "auth", " ", "string", " ", "\"", "user", "name", ":", "password", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "D", "'_", ",_", "'--", "data", "'_", ",_", "dest_", "=_", "'", "data", "'_", ",_", "help_", "=_", "'", "The", " ", "http", " ", "payload", " ", "to", " ", "send", " ", "as", " ", "a", " ", "POST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "A", "'_", ",_", "'--", "header", "s", "'_", ",_", "dest_", "=_", "'", "header", "s", "'_", ",_", "help_", "=_", "'", "The", " ", "http", " ", "header", "s", " ", "in", " ", "JSO", "N", " ", "format", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "f", "'_", ",_", "'--", "field", "\\u", "separator", "'_", ",_", "dest_", "=_", "'", "separator", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Js", "on", " ", "Field", " ", "separator", ",", " ", "default", "s", " ", "to", " ", "\".", "\"", " ", ";", " ", "Select", " ", "element", " ", "in", " ", "an", " ", "array", " ", "with", " ", "\"(", "\"", " ", "\")", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "w", "'_", ",_", "'--", "warn", "ing", "'_", ",_", "dest_", "=_", "'", "key", "\\u", "threshol", "d\\u", "warn", "ing", "'_", ",_", "nargs_", "=_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Warn", "ing", " ", "threshol", "d", " ", "for", " ", "these", " ", "values", " ", "(", "key", "1", "[", ">", "alias", "],", "Warn", "Range", " ", "key", "2", "[", ">", "alias", "],", "Warn", "Range", ").", " ", "Warn", "Range", " ", "is", " ", "in", " ", "the", " ", "format", " ", "[", "@]", "start", ":", "end", ",", " ", "more", " ", "informati", "on", " ", "at", " ", "nagios", "-", "plugin", "s", ".", "org", "/", "doc", "/", "guide", "lines", ".", "html", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "c", "'_", ",_", "'--", "critic", "al", "'_", ",_", "dest_", "=_", "'", "key", "\\u", "threshol", "d\\u", "critic", "al", "'_", ",_", "nargs_", "=_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Crit", "ical", " ", "threshol", "d", " ", "for", " ", "these", " ", "values", " ", "(", "key", "1", "[", ">", "alias", "],", "Crit", "ical", "Range", " ", "key", "2", "[", ">", "alias", "],", "Crit", "ical", "Range", ".", " ", "Crit", "ical", "Range", " ", "is", " ", "in", " ", "the", " ", "format", " ", "[", "@]", "start", ":", "end", ",", " ", "more", " ", "informati", "on", " ", "at", " ", "nagios", "-", "plugin", "s", ".", "org", "/", "doc", "/", "guide", "lines", ".", "html", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "e", "'_", ",_", "'--", "key", "\\u", "exist", "s", "'_", ",_", "dest_", "=_", "'", "key", "\\u", "list", "'_", ",_", "nargs_", "=_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Check", "s", " ", "existence", " ", "of", " ", "these", " ", "keys", " ", "to", " ", "dete", "rmin", "e", " ", "status", ".", " ", "Return", " ", "warn", "ing", " ", "if", " ", "key", " ", "is", " ", "not", " ", "presen", "t", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "E", "'_", ",_", "'--", "key", "\\u", "exist", "s", "\\u", "critic", "al", "'_", ",_", "dest_", "=_", "'", "key", "\\u", "list", "\\u", "critic", "al", "'_", ",_", "nargs_", "=_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Sam", "e", " ", "as", " ", "-", "e", " ", "but", " ", "return", " ", "critic", "al", " ", "if", " ", "key", " ", "is", " ", "not", " ", "presen", "t", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "q", "'_", ",_", "'--", "key", "\\u", "equals", "'_", ",_", "dest_", "=_", "'", "key", "\\u", "value", "\\u", "list", "'_", ",_", "nargs_", "=_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Check", "s", " ", "equality", " ", "of", " ", "these", " ", "keys", " ", "and", " ", "values", " ", "(", "key", "[", ">", "alias", "],", "value", " ", "key", "2", ",", "value", "2", ")", " ", "to", " ", "dete", "rmin", "e", " ", "status", ".\\\\", "\\", "10", ";", "\t", "\t", "Multipl", "e", " ", "key", " ", "values", " ", "can", " ", "be", " ", "delim", "ited", " ", "with", " ", "colon", " ", "(", "key", ",", "value", "1", ":", "value", "2", ").", " ", "Return", " ", "warn", "ing", " ", "if", " ", "equality", " ", "check", " ", "fail", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "Q", "'_", ",_", "'--", "key", "\\u", "equals", "\\u", "critic", "al", "'_", ",_", "dest_", "=_", "'", "key", "\\u", "value", "\\u", "list", "\\u", "critic", "al", "'_", ",_", "nargs_", "=_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Sam", "e", " ", "as", " ", "-", "q", " ", "but", " ", "return", " ", "critic", "al", " ", "if", " ", "equality", " ", "check", " ", "fail", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "m", "'_", ",_", "'--", "key", "\\u", "metric", "'_", ",_", "dest_", "=_", "'", "metric", "\\u", "list", "'_", ",_", "nargs_", "=_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Gather", "s", " ", "the", " ", "values", " ", "of", " ", "these", " ", "keys", " ", "(", "key", "[", ">", "alias", "],", "Unit", "Of", "Measure", ",", "Warn", "Range", ",", "Crit", "ical", "Range", ",", "Min", ",", "Max", ")", " ", "for", " ", "Nag", "ios", " ", "perform", "anc", "e", " ", "data", ".\\\\", "\\", "10", ";", "\t", "\t", "Mor", "e", " ", "informati", "on", " ", "abo", "ut", " ", "Range", " ", "format", " ", "and", " ", "unit", "s", " ", "of", " ", "measure", " ", "for", " ", "nagios", " ", "can", " ", "be", " ", "found", " ", "at", " ", "nagios", "-", "plugin", "s", ".", "org", "/", "doc", "/", "guide", "lines", ".", "html", "\\\\", "\\", "10", ";", "\t", "\t", "Addition", "al", " ", "formats", " ", "for", " ", "this", " ", "parameter", " ", "are", ":", " ", "(", "key", "[", ">", "alias", "])", ",", " ", "(", "key", "[", ">", "alias", "],", "Unit", "Of", "Measure", "),", " ", "(", "key", "[", ">", "alias", "],", "Unit", "Of", "Measure", ",", "Warn", "Range", ",", "Crit", "ical", "Range", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "debug", "Print_", "(_", "debug", "\\u", "flag_", ",_", "message_", ",_", "pretty", "\\u", "flag_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "debug", "\\u", "flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "pretty", "\\u", "flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pprint_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "data_", "(_", "self_", ",_", "args_", ",_", "jsondata_", ",_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "data_", "=_", "json_", "._", "loads_", "(_", "jsondata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "=_", "Nag", "ios", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "Js", "on", "Rule", "Processor_", "(_", "data_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "._", "append", "\\u", "warning_", "(_", "processor_", "._", "check", "Warning_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "._", "append", "\\u", "critical_", "(_", "processor_", "._", "check", "Crit", "ical_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nagios", "_", "._", "append", "\\u", "metrics_", "(_", "processor_", "._", "check", "Metrics_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "code_", ",_", "nagios", "_", "._", "get", "Code_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
tornadoweb/tornado/tornado/test/auth_test.py
[ { "content": " def test_openid_redirect(self):\n response = self.fetch('/openid/client/login', follow_redirects=False)\n self.assertEqual(response.code, 302)\n self.assertTrue(\n '/openid/server/authenticate?' in response.headers['Location'])", "metadata": "root.AuthTest.test_openid_redirect", "header": "['class', 'AuthTest', '(', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 318 }, { "content": " def test_oauth10_request_parameters(self):\n response = self.fetch('/oauth10/client/request_params')\n response.rethrow()\n parsed = json_decode(response.body)\n self.assertEqual(parsed['oauth_consumer_key'], 'asdf')\n self.assertEqual(parsed['oauth_token'], 'uiop')\n self.assertTrue('oauth_nonce' in parsed)\n self.assertTrue('oauth_signature' in parsed)", "metadata": "root.AuthTest.test_oauth10_request_parameters", "header": "['class', 'AuthTest', '(', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 349 }, { "content": " def test_oauth10a_request_parameters(self):\n response = self.fetch('/oauth10a/client/request_params')\n response.rethrow()\n parsed = json_decode(response.body)\n self.assertEqual(parsed['oauth_consumer_key'], 'asdf')\n self.assertEqual(parsed['oauth_token'], 'uiop')\n self.assertTrue('oauth_nonce' in parsed)\n self.assertTrue('oauth_signature' in parsed)", "metadata": "root.AuthTest.test_oauth10a_request_parameters", "header": "['class', 'AuthTest', '(', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 377 }, { "content": " def test_oauth2_redirect(self):\n response = self.fetch('/oauth2/client/login', follow_redirects=False)\n self.assertEqual(response.code, 302)\n self.assertTrue('/oauth2/server/authorize?' in response.headers['Location'])", "metadata": "root.AuthTest.test_oauth2_redirect", "header": "['class', 'AuthTest', '(', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 392 }, { "content": " def test_facebook_login(self):\n response = self.fetch('/facebook/client/login', follow_redirects=False)\n self.assertEqual(response.code, 302)\n self.assertTrue('/facebook/server/authorize?' in response.headers['Location'])\n response = self.fetch('/facebook/client/login?code=1234', follow_redirects=False)\n self.assertEqual(response.code, 200)", "metadata": "root.AuthTest.test_facebook_login", "header": "['class', 'AuthTest', '(', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 397 } ]
[ { "span": "self.assertTrue(\n '/openid/server/authenticate?' in response.headers['Location'])", "start_line": 321, "start_column": 8, "end_line": 322, "end_column": 75 }, { "span": "self.assertTrue('oauth_nonce' in parsed)", "start_line": 355, "start_column": 8, "end_line": 355, "end_column": 48 }, { "span": "self.assertTrue('oauth_signature' in parsed)", "start_line": 356, "start_column": 8, "end_line": 356, "end_column": 52 }, { "span": "self.assertTrue('oauth_nonce' in parsed)", "start_line": 383, "start_column": 8, "end_line": 383, "end_column": 48 }, { "span": "self.assertTrue('oauth_signature' in parsed)", "start_line": 384, "start_column": 8, "end_line": 384, "end_column": 52 }, { "span": "self.assertTrue('/oauth2/server/authorize?' in response.headers['Location'])", "start_line": 395, "start_column": 8, "end_line": 395, "end_column": 84 }, { "span": "self.assertTrue('/facebook/server/authorize?' in response.headers['Location'])", "start_line": 400, "start_column": 8, "end_line": 400, "end_column": 86 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Auth", "Test_", "(_", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "openid", "\\u", "redirect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "fetch_", "(_", "'/", "openid", "/", "client", "/", "login", "'_", ",_", "follow", "\\u", "redirects_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "openid", "/", "server", "/", "authenticat", "e", "?'_", "in_", "response_", "._", "headers_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Test_", "(_", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "oauth", "10", "\\u", "request", "\\u", "parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "fetch_", "(_", "'/", "oauth", "10", "/", "client", "/", "request", "\\u", "params", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "ret", "hro", "w_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "json", "\\u", "decode_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "oauth", "\\u", "consume", "r", "\\u", "key", "'_", "]_", ",_", "'", "asd", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "oauth", "\\u", "token", "'_", "]_", ",_", "'", "ui", "op", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "oauth", "\\u", "nonc", "e", "'_", "in_", "parsed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "oauth", "\\u", "signa", "ture", "'_", "in_", "parsed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Test_", "(_", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "oauth", "10", "a", "\\u", "request", "\\u", "parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "fetch_", "(_", "'/", "oauth", "10", "a", "/", "client", "/", "request", "\\u", "params", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "ret", "hro", "w_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "json", "\\u", "decode_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "oauth", "\\u", "consume", "r", "\\u", "key", "'_", "]_", ",_", "'", "asd", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "oauth", "\\u", "token", "'_", "]_", ",_", "'", "ui", "op", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "oauth", "\\u", "nonc", "e", "'_", "in_", "parsed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "oauth", "\\u", "signa", "ture", "'_", "in_", "parsed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Test_", "(_", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "oauth2", "\\u", "redirect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "fetch_", "(_", "'/", "oauth2", "/", "client", "/", "login", "'_", ",_", "follow", "\\u", "redirects_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "oauth2", "/", "server", "/", "authoriz", "e", "?'_", "in_", "response_", "._", "headers_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Test_", "(_", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "facebook", "\\u", "login_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "fetch_", "(_", "'/", "facebook", "/", "client", "/", "login", "'_", ",_", "follow", "\\u", "redirects_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "facebook", "/", "server", "/", "authoriz", "e", "?'_", "in_", "response_", "._", "headers_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "fetch_", "(_", "'/", "facebook", "/", "client", "/", "login", "?", "code", "=", "1234", "'_", ",_", "follow", "\\u", "redirects_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "code_", ",_", "200_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kvh/ramp/ramp/tests/test_selectors.py
[ { "content": "import sys\nsys.path.append('../..')\nimport unittest\n\nimport numpy as np\nimport pandas as pd\nfrom pandas import DataFrame, Series, Index\nfrom pandas.util.testing import assert_almost_equal\n\nfrom ramp.builders import *\nfrom ramp.estimators.base import Probabilities\nfrom ramp.features.base import F, Map\nfrom ramp.features.trained import Predictions\nfrom ramp.model_definition import ModelDefinition\nfrom ramp.selectors import BinaryFeatureSelector\nfrom ramp.tests.test_features import make_data\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestSelectors(unittest.TestCase):\n\n", "metadata": "root.TestSelectors", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def setUp(self):\n self.data = make_data(100)", "metadata": "root.TestSelectors.setUp", "header": "['class', 'TestSelectors', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_binary_selectors(self):\n d = self.data\n d['target'] = [0] * 50 + [1] * 50\n d['good_feature'] = [0] * 35 + [1] * 65\n d['best_feature'] = d['target']\n features = map(F, ['a', 'b', 'good_feature', 'best_feature'])\n selector = BinaryFeatureSelector()\n x, ffs = build_featureset_safe(features, self.data)\n y, ff = build_target_safe(F('target'), self.data)\n cols = selector.select(x, y, 2)\n feature_rank = [F('best_feature'), F('good_feature')]\n self.assertEqual(cols, [f.unique_name for f in feature_rank])", "metadata": "root.TestSelectors.test_binary_selectors", "header": "['class', 'TestSelectors', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_binary_selectors_multiclass(self):\n d = self.data\n d['target'] = [0] * 50 + [1] * 25 + [2] * 25\n d['good_feature'] = [0] * 35 + [1] * 65\n d['best_feature'] = d['target']\n features = map(F, ['a', 'b', 'good_feature', 'best_feature'])\n selector = BinaryFeatureSelector()\n x, ffs = build_featureset_safe(features, self.data)\n y, ff = build_target_safe(F('target'), self.data)\n cols = selector.select(x, y, 2)\n feature_rank = [F('best_feature'), F('good_feature')]\n self.assertEqual(cols, [f.unique_name for f in feature_rank])", "metadata": "root.TestSelectors.test_binary_selectors_multiclass", "header": "['class', 'TestSelectors', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "import numpy as np", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 18 }, { "span": "import pandas as pd", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 19 }, { "span": "from pandas import DataFrame, Series, Index", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 43 }, { "span": "from pandas.util.testing import assert_almost_equal", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 51 }, { "span": "from ramp.estimators.base import Probabilities", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 46 }, { "span": "from ramp.features.base import F, Map", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 37 }, { "span": "from ramp.features.trained import Predictions", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 45 }, { "span": "from ramp.model_definition import ModelDefinition", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "'../", "..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "import_", "Data", "Frame_", ",_", "Series_", ",_", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "._", "util_", "._", "testing_", "import_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ramp", "_", "._", "builders_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ramp", "_", "._", "estimators_", "._", "base_", "import_", "Probabili", "ties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ramp", "_", "._", "features_", "._", "base_", "import_", "F_", ",_", "Map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ramp", "_", "._", "features_", "._", "trained", "_", "import_", "Prediction", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ramp", "_", "._", "model", "\\u", "definition_", "import_", "Model", "Definition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ramp", "_", "._", "selectors_", "import_", "Bin", "ary", "Feature", "Selector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ramp", "_", "._", "tests_", "._", "test\\u", "features_", "import_", "make", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Select", "ors_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "ors_", "(_", "unittest_", "._", "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_", "._", "data_", "=_", "make", "\\u", "data_", "(_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "ors_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "binar", "y", "\\u", "selectors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "target", "'_", "]_", "=_", "[_", "0_", "]_", "*_", "50_", "+_", "[_", "1_", "]_", "*_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "good", "\\u", "feature", "'_", "]_", "=_", "[_", "0_", "]_", "*_", "35_", "+_", "[_", "1_", "]_", "*_", "65_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "best", "\\u", "feature", "'_", "]_", "=_", "d_", "[_", "'", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "=_", "map_", "(_", "F_", ",_", "[_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "good", "\\u", "feature", "'_", ",_", "'", "best", "\\u", "feature", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selector_", "=_", "Bin", "ary", "Feature", "Selector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "ffs_", "=_", "build", "\\u", "features", "et", "\\u", "safe_", "(_", "features_", ",_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", ",_", "ff_", "=_", "build", "\\u", "target", "\\u", "safe_", "(_", "F_", "(_", "'", "target", "'_", ")_", ",_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "=_", "selector_", "._", "select_", "(_", "x_", ",_", "y_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature", "\\u", "rank_", "=_", "[_", "F_", "(_", "'", "best", "\\u", "feature", "'_", ")_", ",_", "F_", "(_", "'", "good", "\\u", "feature", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cols_", ",_", "[_", "f_", "._", "unique", "\\u", "name_", "for_", "f_", "in_", "feature", "\\u", "rank_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "ors_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "binar", "y", "\\u", "select", "ors", "\\u", "multic", "lass_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "target", "'_", "]_", "=_", "[_", "0_", "]_", "*_", "50_", "+_", "[_", "1_", "]_", "*_", "25_", "+_", "[_", "2_", "]_", "*_", "25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "good", "\\u", "feature", "'_", "]_", "=_", "[_", "0_", "]_", "*_", "35_", "+_", "[_", "1_", "]_", "*_", "65_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "best", "\\u", "feature", "'_", "]_", "=_", "d_", "[_", "'", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "=_", "map_", "(_", "F_", ",_", "[_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "good", "\\u", "feature", "'_", ",_", "'", "best", "\\u", "feature", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selector_", "=_", "Bin", "ary", "Feature", "Selector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "ffs_", "=_", "build", "\\u", "features", "et", "\\u", "safe_", "(_", "features_", ",_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", ",_", "ff_", "=_", "build", "\\u", "target", "\\u", "safe_", "(_", "F_", "(_", "'", "target", "'_", ")_", ",_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "=_", "selector_", "._", "select_", "(_", "x_", ",_", "y_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature", "\\u", "rank_", "=_", "[_", "F_", "(_", "'", "best", "\\u", "feature", "'_", ")_", ",_", "F_", "(_", "'", "good", "\\u", "feature", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cols_", ",_", "[_", "f_", "._", "unique", "\\u", "name_", "for_", "f_", "in_", "feature", "\\u", "rank_", "]_", ")_", "\\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, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
bitxbay/BitXBay/BitXBay.py
[ { "content": " def start(self, daemon=False):\n from PyQt4 import QtGui, QtCore\n app = QtGui.QApplication(sys.argv)\n import bitmessage_icons_rc\n splash_pix = QtGui.QPixmap(':/newPrefix/images/loading.jpg')\n splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)\n\n splash.setMask(splash_pix.mask())\n splash.show()\n shared.daemon = daemon\n\n #electrum version\n electrumon = True\n settings = shelve.open(\"settings.slv\")\n if \"electrumon\" in settings.keys():\n if settings[\"electrumon\"] == True:\n electrumon = True\n settings.close()\n else:\n settings.close()\n electrumon = False\n else:\n #settings[\"electrumon\"] = True\n settings.close()\n splash.hide()\n import electrumfirst\n electrumfirst.run()\n\n if electrumon == False:\n try:\n datadir = os.getcwd()+\"/btc\"\n print datadir\n db_env = DBEnv(0)\n r = db_env.open(datadir, (DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_THREAD|DB_RECOVER))\n walletname = \"wallet.dat\"\n fordel = shelve.open(\"fordel.slv\")\n try:\n for i in fordel:\n keydel = i\n deleted_items = delete_from_wallet(db_env, walletname, \"key\", keydel)\n print \"address:%s has been successfully deleted from %s/%s, resulting in %d deleted item\"%(keydel, datadir, walletname, deleted_items)\n priv = \"\"\n del fordel[i]\n fordel.sync()\n except:\n print \"can't delete addresses\"\n fordel.close()\n #changes start\n process = subprocess.Popen([os.getcwd()+'/btc/bitcoin-qt.exe', \"-datadir=\"+datadir], shell=True, creationflags=subprocess.SW_HIDE)\n print \"Wait bitcoin-qt\"\n time.sleep(5)\n except:\n error=\"\"\n\n\n\n #changes end here\n #\n # is the application already running? If yes then exit.\n thisapp = singleton.singleinstance()\n\n signal.signal(signal.SIGINT, helper_generic.signal_handler)\n # signal.signal(signal.SIGINT, signal.SIG_DFL)\n\n helper_bootstrap.knownNodes()\n # Start the address generation thread\n addressGeneratorThread = addressGenerator()\n addressGeneratorThread.daemon = True # close the main program even if there are threads left\n addressGeneratorThread.start()\n\n # Start the thread that calculates POWs\n singleWorkerThread = singleWorker()\n singleWorkerThread.daemon = True # close the main program even if there are threads left\n singleWorkerThread.start()\n\n #data_dir = os.getcwd()+\"/btc/testnet3/blocks\"\n #singleWorkerThread2 = worker(data_dir, config.addresses, config.days)\n #singleWorkerThread2.daemon = False\n #singleWorkerThread2.starttimer()\n\n\n\n # Start the SQL thread\n sqlLookup = sqlThread()\n sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully.\n sqlLookup.start()\n\n # Start the thread that calculates POWs\n objectProcessorThread = objectProcessor()\n objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object.\n objectProcessorThread.start()\n\n objectProcessorThread2 = objectProcessor2()\n objectProcessorThread2.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object.\n objectProcessorThread2.start()\n\n # Start the cleanerThread\n singleCleanerThread = singleCleaner()\n singleCleanerThread.daemon = True # close the main program even if there are threads left\n singleCleanerThread.start()\n shared.reloadMyAddressHashes()\n shared.reloadBroadcastSendersForWhichImWatching()\n\n\n if shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'):\n try:\n apiNotifyPath = shared.config.get(\n 'bitmessagesettings', 'apinotifypath')\n except:\n apiNotifyPath = ''\n if apiNotifyPath != '':\n with shared.printLock:\n print 'Trying to call', apiNotifyPath\n\n call([apiNotifyPath, \"startingUp\"])\n singleAPIThread = singleAPI()\n singleAPIThread.daemon = True # close the main program even if there are threads left\n singleAPIThread.start()\n\n connectToStream(1)\n\n singleListenerThread = singleListener()\n singleListenerThread.setup(selfInitiatedConnections)\n singleListenerThread.daemon = True # close the main program even if there are threads left\n singleListenerThread.start()\n\n if daemon == False and shared.safeConfigGetBoolean('bitmessagesettings', 'daemon') == False:\n try:\n from PyQt4 import QtCore, QtGui\n except Exception as err:\n print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \\'PyQt Download\\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'\n print 'Error message:', err\n try:\n process.kill()\n except:\n pass\n os._exit(0)\n\n import bitmessageqt\n splash.close()\n bitmessageqt.run()\n\n\n\n\n else:\n shared.config.remove_option('bitmessagesettings', 'dontconnect')\n\n if daemon:\n with shared.printLock:\n print 'Running as a daemon. The main program should exit this thread.'\n else:\n with shared.printLock:\n print 'Running as a daemon. You can use Ctrl+C to exit.'\n while True:\n time.sleep(20)", "metadata": "root.Main.start", "header": "['class', 'Main', ':', '___EOS___']", "index": 109 } ]
[ { "span": "except:", "start_line": 153, "start_column": 16, "end_line": 153, "end_column": 23 }, { "span": "except:", "start_line": 160, "start_column": 12, "end_line": 160, "end_column": 19 }, { "span": "except:", "start_line": 217, "start_column": 12, "end_line": 217, "end_column": 19 }, { "span": "except:", "start_line": 243, "start_column": 16, "end_line": 243, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Main_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "start_", "(_", "self_", ",_", "daemon_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "Qt4_", "import_", "Qt", "Gui_", ",_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bitm", "essage", "\\u", "icons", "\\u", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splash", "\\u", "pix_", "=_", "Qt", "Gui_", "._", "QP", "ix", "map_", "(_", "':/", "new", "Pref", "ix", "/", "images", "/", "load", "ing", ".", "jp", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splash", "_", "=_", "Qt", "Gui_", "._", "QS", "plas", "h", "Screen_", "(_", "splash", "\\u", "pix_", ",_", "Qt", "Core_", "._", "Qt_", "._", "Window", "Sta", "ys", "On", "Top", "Hint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "splash", "_", "._", "set", "Mask_", "(_", "splash", "\\u", "pix_", "._", "mask_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splash", "_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared_", "._", "daemon_", "=_", "daemon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "electr", "um", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "electr", "um", "on_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "shelve", "_", "._", "open_", "(_", "\"", "settings", ".", "sl", "v", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "electr", "um", "on", "\"_", "in_", "settings_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "settings_", "[_", "\"", "electr", "um", "on", "\"_", "]_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "electr", "um", "on_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "electr", "um", "on_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "settings", "[\"", "electr", "um", "on", "\"]", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splash", "_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "electr", "um", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "electr", "um", "first_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "electr", "um", "on_", "==_", "False_", ":_", "\\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 ", " _", "datadir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "+_", "\"/", "btc", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "datadir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "env_", "=_", "DB", "Env_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "db", "\\u", "env_", "._", "open_", "(_", "datadir_", ",_", "(_", "DB", "\\u", "CREATE_", "|_", "DB", "\\u", "INIT", "\\u", "LOCK_", "|_", "DB", "\\u", "INIT", "\\u", "LOG_", "|_", "DB", "\\u", "INIT", "\\u", "MP", "OO", "L_", "|_", "DB", "\\u", "INIT", "\\u", "TX", "N_", "|_", "DB", "\\u", "THREAD", "_", "|_", "DB", "\\u", "RECO", "VER_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "walle", "tname_", "=_", "\"", "walle", "t", ".", "dat", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for", "del_", "=_", "shelve", "_", "._", "open_", "(_", "\"", "for", "del", ".", "sl", "v", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "i_", "in_", "for", "del_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "keyd", "el_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "items_", "=_", "delete", "\\u", "from", "\\u", "wallet_", "(_", "db", "\\u", "env_", ",_", "walle", "tname_", ",_", "\"", "key", "\"_", ",_", "keyd", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "address", ":", "%", "s", " ", "has", " ", "bee", "n", " ", "success", "full", "y", " ", "delete", "d", " ", "from", " ", "%", "s", "/", "%", "s", ",", " ", "result", "ing", " ", "in", " ", "%", "d", " ", "delete", "d", " ", "item", "\"_", "%_", "(_", "keyd", "el_", ",_", "datadir_", ",_", "walle", "tname_", ",_", "delete", "d\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "priv_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "for", "del_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for", "del_", "._", "sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "can", "'", "t", " ", "delete", " ", "addresse", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for", "del_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "change", "s", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "process_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "os_", "._", "getcwd_", "(_", ")_", "+_", "'/", "btc", "/", "bitcoin", "-", "qt", ".", "exe", "'_", ",_", "\"-", "datadir", "=\"_", "+_", "datadir_", "]_", ",_", "shell_", "=_", "True_", ",_", "creati", "onf", "lags_", "=_", "subprocess_", "._", "SW", "\\u", "HID", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Wait", " ", "bitcoin", "-", "qt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "change", "s", " ", "end", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "applica", "tion", " ", "alr", "ead", "y", " ", "runn", "ing", "?", " ", " ", "If", " ", "ye", "s", " ", "then", " ", "exit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "this", "app_", "=_", "singleton_", "._", "single", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGINT_", ",_", "help", "er", "\\u", "generic_", "._", "signal", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "signal", ".", "signal", "(", "signal", ".", "SIG", "INT", ",", " ", "signal", ".", "SIG", "\\u", "DF", "L", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "help", "er", "\\u", "bootstrap_", "._", "know", "n", "Nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "address", " ", "generat", "ion", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "address", "Generat", "or", "Thread_", "=_", "address", "Generator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "Generat", "or", "Thread_", "._", "daemon_", "=_", "True_", "#", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "if", " ", "there", " ", "are", " ", "thread", "s", " ", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "Generat", "or", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "thread", " ", "tha", "t", " ", "calcul", "ates", " ", "PO", "Ws", "_", "\\u\\u\\uNL\\u\\u\\u_", "single", "Worke", "r", "Thread_", "=_", "single", "Worker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Worke", "r", "Thread_", "._", "daemon_", "=_", "True_", "#", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "if", " ", "there", " ", "are", " ", "thread", "s", " ", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Worke", "r", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data\\u", "dir", " ", "=", " ", "os", ".", "getc", "wd", "()", "+\"", "/", "btc", "/", "testn", "et", "3", "/", "blocks", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "single", "Worke", "r", "Thread", "2", " ", "=", " ", "worker", "(", "data\\u", "dir", ",", " ", "config", ".", "addresse", "s", ",", " ", "config", ".", "day", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "single", "Worke", "r", "Thread", "2", ".", "daemon", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", "single", "Worke", "r", "Thread", "2", ".", "startt", "ime", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "SQL", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "Lookup_", "=_", "sql", "Thread_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql", "Lookup_", "._", "daemon_", "=_", "False_", "#", " ", "DON", "'", "T", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "if", " ", "there", " ", "are", " ", "thread", "s", " ", "left", ".", " ", "The", " ", "close", "Event", " ", "shou", "ld", " ", "command", " ", "this", " ", "thread", " ", "to", " ", "exit", " ", "graceful", "ly", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql", "Lookup_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "thread", " ", "tha", "t", " ", "calcul", "ates", " ", "PO", "Ws", "_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Process", "or", "Thread_", "=_", "object", "Processor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object", "Process", "or", "Thread_", "._", "daemon_", "=_", "False_", "#", " ", "DON", "'", "T", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "the", " ", "thread", " ", "remains", ".", " ", "Thi", "s", " ", "thread", " ", "checks", " ", "the", " ", "shut", "down", " ", "variab", "le", " ", "after", " ", "process", "ing", " ", "each", " ", "object", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object", "Process", "or", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Process", "or", "Thread", "2_", "=_", "object", "Process", "or", "2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object", "Process", "or", "Thread", "2_", "._", "daemon_", "=_", "False_", "#", " ", "DON", "'", "T", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "the", " ", "thread", " ", "remains", ".", " ", "Thi", "s", " ", "thread", " ", "checks", " ", "the", " ", "shut", "down", " ", "variab", "le", " ", "after", " ", "process", "ing", " ", "each", " ", "object", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object", "Process", "or", "Thread", "2_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "cleaner", "Thread_", "\\u\\u\\uNL\\u\\u\\u_", "single", "Cleane", "r", "Thread_", "=_", "single", "Cleane", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Cleane", "r", "Thread_", "._", "daemon_", "=_", "True_", "#", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "if", " ", "there", " ", "are", " ", "thread", "s", " ", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Cleane", "r", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared_", "._", "relo", "ad", "My", "Address", "Hashe", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared_", "._", "relo", "ad", "Broad", "cast", "Sen", "ders", "For", "Whi", "ch", "Im", "Watch", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shared_", "._", "safe", "Config", "Get", "Boolean_", "(_", "'", "bitm", "essage", "settings", "'_", ",_", "'", "api", "enable", "d", "'_", ")_", ":_", "\\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 ", " _", "api", "Noti", "fy", "Path_", "=_", "shared_", "._", "config_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bitm", "essage", "settings", "'_", ",_", "'", "api", "notif", "ypa", "th", "'_", ")_", "\\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 ", " _", "api", "Noti", "fy", "Path_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "api", "Noti", "fy", "Path_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "shared_", "._", "print", "Lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Tr", "ying", " ", "to", " ", "call", "'_", ",_", "api", "Noti", "fy", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "call_", "(_", "[_", "api", "Noti", "fy", "Path_", ",_", "\"", "startin", "g", "Up", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "single", "API", "Thread_", "=_", "single", "API_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "API", "Thread_", "._", "daemon_", "=_", "True_", "#", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "if", " ", "there", " ", "are", " ", "thread", "s", " ", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "API", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "connect", "To", "Stream_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "single", "Listen", "er", "Thread_", "=_", "single", "Listener_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Listen", "er", "Thread_", "._", "setup_", "(_", "self", "Initiat", "ed", "Connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Listen", "er", "Thread_", "._", "daemon_", "=_", "True_", "#", " ", "close", " ", "the", " ", "main", " ", "program", " ", "even", " ", "if", " ", "there", " ", "are", " ", "thread", "s", " ", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Listen", "er", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "daemon_", "==_", "False_", "and_", "shared_", "._", "safe", "Config", "Get", "Boolean_", "(_", "'", "bitm", "essage", "settings", "'_", ",_", "'", "daemon", "'_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "Qt4_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Py", "Bit", "message", " ", "require", "s", " ", "Py", "Qt", " ", "unl", "ess", " ", "you", " ", "want", " ", "to", " ", "run", " ", "it", " ", "as", " ", "a", " ", "daemon", " ", "and", " ", "interact", " ", "with", " ", "it", " ", "usi", "ng", " ", "the", " ", "API", ".", " ", "You", " ", "can", " ", "download", " ", "Py", "Qt", " ", "from", " ", "http", "://", "www", ".", "river", "bank", "compu", "ting", ".", "com", "/", "software", "/", "pyqt", "/", "download", " ", " ", " ", "or", " ", "by", " ", "search", "ing", " ", "Goo", "gle", " ", "for", " ", "\\\\'", "Py", "Qt", " ", "Down", "load", "\\\\'", ".", " ", "If", " ", "you", " ", "want", " ", "to", " ", "run", " ", "in", " ", "daemon", " ", "mode", ",", " ", "see", " ", "https", "://", "bitm", "essage", ".", "org", "/", "wiki", "/", "Da", "emo", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Error", " ", "message", ":'_", ",_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "process_", "._", "kill_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "bitm", "essage", "qt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splash", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bitm", "essage", "qt_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared_", "._", "config_", "._", "remove", "\\u", "option_", "(_", "'", "bitm", "essage", "settings", "'_", ",_", "'", "don", "tcon", "nect", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "daemon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "shared_", "._", "print", "Lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Run", "ning", " ", "as", " ", "a", " ", "daemon", ".", " ", "The", " ", "main", " ", "program", " ", "shou", "ld", " ", "exit", " ", "this", " ", "thread", ".'_", "\\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 ", " _", "with_", "shared_", "._", "print", "Lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Run", "ning", " ", "as", " ", "a", " ", "daemon", ".", " ", "You", " ", "can", " ", "use", " ", "Ctrl", "+", "C", " ", "to", " ", "exit", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time_", "._", "sleep_", "(_", "20_", ")_", "\\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,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/tests/unittests/backwards_compat_test.py
[ { "content": " @unittest.skipIf(not sys.version_info < (3, 0, 0), 'Can only be run in python 2.7')\n def test_backwards_compatibility(self):\n # Test only makes sense with python 2.7 or lower\n old_pypet_traj = Trajectory()\n module_path, init_file = os.path.split(pypet.__file__)\n filename= os.path.join(module_path, 'tests','testdata','pypet_v0_1b_6.hdf5')\n old_pypet_traj.f_load(index=-1, load_data=2, force=True, filename=filename)\n\n self.assertTrue(old_pypet_traj.v_version=='0.1b.6')\n self.assertTrue(old_pypet_traj.par.x==0)\n self.assertTrue(len(old_pypet_traj)==9)\n self.assertTrue(old_pypet_traj.res.runs.r_4.z==12)\n nexplored = len(old_pypet_traj._explored_parameters)\n self.assertGreater(nexplored, 0)\n for param in old_pypet_traj.f_get_explored_parameters():\n self.assertTrue(old_pypet_traj.f_contains(param))", "metadata": "root.LoadOldTrajectoryTest.test_backwards_compatibility", "header": "['class', 'LoadOldTrajectoryTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 } ]
[ { "span": "self.assertTrue(old_pypet_traj.v_version=='0.1b.6')", "start_line": 27, "start_column": 8, "end_line": 27, "end_column": 59 }, { "span": "self.assertTrue(old_pypet_traj.par.x==0)", "start_line": 28, "start_column": 8, "end_line": 28, "end_column": 48 }, { "span": "self.assertTrue(len(old_pypet_traj)==9)", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 47 }, { "span": "self.assertTrue(old_pypet_traj.res.runs.r_4.z==12)", "start_line": 30, "start_column": 8, "end_line": 30, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Load", "Old", "Trajector", "y", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "not_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "3_", ",_", "0_", ",_", "0_", ")_", ",_", "'", "Can", " ", "only", " ", "be", " ", "run", " ", "in", " ", "python", " ", "2.7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "back", "ward", "s", "\\u", "compatibility", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "only", " ", "make", "s", " ", "sense", " ", "with", " ", "python", " ", "2.7", " ", "or", " ", "lower_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "pype", "t", "\\u", "traj_", "=_", "Trajector", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "path_", ",_", "init", "\\u", "file_", "=_", "os_", "._", "path_", "._", "split_", "(_", "pype", "t_", "._", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "module", "\\u", "path_", ",_", "'", "tests", "'_", ",_", "'", "testd", "ata", "'_", ",_", "'", "pype", "t", "\\u", "v", "0", "\\u", "1b", "\\u", "6", ".", "hdf5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "pype", "t", "\\u", "traj_", "._", "f", "\\u", "load_", "(_", "index_", "=_", "-_", "1_", ",_", "load", "\\u", "data_", "=_", "2_", ",_", "force_", "=_", "True_", ",_", "filename_", "=_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "old", "\\u", "pype", "t", "\\u", "traj_", "._", "v", "\\u", "version_", "==_", "'", "0.", "1b", ".6", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "old", "\\u", "pype", "t", "\\u", "traj_", "._", "par_", "._", "x_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "old", "\\u", "pype", "t", "\\u", "traj_", ")_", "==_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "old", "\\u", "pype", "t", "\\u", "traj_", "._", "res_", "._", "runs_", "._", "r", "\\u", "4_", "._", "z_", "==_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nex", "plo", "red_", "=_", "len_", "(_", "old", "\\u", "pype", "t", "\\u", "traj_", "._", "\\u", "explore", "d\\u", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "nex", "plo", "red_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param_", "in_", "old", "\\u", "pype", "t", "\\u", "traj_", "._", "f", "\\u", "get", "\\u", "explore", "d\\u", "parameters_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "old", "\\u", "pype", "t", "\\u", "traj_", "._", "f", "\\u", "contains_", "(_", "param_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
Pylons/pylons/tests/test_webapps/filestotest/controller_sqlatest.py
[ { "content": "import datetime\n\nfrom projectname.lib.base import *\ntry:\n import sqlalchemy as sa\n from projectname.model.meta import Session, Base\n from projectname.model import Foo\n SQLAtesting = True\nexcept:\n SQLAtesting = False\nimport projectname.lib.helpers as h\nfrom pylons import request, response, session\nfrom pylons import tmpl_context as c\nfrom pylons import app_globals\nfrom pylons.decorators import rest\nfrom pylons.i18n import _, get_lang, set_lang, LanguageError\nfrom pylons.templating import render_mako, render_genshi, render_jinja2\nfrom pylons.controllers.util import abort, redirect\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "project", "name_", "._", "lib_", "._", "base_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sqlalchemy_", "as_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "project", "name_", "._", "model_", "._", "meta_", "import_", "Session_", ",_", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "project", "name_", "._", "model_", "import_", "Foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SQL", "At", "esti", "ng_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SQL", "At", "esti", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "project", "name_", "._", "lib_", "._", "helpers_", "as_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylon", "s_", "import_", "request_", ",_", "response_", ",_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylon", "s_", "import_", "tmpl", "\\u", "context_", "as_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylon", "s_", "import_", "app", "\\u", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylon", "s_", "._", "decorators_", "import_", "rest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylon", "s_", "._", "i18n_", "import_", "\\u_", ",_", "get", "\\u", "lang_", ",_", "set\\u", "lang_", ",_", "Lang", "ua", "ge", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylon", "s_", "._", "templa", "ting_", "import_", "render", "\\u", "mak", "o_", ",_", "render", "\\u", "gens", "hi_", ",_", "render", "\\u", "jinja2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylon", "s_", "._", "controllers_", "._", "util_", "import_", "abort_", ",_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
CollabQ/CollabQ/vendor/django/contrib/auth/models.py
[ { "content": "import datetime\nimport urllib\n\nfrom django.contrib import auth\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.db import models\nfrom django.db.models.manager import EmptyManager\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.utils.encoding import smart_str\nfrom django.utils.hashcompat import md5_constructor, sha_constructor\nfrom django.utils.translation import ugettext_lazy as _\n\nUNUSABLE_PASSWORD = '!' # This will never be a valid hash\n\ntry:\n set\nexcept NameError:\n from sets import Set as set # Python 2.3 fallback\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except NameError:", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "manager_", "import_", "Emp", "ty", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "smart", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "hash", "compat_", "import_", "md5", "\\u", "constructor_", ",_", "sha", "\\u", "constructor_", "\\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_", "UN", "USA", "BL", "E", "\\u", "PASSWORD_", "=_", "'!'_", "#", " ", "Thi", "s", " ", "will", " ", "neve", "r", " ", "be", " ", "a", " ", "valid", " ", "hash_", "\\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 ", " _", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sets_", "import_", "Set_", "as_", "set_", "#", " ", "Pyth", "on", " ", "2.3", " ", "fallback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
AppScale/appscale/AppDB/test/functional/test_zktransaction.py
[ { "content": " def test_lockafterrelease(self):\n app = \"testapp\"\n key = \"root\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)\n try:\n ret = self.zk.acquire_lock(app, txid, key)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_INVALID, e.getType())", "metadata": "root.TestZKTransaction.test_lockafterrelease", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_releaseinvalidid(self):\n app = \"testapp\"\n key = \"root\"\n txid = 99999L\n try:\n self.zk.release_lock(app, txid)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_INVALID, e.getType())", "metadata": "root.TestZKTransaction.test_releaseinvalidid", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test_rollback(self):\n app = \"testapp\"\n key = \"root\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.notify_failed_transaction(app, txid)\n self.assertTrue(ret)\n self.assertTrue(self.zk.is_blacklisted(app, txid))\n try:\n ret = self.zk.release_lock(app, txid)\n self.fail\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_EXPIRED, e.getType())", "metadata": "root.TestZKTransaction.test_rollback", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 435 } ]
[ { "span": "ret ", "start_line": 96, "start_column": 6, "end_line": 96, "end_column": 9 }, { "span": "key ", "start_line": 126, "start_column": 4, "end_line": 126, "end_column": 7 }, { "span": "ret ", "start_line": 446, "start_column": 6, "end_line": 446, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "after", "release_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "INVALID", "_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "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", "release", "invalid", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "99999_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "INVALID", "_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rollback_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "notif", "y", "\\u", "fail", "ed", "\\u", "transaction_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "zk_", "._", "is", "\\u", "blacklisted", "_", "(_", "app_", ",_", "txid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/tlslite/utils/xmltools.py
[ { "content": "def checkName(element, name):\n if element.nodeType != element.ELEMENT_NODE:\n raise SyntaxError(\"Missing element: '%s'\" % name)\n\n if name == None:\n return\n\n if element.tagName != name:\n raise SyntaxError(\"Wrong element name: should be '%s', is '%s'\" % (name, element.tagName))", "metadata": "root.checkName", "header": "['module', '___EOS___']", "index": 78 }, { "content": "def getChild(element, index, name=None):\n if element.nodeType != element.ELEMENT_NODE:\n raise SyntaxError(\"Wrong node type in getChild()\")\n\n child = element.childNodes.item(index)\n if child == None:\n raise SyntaxError(\"Missing child: '%s'\" % name)\n checkName(child, name)\n return child", "metadata": "root.getChild", "header": "['module', '___EOS___']", "index": 88 }, { "content": "def getLastChild(element, index, name=None):\n if element.nodeType != element.ELEMENT_NODE:\n raise SyntaxError(\"Wrong node type in getLastChild()\")\n\n child = element.childNodes.item(index)\n if child == None:\n raise SyntaxError(\"Missing child: '%s'\" % name)\n if child != element.lastChild:\n raise SyntaxError(\"Too many elements under: '%s'\" % element.tagName)\n checkName(child, name)\n return child", "metadata": "root.getLastChild", "header": "['module', '___EOS___']", "index": 123 }, { "content": "def getText(element, regEx=\"\"):\n textNode = element.firstChild\n if textNode == None:\n raise SyntaxError(\"Empty element '%s'\" % element.tagName)\n if textNode.nodeType != textNode.TEXT_NODE:\n raise SyntaxError(\"Non-text node: '%s'\" % element.tagName)\n if not re.match(regEx, textNode.data):\n raise SyntaxError(\"Bad Text Value for '%s': '%s' \" % (element.tagName, textNode.data))\n return str(textNode.data) #de-unicode it; this is needed for bsddb, for example", "metadata": "root.getText", "header": "['module', '___EOS___']", "index": 180 } ]
[ { "span": "name == None:", "start_line": 82, "start_column": 7, "end_line": 82, "end_column": 19 }, { "span": "child == None:", "start_line": 93, "start_column": 7, "end_line": 93, "end_column": 20 }, { "span": "child == None:", "start_line": 128, "start_column": 7, "end_line": 128, "end_column": 20 }, { "span": "textNode == None:", "start_line": 182, "start_column": 7, "end_line": 182, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Name_", "(_", "element_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "._", "node", "Type_", "!=_", "element_", "._", "ELEMENT", "\\u", "NODE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Missing", " ", "element", ":", " ", "'%", "s", "'\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "==_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "element_", "._", "tag", "Name_", "!=_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Wro", "ng", " ", "element", " ", "name", ":", " ", "shou", "ld", " ", "be", " ", "'%", "s", "',", " ", "is", " ", "'%", "s", "'\"_", "%_", "(_", "name_", ",_", "element_", "._", "tag", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Child_", "(_", "element_", ",_", "index_", ",_", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "._", "node", "Type_", "!=_", "element_", "._", "ELEMENT", "\\u", "NODE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Wro", "ng", " ", "node", " ", "type", " ", "in", " ", "get", "Chil", "d", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child_", "=_", "element_", "._", "child", "Nodes_", "._", "item_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Missing", " ", "child", ":", " ", "'%", "s", "'\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "Name_", "(_", "child_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "child_", "\\u\\u\\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", "Las", "t", "Child_", "(_", "element_", ",_", "index_", ",_", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "._", "node", "Type_", "!=_", "element_", "._", "ELEMENT", "\\u", "NODE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Wro", "ng", " ", "node", " ", "type", " ", "in", " ", "get", "Las", "t", "Chil", "d", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child_", "=_", "element_", "._", "child", "Nodes_", "._", "item_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Missing", " ", "child", ":", " ", "'%", "s", "'\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "child_", "!=_", "element_", "._", "last", "Child_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Too", " ", "many", " ", "element", "s", " ", "under", ":", " ", "'%", "s", "'\"_", "%_", "element_", "._", "tag", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "Name_", "(_", "child_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "child_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Text_", "(_", "element_", ",_", "reg", "Ex_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "Node_", "=_", "element_", "._", "first", "Child_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text", "Node_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Emp", "ty", " ", "element", " ", "'%", "s", "'\"_", "%_", "element_", "._", "tag", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "text", "Node_", "._", "node", "Type_", "!=_", "text", "Node_", "._", "TEXT", "\\u", "NODE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Non", "-", "text", " ", "node", ":", " ", "'%", "s", "'\"_", "%_", "element_", "._", "tag", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "re_", "._", "match_", "(_", "reg", "Ex_", ",_", "text", "Node_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "\"", "Ba", "d", " ", "Text", " ", "Value", " ", "for", " ", "'%", "s", "':", " ", "'%", "s", "'", " ", "\"_", "%_", "(_", "element_", "._", "tag", "Name_", ",_", "text", "Node_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "text", "Node_", "._", "data_", ")_", "#", "de", "-", "unicode", " ", "it", ";", " ", "this", " ", "is", " ", "need", "ed", " ", "for", " ", "bsd", "db", ",", " ", "for", " ", "example_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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