lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "for et in ExtractedText.objects.all():\n", "for ex_child in et.fetch_extracted_records():\n", "VAR_21 = ex_child.__class__\n", "self.assertEqual(et.pk, VAR_21.objects.get(pk=ex_child.pk).extracted_text.\n pk, 'string')\n" ]
[ "def test_fetch_extracted_records(self):...\n", "\"\"\"docstring\"\"\"\n", "for et in ExtractedText.objects.all():\n", "for ex_child in et.fetch_extracted_records():\n", "child_model = ex_child.__class__\n", "self.assertEqual(et.pk, child_model.objects.get(pk=ex_child.pk).\n extracted_text.pk,\n 'The ExtractedChemical object with the returned child pk should have the correct extracted_text parent'\n )\n" ]
[ 0, 0, 0, 6, 6, 0 ]
[ "FunctionDef'", "Docstring", "For", "For", "Assign'", "Expr'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.delete_volume(VAR_7)\n", "self.common.client_logout()\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.delete_volume(volume)\n", "self.common.client_logout()\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_8(self, VAR_8=False):...\n", "if not self.NativeFiletypeCompletionAvailable(\n", "self._latest_completion_request = OmniCompletionRequest(self._omnicomp)\n", "VAR_5 = {}\n", "return self._latest_completion_request\n", "self._AddExtraConfDataIfNeeded(VAR_5)\n", "if VAR_8:\n", "VAR_5['force_semantic'] = True\n", "self._latest_completion_request = CompletionRequest(VAR_5\n ) if self._IsServerAlive() else None\n" ]
[ "def CreateCompletionRequest(self, force_semantic=False):...\n", "if not self.NativeFiletypeCompletionAvailable(\n", "self._latest_completion_request = OmniCompletionRequest(self._omnicomp)\n", "extra_data = {}\n", "return self._latest_completion_request\n", "self._AddExtraConfDataIfNeeded(extra_data)\n", "if force_semantic:\n", "extra_data['force_semantic'] = True\n", "self._latest_completion_request = CompletionRequest(extra_data\n ) if self._IsServerAlive() else None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'", "Expr'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_26():...\n", "return self.closed\n" ]
[ "def stop():...\n", "return self.closed\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13=logging.getLogger()):...\n", "\"\"\"docstring\"\"\"\n", "self.host_port = VAR_9\n", "self.device_port = VAR_10\n", "self.app_name = VAR_11\n", "self.uid = None\n", "self._adb = VAR_12\n", "self._client = None\n", "self._conn = None\n", "self._counter = None\n", "self._lock = threading.Lock()\n", "self._event_client = None\n", "self._log = VAR_13\n" ]
[ "def __init__(self, host_port, device_port, app_name, adb_proxy, log=logging...\n", "\"\"\"docstring\"\"\"\n", "self.host_port = host_port\n", "self.device_port = device_port\n", "self.app_name = app_name\n", "self.uid = None\n", "self._adb = adb_proxy\n", "self._client = None\n", "self._conn = None\n", "self._counter = None\n", "self._lock = threading.Lock()\n", "self._event_client = None\n", "self._log = log\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_17(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.contains('ynh_package_install') or self.contains('apt-get install'):\n", "FUNC_3('string')\n", "if self.contains('ynh_package_remove') or self.contains('apt-get remove'):\n", "FUNC_3('string')\n" ]
[ "def check_helper_usage_dependencies(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.contains('ynh_package_install') or self.contains('apt-get install'):\n", "print_warning(\n 'You should not use `ynh_package_install` or `apt-get install`, use `ynh_install_app_dependencies` instead'\n )\n", "if self.contains('ynh_package_remove') or self.contains('apt-get remove'):\n", "print_warning(\n 'You should not use `ynh_package_remove` or `apt-get remove`, use `ynh_remove_app_dependencies` instead'\n )\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_4(VAR_3):...\n", "VAR_10 = {onboarding.INTRODUCTION_INTRO: {'html': '<p>instructor_intro</p>',\n 'description': 'instructor_intro desc', 'title': 'instructor_intro'},\n onboarding.CREATE_COURSE: {'html': '<p>create_course</p>',\n 'description': 'create_course desc', 'title': 'create_course'},\n onboarding.CREATE_COURSELET: {'html': '<p>create_courselet</p>',\n 'description': 'create_courselet desc', 'title': 'create_courselet'},\n onboarding.NEXT_STEPS: {'html': '<p>next_steps</p>', 'description':\n 'next_steps desc', 'title': 'next_steps'}, onboarding.INVITE_SOMEBODY:\n {'html': '<p>invite_somebody</p>', 'description':\n 'invite_somebody desc', 'title': 'invite_somebody'}, onboarding.\n CREATE_THREAD: {'html': '<p>create_thread</p>', 'description':\n 'create_thread desc', 'title': 'create_thread'}, onboarding.\n VIEW_INTRODUCTION: {'html': '<p>view_introduction</p>', 'description':\n 'view_introduction desc', 'title': 'view_introduction'}, onboarding.\n PREVIEW_COURSELET: {'html': '<p>preview_courselet</p>', 'description':\n 'preview_courselet desc', 'title': 'preview_courselet'}}\n", "return VAR_10[VAR_3]\n" ]
[ "def mocked_setting(setting_name):...\n", "data = {onboarding.INTRODUCTION_INTRO: {'html': '<p>instructor_intro</p>',\n 'description': 'instructor_intro desc', 'title': 'instructor_intro'},\n onboarding.CREATE_COURSE: {'html': '<p>create_course</p>',\n 'description': 'create_course desc', 'title': 'create_course'},\n onboarding.CREATE_COURSELET: {'html': '<p>create_courselet</p>',\n 'description': 'create_courselet desc', 'title': 'create_courselet'},\n onboarding.NEXT_STEPS: {'html': '<p>next_steps</p>', 'description':\n 'next_steps desc', 'title': 'next_steps'}, onboarding.INVITE_SOMEBODY:\n {'html': '<p>invite_somebody</p>', 'description':\n 'invite_somebody desc', 'title': 'invite_somebody'}, onboarding.\n CREATE_THREAD: {'html': '<p>create_thread</p>', 'description':\n 'create_thread desc', 'title': 'create_thread'}, onboarding.\n VIEW_INTRODUCTION: {'html': '<p>view_introduction</p>', 'description':\n 'view_introduction desc', 'title': 'view_introduction'}, onboarding.\n PREVIEW_COURSELET: {'html': '<p>preview_courselet</p>', 'description':\n 'preview_courselet desc', 'title': 'preview_courselet'}}\n", "return data[setting_name]\n" ]
[ 0, 6, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_24(self, VAR_6):...\n", "return self.is_localhost(VAR_6['host'])\n" ]
[ "def run_on_localhost(self, comp):...\n", "return self.is_localhost(comp['host'])\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_6(self, VAR_41):...\n", "if VAR_41:\n", "VAR_95 = Thing._by_fullname(VAR_41, False, data=True)\n", "abort(403, 'forbidden')\n", "if isinstance(VAR_95, Message):\n", "return VAR_95\n", "VAR_52 = VAR_95.subreddit_slow\n", "if VAR_101.user_is_loggedin and VAR_52.can_comment(VAR_101.user):\n", "return VAR_95\n" ]
[ "def run(self, fullname):...\n", "if fullname:\n", "parent = Thing._by_fullname(fullname, False, data=True)\n", "abort(403, 'forbidden')\n", "if isinstance(parent, Message):\n", "return parent\n", "sr = parent.subreddit_slow\n", "if c.user_is_loggedin and sr.can_comment(c.user):\n", "return parent\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_23():...\n", "return threading.current_thread().getName() == 'MainThread'\n" ]
[ "def is_main_thread():...\n", "return threading.current_thread().getName() == 'MainThread'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_24(self, VAR_54):...\n", "\"\"\"docstring\"\"\"\n", "return MySQLdb.escape_string(VAR_54)\n" ]
[ "def _sql_injection_proof(self, value):...\n", "\"\"\"docstring\"\"\"\n", "return MySQLdb.escape_string(value)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@handler('request_value_changed')...\n", "if VAR_10.handled:\n", "return\n", "VAR_4, VAR_8 = VAR_10.event.args[:2]\n", "if VAR_10.result and not VAR_10.errors:\n", "VAR_8.body = VAR_10.value\n", "if VAR_10.promise:\n", "self.fire(response(VAR_8))\n", "VAR_10.event.notify = True\n", "self.fire(httperror(VAR_4, VAR_8, error=value.value))\n" ]
[ "@handler('request_value_changed')...\n", "if value.handled:\n", "return\n", "req, res = value.event.args[:2]\n", "if value.result and not value.errors:\n", "res.body = value.value\n", "if value.promise:\n", "self.fire(response(res))\n", "value.event.notify = True\n", "self.fire(httperror(req, res, error=value.value))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def __hash__(self):...\n", "return hash(tuple(self))\n" ]
[ "def __hash__(self):...\n", "return hash(tuple(self))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "\"\"\"Front-end UI.\"\"\"\n", "import logging\n", "import os\n", "import webapp2\n", "from components import auth\n", "from components import datastore_utils\n", "from components import template\n", "from components import utils\n", "import handlers_endpoints\n", "import models\n", "VAR_0 = os.path.dirname(os.path.abspath(__file__))\n", "\"\"\"Catalog handler.\"\"\"\n", "@auth.require(auth.is_admin)...\n", "VAR_4 = {'machines': [], 'next_page_token': None}\n", "if VAR_1:\n", "VAR_5 = models.CatalogMachineEntry.get_by_id(VAR_1)\n", "VAR_6 = models.CatalogMachineEntry.query().order(models.CatalogMachineEntry\n .dimensions.hostname)\n", "if not VAR_5:\n", "VAR_7 = self.request.get('page_token') or ''\n", "self.abort(404)\n", "VAR_4['machines'] = [VAR_5]\n", "VAR_4['machines'], VAR_4['next_page_token'] = datastore_utils.fetch_page(VAR_6,\n 50, VAR_7)\n", "self.response.write(template.render('templates/catalog.html', VAR_4=params))\n", "\"\"\"Lease request handler.\"\"\"\n", "@auth.require(auth.is_admin)...\n", "VAR_4 = {'lease_requests': [], 'next_page_token': None, 'now_ts': utils.\n time_time()}\n", "if VAR_2:\n", "VAR_8 = models.LeaseRequest.get_by_id(VAR_2)\n", "VAR_6 = models.LeaseRequest.query().order(-models.LeaseRequest.last_modified_ts\n )\n", "if not VAR_8:\n", "VAR_7 = self.request.get('page_token') or ''\n", "self.abort(404)\n", "VAR_4['lease_requests'] = [VAR_8]\n", "VAR_4['lease_requests'], VAR_4['next_page_token'] = datastore_utils.fetch_page(\n VAR_6, 50, VAR_7)\n", "self.response.write(template.render('templates/leases.html', VAR_4=params))\n", "\"\"\"Root handler.\"\"\"\n", "@auth.public...\n", "VAR_4 = {'is_admin': auth.is_admin()}\n", "self.response.write(template.render('templates/root.html', VAR_4=params))\n", "def FUNC_0():...\n", "return [webapp2.Route('/', handler=RootHandler), webapp2.Route('/catalog',\n handler=CatalogHandler), webapp2.Route('/catalog/<machine_id>', handler\n =CatalogHandler), webapp2.Route('/leases', handler=LeaseRequestHandler),\n webapp2.Route('/leases/<lease_id>', handler=LeaseRequestHandler)]\n" ]
[ "\"\"\"Front-end UI.\"\"\"\n", "import logging\n", "import os\n", "import webapp2\n", "from components import auth\n", "from components import datastore_utils\n", "from components import template\n", "from components import utils\n", "import handlers_endpoints\n", "import models\n", "THIS_DIR = os.path.dirname(os.path.abspath(__file__))\n", "\"\"\"Catalog handler.\"\"\"\n", "@auth.require(auth.is_admin)...\n", "params = {'machines': [], 'next_page_token': None}\n", "if machine_id:\n", "machine = models.CatalogMachineEntry.get_by_id(machine_id)\n", "query = models.CatalogMachineEntry.query().order(models.CatalogMachineEntry\n .dimensions.hostname)\n", "if not machine:\n", "page_token = self.request.get('page_token') or ''\n", "self.abort(404)\n", "params['machines'] = [machine]\n", "params['machines'], params['next_page_token'] = datastore_utils.fetch_page(\n query, 50, page_token)\n", "self.response.write(template.render('templates/catalog.html', params=params))\n", "\"\"\"Lease request handler.\"\"\"\n", "@auth.require(auth.is_admin)...\n", "params = {'lease_requests': [], 'next_page_token': None, 'now_ts': utils.\n time_time()}\n", "if lease_id:\n", "lease_request = models.LeaseRequest.get_by_id(lease_id)\n", "query = models.LeaseRequest.query().order(-models.LeaseRequest.last_modified_ts\n )\n", "if not lease_request:\n", "page_token = self.request.get('page_token') or ''\n", "self.abort(404)\n", "params['lease_requests'] = [lease_request]\n", "params['lease_requests'], params['next_page_token'\n ] = datastore_utils.fetch_page(query, 50, page_token)\n", "self.response.write(template.render('templates/leases.html', params=params))\n", "\"\"\"Root handler.\"\"\"\n", "@auth.public...\n", "params = {'is_admin': auth.is_admin()}\n", "self.response.write(template.render('templates/root.html', params=params))\n", "def get_routes():...\n", "return [webapp2.Route('/', handler=RootHandler), webapp2.Route('/catalog',\n handler=CatalogHandler), webapp2.Route('/catalog/<machine_id>', handler\n =CatalogHandler), webapp2.Route('/leases', handler=LeaseRequestHandler),\n webapp2.Route('/leases/<lease_id>', handler=LeaseRequestHandler)]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "FunctionDef'", "Return'" ]
[ "def FUNC_10(self, VAR_32):...\n", "self.tables.append(VAR_32)\n", "VAR_0 = VAR_32[4:-1]\n", "if not self.flags.ignore_permissions and not frappe.has_permission(VAR_0):\n", "frappe.flags.error_message = _('Insufficient Permission for {0}').format(frappe\n .bold(VAR_0))\n" ]
[ "def append_table(self, table_name):...\n", "self.tables.append(table_name)\n", "doctype = table_name[4:-1]\n", "if not self.flags.ignore_permissions and not frappe.has_permission(doctype):\n", "frappe.flags.error_message = _('Insufficient Permission for {0}').format(frappe\n .bold(doctype))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Assign'" ]
[ "def __init__(self, VAR_20, *VAR_17, **VAR_10):...\n", "assert isinstance(VAR_20, CLASS_2)\n", "VAR_28 = CLASS_3(VAR_20.key_name, *VAR_20.source_expressions, **\n key_transform.extra)\n", "super().__init__(VAR_28, *VAR_17, **kwargs)\n" ]
[ "def __init__(self, key_transform, *args, **kwargs):...\n", "assert isinstance(key_transform, KeyTransform)\n", "key_text_transform = KeyTextTransform(key_transform.key_name, *\n key_transform.source_expressions, **key_transform.extra)\n", "super().__init__(key_text_transform, *args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assert'", "Assign'", "Expr'" ]
[ "def FUNC_2(self, VAR_13):...\n", "VAR_23 = False\n", "VAR_24 = False\n", "if self.notRegex:\n", "VAR_36 = re.search(self.notRegex, VAR_13)\n", "if self.trueRegex and not VAR_23:\n", "if VAR_36 == None:\n", "VAR_36 = re.search(self.trueRegex, VAR_13)\n", "return VAR_23\n", "VAR_23 = True\n", "if VAR_36:\n", "if self.trueRegex:\n", "VAR_23 = str(VAR_36.group(1))\n", "VAR_23 = str(VAR_36.group(0))\n", "VAR_45 = re.search(self.trueRegex, VAR_13)\n", "if VAR_45:\n", "VAR_23 = str(VAR_45.groups())\n" ]
[ "def isASuccessfulUpload(self, html):...\n", "result = False\n", "validExt = False\n", "if self.notRegex:\n", "fileUploaded = re.search(self.notRegex, html)\n", "if self.trueRegex and not result:\n", "if fileUploaded == None:\n", "fileUploaded = re.search(self.trueRegex, html)\n", "return result\n", "result = True\n", "if fileUploaded:\n", "if self.trueRegex:\n", "result = str(fileUploaded.group(1))\n", "result = str(fileUploaded.group(0))\n", "moreInfo = re.search(self.trueRegex, html)\n", "if moreInfo:\n", "result = str(moreInfo.groups())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Return'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "@renderer...\n", "return CLASS_0(self.disclaimer_banner_file).render(VAR_5)\n" ]
[ "@renderer...\n", "return DisclaimerElement(self.disclaimer_banner_file).render(request)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_9(VAR_2):...\n", "assert VAR_2 == 'hello'\n" ]
[ "def assert_warn(line):...\n", "assert line == 'hello'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assert'" ]
[ "def FUNC_2(self, VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = VAR_2['nome']\n", "VAR_8 = VAR_2['sobrenome']\n", "VAR_9 = VAR_2['endereco']\n", "VAR_10 = 'INSERT INTO users (nome, sobrenome, endereco) VALUES (%s,%s,%s)'\n", "VAR_11 = VAR_7, VAR_8, VAR_9\n", "self.cursor.execute(VAR_10, VAR_11)\n", "print('Error: {}'.format(error))\n", "self.__connection.commit()\n", "self.cursor.lastrowid\n" ]
[ "def insert(self, table, content):...\n", "\"\"\"docstring\"\"\"\n", "nome = content['nome']\n", "sobrenome = content['sobrenome']\n", "endereco = content['endereco']\n", "add_user = 'INSERT INTO users (nome, sobrenome, endereco) VALUES (%s,%s,%s)'\n", "data_user = nome, sobrenome, endereco\n", "self.cursor.execute(add_user, data_user)\n", "print('Error: {}'.format(error))\n", "self.__connection.commit()\n", "self.cursor.lastrowid\n" ]
[ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "\"\"\"string\"\"\"\n", "import argparse\n", "import importlib\n", "import os\n", "import sys\n", "from parlai.core.agents import get_agent_module, get_task_module\n", "from parlai.tasks.tasks import ids_to_tasks\n", "def FUNC_0(VAR_0):...\n", "VAR_3 = VAR_0.lower()\n", "if VAR_3 in ('yes', 'true', 't', '1', 'y'):\n", "return True\n", "if VAR_3 in ('no', 'false', 'f', 'n', '0'):\n", "return False\n", "def FUNC_1(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "if ':' not in VAR_0:\n", "VAR_4 = VAR_0.split(':')\n", "VAR_5 = importlib.import_module(VAR_4[0])\n", "return getattr(VAR_5, VAR_4[1])\n" ]
[ "\"\"\"Provides an argument parser and a set of default command line options for\nusing the ParlAI package.\n\"\"\"\n", "import argparse\n", "import importlib\n", "import os\n", "import sys\n", "from parlai.core.agents import get_agent_module, get_task_module\n", "from parlai.tasks.tasks import ids_to_tasks\n", "def str2bool(value):...\n", "v = value.lower()\n", "if v in ('yes', 'true', 't', '1', 'y'):\n", "return True\n", "if v in ('no', 'false', 'f', 'n', '0'):\n", "return False\n", "def str2class(value):...\n", "\"\"\"docstring\"\"\"\n", "if ':' not in value:\n", "name = value.split(':')\n", "module = importlib.import_module(name[0])\n", "return getattr(module, name[1])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Condition", "Return'", "Condition", "Return'", "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(self):...\n", "VAR_14 = []\n", "VAR_4 = list(self.actors.keys())\n", "for ind1 in range(len(VAR_4)):\n", "for ind2 in range(ind1 + 1, len(VAR_4)):\n", "return VAR_14\n", "VAR_17 = self.actors[VAR_4[ind1]].collideWith(self.actors[VAR_4[ind2]])\n", "VAR_14 = VAR_14 + VAR_17\n" ]
[ "def getCollisionCommands(self):...\n", "all_commands = []\n", "keys = list(self.actors.keys())\n", "for ind1 in range(len(keys)):\n", "for ind2 in range(ind1 + 1, len(keys)):\n", "return all_commands\n", "commands = self.actors[keys[ind1]].collideWith(self.actors[keys[ind2]])\n", "all_commands = all_commands + commands\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "For", "Return'", "Assign'", "Assign'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "return list(listfiles(VAR_12, VAR_13=restriction, VAR_14=omit_value))\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "return list(listfiles(pattern, restriction=restriction, omit_value=omit_value))\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_0(VAR_0, *, VAR_1: Optional[int]=None, VAR_2: Optional[str]=None,...\n", "VAR_9 = []\n", "params: Union[tuple, Tuple[Any]] = ()\n", "if VAR_1:\n", "VAR_9.append(f'user_id = {VAR_1}')\n", "if VAR_2:\n", "VAR_9.append('updated_at >= ?')\n", "if VAR_3:\n", "params += VAR_2,\n", "VAR_9.append(f\"updated_at <= '{VAR_3}'\")\n", "if VAR_4:\n", "VAR_9.append(f'LOWER(content) LIKE ?')\n", "VAR_10 = (\n 'SELECT note_id, user_id, content, created_at, updated_at FROM note' +\n ' WHERE ' + ' AND '.join(VAR_9) + ' ORDER BY updated_at DESC')\n", "params += f'%{VAR_4.lower()}%',\n", "return db.fetchall(VAR_5, CLASS_0, VAR_10, params)\n" ]
[ "def find_notes(conn, *, user_id: Optional[int]=None, from_date: Optional[...\n", "conditions = []\n", "params: Union[tuple, Tuple[Any]] = ()\n", "if user_id:\n", "conditions.append(f'user_id = {user_id}')\n", "if from_date:\n", "conditions.append('updated_at >= ?')\n", "if to_date:\n", "params += from_date,\n", "conditions.append(f\"updated_at <= '{to_date}'\")\n", "if search:\n", "conditions.append(f'LOWER(content) LIKE ?')\n", "sql = (\n 'SELECT note_id, user_id, content, created_at, updated_at FROM note' +\n ' WHERE ' + ' AND '.join(conditions) + ' ORDER BY updated_at DESC')\n", "params += f'%{search.lower()}%',\n", "return db.fetchall(cur, Note, sql, params)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "Condition", "Assign'", "AnnAssign'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "AugAssign'", "Expr'", "Condition", "Expr'", "Assign'", "AugAssign'", "Return'" ]
[ "def FUNC_4(self):...\n", "VAR_3 = ('INSERT INTO jdk_entries ' +\n '(title, body, date_created, date_last_modified)' + \"VALUES ('', '', \" +\n VAR_1 + ', ' + VAR_1 + ');')\n", "FUNC_0(VAR_3)\n", "return None\n" ]
[ "def create_entry(self):...\n", "sql = ('INSERT INTO jdk_entries ' +\n '(title, body, date_created, date_last_modified)' + \"VALUES ('', '', \" +\n CURRENT_DATESTAMP + ', ' + CURRENT_DATESTAMP + ');')\n", "db_execute(sql)\n", "return None\n" ]
[ 0, 4, 4, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_5(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['like', 'J%']}))\n" ]
[ "def test_filters_3(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['like', 'J%']}))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@FUNC_0...\n", "VAR_27 = VAR_10.get_transport()\n", "VAR_7 = VAR_27.open_session()\n", "VAR_7.invoke_shell()\n", "VAR_0.debug(_('Reading CLI MOTD'))\n", "self._get_output(VAR_7)\n", "VAR_28 = 'stty columns 255'\n", "VAR_0.debug(_(\"Setting CLI terminal width: '%s'\"), VAR_28)\n", "VAR_7.send(VAR_28 + '\\r')\n", "VAR_25 = self._get_output(VAR_7)\n", "VAR_0.debug(_(\"Sending CLI command: '%s'\"), VAR_11)\n", "VAR_7.send(VAR_11 + '\\r')\n", "VAR_25 = self._get_output(VAR_7)\n", "VAR_7.close()\n", "if any(line.startswith(('% Error', 'Error:')) for line in VAR_25):\n", "VAR_37 = _('Error executing EQL command')\n", "return VAR_25\n", "VAR_38 = '\\n'.join(VAR_25)\n", "VAR_0.error(VAR_38)\n" ]
[ "@with_timeout...\n", "transport = ssh.get_transport()\n", "chan = transport.open_session()\n", "chan.invoke_shell()\n", "LOG.debug(_('Reading CLI MOTD'))\n", "self._get_output(chan)\n", "cmd = 'stty columns 255'\n", "LOG.debug(_(\"Setting CLI terminal width: '%s'\"), cmd)\n", "chan.send(cmd + '\\r')\n", "out = self._get_output(chan)\n", "LOG.debug(_(\"Sending CLI command: '%s'\"), command)\n", "chan.send(command + '\\r')\n", "out = self._get_output(chan)\n", "chan.close()\n", "if any(line.startswith(('% Error', 'Error:')) for line in out):\n", "desc = _('Error executing EQL command')\n", "return out\n", "cmdout = '\\n'.join(out)\n", "LOG.error(cmdout)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "For", "Assign'", "Return'", "Assign'", "Expr'" ]
[ "def FUNC_1(self, VAR_5):...\n", "for p in self.ALLOWED_PATHS:\n", "if VAR_5.startswith(p):\n", "return False\n", "return True\n" ]
[ "def _path_allowed(self, path):...\n", "for p in self.ALLOWED_PATHS:\n", "if path.startswith(p):\n", "return False\n", "return True\n" ]
[ 0, 5, 5, 5, 5 ]
[ "FunctionDef'", "For", "Condition", "Return'", "Return'" ]
[ "@classmethod...\n", "return JarDependency(org='org.scala-lang', VAR_5=name, rev=scala_build_info\n [version].full_version)\n" ]
[ "@classmethod...\n", "return JarDependency(org='org.scala-lang', name=name, rev=scala_build_info[\n version].full_version)\n" ]
[ 7, 0 ]
[ "Condition", "Return'" ]
[ "@VAR_0.route('/delete_crawl', methods=['POST'])...\n", "VAR_7 = request.form['cid']\n", "VAR_28 = VAR_1.connection.cursor()\n", "VAR_29 = VAR_28.execute('DELETE FROM Crawls WHERE cid = %s' % VAR_7)\n", "VAR_1.connection.commit()\n", "VAR_28.close()\n", "flash('Crawl successfully removed', 'success')\n", "return redirect(url_for('dashboard'))\n" ]
[ "@app.route('/delete_crawl', methods=['POST'])...\n", "cid = request.form['cid']\n", "cur = mysql.connection.cursor()\n", "result = cur.execute('DELETE FROM Crawls WHERE cid = %s' % cid)\n", "mysql.connection.commit()\n", "cur.close()\n", "flash('Crawl successfully removed', 'success')\n", "return redirect(url_for('dashboard'))\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = []\n", "VAR_7 = self.pool.get('ir.model.data')\n", "VAR_8 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n", "VAR_9 = self.pool.get('account.bank.statement')\n", "VAR_10 = self.pool.get('ir.sequence')\n", "VAR_11 = self.pool.get('account.journal')\n", "VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n", "VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_12)))\n", "VAR_13 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "for journal in VAR_11.browse(VAR_2, VAR_3, VAR_13):\n", "VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n", "VAR_14 = self.pool.get('ir.model.data')\n", "if len(VAR_4):\n", "VAR_15 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n", "VAR_17 = ''\n", "VAR_16 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if VAR_15:\n", "VAR_17 = VAR_10.get_id(VAR_2, VAR_3, journal.sequence_id.id)\n", "VAR_17 = VAR_10.get(VAR_2, VAR_3, 'account.bank.statement')\n", "VAR_15 = VAR_14.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n", "if VAR_16:\n", "VAR_18 = VAR_9.create(VAR_2, VAR_3, {'journal_id': journal.id, 'company_id':\n VAR_8, 'user_id': VAR_3, 'state': 'open', 'name': VAR_17,\n 'starting_details_ids': VAR_9._get_cash_close_box_lines(VAR_2, VAR_3, [])})\n", "VAR_16 = VAR_14.browse(VAR_2, VAR_3, VAR_16, VAR_5=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(VAR_15, 'tree'), (VAR_16, 'form')],\n 'type': 'ir.actions.act_window'}\n", "VAR_9.button_open(VAR_2, VAR_3, [VAR_18], VAR_5)\n" ]
[ "def open_statement(self, cr, uid, ids, context):...\n", "\"\"\"docstring\"\"\"\n", "list_statement = []\n", "mod_obj = self.pool.get('ir.model.data')\n", "company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n", "statement_obj = self.pool.get('account.bank.statement')\n", "sequence_obj = self.pool.get('ir.sequence')\n", "journal_obj = self.pool.get('account.journal')\n", "cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n", "j_ids = map(lambda x1: x1[0], cr.fetchall())\n", "cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n", "journal_ids = map(lambda x1: x1[0], cr.fetchall())\n", "for journal in journal_obj.browse(cr, uid, journal_ids):\n", "ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n", "data_obj = self.pool.get('ir.model.data')\n", "if len(ids):\n", "id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n", "number = ''\n", "id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if id2:\n", "number = sequence_obj.get_id(cr, uid, journal.sequence_id.id)\n", "number = sequence_obj.get(cr, uid, 'account.bank.statement')\n", "id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n", "if id3:\n", "statement_id = statement_obj.create(cr, uid, {'journal_id': journal.id,\n 'company_id': company_id, 'user_id': uid, 'state': 'open', 'name':\n number, 'starting_details_ids': statement_obj._get_cash_close_box_lines\n (cr, uid, [])})\n", "id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(id2, 'tree'), (id3, 'form')],\n 'type': 'ir.actions.act_window'}\n", "statement_obj.button_open(cr, uid, [statement_id], context)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_5(VAR_13):...\n", "\"\"\"docstring\"\"\"\n", "VAR_56 = in_f.readlines()\n", "VAR_33 = set(VAR_13.keys())\n", "for VAR_69, line in enumerate(VAR_56):\n", "VAR_46 = re.match('^(\\\\s*)\"([^\"]+)\":', line)\n", "for l in VAR_56:\n", "if VAR_46:\n", "out_f.write(l)\n", "if VAR_33:\n", "VAR_65, VAR_66 = VAR_46.groups()\n", "print('These configuration items were not set:')\n", "FUNC_2()\n", "if VAR_66 in VAR_33:\n", "print(' ' + ', '.join(sorted(list(VAR_33))))\n", "VAR_56[VAR_69] = '%s\"%s\": %s,\\n' % (VAR_65, VAR_66, VAR_13[VAR_66])\n", "VAR_33.remove(VAR_66)\n" ]
[ "def configure_cms(options):...\n", "\"\"\"docstring\"\"\"\n", "lines = in_f.readlines()\n", "unset = set(options.keys())\n", "for i, line in enumerate(lines):\n", "g = re.match('^(\\\\s*)\"([^\"]+)\":', line)\n", "for l in lines:\n", "if g:\n", "out_f.write(l)\n", "if unset:\n", "whitespace, key = g.groups()\n", "print('These configuration items were not set:')\n", "read_cms_config()\n", "if key in unset:\n", "print(' ' + ', '.join(sorted(list(unset))))\n", "lines[i] = '%s\"%s\": %s,\\n' % (whitespace, key, options[key])\n", "unset.remove(key)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "For", "Assign'", "For", "Condition", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_5(self, VAR_7):...\n", "return VAR_54.db.get_value(self.doctype, self.name, VAR_7)\n" ]
[ "def get_db_value(self, key):...\n", "return frappe.db.get_value(self.doctype, self.name, key)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "async def FUNC_5(VAR_6):...\n", "VAR_10 = {'Authorization': f'Bearer {VAR_1}'}\n", "VAR_7 = {'date': '2015-06-20', 'distance': 2000, 'time': 405, 'location':\n '32.0853 34.7818'}\n", "VAR_8 = await VAR_6.post('/results', VAR_10=headers, VAR_7=json.dumps(data))\n", "assert VAR_8.status == 201\n" ]
[ "async def test_positive_jogging_result(test_cli):...\n", "headers = {'Authorization': f'Bearer {access_token}'}\n", "data = {'date': '2015-06-20', 'distance': 2000, 'time': 405, 'location':\n '32.0853 34.7818'}\n", "resp = await test_cli.post('/results', headers=headers, data=json.dumps(data))\n", "assert resp.status == 201\n" ]
[ 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Assign'", "Assign'", "Assign'", "Assert'" ]
[ "def FUNC_8(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = b64encode(self.urandom(24)).decode('utf-8')\n", "VAR_18['oidc_csrf_token'] = VAR_17\n", "VAR_19 = {'csrf_token': VAR_17, 'destination': VAR_10}\n", "VAR_20 = {'state': json.dumps(VAR_19)}\n", "VAR_16 = self.flow_for_request()\n", "VAR_21 = '{url}&{extra_params}'.format(url=flow.step1_get_authorize_url(),\n VAR_20=urlencode(extra_params))\n", "self.set_cookie_id_token(None)\n", "return redirect(VAR_21)\n" ]
[ "def redirect_to_auth_server(self, destination):...\n", "\"\"\"docstring\"\"\"\n", "csrf_token = b64encode(self.urandom(24)).decode('utf-8')\n", "session['oidc_csrf_token'] = csrf_token\n", "state = {'csrf_token': csrf_token, 'destination': destination}\n", "extra_params = {'state': json.dumps(state)}\n", "flow = self.flow_for_request()\n", "auth_url = '{url}&{extra_params}'.format(url=flow.step1_get_authorize_url(),\n extra_params=urlencode(extra_params))\n", "self.set_cookie_id_token(None)\n", "return redirect(auth_url)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_4(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = self.getfile(VAR_21, VAR_23=True)\n", "if VAR_24 is not False:\n", "return True\n" ]
[ "def exists(self, path):...\n", "\"\"\"docstring\"\"\"\n", "f = self.getfile(path, follow_symlinks=True)\n", "if f is not False:\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'" ]
[ "def FUNC_3(self):...\n", "VAR_10 = VAR_11(self.container, self)\n", "self.frames[VAR_11] = VAR_10\n", "VAR_10.grid(row=0, column=0, sticky='nsew')\n", "self.show_frame(VAR_11)\n" ]
[ "def custom_frame(self):...\n", "result_frame = ResultsPage(self.container, self)\n", "self.frames[ResultsPage] = result_frame\n", "result_frame.grid(row=0, column=0, sticky='nsew')\n", "self.show_frame(ResultsPage)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9=None, VAR_10=None,...\n", "threading.Thread.__init__(self)\n", "self.username = VAR_5\n", "self.password = VAR_6\n", "self.metrics = VAR_7\n", "self.tasks = VAR_8\n", "self.log = VAR_9\n", "self.base_url = VAR_10\n", "self.submissions_path = VAR_11\n", "self.name = 'Actor thread for user %s' % self.username\n", "self.browser = Browser()\n", "self.die = False\n" ]
[ "def __init__(self, username, password, metrics, tasks, log=None, base_url=...\n", "threading.Thread.__init__(self)\n", "self.username = username\n", "self.password = password\n", "self.metrics = metrics\n", "self.tasks = tasks\n", "self.log = log\n", "self.base_url = base_url\n", "self.submissions_path = submissions_path\n", "self.name = 'Actor thread for user %s' % self.username\n", "self.browser = Browser()\n", "self.die = False\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def __init__(self):...\n", "self.content = VAR_2\n" ]
[ "def __init__(self):...\n", "self.content = content\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_24(self, VAR_30):...\n", "\"\"\"docstring\"\"\"\n", "return self.build_graph.resolve(VAR_30)\n" ]
[ "def resolve(self, spec):...\n", "\"\"\"docstring\"\"\"\n", "return self.build_graph.resolve(spec)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_0(VAR_3):...\n", "@functools.wraps(VAR_3)...\n", "VAR_23 = VAR_5.pop('timeout', None)\n", "VAR_24 = eventlet.spawn(VAR_3, self, *VAR_4, **kwargs)\n", "if VAR_23 is None:\n", "return VAR_24.wait()\n", "VAR_36 = eventlet.spawn_after(VAR_23, VAR_24.kill)\n", "VAR_48 = VAR_24.wait()\n", "VAR_36.cancel()\n", "return FUNC_1\n", "return VAR_48\n" ]
[ "def with_timeout(f):...\n", "@functools.wraps(f)...\n", "timeout = kwargs.pop('timeout', None)\n", "gt = eventlet.spawn(f, self, *args, **kwargs)\n", "if timeout is None:\n", "return gt.wait()\n", "kill_thread = eventlet.spawn_after(timeout, gt.kill)\n", "res = gt.wait()\n", "kill_thread.cancel()\n", "return __inner\n", "return res\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_6(self, VAR_20, VAR_12, VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_20:\n", "VAR_12.standard_price = VAR_16\n" ]
[ "def fix_quant_data(self, quant, prod, cost):...\n", "\"\"\"docstring\"\"\"\n", "if not quant:\n", "prod.standard_price = cost\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'" ]
[ "def FUNC_4(self):...\n", "VAR_15 = []\n", "VAR_16 = datetime.now(timezone(timedelta(hours=+9), 'JST'))\n", "VAR_16 = VAR_16.replace(hour=0, minute=0, second=0, microsecond=0)\n", "for day in range(30)[::-1]:\n", "VAR_18 = VAR_16 - timedelta(days=day)\n", "return VAR_15\n", "VAR_19 = VAR_16 - timedelta(days=day - 1)\n", "VAR_12 = self.object_list.filter(datetime__gte=from_date, datetime__lte=to_date\n ).count()\n", "VAR_15.append(VAR_12)\n" ]
[ "def thirty_day_data(self):...\n", "data = []\n", "today = datetime.now(timezone(timedelta(hours=+9), 'JST'))\n", "today = today.replace(hour=0, minute=0, second=0, microsecond=0)\n", "for day in range(30)[::-1]:\n", "from_date = today - timedelta(days=day)\n", "return data\n", "to_date = today - timedelta(days=day - 1)\n", "count = self.object_list.filter(datetime__gte=from_date, datetime__lte=to_date\n ).count()\n", "data.append(count)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_7(self, VAR_7):...\n", "VAR_10 = os.path.join(logging.log_path, 'AndroidDevice%s' % self.serial,\n 'BugReports', 'test_something,sometime,%s' % self.serial)\n", "assert VAR_10 in VAR_7, \"Expected '%s', got '%s'.\" % (VAR_10, VAR_7)\n" ]
[ "def bugreport(self, params):...\n", "expected = os.path.join(logging.log_path, 'AndroidDevice%s' % self.serial,\n 'BugReports', 'test_something,sometime,%s' % self.serial)\n", "assert expected in params, \"Expected '%s', got '%s'.\" % (expected, params)\n" ]
[ 0, 2, 2 ]
[ "FunctionDef'", "Assign'", "Assert'" ]
[ "def FUNC_2(self):...\n", "return HttpResponseRedirect(self.failure_url)\n" ]
[ "def login_failure(self):...\n", "return HttpResponseRedirect(self.failure_url)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_21(self, VAR_17, VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "self._check_volume(VAR_16)\n", "VAR_0.warn(_('Volume %s is not found!, it may have been deleted'), VAR_16[\n 'name'])\n", "VAR_0.error(_('Failed to ensure export of volume %s'), VAR_16['name'])\n" ]
[ "def ensure_export(self, context, volume):...\n", "\"\"\"docstring\"\"\"\n", "self._check_volume(volume)\n", "LOG.warn(_('Volume %s is not found!, it may have been deleted'), volume['name']\n )\n", "LOG.error(_('Failed to ensure export of volume %s'), volume['name'])\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self):...\n", "self._sqlite_engine_cache = Cache()\n" ]
[ "def __init__(self):...\n", "self._sqlite_engine_cache = Cache()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_19(self, VAR_16, VAR_20, VAR_21=False, **VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "self._eql_execute('volume', 'select', VAR_16['name'], 'access', 'delete', '1')\n", "VAR_0.error(_('Failed to terminate connection to volume %s'), VAR_16['name'])\n" ]
[ "def terminate_connection(self, volume, connector, force=False, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "self._eql_execute('volume', 'select', volume['name'], 'access', 'delete', '1')\n", "LOG.error(_('Failed to terminate connection to volume %s'), volume['name'])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'" ]
[ "def FUNC_11(self, VAR_8):...\n", "if not self.current_user:\n", "return False\n", "if self.current_user.admin:\n", "return True\n", "VAR_8 = GroupList.check(self.current_user.key, VAR_8, self.sql_session)\n", "return bool(VAR_8)\n" ]
[ "def is_group_user(self, group):...\n", "if not self.current_user:\n", "return False\n", "if self.current_user.admin:\n", "return True\n", "group = GroupList.check(self.current_user.key, group, self.sql_session)\n", "return bool(group)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Return'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = {'TEST_STACK': str(CLASS_0.DEFAULT_TEST_ID), 'TEST_APP': \n 'gcpsmoketest' + CLASS_0.DEFAULT_TEST_ID}\n", "return st.ScenarioTestRunner.main(CLASS_0, default_binding_overrides=\n defaults, test_case_list=[GoogleSmokeTest])\n" ]
[ "def main():...\n", "\"\"\"docstring\"\"\"\n", "defaults = {'TEST_STACK': str(GoogleSmokeTestScenario.DEFAULT_TEST_ID),\n 'TEST_APP': 'gcpsmoketest' + GoogleSmokeTestScenario.DEFAULT_TEST_ID}\n", "return st.ScenarioTestRunner.main(GoogleSmokeTestScenario,\n default_binding_overrides=defaults, test_case_list=[GoogleSmokeTest])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_6(self, VAR_11, VAR_12, VAR_10):...\n", "return True\n" ]
[ "def validate(self, levelfields, path_list, client):...\n", "return True\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import fnmatch\n", "import inspect\n", "import logging\n", "import os\n", "import random\n", "import re\n", "import string\n", "import tarfile\n", "import threading\n", "import tempfile\n", "import shutil\n", "import subprocess\n", "import sys\n", "from datetime import datetime\n", "from concurrent.futures import ThreadPoolExecutor\n", "from .sosnode import SosNode\n", "from distutils.sysconfig import get_python_lib\n", "from getpass import getpass\n", "from six.moves import input\n", "from textwrap import fill\n", "from soscollector import __version__\n", "\"\"\"Main sos-collector class\"\"\"\n", "def __init__(self, VAR_0):...\n", "os.umask(63)\n", "self.config = VAR_0\n", "self.client_list = []\n", "self.node_list = []\n", "self.master = False\n", "self.retrieved = 0\n", "self.need_local_sudo = False\n", "self.clusters = self.config['cluster_types']\n", "if not self.config['list_options']:\n", "def FUNC_0(self):...\n", "if not self.config['tmp_dir']:\n", "self._exit('Exiting on user cancel', 130)\n", "self.logger = logging.getLogger('sos_collector')\n", "self.create_tmp_dir()\n", "self._setup_logging()\n", "self.logger.setLevel(logging.DEBUG)\n", "self.log_debug('Executing %s' % ' '.join(s for s in sys.argv))\n", "self.logfile = tempfile.NamedTemporaryFile(mode='w+', dir=self.config[\n 'tmp_dir'], delete=False)\n", "self.log_debug('Found cluster profiles: %s' % self.clusters.keys())\n", "VAR_7 = logging.StreamHandler(self.logfile)\n", "self.log_debug('Found supported host types: %s' % self.config['host_types']\n .keys())\n", "VAR_7.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s'))\n", "self._parse_options()\n", "VAR_7.setLevel(logging.DEBUG)\n", "self.prep()\n", "self.logger.addHandler(VAR_7)\n", "VAR_8 = logging.StreamHandler(sys.stderr)\n", "VAR_8.setFormatter(logging.Formatter('%(message)s'))\n", "self.console = logging.getLogger('sos_collector_console')\n", "self.console.setLevel(logging.DEBUG)\n", "self.console_log_file = tempfile.NamedTemporaryFile(mode='w+', dir=self.\n config['tmp_dir'], delete=False)\n", "VAR_9 = logging.StreamHandler(self.console_log_file)\n", "VAR_10 = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')\n", "VAR_9.setFormatter(VAR_10)\n", "self.console.addHandler(VAR_9)\n", "VAR_11 = logging.StreamHandler()\n", "VAR_12 = logging.Formatter('%(message)s')\n", "VAR_11.setFormatter(VAR_12)\n", "if self.config['verbose']:\n", "VAR_11.setLevel(logging.DEBUG)\n", "VAR_11.setLevel(logging.INFO)\n", "self.console.addHandler(VAR_11)\n", "def FUNC_1(self, VAR_1, VAR_2=1):...\n", "\"\"\"docstring\"\"\"\n", "self.log_error(VAR_1)\n", "self.close_all_connections()\n", "sys.exit(VAR_2)\n", "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['cluster_options']:\n", "for opt in self.config['cluster_options']:\n", "def FUNC_3(self, VAR_3, VAR_4):...\n", "VAR_32 = False\n", "\"\"\"docstring\"\"\"\n", "for option in self.clusters[opt.cluster].options:\n", "if not VAR_3.opt_type == bool:\n", "if opt.name == option.name:\n", "if not VAR_32:\n", "if not VAR_3.opt_type == VAR_4.opt_type:\n", "VAR_27 = VAR_4.value.lower()\n", "VAR_32 = True\n", "self._exit('Unknown option provided: %s.%s' % (opt.cluster, opt.name))\n", "VAR_1 = 'Invalid option type for %s. Expected %s got %s'\n", "return VAR_4.value\n", "if VAR_27 not in ['true', 'on', 'false', 'off']:\n", "option.value = self._validate_option(option, opt)\n", "self._exit(VAR_1 % (VAR_4.name, VAR_3.opt_type, VAR_4.opt_type))\n", "VAR_1 = (\n \"Invalid value for %s. Accepted values are: 'true', 'false', 'on', 'off'\")\n", "if VAR_27 in ['true', 'on']:\n", "self._exit(VAR_1 % VAR_4.name)\n", "return True\n", "return False\n", "def FUNC_4(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.info(VAR_1)\n", "self.console.info(VAR_1)\n", "def FUNC_5(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.warn(VAR_1)\n", "self.console.warn('WARNING: %s' % VAR_1)\n", "def FUNC_6(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.error(VAR_1)\n", "self.console.error(VAR_1)\n", "def FUNC_7(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = inspect.stack()[1][3]\n", "VAR_1 = '[sos_collector:%s] %s' % (VAR_13, VAR_1)\n", "self.logger.debug(VAR_1)\n", "if self.config['verbose']:\n", "self.console.debug(VAR_1)\n", "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = tempfile.mkdtemp(prefix='sos-collector-', dir='/var/tmp')\n", "self.config['tmp_dir'] = VAR_14\n", "self.config['tmp_dir_created'] = True\n", "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "print(\"\"\"\nThe following cluster options are available:\n\"\"\")\n", "print('{:15} {:15} {:<10} {:10} {:<}'.format('Cluster', 'Option Name',\n 'Type', 'Default', 'Description'))\n", "for VAR_39 in self.clusters:\n", "for opt in self.clusters[VAR_39].options:\n", "print('string')\n", "VAR_33 = '{:15} {:15} {:<10} {:<10} {:<10}'.format(opt.cluster, opt.name,\n opt.opt_type.__name__, str(opt.value), opt.description)\n", "def FUNC_10(self):...\n", "print(VAR_33)\n", "\"\"\"docstring\"\"\"\n", "shutil.rmtree(self.config['tmp_dir'])\n", "def FUNC_11(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = 'sos-collector'\n", "if self.config['label']:\n", "VAR_15 += '-%s' % self.config['label']\n", "if self.config['case_id']:\n", "VAR_15 += '-%s' % self.config['case_id']\n", "VAR_16 = datetime.strftime(datetime.now(), '%Y-%m-%d')\n", "string.lowercase = string.ascii_lowercase\n", "VAR_17 = ''.join(random.choice(string.lowercase) for x in range(5))\n", "return '%s-%s-%s' % (VAR_15, VAR_16, VAR_17)\n" ]
[ "import fnmatch\n", "import inspect\n", "import logging\n", "import os\n", "import random\n", "import re\n", "import string\n", "import tarfile\n", "import threading\n", "import tempfile\n", "import shutil\n", "import subprocess\n", "import sys\n", "from datetime import datetime\n", "from concurrent.futures import ThreadPoolExecutor\n", "from .sosnode import SosNode\n", "from distutils.sysconfig import get_python_lib\n", "from getpass import getpass\n", "from six.moves import input\n", "from textwrap import fill\n", "from soscollector import __version__\n", "\"\"\"Main sos-collector class\"\"\"\n", "def __init__(self, config):...\n", "os.umask(63)\n", "self.config = config\n", "self.client_list = []\n", "self.node_list = []\n", "self.master = False\n", "self.retrieved = 0\n", "self.need_local_sudo = False\n", "self.clusters = self.config['cluster_types']\n", "if not self.config['list_options']:\n", "def _setup_logging(self):...\n", "if not self.config['tmp_dir']:\n", "self._exit('Exiting on user cancel', 130)\n", "self.logger = logging.getLogger('sos_collector')\n", "self.create_tmp_dir()\n", "self._setup_logging()\n", "self.logger.setLevel(logging.DEBUG)\n", "self.log_debug('Executing %s' % ' '.join(s for s in sys.argv))\n", "self.logfile = tempfile.NamedTemporaryFile(mode='w+', dir=self.config[\n 'tmp_dir'], delete=False)\n", "self.log_debug('Found cluster profiles: %s' % self.clusters.keys())\n", "hndlr = logging.StreamHandler(self.logfile)\n", "self.log_debug('Found supported host types: %s' % self.config['host_types']\n .keys())\n", "hndlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s'))\n", "self._parse_options()\n", "hndlr.setLevel(logging.DEBUG)\n", "self.prep()\n", "self.logger.addHandler(hndlr)\n", "console = logging.StreamHandler(sys.stderr)\n", "console.setFormatter(logging.Formatter('%(message)s'))\n", "self.console = logging.getLogger('sos_collector_console')\n", "self.console.setLevel(logging.DEBUG)\n", "self.console_log_file = tempfile.NamedTemporaryFile(mode='w+', dir=self.\n config['tmp_dir'], delete=False)\n", "chandler = logging.StreamHandler(self.console_log_file)\n", "cfmt = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')\n", "chandler.setFormatter(cfmt)\n", "self.console.addHandler(chandler)\n", "ui = logging.StreamHandler()\n", "fmt = logging.Formatter('%(message)s')\n", "ui.setFormatter(fmt)\n", "if self.config['verbose']:\n", "ui.setLevel(logging.DEBUG)\n", "ui.setLevel(logging.INFO)\n", "self.console.addHandler(ui)\n", "def _exit(self, msg, error=1):...\n", "\"\"\"docstring\"\"\"\n", "self.log_error(msg)\n", "self.close_all_connections()\n", "sys.exit(error)\n", "def _parse_options(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['cluster_options']:\n", "for opt in self.config['cluster_options']:\n", "def _validate_option(self, default, cli):...\n", "match = False\n", "\"\"\"docstring\"\"\"\n", "for option in self.clusters[opt.cluster].options:\n", "if not default.opt_type == bool:\n", "if opt.name == option.name:\n", "if not match:\n", "if not default.opt_type == cli.opt_type:\n", "val = cli.value.lower()\n", "match = True\n", "self._exit('Unknown option provided: %s.%s' % (opt.cluster, opt.name))\n", "msg = 'Invalid option type for %s. Expected %s got %s'\n", "return cli.value\n", "if val not in ['true', 'on', 'false', 'off']:\n", "option.value = self._validate_option(option, opt)\n", "self._exit(msg % (cli.name, default.opt_type, cli.opt_type))\n", "msg = \"Invalid value for %s. Accepted values are: 'true', 'false', 'on', 'off'\"\n", "if val in ['true', 'on']:\n", "self._exit(msg % cli.name)\n", "return True\n", "return False\n", "def log_info(self, msg):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.info(msg)\n", "self.console.info(msg)\n", "def log_warn(self, msg):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.warn(msg)\n", "self.console.warn('WARNING: %s' % msg)\n", "def log_error(self, msg):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.error(msg)\n", "self.console.error(msg)\n", "def log_debug(self, msg):...\n", "\"\"\"docstring\"\"\"\n", "caller = inspect.stack()[1][3]\n", "msg = '[sos_collector:%s] %s' % (caller, msg)\n", "self.logger.debug(msg)\n", "if self.config['verbose']:\n", "self.console.debug(msg)\n", "def create_tmp_dir(self):...\n", "\"\"\"docstring\"\"\"\n", "tmpdir = tempfile.mkdtemp(prefix='sos-collector-', dir='/var/tmp')\n", "self.config['tmp_dir'] = tmpdir\n", "self.config['tmp_dir_created'] = True\n", "def list_options(self):...\n", "\"\"\"docstring\"\"\"\n", "print(\"\"\"\nThe following cluster options are available:\n\"\"\")\n", "print('{:15} {:15} {:<10} {:10} {:<}'.format('Cluster', 'Option Name',\n 'Type', 'Default', 'Description'))\n", "for cluster in self.clusters:\n", "for opt in self.clusters[cluster].options:\n", "print(\n \"\"\"\nOptions take the form of cluster.name=value\nE.G. \"ovirt.no-database=True\" or \"pacemaker.offline=False\\\"\"\"\"\n )\n", "optln = '{:15} {:15} {:<10} {:<10} {:<10}'.format(opt.cluster, opt.name,\n opt.opt_type.__name__, str(opt.value), opt.description)\n", "def delete_tmp_dir(self):...\n", "print(optln)\n", "\"\"\"docstring\"\"\"\n", "shutil.rmtree(self.config['tmp_dir'])\n", "def _get_archive_name(self):...\n", "\"\"\"docstring\"\"\"\n", "nstr = 'sos-collector'\n", "if self.config['label']:\n", "nstr += '-%s' % self.config['label']\n", "if self.config['case_id']:\n", "nstr += '-%s' % self.config['case_id']\n", "dt = datetime.strftime(datetime.now(), '%Y-%m-%d')\n", "string.lowercase = string.ascii_lowercase\n", "rand = ''.join(random.choice(string.lowercase) for x in range(5))\n", "return '%s-%s-%s' % (nstr, dt, rand)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "FunctionDef'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Condition", "For", "FunctionDef'", "Assign'", "Docstring", "For", "Condition", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Return'", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Return'", "Return'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "For", "For", "Expr'", "Assign'", "FunctionDef'", "Expr'", "Docstring", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_13(self):...\n", "self.run_test_case(self.scenario.delete_server_group(), max_retries=5)\n" ]
[ "def test_x_delete_server_group(self):...\n", "self.run_test_case(self.scenario.delete_server_group(), max_retries=5)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_11(self):...\n", "VAR_9 = []\n", "VAR_10 = {}\n", "for kid in self.child_groups:\n", "VAR_13 = kid.get_hosts()\n", "for VAR_14 in self.hosts:\n", "for VAR_15 in VAR_13:\n", "if VAR_14 not in VAR_10:\n", "return VAR_9\n", "if VAR_15 not in VAR_10:\n", "VAR_10[VAR_14] = 1\n", "VAR_10[VAR_15] = 1\n", "if self.name == 'all' and VAR_14.implicit:\n", "if self.name == 'all' and VAR_15.implicit:\n", "VAR_9.append(VAR_14)\n", "VAR_9.append(VAR_15)\n" ]
[ "def _get_hosts(self):...\n", "hosts = []\n", "seen = {}\n", "for kid in self.child_groups:\n", "kid_hosts = kid.get_hosts()\n", "for mine in self.hosts:\n", "for kk in kid_hosts:\n", "if mine not in seen:\n", "return hosts\n", "if kk not in seen:\n", "seen[mine] = 1\n", "seen[kk] = 1\n", "if self.name == 'all' and mine.implicit:\n", "if self.name == 'all' and kk.implicit:\n", "hosts.append(mine)\n", "hosts.append(kk)\n" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Assign'", "For", "For", "Condition", "Return'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_13(VAR_0, VAR_5, VAR_6, VAR_12=False):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_12:\n", "print('REMOVE OUTLIERS FAILED')\n", "db.engine.execute('DELETE FROM \"{0}\" WHERE \"{1}\" < {2}'.format(VAR_0, VAR_5,\n VAR_6))\n", "db.engine.execute('DELETE FROM \"{0}\" WHERE \"{1}\" > {2}'.format(VAR_0, VAR_5,\n VAR_6))\n" ]
[ "def remove_outliers(table_name, attr, value, smaller_than=False):...\n", "\"\"\"docstring\"\"\"\n", "if smaller_than:\n", "print('REMOVE OUTLIERS FAILED')\n", "db.engine.execute('DELETE FROM \"{0}\" WHERE \"{1}\" < {2}'.format(table_name,\n attr, value))\n", "db.engine.execute('DELETE FROM \"{0}\" WHERE \"{1}\" > {2}'.format(table_name,\n attr, value))\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(VAR_2, VAR_3, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = dict(VAR_4 or {})\n", "VAR_4['Content-Length'] = len(VAR_2)\n", "def __init__(self):...\n", "self.content = VAR_2\n", "def FUNC_6(self, VAR_7):...\n", "VAR_8 = self.content\n", "while VAR_8:\n", "yield VAR_8[:VAR_7]\n", "def FUNC_7(self):...\n", "VAR_8 = VAR_8[VAR_7:]\n", "return self.content\n" ]
[ "def make_fake_response(content, url, headers=None):...\n", "\"\"\"docstring\"\"\"\n", "headers = dict(headers or {})\n", "headers['Content-Length'] = len(content)\n", "def __init__(self):...\n", "self.content = content\n", "def iter_content(self, chunk_size):...\n", "c = self.content\n", "while c:\n", "yield c[:chunk_size]\n", "def read(self):...\n", "c = c[chunk_size:]\n", "return self.content\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "FunctionDef'", "Assign'", "FunctionDef'", "Assign'", "Condition", "Expr'", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_13(self):...\n", "VAR_28 = QueryDict('', mutable=True)\n", "VAR_28.update(self.filter_data)\n", "VAR_28.update(self.request.GET)\n", "self.is_filtered = False\n", "if len([k for k in VAR_28.keys() if k != 'page']) > 0:\n", "self.is_filtered = True\n", "self.filter = TransactionFilter(VAR_28)\n", "self.queryset = self.filter.qs.select_related('cashclose').prefetch_related(\n 'concepts__value__currency').order_by('-id')\n", "return self.queryset\n" ]
[ "def get_queryset(self):...\n", "data = QueryDict('', mutable=True)\n", "data.update(self.filter_data)\n", "data.update(self.request.GET)\n", "self.is_filtered = False\n", "if len([k for k in data.keys() if k != 'page']) > 0:\n", "self.is_filtered = True\n", "self.filter = TransactionFilter(data)\n", "self.queryset = self.filter.qs.select_related('cashclose').prefetch_related(\n 'concepts__value__currency').order_by('-id')\n", "return self.queryset\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_5(self, VAR_3, VAR_4=None, VAR_1=None):...\n", "VAR_3 = VAR_3.lower()\n", "VAR_8 = sqlite3.connect('data/ed.db').cursor()\n", "if ',' in VAR_3:\n", "VAR_3, VAR_4 = (i.strip() for i in VAR_3.split(','))\n", "VAR_11 = f\"select * from stations where lower(name) = '{VAR_3}'\"\n", "if VAR_4 is not None:\n", "VAR_4 = VAR_4.lower()\n", "VAR_7 = VAR_8.execute(VAR_11)\n", "VAR_9 = VAR_8.execute(f\"select id from populated where lower(name)='{VAR_4}'\")\n", "VAR_10 = VAR_7.fetchall()\n", "VAR_10 = VAR_9.fetchone()\n", "if len(VAR_10) == 1:\n", "if VAR_10:\n", "VAR_12 = tuple(i[0] for i in VAR_7.description)\n", "if not VAR_10:\n", "VAR_4 = VAR_10[0]\n", "return 'System not found.'\n", "return '\\n'.join(f\"{key.replace('_', ' ').title()}: {field}\" for key, field in\n zip(VAR_12[2:], VAR_10[0][2:]) if field)\n", "return 'Station not found.'\n", "return 'Multiple stations found, please specify system.'\n", "VAR_11 += f' and system_id = {VAR_4}'\n" ]
[ "def station_search(self, search, target_system=None, ctx=None):...\n", "search = search.lower()\n", "conn = sqlite3.connect('data/ed.db').cursor()\n", "if ',' in search:\n", "search, target_system = (i.strip() for i in search.split(','))\n", "query = f\"select * from stations where lower(name) = '{search}'\"\n", "if target_system is not None:\n", "target_system = target_system.lower()\n", "result = conn.execute(query)\n", "table = conn.execute(\n f\"select id from populated where lower(name)='{target_system}'\")\n", "results = result.fetchall()\n", "results = table.fetchone()\n", "if len(results) == 1:\n", "if results:\n", "keys = tuple(i[0] for i in result.description)\n", "if not results:\n", "target_system = results[0]\n", "return 'System not found.'\n", "return '\\n'.join(f\"{key.replace('_', ' ').title()}: {field}\" for key, field in\n zip(keys[2:], results[0][2:]) if field)\n", "return 'Station not found.'\n", "return 'Multiple stations found, please specify system.'\n", "query += f' and system_id = {target_system}'\n" ]
[ 0, 0, 0, 0, 0, 4, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Return'", "Return'", "Return'", "AugAssign'" ]
[ "def FUNC_1(self):...\n", "VAR_2 = self.connect()\n", "VAR_3 = 'SELECT description FROM crimes;'\n", "VAR_2.close()\n", "cursor.execute(VAR_3)\n", "return cursor.fetchall()\n" ]
[ "def get_all_inputs(self):...\n", "connection = self.connect()\n", "query = 'SELECT description FROM crimes;'\n", "connection.close()\n", "cursor.execute(query)\n", "return cursor.fetchall()\n" ]
[ 0, 0, 0, 0, 4, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_23(VAR_11):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ "def _fake_recv(ignore_arg):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_0):...\n", "warn('Plus integration not yet implemented')\n", "super(CLASS_7, self).__init__('Plus: ' + VAR_0)\n" ]
[ "def __init__(self, txt):...\n", "warn('Plus integration not yet implemented')\n", "super(PlusEnv, self).__init__('Plus: ' + txt)\n" ]
[ 0, 2, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed('string', VAR_2='Big SD cards')\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed(\n \"\"\"If you want to change your SD card to one bigger than 32GB then you'll have to format it to FAT32.\nYou can do this with the tool of your preference.\nFormatter examples:\n- [guiformat - Windows](http://www.ridgecrop.demon.co.uk/index.htm?guiformat.htm)\n- [gparted - Linux](http://gparted.org/download.php)\"\"\"\n , title='Big SD cards')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "for VAR_10 in self.log_files:\n", "if VAR_10 in self.log_file_handles:\n", "VAR_11 = []\n", "if VAR_10 in self.files_to_ignore:\n", "while True:\n", "self.log_file_handles[VAR_10] = open(VAR_10, 'r')\n", "if e.errno == os.errno.EMFILE:\n", "VAR_12 = self.log_file_handles[VAR_10].tell()\n", "VAR_0.warning('Warning: Ignoring {} because there are too many open files.'\n .format(VAR_10))\n", "if e.errno == os.errno.ENOENT:\n", "VAR_13 = self.log_file_handles[VAR_10].readline()\n", "self.files_to_ignore.add(VAR_10)\n", "VAR_0.warning('Warning: The file {} was not found.'.format(VAR_10))\n", "if VAR_13 != '':\n", "VAR_11.append(VAR_13)\n", "self.log_file_handles[VAR_10].seek(VAR_12)\n", "if len(VAR_11) > 0:\n", "self.log_files[VAR_10] += VAR_11\n", "VAR_14 = 'LOGFILE:{}:{}'.format(self.node_ip_address, ray.utils.decode(VAR_10))\n", "self.redis_client.rpush(VAR_14, *VAR_11)\n" ]
[ "def check_log_files_and_push_updates(self):...\n", "\"\"\"docstring\"\"\"\n", "for log_filename in self.log_files:\n", "if log_filename in self.log_file_handles:\n", "new_lines = []\n", "if log_filename in self.files_to_ignore:\n", "while True:\n", "self.log_file_handles[log_filename] = open(log_filename, 'r')\n", "if e.errno == os.errno.EMFILE:\n", "current_position = self.log_file_handles[log_filename].tell()\n", "logger.warning('Warning: Ignoring {} because there are too many open files.'\n .format(log_filename))\n", "if e.errno == os.errno.ENOENT:\n", "next_line = self.log_file_handles[log_filename].readline()\n", "self.files_to_ignore.add(log_filename)\n", "logger.warning('Warning: The file {} was not found.'.format(log_filename))\n", "if next_line != '':\n", "new_lines.append(next_line)\n", "self.log_file_handles[log_filename].seek(current_position)\n", "if len(new_lines) > 0:\n", "self.log_files[log_filename] += new_lines\n", "redis_key = 'LOGFILE:{}:{}'.format(self.node_ip_address, ray.utils.decode(\n log_filename))\n", "self.redis_client.rpush(redis_key, *new_lines)\n" ]
[ 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 ]
[ "FunctionDef'", "Docstring", "For", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "AugAssign'", "Assign'", "Expr'" ]
[ "def FUNC_4(self, VAR_6, VAR_7):...\n", "if self.telnet:\n", "for attempt in range(VAR_7):\n", "self.dut.serial.write('\\x03')\n", "self.command('reset', VAR_6, 'Error resetting DUT', False)\n", "db.log_event('Warning' if attempt < VAR_7 - 1 else 'Error', 'Debugger',\n 'Error resetting DUT', db.log_exception)\n", "db.log_event('Information', 'Debugger', 'Reset DUT')\n", "print(colored(self.dut.serial.port + ': Error resetting DUT (attempt ' +\n str(attempt + 1) + '/' + str(VAR_7) + ')', 'red'))\n", "if attempt < VAR_7 - 1:\n", "sleep(30)\n" ]
[ "def reset_dut(self, expected_output, attempts):...\n", "if self.telnet:\n", "for attempt in range(attempts):\n", "self.dut.serial.write('\\x03')\n", "self.command('reset', expected_output, 'Error resetting DUT', False)\n", "db.log_event('Warning' if attempt < attempts - 1 else 'Error', 'Debugger',\n 'Error resetting DUT', db.log_exception)\n", "db.log_event('Information', 'Debugger', 'Reset DUT')\n", "print(colored(self.dut.serial.port + ': Error resetting DUT (attempt ' +\n str(attempt + 1) + '/' + str(attempts) + ')', 'red'))\n", "if attempt < attempts - 1:\n", "sleep(30)\n" ]
[ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "For", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_26(VAR_51, VAR_52):...\n", "for sub_ in VAR_51.sub_items:\n", "FUNC_26(sub_, VAR_52)\n", "VAR_51.owner = VAR_52\n", "if VAR_51.is_dir:\n", "self._update_in_db(VAR_51)\n", "return\n" ]
[ "def _chown_recursive(item_, owner_):...\n", "for sub_ in item_.sub_items:\n", "_chown_recursive(sub_, owner_)\n", "item_.owner = owner_\n", "if item_.is_dir:\n", "self._update_in_db(item_)\n", "return\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_1 = Template(filename='r2/templates/showmeetup.html', output_encoding=\n 'utf-8', encoding_errors='replace')\n", "VAR_2 = VAR_1.get_def('meetup_info').render_unicode(VAR_0=meetup)\n", "VAR_3 = url_for(controller='meetups', action='show', id=meetup._id36)\n", "VAR_4 = python_websafe(VAR_0.title)\n", "VAR_5 = u\"<h2>Discussion article for the meetup : <a href='%s'>%s</a></h2>\" % (\n VAR_3, VAR_4)\n", "return VAR_5 + VAR_2 + VAR_5\n" ]
[ "def meetup_article_text(meetup):...\n", "t = Template(filename='r2/templates/showmeetup.html', output_encoding=\n 'utf-8', encoding_errors='replace')\n", "res = t.get_def('meetup_info').render_unicode(meetup=meetup)\n", "url = url_for(controller='meetups', action='show', id=meetup._id36)\n", "title = python_websafe(meetup.title)\n", "hdr = u\"<h2>Discussion article for the meetup : <a href='%s'>%s</a></h2>\" % (\n url, title)\n", "return hdr + res + hdr\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@VAR_0.route('/users/new', methods=['GET', 'POST'])...\n", "if request.method == 'POST':\n", "VAR_2 = connectToMySQL('users_db')\n", "return render_template('edit.html', VAR_4=None)\n", "VAR_6 = 'string'\n", "VAR_8 = {'fn': request.form['first_name'], 'ln': request.form['last_name'],\n 'e': request.form['email'], 'd': request.form['description']}\n", "VAR_9 = VAR_2.query_db(VAR_6, VAR_8)\n", "return redirect(f'/users/{VAR_9}')\n" ]
[ "@app.route('/users/new', methods=['GET', 'POST'])...\n", "if request.method == 'POST':\n", "mysql = connectToMySQL('users_db')\n", "return render_template('edit.html', user=None)\n", "query = (\n 'INSERT INTO users (first_name, last_name, email, description, created_at) VALUES (%(fn)s, %(ln)s, %(e)s, %(d)s, now());'\n )\n", "data = {'fn': request.form['first_name'], 'ln': request.form['last_name'],\n 'e': request.form['email'], 'd': request.form['description']}\n", "new_user = mysql.query_db(query, data)\n", "return redirect(f'/users/{new_user}')\n" ]
[ 0, 0, 0, 0, 4, 0, 0, 4 ]
[ "Condition", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_31(VAR_31):...\n", "\"\"\"docstring\"\"\"\n", "def __getitem__(self, *VAR_30):...\n", "return dict.__getitem__(self, VAR_30)\n" ]
[ "def memoize(f):...\n", "\"\"\"docstring\"\"\"\n", "def __getitem__(self, *key):...\n", "return dict.__getitem__(self, key)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Return'" ]
[ "def FUNC_9(self, VAR_7, VAR_6):...\n", "VAR_11 = VAR_7[0]\n", "VAR_12 = VAR_7[1]\n", "if VAR_7['lkvm'] < VAR_6:\n", "VAR_26 = 1\n", "VAR_26 = float('inf')\n", "self.G[VAR_11][VAR_12]['tpvm'] = VAR_26\n" ]
[ "def calcTPVM(self, edge, gamma):...\n", "i = edge[0]\n", "j = edge[1]\n", "if edge['lkvm'] < gamma:\n", "tpvm = 1\n", "tpvm = float('inf')\n", "self.G[i][j]['tpvm'] = tpvm\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(VAR_0=True):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = getUtility(IRegistry)\n", "VAR_15['collective.solr.active'] = VAR_0\n" ]
[ "def activate(active=True):...\n", "\"\"\"docstring\"\"\"\n", "registry = getUtility(IRegistry)\n", "registry['collective.solr.active'] = active\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'" ]
[ "def FUNC_1(VAR_5):...\n", "VAR_12 = f\"\"\"\n SELECT * FROM {VAR_0} WHERE id=%s\n \"\"\"\n", "VAR_14 = create_connection()\n", "VAR_14.close()\n", "VAR_15 = VAR_14.cursor()\n", "VAR_15.execute(VAR_12, VAR_5)\n", "VAR_16 = VAR_15.fetchone()\n", "if not VAR_16:\n", "return None\n", "return {'firstName': VAR_16['first_name'], 'lastName': VAR_16['last_name'],\n 'username': VAR_16['username']}\n" ]
[ "def get_user(id):...\n", "sql_query = f\"\"\"\n SELECT * FROM {USERS_TABLE} WHERE id=%s\n \"\"\"\n", "connection = create_connection()\n", "connection.close()\n", "cursor = connection.cursor()\n", "cursor.execute(sql_query, id)\n", "user = cursor.fetchone()\n", "if not user:\n", "return None\n", "return {'firstName': user['first_name'], 'lastName': user['last_name'],\n 'username': user['username']}\n" ]
[ 0, 4, 0, 0, 0, 4, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_27(VAR_32, VAR_3):...\n", "self.assertEqual('https://localhost:1/swarming/api/v1/bot/bot_code/123', VAR_3)\n", "self.assertEqual(VAR_31, VAR_32)\n", "z.writestr('__main__.py', 'print(\"hi\")')\n", "return True\n" ]
[ "def url_retrieve(f, url):...\n", "self.assertEqual('https://localhost:1/swarming/api/v1/bot/bot_code/123', url)\n", "self.assertEqual(new_zip, f)\n", "z.writestr('__main__.py', 'print(\"hi\")')\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_7():...\n", "VAR_36 = FUNC_3(VAR_18, VAR_19)\n", "VAR_37 = CLASS_17 if VAR_20 else CLASS_18\n", "return VAR_37, VAR_36\n" ]
[ "def four():...\n", "ListPresenceFormSet = make_formset(parent, child)\n", "ParentForm = ExtractedCPCatForm if extracted else ExtractedCPCatEditForm\n", "return ParentForm, ListPresenceFormSet\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_6(self, VAR_24, VAR_25):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_24[VAR_10] and os.path.exists(VAR_25) and not os.path.islink(VAR_25\n", "VAR_24[VAR_10] = VAR_25\n" ]
[ "def update_realfile(self, f, realfile):...\n", "\"\"\"docstring\"\"\"\n", "if not f[A_REALFILE] and os.path.exists(realfile) and not os.path.islink(\n", "f[A_REALFILE] = realfile\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "if socket.gethostname() == config.PROD_HOST_NAME:\n", "log.info('Connecting to the local database...')\n", "log.info('Connecting to the database via SSH...')\n", "VAR_6 = 3306\n", "if not self.tunnel_opened:\n", "self.conn = MySQLdb.connect(host='127.0.0.1', user=config.DB_USER, password\n =config.DB_PASSWD, VAR_6=port, database=config.DB_NAME, charset='utf8')\n", "self._open_ssh_tunnel()\n", "VAR_6 = self.tunnel.local_bind_port\n", "log.info('Connected to the database.')\n" ]
[ "def connect(self):...\n", "\"\"\"docstring\"\"\"\n", "if socket.gethostname() == config.PROD_HOST_NAME:\n", "log.info('Connecting to the local database...')\n", "log.info('Connecting to the database via SSH...')\n", "port = 3306\n", "if not self.tunnel_opened:\n", "self.conn = MySQLdb.connect(host='127.0.0.1', user=config.DB_USER, password\n =config.DB_PASSWD, port=port, database=config.DB_NAME, charset='utf8')\n", "self._open_ssh_tunnel()\n", "port = self.tunnel.local_bind_port\n", "log.info('Connected to the database.')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_0(self):...\n", "self._mox = mox.Mox()\n", "self.mock(logging, 'error', lambda *_: None)\n", "self.mock(logging, 'exception', lambda *_: None)\n", "self.mock(logging, 'info', lambda *_: None)\n", "self.mock(logging, 'warning', lambda *_: None)\n", "self._mox.StubOutWithMock(time, 'sleep')\n", "self._mox.StubOutWithMock(urllib2, 'urlopen')\n" ]
[ "def setUp(self):...\n", "self._mox = mox.Mox()\n", "self.mock(logging, 'error', lambda *_: None)\n", "self.mock(logging, 'exception', lambda *_: None)\n", "self.mock(logging, 'info', lambda *_: None)\n", "self.mock(logging, 'warning', lambda *_: None)\n", "self._mox.StubOutWithMock(time, 'sleep')\n", "self._mox.StubOutWithMock(urllib2, 'urlopen')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'MEDIUM': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('mark_safe.py', VAR_2)\n" ]
[ "def test_mark_safe(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'MEDIUM': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('mark_safe.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_5(self):...\n", "" ]
[ "def _check_children_depth(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "VAR_23 = self.common.create_volume(VAR_7)\n", "self.common.client_logout()\n", "return {'metadata': VAR_23}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "metadata = self.common.create_volume(volume)\n", "self.common.client_logout()\n", "return {'metadata': metadata}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@VAR_0.route('/')...\n", "return render_template('homepage.html')\n" ]
[ "@app.route('/')...\n", "return render_template('homepage.html')\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_6(self):...\n", "VAR_8 = 'test_foo.py'\n", "VAR_7 = BokChoyTestSuite('', test_spec=spec, default_store='draft')\n", "VAR_1 = 'tests/{}'.format(VAR_8)\n", "self.assertEqual(VAR_7.cmd, self._expected_command(VAR_1=name, VAR_2='draft'))\n" ]
[ "def test_spec_with_draft_default_store(self):...\n", "spec = 'test_foo.py'\n", "suite = BokChoyTestSuite('', test_spec=spec, default_store='draft')\n", "name = 'tests/{}'.format(spec)\n", "self.assertEqual(suite.cmd, self._expected_command(name=name, store='draft'))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_4():...\n", "VAR_3 = {'foo': 'bar'}\n", "VAR_1 = json.dumps(VAR_3)\n", "VAR_4 = tempfile.NamedTemporaryFile(mode='w', suffix='.json')\n", "VAR_4.write(VAR_1)\n", "VAR_4.flush()\n", "VAR_2 = load_source(VAR_4.name)\n", "assert VAR_2 == VAR_3\n" ]
[ "def test_json_file_path():...\n", "native = {'foo': 'bar'}\n", "source = json.dumps(native)\n", "tmp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.json')\n", "tmp_file.write(source)\n", "tmp_file.flush()\n", "result = load_source(tmp_file.name)\n", "assert result == native\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assert'" ]
[ "def FUNC_7(self, VAR_10=None):...\n", "VAR_25 = VAR_20.path.join(self.parlai_home, 'downloads')\n", "VAR_26 = self.add_argument_group('Main ParlAI Arguments')\n", "VAR_26.add_argument('-t', '--task', help=\n 'ParlAI task(s), e.g. \"babi:Task1\" or \"babi,cbt\"')\n", "VAR_26.add_argument('--download-path', default=default_downloads_path, help\n =\n 'path for non-data dependencies to store any needed files.defaults to {parlai_dir}/downloads'\n )\n", "VAR_26.add_argument('-dt', '--datatype', default='train', choices=['train',\n 'train:stream', 'train:ordered', 'train:ordered:stream',\n 'train:stream:ordered', 'valid', 'valid:stream', 'test', 'test:stream'],\n help=\n 'choose from: train, train:ordered, valid, test. to stream data add \":stream\" to any option (e.g., train:stream). by default: train is random with replacement, valid is ordered, test is ordered.'\n )\n", "VAR_26.add_argument('-im', '--image-mode', default='raw', type=str, help=\n 'image preprocessor to use. default is \"raw\". set to \"none\" to skip image loading.'\n )\n", "VAR_26.add_argument('-nt', '--numthreads', default=1, type=int, help=\n 'number of threads. If batchsize set to 1, used for hogwild; otherwise, used for number of threads in threadpool loading, e.g. in vqa'\n )\n", "VAR_26.add_argument('--hide-labels', default=False, type='bool', help=\n 'default (False) moves labels in valid and test sets to the eval_labels field. If True, they are hidden completely.'\n )\n", "VAR_27 = self.add_argument_group('Batching Arguments')\n", "VAR_27.add_argument('-bs', '--batchsize', default=1, type=int, help=\n 'batch size for minibatch training schemes')\n", "VAR_27.add_argument('-bsrt', '--batch-sort', default=True, type='bool',\n help=\n 'If enabled (default True), create batches by flattening all episodes to have exactly one utterance exchange and then sorting all the examples according to their length. This dramatically reduces the amount of padding present after examples have been parsed, speeding up training.'\n )\n", "VAR_27.add_argument('-clen', '--context-length', default=-1, type=int, help\n =\n 'Number of past utterances to remember when building flattened batches of data in multi-example episodes.'\n )\n", "VAR_27.add_argument('-incl', '--include-labels', default=True, type='bool',\n help=\n 'Specifies whether or not to include labels as past utterances when building flattened batches of data in multi-example episodes.'\n )\n", "self.add_parlai_data_path(VAR_26)\n" ]
[ "def add_parlai_args(self, args=None):...\n", "default_downloads_path = os.path.join(self.parlai_home, 'downloads')\n", "parlai = self.add_argument_group('Main ParlAI Arguments')\n", "parlai.add_argument('-t', '--task', help=\n 'ParlAI task(s), e.g. \"babi:Task1\" or \"babi,cbt\"')\n", "parlai.add_argument('--download-path', default=default_downloads_path, help\n =\n 'path for non-data dependencies to store any needed files.defaults to {parlai_dir}/downloads'\n )\n", "parlai.add_argument('-dt', '--datatype', default='train', choices=['train',\n 'train:stream', 'train:ordered', 'train:ordered:stream',\n 'train:stream:ordered', 'valid', 'valid:stream', 'test', 'test:stream'],\n help=\n 'choose from: train, train:ordered, valid, test. to stream data add \":stream\" to any option (e.g., train:stream). by default: train is random with replacement, valid is ordered, test is ordered.'\n )\n", "parlai.add_argument('-im', '--image-mode', default='raw', type=str, help=\n 'image preprocessor to use. default is \"raw\". set to \"none\" to skip image loading.'\n )\n", "parlai.add_argument('-nt', '--numthreads', default=1, type=int, help=\n 'number of threads. If batchsize set to 1, used for hogwild; otherwise, used for number of threads in threadpool loading, e.g. in vqa'\n )\n", "parlai.add_argument('--hide-labels', default=False, type='bool', help=\n 'default (False) moves labels in valid and test sets to the eval_labels field. If True, they are hidden completely.'\n )\n", "batch = self.add_argument_group('Batching Arguments')\n", "batch.add_argument('-bs', '--batchsize', default=1, type=int, help=\n 'batch size for minibatch training schemes')\n", "batch.add_argument('-bsrt', '--batch-sort', default=True, type='bool', help\n =\n 'If enabled (default True), create batches by flattening all episodes to have exactly one utterance exchange and then sorting all the examples according to their length. This dramatically reduces the amount of padding present after examples have been parsed, speeding up training.'\n )\n", "batch.add_argument('-clen', '--context-length', default=-1, type=int, help=\n 'Number of past utterances to remember when building flattened batches of data in multi-example episodes.'\n )\n", "batch.add_argument('-incl', '--include-labels', default=True, type='bool',\n help=\n 'Specifies whether or not to include labels as past utterances when building flattened batches of data in multi-example episodes.'\n )\n", "self.add_parlai_data_path(parlai)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(VAR_3, VAR_5):...\n", "VAR_8 = VAR_3.cursor()\n", "VAR_10 = VAR_8.execute(VAR_5)\n", "VAR_3.commit()\n", "print('insert data successfull')\n", "return VAR_10\n" ]
[ "def insertDB(conn, sql_insert):...\n", "cur = conn.cursor()\n", "result = cur.execute(sql_insert)\n", "conn.commit()\n", "print('insert data successfull')\n", "return result\n" ]
[ 0, 0, 4, 0, 0, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_47(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('httpoxy_cgihandler.py', VAR_2)\n", "self.check_example('httpoxy_twisted_script.py', VAR_2)\n", "self.check_example('httpoxy_twisted_directory.py', VAR_2)\n" ]
[ "def test_httpoxy(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('httpoxy_cgihandler.py', expect)\n", "self.check_example('httpoxy_twisted_script.py', expect)\n", "self.check_example('httpoxy_twisted_directory.py', expect)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(self):...\n", "VAR_7 = []\n", "for parent in self.parent_groups:\n", "VAR_7.append(parent.serialize())\n", "self._hosts = None\n", "VAR_8 = dict(VAR_0=self.name, vars=self.vars.copy(), VAR_7=parent_groups,\n depth=self.depth, VAR_9=self.hosts)\n", "return VAR_8\n" ]
[ "def serialize(self):...\n", "parent_groups = []\n", "for parent in self.parent_groups:\n", "parent_groups.append(parent.serialize())\n", "self._hosts = None\n", "result = dict(name=self.name, vars=self.vars.copy(), parent_groups=\n parent_groups, depth=self.depth, hosts=self.hosts)\n", "return result\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_8(VAR_13, VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "VAR_25 = 'string'\n", "VAR_14.execute(VAR_25)\n", "VAR_31 = []\n", "for record in VAR_14:\n", "VAR_38 = record[0]\n", "return VAR_31\n", "VAR_31.append(VAR_38)\n" ]
[ "def get_all_old_sourcebyinstitutions(conn, sqlite):...\n", "\"\"\"docstring\"\"\"\n", "query = \"\"\"\n SELECT\n sourcebyinstitution\n FROM\n sourcebyinstitution\n GROUP BY\n sourcebyinstitution\n \"\"\"\n", "sqlite.execute(query)\n", "old_sourcebyinstitutions = []\n", "for record in sqlite:\n", "old_sourcebyinstitution = record[0]\n", "return old_sourcebyinstitutions\n", "old_sourcebyinstitutions.append(old_sourcebyinstitution)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = threading.Thread(target=self._run, name='ray_import_thread')\n", "VAR_3.daemon = True\n", "VAR_3.start()\n" ]
[ "def start(self):...\n", "\"\"\"docstring\"\"\"\n", "t = threading.Thread(target=self._run, name='ray_import_thread')\n", "t.daemon = True\n", "t.start()\n" ]
[ 0, 0, 6, 6, 6 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_7(self):...\n", "for VAR_30 in VAR_7(len(self._['tags'])):\n", "self._['tags'][VAR_30] = self._['tags'][VAR_30][:40]\n", "VAR_10 = AnnTag.get_ann_tags(self.ann_id, self.sql_session)\n", "if not VAR_4.match(self._['tags'][VAR_30]):\n", "VAR_11 = set(self._['tags'])\n", "VAR_12 = set(VAR_10)\n", "VAR_13 = VAR_11 - VAR_12\n", "VAR_14 = VAR_12 - VAR_11\n", "for tag in VAR_13:\n", "self.sql_session.add(AnnTag(self.ann_id, tag))\n", "for tag in VAR_14:\n", "AnnTag.by_tag(self.ann_id, tag, self.sql_session).delete()\n" ]
[ "def parse_tag(self):...\n", "for i in xrange(len(self._['tags'])):\n", "self._['tags'][i] = self._['tags'][i][:40]\n", "old_tags = AnnTag.get_ann_tags(self.ann_id, self.sql_session)\n", "if not tag_re.match(self._['tags'][i]):\n", "new_tag_set = set(self._['tags'])\n", "old_tag_set = set(old_tags)\n", "add_set = new_tag_set - old_tag_set\n", "delete_set = old_tag_set - new_tag_set\n", "for tag in add_set:\n", "self.sql_session.add(AnnTag(self.ann_id, tag))\n", "for tag in delete_set:\n", "AnnTag.by_tag(self.ann_id, tag, self.sql_session).delete()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "For", "Expr'" ]
[ "def FUNC_12(self):...\n", "VAR_33 = []\n", "VAR_34 = self.redirection()\n", "while VAR_34:\n", "VAR_33.append(VAR_34)\n", "if len(VAR_33) > 0:\n", "VAR_34 = self.redirection()\n", "return CLASS_11(VAR_33)\n", "return None\n" ]
[ "def redirections(self):...\n", "redirs = []\n", "redir = self.redirection()\n", "while redir:\n", "redirs.append(redir)\n", "if len(redirs) > 0:\n", "redir = self.redirection()\n", "return RedirectionsHelper(redirs)\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Return'", "Return'" ]
[ "def FUNC_5(self):...\n", "VAR_1 = self.client.get(url_for('oauthclient.login', remote_app='test'))\n", "self.assertStatus(VAR_1, 302)\n", "self.assertEqual(VAR_1.location, \n 'https://foo.bar/oauth/authorize?response_type=code&client_id=testid&redirect_uri=%s'\n % quote_plus(url_for('oauthclient.authorized', remote_app='test',\n _external=True)))\n", "VAR_1 = self.client.get(url_for('oauthclient.login', remote_app='invalid'))\n", "self.assertStatus(VAR_1, 404)\n" ]
[ "def test_login(self):...\n", "resp = self.client.get(url_for('oauthclient.login', remote_app='test'))\n", "self.assertStatus(resp, 302)\n", "self.assertEqual(resp.location, \n 'https://foo.bar/oauth/authorize?response_type=code&client_id=testid&redirect_uri=%s'\n % quote_plus(url_for('oauthclient.authorized', remote_app='test',\n _external=True)))\n", "resp = self.client.get(url_for('oauthclient.login', remote_app='invalid'))\n", "self.assertStatus(resp, 404)\n" ]
[ 0, 5, 0, 5, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_22(self, VAR_2, VAR_3, VAR_4, *VAR_6):...\n", "VAR_46 = self.pool.get('res.request')\n", "VAR_47 = self.browse(VAR_2, VAR_3, VAR_4)\n", "for VAR_23 in VAR_47:\n", "VAR_51 = VAR_23.project_id\n", "return True\n", "if VAR_51 and VAR_51.warn_manager and VAR_51.manager.id and VAR_51.manager.id != VAR_3:\n", "VAR_46.create(VAR_2, VAR_3, {'name': _(\"Task '%s' set in progress\") %\n VAR_23.name, 'state': 'waiting', 'act_from': VAR_3, 'act_to': VAR_51.\n manager.id, 'ref_partner_id': VAR_23.partner_id.id, 'ref_doc1': \n 'project.task,%d' % VAR_23.id, 'ref_doc2': 'project.project,%d' %\n VAR_51.id})\n", "self.write(VAR_2, VAR_3, [VAR_23.id], {'state': 'open'})\n" ]
[ "def do_reopen(self, cr, uid, ids, *args):...\n", "request = self.pool.get('res.request')\n", "tasks = self.browse(cr, uid, ids)\n", "for task in tasks:\n", "project = task.project_id\n", "return True\n", "if project and project.warn_manager and project.manager.id and project.manager.id != uid:\n", "request.create(cr, uid, {'name': _(\"Task '%s' set in progress\") % task.name,\n 'state': 'waiting', 'act_from': uid, 'act_to': project.manager.id,\n 'ref_partner_id': task.partner_id.id, 'ref_doc1': 'project.task,%d' %\n task.id, 'ref_doc2': 'project.project,%d' % project.id})\n", "self.write(cr, uid, [task.id], {'state': 'open'})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'", "Expr'" ]
[ "from gi.repository import Gio, Gtk\n", "from keepassgtk.database_manager import DatabaseManager\n", "from keepassgtk.unlocked_database import UnlockedDatabase\n", "import keepassgtk.config_manager\n", "from keepassgtk.logging_manager import LoggingManager\n", "import gi\n", "gi.require_version('Gtk', '3.0')\n", "import ntpath\n", "import threading\n", "VAR_0 = NotImplemented\n", "VAR_1 = NotImplemented\n", "VAR_2 = NotImplemented\n", "VAR_3 = NotImplemented\n", "VAR_4 = NotImplemented\n", "VAR_5 = NotImplemented\n", "VAR_6 = NotImplemented\n", "VAR_7 = NotImplemented\n", "VAR_8 = LoggingManager(True)\n", "VAR_9 = NotImplemented\n", "def __init__(self, VAR_2, VAR_10, VAR_11):...\n", "self.window = VAR_2\n", "self.parent_widget = VAR_10\n", "self.database_filepath = VAR_11\n", "self.unlock_database()\n", "def FUNC_0(self):...\n", "self.builder = Gtk.Builder()\n", "self.builder.add_from_resource('/run/terminal/KeepassGtk/unlock_database.ui')\n", "self.set_headerbar()\n", "self.assemble_stack()\n", "self.connect_events()\n", "def FUNC_1(self):...\n", "VAR_14 = self.builder.get_object('headerbar')\n", "VAR_14.set_subtitle(self.database_filepath)\n", "self.window.set_titlebar(VAR_14)\n", "self.parent_widget.set_headerbar(VAR_14)\n", "VAR_15 = self.builder.get_object('back_button')\n", "VAR_15.connect('clicked', self.on_headerbar_back_button_clicked)\n", "def FUNC_2(self):...\n", "self.overlay = Gtk.Overlay()\n", "VAR_16 = self.builder.get_object('unlock_failed_overlay')\n", "self.overlay.add_overlay(VAR_16)\n", "VAR_17 = Gtk.Stack()\n", "VAR_17.set_transition_type(Gtk.StackTransitionType.CROSSFADE)\n", "self.unlock_database_stack_box = self.builder.get_object(\n 'unlock_database_stack_box')\n", "VAR_18 = self.builder.get_object('unlock_database_stack_switcher')\n", "VAR_18.set_stack(VAR_17)\n", "VAR_19 = self.builder.get_object('password_unlock_stack_page')\n", "VAR_20 = self.builder.get_object('keyfile_unlock_stack_page')\n", "VAR_21 = self.builder.get_object('composite_unlock_stack_page')\n", "VAR_17.add_titled(VAR_19, 'password_unlock', 'Password')\n", "VAR_17.child_set_property(VAR_19, 'icon-name', 'input-dialpad-symbolic')\n", "VAR_17.add_titled(VAR_20, 'keyfile_unlock', 'Keyfile')\n", "VAR_17.child_set_property(VAR_20, 'icon-name', 'mail-attachment-symbolic')\n", "VAR_17.add_titled(VAR_21, 'composite_unlock', 'Composite')\n", "VAR_17.child_set_property(VAR_21, 'icon-name', 'insert-link-symbolic')\n", "self.overlay.add(VAR_17)\n", "self.unlock_database_stack_box.add(self.overlay)\n", "self.unlock_database_stack_box.show_all()\n", "self.parent_widget.add(self.unlock_database_stack_box)\n", "def FUNC_3(self):...\n", "VAR_22 = self.builder.get_object('password_unlock_button')\n", "VAR_22.connect('clicked', self.on_password_unlock_button_clicked)\n", "VAR_23 = self.builder.get_object('keyfile_unlock_button')\n", "VAR_23.connect('clicked', self.on_keyfile_unlock_button_clicked)\n", "VAR_24 = self.builder.get_object('composite_unlock_button')\n", "VAR_24.connect('clicked', self.on_composite_unlock_button_clicked)\n", "VAR_25 = self.builder.get_object('keyfile_unlock_select_button')\n", "VAR_25.connect('clicked', self.on_keyfile_unlock_select_button_clicked)\n", "VAR_26 = self.builder.get_object('composite_unlock_select_button')\n", "VAR_26.connect('clicked', self.on_composite_unlock_select_button_clicked)\n", "VAR_27 = self.builder.get_object('password_unlock_entry')\n", "VAR_27.connect('activate', self.on_password_unlock_button_clicked)\n", "VAR_27.connect('icon-press', self.on_password_unlock_entry_secondary_clicked)\n", "def FUNC_4(self, VAR_10, VAR_12, VAR_13):...\n", "if VAR_10.get_visibility():\n", "VAR_10.set_invisible_char('●')\n", "VAR_10.set_visibility(True)\n", "VAR_10.set_visibility(False)\n", "def FUNC_5(self, VAR_10):...\n", "self.window.set_headerbar()\n", "self.window.close_tab(self.parent_widget)\n", "def FUNC_6(self, VAR_10):...\n", "VAR_27 = self.builder.get_object('password_unlock_entry')\n", "if VAR_27.get_text() != '':\n", "def FUNC_7(self, VAR_10):...\n", "self.database_manager = DatabaseManager(self.database_filepath, VAR_27.\n get_text())\n", "self.show_unlock_failed_revealer()\n", "VAR_28 = Gtk.FileChooserDialog('Choose a keyfile', self.window, Gtk.\n FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk\n .STOCK_OPEN, Gtk.ResponseType.OK))\n", "self.open_database_page()\n", "VAR_27.grab_focus()\n", "VAR_29 = Gtk.FileFilter()\n", "self.logging_manager.log_debug('Opening of database was successfull')\n", "VAR_27.get_style_context().add_class('error')\n", "VAR_29.set_name('Keyfile')\n", "self.clear_input_fields()\n", "VAR_29.add_mime_type('application/octet-stream')\n", "self.logging_manager.log_debug('Could not open database, wrong password')\n", "VAR_29.add_mime_type('application/x-keepass2')\n", "VAR_29.add_mime_type('text/plain')\n", "VAR_29.add_mime_type('application/x-iwork-keynote-sffkey')\n", "VAR_28.add_filter(VAR_29)\n", "VAR_30 = VAR_28.run()\n", "if VAR_30 == Gtk.ResponseType.OK:\n", "self.logging_manager.log_debug('File selected: ' + VAR_28.get_filename())\n", "if VAR_30 == Gtk.ResponseType.CANCEL:\n", "VAR_28.close()\n", "self.logging_manager.log_debug('File selection canceled')\n", "def FUNC_8(self, VAR_10):...\n", "VAR_25 = self.builder.get_object('keyfile_unlock_select_button')\n", "VAR_28.close()\n", "VAR_25 = self.builder.get_object('keyfile_unlock_select_button')\n", "VAR_25.get_style_context().remove_class(Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION)\n", "VAR_31 = VAR_25.get_label()\n", "VAR_25.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION)\n", "self.database_manager = DatabaseManager(self.database_filepath, password=\n None, VAR_6=keyfile_path)\n", "self.show_unlock_failed_revealer()\n", "def FUNC_9(self, VAR_10):...\n", "VAR_25.set_label(ntpath.basename(VAR_28.get_filename()))\n", "self.open_database_page()\n", "VAR_25.get_style_context().add_class(Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION)\n", "VAR_32 = Gtk.FileChooserDialog('Choose Keyfile', self.window, Gtk.\n FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk\n .STOCK_OPEN, Gtk.ResponseType.OK))\n", "self.logging_manager.log_debug('Database successfully opened with keyfile')\n", "VAR_25.set_label('Try again')\n", "VAR_26 = self.builder.get_object('composite_unlock_select_button')\n", "self.logging_manager.log_debug('Invalid keyfile chosen')\n", "VAR_29 = Gtk.FileFilter()\n", "self.logging_manager.log_debug('Keyfile path: ' + VAR_31)\n", "VAR_29.set_name('Keyfile')\n", "VAR_29.add_mime_type('application/octet-stream')\n", "VAR_29.add_mime_type('application/x-keepass2')\n", "VAR_29.add_mime_type('text/plain')\n", "VAR_29.add_mime_type('application/x-iwork-keynote-sffkey')\n", "VAR_32.add_filter(VAR_29)\n", "VAR_30 = VAR_32.run()\n", "if VAR_30 == Gtk.ResponseType.OK:\n", "self.logging_manager.log_debug('File selected: ' + VAR_32.get_filename())\n", "if VAR_30 == Gtk.ResponseType.CANCEL:\n", "VAR_32.close()\n", "self.logging_manager.log_debug('File selection cancelled')\n", "def FUNC_10(self, VAR_10):...\n", "VAR_38 = VAR_32.get_filename()\n", "VAR_32.close()\n", "VAR_33 = self.builder.get_object('composite_unlock_entry')\n", "VAR_26.set_label(ntpath.basename(VAR_38))\n", "VAR_26 = self.builder.get_object('composite_unlock_select_button')\n", "self.composite_keyfile_path = VAR_38\n", "if VAR_33.get_text() is not '':\n", "VAR_33.get_style_context().add_class('error')\n", "self.database_manager = DatabaseManager(self.database_filepath, VAR_33.\n get_text(), self.composite_keyfile_path)\n", "self.show_unlock_failed_revealer()\n", "def FUNC_11(self):...\n", "self.open_database_page()\n", "VAR_33.grab_focus()\n", "self.clear_input_fields()\n", "self.logging_manager.log_debug('Opening of database was successfull')\n", "VAR_33.get_style_context().add_class('error')\n", "keepassgtk.config_manager.create_config_entry_string('history',\n 'last-opened-db', str(self.database_filepath))\n", "VAR_26.get_style_context().remove_class('suggested-action')\n", "keepassgtk.config_manager.save_config()\n", "VAR_26.get_style_context().add_class('destructive-action')\n", "self.unlock_database_stack_box.destroy()\n", "self.clear_input_fields()\n", "UnlockedDatabase(self.window, self.parent_widget, self.database_manager)\n", "self.logging_manager.log_debug('Could not open database, wrong password')\n", "def FUNC_12(self):...\n", "VAR_27 = self.builder.get_object('password_unlock_entry')\n", "VAR_33 = self.builder.get_object('composite_unlock_entry')\n", "VAR_27.set_text('')\n", "VAR_33.set_text('')\n", "def FUNC_13(self):...\n", "VAR_34 = self.builder.get_object('unlock_failed_box')\n", "VAR_35 = VAR_34.get_style_context()\n", "VAR_35.add_class('NotifyRevealer')\n", "VAR_36 = self.builder.get_object('unlock_failed_revealer')\n", "VAR_36.set_reveal_child(not VAR_36.get_reveal_child())\n", "VAR_37 = threading.Timer(3.0, self.hide_unlock_failed_revealer)\n", "VAR_37.start()\n", "def FUNC_14(self):...\n", "VAR_36 = self.builder.get_object('unlock_failed_revealer')\n", "VAR_36.set_reveal_child(not VAR_36.get_reveal_child())\n" ]
[ "from gi.repository import Gio, Gtk\n", "from keepassgtk.database_manager import DatabaseManager\n", "from keepassgtk.unlocked_database import UnlockedDatabase\n", "import keepassgtk.config_manager\n", "from keepassgtk.logging_manager import LoggingManager\n", "import gi\n", "gi.require_version('Gtk', '3.0')\n", "import ntpath\n", "import threading\n", "builder = NotImplemented\n", "parent_widget = NotImplemented\n", "window = NotImplemented\n", "database_filepath = NotImplemented\n", "database_manager = NotImplemented\n", "unlock_database_stack_box = NotImplemented\n", "keyfile = NotImplemented\n", "composite_keyfile_path = NotImplemented\n", "logging_manager = LoggingManager(True)\n", "overlay = NotImplemented\n", "def __init__(self, window, widget, filepath):...\n", "self.window = window\n", "self.parent_widget = widget\n", "self.database_filepath = filepath\n", "self.unlock_database()\n", "def unlock_database(self):...\n", "self.builder = Gtk.Builder()\n", "self.builder.add_from_resource('/run/terminal/KeepassGtk/unlock_database.ui')\n", "self.set_headerbar()\n", "self.assemble_stack()\n", "self.connect_events()\n", "def set_headerbar(self):...\n", "headerbar = self.builder.get_object('headerbar')\n", "headerbar.set_subtitle(self.database_filepath)\n", "self.window.set_titlebar(headerbar)\n", "self.parent_widget.set_headerbar(headerbar)\n", "back_button = self.builder.get_object('back_button')\n", "back_button.connect('clicked', self.on_headerbar_back_button_clicked)\n", "def assemble_stack(self):...\n", "self.overlay = Gtk.Overlay()\n", "unlock_failed_overlay = self.builder.get_object('unlock_failed_overlay')\n", "self.overlay.add_overlay(unlock_failed_overlay)\n", "stack = Gtk.Stack()\n", "stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)\n", "self.unlock_database_stack_box = self.builder.get_object(\n 'unlock_database_stack_box')\n", "unlock_database_stack_switcher = self.builder.get_object(\n 'unlock_database_stack_switcher')\n", "unlock_database_stack_switcher.set_stack(stack)\n", "password_unlock_stack_page = self.builder.get_object(\n 'password_unlock_stack_page')\n", "keyfile_unlock_stack_page = self.builder.get_object('keyfile_unlock_stack_page'\n )\n", "composite_unlock_stack_page = self.builder.get_object(\n 'composite_unlock_stack_page')\n", "stack.add_titled(password_unlock_stack_page, 'password_unlock', 'Password')\n", "stack.child_set_property(password_unlock_stack_page, 'icon-name',\n 'input-dialpad-symbolic')\n", "stack.add_titled(keyfile_unlock_stack_page, 'keyfile_unlock', 'Keyfile')\n", "stack.child_set_property(keyfile_unlock_stack_page, 'icon-name',\n 'mail-attachment-symbolic')\n", "stack.add_titled(composite_unlock_stack_page, 'composite_unlock', 'Composite')\n", "stack.child_set_property(composite_unlock_stack_page, 'icon-name',\n 'insert-link-symbolic')\n", "self.overlay.add(stack)\n", "self.unlock_database_stack_box.add(self.overlay)\n", "self.unlock_database_stack_box.show_all()\n", "self.parent_widget.add(self.unlock_database_stack_box)\n", "def connect_events(self):...\n", "password_unlock_button = self.builder.get_object('password_unlock_button')\n", "password_unlock_button.connect('clicked', self.\n on_password_unlock_button_clicked)\n", "keyfile_unlock_button = self.builder.get_object('keyfile_unlock_button')\n", "keyfile_unlock_button.connect('clicked', self.on_keyfile_unlock_button_clicked)\n", "composite_unlock_button = self.builder.get_object('composite_unlock_button')\n", "composite_unlock_button.connect('clicked', self.\n on_composite_unlock_button_clicked)\n", "keyfile_unlock_select_button = self.builder.get_object(\n 'keyfile_unlock_select_button')\n", "keyfile_unlock_select_button.connect('clicked', self.\n on_keyfile_unlock_select_button_clicked)\n", "composite_unlock_select_button = self.builder.get_object(\n 'composite_unlock_select_button')\n", "composite_unlock_select_button.connect('clicked', self.\n on_composite_unlock_select_button_clicked)\n", "password_unlock_entry = self.builder.get_object('password_unlock_entry')\n", "password_unlock_entry.connect('activate', self.\n on_password_unlock_button_clicked)\n", "password_unlock_entry.connect('icon-press', self.\n on_password_unlock_entry_secondary_clicked)\n", "def on_password_unlock_entry_secondary_clicked(self, widget, position,...\n", "if widget.get_visibility():\n", "widget.set_invisible_char('●')\n", "widget.set_visibility(True)\n", "widget.set_visibility(False)\n", "def on_headerbar_back_button_clicked(self, widget):...\n", "self.window.set_headerbar()\n", "self.window.close_tab(self.parent_widget)\n", "def on_password_unlock_button_clicked(self, widget):...\n", "password_unlock_entry = self.builder.get_object('password_unlock_entry')\n", "if password_unlock_entry.get_text() != '':\n", "def on_keyfile_unlock_select_button_clicked(self, widget):...\n", "self.database_manager = DatabaseManager(self.database_filepath,\n password_unlock_entry.get_text())\n", "self.show_unlock_failed_revealer()\n", "keyfile_chooser_dialog = Gtk.FileChooserDialog('Choose a keyfile', self.\n window, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType\n .CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))\n", "self.open_database_page()\n", "password_unlock_entry.grab_focus()\n", "filter_text = Gtk.FileFilter()\n", "self.logging_manager.log_debug('Opening of database was successfull')\n", "password_unlock_entry.get_style_context().add_class('error')\n", "filter_text.set_name('Keyfile')\n", "self.clear_input_fields()\n", "filter_text.add_mime_type('application/octet-stream')\n", "self.logging_manager.log_debug('Could not open database, wrong password')\n", "filter_text.add_mime_type('application/x-keepass2')\n", "filter_text.add_mime_type('text/plain')\n", "filter_text.add_mime_type('application/x-iwork-keynote-sffkey')\n", "keyfile_chooser_dialog.add_filter(filter_text)\n", "response = keyfile_chooser_dialog.run()\n", "if response == Gtk.ResponseType.OK:\n", "self.logging_manager.log_debug('File selected: ' + keyfile_chooser_dialog.\n get_filename())\n", "if response == Gtk.ResponseType.CANCEL:\n", "keyfile_chooser_dialog.close()\n", "self.logging_manager.log_debug('File selection canceled')\n", "def on_keyfile_unlock_button_clicked(self, widget):...\n", "keyfile_unlock_select_button = self.builder.get_object(\n 'keyfile_unlock_select_button')\n", "keyfile_chooser_dialog.close()\n", "keyfile_unlock_select_button = self.builder.get_object(\n 'keyfile_unlock_select_button')\n", "keyfile_unlock_select_button.get_style_context().remove_class(Gtk.\n STYLE_CLASS_DESTRUCTIVE_ACTION)\n", "keyfile_path = keyfile_unlock_select_button.get_label()\n", "keyfile_unlock_select_button.get_style_context().add_class(Gtk.\n STYLE_CLASS_SUGGESTED_ACTION)\n", "self.database_manager = DatabaseManager(self.database_filepath, password=\n None, keyfile=keyfile_path)\n", "self.show_unlock_failed_revealer()\n", "def on_composite_unlock_select_button_clicked(self, widget):...\n", "keyfile_unlock_select_button.set_label(ntpath.basename(\n keyfile_chooser_dialog.get_filename()))\n", "self.open_database_page()\n", "keyfile_unlock_select_button.get_style_context().add_class(Gtk.\n STYLE_CLASS_DESTRUCTIVE_ACTION)\n", "filechooser_opening_dialog = Gtk.FileChooserDialog('Choose Keyfile', self.\n window, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType\n .CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))\n", "self.logging_manager.log_debug('Database successfully opened with keyfile')\n", "keyfile_unlock_select_button.set_label('Try again')\n", "composite_unlock_select_button = self.builder.get_object(\n 'composite_unlock_select_button')\n", "self.logging_manager.log_debug('Invalid keyfile chosen')\n", "filter_text = Gtk.FileFilter()\n", "self.logging_manager.log_debug('Keyfile path: ' + keyfile_path)\n", "filter_text.set_name('Keyfile')\n", "filter_text.add_mime_type('application/octet-stream')\n", "filter_text.add_mime_type('application/x-keepass2')\n", "filter_text.add_mime_type('text/plain')\n", "filter_text.add_mime_type('application/x-iwork-keynote-sffkey')\n", "filechooser_opening_dialog.add_filter(filter_text)\n", "response = filechooser_opening_dialog.run()\n", "if response == Gtk.ResponseType.OK:\n", "self.logging_manager.log_debug('File selected: ' +\n filechooser_opening_dialog.get_filename())\n", "if response == Gtk.ResponseType.CANCEL:\n", "filechooser_opening_dialog.close()\n", "self.logging_manager.log_debug('File selection cancelled')\n", "def on_composite_unlock_button_clicked(self, widget):...\n", "file_path = filechooser_opening_dialog.get_filename()\n", "filechooser_opening_dialog.close()\n", "composite_unlock_entry = self.builder.get_object('composite_unlock_entry')\n", "composite_unlock_select_button.set_label(ntpath.basename(file_path))\n", "composite_unlock_select_button = self.builder.get_object(\n 'composite_unlock_select_button')\n", "self.composite_keyfile_path = file_path\n", "if composite_unlock_entry.get_text() is not '':\n", "composite_unlock_entry.get_style_context().add_class('error')\n", "self.database_manager = DatabaseManager(self.database_filepath,\n composite_unlock_entry.get_text(), self.composite_keyfile_path)\n", "self.show_unlock_failed_revealer()\n", "def open_database_page(self):...\n", "self.open_database_page()\n", "composite_unlock_entry.grab_focus()\n", "self.clear_input_fields()\n", "self.logging_manager.log_debug('Opening of database was successfull')\n", "composite_unlock_entry.get_style_context().add_class('error')\n", "keepassgtk.config_manager.create_config_entry_string('history',\n 'last-opened-db', str(self.database_filepath))\n", "composite_unlock_select_button.get_style_context().remove_class(\n 'suggested-action')\n", "keepassgtk.config_manager.save_config()\n", "composite_unlock_select_button.get_style_context().add_class(\n 'destructive-action')\n", "self.unlock_database_stack_box.destroy()\n", "self.clear_input_fields()\n", "UnlockedDatabase(self.window, self.parent_widget, self.database_manager)\n", "self.logging_manager.log_debug('Could not open database, wrong password')\n", "def clear_input_fields(self):...\n", "password_unlock_entry = self.builder.get_object('password_unlock_entry')\n", "composite_unlock_entry = self.builder.get_object('composite_unlock_entry')\n", "password_unlock_entry.set_text('')\n", "composite_unlock_entry.set_text('')\n", "def show_unlock_failed_revealer(self):...\n", "unlock_failed_box = self.builder.get_object('unlock_failed_box')\n", "context = unlock_failed_box.get_style_context()\n", "context.add_class('NotifyRevealer')\n", "unlock_failed_revealer = self.builder.get_object('unlock_failed_revealer')\n", "unlock_failed_revealer.set_reveal_child(not unlock_failed_revealer.\n get_reveal_child())\n", "revealer_timer = threading.Timer(3.0, self.hide_unlock_failed_revealer)\n", "revealer_timer.start()\n", "def hide_unlock_failed_revealer(self):...\n", "unlock_failed_revealer = self.builder.get_object('unlock_failed_revealer')\n", "unlock_failed_revealer.set_reveal_child(not unlock_failed_revealer.\n get_reveal_child())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "Import'", "Expr'", "Import'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Condition", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Condition", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'" ]
[ "@jwt_required...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = f'insert into spaces values (%s, %s, %s, %s, %s);'\n", "VAR_7 = request.get_json()\n", "VAR_6 = VAR_7['space_id'], VAR_7['building_id'], VAR_7['name'], VAR_7[\n 'capacity'], VAR_7['features']\n", "database_utilities.execute_query(VAR_5, VAR_6)\n" ]
[ "@jwt_required...\n", "\"\"\"docstring\"\"\"\n", "query = f'insert into spaces values (%s, %s, %s, %s, %s);'\n", "json_data = request.get_json()\n", "parameters = json_data['space_id'], json_data['building_id'], json_data['name'\n ], json_data['capacity'], json_data['features']\n", "database_utilities.execute_query(query, parameters)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_7, VAR_71=20, **VAR_16):...\n", "self.num = VAR_71\n", "CLASS_0.__init__(self, VAR_7=param, **kw)\n" ]
[ "def __init__(self, param, num=20, **kw):...\n", "self.num = num\n", "Validator.__init__(self, param=param, **kw)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_12(VAR_18):...\n", "VAR_44 = QtGui.QApplication(sys.argv)\n", "VAR_45 = QtGui.QMainWindow()\n", "VAR_46 = hyperGUI.UiMainWindow()\n", "VAR_46.ui_init(VAR_45, VAR_18)\n", "VAR_45.show()\n", "sys.exit(VAR_44.exec_())\n" ]
[ "def start_gui(control_center):...\n", "app = QtGui.QApplication(sys.argv)\n", "main_window = QtGui.QMainWindow()\n", "ui = hyperGUI.UiMainWindow()\n", "ui.ui_init(main_window, control_center)\n", "main_window.show()\n", "sys.exit(app.exec_())\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "\"\"\"string\"\"\"\n", "import Pyjo.Base\n", "import Pyjo.Mixin.String\n", "from Pyjo.Util import b, u, url_escape, url_unescape\n", "\"\"\"string\"\"\"\n", "VAR_2 = 'utf-8'\n", "\"\"\"string\"\"\"\n", "VAR_3 = False\n", "VAR_4 = None\n", "VAR_5 = None\n", "VAR_6 = False\n", "def __init__(self, VAR_7=None):...\n", "super(CLASS_0, self).__init__()\n", "if VAR_7 is not None:\n", "self.parse(VAR_7)\n", "def __bool__(self):...\n", "\"\"\"docstring\"\"\"\n", "return True\n" ]
[ "\"\"\"\nPyjo.Path - Path\n================\n::\n\n import Pyjo.Path\n\n # Parse\n path = Pyjo.Path.new('/foo%2Fbar%3B/baz.html')\n print(path[0])\n\n # Build\n path = Pyjo.Path.new(u'/i/♥')\n path.append('pyjo')\n print(path)\n\n:mod:`Pyjo.Path` is a container for paths used by :mod:`Pyjo.URL` and based on\n:rfc:`3986`.\n\"\"\"\n", "import Pyjo.Base\n", "import Pyjo.Mixin.String\n", "from Pyjo.Util import b, u, url_escape, url_unescape\n", "\"\"\"::\n\n path = Pyjo.Path.new()\n path = Pyjo.Path.new('/foo%2Fbar%3B/baz.html')\n\n Construct a new :mod`Pyjo.Path` object and :meth:`parse` path if necessary.\n \"\"\"\n", "charset = 'utf-8'\n", "\"\"\"::\n\n charset = path.charset\n path.charset = 'utf-8'\n\n Charset used for encoding and decoding, defaults to ``utf-8``. ::\n\n # Disable encoding and decoding\n path.charset = None\n \"\"\"\n", "_leading_slash = False\n", "_path = None\n", "_parts = None\n", "_trailing_slash = False\n", "def __init__(self, path=None):...\n", "super(Pyjo_Path, self).__init__()\n", "if path is not None:\n", "self.parse(path)\n", "def __bool__(self):...\n", "\"\"\"docstring\"\"\"\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "ImportFrom'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Condition", "Expr'", "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_19(self):...\n", "self.running.clear()\n" ]
[ "def term(self):...\n", "self.running.clear()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_7(self, VAR_9, VAR_10):...\n", "return ' %s %s,' % (VAR_9, VAR_10)\n" ]
[ "def create_table_field(self, current, field):...\n", "return ' %s %s,' % (current, field)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_15(self, VAR_26):...\n", "for group in self.config['groups']:\n", "for VAR_6 in group['components']:\n", "VAR_47 = Node({'name': 'master_node'})\n", "self.nodes[VAR_6['name']] = Node(VAR_6)\n", "for VAR_11 in self.nodes:\n", "VAR_49 = self.nodes.get(VAR_11)\n", "self.nodes['master_node'] = VAR_47\n", "VAR_47.addEdge(VAR_49)\n", "VAR_49 = self.nodes.get('master_node')\n", "self.logger.error(\n 'Detected circular dependency reference between %s and %s!' % (ex.node1,\n ex.node2))\n", "if 'depends' in VAR_49.component:\n", "VAR_50 = []\n", "if VAR_26:\n", "for dep in VAR_49.component['depends']:\n", "VAR_51 = []\n", "exit(1)\n", "if dep in self.nodes:\n", "dep_resolve(VAR_49, VAR_50, VAR_51)\n", "VAR_49.addEdge(self.nodes[dep])\n", "self.logger.error(\"Unmet dependency: '%s' for component '%s'!\" % (dep,\n VAR_49.comp_name))\n", "VAR_59 = ''\n", "if VAR_26:\n", "for VAR_49 in VAR_50:\n", "exit(1)\n", "if VAR_49 is not VAR_47:\n", "self.logger.debug('Dependency tree for start all: %s' % VAR_59)\n", "VAR_59 = '%s -> %s' % (VAR_59, VAR_49.comp_name)\n" ]
[ "def set_dependencies(self, exit_on_fail):...\n", "for group in self.config['groups']:\n", "for comp in group['components']:\n", "master_node = Node({'name': 'master_node'})\n", "self.nodes[comp['name']] = Node(comp)\n", "for name in self.nodes:\n", "node = self.nodes.get(name)\n", "self.nodes['master_node'] = master_node\n", "master_node.addEdge(node)\n", "node = self.nodes.get('master_node')\n", "self.logger.error(\n 'Detected circular dependency reference between %s and %s!' % (ex.node1,\n ex.node2))\n", "if 'depends' in node.component:\n", "res = []\n", "if exit_on_fail:\n", "for dep in node.component['depends']:\n", "unres = []\n", "exit(1)\n", "if dep in self.nodes:\n", "dep_resolve(node, res, unres)\n", "node.addEdge(self.nodes[dep])\n", "self.logger.error(\"Unmet dependency: '%s' for component '%s'!\" % (dep, node\n .comp_name))\n", "dep_string = ''\n", "if exit_on_fail:\n", "for node in res:\n", "exit(1)\n", "if node is not master_node:\n", "self.logger.debug('Dependency tree for start all: %s' % dep_string)\n", "dep_string = '%s -> %s' % (dep_string, node.comp_name)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "For", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "For", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "For", "Expr'", "Condition", "Expr'", "Assign'" ]