lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_4(self):...\n", "self.parse_cluster_options()\n", "for VAR_26 in ['skip_plugins', 'enable_plugins', 'plugin_options',\n", "if self[VAR_26]:\n", "VAR_13 = []\n", "if isinstance(self[VAR_26], six.string_types):\n", "self[VAR_26] = [self[VAR_26]]\n", "for option in self[VAR_26]:\n", "VAR_13 += option.split(',')\n", "self[VAR_26] = VAR_13\n" ]
[ "def parse_options(self):...\n", "self.parse_cluster_options()\n", "for opt in ['skip_plugins', 'enable_plugins', 'plugin_options', 'only_plugins'\n", "if self[opt]:\n", "opts = []\n", "if isinstance(self[opt], six.string_types):\n", "self[opt] = [self[opt]]\n", "for option in self[opt]:\n", "opts += option.split(',')\n", "self[opt] = opts\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "For", "Condition", "Assign'", "Condition", "Assign'", "For", "AugAssign'", "Assign'" ]
[ "def FUNC_3(self, VAR_10, VAR_11, VAR_12, VAR_13):...\n", "self.cursor.execute(\n \"\"\"INSERT INTO file (submission_id, hash, filename, size)\n VALUES(?, ?, ?, ?)\"\"\"\n , (VAR_10, VAR_11, VAR_12, VAR_13))\n", "self.database.commit()\n" ]
[ "def add_file(self, submission_id, hash, filename, size):...\n", "self.cursor.execute(\n \"\"\"INSERT INTO file (submission_id, hash, filename, size)\n VALUES(?, ?, ?, ?)\"\"\"\n , (submission_id, hash, filename, size))\n", "self.database.commit()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "@jwt_refresh_token_required...\n", "VAR_3 = get_jwt_identity()\n", "VAR_4 = create_access_token(identity=current_user)\n", "VAR_5 = jsonify({'refresh': True})\n", "set_access_cookies(VAR_5, VAR_4)\n", "return VAR_5\n" ]
[ "@jwt_refresh_token_required...\n", "current_user = get_jwt_identity()\n", "access_token = create_access_token(identity=current_user)\n", "resp = jsonify({'refresh': True})\n", "set_access_cookies(resp, access_token)\n", "return resp\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_12(self, VAR_19):...\n", "VAR_4 = self.directory\n", "def FUNC_19(VAR_36):...\n", "if VAR_36.strip() != '' and not os.path.exists(VAR_36):\n", "os.makedirs(VAR_36)\n", "VAR_37 = os.environ.copy()\n", "VAR_37['LC_MESSAGES'] = 'C'\n", "def FUNC_20():...\n", "VAR_61 = Popen(['git', 'ls-tree', '-r', '--name-only', 'HEAD'], stdout=PIPE,\n VAR_37=env)\n", "VAR_62 = VAR_61.communicate()[0]\n", "if VAR_61.returncode != 0 or not VAR_62.strip():\n", "return None\n", "return [e.strip() for e in VAR_62.splitlines() if os.path.exists(e)]\n" ]
[ "def mirror(self, dst_dir):...\n", "source_dir = self.directory\n", "def mkdir_p(path):...\n", "if path.strip() != '' and not os.path.exists(path):\n", "os.makedirs(path)\n", "env = os.environ.copy()\n", "env['LC_MESSAGES'] = 'C'\n", "def tracked_files():...\n", "p = Popen(['git', 'ls-tree', '-r', '--name-only', 'HEAD'], stdout=PIPE, env=env\n )\n", "out = p.communicate()[0]\n", "if p.returncode != 0 or not out.strip():\n", "return None\n", "return [e.strip() for e in out.splitlines() if os.path.exists(e)]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "FunctionDef'", "Condition", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_17(VAR_20, **VAR_19):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4[VAR_20] = VAR_19\n" ]
[ "def add_existing_task(task_id, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "created_tasks[task_id] = kwargs\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'" ]
[ "def FUNC_3(self, VAR_3, VAR_4, VAR_9):...\n", "if not isinstance(VAR_9, UserProfile):\n", "return True\n", "VAR_6 = VAR_3.user\n", "return VAR_6 and (VAR_6.id is not None and VAR_6.id == VAR_9.user_id or\n super().has_object_permission(VAR_3, VAR_4, VAR_9))\n" ]
[ "def has_object_permission(self, request, view, obj):...\n", "if not isinstance(obj, UserProfile):\n", "return True\n", "user = request.user\n", "return user and (user.id is not None and user.id == obj.user_id or super().\n has_object_permission(request, view, obj))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Return'" ]
[ "def FUNC_32(self):...\n", "VAR_44 = VAR_54.get_doc(self.doctype, self.name).as_dict()\n", "for VAR_7 in self.as_dict():\n", "VAR_25 = self.meta.get_field(VAR_7)\n", "VAR_60 = VAR_44.get(VAR_7)\n", "if VAR_25 and not VAR_25.allow_on_submit and (self.get(VAR_7) or VAR_60):\n", "if VAR_25.fieldtype == 'Table':\n", "VAR_72 = len(self.get(VAR_7))\n", "VAR_72 = self.get_value(VAR_7)\n", "VAR_60 = len(VAR_60)\n", "if VAR_72 != VAR_60:\n", "VAR_54.throw(_('Not allowed to change {0} after submission').format(VAR_25.\n label), VAR_54.UpdateAfterSubmitError)\n" ]
[ "def _validate_update_after_submit(self):...\n", "db_values = frappe.get_doc(self.doctype, self.name).as_dict()\n", "for key in self.as_dict():\n", "df = self.meta.get_field(key)\n", "db_value = db_values.get(key)\n", "if df and not df.allow_on_submit and (self.get(key) or db_value):\n", "if df.fieldtype == 'Table':\n", "self_value = len(self.get(key))\n", "self_value = self.get_value(key)\n", "db_value = len(db_value)\n", "if self_value != db_value:\n", "frappe.throw(_('Not allowed to change {0} after submission').format(df.\n label), frappe.UpdateAfterSubmitError)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'" ]
[ "@memoized_property...\n", "VAR_35 = {}\n", "VAR_36 = self.get_options().paths or {}\n", "for VAR_1, paths in sorted(VAR_36.items()):\n", "VAR_43 = normalize_os_name(VAR_1)\n", "return VAR_35\n", "if VAR_43 in VAR_35:\n", "VAR_0.warning('Multiple OS names alias to \"{}\"; combining results.'.format(\n VAR_43))\n", "VAR_35[VAR_43] = paths\n", "VAR_35[VAR_43].extend(paths)\n" ]
[ "@memoized_property...\n", "normalized = {}\n", "jdk_paths = self.get_options().paths or {}\n", "for name, paths in sorted(jdk_paths.items()):\n", "rename = normalize_os_name(name)\n", "return normalized\n", "if rename in normalized:\n", "logger.warning('Multiple OS names alias to \"{}\"; combining results.'.format\n (rename))\n", "normalized[rename] = paths\n", "normalized[rename].extend(paths)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_29):...\n", "if VAR_29 is None:\n", "return VAR_101.user.pref_numsites\n", "return VAR_54(VAR_55(int(VAR_29), 1), 250)\n" ]
[ "def run(self, limit):...\n", "if limit is None:\n", "return c.user.pref_numsites\n", "return min(max(int(limit), 1), 250)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_4():...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = os.path.join(FUNC_0(), 'tmp')\n", "if os.path.exists(VAR_13):\n", "import shutil\n", "shutil.rmtree(VAR_13)\n" ]
[ "def clean_tmp():...\n", "\"\"\"docstring\"\"\"\n", "tmp_path = os.path.join(path_to_visbrain_data(), 'tmp')\n", "if os.path.exists(tmp_path):\n", "import shutil\n", "shutil.rmtree(tmp_path)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Import'", "Expr'" ]
[ "def FUNC_22(VAR_30, VAR_3):...\n", "if not isinstance(VAR_30, _IOFile):\n", "return IOFile(VAR_30, VAR_16=self)\n", "return VAR_30.apply_wildcards(VAR_3, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n" ]
[ "def concretize_iofile(f, wildcards):...\n", "if not isinstance(f, _IOFile):\n", "return IOFile(f, rule=self)\n", "return f.apply_wildcards(wildcards, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_7(self):...\n", "return self.groups\n" ]
[ "def get_groups(self):...\n", "return self.groups\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_18(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer())\n" ]
[ "def test_z_delete_load_balancer(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_3(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_1 = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'show')\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'offline')\n", "self.driver._eql_execute('volume', 'delete', VAR_1['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_volume(VAR_1)\n" ]
[ "def test_delete_volume(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "volume = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'show')\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'offline')\n", "self.driver._eql_execute('volume', 'delete', volume['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_volume(volume)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_9(self):...\n", "VAR_7 = BokChoyTestSuite('', VAR_3=True)\n", "VAR_1 = 'tests'\n", "self.assertEqual(VAR_7.cmd, self._expected_command(VAR_1=name, VAR_3=True))\n" ]
[ "def test_verify_xss(self):...\n", "suite = BokChoyTestSuite('', verify_xss=True)\n", "name = 'tests'\n", "self.assertEqual(suite.cmd, self._expected_command(name=name, verify_xss=True))\n" ]
[ 0, 0, 0, 3 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_19 = configuration_helpers.get_value(\n 'ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS', settings.\n ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS)\n", "return [field for field in VAR_6['fields'] if field['name'] not in VAR_19]\n" ]
[ "def enterprise_fields_only(fields):...\n", "\"\"\"docstring\"\"\"\n", "enterprise_exclusions = configuration_helpers.get_value(\n 'ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS', settings.\n ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS)\n", "return [field for field in fields['fields'] if field['name'] not in\n enterprise_exclusions]\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_4(VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = hashlib.sha1()\n", "for name, content in FUNC_2(VAR_2, VAR_3, VAR_4, VAR_5):\n", "logging.warning('Missing expected file. Hash will be invalid.')\n", "VAR_12 = VAR_10.hexdigest()\n", "VAR_10.update(str(len(name)))\n", "logging.info('get_swarming_bot_version(%s) = %s', sorted(VAR_5), VAR_12)\n", "VAR_10.update(name)\n", "return VAR_12\n", "VAR_10.update(str(len(content)))\n", "VAR_10.update(content)\n" ]
[ "def get_swarming_bot_version(root_dir, host, host_version, additionals):...\n", "\"\"\"docstring\"\"\"\n", "h = hashlib.sha1()\n", "for name, content in yield_swarming_bot_files(root_dir, host, host_version,\n", "logging.warning('Missing expected file. Hash will be invalid.')\n", "bot_version = h.hexdigest()\n", "h.update(str(len(name)))\n", "logging.info('get_swarming_bot_version(%s) = %s', sorted(additionals),\n bot_version)\n", "h.update(name)\n", "return bot_version\n", "h.update(str(len(content)))\n", "h.update(content)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'", "Expr'", "Expr'" ]
[ "from django.db import models\n", "from .common_info import CommonInfo\n", "from django.urls import reverse\n", "from django.utils import timezone\n", "from .document_type import DocumentType\n", "from django.core.exceptions import ValidationError\n", "\"\"\"string\"\"\"\n", "VAR_0 = models.CharField(max_length=255)\n", "VAR_1 = models.CharField(max_length=255)\n", "VAR_2 = models.CharField(null=True, blank=True, max_length=275)\n", "VAR_3 = models.CharField(null=True, blank=True, max_length=100)\n", "VAR_4 = models.ForeignKey('DataGroup', on_delete=models.CASCADE)\n", "VAR_5 = models.ManyToManyField('Product', through='ProductDocument')\n", "VAR_6 = models.BooleanField(default=False)\n", "VAR_7 = models.BooleanField(default=False)\n", "VAR_8 = models.ForeignKey(DocumentType, on_delete=models.PROTECT, null=True,\n blank=True)\n", "VAR_9 = models.CharField(max_length=255, blank=True)\n", "VAR_10 = models.TextField(blank=True, null=True)\n", "VAR_11 = ['-id']\n", "def __str__(self):...\n", "return str(self.title)\n" ]
[ "from django.db import models\n", "from .common_info import CommonInfo\n", "from django.urls import reverse\n", "from django.utils import timezone\n", "from .document_type import DocumentType\n", "from django.core.exceptions import ValidationError\n", "\"\"\"\n A DataDocument object is a single source of Factotum data. \n\n ``filename``\n the name of the document's source file\n\n ``title``\n the title of the document\n \n ``url``\n an optional URL to the document's remote source\n\n ``raw_category``\n\n ``data_group``\n the DataGroup object to which the document belongs. The\n type of the data group determines which document types the\n document might be among, and determines much of the available \n relationships and behavior associated with the document's \n extracted data\n \n ``products``\n Products are associated with the data document in a many-to-many relationship\n\n ``matched``\n When a source file for the document has been uploaded to the\n file system, the document is considered \"matched\" to that\n source file. \n \n ``extracted``\n When the content of a data document has been extracted by manual data entry\n or by an extraction script, a new ExtractedText record is created\n with the DataDocument's id as its primary key. \n \n ``document_type``\n each type of data group may only contain certain types of data documents. The\n clean() method checks to make sure that the assigned document type is among the\n types allowed by the group type\n\n ``organization``\n\n ``note``\n\n \"\"\"\n", "filename = models.CharField(max_length=255)\n", "title = models.CharField(max_length=255)\n", "url = models.CharField(null=True, blank=True, max_length=275)\n", "raw_category = models.CharField(null=True, blank=True, max_length=100)\n", "data_group = models.ForeignKey('DataGroup', on_delete=models.CASCADE)\n", "products = models.ManyToManyField('Product', through='ProductDocument')\n", "matched = models.BooleanField(default=False)\n", "extracted = models.BooleanField(default=False)\n", "document_type = models.ForeignKey(DocumentType, on_delete=models.PROTECT,\n null=True, blank=True)\n", "organization = models.CharField(max_length=255, blank=True)\n", "note = models.TextField(blank=True, null=True)\n", "ordering = ['-id']\n", "def __str__(self):...\n", "return str(self.title)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_7():...\n", "\"\"\"docstring\"\"\"\n", "VAR_37 = np.random.get_state()\n", "np.random.seed(None)\n", "VAR_38 = np.random.bytes(ray_constants.ID_SIZE)\n", "np.random.set_state(VAR_37)\n", "return VAR_38\n" ]
[ "def random_string():...\n", "\"\"\"docstring\"\"\"\n", "numpy_state = np.random.get_state()\n", "np.random.seed(None)\n", "random_id = np.random.bytes(ray_constants.ID_SIZE)\n", "np.random.set_state(numpy_state)\n", "return random_id\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.bindings\n", "VAR_11 = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n", "VAR_9 = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'serverGroupName': group_name, 'region': bindings[\n 'TEST_GCE_REGION'], 'zone': bindings['TEST_GCE_ZONE'], 'asgName':\n group_name, 'type': 'destroyServerGroup', 'regions': [bindings[\n 'TEST_GCE_REGION']], 'zones': [bindings['TEST_GCE_ZONE']],\n 'credentials': bindings['GCE_CREDENTIALS'], 'user': '[anonymous]'}],\n application=self.TEST_APP, description='DestroyServerGroup: ' + group_name)\n", "VAR_10 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_10.new_clause_builder('Managed Instance Group Removed').inspect_resource(\n 'managed-instance-groups', VAR_11, no_resource_ok=True).contains_path_eq(\n 'targetSize', 0)\n", "VAR_10.new_clause_builder('Instances Are Removed', retryable_for_secs=30\n ).list_resources('instances').excludes_path_value('name', VAR_11)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_server_group', data=payload, path='tasks'), VAR_5=builder.build())\n" ]
[ "def delete_server_group(self):...\n", "\"\"\"docstring\"\"\"\n", "bindings = self.bindings\n", "group_name = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n", "payload = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'serverGroupName': group_name, 'region': bindings[\n 'TEST_GCE_REGION'], 'zone': bindings['TEST_GCE_ZONE'], 'asgName':\n group_name, 'type': 'destroyServerGroup', 'regions': [bindings[\n 'TEST_GCE_REGION']], 'zones': [bindings['TEST_GCE_ZONE']],\n 'credentials': bindings['GCE_CREDENTIALS'], 'user': '[anonymous]'}],\n application=self.TEST_APP, description='DestroyServerGroup: ' + group_name)\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Managed Instance Group Removed').inspect_resource(\n 'managed-instance-groups', group_name, no_resource_ok=True\n ).contains_path_eq('targetSize', 0)\n", "builder.new_clause_builder('Instances Are Removed', retryable_for_secs=30\n ).list_resources('instances').excludes_path_value('name', group_name)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_server_group', data=payload, path='tasks'), contract=builder.\n build())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "import arrow\n", "import logging\n", "import json\n", "import os\n", "from urllib.parse import urlparse\n", "from channels import Group\n", "from rest_framework.generics import CreateAPIView\n", "from rest_framework.permissions import IsAuthenticated\n", "from rest_framework.response import Response\n", "from rest_framework import status\n", "from django.conf import settings\n", "from realpal.apps.chat.models import Message\n", "from realpal.apps.chat.serializers import MessageSerializer\n", "from realpal.apps.chat.consumers import get_room_group_channel\n", "from realpal.apps.chat.models import Room\n", "VAR_0 = logging.getLogger(__name__)\n", "\"\"\"string\"\"\"\n", "VAR_1 = Message\n", "VAR_2 = MessageSerializer\n", "VAR_3 = [IsAuthenticated]\n", "def FUNC_0(self, VAR_4, *VAR_5, **VAR_6):...\n", "VAR_10 = self.request.data.get('room')\n", "self.room = Room.objects.get(pk=room_id)\n", "return Response(status=status.HTTP_400_BAD_REQUEST)\n", "def FUNC_1(self, VAR_7):...\n", "self.request.data['sent_by'] = self.request.user.id\n", "VAR_7.is_valid(self)\n", "self.request.data['room'] = self.room.id\n", "VAR_11 = VAR_7.save(sent_by=self.request.user, room=self.room)\n", "self.request.data['text'] = self.request.data.get('message')\n", "if not settings.IS_TESTING:\n", "VAR_7 = self.get_serializer(VAR_9=request.data)\n", "VAR_9 = {'id': VAR_11.id.__str__(), 'timestamp': VAR_11.time_ago,\n 'timestamp_string': VAR_11.timestamp_string, 'user_handle': self.\n request.user.full_name, 'user_type': self.request.user.user_type,\n 'message': VAR_11.text, 'file_name': os.path.basename(urlparse(VAR_11.\n attachment.path).path) if VAR_11.attachment else None, 'file_link': \n VAR_11.file_download_link if VAR_11.attachment else None}\n", "@staticmethod...\n", "self.perform_create(VAR_7)\n", "VAR_8 = get_room_group_channel(VAR_11.room.id)\n", "Group(VAR_8).send({'text': json.dumps(VAR_9)})\n", "return Response(VAR_7.data, status=status.HTTP_201_CREATED)\n", "self.push_socket_update(VAR_8, VAR_9)\n" ]
[ "import arrow\n", "import logging\n", "import json\n", "import os\n", "from urllib.parse import urlparse\n", "from channels import Group\n", "from rest_framework.generics import CreateAPIView\n", "from rest_framework.permissions import IsAuthenticated\n", "from rest_framework.response import Response\n", "from rest_framework import status\n", "from django.conf import settings\n", "from realpal.apps.chat.models import Message\n", "from realpal.apps.chat.serializers import MessageSerializer\n", "from realpal.apps.chat.consumers import get_room_group_channel\n", "from realpal.apps.chat.models import Room\n", "logger = logging.getLogger(__name__)\n", "\"\"\"\n Creates a new message object with a file attachment\n\n Returns on the socket\n\n {\n 'id': \"id\",\n 'sent_by':'user_id',\n 'room':\"room_id\",\n 'text':message.txt,\n 'file_name': message.attachment,\n 'file_link': message.attachment.path\n }\n \"\"\"\n", "model = Message\n", "serializer_class = MessageSerializer\n", "permission_classes = [IsAuthenticated]\n", "def create(self, request, *args, **kwargs):...\n", "room_id = self.request.data.get('room')\n", "self.room = Room.objects.get(pk=room_id)\n", "return Response(status=status.HTTP_400_BAD_REQUEST)\n", "def perform_create(self, serializer):...\n", "self.request.data['sent_by'] = self.request.user.id\n", "serializer.is_valid(self)\n", "self.request.data['room'] = self.room.id\n", "instance = serializer.save(sent_by=self.request.user, room=self.room)\n", "self.request.data['text'] = self.request.data.get('message')\n", "if not settings.IS_TESTING:\n", "serializer = self.get_serializer(data=request.data)\n", "data = {'id': instance.id.__str__(), 'timestamp': instance.time_ago,\n 'timestamp_string': instance.timestamp_string, 'user_handle': self.\n request.user.full_name, 'user_type': self.request.user.user_type,\n 'message': instance.text, 'file_name': os.path.basename(urlparse(\n instance.attachment.path).path) if instance.attachment else None,\n 'file_link': instance.file_download_link if instance.attachment else None}\n", "@staticmethod...\n", "self.perform_create(serializer)\n", "group_channel = get_room_group_channel(instance.room.id)\n", "Group(group_channel).send({'text': json.dumps(data)})\n", "return Response(serializer.data, status=status.HTTP_201_CREATED)\n", "self.push_socket_update(group_channel, data)\n" ]
[ 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 6, 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 ]
[ "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Return'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Return'", "Expr'" ]
[ "def FUNC_0(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_0.project_data():\n", "VAR_2 = VAR_0.project_data()['urtext_path']\n", "VAR_2 = '.'\n", "return VAR_2\n" ]
[ "def get_path(window):...\n", "\"\"\"docstring\"\"\"\n", "if window.project_data():\n", "path = window.project_data()['urtext_path']\n", "path = '.'\n", "return path\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_27(self):...\n", "\"\"\"docstring\"\"\"\n", "if not self.exists and FUNC_0(self.file):\n" ]
[ "def check_broken_symlink(self):...\n", "\"\"\"docstring\"\"\"\n", "if not self.exists and lstat(self.file):\n" ]
[ 0, 0, 7 ]
[ "FunctionDef'", "Docstring", "Condition" ]
[ "@tornado.gen.coroutine...\n", "VAR_17 = 'SELECT date, temp_average_air FROM reports WHERE YEAR(date) = %s'\n", "VAR_18 = VAR_2,\n", "VAR_19 = yield VAR_1.execute(query=sql, VAR_18=params)\n", "VAR_26 = VAR_19.fetchall()\n", "VAR_25 = {}\n", "for VAR_21 in VAR_26:\n", "VAR_11 = VAR_21[0].timetuple().tm_yday\n", "return VAR_25\n", "VAR_25[VAR_11] = VAR_21[1]\n" ]
[ "@tornado.gen.coroutine...\n", "sql = 'SELECT date, temp_average_air FROM reports WHERE YEAR(date) = %s'\n", "params = year,\n", "cursor = yield tx.execute(query=sql, params=params)\n", "data = cursor.fetchall()\n", "res = {}\n", "for row in data:\n", "day = row[0].timetuple().tm_yday\n", "return res\n", "res[day] = row[1]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_5(self, VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "self._path = b(VAR_7, self.charset)\n", "self._parts = None\n", "self._leading_slash = False\n", "self._trailing_slash = False\n", "return self\n" ]
[ "def parse(self, path):...\n", "\"\"\"docstring\"\"\"\n", "self._path = b(path, self.charset)\n", "self._parts = None\n", "self._leading_slash = False\n", "self._trailing_slash = False\n", "return self\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "for retries in range(1, 100):\n", "logger.info('Checking to see if mcpd is up')\n", "if VAR_16 is 0:\n", "VAR_16 = shellutil.run(\n '/usr/bin/tmsh -a show sys mcp-state field-fmt 2>/dev/null | grep phase | grep running'\n , VAR_8=False)\n", "return True\n", "if VAR_16 == 0:\n", "logger.info('mcpd is up!')\n", "time.sleep(30)\n" ]
[ "def _wait_until_mcpd_is_initialized(self):...\n", "\"\"\"docstring\"\"\"\n", "for retries in range(1, 100):\n", "logger.info('Checking to see if mcpd is up')\n", "if rc is 0:\n", "rc = shellutil.run(\n '/usr/bin/tmsh -a show sys mcp-state field-fmt 2>/dev/null | grep phase | grep running'\n , chk_err=False)\n", "return True\n", "if rc == 0:\n", "logger.info('mcpd is up!')\n", "time.sleep(30)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Expr'", "Condition", "Assign'", "Return'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_12(self):...\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "create_test_db()\n", "os.rename(filename, 'temp_' + filename)\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "os.rename('test_' + filename, filename)\n" ]
[ "def setUp(self):...\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "create_test_db()\n", "os.rename(filename, 'temp_' + filename)\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "os.rename('test_' + filename, filename)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'", "Expr'", "For", "Expr'" ]
[ "@memoized_property...\n", "return PythonSetup.global_instance()\n" ]
[ "@memoized_property...\n", "return PythonSetup.global_instance()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_0():...\n", "VAR_0 = {'static_path': os.path.join(os.path.dirname(__file__), './static'),\n 'template_path': './server/templates', 'login_url': '/login',\n 'cookie_secret': os.urandom(24), 'xsrf_cookies': True}\n", "VAR_1 = [('/', CLASS_1), ('/report', CLASS_3), ('/create', CLASS_3.\n NewReportController), ('/login', CLASS_2), ('/logout', CLASS_2.\n LogoutController)]\n", "VAR_2 = tornado.web.Application(VAR_1, **server_settings)\n", "VAR_3 = tornado.httpserver.HTTPServer(VAR_2)\n", "VAR_3.listen(options.port)\n", "tornado.ioloop.IOLoop.instance().start()\n" ]
[ "def launch():...\n", "server_settings = {'static_path': os.path.join(os.path.dirname(__file__),\n './static'), 'template_path': './server/templates', 'login_url':\n '/login', 'cookie_secret': os.urandom(24), 'xsrf_cookies': True}\n", "handlers = [('/', IndexController), ('/report', ReportController), (\n '/create', ReportController.NewReportController), ('/login',\n LoginController), ('/logout', LoginController.LogoutController)]\n", "application = tornado.web.Application(handlers, **server_settings)\n", "http_server = tornado.httpserver.HTTPServer(application)\n", "http_server.listen(options.port)\n", "tornado.ioloop.IOLoop.instance().start()\n" ]
[ 0, 4, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(self):...\n", "VAR_8 = 'test_foo.py:FooTest.test_bar'\n", "VAR_7 = BokChoyTestSuite('', test_spec=spec)\n", "VAR_1 = 'tests/{}'.format(VAR_8)\n", "self.assertEqual(VAR_7.cmd, self._expected_command(VAR_1=name))\n" ]
[ "def test_testcase_spec(self):...\n", "spec = 'test_foo.py:FooTest.test_bar'\n", "suite = BokChoyTestSuite('', test_spec=spec)\n", "name = 'tests/{}'.format(spec)\n", "self.assertEqual(suite.cmd, self._expected_command(name=name))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_16(self, VAR_29=False):...\n", "VAR_46 = list(get_plugins(pm))\n", "if not VAR_29:\n", "VAR_46 = [p for p in VAR_46 if p['name'] not in DEFAULT_PLUGINS]\n", "return [{'name': p['name'], 'static': p['static_path'] is not None,\n 'templates': p['templates_path'] is not None, 'version': p.get(\n 'version')} for p in VAR_46]\n" ]
[ "def plugins(self, show_all=False):...\n", "ps = list(get_plugins(pm))\n", "if not show_all:\n", "ps = [p for p in ps if p['name'] not in DEFAULT_PLUGINS]\n", "return [{'name': p['name'], 'static': p['static_path'] is not None,\n 'templates': p['templates_path'] is not None, 'version': p.get(\n 'version')} for p in ps]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_23(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = SosNode(VAR_5, self.config)\n", "if VAR_6.connected:\n", "self.client_list.append(VAR_6)\n", "VAR_6.close_ssh_session()\n" ]
[ "def _connect_to_node(self, node):...\n", "\"\"\"docstring\"\"\"\n", "client = SosNode(node, self.config)\n", "if client.connected:\n", "self.client_list.append(client)\n", "client.close_ssh_session()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "from django.core.management.base import BaseCommand\n", "from ct.models import Course, Role, UnitLesson, Unit, Lesson, Response\n", "from ctms.models import Invite\n", "from chat.models import Chat, EnrollUnitCode\n", "from accounts.models import Instructor\n", "from core.common.utils import update_onboarding_step, get_onboarding_percentage\n", "from core.common import onboarding\n", "from django.conf import settings\n", "VAR_0 = 'Onboarding preprocessing'\n", "def FUNC_0(self, *VAR_1, **VAR_2):...\n", "for instructor in Instructor.objects.all():\n", "VAR_5 = Course.objects.get(id=settings.ONBOARDING_INTRODUCTION_COURSE_ID)\n", "print('Onboarding course is not provided')\n", "VAR_3 = Chat.objects.filter(user=instructor.user,\n enroll_code__courseUnit__course=course, progress__gte=70).exists()\n", "return\n", "if VAR_3:\n", "update_onboarding_step(onboarding.STEP_2, instructor.user_id)\n", "if Course.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_3, instructor.user_id)\n", "if Unit.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_4, instructor.user_id)\n", "if Lesson.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_5, instructor.user_id)\n", "if Invite.objects.filter(instructor=instructor).exists():\n", "update_onboarding_step(onboarding.STEP_8, instructor.user_id)\n", "VAR_4 = EnrollUnitCode.objects.filter(courseUnit__course__addedBy=\n instructor.user, isPreview=True, isLive=False, isTest=False).exists()\n", "if VAR_4:\n", "update_onboarding_step(onboarding.STEP_6, instructor.user_id)\n", "print('Instructor {} passed onboarding at {}%'.format(instructor.user.\n username, get_onboarding_percentage(instructor.user.id)))\n" ]
[ "from django.core.management.base import BaseCommand\n", "from ct.models import Course, Role, UnitLesson, Unit, Lesson, Response\n", "from ctms.models import Invite\n", "from chat.models import Chat, EnrollUnitCode\n", "from accounts.models import Instructor\n", "from core.common.utils import update_onboarding_step, get_onboarding_percentage\n", "from core.common import onboarding\n", "from django.conf import settings\n", "help = 'Onboarding preprocessing'\n", "def handle(self, *args, **options):...\n", "for instructor in Instructor.objects.all():\n", "course = Course.objects.get(id=settings.ONBOARDING_INTRODUCTION_COURSE_ID)\n", "print('Onboarding course is not provided')\n", "chat_exists = Chat.objects.filter(user=instructor.user,\n enroll_code__courseUnit__course=course, progress__gte=70).exists()\n", "return\n", "if chat_exists:\n", "update_onboarding_step(onboarding.STEP_2, instructor.user_id)\n", "if Course.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_3, instructor.user_id)\n", "if Unit.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_4, instructor.user_id)\n", "if Lesson.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_5, instructor.user_id)\n", "if Invite.objects.filter(instructor=instructor).exists():\n", "update_onboarding_step(onboarding.STEP_8, instructor.user_id)\n", "enroll_unit_code_exists = EnrollUnitCode.objects.filter(\n courseUnit__course__addedBy=instructor.user, isPreview=True, isLive=\n False, isTest=False).exists()\n", "if enroll_unit_code_exists:\n", "update_onboarding_step(onboarding.STEP_6, instructor.user_id)\n", "print('Instructor {} passed onboarding at {}%'.format(instructor.user.\n username, get_onboarding_percentage(instructor.user.id)))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 6, 6, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "For", "Assign'", "Expr'", "Assign'", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "\"\"\"string\"\"\"\n", "import logging as log\n", "import numpy as np\n", "from numpy.random import randn\n", "from openqml import Device, DeviceError\n", "from openqml import Variable\n", "import projectq as pq\n", "import projectq.setups.ibm\n", "from projectq.ops import HGate, XGate, YGate, ZGate, SGate, TGate, SqrtXGate, SwapGate, SqrtSwapGate, Rx, Ry, Rz, R\n", "from .ops import CNOT, CZ, Toffoli, AllZGate, Rot, Hermitian\n", "from ._version import __version__\n", "VAR_0 = {'PauliX': XGate, 'PauliY': YGate, 'PauliZ': ZGate, 'CNOT': CNOT,\n 'CZ': CZ, 'SWAP': SwapGate, 'RX': Rx, 'RY': Ry, 'RZ': Rz, 'Rot': Rot}\n", "\"\"\"string\"\"\"\n", "VAR_1 = 'ProjectQ OpenQML plugin'\n", "VAR_2 = 'projectq'\n", "VAR_3 = '0.1.0'\n", "VAR_4 = __version__\n", "VAR_5 = 'Christian Gogolin'\n", "VAR_6 = {'backend': list(['Simulator', 'ClassicalSimulator', 'IBMBackend'])}\n", "def __init__(self, VAR_7, **VAR_8):...\n", "VAR_8.setdefault('shots', 0)\n", "super().__init__(self.short_name, VAR_8['shots'])\n", "for k, v in {'log': 'verbose'}.items():\n", "if k in VAR_8:\n", "if 'num_runs' in VAR_8:\n", "VAR_8.setdefault(v, VAR_8[k])\n", "if isinstance(VAR_8['num_runs'], int) and VAR_8['num_runs'] > 0:\n", "self.wires = VAR_7\n", "self.n_eval = VAR_8['num_runs']\n", "self.n_eval = 0\n", "self.backend = VAR_8['backend']\n", "self.kwargs = VAR_8\n", "self.eng = None\n", "self.reg = None\n", "def FUNC_0(self):...\n", "self.reg = self.eng.allocate_qureg(self.wires)\n", "def __repr__(self):...\n", "return super().__repr__() + 'Backend: ' + self.backend + '\\n'\n" ]
[ "\"\"\"\nProjectQ plugin\n========================\n\n**Module name:** :mod:`openqml.plugins.projectq`\n\n.. currentmodule:: openqml.plugins.projectq\n\nThis plugin provides the interface between OpenQML and ProjecQ.\nIt enables OpenQML to optimize quantum circuits simulable with ProjectQ.\n\nProjecQ supports several different backends. Of those, the following are useful in the current context:\n\n- projectq.backends.Simulator([gate_fusion, ...])\tSimulator is a compiler engine which simulates a quantum computer using C++-based kernels.\n- projectq.backends.ClassicalSimulator()\t A simple introspective simulator that only permits classical operations.\n- projectq.backends.IBMBackend([use_hardware, ...])\tThe IBM Backend class, which stores the circuit, transforms it to JSON QASM, and sends the circuit through the IBM API.\n\nSee PluginAPI._capabilities['backend'] for a list of backend options.\n\nFunctions\n---------\n\n.. autosummary::\n init_plugin\n\nClasses\n-------\n\n.. autosummary::\n Gate\n Observable\n PluginAPI\n\n----\n\"\"\"\n", "import logging as log\n", "import numpy as np\n", "from numpy.random import randn\n", "from openqml import Device, DeviceError\n", "from openqml import Variable\n", "import projectq as pq\n", "import projectq.setups.ibm\n", "from projectq.ops import HGate, XGate, YGate, ZGate, SGate, TGate, SqrtXGate, SwapGate, SqrtSwapGate, Rx, Ry, Rz, R\n", "from .ops import CNOT, CZ, Toffoli, AllZGate, Rot, Hermitian\n", "from ._version import __version__\n", "operator_map = {'PauliX': XGate, 'PauliY': YGate, 'PauliZ': ZGate, 'CNOT':\n CNOT, 'CZ': CZ, 'SWAP': SwapGate, 'RX': Rx, 'RY': Ry, 'RZ': Rz, 'Rot': Rot}\n", "\"\"\"ProjectQ device for OpenQML.\n\n Args:\n wires (int): The number of qubits of the device.\n\n Keyword Args for Simulator backend:\n gate_fusion (bool): If True, gates are cached and only executed once a certain gate-size has been reached (only has an effect for the c++ simulator).\n rnd_seed (int): Random seed (uses random.randint(0, 4294967295) by default).\n\n Keyword Args for IBMBackend backend:\n use_hardware (bool): If True, the code is run on the IBM quantum chip (instead of using the IBM simulator)\n num_runs (int): Number of runs to collect statistics. (default is 1024)\n verbose (bool): If True, statistics are printed, in addition to the measurement result being registered (at the end of the circuit).\n user (string): IBM Quantum Experience user name\n password (string): IBM Quantum Experience password\n device (string): Device to use (‘ibmqx4’, or ‘ibmqx5’) if use_hardware is set to True. Default is ibmqx4.\n retrieve_execution (int): Job ID to retrieve instead of re-running the circuit (e.g., if previous run timed out).\n \"\"\"\n", "name = 'ProjectQ OpenQML plugin'\n", "short_name = 'projectq'\n", "api_version = '0.1.0'\n", "plugin_version = __version__\n", "author = 'Christian Gogolin'\n", "_capabilities = {'backend': list(['Simulator', 'ClassicalSimulator',\n 'IBMBackend'])}\n", "def __init__(self, wires, **kwargs):...\n", "kwargs.setdefault('shots', 0)\n", "super().__init__(self.short_name, kwargs['shots'])\n", "for k, v in {'log': 'verbose'}.items():\n", "if k in kwargs:\n", "if 'num_runs' in kwargs:\n", "kwargs.setdefault(v, kwargs[k])\n", "if isinstance(kwargs['num_runs'], int) and kwargs['num_runs'] > 0:\n", "self.wires = wires\n", "self.n_eval = kwargs['num_runs']\n", "self.n_eval = 0\n", "self.backend = kwargs['backend']\n", "self.kwargs = kwargs\n", "self.eng = None\n", "self.reg = None\n", "def reset(self):...\n", "self.reg = self.eng.allocate_qureg(self.wires)\n", "def __repr__(self):...\n", "return super().__repr__() + 'Backend: ' + self.backend + '\\n'\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 ]
[ "Expr'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Expr'", "For", "Condition", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n", "CLASS_3.__init__(self, VAR_18, errors.BAD_SR_NAME, *VAR_15, **kw)\n" ]
[ "def __init__(self, item, *a, **kw):...\n", "VRequired.__init__(self, item, errors.BAD_SR_NAME, *a, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_0(self):...\n", "self.serial.close()\n" ]
[ "def close(self):...\n", "self.serial.close()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_2():...\n", "VAR_2 = json.load(f)\n" ]
[ "def read_cms_config():...\n", "cms_config = json.load(f)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_2 = re.compile('<.*?>')\n", "VAR_3 = re.sub(VAR_2, '', VAR_0)\n", "return VAR_3\n" ]
[ "def cleanhtml(raw_html):...\n", "cleanr = re.compile('<.*?>')\n", "cleantext = re.sub(cleanr, '', raw_html)\n", "return cleantext\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@classmethod...\n", "assert engine\n", "VAR_9 = text('string')\n", "VAR_7 = engine.connect()\n", "VAR_10 = VAR_7.execute(VAR_9, VAR_1=username).fetchone()\n", "if VAR_10 is not None:\n", "VAR_10 = CLASS_0(VAR_10[0], VAR_10[1], VAR_10[2].decode('utf-8'), VAR_10[3])\n", "VAR_7.close()\n", "return VAR_10\n" ]
[ "@classmethod...\n", "assert engine\n", "s = text(\n 'SELECT user_id, username, hashed_password, roll_id FROM users WHERE username = :username AND expire_date is null'\n )\n", "connection = engine.connect()\n", "rc = connection.execute(s, username=username).fetchone()\n", "if rc is not None:\n", "rc = User(rc[0], rc[1], rc[2].decode('utf-8'), rc[3])\n", "connection.close()\n", "return rc\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assert'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_6(self, VAR_47):...\n", "if VAR_101.user_is_admin:\n", "return True\n", "if VAR_101.user_is_loggedin:\n", "VAR_18 = Thing._by_fullname(VAR_47, data=True)\n", "abort(403, 'forbidden')\n", "VAR_109 = VAR_18.subreddit_slow\n", "if VAR_109.can_ban(VAR_101.user):\n", "return True\n" ]
[ "def run(self, thing_name):...\n", "if c.user_is_admin:\n", "return True\n", "if c.user_is_loggedin:\n", "item = Thing._by_fullname(thing_name, data=True)\n", "abort(403, 'forbidden')\n", "subreddit = item.subreddit_slow\n", "if subreddit.can_ban(c.user):\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Return'" ]
[ "def __init__(self, VAR_13, VAR_14=None, VAR_15=None):...\n", "self.lexeme = VAR_14\n", "self.ttype = VAR_13\n", "self.position = VAR_15\n" ]
[ "def __init__(self, ttype, lexeme=None, position=None):...\n", "self.lexeme = lexeme\n", "self.ttype = ttype\n", "self.position = position\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'" ]
[ "from django.shortcuts import render\n", "from django.http import HttpResponse, JsonResponse\n", "from django.views.decorators.csrf import csrf_exempt\n", "from rest_framework.renderers import JSONRenderer\n", "from rest_framework.parsers import JSONParser\n", "from rest_framework.response import Response\n", "from rest_framework import viewsets\n", "from rest_framework.decorators import list_route\n", "from flask import escape\n", "from .models import BoxDetails, RegisteredServices\n", "from .serializers import BoxDetailsSerializer, RegisteredServicesSerializer\n", "import common, sqlite3, subprocess, NetworkManager, os, crypt, pwd, getpass, spwd\n", "VAR_0 = NetworkManager.NetworkManager\n", "VAR_1 = [d for d in VAR_0.Devices if isinstance(d, NetworkManager.Wireless)]\n", "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = f.read().split('\\n')\n", "VAR_18 = VAR_17[4].split('=')[1].strip('\"')\n", "return VAR_18\n" ]
[ "from django.shortcuts import render\n", "from django.http import HttpResponse, JsonResponse\n", "from django.views.decorators.csrf import csrf_exempt\n", "from rest_framework.renderers import JSONRenderer\n", "from rest_framework.parsers import JSONParser\n", "from rest_framework.response import Response\n", "from rest_framework import viewsets\n", "from rest_framework.decorators import list_route\n", "from flask import escape\n", "from .models import BoxDetails, RegisteredServices\n", "from .serializers import BoxDetailsSerializer, RegisteredServicesSerializer\n", "import common, sqlite3, subprocess, NetworkManager, os, crypt, pwd, getpass, spwd\n", "nm = NetworkManager.NetworkManager\n", "wlans = [d for d in nm.Devices if isinstance(d, NetworkManager.Wireless)]\n", "def get_osversion():...\n", "\"\"\"docstring\"\"\"\n", "osfilecontent = f.read().split('\\n')\n", "version = osfilecontent[4].split('=')[1].strip('\"')\n", "return version\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "@wraps(VAR_6)...\n", "if 'logged_in' in VAR_10:\n", "return VAR_6(*VAR_8, **kwargs)\n", "flash('Unauthorized, Please login', 'danger')\n", "return redirect(url_for('login'))\n" ]
[ "@wraps(f)...\n", "if 'logged_in' in session:\n", "return f(*args, **kwargs)\n", "flash('Unauthorized, Please login', 'danger')\n", "return redirect(url_for('login'))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_16(VAR_6):...\n", "if 'Content-Security-Policy' not in VAR_6.headers:\n", "return False\n", "if \"default-src 'self'\" not in VAR_6.headers['Content-Security-Policy']:\n", "return False\n", "return True\n" ]
[ "def validate_csp(page):...\n", "if 'Content-Security-Policy' not in page.headers:\n", "return False\n", "if \"default-src 'self'\" not in page.headers['Content-Security-Policy']:\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_5(self):...\n", "if not self.route:\n", "return frappe.db.get_value('Blog Category', self.blog_category, 'route'\n ) + '/' + self.scrub(self.title)\n" ]
[ "def make_route(self):...\n", "if not self.route:\n", "return frappe.db.get_value('Blog Category', self.blog_category, 'route'\n ) + '/' + self.scrub(self.title)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'" ]
[ "def FUNC_22(VAR_48):...\n", "for VAR_29, VAR_51 in sorted(VAR_48.options.items()):\n", "if VAR_51 is None:\n", "VAR_46.append('unset(%s CACHE)\\n' % VAR_29)\n", "if isinstance(VAR_51, bool):\n", "VAR_79 = 'BOOL'\n", "VAR_79 = 'STRING'\n", "VAR_51 = 'ON' if VAR_51 else 'OFF'\n", "VAR_46.append('set(%s %s CACHE INTERNAL \"\" FORCE)\\n' % (VAR_29, VAR_51))\n" ]
[ "def dump_options(module):...\n", "for key, value in sorted(module.options.items()):\n", "if value is None:\n", "cmakelists_rows.append('unset(%s CACHE)\\n' % key)\n", "if isinstance(value, bool):\n", "kind = 'BOOL'\n", "kind = 'STRING'\n", "value = 'ON' if value else 'OFF'\n", "cmakelists_rows.append('set(%s %s CACHE INTERNAL \"\" FORCE)\\n' % (key, value))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_22(self):...\n", "\"\"\"docstring\"\"\"\n", "self.client = paramiko.SSHClient()\n", "if not self.config['password']:\n", "self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n", "self.log_error('Authentication failed. SSH keys installed?')\n", "self.log_error('Authentication failed. Incorrect password.')\n", "self.client.load_system_host_keys()\n", "self.log_error(\n 'Bad authentication type. The node rejected the authentication attempt.')\n", "self.log_debug('Opening session to %s.' % self.address)\n", "self.log_error(\n 'Provided key was rejected by remote SSH client. Check ~/.ssh/known_hosts.'\n )\n", "self.client.connect(self.address, username=self.config['ssh_user'], port=\n self.config['ssh_port'], password=self.config['password'] or None,\n VAR_17=15)\n", "if VAR_67.errno == -2:\n", "self.log_debug('%s successfully connected' % self._hostname)\n", "self.log_error('Provided hostname did not resolve.')\n", "self.log_error('Socket error trying to connect: %s' % VAR_67)\n", "return True\n", "VAR_4 = 'Unable to connect: %s' % VAR_67\n", "if hasattr(VAR_67, 'errors'):\n", "VAR_4 = self._determine_ssh_error(VAR_67.errors)\n", "self.log_error(VAR_4)\n" ]
[ "def open_ssh_session(self):...\n", "\"\"\"docstring\"\"\"\n", "self.client = paramiko.SSHClient()\n", "if not self.config['password']:\n", "self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n", "self.log_error('Authentication failed. SSH keys installed?')\n", "self.log_error('Authentication failed. Incorrect password.')\n", "self.client.load_system_host_keys()\n", "self.log_error(\n 'Bad authentication type. The node rejected the authentication attempt.')\n", "self.log_debug('Opening session to %s.' % self.address)\n", "self.log_error(\n 'Provided key was rejected by remote SSH client. Check ~/.ssh/known_hosts.'\n )\n", "self.client.connect(self.address, username=self.config['ssh_user'], port=\n self.config['ssh_port'], password=self.config['password'] or None,\n timeout=15)\n", "if err.errno == -2:\n", "self.log_debug('%s successfully connected' % self._hostname)\n", "self.log_error('Provided hostname did not resolve.')\n", "self.log_error('Socket error trying to connect: %s' % err)\n", "return True\n", "msg = 'Unable to connect: %s' % err\n", "if hasattr(err, 'errors'):\n", "msg = self._determine_ssh_error(err.errors)\n", "self.log_error(msg)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Return'", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_4, VAR_5):...\n", "self.port = 23\n", "super().__init__(VAR_4, VAR_5)\n", "if VAR_5.jtag:\n", "self.connect_telnet()\n" ]
[ "def __init__(self, database, options):...\n", "self.port = 23\n", "super().__init__(database, options)\n", "if options.jtag:\n", "self.connect_telnet()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/apps'\n", "VAR_5 = self.client.post(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_6 = VAR_5.data['id']\n", "VAR_7 = Container.objects.create(owner=User.objects.get(username='autotest'\n ), app=App.objects.get(id=app_id), release=App.objects.get(id=app_id).\n release_set.latest(), type='web', VAR_9=1)\n", "self.assertRaises(AttributeError, lambda : setattr(VAR_7, 'state', 'up'))\n" ]
[ "def test_container_state_protected(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "c = Container.objects.create(owner=User.objects.get(username='autotest'),\n app=App.objects.get(id=app_id), release=App.objects.get(id=app_id).\n release_set.latest(), type='web', num=1)\n", "self.assertRaises(AttributeError, lambda : setattr(c, 'state', 'up'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_44(self):...\n", "return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n FileColumn)]\n" ]
[ "def get_file_column_list(self):...\n", "return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n FileColumn)]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_22(self, VAR_14):...\n", "if self.is_relation_many_to_one(VAR_14):\n", "VAR_34 = self.get_relation_fk(VAR_14)\n", "return self.list_columns[VAR_14].nullable\n", "return False\n", "return VAR_34.nullable\n" ]
[ "def is_nullable(self, col_name):...\n", "if self.is_relation_many_to_one(col_name):\n", "col = self.get_relation_fk(col_name)\n", "return self.list_columns[col_name].nullable\n", "return False\n", "return col.nullable\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Return'", "Return'" ]
[ "def __str__(self):...\n", "from beamr.interpreters.config import Config\n", "if VAR_31.effectiveConfig['bib']:\n", "return '\\\\cite{' + self.txt + '}'\n", "warn('Citations used but no bibliography file given.')\n", "return ''\n" ]
[ "def __str__(self):...\n", "from beamr.interpreters.config import Config\n", "if Config.effectiveConfig['bib']:\n", "return '\\\\cite{' + self.txt + '}'\n", "warn('Citations used but no bibliography file given.')\n", "return ''\n" ]
[ 0, 0, 2, 2, 2, 0 ]
[ "FunctionDef'", "ImportFrom'", "Condition", "Return'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "self.pid = VAR_1\n", "self.comp_name = VAR_2\n" ]
[ "def __init__(self, pid, comp_name):...\n", "\"\"\"docstring\"\"\"\n", "self.pid = pid\n", "self.comp_name = comp_name\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'" ]
[ "def FUNC_8():...\n", "VAR_38 = FUNC_3(VAR_18, VAR_19)\n", "VAR_37 = CLASS_19 if VAR_20 else CLASS_20\n", "return VAR_37, VAR_38\n" ]
[ "def five():...\n", "HHFormSet = make_formset(parent, child)\n", "ParentForm = ExtractedHHDocForm if extracted else ExtractedHHDocEditForm\n", "return ParentForm, HHFormSet\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = dict()\n", "self.cursor.execute('SELECT * FROM {0}'.format(VAR_1))\n", "VAR_6 = {}\n", "for VAR_13 in self.cursor:\n", "VAR_6[VAR_12(VAR_13[3])] = {}\n", "return json.dumps(VAR_6)\n", "VAR_6[VAR_12(VAR_13[3])]['nome'] = VAR_13[0]\n", "VAR_6[VAR_12(VAR_13[3])]['sobrenome'] = VAR_13[1]\n", "VAR_6[VAR_12(VAR_13[3])]['endereco'] = VAR_13[2]\n" ]
[ "def select(self, table):...\n", "\"\"\"docstring\"\"\"\n", "aux_dict = dict()\n", "self.cursor.execute('SELECT * FROM {0}'.format(table))\n", "json_data = {}\n", "for user in self.cursor:\n", "json_data[str(user[3])] = {}\n", "return json.dumps(json_data)\n", "json_data[str(user[3])]['nome'] = user[0]\n", "json_data[str(user[3])]['sobrenome'] = user[1]\n", "json_data[str(user[3])]['endereco'] = user[2]\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_14():...\n", "populate_test_database()\n", "FUNC_1('first playlist')\n", "VAR_11 = VAR_3.delete('/playlists/2')\n", "assert VAR_11.json['status'] == 'NOK'\n", "assert VAR_11.json['message'] != None\n" ]
[ "def test_should_return_a_not_ok_status_when_deleting_an_unknown_playlist_id():...\n", "populate_test_database()\n", "create_playlist('first playlist')\n", "response = test_app.delete('/playlists/2')\n", "assert response.json['status'] == 'NOK'\n", "assert response.json['message'] != None\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "Assert'", "Assert'" ]
[ "def FUNC_6(self, VAR_64):...\n", "VAR_90 = VAR_64.split(',')\n", "return Thing._by_fullname(VAR_90, data=True, return_dict=False)\n" ]
[ "def run(self, id_str):...\n", "tids = id_str.split(',')\n", "return Thing._by_fullname(tids, data=True, return_dict=False)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_0(self, *VAR_1, **VAR_2):...\n", "for instructor in Instructor.objects.all():\n", "VAR_5 = Course.objects.get(id=settings.ONBOARDING_INTRODUCTION_COURSE_ID)\n", "print('Onboarding course is not provided')\n", "VAR_3 = Chat.objects.filter(user=instructor.user,\n enroll_code__courseUnit__course=course, progress__gte=70).exists()\n", "return\n", "if VAR_3:\n", "update_onboarding_step(onboarding.STEP_2, instructor.user_id)\n", "if Course.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_3, instructor.user_id)\n", "if Unit.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_4, instructor.user_id)\n", "if Lesson.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_5, instructor.user_id)\n", "if Invite.objects.filter(instructor=instructor).exists():\n", "update_onboarding_step(onboarding.STEP_8, instructor.user_id)\n", "VAR_4 = EnrollUnitCode.objects.filter(courseUnit__course__addedBy=\n instructor.user, isPreview=True, isLive=False, isTest=False).exists()\n", "if VAR_4:\n", "update_onboarding_step(onboarding.STEP_6, instructor.user_id)\n", "print('Instructor {} passed onboarding at {}%'.format(instructor.user.\n username, get_onboarding_percentage(instructor.user.id)))\n" ]
[ "def handle(self, *args, **options):...\n", "for instructor in Instructor.objects.all():\n", "course = Course.objects.get(id=settings.ONBOARDING_INTRODUCTION_COURSE_ID)\n", "print('Onboarding course is not provided')\n", "chat_exists = Chat.objects.filter(user=instructor.user,\n enroll_code__courseUnit__course=course, progress__gte=70).exists()\n", "return\n", "if chat_exists:\n", "update_onboarding_step(onboarding.STEP_2, instructor.user_id)\n", "if Course.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_3, instructor.user_id)\n", "if Unit.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_4, instructor.user_id)\n", "if Lesson.objects.filter(addedBy=instructor.user).exists():\n", "update_onboarding_step(onboarding.STEP_5, instructor.user_id)\n", "if Invite.objects.filter(instructor=instructor).exists():\n", "update_onboarding_step(onboarding.STEP_8, instructor.user_id)\n", "enroll_unit_code_exists = EnrollUnitCode.objects.filter(\n courseUnit__course__addedBy=instructor.user, isPreview=True, isLive=\n False, isTest=False).exists()\n", "if enroll_unit_code_exists:\n", "update_onboarding_step(onboarding.STEP_6, instructor.user_id)\n", "print('Instructor {} passed onboarding at {}%'.format(instructor.user.\n username, get_onboarding_percentage(instructor.user.id)))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 6, 6, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Assign'", "Expr'", "Assign'", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_16, VAR_17):...\n", "if not (VAR_16, VAR_17) in self.wz.req_handlers:\n", "self.log.debug('Route %s,%s was not bound', VAR_16, VAR_17)\n", "self.log.debug('Unbinding route %s,%s', VAR_16, VAR_17)\n", "return\n", "self.wz.del_req_handler(VAR_16, VAR_17)\n", "def FUNC_23(VAR_33, VAR_13, VAR_20, VAR_21, VAR_12):...\n", "if VAR_21 == wzrpc.status.success:\n", "self.log.debug('Route unbinded for (%s, %s)', VAR_16, VAR_17)\n", "self.log.warn('Status %s, passing', wzrpc.name_status(VAR_21))\n", "return self.wz_wait_reply(FUNC_23, *self.wz.make_auth_unbind_route_data(\n VAR_16, VAR_17, wzauth_data.bind_route[VAR_16, VAR_17]))\n" ]
[ "def unbind_route(self, i, m):...\n", "if not (i, m) in self.wz.req_handlers:\n", "self.log.debug('Route %s,%s was not bound', i, m)\n", "self.log.debug('Unbinding route %s,%s', i, m)\n", "return\n", "self.wz.del_req_handler(i, m)\n", "def accept(that, reqid, seqnum, status, data):...\n", "if status == wzrpc.status.success:\n", "self.log.debug('Route unbinded for (%s, %s)', i, m)\n", "self.log.warn('Status %s, passing', wzrpc.name_status(status))\n", "return self.wz_wait_reply(accept, *self.wz.make_auth_unbind_route_data(i, m,\n wzauth_data.bind_route[i, m]))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'", "Return'", "Expr'", "FunctionDef'", "Condition", "Expr'", "Expr'", "Return'" ]
[ "def __str__(self):...\n", "return os.path.basename(self.path)\n" ]
[ "def __str__(self):...\n", "return os.path.basename(self.path)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_9(self):...\n", "VAR_4 = '/api/apps'\n", "VAR_5 = self.client.post(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_6 = VAR_5.data['id']\n", "VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n", "VAR_8 = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'web': 1}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 204)\n", "VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertEqual(len(VAR_5.data['results']), 1)\n", "VAR_10 = VAR_5.data['results'][0]['uuid']\n", "VAR_11 = Container.objects.get(VAR_10=uuid)\n", "self.assertNotIn('{c_type}', VAR_11._command)\n" ]
[ "def test_container_command_format(self):...\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "url = '/api/apps/{app_id}/builds'.format(**locals())\n", "body = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'web': 1}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 204)\n", "url = '/api/apps/{app_id}/containers'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 1)\n", "uuid = response.data['results'][0]['uuid']\n", "container = Container.objects.get(uuid=uuid)\n", "self.assertNotIn('{c_type}', container._command)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_2(self):...\n", "" ]
[ "def tearDown(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_9(VAR_8, VAR_11, VAR_12=False, VAR_13=False, VAR_14=None, VAR_15=False...\n", "def FUNC_35(VAR_29):...\n", "VAR_40 = VAR_29.group('name')\n", "VAR_16 = VAR_11[VAR_40]\n", "if VAR_15:\n", "return re.sub(VAR_5, FUNC_35, VAR_8)\n", "if VAR_13 and VAR_16 == VAR_14:\n", "return '{{{}}}'.format(VAR_40)\n", "if VAR_12:\n", "return str(VAR_16)\n", "return VAR_14\n" ]
[ "def apply_wildcards(pattern, wildcards, fill_missing=False, fail_dynamic=...\n", "def format_match(match):...\n", "name = match.group('name')\n", "value = wildcards[name]\n", "if keep_dynamic:\n", "return re.sub(_wildcard_regex, format_match, pattern)\n", "if fail_dynamic and value == dynamic_fill:\n", "return '{{{}}}'.format(name)\n", "if fill_missing:\n", "return str(value)\n", "return dynamic_fill\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "FunctionDef'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_20(self, VAR_17, VAR_16):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def create_export(self, context, volume):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "@rest_utils.ajax()...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = api.nova.keypair_list(VAR_1)\n", "return {'items': [u.to_dict() for u in VAR_10]}\n" ]
[ "@rest_utils.ajax()...\n", "\"\"\"docstring\"\"\"\n", "result = api.nova.keypair_list(request)\n", "return {'items': [u.to_dict() for u in result]}\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_9(self, VAR_10=True):...\n", "return self.aq_parent.breadcrumbs_obj_path(VAR_10)\n" ]
[ "def breadcrumbs_obj_path(self, portalMaster=True):...\n", "return self.aq_parent.breadcrumbs_obj_path(portalMaster)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_10(VAR_16):...\n", "return isinstance(VAR_16, str) or not isinstance(VAR_16, Iterable)\n" ]
[ "def not_iterable(value):...\n", "return isinstance(value, str) or not isinstance(value, Iterable)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@bot.message_handler(content_types=['text'])...\n", "VAR_12 = users.find_one(VAR_1).language\n", "VAR_7 = users.find_one(VAR_1)\n", "if VAR_1.text == 'Русский/English':\n", "VAR_37 = users.find_one(VAR_1).switch_language()\n", "if VAR_1.text == messages[VAR_12]['top_cams']:\n", "if VAR_12 != VAR_37:\n", "log.info('User %s asked for top cams', VAR_7)\n", "if VAR_1.text == messages[VAR_12]['top_lens']:\n", "bot.send_message(VAR_7.chat_id, messages[VAR_37]['switch_lang_success'])\n", "bot.send_message(VAR_7.chat_id, messages[VAR_37]['switch_lang_failure'])\n", "bot.send_message(VAR_7.chat_id, text=get_most_popular_items('camera_name',\n message))\n", "log.info('User %s asked for top lens', VAR_7)\n", "if VAR_1.text == messages[VAR_12]['top_countries']:\n", "FUNC_1(VAR_1)\n", "FUNC_1(VAR_1)\n", "log.info('List of most popular cameras has been returned to %s', VAR_7)\n", "bot.send_message(VAR_7.chat_id, text=get_most_popular_items('lens_name',\n message))\n", "log.info('User %s asked for top countries', VAR_7)\n", "if VAR_1.text.lower() == 'admin' and VAR_7.chat_id == int(config.MY_TELEGRAM):\n", "users.compare_and_update(VAR_7, VAR_1)\n", "log.info('List of most popular lens has been returned to %s', VAR_7)\n", "VAR_53 = 'country_ru' if VAR_12 == 'ru-RU' else 'country_en'\n", "VAR_54 = types.InlineKeyboardMarkup()\n", "log.info('%s sent text message.', VAR_7)\n", "bot.send_message(VAR_7.chat_id, text=get_most_popular_items(lang_table_name,\n message))\n", "VAR_55 = types.InlineKeyboardButton\n", "bot.send_message(VAR_7.chat_id, messages[VAR_12]['dont_speak'])\n", "log.info('List of most popular countries has been returned to %s', VAR_7)\n", "VAR_54.add(VAR_55(text='Turn bot off', callback_data='off'))\n", "VAR_54.add(VAR_55(text='Last active users', callback_data='last active'))\n", "VAR_54.add(VAR_55(text='Total number of photos were sent', callback_data=\n 'total number photos sent'))\n", "VAR_54.add(VAR_55(text='Number of photos today', callback_data='photos today'))\n", "VAR_54.add(VAR_55(text='Number of users', callback_data='number of users'))\n", "VAR_54.add(VAR_55(text='Number of gadgets', callback_data='number of gadgets'))\n", "VAR_54.add(VAR_55(text='Uptime', callback_data='uptime'))\n", "bot.send_message(config.MY_TELEGRAM, 'Admin commands', reply_markup=keyboard)\n" ]
[ "@bot.message_handler(content_types=['text'])...\n", "current_user_lang = users.find_one(message).language\n", "user = users.find_one(message)\n", "if message.text == 'Русский/English':\n", "new_lang = users.find_one(message).switch_language()\n", "if message.text == messages[current_user_lang]['top_cams']:\n", "if current_user_lang != new_lang:\n", "log.info('User %s asked for top cams', user)\n", "if message.text == messages[current_user_lang]['top_lens']:\n", "bot.send_message(user.chat_id, messages[new_lang]['switch_lang_success'])\n", "bot.send_message(user.chat_id, messages[new_lang]['switch_lang_failure'])\n", "bot.send_message(user.chat_id, text=get_most_popular_items('camera_name',\n message))\n", "log.info('User %s asked for top lens', user)\n", "if message.text == messages[current_user_lang]['top_countries']:\n", "create_main_keyboard(message)\n", "create_main_keyboard(message)\n", "log.info('List of most popular cameras has been returned to %s', user)\n", "bot.send_message(user.chat_id, text=get_most_popular_items('lens_name',\n message))\n", "log.info('User %s asked for top countries', user)\n", "if message.text.lower() == 'admin' and user.chat_id == int(config.MY_TELEGRAM):\n", "users.compare_and_update(user, message)\n", "log.info('List of most popular lens has been returned to %s', user)\n", "lang_table_name = ('country_ru' if current_user_lang == 'ru-RU' else\n 'country_en')\n", "keyboard = types.InlineKeyboardMarkup()\n", "log.info('%s sent text message.', user)\n", "bot.send_message(user.chat_id, text=get_most_popular_items(lang_table_name,\n message))\n", "button = types.InlineKeyboardButton\n", "bot.send_message(user.chat_id, messages[current_user_lang]['dont_speak'])\n", "log.info('List of most popular countries has been returned to %s', user)\n", "keyboard.add(button(text='Turn bot off', callback_data='off'))\n", "keyboard.add(button(text='Last active users', callback_data='last active'))\n", "keyboard.add(button(text='Total number of photos were sent', callback_data=\n 'total number photos sent'))\n", "keyboard.add(button(text='Number of photos today', callback_data=\n 'photos today'))\n", "keyboard.add(button(text='Number of users', callback_data='number of users'))\n", "keyboard.add(button(text='Number of gadgets', callback_data=\n 'number of gadgets'))\n", "keyboard.add(button(text='Uptime', callback_data='uptime'))\n", "bot.send_message(config.MY_TELEGRAM, 'Admin commands', reply_markup=keyboard)\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 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(self, VAR_0, VAR_1, VAR_2, VAR_3=None, VAR_4=None, VAR_5=None):...\n", "VAR_8 = self.create_select(VAR_0) + ' '\n", "VAR_8 += self.create_from(VAR_1) + ' '\n", "VAR_8 += self.create_where(VAR_2)\n", "if VAR_3:\n", "VAR_8 += ' ' + self.create_sort_by(VAR_3)\n", "if VAR_4 and VAR_5:\n", "VAR_8 += ' ' + self.create_offset(VAR_4, VAR_5)\n", "return VAR_8\n" ]
[ "def get_sql(self, select, table, where, sort_by=None, offset=None, limit=None):...\n", "sql = self.create_select(select) + ' '\n", "sql += self.create_from(table) + ' '\n", "sql += self.create_where(where)\n", "if sort_by:\n", "sql += ' ' + self.create_sort_by(sort_by)\n", "if offset and limit:\n", "sql += ' ' + self.create_offset(offset, limit)\n", "return sql\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0, 4 ]
[ "FunctionDef'", "Assign'", "AugAssign'", "AugAssign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Return'" ]
[ "def FUNC_21(self):...\n", "if not self._IsServerAlive():\n", "return\n", "SendEventNotificationAsync('CurrentIdentifierFinished')\n" ]
[ "def OnCurrentIdentifierFinished(self):...\n", "if not self._IsServerAlive():\n", "return\n", "SendEventNotificationAsync('CurrentIdentifierFinished')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Expr'" ]
[ "def FUNC_2(VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = 2.55 + 1\n", "VAR_15 = float(len(VAR_4)) / VAR_14\n", "VAR_16 = [word for word in re.split('\\\\W', VAR_4) if word.isalpha()]\n", "VAR_17 = len(VAR_16)\n", "return VAR_17 > VAR_15\n" ]
[ "def _is_english_text(text):...\n", "\"\"\"docstring\"\"\"\n", "avg_word_length = 2.55 + 1\n", "expected_word_number = float(len(text)) / avg_word_length\n", "words = [word for word in re.split('\\\\W', text) if word.isalpha()]\n", "word_number = len(words)\n", "return word_number > expected_word_number\n" ]
[ 0, 0, 7, 7, 7, 7, 7 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def __str__(self):...\n", "return self.get_name()\n" ]
[ "def __str__(self):...\n", "return self.get_name()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_12(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = (\n '--with-xunit --xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --verbosity=2'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else ''))\n", "VAR_7 = BokChoyTestSuite('', num_processes=1)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(VAR_7), VAR_10)\n" ]
[ "def test_verbosity_settings_1_process(self):...\n", "\"\"\"docstring\"\"\"\n", "expected_verbosity_string = (\n '--with-xunit --xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --verbosity=2'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else ''))\n", "suite = BokChoyTestSuite('', num_processes=1)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),\n expected_verbosity_string)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_64):...\n", "self.func = VAR_64\n", "self.shellcmd = None\n", "self.norun = False\n", "self.input = None\n", "self.output = None\n", "self.params = None\n", "self.message = None\n", "self.benchmark = None\n", "self.threads = None\n", "self.resources = None\n", "self.priority = None\n", "self.version = None\n", "self.log = None\n", "self.docstring = None\n" ]
[ "def __init__(self, func):...\n", "self.func = func\n", "self.shellcmd = None\n", "self.norun = False\n", "self.input = None\n", "self.output = None\n", "self.params = None\n", "self.message = None\n", "self.benchmark = None\n", "self.threads = None\n", "self.resources = None\n", "self.priority = None\n", "self.version = None\n", "self.log = None\n", "self.docstring = None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Docstring" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = None\n", "if self.main and self.main.projects:\n", "VAR_12 = self.main.projects.get_active_project_path()\n", "if not VAR_12:\n", "VAR_12 = getcwd_or_home()\n", "return VAR_12\n" ]
[ "def get_root_path(self):...\n", "\"\"\"docstring\"\"\"\n", "path = None\n", "if self.main and self.main.projects:\n", "path = self.main.projects.get_active_project_path()\n", "if not path:\n", "path = getcwd_or_home()\n", "return path\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_4(VAR_11):...\n", "VAR_17 = []\n", "for r in VAR_11:\n", "VAR_18 = {'value': r[0], 'description': ', '.join(unique(cstr(d) for d in r if\n d)[1:])}\n", "return VAR_17\n", "VAR_17.append(VAR_18)\n" ]
[ "def build_for_autosuggest(res):...\n", "results = []\n", "for r in res:\n", "out = {'value': r[0], 'description': ', '.join(unique(cstr(d) for d in r if\n d)[1:])}\n", "return results\n", "results.append(out)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "Expr'" ]
[ "@VAR_0.route('/add', methods=['POST'])...\n", "return render_template('show_entries.html')\n" ]
[ "@app.route('/add', methods=['POST'])...\n", "return render_template('show_entries.html')\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@session_manager...\n", "\"\"\"docstring\"\"\"\n", "from invenio.modules.accounts.models import User, UserEXT\n", "from invenio.ext.sqlalchemy import db\n", "from ..handlers import token_session_key\n", "from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound\n", "import json\n", "import requests\n", "VAR_6 = session.get(token_session_key(VAR_2.name) + '_account_info').get(\n 'external_id')\n", "VAR_7 = {'orcid': VAR_6}\n", "VAR_4.remote_account.extra_data = VAR_7\n", "VAR_8 = User.query.join(UserEXT).filter_by(id=orcid, method='orcid').one()\n", "current_app.logger.exception('No user entry in userEXT.')\n", "if VAR_8 and not any([VAR_8.given_names, VAR_8.family_name]):\n", "VAR_9 = 'http://orcid.org/{0}/orcid-bio'.format(VAR_6)\n", "VAR_10 = {'Accept': 'application/orcid+json'}\n", "VAR_11 = requests.get(VAR_9, VAR_10=headers)\n", "VAR_12 = VAR_11.status_code\n", "if VAR_12 == requests.codes.ok:\n", "VAR_13 = json.loads(VAR_11.content)\n", "current_app.logger.exception('Not valid JSON response from ' +\n 'ORCID:\\n {0}'.format(repr(VAR_13)))\n", "VAR_14 = VAR_13['orcid-profile']['orcid-bio']['personal-details']\n", "current_app.logger.exception('Unexpected return format ' +\n 'from ORCID:\\n {0}'.format(repr(VAR_13)))\n", "db.session.add(VAR_8)\n", "return\n", "VAR_8.given_names = VAR_14['given-names']['value']\n", "return\n", "current_user.reload()\n", "VAR_8.family_name = VAR_14['family-name']['value']\n" ]
[ "@session_manager...\n", "\"\"\"docstring\"\"\"\n", "from invenio.modules.accounts.models import User, UserEXT\n", "from invenio.ext.sqlalchemy import db\n", "from ..handlers import token_session_key\n", "from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound\n", "import json\n", "import requests\n", "orcid = session.get(token_session_key(remote.name) + '_account_info').get(\n 'external_id')\n", "extra_data = {'orcid': orcid}\n", "token.remote_account.extra_data = extra_data\n", "user = User.query.join(UserEXT).filter_by(id=orcid, method='orcid').one()\n", "current_app.logger.exception('No user entry in userEXT.')\n", "if user and not any([user.given_names, user.family_name]):\n", "request_url = 'http://orcid.org/{0}/orcid-bio'.format(orcid)\n", "headers = {'Accept': 'application/orcid+json'}\n", "response = requests.get(request_url, headers=headers)\n", "code = response.status_code\n", "if code == requests.codes.ok:\n", "orcid_bio = json.loads(response.content)\n", "current_app.logger.exception('Not valid JSON response from ' +\n 'ORCID:\\n {0}'.format(repr(orcid_bio)))\n", "name = orcid_bio['orcid-profile']['orcid-bio']['personal-details']\n", "current_app.logger.exception('Unexpected return format ' +\n 'from ORCID:\\n {0}'.format(repr(orcid_bio)))\n", "db.session.add(user)\n", "return\n", "user.given_names = name['given-names']['value']\n", "return\n", "current_user.reload()\n", "user.family_name = name['family-name']['value']\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 ]
[ "Condition", "Docstring", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'", "Assign'", "Return'", "Expr'", "Assign'" ]
[ "def FUNC_23(self, VAR_26, VAR_7, VAR_27, VAR_28, VAR_25):...\n", "\"\"\"docstring\"\"\"\n", "if __debug__:\n", "self.__log_traverse_one(VAR_26, VAR_7, VAR_27, VAR_28)\n", "self.__traversed.add((VAR_27, VAR_28))\n", "VAR_40 = VAR_27 or VAR_28\n", "if VAR_40.do_traverse():\n", "VAR_48 = RELATION_OPERATIONS.check(VAR_27, VAR_28)\n", "VAR_25.visit(VAR_26, VAR_7, VAR_27, VAR_28)\n", "for attr in VAR_40.get_relationship_attributes():\n", "if not bool(attr.cascade & VAR_48):\n", "if not VAR_27 is None:\n", "VAR_59 = VAR_27.get_attribute_proxy(attr)\n", "VAR_59 = None\n", "if not VAR_28 is None:\n", "VAR_60 = VAR_28.get_attribute_proxy(attr)\n", "VAR_60 = None\n", "VAR_56 = RELATION_OPERATIONS.check(VAR_59, VAR_60)\n", "if VAR_56 == RELATION_OPERATIONS.ADD:\n", "if VAR_48 == RELATION_OPERATIONS.ADD:\n", "if VAR_56 == RELATION_OPERATIONS.REMOVE:\n", "VAR_50 = VAR_27\n", "VAR_50 = VAR_28\n", "VAR_50 = VAR_28\n", "VAR_50 = VAR_28\n", "VAR_57 = get_attribute_cardinality(attr)\n", "if VAR_57 == CARDINALITY_CONSTANTS.ONE:\n", "if VAR_59 is None and VAR_60 is None:\n", "VAR_62 = VAR_59\n", "VAR_61 = VAR_59, VAR_60\n", "VAR_63 = VAR_60\n", "if VAR_61 in self.__traversed:\n", "VAR_26.push(VAR_50, attr, VAR_48)\n", "if VAR_56 == RELATION_OPERATIONS.ADD:\n", "self.traverse_many(VAR_26.clone(), attr, VAR_62, VAR_63, VAR_25)\n", "VAR_62 = [VAR_59]\n", "if VAR_56 == RELATION_OPERATIONS.REMOVE:\n", "VAR_26.pop()\n", "VAR_63 = None\n", "VAR_62 = None\n", "VAR_62 = [VAR_59]\n", "VAR_63 = [VAR_60]\n", "VAR_63 = [VAR_60]\n", "VAR_66 = VAR_59.get_id()\n", "VAR_67 = VAR_60.get_id()\n", "if VAR_66 != VAR_67:\n", "VAR_68 = VAR_60.get_matching(VAR_66)\n", "if not VAR_68 is None:\n", "VAR_63.append(VAR_68)\n" ]
[ "def traverse_one(self, path, attribute, source, target, visitor):...\n", "\"\"\"docstring\"\"\"\n", "if __debug__:\n", "self.__log_traverse_one(path, attribute, source, target)\n", "self.__traversed.add((source, target))\n", "prx = source or target\n", "if prx.do_traverse():\n", "rel_op = RELATION_OPERATIONS.check(source, target)\n", "visitor.visit(path, attribute, source, target)\n", "for attr in prx.get_relationship_attributes():\n", "if not bool(attr.cascade & rel_op):\n", "if not source is None:\n", "attr_source = source.get_attribute_proxy(attr)\n", "attr_source = None\n", "if not target is None:\n", "attr_target = target.get_attribute_proxy(attr)\n", "attr_target = None\n", "attr_rel_op = RELATION_OPERATIONS.check(attr_source, attr_target)\n", "if attr_rel_op == RELATION_OPERATIONS.ADD:\n", "if rel_op == RELATION_OPERATIONS.ADD:\n", "if attr_rel_op == RELATION_OPERATIONS.REMOVE:\n", "parent = source\n", "parent = target\n", "parent = target\n", "parent = target\n", "card = get_attribute_cardinality(attr)\n", "if card == CARDINALITY_CONSTANTS.ONE:\n", "if attr_source is None and attr_target is None:\n", "src_items = attr_source\n", "key = attr_source, attr_target\n", "tgt_items = attr_target\n", "if key in self.__traversed:\n", "path.push(parent, attr, rel_op)\n", "if attr_rel_op == RELATION_OPERATIONS.ADD:\n", "self.traverse_many(path.clone(), attr, src_items, tgt_items, visitor)\n", "src_items = [attr_source]\n", "if attr_rel_op == RELATION_OPERATIONS.REMOVE:\n", "path.pop()\n", "tgt_items = None\n", "src_items = None\n", "src_items = [attr_source]\n", "tgt_items = [attr_target]\n", "tgt_items = [attr_target]\n", "src_id = attr_source.get_id()\n", "tgt_id = attr_target.get_id()\n", "if src_id != tgt_id:\n", "src_target = attr_target.get_matching(src_id)\n", "if not src_target is None:\n", "tgt_items.append(src_target)\n" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Expr'", "For", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_48(self):...\n", "self.cursor.execute('create table t1(id int)')\n", "for i in range(1, 5):\n", "self.cursor.execute('insert into t1 values(?)', i)\n", "self.cursor.execute('select id from t1 order by id')\n", "self.assertEqual(self.cursor.fetchone()[0], 1)\n", "self.cursor.skip(2)\n", "self.assertEqual(self.cursor.fetchone()[0], 4)\n" ]
[ "def test_skip(self):...\n", "self.cursor.execute('create table t1(id int)')\n", "for i in range(1, 5):\n", "self.cursor.execute('insert into t1 values(?)', i)\n", "self.cursor.execute('select id from t1 order by id')\n", "self.assertEqual(self.cursor.fetchone()[0], 1)\n", "self.cursor.skip(2)\n", "self.assertEqual(self.cursor.fetchone()[0], 4)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "For", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_7(self):...\n", "VAR_4 = Lint.executable\n", "VAR_5 = 'invalid_binary_which_doesnt_exist'\n", "Lint.executable = VAR_5\n", "self.assertEqual(Lint.check_prerequisites(), \"'{}' is not installed.\".\n format(VAR_5))\n", "Lint.executable = 'echo'\n", "self.assertTrue(Lint.check_prerequisites())\n", "self.assertTrue(Lint.check_prerequisites())\n", "Lint.executable = VAR_4\n" ]
[ "def test_missing_binary(self):...\n", "old_binary = Lint.executable\n", "invalid_binary = 'invalid_binary_which_doesnt_exist'\n", "Lint.executable = invalid_binary\n", "self.assertEqual(Lint.check_prerequisites(), \"'{}' is not installed.\".\n format(invalid_binary))\n", "Lint.executable = 'echo'\n", "self.assertTrue(Lint.check_prerequisites())\n", "self.assertTrue(Lint.check_prerequisites())\n", "Lint.executable = old_binary\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'" ]
[ "def FUNC_10(VAR_15):...\n", "VAR_36 = Thread(target=self.sendRandomPic, args=(chat_id, MMKM))\n", "self.pic_sender_threads[VAR_15] = VAR_36\n", "VAR_36.start()\n" ]
[ "def startThread(chat_id):...\n", "t = Thread(target=self.sendRandomPic, args=(chat_id, MMKM))\n", "self.pic_sender_threads[chat_id] = t\n", "t.start()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_15(self, VAR_24):...\n", "for toc_node in VAR_24.findall(\".//*[@class='toc']\"):\n", "VAR_32 = toc_node[0]\n", "if self.has_a_single_h1:\n", "VAR_34 = VAR_32[0]\n", "VAR_35 = VAR_32\n", "VAR_35 = VAR_34[1]\n", "toc_node.remove(VAR_32)\n", "VAR_28 = ElementTree.SubElement(toc_node, 'h2')\n", "VAR_28.text = 'Contents'\n", "VAR_28.tail = '\\n'\n", "VAR_33 = ElementTree.SubElement(toc_node, 'div', {'class': 'toc-aux'})\n", "VAR_33.text = '\\n'\n", "VAR_33.append(VAR_35)\n", "VAR_33.tail = '\\n'\n" ]
[ "def run(self, tree):...\n", "for toc_node in tree.findall(\".//*[@class='toc']\"):\n", "toc_ul = toc_node[0]\n", "if self.has_a_single_h1:\n", "toc_ul_li = toc_ul[0]\n", "ul_with_the_desired_toc_entries = toc_ul\n", "ul_with_the_desired_toc_entries = toc_ul_li[1]\n", "toc_node.remove(toc_ul)\n", "contents = ElementTree.SubElement(toc_node, 'h2')\n", "contents.text = 'Contents'\n", "contents.tail = '\\n'\n", "toc_aux = ElementTree.SubElement(toc_node, 'div', {'class': 'toc-aux'})\n", "toc_aux.text = '\\n'\n", "toc_aux.append(ul_with_the_desired_toc_entries)\n", "toc_aux.tail = '\\n'\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_21(VAR_6):...\n", "return FUNC_7(VAR_6, 'X-Permitted-Cross-Domain-Policies', 'master-only')\n" ]
[ "def validate_cross_domain_policy(page):...\n", "return validate_security_header(page, 'X-Permitted-Cross-Domain-Policies',\n 'master-only')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self, VAR_5):...\n", "self.cursor.execute(self.SQL_INSERT_JSON % (self.name, json.dumps(VAR_5)))\n", "return self.cursor.fetchone()[0]\n" ]
[ "def put(self, data):...\n", "self.cursor.execute(self.SQL_INSERT_JSON % (self.name, json.dumps(data)))\n", "return self.cursor.fetchone()[0]\n" ]
[ 0, 4, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return os.path.join(os.path.dirname(VAR_0), 'swarming_bot.zip')\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return os.path.join(os.path.dirname(THIS_FILE), 'swarming_bot.zip')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "@api.require(lambda : False)...\n", "VAR_6.fail('Handler code should not be called')\n" ]
[ "@api.require(lambda : False)...\n", "test.fail('Handler code should not be called')\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_26(VAR_17):...\n", "\"\"\"docstring\"\"\"\n", "VAR_68 = len(VAR_17)\n", "VAR_69 = lambda x: int(float(x) / 100 * VAR_68)\n", "VAR_70 = [VAR_17[VAR_69(start):VAR_69(end)] for start, end in bconfig.\n CFG_BIBCLASSIFY_PARTIAL_TEXT]\n", "return '\\n'.join(VAR_70)\n" ]
[ "def _get_partial_text(fulltext):...\n", "\"\"\"docstring\"\"\"\n", "length = len(fulltext)\n", "get_index = lambda x: int(float(x) / 100 * length)\n", "partial_text = [fulltext[get_index(start):get_index(end)] for start, end in\n bconfig.CFG_BIBCLASSIFY_PARTIAL_TEXT]\n", "return '\\n'.join(partial_text)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@app.route('/players/<int:player_id>/achievements')...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "VAR_11.execute('string' % VAR_2)\n", "return flask.jsonify(items=cursor.fetchall())\n" ]
[ "@app.route('/players/<int:player_id>/achievements')...\n", "\"\"\"docstring\"\"\"\n", "cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "cursor.execute(\n \"\"\"SELECT\n achievement_id,\n current_steps,\n state,\n UNIX_TIMESTAMP(create_time) as create_time,\n UNIX_TIMESTAMP(update_time) as update_time\n FROM player_achievements\n WHERE player_id = '%s'\"\"\"\n % player_id)\n", "return flask.jsonify(items=cursor.fetchall())\n" ]
[ 0, 0, 0, 4, 0 ]
[ "Condition", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_13(self, VAR_17, VAR_18, VAR_19):...\n", "if VAR_18 == 'CP':\n", "VAR_28 = self.command(' '.join(['arm', 'mrc', str(self.targets[VAR_18][\n 'registers'][VAR_17]['CP']), str(self.targets[VAR_18]['registers'][\n VAR_17]['Op1']), str(self.targets[VAR_18]['registers'][VAR_17]['CRn']),\n str(self.targets[VAR_18]['registers'][VAR_17]['CRm']), str(self.targets\n [VAR_18]['registers'][VAR_17]['Op2'])]), VAR_11=\n 'Error getting register value')\n", "VAR_28 = self.command('reg ' + VAR_17, [':'], 'Error getting register value')\n", "return hex(int(VAR_28.split('\\n')[1].strip()))\n", "return VAR_28.split('\\n')[1].split(':')[1].split()[0]\n" ]
[ "def get_register_value(self, register, target, target_index):...\n", "if target == 'CP':\n", "buff = self.command(' '.join(['arm', 'mrc', str(self.targets[target][\n 'registers'][register]['CP']), str(self.targets[target]['registers'][\n register]['Op1']), str(self.targets[target]['registers'][register][\n 'CRn']), str(self.targets[target]['registers'][register]['CRm']), str(\n self.targets[target]['registers'][register]['Op2'])]), error_message=\n 'Error getting register value')\n", "buff = self.command('reg ' + register, [':'], 'Error getting register value')\n", "return hex(int(buff.split('\\n')[1].strip()))\n", "return buff.split('\\n')[1].split(':')[1].split()[0]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'", "Return'" ]
[ "def FUNC_2(self):...\n", "self.assertTrue({'name': 'DocType', 'issingle': 0} in DatabaseQuery(\n 'DocType').execute(fields=['name', 'issingle'], limit_page_length=None))\n" ]
[ "def test_fields(self):...\n", "self.assertTrue({'name': 'DocType', 'issingle': 0} in DatabaseQuery(\n 'DocType').execute(fields=['name', 'issingle'], limit_page_length=None))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_29():...\n", "self.assertIn('reauthn-for-termination', VAR_32)\n", "VAR_29 = VAR_32['reauthn-for-termination']\n", "VAR_30 = int(time.time())\n", "self.assertTrue(VAR_30 - VAR_29 < 5)\n" ]
[ "def _check():...\n", "self.assertIn('reauthn-for-termination', session)\n", "then = session['reauthn-for-termination']\n", "now = int(time.time())\n", "self.assertTrue(now - then < 5)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_4(self):...\n", "if self.redirected_to is None:\n", "return None\n", "VAR_14 = self.redirected_to.split('?')\n", "if len(VAR_14) != 2:\n", "VAR_0.warning(\"Redirected to an unexpected page: `%s'\", self.redirected_to)\n", "VAR_20 = decrypt_number(VAR_14[-1])\n", "VAR_0.warning(\"Unable to decrypt submission id from page: `%s'\", self.\n redirected_to)\n", "return VAR_20\n", "return None\n", "return None\n" ]
[ "def get_submission_id(self):...\n", "if self.redirected_to is None:\n", "return None\n", "p = self.redirected_to.split('?')\n", "if len(p) != 2:\n", "logger.warning(\"Redirected to an unexpected page: `%s'\", self.redirected_to)\n", "submission_id = decrypt_number(p[-1])\n", "logger.warning(\"Unable to decrypt submission id from page: `%s'\", self.\n redirected_to)\n", "return submission_id\n", "return None\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Return'", "Return'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "import sqlite3\n", "VAR_0 = '/srv/data/msd/lastfm/SQLITE/lastfm_tags.db'\n", "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_0 = VAR_1\n", "\"\"\"string\"\"\"\n", "def __init__(self, VAR_0):...\n", "self.conn = sqlite3.connect(VAR_0)\n", "self.c = self.conn.cursor()\n", "def __del__(self):...\n", "self.conn.close()\n", "def FUNC_1(self, VAR_2):...\n", "return self.c.execute(VAR_2)\n" ]
[ "\"\"\" Contains simple tools for querying the lastfm_tags.db file\n\n\nNotes\n-----\nThe lastfm database contains 3 tables: tids, tags, tid_tag.\n- tids, 1-column table containing the track ids.\n- tid_tags, contains 3 columns:\n - tid: rowid of the track id in the tids table.\n - tag: rowid of the tag that belongs to the tid in the same row.\n - val: number between 0 and 100 (guessing this is how accurate the tag is?)\n- tags, 1-column table containing the tags.\n\nIMPORTANT: If using this script elsewhere than on Boden then run set_path(new_path) to\nset the path of the database. Otherwise it will use the default path, which is the path\nto the database on Boden.\n\nFunctions\n---------\n- set_path\n Set path to the lastfm_tags.db.\n\"\"\"\n", "import sqlite3\n", "path = '/srv/data/msd/lastfm/SQLITE/lastfm_tags.db'\n", "def set_path(new_path):...\n", "\"\"\"docstring\"\"\"\n", "path = new_path\n", "\"\"\" Opens a SQLite connection to the last.fm database. Provides methods to perform advanced queries on it.\n\n Methods\n -------\n - tid_to_tid_nums\n Get tid_num given tid.\n\n - tid_num_to_tid\n Get tid given tid_num.\n\n - tid_num_to_tag_nums\n Get tag_num given tid_num.\n\n - tag_num_to_tag\n Get tag given tag_num.\n\n - tag_to_tag_num\n Get tag_num given tag.\n\n - get_tags\n Get a list of tags associated to given tid.\n\n - get_tags_dict\n Get a dict with tids as keys and a list of its tags as value.\n\n - tid_tag_count\n Get a dict with tids as keys and its number of tags as value.\n\n - filter_tags\n Filter list of tids based on minimum number of tags.\n\n - tag_count\n Get a dict with the tags associated to tids as keys and their count number as values.\n \"\"\"\n", "def __init__(self, path):...\n", "self.conn = sqlite3.connect(path)\n", "self.c = self.conn.cursor()\n", "def __del__(self):...\n", "self.conn.close()\n", "def query(self, query):...\n", "return self.c.execute(query)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4 ]
[ "Expr'", "Import'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Return'" ]
[ "@FUNC_0...\n", "VAR_19 = await mazemap.test(VAR_3)\n", "return VAR_19\n" ]
[ "@handle_html...\n", "out = await mazemap.test(request)\n", "return out\n" ]
[ 0, 0, 0 ]
[ "Condition", "Assign'", "Return'" ]
[ "def FUNC_14(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = 3\n", "VAR_10 = 'string'.format(repo_dir=REPO_DIR, shard_str='/shard_' + self.\n shard if self.shard else '', procs=process_count)\n", "VAR_7 = BokChoyTestSuite('', num_processes=process_count)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(VAR_7), VAR_10)\n" ]
[ "def test_verbosity_settings_3_processes(self):...\n", "\"\"\"docstring\"\"\"\n", "process_count = 3\n", "expected_verbosity_string = (\n '--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --processes={procs} --no-color --process-timeout=1200'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else '', procs=process_count))\n", "suite = BokChoyTestSuite('', num_processes=process_count)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),\n expected_verbosity_string)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_1(VAR_5):...\n", "if not VAR_6:\n", "return\n", "VAR_20 = UltiSnips_Manager._snips('', 1)\n", "return\n", "VAR_5['ultisnips_snippets'] = [{'trigger': x.trigger, 'description': x.\n description} for x in VAR_20]\n" ]
[ "def _AddUltiSnipsDataIfNeeded(extra_data):...\n", "if not USE_ULTISNIPS_DATA:\n", "return\n", "rawsnips = UltiSnips_Manager._snips('', 1)\n", "return\n", "extra_data['ultisnips_snippets'] = [{'trigger': x.trigger, 'description': x\n .description} for x in rawsnips]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_11(self):...\n", "VAR_14 = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n", "VAR_18 = {'Content-Type': 'application/json'}\n", "VAR_14.url_list('/connections', VAR_18)\n", "FUNC_1('get', VAR_14, 'https://1.2.3.4/api/v1/ports/connections', VAR_9=\n _headers(**json_headers))\n" ]
[ "def test_client_url_list(self):...\n", "api = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n", "json_headers = {'Content-Type': 'application/json'}\n", "api.url_list('/connections', json_headers)\n", "assert_call('get', api, 'https://1.2.3.4/api/v1/ports/connections', headers\n =_headers(**json_headers))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_9():...\n", "\"\"\"docstring\"\"\"\n", "VAR_35 = False\n", "VAR_18 = sql.connect('./resources/users.db')\n", "VAR_20 = 'DELETE FROM users;'\n", "VAR_21 = VAR_18.cursor()\n", "VAR_21.execute(VAR_20)\n", "VAR_18.commit()\n", "VAR_35 = True\n", "VAR_18.close()\n", "return VAR_35\n" ]
[ "def delete_users():...\n", "\"\"\"docstring\"\"\"\n", "deleted = False\n", "con = sql.connect('./resources/users.db')\n", "cmd = 'DELETE FROM users;'\n", "cur = con.cursor()\n", "cur.execute(cmd)\n", "con.commit()\n", "deleted = True\n", "con.close()\n", "return deleted\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]