lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def __init__(self):...\n", "self._time = 0.0\n" ]
[ "def __init__(self):...\n", "self._time = 0.0\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_26(*VAR_29, **VAR_30):...\n", "" ]
[ "def raiseOSError(*_a, **_k):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_3(self):...\n", "VAR_4 = CLASS_2()\n", "VAR_5 = EntityCache(entities=[], allow_none_id=False)\n", "self.assert_raises(ValueError, VAR_5.add, VAR_4)\n" ]
[ "def test_allow_none_id_false(self):...\n", "ent = MyEntity()\n", "cache = EntityCache(entities=[], allow_none_id=False)\n", "self.assert_raises(ValueError, cache.add, ent)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_19(self, VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "for retries in range(1, 100):\n", "if os.path.exists('/sys/bus/vmbus/devices/'):\n", "return super(CLASS_0, self).device_for_ide_port(VAR_14)\n", "time.sleep(10)\n" ]
[ "def device_for_ide_port(self, port_id):...\n", "\"\"\"docstring\"\"\"\n", "for retries in range(1, 100):\n", "if os.path.exists('/sys/bus/vmbus/devices/'):\n", "return super(BigIpOSUtil, self).device_for_ide_port(port_id)\n", "time.sleep(10)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Condition", "Return'", "Expr'" ]
[ "def FUNC_8(self, VAR_47, VAR_48):...\n", "\"\"\"docstring\"\"\"\n", "assert isinstance(VAR_47, list)\n", "assert isinstance(VAR_48, dict)\n", "assert self.validate_group_by_data(VAR_47, VAR_48), 'Invalid having data'\n", "if len(VAR_47) == 0:\n", "return ''\n", "VAR_71 = ''\n", "VAR_72 = map(lambda field_id: '`{table_name}`.`{field_name}`'.format(\n table_name=self.field_mapping[field_id][self.TABLE_NAME], VAR_75=self.\n field_mapping[field_id][self.FIELD_NAME]), VAR_47)\n", "VAR_71 += 'GROUP BY {fields}'.format(fields=', '.join(\n fully_qualified_field_names))\n", "if len(VAR_48.keys()) > 0:\n", "VAR_71 += ' HAVING {condition}'.format(VAR_55=self._generate_sql_condition(\n having_clause))\n", "return VAR_71\n" ]
[ "def generate_group_by(self, group_by_fields, having_clause):...\n", "\"\"\"docstring\"\"\"\n", "assert isinstance(group_by_fields, list)\n", "assert isinstance(having_clause, dict)\n", "assert self.validate_group_by_data(group_by_fields, having_clause\n ), 'Invalid having data'\n", "if len(group_by_fields) == 0:\n", "return ''\n", "result = ''\n", "fully_qualified_field_names = map(lambda field_id:\n '`{table_name}`.`{field_name}`'.format(table_name=self.field_mapping[\n field_id][self.TABLE_NAME], field_name=self.field_mapping[field_id][\n self.FIELD_NAME]), group_by_fields)\n", "result += 'GROUP BY {fields}'.format(fields=', '.join(\n fully_qualified_field_names))\n", "if len(having_clause.keys()) > 0:\n", "result += ' HAVING {condition}'.format(condition=self.\n _generate_sql_condition(having_clause))\n", "return result\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Assert'", "Assert'", "Condition", "Return'", "Assign'", "Assign'", "AugAssign'", "Condition", "AugAssign'", "Return'" ]
[ "def FUNC_2(self):...\n", "self.telnet = Telnet(self.options.debugger_ip_address, self.port, timeout=\n self.timeout)\n", "db.log_event('Information', 'Debugger', 'Connected to telnet', self.options\n .debugger_ip_address + ':' + str(self.port))\n" ]
[ "def connect_telnet(self):...\n", "self.telnet = Telnet(self.options.debugger_ip_address, self.port, timeout=\n self.timeout)\n", "db.log_event('Information', 'Debugger', 'Connected to telnet', self.options\n .debugger_ip_address + ':' + str(self.port))\n" ]
[ 0, 0, 2 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def __gt__(self, VAR_11):...\n", "return self.rule.__gt__(VAR_11.rule)\n" ]
[ "def __gt__(self, other):...\n", "return self.rule.__gt__(other.rule)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self, VAR_2):...\n", "if self == VAR_2:\n", "if VAR_2 not in self.child_groups:\n", "self.child_groups.append(VAR_2)\n", "VAR_2.depth = max([self.depth + 1, VAR_2.depth])\n", "VAR_2._check_children_depth()\n", "if self.name not in [VAR_12.name for VAR_12 in VAR_2.parent_groups]:\n", "VAR_2.parent_groups.append(self)\n", "self.clear_hosts_cache()\n", "for h in VAR_2.get_hosts():\n", "h.populate_ancestors()\n" ]
[ "def add_child_group(self, group):...\n", "if self == group:\n", "if group not in self.child_groups:\n", "self.child_groups.append(group)\n", "group.depth = max([self.depth + 1, group.depth])\n", "group._check_children_depth()\n", "if self.name not in [g.name for g in group.parent_groups]:\n", "group.parent_groups.append(self)\n", "self.clear_hosts_cache()\n", "for h in group.get_hosts():\n", "h.populate_ancestors()\n" ]
[ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1 ]
[ "FunctionDef'", "Condition", "Condition", "Expr'", "Assign'", "Expr'", "For", "Expr'", "Expr'", "For", "Expr'" ]
[ "def FUNC_6(self, VAR_3):...\n", "if VAR_3.name not in self.host_names:\n", "self.hosts.append(VAR_3)\n", "self._hosts.add(VAR_3.name)\n", "VAR_3.add_group(self)\n", "self.clear_hosts_cache()\n" ]
[ "def add_host(self, host):...\n", "if host.name not in self.host_names:\n", "self.hosts.append(host)\n", "self._hosts.add(host.name)\n", "host.add_group(self)\n", "self.clear_hosts_cache()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.get_options().incremental_caching\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.get_options().incremental_caching\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1=None, VAR_2=None):...\n", "if VAR_2 is None:\n", "VAR_2 = VAR_0.dataset\n", "VAR_3 = db.build_dict_from_row(VAR_2)\n", "VAR_3['version'] = db.build_dict_from_row(VAR_0)\n", "VAR_3['version']['available_from'] = VAR_3['version']['available_from'\n ].strftime('%Y-%m-%d')\n", "VAR_3['has_image'] = VAR_2.has_image()\n", "if VAR_1:\n", "VAR_3['is_admin'] = VAR_1.is_admin(VAR_2)\n", "return VAR_3\n", "if VAR_1.has_access(VAR_2):\n", "VAR_3['authorization_level'] = 'has_access'\n", "if VAR_1.has_requested_access(VAR_2):\n", "VAR_3['authorization_level'] = 'has_requested_access'\n", "VAR_3['authorization_level'] = 'no_access'\n" ]
[ "def build_dataset_structure(dataset_version, user=None, dataset=None):...\n", "if dataset is None:\n", "dataset = dataset_version.dataset\n", "r = db.build_dict_from_row(dataset)\n", "r['version'] = db.build_dict_from_row(dataset_version)\n", "r['version']['available_from'] = r['version']['available_from'].strftime(\n '%Y-%m-%d')\n", "r['has_image'] = dataset.has_image()\n", "if user:\n", "r['is_admin'] = user.is_admin(dataset)\n", "return r\n", "if user.has_access(dataset):\n", "r['authorization_level'] = 'has_access'\n", "if user.has_requested_access(dataset):\n", "r['authorization_level'] = 'has_requested_access'\n", "r['authorization_level'] = 'no_access'\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Condition", "Assign'", "Assign'" ]
[ "def __repr__(self):...\n", "return self.get_name()\n" ]
[ "def __repr__(self):...\n", "return self.get_name()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from reddit_base import RedditController\n", "from r2.lib.pages import BoringPage, ShowMeetup, NewMeetup, EditMeetup, PaneStack, CommentListing, LinkInfoPage, CommentReplyBox, NotEnoughKarmaToPost\n", "from validator import validate, VUser, VRequired, VMeetup, VEditMeetup, VFloat, ValueOrBlank, ValidIP, VMenu, VCreateMeetup\n", "from errors import errors\n", "from r2.lib.jsonresponse import Json\n", "from routes.util import url_for\n", "from r2.models import Meetup, Link, Subreddit, CommentBuilder\n", "from r2.models.listing import NestedListing\n", "from r2.lib.menus import CommentSortMenu, NumCommentsMenu\n", "from r2.lib.filters import python_websafe\n", "from mako.template import Template\n", "from pylons.i18n import _\n", "from pylons import c, g, request\n", "import json\n", "def FUNC_0(VAR_0):...\n", "VAR_1 = Template(filename='r2/templates/showmeetup.html', output_encoding=\n 'utf-8', encoding_errors='replace')\n", "VAR_2 = VAR_1.get_def('meetup_info').render_unicode(VAR_0=meetup)\n", "VAR_3 = url_for(controller='meetups', action='show', id=meetup._id36)\n", "VAR_4 = python_websafe(VAR_0.title)\n", "VAR_5 = u\"<h2>Discussion article for the meetup : <a href='%s'>%s</a></h2>\" % (\n VAR_3, VAR_4)\n", "return VAR_5 + VAR_2 + VAR_5\n" ]
[ "from reddit_base import RedditController\n", "from r2.lib.pages import BoringPage, ShowMeetup, NewMeetup, EditMeetup, PaneStack, CommentListing, LinkInfoPage, CommentReplyBox, NotEnoughKarmaToPost\n", "from validator import validate, VUser, VRequired, VMeetup, VEditMeetup, VFloat, ValueOrBlank, ValidIP, VMenu, VCreateMeetup\n", "from errors import errors\n", "from r2.lib.jsonresponse import Json\n", "from routes.util import url_for\n", "from r2.models import Meetup, Link, Subreddit, CommentBuilder\n", "from r2.models.listing import NestedListing\n", "from r2.lib.menus import CommentSortMenu, NumCommentsMenu\n", "from r2.lib.filters import python_websafe\n", "from mako.template import Template\n", "from pylons.i18n import _\n", "from pylons import c, g, request\n", "import json\n", "def meetup_article_text(meetup):...\n", "t = Template(filename='r2/templates/showmeetup.html', output_encoding=\n 'utf-8', encoding_errors='replace')\n", "res = t.get_def('meetup_info').render_unicode(meetup=meetup)\n", "url = url_for(controller='meetups', action='show', id=meetup._id36)\n", "title = python_websafe(meetup.title)\n", "hdr = u\"<h2>Discussion article for the meetup : <a href='%s'>%s</a></h2>\" % (\n url, title)\n", "return hdr + res + hdr\n" ]
[ 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_8, VAR_9, VAR_10, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = VAR_8.components.netatmo\n", "VAR_13 = CLASS_1(VAR_12.NETATMO_AUTH, VAR_9.get(VAR_2, None))\n", "VAR_14 = []\n", "import pyatmo\n", "if VAR_1 in VAR_9:\n", "return None\n", "VAR_10(VAR_14, True)\n", "for VAR_16, monitored_conditions in VAR_9[VAR_1].items():\n", "for VAR_16 in VAR_13.get_module_names():\n", "if VAR_16 not in VAR_13.get_module_names():\n", "for variable in VAR_13.station_data.monitoredConditions(VAR_16):\n", "VAR_0.error('Module name: \"%s\" not found', VAR_16)\n", "for variable in monitored_conditions:\n", "if variable in VAR_5.keys():\n", "VAR_14.append(CLASS_0(VAR_13, VAR_16, variable))\n", "VAR_14.append(CLASS_0(VAR_13, VAR_16, variable))\n", "VAR_0.warning('Ignoring unknown var %s for mod %s', variable, VAR_16)\n" ]
[ "def setup_platform(hass, config, add_devices, discovery_info=None):...\n", "\"\"\"docstring\"\"\"\n", "netatmo = hass.components.netatmo\n", "data = NetAtmoData(netatmo.NETATMO_AUTH, config.get(CONF_STATION, None))\n", "dev = []\n", "import pyatmo\n", "if CONF_MODULES in config:\n", "return None\n", "add_devices(dev, True)\n", "for module_name, monitored_conditions in config[CONF_MODULES].items():\n", "for module_name in data.get_module_names():\n", "if module_name not in data.get_module_names():\n", "for variable in data.station_data.monitoredConditions(module_name):\n", "_LOGGER.error('Module name: \"%s\" not found', module_name)\n", "for variable in monitored_conditions:\n", "if variable in SENSOR_TYPES.keys():\n", "dev.append(NetAtmoSensor(data, module_name, variable))\n", "dev.append(NetAtmoSensor(data, module_name, variable))\n", "_LOGGER.warning('Ignoring unknown var %s for mod %s', variable, module_name)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Import'", "Condition", "Return'", "Expr'", "For", "For", "Condition", "For", "Expr'", "For", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_0, VAR_4=None):...\n", "VAR_12 = []\n", "VAR_11 = self.find_ord(VAR_0)\n", "for node, dep, lbl in self.edges:\n", "if VAR_4:\n", "return VAR_12\n", "if dep == VAR_11 and lbl == VAR_4:\n", "if dep == VAR_11:\n", "VAR_12.append(self.nodes[node])\n", "VAR_12.append(self.nodes[node])\n" ]
[ "def get_dependents(self, obj, label=None):...\n", "decendents = []\n", "this_ord = self.find_ord(obj)\n", "for node, dep, lbl in self.edges:\n", "if label:\n", "return decendents\n", "if dep == this_ord and lbl == label:\n", "if dep == this_ord:\n", "decendents.append(self.nodes[node])\n", "decendents.append(self.nodes[node])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Condition", "Return'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_14(VAR_9):...\n", "VAR_36 = []\n", "for VAR_11 in VAR_9:\n", "if VAR_11.name == 'start_day':\n", "return VAR_36\n", "VAR_36.append({'command': VAR_11.name, 'start_day': VAR_39(VAR_11.data)})\n", "if VAR_11.name == 'number_of_days':\n", "VAR_36.append({'command': VAR_11.name, 'number_of_days': VAR_11.data})\n", "if VAR_11.name == 'exe_models':\n", "VAR_36.append({'command': VAR_11.name, 'include': VAR_11.data})\n", "if VAR_11.name == 'change_input_series_one_model':\n", "for entry in VAR_11.entries:\n", "if VAR_11.name == 'change_input_series_all_models':\n", "VAR_36.append({'command': VAR_11.name, 'model_system_name': entry.\n model_system_name.data, 'input_source_initial': entry.\n input_source_initial.data, 'input_source_final': entry.\n input_source_final.data})\n", "for entry in VAR_11.entries:\n", "if VAR_11.name == 'change_timeseries_value_several_days':\n", "VAR_36.append({'command': VAR_11.name, 'input_source_initial': entry.\n input_source_initial.data, 'input_source_final': entry.\n input_source_final.data})\n", "for entry in VAR_11.entries:\n", "if VAR_11.name == 'change_timeseries_value_several_days_add_delta':\n", "VAR_36.append({'command': VAR_11.name, 'input_source_initial': entry.\n input_source_initial.data, 'start_day': VAR_39(entry.start_day.data),\n 'number_of_days': entry.number_of_days.data, 'new_value': entry.\n new_value.data})\n", "for entry in VAR_11.entries:\n", "VAR_36.append({'command': VAR_11.name, 'input_source_initial': entry.\n input_source_initial.data, 'start_day': VAR_39(entry.start_day.data),\n 'number_of_days': entry.number_of_days.data, 'delta': entry.delta.data})\n" ]
[ "def get_commands(form):...\n", "result = []\n", "for field in form:\n", "if field.name == 'start_day':\n", "return result\n", "result.append({'command': field.name, 'start_day': str(field.data)})\n", "if field.name == 'number_of_days':\n", "result.append({'command': field.name, 'number_of_days': field.data})\n", "if field.name == 'exe_models':\n", "result.append({'command': field.name, 'include': field.data})\n", "if field.name == 'change_input_series_one_model':\n", "for entry in field.entries:\n", "if field.name == 'change_input_series_all_models':\n", "result.append({'command': field.name, 'model_system_name': entry.\n model_system_name.data, 'input_source_initial': entry.\n input_source_initial.data, 'input_source_final': entry.\n input_source_final.data})\n", "for entry in field.entries:\n", "if field.name == 'change_timeseries_value_several_days':\n", "result.append({'command': field.name, 'input_source_initial': entry.\n input_source_initial.data, 'input_source_final': entry.\n input_source_final.data})\n", "for entry in field.entries:\n", "if field.name == 'change_timeseries_value_several_days_add_delta':\n", "result.append({'command': field.name, 'input_source_initial': entry.\n input_source_initial.data, 'start_day': str(entry.start_day.data),\n 'number_of_days': entry.number_of_days.data, 'new_value': entry.\n new_value.data})\n", "for entry in field.entries:\n", "result.append({'command': field.name, 'input_source_initial': entry.\n input_source_initial.data, 'start_day': str(entry.start_day.data),\n 'number_of_days': entry.number_of_days.data, 'delta': entry.delta.data})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Condition", "Return'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "For", "Condition", "Expr'", "For", "Condition", "Expr'", "For", "Condition", "Expr'", "For", "Expr'" ]
[ "def FUNC_13(VAR_25):...\n", "VAR_40 = []\n", "if os.path.exists(VAR_25):\n", "VAR_40 = json.loads(ocf.read())\n", "if not isinstance(VAR_40, list):\n", "return VAR_40\n" ]
[ "def load_list_from_json(json_file):...\n", "json_obj = []\n", "if os.path.exists(json_file):\n", "json_obj = json.loads(ocf.read())\n", "if not isinstance(json_obj, list):\n", "return json_obj\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "Return'" ]
[ "def FUNC_12():...\n", "VAR_18 = requests.get(FUNC_2('healthy'))\n", "VAR_18.raise_for_status()\n", "return VAR_18.json()\n" ]
[ "def _ServerIsHealthy():...\n", "response = requests.get(_BuildUri('healthy'))\n", "response.raise_for_status()\n", "return response.json()\n" ]
[ 0, 7, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_5 = ConfigParser()\n", "VAR_5.read(VAR_4)\n", "VAR_6 = {param[0]: param[1] for param in VAR_5.items(VAR_0)}\n", "logging.info('Loaded %d parameters for section %s', len(VAR_6), VAR_0)\n", "return VAR_6\n" ]
[ "def read_config(section):...\n", "parser = ConfigParser()\n", "parser.read(CONFIG_INI)\n", "config_params = {param[0]: param[1] for param in parser.items(section)}\n", "logging.info('Loaded %d parameters for section %s', len(config_params), section\n )\n", "return config_params\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_11):...\n", "" ]
[ "def _is_ipv6(self, host):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_6():...\n", "if not request.method in VAR_0:\n", "return True\n", "if not request.environ.get('AUTH_TYPE') == 'cookie':\n", "return True\n", "if config.get('skip_authentication'):\n", "return True\n", "if request.environ.get('HTTP_REFERER'):\n", "VAR_7 = urlparse(request.environ.get('HTTP_REFERER'))\n", "if request.method == 'GET' and FUNC_4():\n", "VAR_8 = VAR_7.hostname\n", "return True\n", "return False\n", "if VAR_7.port:\n", "VAR_8 += ':' + str(VAR_7.port)\n", "if VAR_8.endswith(request.environ['adhocracy.domain']):\n", "if request.method != 'GET':\n", "return True\n" ]
[ "def check():...\n", "if not request.method in methods:\n", "return True\n", "if not request.environ.get('AUTH_TYPE') == 'cookie':\n", "return True\n", "if config.get('skip_authentication'):\n", "return True\n", "if request.environ.get('HTTP_REFERER'):\n", "ref_url = urlparse(request.environ.get('HTTP_REFERER'))\n", "if request.method == 'GET' and has_token():\n", "ref_host = ref_url.hostname\n", "return True\n", "return False\n", "if ref_url.port:\n", "ref_host += ':' + str(ref_url.port)\n", "if ref_host.endswith(request.environ['adhocracy.domain']):\n", "if request.method != 'GET':\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Condition", "Return'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Return'", "Condition", "AugAssign'", "Condition", "Condition", "Return'" ]
[ "def FUNC_31(self):...\n", "if VAR_54.flags.in_install:\n", "return\n", "if self.meta.issingle:\n", "return\n", "VAR_43 = 'varchar', 'int', 'bigint'\n", "for VAR_16, VAR_9 in iteritems(self.get_valid_dict()):\n", "VAR_25 = self.meta.get_field(VAR_16)\n", "if not VAR_25 or VAR_25.fieldtype == 'Check':\n", "VAR_58 = type_map[VAR_25.fieldtype][0] or None\n", "VAR_59 = type_map[VAR_25.fieldtype][1] or None\n", "if VAR_25 and VAR_25.fieldtype in type_map and VAR_58 in VAR_43:\n", "VAR_69 = cint(VAR_25.get('length')) or cint(VAR_59)\n", "if len(cstr(VAR_9)) > VAR_69:\n", "if self.parentfield and self.idx:\n", "VAR_73 = _('{0}, Row {1}').format(_(self.doctype), self.idx)\n", "VAR_73 = '{0} {1}'.format(_(self.doctype), self.name)\n", "VAR_54.throw(_(\n \"{0}: '{1}' ({3}) will get truncated, as max characters allowed is {2}\"\n ).format(VAR_73, _(VAR_25.label), VAR_69, VAR_9), VAR_54.\n CharacterLengthExceededError, title=_('Value too big'))\n" ]
[ "def _validate_length(self):...\n", "if frappe.flags.in_install:\n", "return\n", "if self.meta.issingle:\n", "return\n", "column_types_to_check_length = 'varchar', 'int', 'bigint'\n", "for fieldname, value in iteritems(self.get_valid_dict()):\n", "df = self.meta.get_field(fieldname)\n", "if not df or df.fieldtype == 'Check':\n", "column_type = type_map[df.fieldtype][0] or None\n", "default_column_max_length = type_map[df.fieldtype][1] or None\n", "if df and df.fieldtype in type_map and column_type in column_types_to_check_length:\n", "max_length = cint(df.get('length')) or cint(default_column_max_length)\n", "if len(cstr(value)) > max_length:\n", "if self.parentfield and self.idx:\n", "reference = _('{0}, Row {1}').format(_(self.doctype), self.idx)\n", "reference = '{0} {1}'.format(_(self.doctype), self.name)\n", "frappe.throw(_(\n \"{0}: '{1}' ({3}) will get truncated, as max characters allowed is {2}\"\n ).format(reference, _(df.label), max_length, value), frappe.\n CharacterLengthExceededError, title=_('Value too big'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Assign'", "For", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = jc.Contract()\n", "return st.OperationContract(self.agent.make_create_app_operation(VAR_1=self\n .bindings, application=self.TEST_APP), VAR_5=contract)\n" ]
[ "def create_app(self):...\n", "\"\"\"docstring\"\"\"\n", "contract = jc.Contract()\n", "return st.OperationContract(self.agent.make_create_app_operation(bindings=\n self.bindings, application=self.TEST_APP), contract=contract)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_6(self, VAR_21):...\n", "if VAR_21:\n", "VAR_106 = int(VAR_21, 36)\n", "if self.redirect:\n", "return Link._byID(VAR_106, True)\n", "abort(404, 'page not found')\n", "return None\n" ]
[ "def run(self, link_id):...\n", "if link_id:\n", "aid = int(link_id, 36)\n", "if self.redirect:\n", "return Link._byID(aid, True)\n", "abort(404, 'page not found')\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_0(self):...\n", "VAR_1 = bot.Bot(None, {'dimensions': {'foo': 'bar'}},\n 'https://localhost:1/', '1234-1a2b3c4-tainted-joe', 'base_dir', None)\n", "self.assertEqual({'foo': 'bar'}, VAR_1.dimensions)\n", "self.assertEqual(os.path.join(os.path.dirname(VAR_0), 'swarming_bot.zip'),\n VAR_1.swarming_bot_zip)\n", "self.assertEqual('1234-1a2b3c4-tainted-joe', VAR_1.server_version)\n", "self.assertEqual('base_dir', VAR_1.base_dir)\n" ]
[ "def test_bot(self):...\n", "obj = bot.Bot(None, {'dimensions': {'foo': 'bar'}}, 'https://localhost:1/',\n '1234-1a2b3c4-tainted-joe', 'base_dir', None)\n", "self.assertEqual({'foo': 'bar'}, obj.dimensions)\n", "self.assertEqual(os.path.join(os.path.dirname(THIS_FILE),\n 'swarming_bot.zip'), obj.swarming_bot_zip)\n", "self.assertEqual('1234-1a2b3c4-tainted-joe', obj.server_version)\n", "self.assertEqual('base_dir', obj.base_dir)\n" ]
[ 0, 5, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_7(self, VAR_3):...\n", "if VAR_3.name in self.host_names:\n", "self.hosts.remove(VAR_3)\n", "self._hosts.remove(VAR_3.name)\n", "VAR_3.remove_group(self)\n", "self.clear_hosts_cache()\n" ]
[ "def remove_host(self, host):...\n", "if host.name in self.host_names:\n", "self.hosts.remove(host)\n", "self._hosts.remove(host.name)\n", "host.remove_group(self)\n", "self.clear_hosts_cache()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@FUNC_3...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = {'css_file': self.css_file, 'js_file': self.js_file_url,\n 'navbar_tab_id': self.navbar_tab_id, 'page_title': self.navbar_tab_title}\n", "self.reply(self.template_file, VAR_15)\n" ]
[ "@redirect_ui_on_replica...\n", "\"\"\"docstring\"\"\"\n", "env = {'css_file': self.css_file, 'js_file': self.js_file_url,\n 'navbar_tab_id': self.navbar_tab_id, 'page_title': self.navbar_tab_title}\n", "self.reply(self.template_file, env)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Expr'" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "VAR_20 = self._create_host(VAR_6, VAR_9)\n", "VAR_21 = self.common.create_vlun(VAR_6, VAR_20)\n", "VAR_22 = self.common.get_ports()\n", "self.common.client_logout()\n", "VAR_23 = {'driver_volume_type': 'fibre_channel', 'data': {'target_lun':\n VAR_21['lun'], 'target_discovered': True, 'target_wwn': VAR_22['FC']}}\n", "return VAR_23\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "host = self._create_host(volume, connector)\n", "vlun = self.common.create_vlun(volume, host)\n", "ports = self.common.get_ports()\n", "self.common.client_logout()\n", "info = {'driver_volume_type': 'fibre_channel', 'data': {'target_lun': vlun[\n 'lun'], 'target_discovered': True, 'target_wwn': ports['FC']}}\n", "return info\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_7(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = block.sysfs_to_devpath(VAR_1)\n", "util.subp(['cryptsetup', 'remove', VAR_11], capture=True)\n" ]
[ "def shutdown_crypt(device):...\n", "\"\"\"docstring\"\"\"\n", "blockdev = block.sysfs_to_devpath(device)\n", "util.subp(['cryptsetup', 'remove', blockdev], capture=True)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_5(self, VAR_2, VAR_3, VAR_4, *VAR_5):...\n", "self.write_data({'type': 'new_version_available', 'event': {'version':\n VAR_5[0]}})\n" ]
[ "def on_new_version_available(self, subject, changetype, objectID, *args):...\n", "self.write_data({'type': 'new_version_available', 'event': {'version': args\n [0]}})\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@tornado.gen.coroutine...\n", "VAR_17 = 'DELETE FROM reports WHERE date = %s'\n", "VAR_18 = VAR_5,\n", "VAR_19 = yield VAR_1.execute(query=sql, VAR_18=params)\n", "return VAR_19.fetchone()\n" ]
[ "@tornado.gen.coroutine...\n", "sql = 'DELETE FROM reports WHERE date = %s'\n", "params = date,\n", "cursor = yield tx.execute(query=sql, params=params)\n", "return cursor.fetchone()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_5(self):...\n", "" ]
[ "def test_run_interactive_shell_command_kwargs_delegation(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@utils.synchronized('3par', external=True)...\n", "" ]
[ "@utils.synchronized('3par', external=True)...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "@db_session...\n", "\"\"\"docstring\"\"\"\n", "VAR_37 = {'id': self.rowid, 'name': self.title, 'infohash': hexlify(self.\n infohash), 'size': self.size, 'category': self.tags, 'num_seeders':\n self.health.seeders, 'num_leechers': self.health.leechers,\n 'last_tracker_check': self.health.last_check, 'status': self.status}\n", "if VAR_29:\n", "VAR_37['trackers'] = [VAR_39.url for VAR_39 in self.health.trackers]\n", "return VAR_37\n" ]
[ "@db_session...\n", "\"\"\"docstring\"\"\"\n", "simple_dict = {'id': self.rowid, 'name': self.title, 'infohash': hexlify(\n self.infohash), 'size': self.size, 'category': self.tags, 'num_seeders':\n self.health.seeders, 'num_leechers': self.health.leechers,\n 'last_tracker_check': self.health.last_check, 'status': self.status}\n", "if include_trackers:\n", "simple_dict['trackers'] = [tracker.url for tracker in self.health.trackers]\n", "return simple_dict\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_4(self, VAR_9, VAR_3):...\n", "if isinstance(VAR_9, slice):\n", "VAR_30 = (\n f\"[{VAR_9.start or ''}:{VAR_9.stop or ''}{VAR_9.step and ':' + VAR_9.step or ''}]\"\n )\n", "VAR_30 = f'[{VAR_9!r}]'\n", "self._r_steps_.append((VAR_30, VAR_3))\n" ]
[ "def log_getitem(self, key_name, roamer):...\n", "if isinstance(key_name, slice):\n", "item_desc = (\n f\"[{key_name.start or ''}:{key_name.stop or ''}{key_name.step and ':' + key_name.step or ''}]\"\n )\n", "item_desc = f'[{key_name!r}]'\n", "self._r_steps_.append((item_desc, roamer))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_6(self):...\n", "VAR_16 = self.parser.require('cppwd', 64)\n", "if not VAR_16 in self.auth.iuser:\n", "VAR_36 = [u'Set-Cookie: cppwd=x; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT'\n ]\n", "VAR_36 = ['Set-Cookie: cppwd={}; Path=/'.format(VAR_16)]\n", "self.loud_reply(u'bad_ppwd \"{}\"'.format(VAR_16), VAR_6=h)\n", "self.loud_reply(u'login_ok', VAR_6=h)\n" ]
[ "def handle_login(self):...\n", "pwd = self.parser.require('cppwd', 64)\n", "if not pwd in self.auth.iuser:\n", "h = [u'Set-Cookie: cppwd=x; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT']\n", "h = ['Set-Cookie: cppwd={}; Path=/'.format(pwd)]\n", "self.loud_reply(u'bad_ppwd \"{}\"'.format(pwd), headers=h)\n", "self.loud_reply(u'login_ok', headers=h)\n" ]
[ 0, 0, 1, 1, 0, 1, 1 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_0(self, **VAR_34):...\n", "\"\"\"docstring\"\"\"\n", "for arg in VAR_34:\n", "if hasattr(self, arg):\n", "self._check_usage()\n", "setattr(self, arg, VAR_34[arg])\n" ]
[ "def update(self, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "for arg in kwargs:\n", "if hasattr(self, arg):\n", "self._check_usage()\n", "setattr(self, arg, kwargs[arg])\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_7(VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "@wraps(VAR_7)...\n", "return VAR_7(*VAR_8, **kwargs)\n", "current_app.logger.warning(e.message, exc_info=True)\n", "return FUNC_16\n", "return FUNC_15(e.remote, e.response, e.code, e.uri, e.description)\n" ]
[ "def oauth_error_handler(f):...\n", "\"\"\"docstring\"\"\"\n", "@wraps(f)...\n", "return f(*args, **kwargs)\n", "current_app.logger.warning(e.message, exc_info=True)\n", "return inner\n", "return oauth2_handle_error(e.remote, e.response, e.code, e.uri, e.description)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_3(self):...\n", "if self.check() == False:\n", "return self.redirect('/')\n", "self.check_xsrf()\n", "VAR_6 = self.get_arg('oldpassword')\n", "VAR_7 = self.get_arg('password')\n", "VAR_8 = self.get_arg('password2')\n", "VAR_3 = dbapi.User()\n", "VAR_0 = ''\n", "if VAR_7 == VAR_8 and VAR_3.check_user(self.email, VAR_6) != -1:\n", "VAR_10 = VAR_3.update_password(self.email, VAR_7)\n", "if VAR_7 != VAR_8:\n", "if VAR_10 != -1:\n", "VAR_0 = 'new password inconsistent'\n", "VAR_0 = 'old password incorrect'\n", "VAR_0 = 'Update Password Successfully'\n", "VAR_0 = 'Update failure, try again later'\n", "return self.get(VAR_0)\n" ]
[ "def post(self):...\n", "if self.check() == False:\n", "return self.redirect('/')\n", "self.check_xsrf()\n", "oldpassword = self.get_arg('oldpassword')\n", "password = self.get_arg('password')\n", "password2 = self.get_arg('password2')\n", "user = dbapi.User()\n", "error = ''\n", "if password == password2 and user.check_user(self.email, oldpassword) != -1:\n", "result = user.update_password(self.email, password)\n", "if password != password2:\n", "if result != -1:\n", "error = 'new password inconsistent'\n", "error = 'old password incorrect'\n", "error = 'Update Password Successfully'\n", "error = 'Update failure, try again later'\n", "return self.get(error)\n" ]
[ 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_6, VAR_7, VAR_8):...\n", "self.query_params = VAR_6\n", "self.column_id = VAR_7\n", "self.ordering_query_param = VAR_8\n", "self.query_order = VAR_6.get(VAR_8)\n", "self.current_columns = [int(col) for col in self.query_order.replace('-',\n '').split('.')] if self.query_order else []\n", "self.current_columns_length = len(self.current_columns)\n" ]
[ "def __init__(self, query_params, column_id, ordering_query_param):...\n", "self.query_params = query_params\n", "self.column_id = column_id\n", "self.ordering_query_param = ordering_query_param\n", "self.query_order = query_params.get(ordering_query_param)\n", "self.current_columns = [int(col) for col in self.query_order.replace('-',\n '').split('.')] if self.query_order else []\n", "self.current_columns_length = len(self.current_columns)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "async def FUNC_4(self):...\n", "if self._loaded:\n", "await self._runon('stop')\n" ]
[ "async def stop(self):...\n", "if self._loaded:\n", "await self._runon('stop')\n" ]
[ 0, 0, 0 ]
[ "AsyncFunctionDef'", "Condition", "Expr'" ]
[ "def __init__(self, VAR_20, VAR_21):...\n", "self.start = VAR_20\n", "self.end = VAR_21\n" ]
[ "def __init__(self, start, end):...\n", "self.start = start\n", "self.end = end\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def FUNC_19(self, *VAR_18):...\n", "\"\"\"docstring\"\"\"\n", "self.order.append(list(VAR_18))\n" ]
[ "def add(self, *rulenames):...\n", "\"\"\"docstring\"\"\"\n", "self.order.append(list(rulenames))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_6(self, VAR_41):...\n", "if VAR_41:\n", "return self.error()\n", "return Thing._by_fullname(VAR_41, False, data=True)\n" ]
[ "def run(self, fullname):...\n", "if fullname:\n", "return self.error()\n", "return Thing._by_fullname(fullname, False, data=True)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "@property...\n", "if self._snakefile is None:\n", "return os.path.abspath(os.path.join(self.workdir, 'Snakefile'))\n", "if not os.path.isabs(self._snakefile):\n", "return os.path.abspath(os.path.join(self.workflow.basedir, self._snakefile))\n", "return self._snakefile\n" ]
[ "@property...\n", "if self._snakefile is None:\n", "return os.path.abspath(os.path.join(self.workdir, 'Snakefile'))\n", "if not os.path.isabs(self._snakefile):\n", "return os.path.abspath(os.path.join(self.workflow.basedir, self._snakefile))\n", "return self._snakefile\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=False,\n VAR_10=self.base_url))\n", "self.do_step(LoginRequest(self.browser, self.username, self.password,\n VAR_10=self.base_url))\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=True,\n VAR_10=self.base_url))\n" ]
[ "def login(self):...\n", "\"\"\"docstring\"\"\"\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=False,\n base_url=self.base_url))\n", "self.do_step(LoginRequest(self.browser, self.username, self.password,\n base_url=self.base_url))\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=True,\n base_url=self.base_url))\n" ]
[ 0, 0, 5, 5, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'" ]
[ "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", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_14(self, VAR_4, VAR_33, VAR_18=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_18 is not None:\n", "self.flags.ignore_permissions = VAR_18\n", "if isinstance(VAR_4, dict):\n", "VAR_4 = [VAR_4]\n", "for VAR_34 in VAR_4:\n", "if isinstance(VAR_34, string_types):\n", "VAR_33.append(VAR_34)\n", "VAR_33.append(self.prepare_filter_condition(VAR_34))\n" ]
[ "def build_filter_conditions(self, filters, conditions, ignore_permissions=None...\n", "\"\"\"docstring\"\"\"\n", "if ignore_permissions is not None:\n", "self.flags.ignore_permissions = ignore_permissions\n", "if isinstance(filters, dict):\n", "filters = [filters]\n", "for f in filters:\n", "if isinstance(f, string_types):\n", "conditions.append(f)\n", "conditions.append(self.prepare_filter_condition(f))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "For", "Condition", "Expr'", "Expr'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = (\n f\"INSERT INTO users (chat_id, first_name, nickname, last_name, language) VALUES ({VAR_7.chat_id}, '{VAR_7.first_name}', '{VAR_7.nickname}', '{VAR_7.last_name}', '{VAR_7.language}')\"\n )\n", "db.add(VAR_10)\n", "log.error('Cannot add user to the database')\n", "log.info(f'User {VAR_7} was successfully added to the users db')\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "query = (\n f\"INSERT INTO users (chat_id, first_name, nickname, last_name, language) VALUES ({user.chat_id}, '{user.first_name}', '{user.nickname}', '{user.last_name}', '{user.language}')\"\n )\n", "db.add(query)\n", "log.error('Cannot add user to the database')\n", "log.info(f'User {user} was successfully added to the users db')\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_11.event...\n", "if str(VAR_12.guild.id) != VAR_7:\n", "return\n", "if VAR_13 and str(VAR_12.author.id) not in VAR_13:\n", "return\n", "VAR_14 = ''\n", "if VAR_12.content.startswith(VAR_1):\n", "VAR_14 = VAR_1\n", "if VAR_12.content.startswith('<@' + str(VAR_5) + '>'):\n", "async def FUNC_3():...\n", "VAR_14 = '@{}#{}'.format(VAR_11.user.name, VAR_11.user.discriminator)\n", "return\n", "VAR_12.channel.send('Command list:\\n' + '\\n' +\n '`help` - Shows this help text\\n' +\n '`whitelist` - Add user(s) to the whitelist')\n", "VAR_9 = VAR_12.content.strip().split()[1:]\n", "if not VAR_9:\n", "await VAR_12.channel.send('Usage: `{} whitelist <username> [username...]`'.\n format(VAR_14), delete_after=30)\n", "if VAR_9[0] == 'help':\n", "await VAR_12.delete()\n", "await FUNC_3()\n", "if VAR_9[0] == 'whitelist':\n", "if len(VAR_9) < 1:\n", "await FUNC_3()\n", "await FUNC_0(' '.join(VAR_9[1:]))\n" ]
[ "@bot.event...\n", "if str(message.guild.id) != discord_bot_server:\n", "return\n", "if discord_bot_owner and str(message.author.id) not in discord_bot_owner:\n", "return\n", "prefix = ''\n", "if message.content.startswith(COMMAND_PREFIX):\n", "prefix = COMMAND_PREFIX\n", "if message.content.startswith('<@' + str(discord_id) + '>'):\n", "async def help():...\n", "prefix = '@{}#{}'.format(bot.user.name, bot.user.discriminator)\n", "return\n", "message.channel.send('Command list:\\n' + '\\n' +\n '`help` - Shows this help text\\n' +\n '`whitelist` - Add user(s) to the whitelist')\n", "args = message.content.strip().split()[1:]\n", "if not args:\n", "await message.channel.send('Usage: `{} whitelist <username> [username...]`'\n .format(prefix), delete_after=30)\n", "if args[0] == 'help':\n", "await message.delete()\n", "await help()\n", "if args[0] == 'whitelist':\n", "if len(args) < 1:\n", "await help()\n", "await whitelist(' '.join(args[1:]))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Condition", "AsyncFunctionDef'", "Assign'", "Return'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_2, VAR_3=None, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = self.r_handler.get_query_argument(VAR_2, None)\n", "if not VAR_12:\n", "return VAR_4\n", "if VAR_3 is bool:\n", "return VAR_12.lower() == 'true'\n", "if VAR_3 is FUNC_13:\n", "return VAR_12.split(',')\n", "if VAR_3 is not None:\n", "return VAR_3(VAR_12)\n", "return VAR_12\n" ]
[ "def _query_arg(self, argument_name, output=None, default=None):...\n", "\"\"\"docstring\"\"\"\n", "arg = self.r_handler.get_query_argument(argument_name, None)\n", "if not arg:\n", "return default\n", "if output is bool:\n", "return arg.lower() == 'true'\n", "if output is list:\n", "return arg.split(',')\n", "if output is not None:\n", "return output(arg)\n", "return arg\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Condition", "Return'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_0(self):...\n", "super(CLASS_0, self).setUp()\n", "self.configuration = mox.MockObject(conf.Configuration)\n", "self.configuration.append_config_values(mox.IgnoreArg())\n", "self.configuration.san_is_local = False\n", "self.configuration.san_ip = '10.0.0.1'\n", "self.configuration.san_login = 'foo'\n", "self.configuration.san_password = 'bar'\n", "self.configuration.san_ssh_port = 16022\n", "self.configuration.san_thin_provision = True\n", "self.configuration.eqlx_pool = 'non-default'\n", "self.configuration.eqlx_use_chap = True\n", "self.configuration.eqlx_group_name = 'group-0'\n", "self.configuration.eqlx_cli_timeout = 30\n", "self.configuration.eqlx_cli_max_retries = 5\n", "self.configuration.eqlx_chap_login = 'admin'\n", "self.configuration.eqlx_chap_password = 'password'\n", "self.configuration.volume_name_template = 'volume_%s'\n", "self._context = context.get_admin_context()\n", "self.driver = eqlx.DellEQLSanISCSIDriver(configuration=self.configuration)\n", "self.volume_name = 'fakevolume'\n", "self.volid = 'fakeid'\n", "self.connector = {'ip': '10.0.0.2', 'initiator':\n 'iqn.1993-08.org.debian:01:222', 'host': 'fakehost'}\n", "self.fake_iqn = 'iqn.2003-10.com.equallogic:group01:25366:fakev'\n", "self.driver._group_ip = '10.0.1.6'\n", "self.properties = {'target_discoverd': True, 'target_portal': '%s:3260' %\n self.driver._group_ip, 'target_iqn': self.fake_iqn, 'volume_id': 1}\n", "self._model_update = {'provider_location': '%s:3260,1 %s 0' % (self.driver.\n _group_ip, self.fake_iqn), 'provider_auth': 'CHAP %s %s' % (self.\n configuration.eqlx_chap_login, self.configuration.eqlx_chap_password)}\n" ]
[ "def setUp(self):...\n", "super(DellEQLSanISCSIDriverTestCase, self).setUp()\n", "self.configuration = mox.MockObject(conf.Configuration)\n", "self.configuration.append_config_values(mox.IgnoreArg())\n", "self.configuration.san_is_local = False\n", "self.configuration.san_ip = '10.0.0.1'\n", "self.configuration.san_login = 'foo'\n", "self.configuration.san_password = 'bar'\n", "self.configuration.san_ssh_port = 16022\n", "self.configuration.san_thin_provision = True\n", "self.configuration.eqlx_pool = 'non-default'\n", "self.configuration.eqlx_use_chap = True\n", "self.configuration.eqlx_group_name = 'group-0'\n", "self.configuration.eqlx_cli_timeout = 30\n", "self.configuration.eqlx_cli_max_retries = 5\n", "self.configuration.eqlx_chap_login = 'admin'\n", "self.configuration.eqlx_chap_password = 'password'\n", "self.configuration.volume_name_template = 'volume_%s'\n", "self._context = context.get_admin_context()\n", "self.driver = eqlx.DellEQLSanISCSIDriver(configuration=self.configuration)\n", "self.volume_name = 'fakevolume'\n", "self.volid = 'fakeid'\n", "self.connector = {'ip': '10.0.0.2', 'initiator':\n 'iqn.1993-08.org.debian:01:222', 'host': 'fakehost'}\n", "self.fake_iqn = 'iqn.2003-10.com.equallogic:group01:25366:fakev'\n", "self.driver._group_ip = '10.0.1.6'\n", "self.properties = {'target_discoverd': True, 'target_portal': '%s:3260' %\n self.driver._group_ip, 'target_iqn': self.fake_iqn, 'volume_id': 1}\n", "self._model_update = {'provider_location': '%s:3260,1 %s 0' % (self.driver.\n _group_ip, self.fake_iqn), 'provider_auth': 'CHAP %s %s' % (self.\n configuration.eqlx_chap_login, self.configuration.eqlx_chap_password)}\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 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_1():...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = 'testing inband sql injection on parameter '\n", "VAR_3 += \"'%s'\" % kb.injParameter\n", "logger.info(VAR_3)\n", "VAR_4 = ''\n", "VAR_0 = agent.prefixQuery(' UNION ALL SELECT NULL')\n", "for VAR_1 in (queries[kb.dbms].comment, ''):\n", "VAR_4 = FUNC_0(VAR_0, VAR_1)\n", "if kb.unionCount:\n", "if VAR_4:\n", "VAR_3 = 'the target url could be affected by an '\n", "VAR_8 = 'the target url is not affected by an '\n", "setUnion(VAR_1, VAR_4.count('NULL'))\n", "VAR_3 += 'inband sql injection vulnerability'\n", "VAR_8 += 'inband sql injection vulnerability'\n", "logger.info(VAR_3)\n", "logger.warn(VAR_8)\n", "return VAR_4\n" ]
[ "def unionTest():...\n", "\"\"\"docstring\"\"\"\n", "logMsg = 'testing inband sql injection on parameter '\n", "logMsg += \"'%s'\" % kb.injParameter\n", "logger.info(logMsg)\n", "value = ''\n", "query = agent.prefixQuery(' UNION ALL SELECT NULL')\n", "for comment in (queries[kb.dbms].comment, ''):\n", "value = __effectiveUnionTest(query, comment)\n", "if kb.unionCount:\n", "if value:\n", "logMsg = 'the target url could be affected by an '\n", "warnMsg = 'the target url is not affected by an '\n", "setUnion(comment, value.count('NULL'))\n", "logMsg += 'inband sql injection vulnerability'\n", "warnMsg += 'inband sql injection vulnerability'\n", "logger.info(logMsg)\n", "logger.warn(warnMsg)\n", "return value\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "AugAssign'", "Expr'", "Assign'", "Assign'", "For", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Expr'", "AugAssign'", "AugAssign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_4(self):...\n", "self.run_test_case(self.scenario.upsert_load_balancer())\n" ]
[ "def test_a_upsert_load_balancer(self):...\n", "self.run_test_case(self.scenario.upsert_load_balancer())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __init__(self, VAR_37=None, VAR_38=None, VAR_39=False):...\n", "\"\"\"docstring\"\"\"\n", "list.__init__(self)\n", "self._names = dict()\n", "if VAR_37:\n", "self.extend(map(str, VAR_37) if VAR_39 else VAR_37)\n", "if VAR_38:\n", "if isinstance(VAR_37, CLASS_2):\n", "for VAR_44, item in VAR_38.items():\n", "self.take_names(VAR_37.get_names())\n", "self.append(item)\n", "self.add_name(VAR_44)\n" ]
[ "def __init__(self, toclone=None, fromdict=None, plainstr=False):...\n", "\"\"\"docstring\"\"\"\n", "list.__init__(self)\n", "self._names = dict()\n", "if toclone:\n", "self.extend(map(str, toclone) if plainstr else toclone)\n", "if fromdict:\n", "if isinstance(toclone, Namedlist):\n", "for key, item in fromdict.items():\n", "self.take_names(toclone.get_names())\n", "self.append(item)\n", "self.add_name(key)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Condition", "For", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_3(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = VAR_5[:]\n", "for request in VAR_5:\n", "self.assertEqual(tuple, request.__class__)\n", "self.assertEqual([], self._requests)\n", "self.assertIn(len(request), (3, 4))\n", "self._requests = VAR_5\n" ]
[ "def expected_requests(self, requests):...\n", "\"\"\"docstring\"\"\"\n", "requests = requests[:]\n", "for request in requests:\n", "self.assertEqual(tuple, request.__class__)\n", "self.assertEqual([], self._requests)\n", "self.assertIn(len(request), (3, 4))\n", "self._requests = requests\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Expr'", "Expr'", "Assign'" ]
[ "def FUNC_7(self, VAR_0, VAR_1):...\n", "VAR_20 = tweet.objects.filter(hunt_id=Hunt(id=pk)).order_by('-datetime')\n", "return VAR_20\n" ]
[ "def get_queryset(self, request, pk):...\n", "query = tweet.objects.filter(hunt_id=Hunt(id=pk)).order_by('-datetime')\n", "return query\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_19(VAR_6):...\n", "return FUNC_7(VAR_6, 'X-Download-Options', 'noopen')\n" ]
[ "def validate_download_options(page):...\n", "return validate_security_header(page, 'X-Download-Options', 'noopen')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from __future__ import absolute_import\n", "from mock import MagicMock, patch\n", "from six.moves.urllib_parse import quote_plus\n", "from flask import url_for, session\n", "from invenio.testsuite import make_test_suite, run_test_suite\n", "from invenio.ext.sqlalchemy import db\n", "from .helpers import OAuth2ClientTestCase\n", "def FUNC_0(self):...\n", "VAR_8 = lambda x: dict(request_token_params={'scope': ''}, base_url=\n 'https://foo.bar/', request_token_url=None, access_token_url=\n 'https://foo.bar/oauth/access_token', authorize_url=\n 'https://foo.bar/oauth/authorize', consumer_key=x, consumer_secret=\n 'testsecret')\n", "self.app.config['OAUTHCLIENT_REMOTE_APPS'] = dict(test=dict(\n authorized_handler=self.handler, params=params('testid'), title=\n 'MyLinkedTestAccount'), test_invalid=dict(authorized_handler=self.\n handler_invalid, params=params('test_invalidid'), title='Test Invalid'),\n full=dict(params=params('fullid'), title='Full'))\n", "self.handled_resp = None\n", "self.handled_remote = None\n", "self.handled_args = None\n", "self.handled_kwargs = None\n", "from invenio.modules.oauthclient.models import RemoteToken, RemoteAccount\n", "RemoteToken.query.delete()\n", "RemoteAccount.query.delete()\n", "db.session.commit()\n", "def FUNC_1(self):...\n", "self.handled_resp = None\n", "self.handled_remote = None\n", "self.handled_args = None\n", "self.handled_kwargs = None\n", "from invenio.modules.oauthclient.models import RemoteToken, RemoteAccount\n", "RemoteToken.query.delete()\n", "RemoteAccount.query.delete()\n", "db.session.commit()\n", "def FUNC_2(self, VAR_1, VAR_2, *VAR_3, **VAR_4):...\n", "self.handled_resp = VAR_1\n", "self.handled_remote = VAR_2\n", "self.handled_args = VAR_3\n", "self.handled_kwargs = VAR_4\n", "return 'TEST'\n" ]
[ "from __future__ import absolute_import\n", "from mock import MagicMock, patch\n", "from six.moves.urllib_parse import quote_plus\n", "from flask import url_for, session\n", "from invenio.testsuite import make_test_suite, run_test_suite\n", "from invenio.ext.sqlalchemy import db\n", "from .helpers import OAuth2ClientTestCase\n", "def setUp(self):...\n", "params = lambda x: dict(request_token_params={'scope': ''}, base_url=\n 'https://foo.bar/', request_token_url=None, access_token_url=\n 'https://foo.bar/oauth/access_token', authorize_url=\n 'https://foo.bar/oauth/authorize', consumer_key=x, consumer_secret=\n 'testsecret')\n", "self.app.config['OAUTHCLIENT_REMOTE_APPS'] = dict(test=dict(\n authorized_handler=self.handler, params=params('testid'), title=\n 'MyLinkedTestAccount'), test_invalid=dict(authorized_handler=self.\n handler_invalid, params=params('test_invalidid'), title='Test Invalid'),\n full=dict(params=params('fullid'), title='Full'))\n", "self.handled_resp = None\n", "self.handled_remote = None\n", "self.handled_args = None\n", "self.handled_kwargs = None\n", "from invenio.modules.oauthclient.models import RemoteToken, RemoteAccount\n", "RemoteToken.query.delete()\n", "RemoteAccount.query.delete()\n", "db.session.commit()\n", "def tearDown(self):...\n", "self.handled_resp = None\n", "self.handled_remote = None\n", "self.handled_args = None\n", "self.handled_kwargs = None\n", "from invenio.modules.oauthclient.models import RemoteToken, RemoteAccount\n", "RemoteToken.query.delete()\n", "RemoteAccount.query.delete()\n", "db.session.commit()\n", "def handler(self, resp, remote, *args, **kwargs):...\n", "self.handled_resp = resp\n", "self.handled_remote = remote\n", "self.handled_args = args\n", "self.handled_kwargs = kwargs\n", "return 'TEST'\n" ]
[ 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "ImportFrom'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "ImportFrom'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_6(self, VAR_27):...\n", "if VAR_27:\n", "VAR_27 = int(VAR_27, 36)\n", "return Comment._byID(VAR_27, True)\n" ]
[ "def run(self, cid):...\n", "if cid:\n", "cid = int(cid, 36)\n", "return Comment._byID(cid, True)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed('string', VAR_2='SD Card Errors')\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed(\n \"\"\"Guide For Checking SD Card For Errors\n- [H2testw Guide - Windows](https://3ds.guide/h2testw-(windows\\\\))\n- [F3 Guide - Linux](https://3ds.guide/f3-(linux\\\\))\n- [F3X Guide - Mac](https://3ds.guide/f3x-(mac\\\\))\"\"\"\n , title='SD Card Errors')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_1(VAR_2):...\n", "VAR_8 = psycopg2.connect('dbname=fluffy_bot user=censored password=Laumau11p')\n", "VAR_9 = VAR_8.cursor()\n", "VAR_9.execute(VAR_2)\n", "VAR_8.commit()\n", "VAR_9.close()\n", "VAR_8.close()\n" ]
[ "def update(query):...\n", "conn = psycopg2.connect('dbname=fluffy_bot user=censored password=Laumau11p')\n", "cur = conn.cursor()\n", "cur.execute(query)\n", "conn.commit()\n", "cur.close()\n", "conn.close()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(self, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "return authn_init_app('test.localhost', VAR_2)\n" ]
[ "def load_app(self, config):...\n", "\"\"\"docstring\"\"\"\n", "return authn_init_app('test.localhost', config)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@VAR_0.route('/login/<remote_app>/')...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1 not in oauth.remote_apps:\n", "return abort(404)\n", "VAR_2 = url_for('.authorized', VAR_1=remote_app, next=request.args.get(\n 'next') or request.referrer or None, _external=True)\n", "return oauth.remote_apps[VAR_1].authorize(callback=callback_url)\n" ]
[ "@blueprint.route('/login/<remote_app>/')...\n", "\"\"\"docstring\"\"\"\n", "if remote_app not in oauth.remote_apps:\n", "return abort(404)\n", "callback_url = url_for('.authorized', remote_app=remote_app, next=request.\n args.get('next') or request.referrer or None, _external=True)\n", "return oauth.remote_apps[remote_app].authorize(callback=callback_url)\n" ]
[ 0, 0, 0, 0, 5, 5 ]
[ "Condition", "Docstring", "Condition", "Return'", "Assign'", "Return'" ]
[ "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_24(self):...\n", "return self.authenticated\n" ]
[ "def is_authenticated(self):...\n", "return self.authenticated\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_6(self, VAR_6, VAR_7):...\n", "self.vars[VAR_6] = VAR_7\n" ]
[ "def set_variable(self, key, value):...\n", "self.vars[key] = value\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_0(VAR_0):...\n", "" ]
[ "def is_folder(path):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_6(self, VAR_16):...\n", "for line in filter(lambda error: bool(error.strip()), VAR_16):\n", "self.warn(line)\n" ]
[ "def _print_errors(self, errors):...\n", "for line in filter(lambda error: bool(error.strip()), errors):\n", "self.warn(line)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'" ]
[ "@inlineCallbacks...\n", "if self.http_server:\n", "yield maybeDeferred(self.http_server.stopListening)\n", "yield super(CLASS_0, self).tearDown()\n" ]
[ "@inlineCallbacks...\n", "if self.http_server:\n", "yield maybeDeferred(self.http_server.stopListening)\n", "yield super(TestMakeTorrent, self).tearDown()\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Expr'", "Expr'" ]
[ "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 unreachable (%s)', getHost(VAR_9), e)\n", "VAR_21 = FUNC_7(VAR_34.text)\n", "self.httpRequests += 1\n", "exit()\n", "if len(VAR_21) == 0:\n", "if self.logger.verbosity > 1:\n", "self.logger.critical('No HTML form found here')\n", "if len(VAR_21) > 1:\n", "printSimpleResponseObject(VAR_34)\n", "if self.logger.verbosity > 2:\n", "exit()\n", "self.logger.critical(\n '%s forms found containing file upload inputs, no way to choose which one to test.'\n , len(VAR_21))\n", "if len(VAR_21[0][1]) > 1:\n", "print('\\x1b[36m' + VAR_34.text + '\\x1b[m')\n", "if VAR_34.status_code < 200 or VAR_34.status_code > 300:\n", "exit()\n", "self.logger.critical(\n '%s file inputs found inside the same form, no way to choose which one to test.'\n , len(VAR_21[0]))\n", "self.inputName = VAR_21[0][1][0]['name']\n", "self.logger.critical('Server responded with following status : %s - %s',\n VAR_34.status_code, VAR_34.reason)\n", "exit()\n", "self.logger.debug('Found the following file upload input : %s', self.inputName)\n", "exit()\n", "VAR_22 = VAR_21[0][0]\n", "self.action = VAR_22['action']\n", "self.action = ''\n", "self.uploadUrl = urljoin(self.formUrl, self.action)\n", "self.logger.debug('Using following URL for file upload : %s', self.uploadUrl)\n", "if not self.uploadsFolder and not self.trueRegex:\n", "self.logger.warning(\n 'No uploads folder nor true regex defined, code execution detection will not be possible.'\n )\n", "if not self.uploadsFolder and self.trueRegex:\n", "print(\n 'No uploads path provided, code detection can still be done using true regex capturing group.'\n )\n", "VAR_40 = input(\n 'Do you want to use the True Regex for code execution detection ? [Y/n] ')\n", "if VAR_40.lower().startswith('y') or VAR_40 == '':\n", "VAR_43 = input('Preffix capturing group of the true regex with : ')\n", "self.logger.warning(\n 'Code execution detection will not be possible as there is no path nor regex pattern configured.'\n )\n", "VAR_44 = input('Suffix capturing group of the true regex with : ')\n", "self.codeExecUrlPattern = VAR_43 + '$captGroup$' + VAR_44\n" ]
[ "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 unreachable (%s)', getHost(initUrl), e)\n", "detectedForms = detectForms(initGet.text)\n", "self.httpRequests += 1\n", "exit()\n", "if len(detectedForms) == 0:\n", "if self.logger.verbosity > 1:\n", "self.logger.critical('No HTML form found here')\n", "if len(detectedForms) > 1:\n", "printSimpleResponseObject(initGet)\n", "if self.logger.verbosity > 2:\n", "exit()\n", "self.logger.critical(\n '%s forms found containing file upload inputs, no way to choose which one to test.'\n , len(detectedForms))\n", "if len(detectedForms[0][1]) > 1:\n", "print('\\x1b[36m' + initGet.text + '\\x1b[m')\n", "if initGet.status_code < 200 or initGet.status_code > 300:\n", "exit()\n", "self.logger.critical(\n '%s file inputs found inside the same form, no way to choose which one to test.'\n , len(detectedForms[0]))\n", "self.inputName = detectedForms[0][1][0]['name']\n", "self.logger.critical('Server responded with following status : %s - %s',\n initGet.status_code, initGet.reason)\n", "exit()\n", "self.logger.debug('Found the following file upload input : %s', self.inputName)\n", "exit()\n", "formDestination = detectedForms[0][0]\n", "self.action = formDestination['action']\n", "self.action = ''\n", "self.uploadUrl = urljoin(self.formUrl, self.action)\n", "self.logger.debug('Using following URL for file upload : %s', self.uploadUrl)\n", "if not self.uploadsFolder and not self.trueRegex:\n", "self.logger.warning(\n 'No uploads folder nor true regex defined, code execution detection will not be possible.'\n )\n", "if not self.uploadsFolder and self.trueRegex:\n", "print(\n 'No uploads path provided, code detection can still be done using true regex capturing group.'\n )\n", "cont = input(\n 'Do you want to use the True Regex for code execution detection ? [Y/n] ')\n", "if cont.lower().startswith('y') or cont == '':\n", "preffixPattern = input('Preffix capturing group of the true regex with : ')\n", "self.logger.warning(\n 'Code execution detection will not be possible as there is no path nor regex pattern configured.'\n )\n", "suffixPattern = input('Suffix capturing group of the true regex with : ')\n", "self.codeExecUrlPattern = preffixPattern + '$captGroup$' + suffixPattern\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "AugAssign'", "Expr'", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_3(self):...\n", "GenericRequest._prepare(self)\n", "self.files = list(zip(self.submission_format, self.filenames))\n" ]
[ "def _prepare(self):...\n", "GenericRequest._prepare(self)\n", "self.files = list(zip(self.submission_format, self.filenames))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'" ]
[ "def FUNC_39(self):...\n", "\"\"\"docstring\"\"\"\n", "self.cursor.execute('create table t1(a int, b varchar(10))')\n", "VAR_28 = [(1, 'good'), ('error', 'not an int'), (3, 'good')]\n", "self.assertRaises(pyodbc.Error, self.cursor.executemany,\n 'insert into t1(a, b) value (?, ?)', VAR_28)\n" ]
[ "def test_executemany_failure(self):...\n", "\"\"\"docstring\"\"\"\n", "self.cursor.execute('create table t1(a int, b varchar(10))')\n", "params = [(1, 'good'), ('error', 'not an int'), (3, 'good')]\n", "self.assertRaises(pyodbc.Error, self.cursor.executemany,\n 'insert into t1(a, b) value (?, ?)', params)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_10(self, VAR_4, VAR_0, VAR_1, VAR_8, VAR_2, VAR_3=None):...\n", "VAR_5 = VAR_4[:]\n", "VAR_5.append(b'')\n", "VAR_5.extend(self.make_req_msg(VAR_0, VAR_1, VAR_8, VAR_2, VAR_3))\n", "return VAR_5\n" ]
[ "def make_router_req_msg(self, iden, interface, method, args, fun, reqid=None):...\n", "msg = iden[:]\n", "msg.append(b'')\n", "msg.extend(self.make_req_msg(interface, method, args, fun, reqid))\n", "return msg\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_10(VAR_7, VAR_13='{}'):...\n", "VAR_14 = FUNC_9(VAR_7)\n", "VAR_48 = FUNC_11(VAR_14, VAR_13) if VAR_14 else None\n", "return VAR_48\n" ]
[ "def get_sanitized_bracket(url, symbol='{}'):...\n", "bracket = get_bracket(url)\n", "sanitized = sanitize_bracket(bracket, symbol) if bracket else None\n", "return sanitized\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@VAR_0.route('/login/<remote_app>/')...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1 not in oauth.remote_apps:\n", "return abort(404)\n", "VAR_2 = url_for('.authorized', VAR_1=remote_app, next=request.args.get(\n 'next') or request.referrer or None, _external=True)\n", "return oauth.remote_apps[VAR_1].authorize(callback=callback_url)\n" ]
[ "@blueprint.route('/login/<remote_app>/')...\n", "\"\"\"docstring\"\"\"\n", "if remote_app not in oauth.remote_apps:\n", "return abort(404)\n", "callback_url = url_for('.authorized', remote_app=remote_app, next=request.\n args.get('next') or request.referrer or None, _external=True)\n", "return oauth.remote_apps[remote_app].authorize(callback=callback_url)\n" ]
[ 0, 0, 0, 0, 5, 5 ]
[ "Condition", "Docstring", "Condition", "Return'", "Assign'", "Return'" ]
[ "from osv import osv\n", "from tools.translate import _\n", "import time\n", "VAR_0 = 'pos.open.statement'\n", "VAR_1 = 'Open Statements'\n", "def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = []\n", "VAR_7 = self.pool.get('ir.model.data')\n", "VAR_8 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n", "VAR_9 = self.pool.get('account.bank.statement')\n", "VAR_10 = self.pool.get('ir.sequence')\n", "VAR_11 = self.pool.get('account.journal')\n", "VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n", "VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_12)))\n", "VAR_13 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "for journal in VAR_11.browse(VAR_2, VAR_3, VAR_13):\n", "VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n", "VAR_14 = self.pool.get('ir.model.data')\n", "if len(VAR_4):\n", "VAR_15 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n", "VAR_17 = ''\n", "VAR_16 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if VAR_15:\n", "VAR_17 = VAR_10.get_id(VAR_2, VAR_3, journal.sequence_id.id)\n", "VAR_17 = VAR_10.get(VAR_2, VAR_3, 'account.bank.statement')\n", "VAR_15 = VAR_14.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n", "if VAR_16:\n", "VAR_18 = VAR_9.create(VAR_2, VAR_3, {'journal_id': journal.id, 'company_id':\n VAR_8, 'user_id': VAR_3, 'state': 'open', 'name': VAR_17,\n 'starting_details_ids': VAR_9._get_cash_close_box_lines(VAR_2, VAR_3, [])})\n", "VAR_16 = VAR_14.browse(VAR_2, VAR_3, VAR_16, VAR_5=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(VAR_15, 'tree'), (VAR_16, 'form')],\n 'type': 'ir.actions.act_window'}\n", "VAR_9.button_open(VAR_2, VAR_3, [VAR_18], VAR_5)\n" ]
[ "from osv import osv\n", "from tools.translate import _\n", "import time\n", "_name = 'pos.open.statement'\n", "_description = 'Open Statements'\n", "def open_statement(self, cr, uid, ids, context):...\n", "\"\"\"docstring\"\"\"\n", "list_statement = []\n", "mod_obj = self.pool.get('ir.model.data')\n", "company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n", "statement_obj = self.pool.get('account.bank.statement')\n", "sequence_obj = self.pool.get('ir.sequence')\n", "journal_obj = self.pool.get('account.journal')\n", "cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n", "j_ids = map(lambda x1: x1[0], cr.fetchall())\n", "cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n", "journal_ids = map(lambda x1: x1[0], cr.fetchall())\n", "for journal in journal_obj.browse(cr, uid, journal_ids):\n", "ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n", "data_obj = self.pool.get('ir.model.data')\n", "if len(ids):\n", "id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n", "number = ''\n", "id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if id2:\n", "number = sequence_obj.get_id(cr, uid, journal.sequence_id.id)\n", "number = sequence_obj.get(cr, uid, 'account.bank.statement')\n", "id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n", "if id3:\n", "statement_id = statement_obj.create(cr, uid, {'journal_id': journal.id,\n 'company_id': company_id, 'user_id': uid, 'state': 'open', 'name':\n number, 'starting_details_ids': statement_obj._get_cash_close_box_lines\n (cr, uid, [])})\n", "id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(id2, 'tree'), (id3, 'form')],\n 'type': 'ir.actions.act_window'}\n", "statement_obj.button_open(cr, uid, [statement_id], context)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Expr'" ]
[ "@VAR_0.route('/profile/<int:ID>', methods=['GET', 'PUT', 'DELETE'])...\n", "if not db_isProfileExists(VAR_1):\n", "return jsonify({'status': 1, 'message': 'Такого аккаунта не существует'})\n", "if request.method == 'GET':\n", "return jsonify(db_getProfileInfo(VAR_1))\n", "if request.method == 'PUT':\n", "VAR_2 = json.loads(request.data)\n", "if request.method == 'DELETE':\n", "if isProfileDeleted(VAR_1):\n", "if isProfileDeleted(VAR_1):\n", "return jsonify({'status': 0, 'message':\n 'Невозможно изменить данные удалённого аккаунта'})\n", "if isProfileBlocked(VAR_1):\n", "return jsonify({'status': 0, 'message': 'Аккаунт уже удалён'})\n", "return jsonify(db_FullDelProfile(VAR_1))\n", "return jsonify({'status': 0, 'message':\n 'Невозможно изменить данные заблокированного'})\n", "return jsonify(db_updateProfileInfo(VAR_1, VAR_2))\n" ]
[ "@profile_module.route('/profile/<int:ID>', methods=['GET', 'PUT', 'DELETE'])...\n", "if not db_isProfileExists(ID):\n", "return jsonify({'status': 1, 'message': 'Такого аккаунта не существует'})\n", "if request.method == 'GET':\n", "return jsonify(db_getProfileInfo(ID))\n", "if request.method == 'PUT':\n", "data = json.loads(request.data)\n", "if request.method == 'DELETE':\n", "if isProfileDeleted(ID):\n", "if isProfileDeleted(ID):\n", "return jsonify({'status': 0, 'message':\n 'Невозможно изменить данные удалённого аккаунта'})\n", "if isProfileBlocked(ID):\n", "return jsonify({'status': 0, 'message': 'Аккаунт уже удалён'})\n", "return jsonify(db_FullDelProfile(ID))\n", "return jsonify({'status': 0, 'message':\n 'Невозможно изменить данные заблокированного'})\n", "return jsonify(db_updateProfileInfo(ID, data))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Return'", "Condition", "Return'", "Return'", "Return'", "Return'" ]
[ "def __init__(self, VAR_17, VAR_18):...\n", "self._src_prx = VAR_17\n", "self._tgt_prx = VAR_18\n", "self.__traversed = set()\n", "self.__root_is_sequence = (not VAR_17 is None and VAR_17.proxy_for ==\n RESOURCE_KINDS.COLLECTION or not VAR_18 is None and VAR_18.proxy_for ==\n RESOURCE_KINDS.COLLECTION)\n", "if __debug__:\n", "self.__logger = get_logger('everest')\n", "self.__logger = None\n" ]
[ "def __init__(self, source_proxy, target_proxy):...\n", "self._src_prx = source_proxy\n", "self._tgt_prx = target_proxy\n", "self.__traversed = set()\n", "self.__root_is_sequence = (not source_proxy is None and source_proxy.\n proxy_for == RESOURCE_KINDS.COLLECTION or not target_proxy is None and \n target_proxy.proxy_for == RESOURCE_KINDS.COLLECTION)\n", "if __debug__:\n", "self.__logger = get_logger('everest')\n", "self.__logger = None\n" ]
[ 0, 0, 0, 1, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_27(VAR_40, VAR_41):...\n", "VAR_71 = os.path.dirname(VAR_40)\n", "if not os.path.isdir(VAR_71):\n", "os.mkdir(VAR_71)\n", "VAR_72 = open(VAR_40, 'w')\n", "VAR_72.write(VAR_41)\n", "VAR_72.close()\n" ]
[ "def save_keywords(filename, xml):...\n", "tmp_dir = os.path.dirname(filename)\n", "if not os.path.isdir(tmp_dir):\n", "os.mkdir(tmp_dir)\n", "file_desc = open(filename, 'w')\n", "file_desc.write(xml)\n", "file_desc.close()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "\"\"\" Client blueprint used to handle OAuth callbacks. \"\"\"\n", "from __future__ import absolute_import\n", "from flask import Blueprint, abort, current_app, url_for, request\n", "from flask.ext.login import user_logged_out\n", "from invenio.base.globals import cfg\n", "from invenio.ext.sslify import ssl_required\n", "from ..client import oauth, handlers, disconnect_handlers, signup_handlers\n", "from ..handlers import authorized_default_handler, make_token_getter, make_handler, disconnect_handler, oauth_logout_handler\n", "VAR_0 = Blueprint('oauthclient', __name__, url_prefix='/oauth',\n static_folder='../static', template_folder='../templates')\n", "@VAR_0.before_app_first_request...\n", "\"\"\"docstring\"\"\"\n", "user_logged_out.connect(oauth_logout_handler)\n", "oauth.init_app(current_app)\n", "for VAR_1, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n", "if VAR_1 not in oauth.remote_apps:\n", "@VAR_0.route('/login/<remote_app>/')...\n", "VAR_4 = oauth.remote_app(VAR_1, **conf['params'])\n", "VAR_4 = oauth.remote_apps[VAR_1]\n", "\"\"\"docstring\"\"\"\n", "VAR_4.tokengetter(make_token_getter(VAR_4))\n", "if VAR_1 not in oauth.remote_apps:\n", "handlers.register(VAR_1, VAR_4.authorized_handler(make_handler(conf.get(\n 'authorized_handler', authorized_default_handler), VAR_4)))\n", "return abort(404)\n", "VAR_2 = url_for('.authorized', VAR_1=remote_app, next=request.args.get(\n 'next') or request.referrer or None, _external=True)\n", "disconnect_handlers.register(VAR_1, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), VAR_4, with_response=False))\n", "return oauth.remote_apps[VAR_1].authorize(callback=callback_url)\n", "def FUNC_5(VAR_4, *VAR_5, **VAR_6):...\n", "VAR_7 = conf.get('signup_handler', dict())\n", "VAR_8 = make_handler(VAR_7.get('info', FUNC_5), VAR_4, with_response=False)\n", "VAR_9 = make_handler(VAR_7.get('setup', FUNC_5), VAR_4, with_response=False)\n", "VAR_10 = make_handler(VAR_7.get('view', FUNC_5), VAR_4, with_response=False)\n", "signup_handlers.register(VAR_1, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n" ]
[ "\"\"\" Client blueprint used to handle OAuth callbacks. \"\"\"\n", "from __future__ import absolute_import\n", "from flask import Blueprint, abort, current_app, url_for, request\n", "from flask.ext.login import user_logged_out\n", "from invenio.base.globals import cfg\n", "from invenio.ext.sslify import ssl_required\n", "from ..client import oauth, handlers, disconnect_handlers, signup_handlers\n", "from ..handlers import authorized_default_handler, make_token_getter, make_handler, disconnect_handler, oauth_logout_handler\n", "blueprint = Blueprint('oauthclient', __name__, url_prefix='/oauth',\n static_folder='../static', template_folder='../templates')\n", "@blueprint.before_app_first_request...\n", "\"\"\"docstring\"\"\"\n", "user_logged_out.connect(oauth_logout_handler)\n", "oauth.init_app(current_app)\n", "for remote_app, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n", "if remote_app not in oauth.remote_apps:\n", "@blueprint.route('/login/<remote_app>/')...\n", "remote = oauth.remote_app(remote_app, **conf['params'])\n", "remote = oauth.remote_apps[remote_app]\n", "\"\"\"docstring\"\"\"\n", "remote.tokengetter(make_token_getter(remote))\n", "if remote_app not in oauth.remote_apps:\n", "handlers.register(remote_app, remote.authorized_handler(make_handler(conf.\n get('authorized_handler', authorized_default_handler), remote)))\n", "return abort(404)\n", "callback_url = url_for('.authorized', remote_app=remote_app, next=request.\n args.get('next') or request.referrer or None, _external=True)\n", "disconnect_handlers.register(remote_app, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), remote, with_response=False))\n", "return oauth.remote_apps[remote_app].authorize(callback=callback_url)\n", "def dummy_handler(remote, *args, **kargs):...\n", "signup_handler = conf.get('signup_handler', dict())\n", "account_info_handler = make_handler(signup_handler.get('info',\n dummy_handler), remote, with_response=False)\n", "account_setup_handler = make_handler(signup_handler.get('setup',\n dummy_handler), remote, with_response=False)\n", "account_view_handler = make_handler(signup_handler.get('view',\n dummy_handler), remote, with_response=False)\n", "signup_handlers.register(remote_app, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n" ]
[ 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "For", "Docstring", "Expr'", "Expr'", "For", "Condition", "Condition", "Assign'", "Assign'", "Docstring", "Expr'", "Condition", "Expr'", "Return'", "Assign'", "Expr'", "Return'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_16(self):...\n", "return True\n" ]
[ "def do_existing_paths(self):...\n", "return True\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(self, VAR_1, VAR_2, VAR_5, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_4 is None:\n", "VAR_4 = {}\n", "VAR_30 = VAR_4.get('states', [])\n", "VAR_31 = VAR_4.get('what', ())\n", "if not VAR_5:\n", "VAR_5 = self.search(VAR_1, VAR_2, [])\n", "VAR_29 = {}.fromkeys(VAR_5, 0.0)\n", "if not VAR_5:\n", "return VAR_29\n", "if VAR_4.get('shop', False):\n", "VAR_1.execute('select warehouse_id from sale_shop where id=%s', (int(VAR_4[\n 'shop']),))\n", "if VAR_4.get('warehouse', False):\n", "VAR_41 = VAR_1.fetchone()\n", "VAR_1.execute('select lot_stock_id from stock_warehouse where id=%s', (int(\n VAR_4['warehouse']),))\n", "if VAR_4.get('location', False):\n", "if VAR_41:\n", "VAR_41 = VAR_1.fetchone()\n", "if type(VAR_4['location']) == type(1):\n", "VAR_42 = []\n", "VAR_4['warehouse'] = VAR_41[0]\n", "if VAR_41:\n", "VAR_42 = [VAR_4['location']]\n", "if type(VAR_4['location']) in (type(''), type(u'')):\n", "VAR_43 = self.pool.get('stock.warehouse').search(VAR_1, VAR_2, [], VAR_4=\n context)\n", "VAR_4['location'] = VAR_41[0]\n", "if VAR_4.get('compute_child', True):\n", "VAR_42 = self.pool.get('stock.location').search(VAR_1, VAR_2, [('name',\n 'ilike', VAR_4['location'])], VAR_4=context)\n", "VAR_42 = VAR_4['location']\n", "for w in self.pool.get('stock.warehouse').browse(VAR_1, VAR_2, VAR_43,\n", "VAR_44 = self.pool.get('stock.location').search(VAR_1, VAR_2, [(\n 'location_id', 'child_of', VAR_42)])\n", "VAR_42 = VAR_42\n", "VAR_42.append(w.lot_stock_id.id)\n", "VAR_42 = VAR_44 or VAR_42\n", "VAR_32 = {}\n", "VAR_33 = {}\n", "for VAR_45 in self.browse(VAR_1, VAR_2, VAR_5, VAR_4=context):\n", "VAR_33[VAR_45.id] = VAR_45.uom_id.id\n", "VAR_34 = []\n", "VAR_32[VAR_45.uom_id.id] = VAR_45.uom_id\n", "VAR_35 = []\n", "VAR_36 = VAR_4.get('from_date', False)\n", "VAR_37 = VAR_4.get('to_date', False)\n", "VAR_38 = False\n", "if VAR_36 and VAR_37:\n", "VAR_38 = \"date_planned>='%s' and date_planned<='%s'\" % (VAR_36, VAR_37)\n", "if VAR_36:\n", "if 'in' in VAR_31:\n", "VAR_38 = \"date_planned>='%s'\" % VAR_36\n", "if VAR_37:\n", "VAR_1.execute('string' + (VAR_38 and 'and ' + VAR_38 + ' ' or '') +\n 'group by product_id,product_uom', (tuple(VAR_42), tuple(VAR_42), tuple\n (VAR_5), tuple(VAR_30)))\n", "if 'out' in VAR_31:\n", "VAR_38 = \"date_planned<='%s'\" % VAR_37\n", "VAR_34 = VAR_1.fetchall()\n", "VAR_1.execute('string' + (VAR_38 and 'and ' + VAR_38 + ' ' or '') +\n 'group by product_id,product_uom', (tuple(VAR_42), tuple(VAR_42), tuple\n (VAR_5), tuple(VAR_30)))\n", "VAR_39 = self.pool.get('product.uom')\n", "VAR_35 = VAR_1.fetchall()\n", "VAR_40 = map(lambda x: x[2], VAR_34) + map(lambda x: x[2], VAR_35)\n", "if VAR_4.get('uom', False):\n", "VAR_40 += [VAR_4['uom']]\n", "VAR_40 = filter(lambda x: x not in VAR_32.keys(), VAR_40)\n", "if VAR_40:\n", "VAR_40 = VAR_39.browse(VAR_1, VAR_2, list(set(VAR_40)), VAR_4=context)\n", "for VAR_46 in VAR_40:\n", "VAR_32[VAR_46.id] = VAR_46\n", "for VAR_47, prod_id, prod_uom in VAR_34:\n", "VAR_47 = VAR_39._compute_qty_obj(VAR_1, VAR_2, VAR_32[prod_uom], VAR_47,\n VAR_32[VAR_4.get('uom', False) or VAR_33[prod_id]])\n", "for VAR_47, prod_id, prod_uom in VAR_35:\n", "VAR_29[prod_id] += VAR_47\n", "VAR_47 = VAR_39._compute_qty_obj(VAR_1, VAR_2, VAR_32[prod_uom], VAR_47,\n VAR_32[VAR_4.get('uom', False) or VAR_33[prod_id]])\n", "return VAR_29\n", "VAR_29[prod_id] -= VAR_47\n" ]
[ "def get_product_available(self, cr, uid, ids, context=None):...\n", "\"\"\"docstring\"\"\"\n", "if context is None:\n", "context = {}\n", "states = context.get('states', [])\n", "what = context.get('what', ())\n", "if not ids:\n", "ids = self.search(cr, uid, [])\n", "res = {}.fromkeys(ids, 0.0)\n", "if not ids:\n", "return res\n", "if context.get('shop', False):\n", "cr.execute('select warehouse_id from sale_shop where id=%s', (int(context[\n 'shop']),))\n", "if context.get('warehouse', False):\n", "res2 = cr.fetchone()\n", "cr.execute('select lot_stock_id from stock_warehouse where id=%s', (int(\n context['warehouse']),))\n", "if context.get('location', False):\n", "if res2:\n", "res2 = cr.fetchone()\n", "if type(context['location']) == type(1):\n", "location_ids = []\n", "context['warehouse'] = res2[0]\n", "if res2:\n", "location_ids = [context['location']]\n", "if type(context['location']) in (type(''), type(u'')):\n", "wids = self.pool.get('stock.warehouse').search(cr, uid, [], context=context)\n", "context['location'] = res2[0]\n", "if context.get('compute_child', True):\n", "location_ids = self.pool.get('stock.location').search(cr, uid, [('name',\n 'ilike', context['location'])], context=context)\n", "location_ids = context['location']\n", "for w in self.pool.get('stock.warehouse').browse(cr, uid, wids, context=context\n", "child_location_ids = self.pool.get('stock.location').search(cr, uid, [(\n 'location_id', 'child_of', location_ids)])\n", "location_ids = location_ids\n", "location_ids.append(w.lot_stock_id.id)\n", "location_ids = child_location_ids or location_ids\n", "uoms_o = {}\n", "product2uom = {}\n", "for product in self.browse(cr, uid, ids, context=context):\n", "product2uom[product.id] = product.uom_id.id\n", "results = []\n", "uoms_o[product.uom_id.id] = product.uom_id\n", "results2 = []\n", "from_date = context.get('from_date', False)\n", "to_date = context.get('to_date', False)\n", "date_str = False\n", "if from_date and to_date:\n", "date_str = \"date_planned>='%s' and date_planned<='%s'\" % (from_date, to_date)\n", "if from_date:\n", "if 'in' in what:\n", "date_str = \"date_planned>='%s'\" % from_date\n", "if to_date:\n", "cr.execute(\n 'select sum(product_qty), product_id, product_uom from stock_move where location_id NOT IN %sand location_dest_id IN %sand product_id IN %sand state IN %s'\n + (date_str and 'and ' + date_str + ' ' or '') +\n 'group by product_id,product_uom', (tuple(location_ids), tuple(\n location_ids), tuple(ids), tuple(states)))\n", "if 'out' in what:\n", "date_str = \"date_planned<='%s'\" % to_date\n", "results = cr.fetchall()\n", "cr.execute(\n 'select sum(product_qty), product_id, product_uom from stock_move where location_id IN %sand location_dest_id NOT IN %s and product_id IN %sand state in %s'\n + (date_str and 'and ' + date_str + ' ' or '') +\n 'group by product_id,product_uom', (tuple(location_ids), tuple(\n location_ids), tuple(ids), tuple(states)))\n", "uom_obj = self.pool.get('product.uom')\n", "results2 = cr.fetchall()\n", "uoms = map(lambda x: x[2], results) + map(lambda x: x[2], results2)\n", "if context.get('uom', False):\n", "uoms += [context['uom']]\n", "uoms = filter(lambda x: x not in uoms_o.keys(), uoms)\n", "if uoms:\n", "uoms = uom_obj.browse(cr, uid, list(set(uoms)), context=context)\n", "for o in uoms:\n", "uoms_o[o.id] = o\n", "for amount, prod_id, prod_uom in results:\n", "amount = uom_obj._compute_qty_obj(cr, uid, uoms_o[prod_uom], amount, uoms_o\n [context.get('uom', False) or product2uom[prod_id]])\n", "for amount, prod_id, prod_uom in results2:\n", "res[prod_id] += amount\n", "amount = uom_obj._compute_qty_obj(cr, uid, uoms_o[prod_uom], amount, uoms_o\n [context.get('uom', False) or product2uom[prod_id]])\n", "return res\n", "res[prod_id] -= amount\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Assign'", "Condition", "Assign'", "For", "Assign'", "For", "Assign'", "For", "AugAssign'", "Assign'", "Return'", "AugAssign'" ]
[ "@staticmethod...\n", "return ' '.join(escape_path_argument(s) for s in (sys.executable, os.path.\n join(os.path.dirname(os.path.realpath(__file__)),\n 'run_shell_command_testfiles', VAR_0)))\n" ]
[ "@staticmethod...\n", "return ' '.join(escape_path_argument(s) for s in (sys.executable, os.path.\n join(os.path.dirname(os.path.realpath(__file__)),\n 'run_shell_command_testfiles', scriptname)))\n" ]
[ 0, 2 ]
[ "Condition", "Return'" ]
[ "def FUNC_54(self):...\n", "self.cursor.execute('create table t1(a blob)')\n", "VAR_35 = 'x' * 100 * 1024\n", "self.cursor.execute('update t1 set a=? where 1=0', (VAR_35,))\n" ]
[ "def test_large_update_nodata(self):...\n", "self.cursor.execute('create table t1(a blob)')\n", "hundredkb = 'x' * 100 * 1024\n", "self.cursor.execute('update t1 set a=? where 1=0', (hundredkb,))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_33(self, VAR_24):...\n", "return self.regex().match(VAR_24) or None\n" ]
[ "def match(self, target):...\n", "return self.regex().match(target) or None\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_7, VAR_54=None, VAR_55=None, VAR_14=errors....\n", "self.min = VAR_54\n", "self.max = VAR_55\n", "self.error = VAR_14\n", "CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n" ]
[ "def __init__(self, param, min=None, max=None, error=errors.BAD_NUMBER, *a, **kw...\n", "self.min = min\n", "self.max = max\n", "self.error = error\n", "Validator.__init__(self, param, *a, **kw)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_4(VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = 'string'.format(VAR_2=sku, VAR_3=ebay_id, VAR_4=qty, VAR_5=price,\n VAR_6=site, VAR_22=hits, VAR_23=watches, VAR_24=questions)\n", "frappe.db.sql(VAR_11, auto_commit=True)\n" ]
[ "def insert_ebay_listing(sku, ebay_id, qty, price, site, hits, watches,...\n", "\"\"\"docstring\"\"\"\n", "sql = (\n \"\"\"\n insert into `zEbayListings`\n values('{sku}', '{ebay_id}', {qty}, {price}, '{site}', {hit_count}, {watch_count}, {question_count})\n \"\"\"\n .format(sku=sku, ebay_id=ebay_id, qty=qty, price=price, site=site,\n hit_count=hits, watch_count=watches, question_count=questions))\n", "frappe.db.sql(sql, auto_commit=True)\n" ]
[ 0, 0, 4, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_2(VAR_9):...\n", "VAR_34 = VAR_9.cmd('list-panes', '-F #{pane_pid}')\n", "return [int(p) for p in VAR_34.stdout]\n" ]
[ "def get_window_pid(window):...\n", "r = window.cmd('list-panes', '-F #{pane_pid}')\n", "return [int(p) for p in r.stdout]\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_3(VAR_6, VAR_7):...\n", "if VAR_7.data is VAR_6[VAR_5].data:\n" ]
[ "def _different(form, field):...\n", "if field.data is form[fieldname].data:\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def __exit__(self, VAR_2, VAR_3, VAR_4):...\n", "if self.conn:\n", "self.conn.close()\n" ]
[ "def __exit__(self, exc_type, exc_val, exc_tb):...\n", "if self.conn:\n", "self.conn.close()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'" ]
[ "@staticmethod...\n", "if not VAR_1 or not VAR_7 or not VAR_6:\n", "if not VAR_5:\n", "VAR_5 = CLASS_0.get_report(VAR_1)['analysis']\n", "VAR_16 = VAR_5['behavior']['generic']\n", "VAR_17 = [z for z in VAR_16 if z['pid'] == VAR_6]\n", "if not VAR_17:\n", "VAR_17 = VAR_17[0]\n", "VAR_18 = VAR_17['summary']\n", "if VAR_7 not in VAR_18:\n", "if VAR_3:\n", "VAR_18[VAR_7] = VAR_18[VAR_7][VAR_3:]\n", "if VAR_2:\n", "VAR_18[VAR_7] = VAR_18[VAR_7][:VAR_2]\n", "return VAR_18[VAR_7]\n" ]
[ "@staticmethod...\n", "if not task_id or not watcher or not pid:\n", "if not report:\n", "report = AnalysisController.get_report(task_id)['analysis']\n", "behavior_generic = report['behavior']['generic']\n", "process = [z for z in behavior_generic if z['pid'] == pid]\n", "if not process:\n", "process = process[0]\n", "summary = process['summary']\n", "if watcher not in summary:\n", "if offset:\n", "summary[watcher] = summary[watcher][offset:]\n", "if limit:\n", "summary[watcher] = summary[watcher][:limit]\n", "return summary[watcher]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def __init__(self, VAR_0, VAR_1, VAR_2):...\n", "super(CLASS_5, self).__init__(VAR_0, VAR_1, VAR_2, 'DELETE')\n" ]
[ "def __init__(self, connection, args, logger):...\n", "super(HttpDelete, self).__init__(connection, args, logger, 'DELETE')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_18(self):...\n", "\"\"\"docstring\"\"\"\n", "self.parser.parse_args(['--delete-match'])\n" ]
[ "def test_arg_delete_match(self):...\n", "\"\"\"docstring\"\"\"\n", "self.parser.parse_args(['--delete-match'])\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_12(self):...\n", "VAR_16 = KeyboardInterruptCheck()\n", "self.assertRaises(KeyboardInterrupt, self.runall, [VAR_16])\n", "VAR_15 = self.runner.stats\n", "self.assertEqual(1, len(VAR_15.failures()))\n", "self.assert_all_dead()\n" ]
[ "def test_kbd_interrupt_within_test(self):...\n", "check = KeyboardInterruptCheck()\n", "self.assertRaises(KeyboardInterrupt, self.runall, [check])\n", "stats = self.runner.stats\n", "self.assertEqual(1, len(stats.failures()))\n", "self.assert_all_dead()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_16):...\n", "self.flags = dict()\n" ]
[ "def __init__(self, value):...\n", "self.flags = dict()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_0(VAR_0, VAR_1, VAR_2):...\n", "VAR_3 = ndb.Key(urlsafe=key_urlsafe).get()\n", "assert VAR_3\n", "assert VAR_3.status == analysis_status.COMPLETED\n", "assert VAR_3.suspected_flake_build_number is not None\n", "if VAR_3.culprit:\n", "VAR_6 = {'culprit_revision': VAR_3.culprit.revision,\n 'culprit_commit_position': VAR_3.culprit.commit_position, 'culprit_url':\n VAR_3.culprit.url}\n", "VAR_6 = {'build_number': VAR_3.suspected_flake_build_number}\n", "VAR_3.UpdateTriageResult(VAR_1, VAR_6, VAR_2, VAR_3.version_number)\n", "VAR_3.put()\n", "return True\n" ]
[ "def _UpdateSuspectedFlakeAnalysis(key_urlsafe, triage_result, user_name):...\n", "master_flake_analysis = ndb.Key(urlsafe=key_urlsafe).get()\n", "assert master_flake_analysis\n", "assert master_flake_analysis.status == analysis_status.COMPLETED\n", "assert master_flake_analysis.suspected_flake_build_number is not None\n", "if master_flake_analysis.culprit:\n", "suspect_info = {'culprit_revision': master_flake_analysis.culprit.revision,\n 'culprit_commit_position': master_flake_analysis.culprit.\n commit_position, 'culprit_url': master_flake_analysis.culprit.url}\n", "suspect_info = {'build_number': master_flake_analysis.\n suspected_flake_build_number}\n", "master_flake_analysis.UpdateTriageResult(triage_result, suspect_info,\n user_name, master_flake_analysis.version_number)\n", "master_flake_analysis.put()\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assert'", "Assert'", "Assert'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_11():...\n", "VAR_8 = logging.getLogger(__name__)\n", "VAR_8.setLevel(logging.DEBUG)\n", "VAR_36 = argparse.ArgumentParser()\n", "VAR_36.add_argument('--config', '-c', type=str, default='test.yaml', help=\n 'YAML config file. see sample-config.yaml. Default: test.yaml')\n", "VAR_37 = VAR_36.add_subparsers(dest='cmd')\n", "VAR_38 = VAR_37.add_parser('edit', help=\n 'Launches the editor to edit or create new systems and components')\n", "VAR_39 = VAR_37.add_parser('run', help=\n 'Launches the setup specified by the --config argument')\n", "VAR_40 = VAR_37.add_parser('validate', help=\n 'Validate the setup specified by the --config argument')\n", "VAR_41 = VAR_37.add_parser('slave', help=\n \"\"\"Run a component locally without controlling it. The control is taken care of the remote master invoking this command.\nIf run with the --kill flag, the passed component will be killed\"\"\"\n )\n", "VAR_40.add_argument('--visual', help='Generate and show a graph image',\n action='store_true')\n", "VAR_42 = VAR_41.add_mutually_exclusive_group(required=False)\n", "VAR_42.add_argument('-k', '--kill', help='switch to kill mode', action=\n 'store_true')\n", "VAR_42.add_argument('-c', '--check', help='Run a component check', action=\n 'store_true')\n", "VAR_43 = VAR_36.parse_args()\n", "VAR_8.debug(VAR_43)\n", "if VAR_43.cmd == 'edit':\n", "VAR_8.debug('Launching editor mode')\n", "if VAR_43.cmd == 'run':\n", "VAR_8.debug('Launching runner mode')\n", "if VAR_43.cmd == 'validate':\n", "VAR_61 = CLASS_1(VAR_43.config)\n", "VAR_8.debug('Launching validation mode')\n", "if VAR_43.cmd == 'slave':\n", "VAR_61.init()\n", "VAR_61 = CLASS_1(VAR_43.config)\n", "VAR_8.debug('Launching slave mode')\n", "FUNC_12(VAR_61)\n", "if VAR_43.visual:\n", "VAR_63 = CLASS_2(VAR_43.config, VAR_43.kill, VAR_43.check)\n", "VAR_61.set_dependencies(False)\n", "VAR_61.set_dependencies(True)\n", "if VAR_43.check:\n", "VAR_61.draw_graph()\n", "VAR_63.run_check()\n", "VAR_63.init()\n" ]
[ "def main():...\n", "logger = logging.getLogger(__name__)\n", "logger.setLevel(logging.DEBUG)\n", "parser = argparse.ArgumentParser()\n", "parser.add_argument('--config', '-c', type=str, default='test.yaml', help=\n 'YAML config file. see sample-config.yaml. Default: test.yaml')\n", "subparsers = parser.add_subparsers(dest='cmd')\n", "subparser_editor = subparsers.add_parser('edit', help=\n 'Launches the editor to edit or create new systems and components')\n", "subparser_run = subparsers.add_parser('run', help=\n 'Launches the setup specified by the --config argument')\n", "subparser_val = subparsers.add_parser('validate', help=\n 'Validate the setup specified by the --config argument')\n", "subparser_remote = subparsers.add_parser('slave', help=\n \"\"\"Run a component locally without controlling it. The control is taken care of the remote master invoking this command.\nIf run with the --kill flag, the passed component will be killed\"\"\"\n )\n", "subparser_val.add_argument('--visual', help=\n 'Generate and show a graph image', action='store_true')\n", "remote_mutex = subparser_remote.add_mutually_exclusive_group(required=False)\n", "remote_mutex.add_argument('-k', '--kill', help='switch to kill mode',\n action='store_true')\n", "remote_mutex.add_argument('-c', '--check', help='Run a component check',\n action='store_true')\n", "args = parser.parse_args()\n", "logger.debug(args)\n", "if args.cmd == 'edit':\n", "logger.debug('Launching editor mode')\n", "if args.cmd == 'run':\n", "logger.debug('Launching runner mode')\n", "if args.cmd == 'validate':\n", "cc = ControlCenter(args.config)\n", "logger.debug('Launching validation mode')\n", "if args.cmd == 'slave':\n", "cc.init()\n", "cc = ControlCenter(args.config)\n", "logger.debug('Launching slave mode')\n", "start_gui(cc)\n", "if args.visual:\n", "sl = SlaveLauncher(args.config, args.kill, args.check)\n", "cc.set_dependencies(False)\n", "cc.set_dependencies(True)\n", "if args.check:\n", "cc.draw_graph()\n", "sl.run_check()\n", "sl.init()\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 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "@app.route('/api/directory_browser', methods=['GET'])...\n", "VAR_24 = request.args.get('path', '/')\n", "if not os.path.exists(VAR_24):\n", "VAR_35 = VAR_24\n", "if not os.path.isdir(VAR_24):\n", "while not os.path.isdir(VAR_35):\n", "VAR_25 = sorted(os.listdir(VAR_24))\n", "VAR_35 = os.path.dirname(VAR_35)\n", "VAR_26 = [dir for dir in VAR_25 if os.path.isdir(os.path.join(VAR_24, dir))]\n", "VAR_27 = os.path.dirname(VAR_24)\n", "VAR_28 = {'path': os.path.normpath(VAR_24), 'subdirectories': VAR_26,\n 'parent': os.path.normpath(VAR_27) if VAR_27 != VAR_24 else None}\n", "if request.args.get('show_files', 'false') == 'true':\n", "VAR_28['files'] = [dir for dir in VAR_25 if os.path.isfile(os.path.join(\n VAR_24, dir))]\n", "return VAR_28\n" ]
[ "@app.route('/api/directory_browser', methods=['GET'])...\n", "path = request.args.get('path', '/')\n", "if not os.path.exists(path):\n", "parent_dir = path\n", "if not os.path.isdir(path):\n", "while not os.path.isdir(parent_dir):\n", "entries = sorted(os.listdir(path))\n", "parent_dir = os.path.dirname(parent_dir)\n", "subdirectories = [dir for dir in entries if os.path.isdir(os.path.join(path,\n dir))]\n", "parent = os.path.dirname(path)\n", "response = {'path': os.path.normpath(path), 'subdirectories':\n subdirectories, 'parent': os.path.normpath(parent) if parent != path else\n None}\n", "if request.args.get('show_files', 'false') == 'true':\n", "response['files'] = [dir for dir in entries if os.path.isfile(os.path.join(\n path, dir))]\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]