lines
listlengths
1
444
raw_lines
listlengths
1
444
label
listlengths
1
444
type
listlengths
1
444
[ "@VAR_0.route('normalize_column', methods=['POST'])...\n", "VAR_1 = get_dataset_with_id(request.args.get('dataset_id'))\n", "VAR_2 = request.form['column']\n", "normalize_attribute(VAR_1.working_copy, VAR_2)\n", "flash('An unexpected error occured while normalizing the column', 'danger')\n", "flash('Colum...
[ "@_transform.route('normalize_column', methods=['POST'])...\n", "dataset = get_dataset_with_id(request.args.get('dataset_id'))\n", "col = request.form['column']\n", "normalize_attribute(dataset.working_copy, col)\n", "flash('An unexpected error occured while normalizing the column', 'danger')\n", "flash('...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_20, VAR_21, *VAR_19, **VAR_5):...\n", "super().__init__(*VAR_19, **kwargs)\n", "self.start = VAR_20\n", "self.end = VAR_21\n" ]
[ "def __init__(self, start, end, *args, **kwargs):...\n", "super().__init__(*args, **kwargs)\n", "self.start = start\n", "self.end = end\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_5(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['like', 'J%']}))\n" ]
[ "def test_filters_3(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['like', 'J%']}))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_6(self, VAR_7=None, VAR_3=None, VAR_4=None, VAR_8=None):...\n", "if VAR_7:\n", "if isinstance(VAR_7, dict):\n", "return self.__dict__\n", "return FUNC_1(self.get_all_children(), VAR_7, VAR_4=limit)\n", "if VAR_3:\n", "if isinstance(VAR_3, dict):\n", "VAR_9 = self.__dict__.get(VAR_7, VAR_8)\n...
[ "def get(self, key=None, filters=None, limit=None, default=None):...\n", "if key:\n", "if isinstance(key, dict):\n", "return self.__dict__\n", "return _filter(self.get_all_children(), key, limit=limit)\n", "if filters:\n", "if isinstance(filters, dict):\n", "value = self.__dict__.get(key, default)\n",...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Return'", "Return'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_0():...\n", "return {'queue': {'name': None, 'type': 'sqs', 'timeout-seconds': 20},\n 'store': {'type': 's3', 'name': None, 'path': 'osm',\n 'reduced-redundancy': False, 'date-prefix': '', 'delete-retry-interval':\n 60}, 'aws': {'credentials': {'aws_access_key_id': None,\n 'aws_secret_access...
[ "def default_yml_config():...\n", "return {'queue': {'name': None, 'type': 'sqs', 'timeout-seconds': 20},\n 'store': {'type': 's3', 'name': None, 'path': 'osm',\n 'reduced-redundancy': False, 'date-prefix': '', 'delete-retry-interval':\n 60}, 'aws': {'credentials': {'aws_access_key_id': None,\n 'aws_s...
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(self, VAR_0, VAR_1):...\n", "VAR_2, VAR_3 = self.fillParams([('attr', None, True), ('doc', None, True)])\n", "VAR_4 = self.db.execute(\n \"\"\"\n\t\t\tselect attr from attributes where attr='%s'\n\t\t\t\"\"\" % VAR_2)\n", "if not VAR_4:\n", "self.db.execute(\"\"\"\n\t\t\tdelete from attribute...
[ "def run(self, params, args):...\n", "attr, doc = self.fillParams([('attr', None, True), ('doc', None, True)])\n", "rows = self.db.execute(\n \"\"\"\n\t\t\tselect attr from attributes where attr='%s'\n\t\t\t\"\"\" % attr)\n", "if not rows:\n", "self.db.execute(\"\"\"\n\t\t\tdelete from attributes_doc whe...
[ 0, 0, 2, 0, 2, 0, 2 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "@VAR_4.cli.command('initdb')...\n", "\"\"\"docstring\"\"\"\n", "FUNC_3()\n", "print('Initialized the database.')\n" ]
[ "@app.cli.command('initdb')...\n", "\"\"\"docstring\"\"\"\n", "init_db()\n", "print('Initialized the database.')\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = ['hp3par_api_url', 'hp3par_username', 'hp3par_password', 'san_ip',\n 'san_login', 'san_password']\n", "self.common.check_flags(self.configuration, VAR_18)\n" ]
[ "def _check_flags(self):...\n", "\"\"\"docstring\"\"\"\n", "required_flags = ['hp3par_api_url', 'hp3par_username', 'hp3par_password',\n 'san_ip', 'san_login', 'san_password']\n", "self.common.check_flags(self.configuration, required_flags)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.client.get('/api/apps', HTTP_X_DEIS_VERSION='1234.5678')\n", "self.assertEqual(VAR_1.status_code, 405)\n" ]
[ "def test_x_deis_version_header_bad(self):...\n", "\"\"\"docstring\"\"\"\n", "response = self.client.get('/api/apps', HTTP_X_DEIS_VERSION='1234.5678')\n", "self.assertEqual(response.status_code, 405)\n" ]
[ 0, 0, 5, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_21(self):...\n", "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ "def test_with_timeout(self):...\n", "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'" ]
[ "def FUNC_0():...\n", "def FUNC_1():...\n", "return FUNC_1\n" ]
[ "def a():...\n", "def b():...\n", "return b\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Return'" ]
[ "def FUNC_2(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_i...
[ "def test_container_state_good(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....
[ 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(self):...\n", "return self.config['runtime.static_dir']\n" ]
[ "def get_base_path(self):...\n", "return self.config['runtime.static_dir']\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_12(self):...\n", "self.run_test_case(self.scenario.delete_server_group(), max_retries=5)\n" ]
[ "def test_x_delete_server_group(self):...\n", "self.run_test_case(self.scenario.delete_server_group(), max_retries=5)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_3(self, VAR_1, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "self.cursor.execute('DELETE FROM {0} WHERE {1}'.format(VAR_1, VAR_3))\n", "print('Erro: {}'.format(error))\n", "self.__connection.commit()\n", "return self.cursor\n" ]
[ "def delete_where(self, table, where):...\n", "\"\"\"docstring\"\"\"\n", "self.cursor.execute('DELETE FROM {0} WHERE {1}'.format(table, where))\n", "print('Erro: {}'.format(error))\n", "self.__connection.commit()\n", "return self.cursor\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_1(VAR_2):...\n", "return HttpResponsePermanentRedirect(reverse('home'))\n" ]
[ "def redirect_to_home(request):...\n", "return HttpResponsePermanentRedirect(reverse('home'))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_18(self, VAR_18, VAR_23):...\n", "\"\"\"docstring\"\"\"\n", "if type(VAR_18) == str:\n", "VAR_18 = self.locate(VAR_18)\n", "if VAR_18.parent:\n", "if not VAR_18:\n", "VAR_18.file_name = VAR_23\n", "if VAR_18.is_dir:\n", "return False\n", "VAR_18.parent.sub_names_idx[VAR_18.file_name] = V...
[ "def rename(self, item, file_name):...\n", "\"\"\"docstring\"\"\"\n", "if type(item) == str:\n", "item = self.locate(item)\n", "if item.parent:\n", "if not item:\n", "item.file_name = file_name\n", "if item.is_dir:\n", "return False\n", "item.parent.sub_names_idx[item.file_name] = item\n", "self...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def __init__(self, *VAR_5, **VAR_6):...\n", "self.campaign = VAR_6['campaign']\n", "super(CLASS_2, self).__init__(*VAR_5, **kwargs)\n", "self.queryset = VAR_6['queryset']\n", "VAR_28 = self.simics_register_diff_choices('checkpoint_number')\n", "self.filters['checkpoint_number'].extra.update(VAR_4=checkpo...
[ "def __init__(self, *args, **kwargs):...\n", "self.campaign = kwargs['campaign']\n", "super(simics_register_diff_filter, self).__init__(*args, **kwargs)\n", "self.queryset = kwargs['queryset']\n", "checkpoint_number_choices = self.simics_register_diff_choices(\n 'checkpoint_number')\n", "self.filters['...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "@defer.inlineCallbacks...\n", "\"\"\"docstring\"\"\"\n", "VAR_13, VAR_8, VAR_14 = yield completion.complete(self, self.lineBuffer,\n self.lineBufferIndex)\n", "if len(VAR_14) == 1:\n", "VAR_17 = '' if VAR_8 else ' '\n", "if len(VAR_14) > 1:\n", "if self.lineBuffer[self.lineBufferIndex - len(VAR_13) ...
[ "@defer.inlineCallbacks...\n", "\"\"\"docstring\"\"\"\n", "partial, rest, completions = yield completion.complete(self, self.\n lineBuffer, self.lineBufferIndex)\n", "if len(completions) == 1:\n", "space = '' if rest else ' '\n", "if len(completions) > 1:\n", "if self.lineBuffer[self.lineBufferIndex ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_3(self):...\n", "self.assertIn('USER', os.environ)\n", "self.assertNotIn('USER', os.environ)\n" ]
[ "def test_hermetic_environment(self):...\n", "self.assertIn('USER', os.environ)\n", "self.assertNotIn('USER', os.environ)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_17(self, VAR_14):...\n", "" ]
[ "def is_relation(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@django.utils.decorators.classonlymethod...\n", "\"\"\"docstring\"\"\"\n", "for key in VAR_12:\n", "if key in VAR_11.http_method_names:\n", "def FUNC_8(VAR_2, *VAR_3, **VAR_4):...\n", "if not hasattr(VAR_11, key):\n", "self = VAR_11(**initkwargs)\n", "if hasattr(self, 'get') and not hasattr(self, 'he...
[ "@django.utils.decorators.classonlymethod...\n", "\"\"\"docstring\"\"\"\n", "for key in initkwargs:\n", "if key in cls.http_method_names:\n", "def view(request, *args, **kwargs):...\n", "if not hasattr(cls, key):\n", "self = cls(**initkwargs)\n", "if hasattr(self, 'get') and not hasattr(self, 'head'):...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "For", "Condition", "FunctionDef'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@retries(5, delay=0.5, backoff=1.5)...\n", "if VAR_11 == 'POST':\n", "return requests.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=_HEADERS)\n", "if VAR_11 == 'GET':\n", "return requests.get(FUNC_2(VAR_7), headers=_HEADERS)\n" ]
[ "@retries(5, delay=0.5, backoff=1.5)...\n", "if method == 'POST':\n", "return requests.post(_BuildUri(handler), data=ToUtf8Json(data), headers=\n _HEADERS)\n", "if method == 'GET':\n", "return requests.get(_BuildUri(handler), headers=_HEADERS)\n" ]
[ 0, 0, 7, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.delete_volume(VAR_6)\n", "self.common.client_logout()\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.delete_volume(volume)\n", "self.common.client_logout()\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_3(self):...\n", "VAR_8 = 'test_foo.py'\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_suite_spec(self):...\n", "spec = 'test_foo.py'\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_20(self):...\n", "if self.context.products.is_required_data('zinc_analysis'):\n", "self.context.products.safe_create_data('zinc_analysis', dict)\n", "if self.context.products.is_required_data('zinc_args'):\n", "self.context.products.safe_create_data('zinc_args', lambda : defaultdict(list))\n" ]
[ "def create_empty_extra_products(self):...\n", "if self.context.products.is_required_data('zinc_analysis'):\n", "self.context.products.safe_create_data('zinc_analysis', dict)\n", "if self.context.products.is_required_data('zinc_args'):\n", "self.context.products.safe_create_data('zinc_args', lambda : defaul...
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_5(self):...\n", "VAR_10 = None\n", "VAR_26, VAR_8 = read_config(self.source)\n", "if VAR_26 is None:\n", "VAR_12 = YamlConfig(VAR_26, VAR_7=self.skip_checks)\n", "if VAR_12.host and self._is_newer(VAR_8, VAR_12.host_name):\n", "VAR_10 = self.create_filename(VAR_12.host_name)\n", "if VAR_10:\...
[ "def generate(self):...\n", "file_name = None\n", "raw_yaml_config, header_source = read_config(self.source)\n", "if raw_yaml_config is None:\n", "yaml_config = YamlConfig(raw_yaml_config, skip_checks=self.skip_checks)\n", "if yaml_config.host and self._is_newer(header_source, yaml_config.host_name):\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Return'", "Expr'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "log.debug(\n 'Establishing SSH tunnel to the server where the database is located...')\n", "sshtunnel.SSH_TIMEOUT = 5.0\n", "sshtunnel.TUNNEL_TIMEOUT = 5.0\n", "self.tunnel = sshtunnel.SSHTunnelForwarder(ssh_address_or_host=config.\n SERVER_ADDRE...
[ "def _open_ssh_tunnel(self):...\n", "\"\"\"docstring\"\"\"\n", "log.debug(\n 'Establishing SSH tunnel to the server where the database is located...')\n", "sshtunnel.SSH_TIMEOUT = 5.0\n", "sshtunnel.TUNNEL_TIMEOUT = 5.0\n", "self.tunnel = sshtunnel.SSHTunnelForwarder(ssh_address_or_host=config.\n SE...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_11(VAR_10):...\n", "if VAR_10 and VAR_10 >= 16070400:\n", "return True\n", "return False\n" ]
[ "def validate_hsts_max_age(max_age):...\n", "if max_age and max_age >= 16070400:\n", "return True\n", "return False\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_2(self):...\n", "VAR_22 = []\n", "for VAR_6 in Ganesha.get_ganesha_clusters():\n", "VAR_22.extend([VAR_26.to_dict() for VAR_26 in GaneshaConf.instance(VAR_6).\n list_exports()])\n", "return VAR_22\n" ]
[ "def list(self):...\n", "result = []\n", "for cluster_id in Ganesha.get_ganesha_clusters():\n", "result.extend([export.to_dict() for export in GaneshaConf.instance(\n cluster_id).list_exports()])\n", "return result\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Expr'", "Return'" ]
[ "def __contains__(self, VAR_0):...\n", "for node in self.nodes:\n", "if node['node_object'] == VAR_0:\n", "return False\n", "return True\n" ]
[ "def __contains__(self, obj):...\n", "for node in self.nodes:\n", "if node['node_object'] == obj:\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Return'", "Return'" ]
[ "def FUNC_0(self, *VAR_3, **VAR_4):...\n", "VAR_7 = super().get_context_data(*VAR_3, **kwargs)\n", "if self.request.GET.get('back', None) is not None:\n", "VAR_7['back_link'] = self.request.GET['back']\n", "return VAR_7\n" ]
[ "def get_context_data(self, *args, **kwargs):...\n", "data = super().get_context_data(*args, **kwargs)\n", "if self.request.GET.get('back', None) is not None:\n", "data['back_link'] = self.request.GET['back']\n", "return data\n" ]
[ 0, 0, 3, 3, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.bindings\n", "VAR_7 = VAR_1['TEST_APP_COMPONENT_NAME']\n", "VAR_15 = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n", "VAR_8 = VAR_1['TEST_AWS_REGION']\n", "VAR_9 = [VAR_8 + 'a', VAR_8 + 'b']\n", "...
[ "def create_server_group(self):...\n", "\"\"\"docstring\"\"\"\n", "bindings = self.bindings\n", "load_balancer_name = bindings['TEST_APP_COMPONENT_NAME']\n", "group_name = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n", "region = bindings['TEST_AWS_REGION']\n", "av...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1):...\n", "VAR_15 = '%s.change_%s' % tuple(VAR_1.split('.'))\n", "if VAR_0.user.has_perm(VAR_15):\n", "return True\n", "return False\n" ]
[ "def check_permission(request, ctype):...\n", "perm = '%s.change_%s' % tuple(ctype.split('.'))\n", "if request.user.has_perm(perm):\n", "return True\n", "return False\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_23(self):...\n", "if self.limit_page_length:\n", "return 'limit %s, %s' % (self.limit_start, self.limit_page_length)\n", "return ''\n" ]
[ "def add_limit(self):...\n", "if self.limit_page_length:\n", "return 'limit %s, %s' % (self.limit_start, self.limit_page_length)\n", "return ''\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_5 = self._dbArgs.copy()\n", "self.augmentDatabaseArgs(VAR_5)\n", "return self.dbapiModule().connect(**kwargs)\n" ]
[ "def newConnection(self):...\n", "kwargs = self._dbArgs.copy()\n", "self.augmentDatabaseArgs(kwargs)\n", "return self.dbapiModule().connect(**kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_3(self):...\n", "VAR_2 = self.connect()\n", "VAR_3 = 'DELETE FROM crimes;'\n", "VAR_2.close()\n", "cursor.execute(VAR_3)\n", "VAR_2.commit()\n" ]
[ "def clear_all(self):...\n", "connection = self.connect()\n", "query = 'DELETE FROM crimes;'\n", "connection.close()\n", "cursor.execute(query)\n", "connection.commit()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "@property...\n", "def FUNC_34(VAR_25):...\n", "VAR_24 = os.environ.get(VAR_25)\n", "return self.Location.from_home(VAR_24) if VAR_24 else None\n" ]
[ "@property...\n", "def env_home(home_env_var):...\n", "home = os.environ.get(home_env_var)\n", "return self.Location.from_home(home) if home else None\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_6():...\n", "VAR_13.throw(_('Invalid Search Field'), VAR_13.DataError)\n" ]
[ "def _raise_exception():...\n", "frappe.throw(_('Invalid Search Field'), frappe.DataError)\n" ]
[ 0, 4 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_2(self, VAR_6):...\n", "VAR_6 = u\"'{0}'\".format(VAR_6)\n", "return VAR_6\n" ]
[ "def insert_format(self, value):...\n", "value = u\"'{0}'\".format(value)\n", "return value\n" ]
[ 0, 4, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "import pymysql.cursors\n", "def __init__(self, VAR_0):...\n", "VAR_3 = pymysql.connect(host='localhost', user='root', password='', VAR_0=\n db, charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor,\n autocommit=True)\n", "self.connection = VAR_3\n", "def FUNC_1(self, VAR_1, VAR_2=None):...\n", ...
[ "import pymysql.cursors\n", "def __init__(self, db):...\n", "connection = pymysql.connect(host='localhost', user='root', password='', db\n =db, charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor,\n autocommit=True)\n", "self.connection = connection\n", "def query_db(self, query, data=None):...\...
[ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Return'", "Return'", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_6(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_10 in self._rules\n" ]
[ "def is_rule(self, name):...\n", "\"\"\"docstring\"\"\"\n", "return name in self._rules\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import mock\n", "import requests\n", "from django.test import TransactionTestCase\n", "from api.models import Build\n", "def FUNC_0(*VAR...
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import mock\n", "import requests\n", "from django.test import TransactionTestCase\n", "from api.models import Build\n", "def mock_import...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_22(self, VAR_11):...\n", "\"\"\"docstring\"\"\"\n", "VAR_35 = self.common._cli_run('showvlun -a -host %s' % VAR_11, None)\n", "if VAR_35:\n", "VAR_35 = VAR_35[1:]\n", "for line in VAR_35:\n", "VAR_30 = line.split(',')\n", "if VAR_30 and len(VAR_30) > 4:\n", "return VAR_30[4]\n" ]
[ "def _get_active_nsp(self, hostname):...\n", "\"\"\"docstring\"\"\"\n", "result = self.common._cli_run('showvlun -a -host %s' % hostname, None)\n", "if result:\n", "result = result[1:]\n", "for line in result:\n", "info = line.split(',')\n", "if info and len(info) > 4:\n", "return info[4]\n" ]
[ 0, 0, 2, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "For", "Assign'", "Condition", "Return'" ]
[ "def FUNC_36(self, VAR_14):...\n", "return self.__class__(self.get_related_model(VAR_14), self.session)\n" ]
[ "def get_related_interface(self, col_name):...\n", "return self.__class__(self.get_related_model(col_name), self.session)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_16(self, **VAR_17):...\n", "\"\"\"docstring\"\"\"\n", "self.set_defaults(**kwargs)\n", "for VAR_42, VAR_3 in VAR_17.items():\n", "self.overridable[VAR_42] = VAR_3\n" ]
[ "def set_params(self, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "self.set_defaults(**kwargs)\n", "for k, v in kwargs.items():\n", "self.overridable[k] = v\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "For", "Assign'" ]
[ "def FUNC_11():...\n", "VAR_16 = FUNC_7('models.json')\n", "return [(VAR_34['model_system_name'], VAR_34['model_name_user'] + ':' +\n VAR_34['author']) for VAR_34 in VAR_16]\n" ]
[ "def get_models_choices():...\n", "models = load_json('models.json')\n", "return [(model['model_system_name'], model['model_name_user'] + ':' + model\n ['author']) for model in models]\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@api.public...\n", "FUNC_31(self, 'POST')\n" ]
[ "@api.public...\n", "record(self, 'POST')\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_8(self):...\n", "run_shell_command('super-cool-command', weird_parameter2='abc')\n", "run_shell_command('super-cool-command', universal_newlines=False)\n" ]
[ "def test_run_shell_command_kwargs_delegation(self):...\n", "run_shell_command('super-cool-command', weird_parameter2='abc')\n", "run_shell_command('super-cool-command', universal_newlines=False)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "\"\"\"Internal bot API handlers.\"\"\"\n", "import base64\n", "import json\n", "import logging\n", "import textwrap\n", "import webob\n", "import webapp2\n", "from google.appengine.api import app_identity\n", "from google.appengine.api import datastore_errors\n", "from google.appengine.datastore ...
[ "\"\"\"Internal bot API handlers.\"\"\"\n", "import base64\n", "import json\n", "import logging\n", "import textwrap\n", "import webob\n", "import webapp2\n", "from google.appengine.api import app_identity\n", "from google.appengine.api import datastore_errors\n", "from google.appengine.datastore ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Impor...
[ "def FUNC_2(self, VAR_5, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = 'ALTER TABLE ' + VAR_2 + ' ADD COLUMN ' + str(VAR_5) + ' ' + VAR_0(\n VAR_6)\n", "self._run_command(VAR_7)\n", "print('Column ' + str(VAR_5) + ' already exists!')\n" ]
[ "def _addColumn(self, column, init_data):...\n", "\"\"\"docstring\"\"\"\n", "command = 'ALTER TABLE ' + TABLE_NAME + ' ADD COLUMN ' + str(column\n ) + ' ' + getSQLiteType(init_data)\n", "self._run_command(command)\n", "print('Column ' + str(column) + ' already exists!')\n" ]
[ 0, 0, 4, 4, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5():...\n", "" ]
[ "def genSSCI():...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_8(VAR_25, VAR_24):...\n", "for VAR_27 in VAR_24:\n", "if VAR_27['submittable'] and VAR_27['confirm_the_level'] and VAR_27['passed']:\n", "if 'unconfirmed' in VAR_25:\n", "FUNC_8(VAR_27, VAR_27.get('children', []))\n", "for child in VAR_25.get('children', []):\n", "if 'unconfirmed' in child:\n"...
[ "def r_check(parent, children):...\n", "for entry in children:\n", "if entry['submittable'] and entry['confirm_the_level'] and entry['passed']:\n", "if 'unconfirmed' in parent:\n", "r_check(entry, entry.get('children', []))\n", "for child in parent.get('children', []):\n", "if 'unconfirmed' in child:\n"...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Condition", "Expr'", "For", "Condition" ]
[ "def FUNC_37(VAR_47, VAR_56):...\n", "return os.path.relpath(VAR_47, VAR_56).startswith(os.pardir)\n" ]
[ "def is_outside(path, putative_parent):...\n", "return os.path.relpath(path, putative_parent).startswith(os.pardir)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@property...\n", "return [CLASS_3(self, obj) for obj in self.object_list]\n" ]
[ "@property...\n", "return [SmartListItem(self, obj) for obj in self.object_list]\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_18(self, VAR_14):...\n", "" ]
[ "def is_relation_many_to_one(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(VAR_1):...\n", "VAR_3 = [_('Employee') + ':Link/Employee:150', _('Employee Name') + '::200',\n _('Department') + '::150']\n", "for leave_type in VAR_1:\n", "VAR_3.append(_(leave_type) + ' ' + _('Opening') + ':Float:160')\n", "return VAR_3\n", "VAR_3.append(_(leave_type) + ' ' + _('Taken') +...
[ "def get_columns(leave_types):...\n", "columns = [_('Employee') + ':Link/Employee:150', _('Employee Name') +\n '::200', _('Department') + '::150']\n", "for leave_type in leave_types:\n", "columns.append(_(leave_type) + ' ' + _('Opening') + ':Float:160')\n", "return columns\n", "columns.append(_(leave_t...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Expr'", "Return'", "Expr'", "Expr'" ]
[ "@VAR_0.route('/login', methods=['GET', 'POST'])...\n", "if request.method == 'POST':\n", "VAR_42 = request.form['username']\n", "return render_template('login.html')\n", "VAR_52 = request.form['password']\n", "VAR_28 = VAR_1.connection.cursor()\n", "VAR_29 = VAR_28.execute('SELECT * FROM Users WHERE us...
[ "@app.route('/login', methods=['GET', 'POST'])...\n", "if request.method == 'POST':\n", "username = request.form['username']\n", "return render_template('login.html')\n", "password_candidate = request.form['password']\n", "cur = mysql.connection.cursor()\n", "result = cur.execute('SELECT * FROM Users WH...
[ 0, 0, 4, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Expr'", "Return'" ]
[ "def FUNC_4(VAR_12):...\n", "VAR_19 = os.path.join(os.getcwd(), VAR_5.registry.settings[VAR_12])\n", "if not os.path.isdir(VAR_19):\n", "VAR_0.error(f'Unable to add_static_view {VAR_12}:{VAR_19}')\n", "return VAR_19\n" ]
[ "def settings_path(key):...\n", "path = os.path.join(os.getcwd(), config.registry.settings[key])\n", "if not os.path.isdir(path):\n", "log.error(f'Unable to add_static_view {key}:{path}')\n", "return path\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if VAR_4 in [TaskStatus.READY, TaskStatus.LOCKED_FOR_VALIDATION, TaskStatus\n", "return\n", "VAR_6 = ProjectService.get_project_by_id(VAR_1)\n", "VAR_7 = UserService.get_user_by_id(VAR_2)\n", "CLASS_0._update_tasks_stats(VAR_6, VAR_7, VAR_3, VAR_4, VAR_5...
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if new_state in [TaskStatus.READY, TaskStatus.LOCKED_FOR_VALIDATION,\n", "return\n", "project = ProjectService.get_project_by_id(project_id)\n", "user = UserService.get_user_by_id(user_id)\n", "StatsService._update_tasks_stats(project, user, last_state, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_0(self, VAR_9):...\n", "self.formUrl = VAR_9\n", "VAR_18 = urlparse(self.formUrl)\n", "self.schema = VAR_18.scheme\n", "self.host = VAR_18.netloc\n", "self.httpRequests = 0\n", "VAR_34 = self.session.get(self.formUrl, headers={'Accept-Encoding': None})\n", "self.logger.critical('%s : Host un...
[ "def setup(self, initUrl):...\n", "self.formUrl = initUrl\n", "url = urlparse(self.formUrl)\n", "self.schema = url.scheme\n", "self.host = url.netloc\n", "self.httpRequests = 0\n", "initGet = self.session.get(self.formUrl, headers={'Accept-Encoding': None})\n", "self.logger.critical('%s : Host unreach...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "AugAssign'", "Expr'", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "A...
[ "" ]
[ "" ]
[ 0 ]
[ "Condition" ]
[ "def FUNC_4(self, VAR_5='test', VAR_6=None):...\n", "\"\"\"docstring\"\"\"\n", "from invenio.modules.oauthclient.client import oauth\n", "oauth.remote_apps[VAR_5].handle_oauth2_response = MagicMock(return_value=\n data or {'access_token': 'test_access_token', 'scope': '', 'token_type':\n 'bearer'})\n" ]
[ "def mock_response(self, app='test', data=None):...\n", "\"\"\"docstring\"\"\"\n", "from invenio.modules.oauthclient.client import oauth\n", "oauth.remote_apps[app].handle_oauth2_response = MagicMock(return_value=data or\n {'access_token': 'test_access_token', 'scope': '', 'token_type': 'bearer'})\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "Assign'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "self.csv.size\n", "VAR_29 = False\n", "return VAR_29\n", "VAR_29 = self.csv.url\n", "VAR_29 = False\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "self.csv.size\n", "csv_url = False\n", "return csv_url\n", "csv_url = self.csv.url\n", "csv_url = False\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Return'", "Assign'", "Assign'" ]
[ "from datetime import datetime\n", "import io\n", "from twisted.web.test.test_web import DummyRequest\n", "from pixelated.adapter.model.mail import InputMail\n", "VAR_0 = ['\\\\Seen', '\\\\Answered', '\\\\Flagged', '\\\\Deleted', '\\\\Draft',\n '\\\\Recent', 'List']\n", "VAR_1 = {'date': str(datetime.n...
[ "from datetime import datetime\n", "import io\n", "from twisted.web.test.test_web import DummyRequest\n", "from pixelated.adapter.model.mail import InputMail\n", "LEAP_FLAGS = ['\\\\Seen', '\\\\Answered', '\\\\Flagged', '\\\\Deleted', '\\\\Draft',\n '\\\\Recent', 'List']\n", "DEFAULT_HEADERS = {'date':...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_11(self, VAR_5, VAR_8):...\n", "VAR_14 = 'string' % (VAR_5, VAR_8)\n", "VAR_11 = sql.queryDB(self.conn, VAR_14)\n", "return VAR_11\n" ]
[ "def getUsersByName(self, userid, username):...\n", "sqlText = (\n \"select userid,name,country,(select Count(*) from friends where users.userid=friends.friendid and friends.userid=%d) as follow from users where users.name='%s';\"\n % (userid, username))\n", "result = sql....
[ 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@click.command(help='Delete a monitor')...\n", "if not VAR_14:\n", "VAR_14 = click.prompt('string'.format(VAR_12=monitor), prompt_suffix='> ')\n", "if VAR_14.strip() != VAR_12:\n", "print('abort')\n", "newrelic.delete_monitor(VAR_0.obj['ACCOUNT'], VAR_12)\n", "sys.exit(1)\n", "print(click.style(u'OK'...
[ "@click.command(help='Delete a monitor')...\n", "if not confirm:\n", "confirm = click.prompt(\n \"\"\"\n ! WARNING: Destructive Action\n ! This command will destroy the monitor: {monitor}\n ! To proceed, type \"{monitor}\" or\n re-run this command with --confirm={monitor}\n\n\"\"\"\n .format(monitor=mon...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "Condition", "Docstring" ]
[ "def FUNC_13(self):...\n", "VAR_11 = {}\n", "for VAR_12 in self.parent_groups:\n", "VAR_11[VAR_12.name] = VAR_12\n", "return VAR_11\n", "VAR_11.update(VAR_12._get_ancestors())\n" ]
[ "def _get_ancestors(self):...\n", "results = {}\n", "for g in self.parent_groups:\n", "results[g.name] = g\n", "return results\n", "results.update(g._get_ancestors())\n" ]
[ 0, 1, 0, 1, 1, 1 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_40(VAR_87):...\n", "return filterfalse(self.is_rule, VAR_87)\n" ]
[ "def files(items):...\n", "return filterfalse(self.is_rule, items)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "import random\n", "import hashlib\n", "from urlparse import urlparse\n", "from decorator import decorator\n", "from pylons import session, request, config\n", "from pylons.controllers.util import abort\n", "from pylons.i18n import _\n", "def FUNC_0(VAR_0=['POST', 'GET', 'PUT...
[ "\"\"\"\nXSRF is Cross-Site Request Forgery, where an attacker has a user follow a link that triggers an \naction on a site which the user did not intentionally want to perform (i.e. vote in \na certain way). To prevent this, some actions are only possible if authorized via HTTP or if a\nmodtoken - a shared SHA1 ha...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, 0 ]
[ "Expr'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Docstring", "FunctionDef'", "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Condition", "Return'", "Condition", "Assign'", "Condition", ...
[ "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "def FUNC_0(self):...\n", "VAR_1, VAR_2 = 'firstuser', 'password'\n", "VAR_3 = 'autotest@deis.io'\n", "VAR_4 = {'username': VAR_1, 'password': VAR_2, 'email': VAR_3}\n", "VAR_5 = '/api/auth/register'\n"...
[ "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "def test_first_signup(self):...\n", "username, password = 'firstuser', 'password'\n", "email = 'autotest@deis.io'\n", "submit = {'username': username, 'password': password, 'email': email}\n", "url = '...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0...
[ "ImportFrom'", "Import'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", ...
[ "def FUNC_12(VAR_4):...\n", "VAR_0, VAR_10 = FUNC_0()\n", "VAR_18 = \"SELECT name from {} where token='{}'\".format(CFG(\n 'tokens_table_name'), VAR_4)\n", "VAR_20 = FUNC_3(VAR_10, VAR_18)\n", "if not VAR_20:\n", "VAR_18 = \"SELECT poll_name from {} where adm_token='{}'\".format(CFG(\n 'admintoken_t...
[ "def pollNameFromToken(token):...\n", "conn, c = connectDB()\n", "req = \"SELECT name from {} where token='{}'\".format(CFG('tokens_table_name'\n ), token)\n", "answer = queryOne(c, req)\n", "if not answer:\n", "req = \"SELECT poll_name from {} where adm_token='{}'\".format(CFG(\n 'admintoken_table_...
[ 0, 0, 4, 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1):...\n", "res: GroupReservation = GroupReservation.objects.get(id=rid)\n" ]
[ "def update_reservation_articles(postdict, rid):...\n", "res: GroupReservation = GroupReservation.objects.get(id=rid)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "AnnAssign'" ]
[ "@functools.wraps(VAR_0)...\n", "if not self.request.headers.get('X-XSRF-Token-Request'):\n", "return VAR_0(self, *VAR_5, **kwargs)\n" ]
[ "@functools.wraps(f)...\n", "if not self.request.headers.get('X-XSRF-Token-Request'):\n", "return f(self, *args, **kwargs)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Condition", "Return'" ]
[ "def FUNC_2(VAR_6, VAR_7):...\n", "if os.getenv('VEIL_REMOTE_BROWSER'):\n", "VAR_7 = 'remote'\n", "get_executing_test().browser_type = VAR_7\n", "VAR_10 = get_executing_test()\n", "VAR_10.addCleanup(FUNC_7)\n", "if 'spynner' == VAR_7:\n", "FUNC_3(VAR_6)\n", "if 'chrome' == VAR_7:\n", "FUNC_4(VAR_6...
[ "def start_browser(url, browser_type):...\n", "if os.getenv('VEIL_REMOTE_BROWSER'):\n", "browser_type = 'remote'\n", "get_executing_test().browser_type = browser_type\n", "test = get_executing_test()\n", "test.addCleanup(stop_browser)\n", "if 'spynner' == browser_type:\n", "start_spynner_browser(url)\...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_29(self):...\n", "VAR_49 = re.split(self.dynamic_fill, self.file)[0]\n", "VAR_50 = os.path.dirname(VAR_49)\n", "if len(VAR_50) > 0 and not os.path.exists(VAR_50):\n", "os.makedirs(VAR_50)\n", "if e.errno != 17:\n" ]
[ "def prepare(self):...\n", "path_until_wildcard = re.split(self.dynamic_fill, self.file)[0]\n", "dir = os.path.dirname(path_until_wildcard)\n", "if len(dir) > 0 and not os.path.exists(dir):\n", "os.makedirs(dir)\n", "if e.errno != 17:\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Condition" ]
[ "def FUNC_2(self):...\n", "CLASS_3.ScenarioMaker().given_a_deep_link_domain('pachatary://app'\n ).given_a_dynamic_link('').when_call_profile_redirect('a_b.c'\n ).then_response_should_be_a_redirect_to('pachatary://app/profiles/a_b.c')\n" ]
[ "def test_when_there_is_no_dynamic_link_returns_deep_link(self):...\n", "RedirectProfileTestCase.ScenarioMaker().given_a_deep_link_domain(\n 'pachatary://app').given_a_dynamic_link('').when_call_profile_redirect(\n 'a_b.c').then_response_should_be_a_redirect_to(\n 'pachatary://app/profiles/a_b.c')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_0(self, VAR_4, VAR_5, VAR_6=True):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = []\n", "for VAR_43, v in VAR_5.items():\n", "VAR_14.append(' %s=%s' % (VAR_43, v))\n", "VAR_15 = VAR_4 + ''.join(VAR_14)\n", "return self._run_ssh(VAR_15, VAR_6)\n" ]
[ "def _cliq_run(self, verb, cliq_args, check_exit_code=True):...\n", "\"\"\"docstring\"\"\"\n", "cliq_arg_strings = []\n", "for k, v in cliq_args.items():\n", "cliq_arg_strings.append(' %s=%s' % (k, v))\n", "cmd = verb + ''.join(cliq_arg_strings)\n", "return self._run_ssh(cmd, check_exit_code)\n" ]
[ 0, 0, 2, 0, 2, 2, 2 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_0: bool):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = threading.current_thread()\n", "if isinstance(VAR_6, threads.CauldronThread):\n", "VAR_6.is_executing = VAR_0\n" ]
[ "def set_executing(on: bool):...\n", "\"\"\"docstring\"\"\"\n", "my_thread = threading.current_thread()\n", "if isinstance(my_thread, threads.CauldronThread):\n", "my_thread.is_executing = on\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.resources = VAR_76, VAR_52\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.resources = args, resources\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_6(self):...\n", "VAR_1 = '/api/apps'\n", "VAR_2 = self.client.post(VAR_1)\n", "self.assertEqual(VAR_2.status_code, 201)\n", "VAR_3 = VAR_2.data['id']\n", "VAR_1 = '/api/apps/{app_id}/builds'.format(**locals())\n", "VAR_4 = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n d...
[ "def test_config_chaos(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'...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", ...
[ "def FUNC_8(self):...\n", "VAR_9 = fingerprint(VAR_0)\n", "self.assertEquals(VAR_9, '54:6d:da:1f:91:b5:2b:6f:a2:83:90:c4:f9:73:76:f5')\n" ]
[ "def test_rsa_key_fingerprint(self):...\n", "fp = fingerprint(RSA_PUBKEY)\n", "self.assertEquals(fp, '54:6d:da:1f:91:b5:2b:6f:a2:83:90:c4:f9:73:76:f5')\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_23(VAR_33, VAR_13, VAR_20, VAR_21, VAR_12):...\n", "if VAR_21 == wzrpc.status.success:\n", "self.log.debug('Auth records on router were cleared')\n", "self.log.warn('Status %s, passing', wzrpc.name_status(VAR_21))\n" ]
[ "def accept(that, reqid, seqnum, status, data):...\n", "if status == wzrpc.status.success:\n", "self.log.debug('Auth records on router were cleared')\n", "self.log.warn('Status %s, passing', wzrpc.name_status(status))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_4(VAR_6, VAR_7=3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = list(VAR_6)\n", "VAR_26 = lambda : [VAR_0 for VAR_0 in VAR_6 if not os.path.exists(VAR_0)]\n", "VAR_27 = VAR_26()\n", "if VAR_27:\n", "logger.info('Waiting at most {} seconds for missing files.'.format(VAR_7))\n", "for _ in range(...
[ "def wait_for_files(files, latency_wait=3):...\n", "\"\"\"docstring\"\"\"\n", "files = list(files)\n", "get_missing = lambda : [f for f in files if not os.path.exists(f)]\n", "missing = get_missing()\n", "if missing:\n", "logger.info('Waiting at most {} seconds for missing files.'.format(\n latency_w...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "For", "Condition", "Return'", "Expr'" ]
[ "def __init__(self, VAR_10, VAR_11):...\n", "unittest.TestCase.__init__(self, VAR_10)\n", "self.connection_string = VAR_11\n" ]
[ "def __init__(self, method_name, connection_string):...\n", "unittest.TestCase.__init__(self, method_name)\n", "self.connection_string = connection_string\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'" ]
[ "def __delitem__(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self.url_to_path(VAR_3)\n", "os.remove(VAR_6)\n", "os.removedirs(os.path.dirname(VAR_6))\n" ]
[ "def __delitem__(self, url):...\n", "\"\"\"docstring\"\"\"\n", "path = self.url_to_path(url)\n", "os.remove(path)\n", "os.removedirs(os.path.dirname(path))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'" ]
[ "@wait_for(timeout=10.0)...\n", "@defer.inlineCallbacks...\n", "VAR_9 = yield VAR_2.client.mail_store.all_mails()\n", "for mail in VAR_9:\n", "yield VAR_2.client.mail_store.delete_mail(mail.ident)\n", "return FUNC_8()\n" ]
[ "@wait_for(timeout=10.0)...\n", "@defer.inlineCallbacks...\n", "mails = yield context.client.mail_store.all_mails()\n", "for mail in mails:\n", "yield context.client.mail_store.delete_mail(mail.ident)\n", "return _delete_all_mails()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "For", "Condition", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_0 = str(VAR_0)\n", "pathlib.Path(VAR_0).mkdir(parents=True, exist_ok=True)\n" ]
[ "def create_directory_tree(path):...\n", "\"\"\"docstring\"\"\"\n", "path = str(path)\n", "pathlib.Path(path).mkdir(parents=True, exist_ok=True)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_7, VAR_57, VAR_58=True, **VAR_16):...\n", "self.nav = VAR_57\n", "self.remember = VAR_58\n", "VAR_7 = VAR_57.get_param, VAR_7\n", "CLASS_0.__init__(self, VAR_7, **kw)\n" ]
[ "def __init__(self, param, menu_cls, remember=True, **kw):...\n", "self.nav = menu_cls\n", "self.remember = remember\n", "param = menu_cls.get_param, param\n", "Validator.__init__(self, param, **kw)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_45, VAR_46, VAR_47, VAR_48, VAR_49, VAR_50, VAR_51,...\n", "self.st_mode = VAR_45\n", "self.st_ino = VAR_46\n", "self.st_dev = VAR_47\n", "self.st_nlink = VAR_48\n", "self.st_uid = VAR_49\n", "self.st_gid = VAR_50\n", "self.st_size = VAR_51\n", "self.st_atime = VAR_52\n", "...
[ "def __init__(self, st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid,...\n", "self.st_mode = st_mode\n", "self.st_ino = st_ino\n", "self.st_dev = st_dev\n", "self.st_nlink = st_nlink\n", "self.st_uid = st_uid\n", "self.st_gid = st_gid\n", "self.st_size = st_size\n", "self.st_atime = st_atime\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_5(self):...\n", "VAR_1 = 'http://my.url.com'\n", "VAR_2 = 'True'\n", "url_helper.urllib2.urlopen(VAR_1, mox.IgnoreArg(), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(VAR_2))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen(VAR_1, method='POST'), VAR_2)\n", "sel...
[ "def testUrlOpenPOSTSuccess(self):...\n", "url = 'http://my.url.com'\n", "response = 'True'\n", "url_helper.urllib2.urlopen(url, mox.IgnoreArg(), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(response))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen(url, method='POST'), r...
[ 0, 0, 0, 5, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(self):...\n", "return self._doc['rules'].keys()\n" ]
[ "def get_rule_names(self):...\n", "return self._doc['rules'].keys()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(VAR_3, VAR_7):...\n", "VAR_8 = VAR_3.cursor()\n", "VAR_10 = VAR_8.execute(VAR_7)\n", "VAR_3.commit()\n", "print('update data successfull')\n", "return VAR_10\n" ]
[ "def updateDB(conn, sql_update):...\n", "cur = conn.cursor()\n", "result = cur.execute(sql_update)\n", "conn.commit()\n", "print('update data successfull')\n", "return result\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_0(self, VAR_0='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n" ]
[ "def connect(self, database='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(VAR_0, VAR_1):...\n", "VAR_9 = get_object_or_404(Hunt, id=pk)\n", "if VAR_9.enable == True:\n", "VAR_9.setDisable()\n", "VAR_9.setEnable()\n", "VAR_9.stop()\n", "VAR_9.start()\n", "return redirect('twitter_hunter:index')\n" ]
[ "def hunt_switch_enable(request, pk):...\n", "hunt = get_object_or_404(Hunt, id=pk)\n", "if hunt.enable == True:\n", "hunt.setDisable()\n", "hunt.setEnable()\n", "hunt.stop()\n", "hunt.start()\n", "return redirect('twitter_hunter:index')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "self.check_image_exists()\n", "if not self.security_groups:\n", "self.security_groups[self.tenant_id] = self.verify(25, self.\n _create_security_group, 1, 'Security group can not be created.',\n 'security group creation', self.compute_client)\n", ...
[ "def test_009_create_server_with_file(self):...\n", "\"\"\"docstring\"\"\"\n", "self.check_image_exists()\n", "if not self.security_groups:\n", "self.security_groups[self.tenant_id] = self.verify(25, self.\n _create_security_group, 1, 'Security group can not be created.',\n 'security group creation', ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_10):...\n", "return '%s%s' % (self.configuration.iscsi_target_prefix, VAR_10['name'])\n" ]
[ "def _build_iscsi_target_name(self, volume):...\n", "return '%s%s' % (self.configuration.iscsi_target_prefix, volume['name'])\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_25(self, VAR_73):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.message = VAR_73\n", "return VAR_101\n" ]
[ "def message(self, message):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.message = message\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_15(VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "if FUNC_12(VAR_16, 'temp'):\n", "return VAR_19(VAR_16, 'protected')\n" ]
[ "def protected(value):...\n", "\"\"\"docstring\"\"\"\n", "if is_flagged(value, 'temp'):\n", "return flag(value, 'protected')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'" ]