lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_26(VAR_9, VAR_10):...\n", "VAR_28 = Keyword.search(VAR_10=term, order='text')\n", "if len(VAR_28) > 0:\n", "return [{'text': 'Previously Used', 'children': FUNC_25(VAR_28)}]\n", "return []\n" ]
[ "def _get_previously_used(model, term):...\n", "keywords = Keyword.search(term=term, order='text')\n", "if len(keywords) > 0:\n", "return [{'text': 'Previously Used', 'children': _select2_list(keywords)}]\n", "return []\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_0(self, VAR_2, *VAR_3, **VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "self.params = utils.Struct()\n", "self.read_params(VAR_5=BaseView._GET_PARAMETERS)\n", "self.env = utils.Struct()\n", "self.env.repo = VAR_4.get('repo', None)\n", "self.env.action = self.ACTION_ID\n", "self.env.config = config.Configuration(self.env.repo or '*')\n", "VAR_13 = self.params.get('lang') or self.request.LANGUAGE_CODE\n", "VAR_13 = re.sub('[^A-Za-z0-9-]', '', VAR_13)\n", "VAR_13 = const.LANGUAGE_SYNONYMS.get(VAR_13, VAR_13)\n", "if VAR_13 in const.LANGUAGE_ENDONYMS.keys():\n", "self.env.lang = VAR_13\n", "self.env.lang = self.env.config.language_menu_options[0\n ] if self.env.config.language_menu_options else const.DEFAULT_LANGUAGE_CODE\n", "self.env.rtl = self.env.lang in const.LANGUAGES_BIDI\n", "self.env.charset = const.CHARSET_UTF8\n", "self.env.global_url = self.build_absolute_uri('/global')\n" ]
[ "def setup(self, request, *args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "self.params = utils.Struct()\n", "self.read_params(get_params=BaseView._GET_PARAMETERS)\n", "self.env = utils.Struct()\n", "self.env.repo = kwargs.get('repo', None)\n", "self.env.action = self.ACTION_ID\n", "self.env.config = config.Configuration(self.env.repo or '*')\n", "lang = self.params.get('lang') or self.request.LANGUAGE_CODE\n", "lang = re.sub('[^A-Za-z0-9-]', '', lang)\n", "lang = const.LANGUAGE_SYNONYMS.get(lang, lang)\n", "if lang in const.LANGUAGE_ENDONYMS.keys():\n", "self.env.lang = lang\n", "self.env.lang = self.env.config.language_menu_options[0\n ] if self.env.config.language_menu_options else const.DEFAULT_LANGUAGE_CODE\n", "self.env.rtl = self.env.lang in const.LANGUAGES_BIDI\n", "self.env.charset = const.CHARSET_UTF8\n", "self.env.global_url = self.build_absolute_uri('/global')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_6(VAR_1, VAR_5=''):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = VAR_17(VAR_1.name)\n", "return VAR_16.pop(VAR_18, None)\n" ]
[ "def token_delete(remote, token=''):...\n", "\"\"\"docstring\"\"\"\n", "session_key = token_session_key(remote.name)\n", "return session.pop(session_key, None)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_1(VAR_0):...\n", "VAR_12 = dict(VAR_10=path, children=[])\n", "for i in os.listdir(VAR_0):\n", "if FUNC_0(VAR_0 + '/' + i):\n", "return VAR_12\n", "VAR_12['children'].append(FUNC_1(VAR_0 + '/' + i))\n", "VAR_12['children'].append(dict(VAR_10=i))\n" ]
[ "def traverse(path):...\n", "n = dict(name=path, children=[])\n", "for i in os.listdir(path):\n", "if is_folder(path + '/' + i):\n", "return n\n", "n['children'].append(traverse(path + '/' + i))\n", "n['children'].append(dict(name=i))\n" ]
[ 0, 0, 0, 0, 0, 0, 1 ]
[ "FunctionDef'", "Assign'", "For", "Condition", "Return'", "Expr'", "Expr'" ]
[ "def FUNC_3():...\n", "def FUNC_12():...\n", "VAR_18 = requests.get(FUNC_2('healthy'))\n", "VAR_18.raise_for_status()\n", "return VAR_18.json()\n" ]
[ "def _CheckServerIsHealthyWithCache():...\n", "def _ServerIsHealthy():...\n", "response = requests.get(_BuildUri('healthy'))\n", "response.raise_for_status()\n", "return response.json()\n" ]
[ 0, 0, 7, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "@staticmethod...\n", "Group(VAR_8).send({'text': json.dumps(VAR_9)})\n" ]
[ "@staticmethod...\n", "Group(group_channel).send({'text': json.dumps(data)})\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "@VAR_7.route('/delete-calendar', methods=['GET', 'POST'])...\n", "VAR_10 = FUNC_0()\n", "if not VAR_10:\n", "return 'Unauthorized'\n", "VAR_8, VAR_3 = FUNC_1()\n", "VAR_11 = request.form['calendar']\n", "calendar.deleteCalendar(VAR_8, VAR_11, VAR_6)\n", "VAR_12 = calendar.getCalendarList(VAR_8, VAR_6)\n", "return redirect(url_for('dashboard', VAR_12=calendars))\n" ]
[ "@app.route('/delete-calendar', methods=['GET', 'POST'])...\n", "isAuthorized = isUserAuthorized()\n", "if not isAuthorized:\n", "return 'Unauthorized'\n", "username, password = getUsernameAndPassword()\n", "calId = request.form['calendar']\n", "calendar.deleteCalendar(username, calId, mysql)\n", "calendars = calendar.getCalendarList(username, mysql)\n", "return redirect(url_for('dashboard', calendars=calendars))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_18(VAR_30, VAR_9, VAR_31, VAR_6, VAR_11, **VAR_12):...\n", "if VAR_31 is None:\n", "VAR_31 = VAR_23[VAR_9].urlstring\n", "VAR_52 = join(VAR_27, VAR_9)\n", "VAR_53 = os.path.realpath(VAR_52)\n", "if not VAR_53.startswith(VAR_26):\n", "VAR_54 = CLASS_1.create(VAR_9, VAR_31, VAR_52, VAR_6, VAR_11, **kwargs)\n", "VAR_55 = VAR_23.setdefault(VAR_9, VAR_54)\n", "if VAR_55 is VAR_54:\n", "VAR_55.parents.add(VAR_30)\n", "if VAR_54.exclude_from_cmake != VAR_55.exclude_from_cmake:\n", "if VAR_8:\n", "VAR_68 = [join(VAR_30.directory, dependency_file) for VAR_30 in VAR_55.parents]\n", "if not VAR_54.same_checkout(VAR_55) and VAR_31 is not None:\n", "VAR_55.update()\n", "VAR_28.append(VAR_55)\n", "VAR_69 = join(VAR_30.directory, dependency_file)\n", "VAR_70 = [join(VAR_30.directory, dependency_file) for VAR_30 in VAR_55.parents]\n", "for VAR_29, VAR_51 in VAR_6.items():\n", "VAR_30.children.add(VAR_55)\n", "VAR_30 = join(VAR_30.directory, dependency_file)\n", "VAR_55.options.setdefault(VAR_29, VAR_51)\n", "if VAR_55.options[VAR_29] != VAR_51:\n" ]
[ "def add_module(parent, name, uri, options, conf, **kwargs):...\n", "if uri is None:\n", "uri = modules[name].urlstring\n", "target_dir = join(subproject_dir, name)\n", "target_dir_rp = os.path.realpath(target_dir)\n", "if not target_dir_rp.startswith(source_dir_rp):\n", "newmodule = Subproject.create(name, uri, target_dir, options, conf, **kwargs)\n", "mod = modules.setdefault(name, newmodule)\n", "if mod is newmodule:\n", "mod.parents.add(parent)\n", "if newmodule.exclude_from_cmake != mod.exclude_from_cmake:\n", "if update:\n", "children_conf = [join(parent.directory, dependency_file) for parent in mod.\n parents]\n", "if not newmodule.same_checkout(mod) and uri is not None:\n", "mod.update()\n", "stack.append(mod)\n", "parent_conf = join(parent.directory, dependency_file)\n", "children = [join(parent.directory, dependency_file) for parent in mod.parents]\n", "for key, value in options.items():\n", "parent.children.add(mod)\n", "parent = join(parent.directory, dependency_file)\n", "mod.options.setdefault(key, value)\n", "if mod.options[key] != value:\n" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Expr'", "Condition" ]
[ "def FUNC_3(self, VAR_8, VAR_3):...\n", "self._r_steps_.append((f'.{VAR_8}', VAR_3))\n" ]
[ "def log_getattr(self, attr_name, roamer):...\n", "self._r_steps_.append((f'.{attr_name}', roamer))\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_11(self, VAR_16, VAR_18):...\n", "self._WriteHeader(VAR_18)\n", "self.wfile.write(f.read())\n", "f.close()\n" ]
[ "def _DoImage(self, full_path, mime_type):...\n", "self._WriteHeader(mime_type)\n", "self.wfile.write(f.read())\n", "f.close()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "self.session.cookies.load(ignore_discard=True)\n", "return False\n", "return True\n" ]
[ "def load_cookies(self):...\n", "\"\"\"docstring\"\"\"\n", "self.session.cookies.load(ignore_discard=True)\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Return'", "Return'" ]
[ "def __call__(self, *VAR_19, **VAR_5):...\n", "return CLASS_7(self.index, self.base_field, *VAR_19, **kwargs)\n" ]
[ "def __call__(self, *args, **kwargs):...\n", "return IndexTransform(self.index, self.base_field, *args, **kwargs)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(self):...\n", "VAR_12 = self.cleaned_data.get('email')\n", "VAR_22 = VAR_12.split('@')[1].lower()\n", "if VAR_22 != 'canada.ca':\n", "VAR_26 = forms.ValidationError(format(ErrorMessages.invalid_email_domain %\n VAR_22))\n", "if get_user_model().objects.filter(username=email.lower()).exists():\n", "self.add_error('email', VAR_26)\n", "VAR_26 = forms.ValidationError(format(ErrorMessages.user_already_exists %\n VAR_12))\n", "return self.cleaned_data\n", "self.add_error('email', VAR_26)\n" ]
[ "def clean(self):...\n", "email = self.cleaned_data.get('email')\n", "email_domain = email.split('@')[1].lower()\n", "if email_domain != 'canada.ca':\n", "message = forms.ValidationError(format(ErrorMessages.invalid_email_domain %\n email_domain))\n", "if get_user_model().objects.filter(username=email.lower()).exists():\n", "self.add_error('email', message)\n", "message = forms.ValidationError(format(ErrorMessages.user_already_exists %\n email))\n", "return self.cleaned_data\n", "self.add_error('email', message)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Return'", "Expr'" ]
[ "def __init__(self, VAR_40):...\n", "assert VAR_40 in (8, 16, 32, 64)\n", "self.size = VAR_40\n" ]
[ "def __init__(self, size):...\n", "assert size in (8, 16, 32, 64)\n", "self.size = size\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assert'", "Assign'" ]
[ "def __repr__(self):...\n", "return f'<Roamer: {self._r_path_.description()} => {self._r_item_!r}>'\n" ]
[ "def __repr__(self):...\n", "return f'<Roamer: {self._r_path_.description()} => {self._r_item_!r}>'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_33(self):...\n", "" ]
[ "def some_other_method(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n" ]
[ "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n" ]
[ 0, 5 ]
[ "FunctionDef'", "Expr'" ]
[ "@wraps(VAR_7)...\n", "if VAR_12:\n", "return VAR_7(VAR_8[0], VAR_1, *VAR_8[1:], **kwargs)\n", "return VAR_7(VAR_1, *VAR_8, **kwargs)\n" ]
[ "@wraps(f)...\n", "if with_response:\n", "return f(args[0], remote, *args[1:], **kwargs)\n", "return f(remote, *args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_8(VAR_2, *VAR_3, **VAR_4):...\n", "self = VAR_11(**initkwargs)\n", "if hasattr(self, 'get') and not hasattr(self, 'head'):\n", "self.head = self.get\n", "self.request = VAR_2\n", "self.args = VAR_3\n", "self.kwargs = VAR_4\n", "self.setup(VAR_2, *VAR_3, **kwargs)\n", "return self.dispatch(VAR_2, *VAR_3, **kwargs)\n" ]
[ "def view(request, *args, **kwargs):...\n", "self = cls(**initkwargs)\n", "if hasattr(self, 'get') and not hasattr(self, 'head'):\n", "self.head = self.get\n", "self.request = request\n", "self.args = args\n", "self.kwargs = kwargs\n", "self.setup(request, *args, **kwargs)\n", "return self.dispatch(request, *args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "from __future__ import unicode_literals\n", "import frappe\n", "from frappe import _\n", "from frappe.website.website_generator import WebsiteGenerator\n", "from frappe.website.render import clear_cache\n", "from frappe.utils import today, cint, global_date_format, get_fullname, strip_html_tags, markdown\n", "from frappe.website.utils import find_first_image, get_comment_list\n", "VAR_8 = frappe._dict(VAR_7='published_on desc')\n", "def FUNC_5(self):...\n", "if not self.route:\n", "return frappe.db.get_value('Blog Category', self.blog_category, 'route'\n ) + '/' + self.scrub(self.title)\n", "def FUNC_6(self):...\n", "return self.title\n" ]
[ "from __future__ import unicode_literals\n", "import frappe\n", "from frappe import _\n", "from frappe.website.website_generator import WebsiteGenerator\n", "from frappe.website.render import clear_cache\n", "from frappe.utils import today, cint, global_date_format, get_fullname, strip_html_tags, markdown\n", "from frappe.website.utils import find_first_image, get_comment_list\n", "website = frappe._dict(order_by='published_on desc')\n", "def make_route(self):...\n", "if not self.route:\n", "return frappe.db.get_value('Blog Category', self.blog_category, 'route'\n ) + '/' + self.scrub(self.title)\n", "def get_feed(self):...\n", "return self.title\n" ]
[ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Condition", "Return'", "FunctionDef'", "Return'" ]
[ "def FUNC_16(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['sos_opt_line']:\n", "VAR_28 = ['&', '|', '>', '<']\n", "if self.config['case_id']:\n", "if any(f in self.config['sos_opt_line'] for f in VAR_28):\n", "self.config['sos_cmd'] += ' --case-id=%s' % self.config['case_id']\n", "if self.config['alloptions']:\n", "self.log_warn(\n 'Possible shell script found in provided sos command. Ignoring --sos-cmd option entirely.'\n )\n", "self.config['sos_cmd'] = '%s %s' % (self.config['sos_cmd'], self.config[\n 'sos_opt_line'])\n", "self.config['sos_cmd'] += ' --alloptions'\n", "if self.config['verify']:\n", "self.config['sos_opt_line'] = None\n", "self.log_debug('User specified manual sosreport command. Command set to %s' %\n self.config['sos_cmd'])\n", "self.config['sos_cmd'] += ' --verify'\n", "if self.config['log_size']:\n", "return True\n", "self.config['sos_cmd'] += ' --log-size=%s' % self.config['log_size']\n", "if self.config['sysroot']:\n", "self.config['sos_cmd'] += ' -s %s' % self.config['sysroot']\n", "if self.config['chroot']:\n", "self.config['sos_cmd'] += ' -c %s' % self.config['chroot']\n", "if self.config['compression']:\n", "self.config['sos_cmd'] += ' -z %s' % self.config['compression']\n", "self.log_debug('Initial sos cmd set to %s' % self.config['sos_cmd'])\n" ]
[ "def configure_sos_cmd(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['sos_opt_line']:\n", "filt = ['&', '|', '>', '<']\n", "if self.config['case_id']:\n", "if any(f in self.config['sos_opt_line'] for f in filt):\n", "self.config['sos_cmd'] += ' --case-id=%s' % self.config['case_id']\n", "if self.config['alloptions']:\n", "self.log_warn(\n 'Possible shell script found in provided sos command. Ignoring --sos-cmd option entirely.'\n )\n", "self.config['sos_cmd'] = '%s %s' % (self.config['sos_cmd'], self.config[\n 'sos_opt_line'])\n", "self.config['sos_cmd'] += ' --alloptions'\n", "if self.config['verify']:\n", "self.config['sos_opt_line'] = None\n", "self.log_debug('User specified manual sosreport command. Command set to %s' %\n self.config['sos_cmd'])\n", "self.config['sos_cmd'] += ' --verify'\n", "if self.config['log_size']:\n", "return True\n", "self.config['sos_cmd'] += ' --log-size=%s' % self.config['log_size']\n", "if self.config['sysroot']:\n", "self.config['sos_cmd'] += ' -s %s' % self.config['sysroot']\n", "if self.config['chroot']:\n", "self.config['sos_cmd'] += ' -c %s' % self.config['chroot']\n", "if self.config['compression']:\n", "self.config['sos_cmd'] += ' -z %s' % self.config['compression']\n", "self.log_debug('Initial sos cmd set to %s' % self.config['sos_cmd'])\n" ]
[ 0, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 2, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "For", "AugAssign'", "Condition", "Expr'", "Assign'", "AugAssign'", "Condition", "Assign'", "Expr'", "AugAssign'", "Condition", "Return'", "AugAssign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Expr'" ]
[ "def FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3):...\n", "VAR_9 = 'string'.format(FUNC_4(VAR_2, VAR_3))\n", "VAR_10 = {'limit': VAR_1, 'offset': int(VAR_0 * VAR_1)}\n", "VAR_11 = get_cursor()\n", "VAR_12 = VAR_11.execute(VAR_9, VAR_10)\n", "VAR_7 = FUNC_5(VAR_12)\n", "return {'rows': VAR_7, 'count': FUNC_1()}\n" ]
[ "def get_books_by_page(page, pagesize, sort_col, sort_dir):...\n", "stmt = (\n \"\"\"\n select b.*,\n case when length(a.FirstName) > 0\n then (a.LastName || \", \" || a.FirstName)\n else a.LastName\n end as Author,\n s.name as Series from books as b\n left outer join collaborations as c on c.book_id=b.id\n left outer join authors as a on a.id=c.author_id\n left join series as s on s.id=b.series_id\n order by {0}\n limit :limit offset :offset\n \"\"\"\n .format(get_sort_clause(sort_col, sort_dir)))\n", "inputs = {'limit': pagesize, 'offset': int(page * pagesize)}\n", "csr = get_cursor()\n", "rst = csr.execute(stmt, inputs)\n", "rows = rows2list(rst)\n", "return {'rows': rows, 'count': get_all_books_count()}\n" ]
[ 0, 4, 4, 4, 4, 0, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_7(self):...\n", "self.assertFalse(DatabaseQuery('DocType').execute(filters={'name': ['in',\n None]}))\n", "self.assertTrue({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['not in', None]}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertTrue(result in DatabaseQuery('DocType').execute(filters={'name':\n ['in', 'DocType,DocField']}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertFalse(result in DatabaseQuery('DocType').execute(filters={'name':\n ['not in', 'DocType,DocField']}))\n" ]
[ "def test_in_not_in_filters(self):...\n", "self.assertFalse(DatabaseQuery('DocType').execute(filters={'name': ['in',\n None]}))\n", "self.assertTrue({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['not in', None]}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertTrue(result in DatabaseQuery('DocType').execute(filters={'name':\n ['in', 'DocType,DocField']}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertFalse(result in DatabaseQuery('DocType').execute(filters={'name':\n ['not in', 'DocType,DocField']}))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "For", "Expr'", "For", "Expr'" ]
[ "def FUNC_17(self, VAR_10=True):...\n", "\"\"\"docstring\"\"\"\n", "VAR_36 = self.getTransitionMatrix(VAR_10)\n", "VAR_37 = _sparse.identity(self.vcount())\n", "return VAR_37 - VAR_36\n" ]
[ "def getLaplacianMatrix(self, includeSubPaths=True):...\n", "\"\"\"docstring\"\"\"\n", "T = self.getTransitionMatrix(includeSubPaths)\n", "I = _sparse.identity(self.vcount())\n", "return I - T\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "@permission_required('tournament.add_game')...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = get_modifiable_tournament_or_404(VAR_3, VAR_2.user)\n", "VAR_8 = FUNC_0(VAR_7, VAR_1)\n", "if VAR_2.method == 'POST':\n", "VAR_30 = formset_factory(PowerAssignForm, VAR_24=BasePowerAssignFormset,\n extra=0)\n", "VAR_8.game_set.all().delete()\n", "VAR_24 = VAR_30(VAR_2.POST, VAR_5=r)\n", "VAR_31 = GameSet.objects.get(pk=1)\n", "if VAR_24.is_valid():\n", "VAR_11 = []\n", "for f in VAR_24:\n", "VAR_9 = {'tournament': VAR_7, 'round': VAR_8, 'games': VAR_21, 'formset':\n VAR_24}\n", "if VAR_7.power_assignment == Tournament.AUTO:\n", "VAR_39 = f.game\n", "send_board_call(VAR_8)\n", "return render(VAR_2, 'rounds/seeded_games.html', VAR_9)\n", "VAR_21 = FUNC_7(VAR_7, VAR_8)\n", "VAR_21 = FUNC_6(VAR_7, VAR_8)\n", "VAR_39.name = f.cleaned_data['game_name']\n", "return HttpResponseRedirect(reverse('game_index', args=(tournament_id,\n round_num)))\n", "for VAR_34, VAR_39 in enumerate(VAR_21, start=1):\n", "for VAR_34, VAR_39 in enumerate(VAR_21, start=1):\n", "VAR_39.the_set = f.cleaned_data['the_set']\n", "VAR_41 = Game.objects.create(name='R%sG%d' % (round_num, i), VAR_5=r,\n the_set=default_set)\n", "VAR_30 = formset_factory(PowerAssignForm, VAR_24=BasePowerAssignFormset,\n extra=0)\n", "VAR_41 = Game.objects.create(name='R%sG%d' % (round_num, i), VAR_5=r,\n the_set=default_set)\n", "VAR_39.full_clean()\n", "f.add_error(None, e)\n", "VAR_39.save()\n", "VAR_28 = {'game_name': VAR_41.name, 'the_set': VAR_41.the_set}\n", "VAR_24 = VAR_30(VAR_5=r, initial=data)\n", "VAR_28 = {'game_name': VAR_41.name, 'the_set': VAR_41.the_set}\n", "return render(VAR_2, 'rounds/seeded_games.html', {'tournament': VAR_7,\n 'round': VAR_8, 'formset': VAR_24})\n", "for gp_id, field in f.cleaned_data.items():\n", "for tp, power in VAR_39:\n", "for tp in VAR_39:\n", "if gp_id in ['the_set', 'game_name']:\n", "VAR_38 = GamePlayer.objects.create(player=tp.player, VAR_37=new_game, power\n =power)\n", "VAR_11.append(VAR_28)\n", "VAR_38 = GamePlayer.objects.create(player=tp.player, VAR_37=new_game)\n", "if VAR_7.power_assignment == Tournament.PREFERENCES:\n", "VAR_38 = GamePlayer.objects.get(id=gp_id)\n", "VAR_28[VAR_38.id] = power\n", "VAR_41.assign_powers_from_prefs()\n", "for tp in VAR_39:\n", "VAR_38.power = field\n", "VAR_38 = GamePlayer.objects.get(player=tp.player, VAR_37=new_game)\n", "VAR_11.append(VAR_28)\n", "VAR_38.full_clean()\n", "f.add_error(None, e)\n", "VAR_38.save()\n", "VAR_28[VAR_38.id] = VAR_38.power\n", "return render(VAR_2, 'rounds/seeded_games.html', {'tournament': VAR_7,\n 'round': VAR_8, 'formset': VAR_24})\n" ]
[ "@permission_required('tournament.add_game')...\n", "\"\"\"docstring\"\"\"\n", "t = get_modifiable_tournament_or_404(tournament_id, request.user)\n", "r = get_round_or_404(t, round_num)\n", "if request.method == 'POST':\n", "PowerAssignFormset = formset_factory(PowerAssignForm, formset=\n BasePowerAssignFormset, extra=0)\n", "r.game_set.all().delete()\n", "formset = PowerAssignFormset(request.POST, the_round=r)\n", "default_set = GameSet.objects.get(pk=1)\n", "if formset.is_valid():\n", "data = []\n", "for f in formset:\n", "context = {'tournament': t, 'round': r, 'games': games, 'formset': formset}\n", "if t.power_assignment == Tournament.AUTO:\n", "g = f.game\n", "send_board_call(r)\n", "return render(request, 'rounds/seeded_games.html', context)\n", "games = _seed_games_and_powers(t, r)\n", "games = _seed_games(t, r)\n", "g.name = f.cleaned_data['game_name']\n", "return HttpResponseRedirect(reverse('game_index', args=(tournament_id,\n round_num)))\n", "for i, g in enumerate(games, start=1):\n", "for i, g in enumerate(games, start=1):\n", "g.the_set = f.cleaned_data['the_set']\n", "new_game = Game.objects.create(name='R%sG%d' % (round_num, i), the_round=r,\n the_set=default_set)\n", "PowerAssignFormset = formset_factory(PowerAssignForm, formset=\n BasePowerAssignFormset, extra=0)\n", "new_game = Game.objects.create(name='R%sG%d' % (round_num, i), the_round=r,\n the_set=default_set)\n", "g.full_clean()\n", "f.add_error(None, e)\n", "g.save()\n", "current = {'game_name': new_game.name, 'the_set': new_game.the_set}\n", "formset = PowerAssignFormset(the_round=r, initial=data)\n", "current = {'game_name': new_game.name, 'the_set': new_game.the_set}\n", "return render(request, 'rounds/seeded_games.html', {'tournament': t,\n 'round': r, 'formset': formset})\n", "for gp_id, field in f.cleaned_data.items():\n", "for tp, power in g:\n", "for tp in g:\n", "if gp_id in ['the_set', 'game_name']:\n", "gp = GamePlayer.objects.create(player=tp.player, game=new_game, power=power)\n", "data.append(current)\n", "gp = GamePlayer.objects.create(player=tp.player, game=new_game)\n", "if t.power_assignment == Tournament.PREFERENCES:\n", "gp = GamePlayer.objects.get(id=gp_id)\n", "current[gp.id] = power\n", "new_game.assign_powers_from_prefs()\n", "for tp in g:\n", "gp.power = field\n", "gp = GamePlayer.objects.get(player=tp.player, game=new_game)\n", "data.append(current)\n", "gp.full_clean()\n", "f.add_error(None, e)\n", "gp.save()\n", "current[gp.id] = gp.power\n", "return render(request, 'rounds/seeded_games.html', {'tournament': t,\n 'round': r, 'formset': formset})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "For", "Assign'", "Condition", "Assign'", "Expr'", "Return'", "Assign'", "Assign'", "Assign'", "Return'", "For", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Return'", "For", "For", "For", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "For", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_5(VAR_1, VAR_3):...\n", "if VAR_3 == None:\n", "VAR_3 = len(VAR_1)\n", "return (VAR_3 - len(VAR_1)) * ' ' + VAR_1\n" ]
[ "def print_right_just(output, length):...\n", "if length == None:\n", "length = len(output)\n", "return (length - len(output)) * ' ' + output\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "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_14(VAR_32, VAR_5=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_52 = {}\n", "for VAR_81, info in VAR_32:\n", "VAR_52[VAR_81.output(VAR_5)] = len(info[0])\n", "return VAR_52\n" ]
[ "def _get_singlekws(skw_matches, spires=False):...\n", "\"\"\"docstring\"\"\"\n", "output = {}\n", "for single_keyword, info in skw_matches:\n", "output[single_keyword.output(spires)] = len(info[0])\n", "return output\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Assign'", "Return'" ]
[ "@classmethod...\n", "return [lambda _req: VAR_11[0]]\n" ]
[ "@classmethod...\n", "return [lambda _req: mocked_ident[0]]\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = set()\n", "for VAR_28, VAR_27 in zip(self.output, self.rule.output):\n", "if VAR_28 in self.dynamic_output:\n", "VAR_16 = defaultdict(list)\n", "for VAR_28, w in self.expand_dynamic(VAR_27, VAR_13=self.wildcards, VAR_14=\n", "for combination in VAR_15:\n", "VAR_15.add(tuple(w.items()))\n", "for name, value in combination:\n", "return VAR_16\n", "VAR_16[name].append(value)\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "combinations = set()\n", "for f, f_ in zip(self.output, self.rule.output):\n", "if f in self.dynamic_output:\n", "wildcards = defaultdict(list)\n", "for f, w in self.expand_dynamic(f_, restriction=self.wildcards, omit_value=\n", "for combination in combinations:\n", "combinations.add(tuple(w.items()))\n", "for name, value in combination:\n", "return wildcards\n", "wildcards[name].append(value)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "For", "Condition", "Assign'", "For", "For", "Expr'", "For", "Return'", "Expr'" ]
[ "def FUNC_8(self, VAR_17):...\n", "\"\"\"docstring\"\"\"\n", "VAR_29 = api.get_current_identity()\n", "if VAR_29.is_anonymous or VAR_29.is_bot:\n", "self.redirect(self.create_login_url(self.request.url))\n", "if model.is_empty_group(model.ADMIN_GROUP):\n", "return\n", "self.redirect_to('bootstrap')\n", "VAR_15 = {'page_title': 'Access Denied', 'error': VAR_17}\n", "return\n", "self.reply('auth/admin/access_denied.html', VAR_15=env, VAR_16=403)\n" ]
[ "def authorization_error(self, error):...\n", "\"\"\"docstring\"\"\"\n", "ident = api.get_current_identity()\n", "if ident.is_anonymous or ident.is_bot:\n", "self.redirect(self.create_login_url(self.request.url))\n", "if model.is_empty_group(model.ADMIN_GROUP):\n", "return\n", "self.redirect_to('bootstrap')\n", "env = {'page_title': 'Access Denied', 'error': error}\n", "return\n", "self.reply('auth/admin/access_denied.html', env=env, status=403)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Expr'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_2(self, VAR_5):...\n", "if self.table_view.verticalScrollBar().value(\n", "self.load_search_results(self.query)\n" ]
[ "def _on_list_scroll(self, event):...\n", "if self.table_view.verticalScrollBar().value(\n", "self.load_search_results(self.query)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'" ]
[ "from __future__ import unicode_literals\n", "import frappe, json\n", "from frappe.utils import cstr, unique\n", "from frappe import _\n", "from six import string_types\n", "def FUNC_0(VAR_0):...\n", "VAR_12 = ['select', 'delete', 'drop', 'update', 'case', 'and', 'or', 'like']\n", "def FUNC_6():...\n", "VAR_13.throw(_('Invalid Search Field'), VAR_13.DataError)\n", "if len(VAR_0) >= 3:\n", "if '=' in VAR_0:\n", "@VAR_13.whitelist()...\n", "FUNC_6()\n", "if ' --' in VAR_0:\n", "FUNC_2(VAR_1, VAR_2, VAR_3, VAR_0=searchfield, VAR_5=page_length, VAR_4=filters\n )\n", "FUNC_6()\n", "if any(' {0} '.format(keyword) in VAR_0.split() for keyword in VAR_12):\n", "VAR_13.response['results'] = FUNC_4(VAR_13.response['values'])\n", "FUNC_6()\n", "if any(keyword in VAR_0.split() for keyword in VAR_12):\n", "@VAR_13.whitelist()...\n", "FUNC_6()\n", "if isinstance(VAR_4, string_types):\n", "VAR_4 = json.loads(VAR_4)\n", "VAR_9 = VAR_13.get_meta(VAR_1)\n", "if VAR_0:\n", "FUNC_0(VAR_0)\n", "if not VAR_0:\n", "VAR_0 = 'name'\n", "VAR_14 = VAR_13.get_hooks().standard_queries or {}\n", "if VAR_3 and VAR_3.split()[0].lower() != 'select':\n", "VAR_13.response['values'] = VAR_13.call(VAR_3, VAR_1, VAR_2, VAR_0, VAR_6,\n VAR_5, VAR_4, VAR_8=as_dict)\n", "if not VAR_3 and VAR_1 in VAR_14:\n", "def FUNC_3(VAR_9, VAR_10):...\n", "FUNC_2(VAR_1, VAR_2, VAR_14[VAR_1][0], VAR_0, VAR_6, VAR_5, VAR_4)\n", "if VAR_3:\n", "VAR_15 = VAR_9.search_fields and VAR_9.search_fields.split(',') or []\n", "VAR_13.throw(_('This query style is discontinued'))\n", "if isinstance(VAR_4, dict):\n", "VAR_16 = [VAR_9.title_field\n ] if VAR_9.title_field and VAR_9.title_field not in VAR_15 else []\n", "VAR_25 = VAR_4.items()\n", "if VAR_4 == None:\n", "VAR_15 = ['name'] + VAR_15 + VAR_16\n", "VAR_4 = []\n", "VAR_4 = []\n", "VAR_19 = []\n", "if not VAR_10 in VAR_15:\n", "for f in VAR_25:\n", "if VAR_2:\n", "VAR_15 = VAR_15 + [VAR_10]\n", "return VAR_15\n", "if isinstance(f[1], (list, tuple)):\n", "VAR_26 = ['name']\n", "if VAR_9.get('fields', {'fieldname': 'enabled', 'fieldtype': 'Check'}):\n", "VAR_4.append([VAR_1, f[0], f[1][0], f[1][1]])\n", "VAR_4.append([VAR_1, f[0], '=', f[1]])\n", "if VAR_9.title_field:\n", "VAR_4.append([VAR_1, 'enabled', '=', 1])\n", "if VAR_9.get('fields', {'fieldname': 'disabled', 'fieldtype': 'Check'}):\n", "VAR_26.append(VAR_9.title_field)\n", "if VAR_9.search_fields:\n", "VAR_4.append([VAR_1, 'disabled', '!=', 1])\n", "VAR_20 = FUNC_3(VAR_9, VAR_0 or 'name')\n", "VAR_26.extend(VAR_9.get_search_fields())\n", "for f in VAR_26:\n", "if VAR_7:\n", "VAR_27 = VAR_9.get_field(f.strip())\n", "VAR_20 = list(set(VAR_20 + json.loads(VAR_7)))\n", "VAR_21 = [('`tab%s`.`%s`' % (VAR_9.name, f.strip())) for f in VAR_20]\n", "if f == 'name' or VAR_27 and VAR_27.fieldtype in ['Data', 'Text',\n", "VAR_21.append('locate(\"{_txt}\", `tab{doctype}`.`name`) as `_relevance`'.\n format(_txt=frappe.db.escape((txt or '').replace('%', '')), VAR_1=\n frappe.db.escape(doctype)))\n", "VAR_19.append([VAR_1, f.strip(), 'like', '%{0}%'.format(VAR_2)])\n", "from frappe.model.db_query import get_order_by\n", "VAR_22 = get_order_by(VAR_1, VAR_9)\n", "VAR_23 = 'if(_relevance, _relevance, 99999), `tab{0}`.idx desc, {1}'.format(\n VAR_1, VAR_22)\n", "VAR_24 = VAR_13.get_list(VAR_1, VAR_4=filters, VAR_20=formatted_fields,\n VAR_19=or_filters, limit_start=start, limit_page_length=page_length,\n VAR_23=order_by, ignore_permissions=True if doctype == 'DocType' else \n False, as_list=not as_dict)\n", "if VAR_8:\n", "for r in VAR_24:\n", "VAR_13.response['values'] = [r[:-1] for r in VAR_24]\n", "r.pop('_relevance')\n", "VAR_13.response['values'] = VAR_24\n" ]
[ "from __future__ import unicode_literals\n", "import frappe, json\n", "from frappe.utils import cstr, unique\n", "from frappe import _\n", "from six import string_types\n", "def sanitize_searchfield(searchfield):...\n", "blacklisted_keywords = ['select', 'delete', 'drop', 'update', 'case', 'and',\n 'or', 'like']\n", "def _raise_exception():...\n", "frappe.throw(_('Invalid Search Field'), frappe.DataError)\n", "if len(searchfield) >= 3:\n", "if '=' in searchfield:\n", "@frappe.whitelist()...\n", "_raise_exception()\n", "if ' --' in searchfield:\n", "search_widget(doctype, txt, query, searchfield=searchfield, page_length=\n page_length, filters=filters)\n", "_raise_exception()\n", "if any(' {0} '.format(keyword) in searchfield.split() for keyword in\n", "frappe.response['results'] = build_for_autosuggest(frappe.response['values'])\n", "_raise_exception()\n", "if any(keyword in searchfield.split() for keyword in blacklisted_keywords):\n", "@frappe.whitelist()...\n", "_raise_exception()\n", "if isinstance(filters, string_types):\n", "filters = json.loads(filters)\n", "meta = frappe.get_meta(doctype)\n", "if searchfield:\n", "sanitize_searchfield(searchfield)\n", "if not searchfield:\n", "searchfield = 'name'\n", "standard_queries = frappe.get_hooks().standard_queries or {}\n", "if query and query.split()[0].lower() != 'select':\n", "frappe.response['values'] = frappe.call(query, doctype, txt, searchfield,\n start, page_length, filters, as_dict=as_dict)\n", "if not query and doctype in standard_queries:\n", "def get_std_fields_list(meta, key):...\n", "search_widget(doctype, txt, standard_queries[doctype][0], searchfield,\n start, page_length, filters)\n", "if query:\n", "sflist = meta.search_fields and meta.search_fields.split(',') or []\n", "frappe.throw(_('This query style is discontinued'))\n", "if isinstance(filters, dict):\n", "title_field = [meta.title_field\n ] if meta.title_field and meta.title_field not in sflist else []\n", "filters_items = filters.items()\n", "if filters == None:\n", "sflist = ['name'] + sflist + title_field\n", "filters = []\n", "filters = []\n", "or_filters = []\n", "if not key in sflist:\n", "for f in filters_items:\n", "if txt:\n", "sflist = sflist + [key]\n", "return sflist\n", "if isinstance(f[1], (list, tuple)):\n", "search_fields = ['name']\n", "if meta.get('fields', {'fieldname': 'enabled', 'fieldtype': 'Check'}):\n", "filters.append([doctype, f[0], f[1][0], f[1][1]])\n", "filters.append([doctype, f[0], '=', f[1]])\n", "if meta.title_field:\n", "filters.append([doctype, 'enabled', '=', 1])\n", "if meta.get('fields', {'fieldname': 'disabled', 'fieldtype': 'Check'}):\n", "search_fields.append(meta.title_field)\n", "if meta.search_fields:\n", "filters.append([doctype, 'disabled', '!=', 1])\n", "fields = get_std_fields_list(meta, searchfield or 'name')\n", "search_fields.extend(meta.get_search_fields())\n", "for f in search_fields:\n", "if filter_fields:\n", "fmeta = meta.get_field(f.strip())\n", "fields = list(set(fields + json.loads(filter_fields)))\n", "formatted_fields = [('`tab%s`.`%s`' % (meta.name, f.strip())) for f in fields]\n", "if f == 'name' or fmeta and fmeta.fieldtype in ['Data', 'Text',\n", "formatted_fields.append(\n 'locate(\"{_txt}\", `tab{doctype}`.`name`) as `_relevance`'.format(_txt=\n frappe.db.escape((txt or '').replace('%', '')), doctype=frappe.db.\n escape(doctype)))\n", "or_filters.append([doctype, f.strip(), 'like', '%{0}%'.format(txt)])\n", "from frappe.model.db_query import get_order_by\n", "order_by_based_on_meta = get_order_by(doctype, meta)\n", "order_by = 'if(_relevance, _relevance, 99999), `tab{0}`.idx desc, {1}'.format(\n doctype, order_by_based_on_meta)\n", "values = frappe.get_list(doctype, filters=filters, fields=formatted_fields,\n or_filters=or_filters, limit_start=start, limit_page_length=page_length,\n order_by=order_by, ignore_permissions=True if doctype == 'DocType' else\n False, as_list=not as_dict)\n", "if as_dict:\n", "for r in values:\n", "frappe.response['values'] = [r[:-1] for r in values]\n", "r.pop('_relevance')\n", "frappe.response['values'] = values\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "FunctionDef'", "Expr'", "Condition", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "For", "Assign'", "Expr'", "For", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "FunctionDef'", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "For", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "For", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Condition", "For", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_7(VAR_3):...\n", "if os.path.exists(VAR_3):\n", "if os.path.isdir(VAR_3):\n", "os.remove(VAR_3)\n", "os.removedirs(VAR_3)\n" ]
[ "def remove(file):...\n", "if os.path.exists(file):\n", "if os.path.isdir(file):\n", "os.remove(file)\n", "os.removedirs(file)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "\"\"\"\nPostgreSQL module for vishnu.\n\"\"\"\n", "import yaml, psycopg2\n", "def FUNC_0(VAR_0):...\n", "VAR_7 = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "VAR_8 = VAR_7.cursor()\n", "VAR_8.execute('string')\n", "VAR_7.commit()\n", "VAR_8.close()\n", "VAR_7.close()\n", "def FUNC_1(VAR_0, VAR_1, VAR_2, VAR_3):...\n", "VAR_7 = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "VAR_8 = VAR_7.cursor()\n", "VAR_8.execute('string', (VAR_1, VAR_2, VAR_3))\n", "VAR_7.commit()\n", "VAR_8.close()\n", "VAR_7.close()\n", "def FUNC_2(VAR_0, VAR_4):...\n", "VAR_7 = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "VAR_8 = VAR_7.cursor()\n", "VAR_8.execute(\"\"\"\n DELETE FROM quests\n WHERE id = %s;\"\"\", VAR_4)\n", "VAR_7.commit()\n", "VAR_8.close()\n", "VAR_7.close()\n", "def FUNC_3(VAR_0, VAR_4, VAR_5):...\n", "VAR_7 = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "VAR_8 = VAR_7.cursor()\n", "VAR_8.execute(\n \"\"\"\n UPDATE quests\n SET completed = '%s'\n WHERE id = %s;\n \"\"\",\n (VAR_5, VAR_4))\n", "VAR_7.commit()\n", "VAR_8.close()\n", "VAR_7.close()\n", "def FUNC_4(VAR_0, VAR_6):...\n", "VAR_7 = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "VAR_8 = VAR_7.cursor()\n", "VAR_8.execute(VAR_6)\n", "VAR_9 = list(VAR_8.fetchall())\n", "VAR_8.close()\n", "VAR_7.close()\n", "return VAR_9\n" ]
[ "\"\"\"\nPostgreSQL module for vishnu.\n\"\"\"\n", "import yaml, psycopg2\n", "def create_tables(pg_connection):...\n", "conn = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "cur = conn.cursor()\n", "cur.execute(\n \"\"\"\n CREATE TABLE IF NOT EXISTS quests\n (id SERIAL PRIMARY KEY, tier VARCHAR, description VARCHAR, creator VARCHAR, completed BOOLEAN);\n \"\"\"\n )\n", "conn.commit()\n", "cur.close()\n", "conn.close()\n", "def import_quest_data(pg_connection, quest_tier, quest_desc, creator):...\n", "conn = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "cur = conn.cursor()\n", "cur.execute(\n \"\"\"\n INSERT INTO quests (tier, description, creator, completed)\n VALUES (%s, %s, %s, False);\n \"\"\"\n , (quest_tier, quest_desc, creator))\n", "conn.commit()\n", "cur.close()\n", "conn.close()\n", "def delete_quest(pg_connection, quest_id):...\n", "conn = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "cur = conn.cursor()\n", "cur.execute(\"\"\"\n DELETE FROM quests\n WHERE id = %s;\"\"\", quest_id)\n", "conn.commit()\n", "cur.close()\n", "conn.close()\n", "def complete_quest(pg_connection, quest_id, completion):...\n", "conn = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "cur = conn.cursor()\n", "cur.execute(\n \"\"\"\n UPDATE quests\n SET completed = '%s'\n WHERE id = %s;\n \"\"\",\n (completion, quest_id))\n", "conn.commit()\n", "cur.close()\n", "conn.close()\n", "def retrieve_quest_data(pg_connection, query):...\n", "conn = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "cur = conn.cursor()\n", "cur.execute(query)\n", "results = list(cur.fetchall())\n", "cur.close()\n", "conn.close()\n", "return results\n" ]
[ 0, 0, 0, 4, 4, 4, 0, 4, 4, 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, 4, 0, 0, 4 ]
[ "Expr'", "Import'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "@decorators.require_taskqueue('backend-default')...\n", "swarming.cancel_task(VAR_2, VAR_3)\n" ]
[ "@decorators.require_taskqueue('backend-default')...\n", "swarming.cancel_task(host, task_id)\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_1(VAR_0, VAR_2, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "return FUNC_0(VAR_0, VAR_0, VAR_2, VAR_3)\n" ]
[ "def has_unexpected_keys(expected_keys, actual_keys, name):...\n", "\"\"\"docstring\"\"\"\n", "return has_unexpected_subset_keys(expected_keys, expected_keys, actual_keys,\n name)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def __repr__(self):...\n", "return 'ColumnSet({})'.format(repr(self.columns))\n" ]
[ "def __repr__(self):...\n", "return 'ColumnSet({})'.format(repr(self.columns))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(VAR_3, VAR_4=None):...\n", "VAR_0 = CLASS_0(VAR_3)\n", "VAR_0.rule = VAR_4\n", "return VAR_0\n" ]
[ "def IOFile(file, rule=None):...\n", "f = _IOFile(file)\n", "f.rule = rule\n", "return f\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@eqlx.with_timeout...\n", "time.sleep(1)\n" ]
[ "@eqlx.with_timeout...\n", "time.sleep(1)\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def __str__(self):...\n", "return self.get_name()\n" ]
[ "def __str__(self):...\n", "return self.get_name()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_39(self, VAR_16, VAR_25=None, VAR_26=True):...\n", "\"\"\"docstring\"\"\"\n", "VAR_47 = self.meta.get_field(VAR_16)\n", "if VAR_47 and VAR_47.get('__print_hide'):\n", "return True\n", "VAR_48 = 0\n", "if self.get(VAR_16) == 0 and not self.meta.istable:\n", "VAR_48 = (VAR_25 and VAR_25.print_hide_if_no_value or VAR_47 and VAR_47.\n print_hide_if_no_value)\n", "if not VAR_48:\n", "if VAR_25 and VAR_25.print_hide is not None:\n", "return VAR_48\n", "VAR_48 = VAR_25.print_hide\n", "if VAR_47:\n", "VAR_48 = VAR_47.print_hide\n" ]
[ "def is_print_hide(self, fieldname, df=None, for_print=True):...\n", "\"\"\"docstring\"\"\"\n", "meta_df = self.meta.get_field(fieldname)\n", "if meta_df and meta_df.get('__print_hide'):\n", "return True\n", "print_hide = 0\n", "if self.get(fieldname) == 0 and not self.meta.istable:\n", "print_hide = (df and df.print_hide_if_no_value or meta_df and meta_df.\n print_hide_if_no_value)\n", "if not print_hide:\n", "if df and df.print_hide is not None:\n", "return print_hide\n", "print_hide = df.print_hide\n", "if meta_df:\n", "print_hide = meta_df.print_hide\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Return'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_5(self, VAR_2, VAR_3):...\n", "VAR_6 = psutil.Popen(['ssh', VAR_2, 'ls', '-Fa', VAR_3.as_posix()], stdout=\n PIPE, stderr=PIPE)\n", "VAR_7, VAR_8 = VAR_6.communicate()\n", "logging.debug(VAR_8.decode(encoding='UTF-8'))\n", "return VAR_7.decode(encoding='UTF-8').split('\\n')\n" ]
[ "def remote_iterdir(self, host, path):...\n", "p = psutil.Popen(['ssh', host, 'ls', '-Fa', path.as_posix()], stdout=PIPE,\n stderr=PIPE)\n", "main_output, main_error = p.communicate()\n", "logging.debug(main_error.decode(encoding='UTF-8'))\n", "return main_output.decode(encoding='UTF-8').split('\\n')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_4(self, VAR_35):...\n", "\"\"\"docstring\"\"\"\n", "VAR_44 = defaultdict(dict)\n", "for VAR_87, join_fld, VAR_86, parent_fld in VAR_35:\n", "assert VAR_86 not in VAR_44[VAR_87\n ], 'Joins with multiple fields is not supported'\n", "return VAR_44\n", "VAR_44[VAR_87][VAR_86] = {self.PARENT_COLUMN: parent_fld, self.JOIN_COLUMN:\n join_fld}\n" ]
[ "def _parse_multi_path_mapping(self, paths):...\n", "\"\"\"docstring\"\"\"\n", "path_map = defaultdict(dict)\n", "for join_tbl, join_fld, parent_tbl, parent_fld in paths:\n", "assert parent_tbl not in path_map[join_tbl\n ], 'Joins with multiple fields is not supported'\n", "return path_map\n", "path_map[join_tbl][parent_tbl] = {self.PARENT_COLUMN: parent_fld, self.\n JOIN_COLUMN: join_fld}\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Assert'", "Return'", "Assign'" ]
[ "def FUNC_14(self, VAR_9, VAR_10=None):...\n", "if isinstance(VAR_9, str) or callable(VAR_9):\n", "self.log.append(IOFile(VAR_9, VAR_16=self) if isinstance(VAR_9, str) else VAR_9\n )\n", "VAR_48 = len(self.log)\n", "if VAR_10:\n", "for VAR_51 in VAR_9:\n", "self.log.add_name(VAR_10)\n", "self._set_log_item(VAR_51)\n", "if VAR_10:\n", "self.log.set_name(VAR_10, VAR_48, end=len(self.log))\n" ]
[ "def _set_log_item(self, item, name=None):...\n", "if isinstance(item, str) or callable(item):\n", "self.log.append(IOFile(item, rule=self) if isinstance(item, str) else item)\n", "start = len(self.log)\n", "if name:\n", "for i in item:\n", "self.log.add_name(name)\n", "self._set_log_item(i)\n", "if name:\n", "self.log.set_name(name, start, end=len(self.log))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "For", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "import json\n", "from django.http import JsonResponse\n", "from django.shortcuts import redirect\n", "from django.views.decorators.csrf import csrf_exempt\n", "from django.views.decorators.http import require_http_methods\n", "from cuckoo.common.config import config\n", "from cuckoo.core.submit import SubmitManager\n", "from cuckoo.web.bin.utils import api_post, JsonSerialize, json_error_response\n", "VAR_0 = SubmitManager()\n", "def FUNC_0():...\n", "VAR_1 = config('cuckoo:cuckoo:machinery')\n", "if config('routing:vpn:enabled'):\n", "VAR_4 = config('routing:vpn:vpns')\n", "VAR_4 = []\n", "return {'machine': config('%s:%s:machines' % (VAR_1, VAR_1)), 'package':\n None, 'priority': 2, 'timeout': config('cuckoo:timeouts:default'),\n 'routing': {'route': config('routing:routing:route'), 'inetsim': config\n ('routing:inetsim:enabled'), 'tor': config('routing:tor:enabled'),\n 'vpns': VAR_4}, 'options': {'enable-services': False, 'enforce-timeout':\n False, 'full-memory-dump': config('cuckoo:cuckoo:memory_dump'),\n 'no-injection': False, 'process-memory-dump': True,\n 'simulated-human-interaction': True}}\n" ]
[ "import json\n", "from django.http import JsonResponse\n", "from django.shortcuts import redirect\n", "from django.views.decorators.csrf import csrf_exempt\n", "from django.views.decorators.http import require_http_methods\n", "from cuckoo.common.config import config\n", "from cuckoo.core.submit import SubmitManager\n", "from cuckoo.web.bin.utils import api_post, JsonSerialize, json_error_response\n", "submit_manager = SubmitManager()\n", "def defaults():...\n", "machinery = config('cuckoo:cuckoo:machinery')\n", "if config('routing:vpn:enabled'):\n", "vpns = config('routing:vpn:vpns')\n", "vpns = []\n", "return {'machine': config('%s:%s:machines' % (machinery, machinery)),\n 'package': None, 'priority': 2, 'timeout': config(\n 'cuckoo:timeouts:default'), 'routing': {'route': config(\n 'routing:routing:route'), 'inetsim': config('routing:inetsim:enabled'),\n 'tor': config('routing:tor:enabled'), 'vpns': vpns}, 'options': {\n 'enable-services': False, 'enforce-timeout': False, 'full-memory-dump':\n config('cuckoo:cuckoo:memory_dump'), 'no-injection': False,\n 'process-memory-dump': True, 'simulated-human-interaction': True}}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "@VAR_1.route('/saveAs')...\n", "if not 'email' in VAR_18 and not 'social' in VAR_18:\n", "if 'diagram' in request.args or VAR_5:\n", "return render_template('saveFile.html', VAR_5=diagram)\n", "return redirect('/login?return_url=saveAs&diagram=true')\n", "return redirect('/login?return_url=saveAs')\n" ]
[ "@app.route('/saveAs')...\n", "if not 'email' in session and not 'social' in session:\n", "if 'diagram' in request.args or diagram:\n", "return render_template('saveFile.html', diagram=diagram)\n", "return redirect('/login?return_url=saveAs&diagram=true')\n", "return redirect('/login?return_url=saveAs')\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Condition", "Return'", "Return'", "Return'" ]
[ "def FUNC_3(VAR_4):...\n", "VAR_11 = f\"string{VAR_4['rating']}\\n \"\n", "VAR_12 = create_connection()\n", "VAR_12.close()\n", "VAR_13 = VAR_12.cursor()\n", "VAR_13.execute(VAR_11)\n", "return int(VAR_13.fetchone()['total'])\n" ]
[ "def get_total_products(filters):...\n", "sql_query = f\"\"\"\n SELECT COUNT(p.id) AS total\n FROM products AS p\n WHERE p.rating >= {filters['rating']}\n \"\"\"\n", "connection = create_connection()\n", "connection.close()\n", "cursor = connection.cursor()\n", "cursor.execute(sql_query)\n", "return int(cursor.fetchone()['total'])\n" ]
[ 0, 4, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@tornado.web.authenticated...\n", "VAR_32 = VAR_51.settings['Output_dir']\n", "print('Received new settings')\n", "for VAR_41 in VAR_51.settings:\n", "VAR_43 = self.get_argument(VAR_41, None)\n", "VAR_51.writeServerSettings()\n", "if not VAR_43:\n", "self.doSettings(True)\n", "if type(VAR_51.settings[VAR_41]) == bool:\n", "if type(VAR_51.settings[VAR_41]) == bool:\n", "if VAR_32 != VAR_51.settings['Output_dir']:\n", "VAR_51.settings[VAR_41] = False\n", "print('string'.format(VAR_41))\n", "VAR_43 = True\n", "if type(VAR_51.settings[VAR_41]) == int:\n", "FUNC_0(VAR_51.settings['Output_dir'])\n", "VAR_51.settings[VAR_41] = VAR_43\n", "VAR_43 = int(VAR_43)\n" ]
[ "@tornado.web.authenticated...\n", "currentOutputDir = settings.settings['Output_dir']\n", "print('Received new settings')\n", "for option in settings.settings:\n", "newValue = self.get_argument(option, None)\n", "settings.writeServerSettings()\n", "if not newValue:\n", "self.doSettings(True)\n", "if type(settings.settings[option]) == bool:\n", "if type(settings.settings[option]) == bool:\n", "if currentOutputDir != settings.settings['Output_dir']:\n", "settings.settings[option] = False\n", "print(\n \"\"\"Warning: Option {} unset! The settingsStructure might be out of sync.\n\tIgnore this if the field is intentionally empty\"\"\"\n .format(option))\n", "newValue = True\n", "if type(settings.settings[option]) == int:\n", "generateSavedImagesCache(settings.settings['Output_dir'])\n", "settings.settings[option] = newValue\n", "newValue = int(newValue)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'", "For", "Assign'", "Expr'", "Condition", "Expr'", "Condition", "Condition", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_6(self, VAR_11, VAR_52=None):...\n", "if VAR_52 is None and not isinstance(VAR_101.site, FakeSubreddit):\n", "VAR_52 = VAR_101.site\n", "if VAR_52:\n", "if not VAR_11:\n", "VAR_52 = None\n", "VAR_52 = Subreddit._by_name(VAR_52)\n", "VAR_101.errors.add(errors.SUBREDDIT_NOEXIST)\n", "return self.error(errors.NO_URL)\n", "VAR_11 = utils.sanitize_url(VAR_11)\n", "VAR_52 = None\n", "if VAR_11 == 'self':\n", "return VAR_11\n", "if VAR_11:\n", "VAR_108 = Link._by_url(VAR_11, VAR_52)\n", "return VAR_11\n", "return self.error(errors.BAD_URL)\n", "self.error(errors.ALREADY_SUB)\n", "return utils.tup(VAR_108)\n" ]
[ "def run(self, url, sr=None):...\n", "if sr is None and not isinstance(c.site, FakeSubreddit):\n", "sr = c.site\n", "if sr:\n", "if not url:\n", "sr = None\n", "sr = Subreddit._by_name(sr)\n", "c.errors.add(errors.SUBREDDIT_NOEXIST)\n", "return self.error(errors.NO_URL)\n", "url = utils.sanitize_url(url)\n", "sr = None\n", "if url == 'self':\n", "return url\n", "if url:\n", "l = Link._by_url(url, sr)\n", "return url\n", "return self.error(errors.BAD_URL)\n", "self.error(errors.ALREADY_SUB)\n", "return utils.tup(l)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Expr'", "Return'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Return'", "Return'", "Expr'", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "VAR_23 = self.common.create_volume_from_snapshot(VAR_7, VAR_9)\n", "self.common.client_logout()\n", "return {'metadata': VAR_23}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "metadata = self.common.create_volume_from_snapshot(volume, snapshot)\n", "self.common.client_logout()\n", "return {'metadata': metadata}\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "from osv import osv\n", "from tools.translate import _\n", "VAR_0 = 'pos.close.statement'\n", "VAR_1 = 'Close Statements'\n", "def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n", "VAR_7 = []\n", "VAR_8 = self.pool.get('ir.model.data')\n", "VAR_9 = self.pool.get('account.bank.statement')\n", "VAR_10 = 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_11 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_11)))\n", "VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "for journal in VAR_10.browse(VAR_2, VAR_3, VAR_12):\n", "VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n", "VAR_13 = self.pool.get('ir.model.data')\n", "if not VAR_4:\n", "VAR_14 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n", "VAR_7.append(VAR_4[0])\n", "VAR_15 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n", "if not journal.check_dtls:\n", "if VAR_14:\n", "VAR_9.button_confirm_cash(VAR_2, VAR_3, VAR_4, VAR_5)\n", "VAR_14 = VAR_13.browse(VAR_2, VAR_3, VAR_14, VAR_5=context).res_id\n", "if VAR_15:\n", "VAR_15 = VAR_13.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n", "return {'domain': \"[('id','in',\" + str(VAR_7) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(VAR_14, 'tree'), (\n VAR_15, 'form')], 'type': 'ir.actions.act_window'}\n" ]
[ "from osv import osv\n", "from tools.translate import _\n", "_name = 'pos.close.statement'\n", "_description = 'Close Statements'\n", "def close_statement(self, cr, uid, ids, context):...\n", "\"\"\"docstring\"\"\"\n", "company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n", "list_statement = []\n", "mod_obj = self.pool.get('ir.model.data')\n", "statement_obj = self.pool.get('account.bank.statement')\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 not ids:\n", "id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n", "list_statement.append(ids[0])\n", "id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n", "if not journal.check_dtls:\n", "if id2:\n", "statement_obj.button_confirm_cash(cr, uid, ids, context)\n", "id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n", "if id3:\n", "id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n", "return {'domain': \"[('id','in',\" + str(list_statement) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(id2, 'tree'), (id3,\n 'form')], 'type': 'ir.actions.act_window'}\n" ]
[ 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 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_32(self, VAR_15):...\n", "for file_col in self.get_file_column_list():\n", "if self.is_file(file_col):\n", "for file_col in self.get_image_column_list():\n", "if getattr(VAR_15, file_col):\n", "if self.is_image(file_col):\n", "VAR_28 = FileManager()\n", "if getattr(VAR_15, file_col):\n", "VAR_28.delete_file(getattr(VAR_15, file_col))\n", "VAR_29 = ImageManager()\n", "VAR_29.delete_file(getattr(VAR_15, file_col))\n" ]
[ "def _delete_files(self, item):...\n", "for file_col in self.get_file_column_list():\n", "if self.is_file(file_col):\n", "for file_col in self.get_image_column_list():\n", "if getattr(item, file_col):\n", "if self.is_image(file_col):\n", "fm = FileManager()\n", "if getattr(item, file_col):\n", "fm.delete_file(getattr(item, file_col))\n", "im = ImageManager()\n", "im.delete_file(getattr(item, file_col))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "For", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_1(VAR_14, VAR_15, VAR_16=VAR_9):...\n", "return \"\"\"\n CREATE TABLE IF NOT EXISTS %(name)s (%(columns)s) ENGINE = %(engine)s\"\"\" % {\n 'columns': VAR_16.for_schema(), 'engine': VAR_15, 'name': VAR_14}\n" ]
[ "def get_table_definition(name, engine, columns=ALL_COLUMNS):...\n", "return \"\"\"\n CREATE TABLE IF NOT EXISTS %(name)s (%(columns)s) ENGINE = %(engine)s\"\"\" % {\n 'columns': columns.for_schema(), 'engine': engine, 'name': name}\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@VAR_0.route('/users/<id>/destroy')...\n", "VAR_5 = VAR_1\n", "VAR_2 = connectToMySQL('users_db')\n", "VAR_6 = 'DELETE from users WHERE id = ' + VAR_5 + ';'\n", "VAR_7 = VAR_2.query_db(VAR_6)\n", "return redirect('/users')\n" ]
[ "@app.route('/users/<id>/destroy')...\n", "user_id = id\n", "mysql = connectToMySQL('users_db')\n", "query = 'DELETE from users WHERE id = ' + user_id + ';'\n", "deleted_user = mysql.query_db(query)\n", "return redirect('/users')\n" ]
[ 0, 0, 0, 4, 4, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@VAR_8.command()...\n", "\"\"\"docstring\"\"\"\n", "if FUNC_0(VAR_9):\n", "if VAR_10 in VAR_6:\n", "await VAR_9.send(VAR_5)\n", "if len(VAR_11) < 100:\n", "await VAR_9.send(\n 'Error: The quest tier you specified is invalid. The valid quest tiers are: '\n + ', '.join(VAR_6) + '. You specified: ' + VAR_10)\n", "VAR_29 = ' '.join(VAR_11)\n", "await VAR_9.send(\n 'Error: Your description is too long. The maximum allowed characters is 100, you had '\n + str(len(VAR_11)))\n", "VAR_30 = str(VAR_9.author)\n", "pgsql.import_quest_data(VAR_3, VAR_10, VAR_29, VAR_30)\n", "print('Tier {} quest added by {}. Description: {}'.format(VAR_10, str(VAR_9\n .author), VAR_29))\n", "await VAR_9.send('Tier {} quest added by {}. Description: {}'.format(VAR_10,\n str(VAR_9.author), VAR_29))\n" ]
[ "@bot.command()...\n", "\"\"\"docstring\"\"\"\n", "if whitelist_check(ctx):\n", "if quest_tier in quest_tier_whitelist:\n", "await ctx.send(permission_error_message)\n", "if len(desc) < 100:\n", "await ctx.send(\n 'Error: The quest tier you specified is invalid. The valid quest tiers are: '\n + ', '.join(quest_tier_whitelist) + '. You specified: ' + quest_tier)\n", "quest_desc = ' '.join(desc)\n", "await ctx.send(\n 'Error: Your description is too long. The maximum allowed characters is 100, you had '\n + str(len(desc)))\n", "creator = str(ctx.author)\n", "pgsql.import_quest_data(pg_connection, quest_tier, quest_desc, creator)\n", "print('Tier {} quest added by {}. Description: {}'.format(quest_tier, str(\n ctx.author), quest_desc))\n", "await ctx.send('Tier {} quest added by {}. Description: {}'.format(\n quest_tier, str(ctx.author), quest_desc))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_11(self, VAR_17):...\n", "\"\"\"docstring\"\"\"\n", "VAR_44 = 'confirmation', 'paging', 'events', 'formatoutput'\n", "VAR_0.error(_('Failed to setup the Dell EqualLogic driver'))\n", "for feature in VAR_44:\n", "self._eql_execute('cli-settings', feature, 'off')\n", "for line in self._eql_execute('grpparams', 'show'):\n", "if line.startswith('Group-Ipaddress:'):\n", "VAR_0.info(_('EQL-driver: Setup is complete, group IP is %s'), self._group_ip)\n", "VAR_50 = line.rstrip().partition(' ')\n", "self._group_ip = VAR_50[-1]\n" ]
[ "def do_setup(self, context):...\n", "\"\"\"docstring\"\"\"\n", "disabled_cli_features = 'confirmation', 'paging', 'events', 'formatoutput'\n", "LOG.error(_('Failed to setup the Dell EqualLogic driver'))\n", "for feature in disabled_cli_features:\n", "self._eql_execute('cli-settings', feature, 'off')\n", "for line in self._eql_execute('grpparams', 'show'):\n", "if line.startswith('Group-Ipaddress:'):\n", "LOG.info(_('EQL-driver: Setup is complete, group IP is %s'), self._group_ip)\n", "out_tup = line.rstrip().partition(' ')\n", "self._group_ip = out_tup[-1]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "For", "Expr'", "For", "Condition", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_13(self, VAR_22):...\n", "logging.warning(\"\"\"Authorization error.\n%s\nPeer: %s\nIP: %s\"\"\", VAR_22, api.\n get_peer_identity().to_bytes(), self.request.remote_addr)\n", "self.abort_with_error(403, text=str(error))\n" ]
[ "def authorization_error(self, error):...\n", "logging.warning(\"\"\"Authorization error.\n%s\nPeer: %s\nIP: %s\"\"\", error, api.\n get_peer_identity().to_bytes(), self.request.remote_addr)\n", "self.abort_with_error(403, text=str(error))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "print(\"\"\"\nThe following cluster options are available:\n\"\"\")\n", "print('{:15} {:15} {:<10} {:10} {:<}'.format('Cluster', 'Option Name',\n 'Type', 'Default', 'Description'))\n", "for VAR_39 in self.clusters:\n", "for opt in self.clusters[VAR_39].options:\n", "print('string')\n", "VAR_33 = '{:15} {:15} {:<10} {:<10} {:<10}'.format(opt.cluster, opt.name,\n opt.opt_type.__name__, str(opt.value), opt.description)\n", "print(VAR_33)\n" ]
[ "def list_options(self):...\n", "\"\"\"docstring\"\"\"\n", "print(\"\"\"\nThe following cluster options are available:\n\"\"\")\n", "print('{:15} {:15} {:<10} {:10} {:<}'.format('Cluster', 'Option Name',\n 'Type', 'Default', 'Description'))\n", "for cluster in self.clusters:\n", "for opt in self.clusters[cluster].options:\n", "print(\n \"\"\"\nOptions take the form of cluster.name=value\nE.G. \"ovirt.no-database=True\" or \"pacemaker.offline=False\\\"\"\"\"\n )\n", "optln = '{:15} {:15} {:<10} {:<10} {:<10}'.format(opt.cluster, opt.name,\n opt.opt_type.__name__, str(opt.value), opt.description)\n", "print(optln)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "For", "For", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_0(self):...\n", "return [c.to_map() for c in self.commands]\n" ]
[ "def to_map(self):...\n", "return [c.to_map() for c in self.commands]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_10(VAR_9, VAR_10, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = [iter(VAR_9)] * VAR_10\n", "return izip_longest(*VAR_15, VAR_11=fillvalue)\n" ]
[ "def grouper(iterable, n, fillvalue=None):...\n", "\"\"\"docstring\"\"\"\n", "args = [iter(iterable)] * n\n", "return izip_longest(*args, fillvalue=fillvalue)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "import asyncio, base64, bcrypt, time, string\n", "from aiohttp import web\n", "from cryptography import fernet\n", "from aiohttp_session import setup as session_setup, get_session, session_middleware\n", "from aiohttp_session.cookie_storage import EncryptedCookieStorage\n", "from psycopg2 import IntegrityError\n", "import database\n", "import mazemap\n", "VAR_0 = 'string'[1:-1]\n", "def FUNC_0(VAR_1):...\n", "async def FUNC_15(*VAR_8, **VAR_9):...\n", "VAR_12 = await get_session(VAR_8[0])\n", "if 'uname' in VAR_12 and 'ignore_timeout' not in VAR_12:\n", "VAR_23 = time.time()\n", "VAR_12['visit_time'] = time.time()\n", "VAR_24 = VAR_12['visit_time']\n", "VAR_11 = await VAR_1(*VAR_8, **kwargs)\n", "if VAR_23 - VAR_24 > FUNC_0.timeout:\n", "VAR_19 = web.Response(content_type='text/html', VAR_11=HTML_base.format(\n text=text))\n", "VAR_12['visit_time'] = VAR_23\n", "return VAR_19\n" ]
[ "import asyncio, base64, bcrypt, time, string\n", "from aiohttp import web\n", "from cryptography import fernet\n", "from aiohttp_session import setup as session_setup, get_session, session_middleware\n", "from aiohttp_session.cookie_storage import EncryptedCookieStorage\n", "from psycopg2 import IntegrityError\n", "import database\n", "import mazemap\n", "HTML_base = (\n \"\"\"\n<!doctype html>\n<html>\n<title>Toilet Finder</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\n{text}\n\n</html>\n\"\"\"\n [1:-1])\n", "def handle_html(func):...\n", "async def ret(*args, **kwargs):...\n", "session = await get_session(args[0])\n", "if 'uname' in session and 'ignore_timeout' not in session:\n", "t = time.time()\n", "session['visit_time'] = time.time()\n", "prev = session['visit_time']\n", "text = await func(*args, **kwargs)\n", "if t - prev > handle_html.timeout:\n", "out = web.Response(content_type='text/html', text=HTML_base.format(text=text))\n", "session['visit_time'] = t\n", "return out\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Assign'", "FunctionDef'", "AsyncFunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_9(self, VAR_10):...\n", "if not FUNC_1(self.view):\n", "FUNC_2(self.view)\n", "VAR_2 = datetime.datetime.now().strftime('<%a., %b. %d, %Y, %I:%M %p>')\n", "VAR_8 = self.view.file_name().split('/')[-1]\n", "self.view.run_command('move_to', {'to': 'eof'})\n", "self.view.run_command('insert_snippet', {'contents': \n 'Metadata added to existing file: ' + VAR_2 + '\\n'})\n", "self.view.run_command('insert_snippet', {'contents': 'Existing filename: ' +\n VAR_8 + '\\n'})\n", "self.view.run_command('move_to', {'to': 'bof'})\n" ]
[ "def run(self, edit):...\n", "if not has_meta(self.view):\n", "add_separator(self.view)\n", "timestamp = datetime.datetime.now().strftime('<%a., %b. %d, %Y, %I:%M %p>')\n", "filename = self.view.file_name().split('/')[-1]\n", "self.view.run_command('move_to', {'to': 'eof'})\n", "self.view.run_command('insert_snippet', {'contents': \n 'Metadata added to existing file: ' + timestamp + '\\n'})\n", "self.view.run_command('insert_snippet', {'contents': 'Existing filename: ' +\n filename + '\\n'})\n", "self.view.run_command('move_to', {'to': 'bof'})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_3(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "if 'category_discovery' not in VAR_5.render_flags:\n", "VAR_9 = HeaderRenderer.category_headers(VAR_5)\n", "return self._json_obj(VAR_5)\n", "[self.headers.append(('Category', h)) for h in VAR_9.headers()]\n" ]
[ "def _render_single_obj(self, obj):...\n", "\"\"\"docstring\"\"\"\n", "if 'category_discovery' not in obj.render_flags:\n", "category_headers = HeaderRenderer.category_headers(obj)\n", "return self._json_obj(obj)\n", "[self.headers.append(('Category', h)) for h in category_headers.headers()]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_16(**VAR_19):...\n", "VAR_35 = FUNC_8('users/add', VAR_16=kwargs)\n", "VAR_46 = re.search('/user/([0-9]+)$', VAR_35.url)\n", "if VAR_46:\n", "VAR_10 = int(VAR_46.group(1))\n", "VAR_19['user_id'] = VAR_10\n", "VAR_3[VAR_10] = VAR_19\n", "VAR_35 = FUNC_8('contest/' + VAR_19['contest_id'] + '/users/add', VAR_16=kwargs\n )\n", "VAR_46 = re.search('<input type=\"radio\" name=\"user_id\" value=\"' + VAR_68(\n VAR_10) + '\"/>', VAR_35.text)\n", "if VAR_46:\n", "return VAR_10\n" ]
[ "def add_user(**kwargs):...\n", "r = admin_req('users/add', args=kwargs)\n", "g = re.search('/user/([0-9]+)$', r.url)\n", "if g:\n", "user_id = int(g.group(1))\n", "kwargs['user_id'] = user_id\n", "created_users[user_id] = kwargs\n", "r = admin_req('contest/' + kwargs['contest_id'] + '/users/add', args=kwargs)\n", "g = re.search('<input type=\"radio\" name=\"user_id\" value=\"' + str(user_id) +\n '\"/>', r.text)\n", "if g:\n", "return user_id\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_27(VAR_32, VAR_3):...\n", "self.assertEqual('https://localhost:1/swarming/api/v1/bot/bot_code/123', VAR_3)\n", "self.assertEqual(VAR_31, VAR_32)\n", "z.writestr('__main__.py', 'print(\"hi\")')\n", "return True\n" ]
[ "def url_retrieve(f, url):...\n", "self.assertEqual('https://localhost:1/swarming/api/v1/bot/bot_code/123', url)\n", "self.assertEqual(new_zip, f)\n", "z.writestr('__main__.py', 'print(\"hi\")')\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_6(self, VAR_25):...\n", "VAR_77 = []\n", "if VAR_25:\n", "VAR_77 = [VAR_3 for VAR_3 in self.comma_sep.split(VAR_25) if VAR_3 ==\n _force_ascii(VAR_3)]\n", "return VAR_77\n" ]
[ "def run(self, tag_field):...\n", "tags = []\n", "if tag_field:\n", "tags = [x for x in self.comma_sep.split(tag_field) if x == _force_ascii(x)]\n", "return tags\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_27(self, VAR_75):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.threads = VAR_75\n", "return VAR_101\n" ]
[ "def threads(self, threads):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.threads = threads\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "@VAR_1.route(VAR_0 + '/create', methods=['GET'])...\n", "return ujson.dumps({'success': True})\n" ]
[ "@post.route(BASE_URL + '/create', methods=['GET'])...\n", "return ujson.dumps({'success': True})\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "async def FUNC_0(VAR_0, VAR_1):...\n", "await FUNC_2(VAR_0, VAR_1)\n" ]
[ "async def respond(bot, message):...\n", "await user_add(bot, message)\n" ]
[ 0, 0 ]
[ "AsyncFunctionDef'", "Expr'" ]
[ "def FUNC_3(self, VAR_6):...\n", "self.common = self._init_common()\n", "self._check_flags()\n", "self.iscsi_ips = {}\n", "VAR_21 = {}\n", "if len(self.configuration.hp3par_iscsi_ips) > 0:\n", "for VAR_42 in self.configuration.hp3par_iscsi_ips:\n", "if self.configuration.iscsi_ip_address not in VAR_21:\n", "VAR_38 = VAR_42.split(':')\n", "VAR_38 = self.configuration.iscsi_ip_address\n", "VAR_22 = self.common.get_ports()['iSCSI']\n", "if len(VAR_38) == 1:\n", "VAR_39 = self.configuration.iscsi_port\n", "for VAR_38, iscsi_info in VAR_22.iteritems():\n", "VAR_21[VAR_42] = {'ip_port': VAR_2}\n", "if len(VAR_38) == 2:\n", "VAR_21[VAR_38] = {'ip_port': VAR_39}\n", "if VAR_38 in VAR_21:\n", "if self.configuration.iscsi_ip_address in VAR_21:\n", "VAR_21[VAR_38[0]] = {'ip_port': VAR_38[1]}\n", "VAR_40 = _(\"Invalid IP address format '%s'\") % VAR_42\n", "VAR_39 = VAR_21[VAR_38]['ip_port']\n", "if len(VAR_21) > 0:\n", "VAR_1.warn(VAR_40)\n", "self.iscsi_ips[VAR_38] = {'ip_port': VAR_39, 'nsp': iscsi_info['nsp'],\n 'iqn': iscsi_info['iqn']}\n", "VAR_40 = _('string') % ', '.join(VAR_21)\n", "if not len(self.iscsi_ips) > 0:\n", "VAR_1.warn(VAR_40)\n", "VAR_40 = _('At least one valid iSCSI IP address must be set.')\n", "self.common.do_setup(VAR_6)\n" ]
[ "def do_setup(self, context):...\n", "self.common = self._init_common()\n", "self._check_flags()\n", "self.iscsi_ips = {}\n", "temp_iscsi_ip = {}\n", "if len(self.configuration.hp3par_iscsi_ips) > 0:\n", "for ip_addr in self.configuration.hp3par_iscsi_ips:\n", "if self.configuration.iscsi_ip_address not in temp_iscsi_ip:\n", "ip = ip_addr.split(':')\n", "ip = self.configuration.iscsi_ip_address\n", "iscsi_ports = self.common.get_ports()['iSCSI']\n", "if len(ip) == 1:\n", "ip_port = self.configuration.iscsi_port\n", "for ip, iscsi_info in iscsi_ports.iteritems():\n", "temp_iscsi_ip[ip_addr] = {'ip_port': DEFAULT_ISCSI_PORT}\n", "if len(ip) == 2:\n", "temp_iscsi_ip[ip] = {'ip_port': ip_port}\n", "if ip in temp_iscsi_ip:\n", "if self.configuration.iscsi_ip_address in temp_iscsi_ip:\n", "temp_iscsi_ip[ip[0]] = {'ip_port': ip[1]}\n", "msg = _(\"Invalid IP address format '%s'\") % ip_addr\n", "ip_port = temp_iscsi_ip[ip]['ip_port']\n", "if len(temp_iscsi_ip) > 0:\n", "LOG.warn(msg)\n", "self.iscsi_ips[ip] = {'ip_port': ip_port, 'nsp': iscsi_info['nsp'], 'iqn':\n iscsi_info['iqn']}\n", "msg = _(\n \"Found invalid iSCSI IP address(s) in configuration option(s) hp3par_iscsi_ips or iscsi_ip_address '%s.'\"\n ) % ', '.join(temp_iscsi_ip)\n", "if not len(self.iscsi_ips) > 0:\n", "LOG.warn(msg)\n", "msg = _('At least one valid iSCSI IP address must be set.')\n", "self.common.do_setup(context)\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 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "For", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "For", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_12 = self.cleaned_data.get('email').lower()\n", "VAR_16 = self.cleaned_data.get('password')\n", "return authenticate(username=email, VAR_16=password)\n" ]
[ "def get_user(self):...\n", "email = self.cleaned_data.get('email').lower()\n", "password = self.cleaned_data.get('password')\n", "return authenticate(username=email, password=password)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_37(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'LOW': 1, 'MEDIUM': 10, 'HIGH': 7}, 'CONFIDENCE': {\n 'LOW': 0, 'MEDIUM': 11, 'HIGH': 7}}\n", "self.check_example('ssl-insecure-version.py', VAR_2)\n" ]
[ "def test_ssl_insecure_version(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'LOW': 1, 'MEDIUM': 10, 'HIGH': 7}, 'CONFIDENCE': {\n 'LOW': 0, 'MEDIUM': 11, 'HIGH': 7}}\n", "self.check_example('ssl-insecure-version.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_14(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = 3\n", "VAR_10 = 'string'.format(repo_dir=REPO_DIR, shard_str='/shard_' + self.\n shard if self.shard else '', procs=process_count)\n", "VAR_7 = BokChoyTestSuite('', num_processes=process_count)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(VAR_7), VAR_10)\n" ]
[ "def test_verbosity_settings_3_processes(self):...\n", "\"\"\"docstring\"\"\"\n", "process_count = 3\n", "expected_verbosity_string = (\n '--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --processes={procs} --no-color --process-timeout=1200'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else '', procs=process_count))\n", "suite = BokChoyTestSuite('', num_processes=process_count)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),\n expected_verbosity_string)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_29(self, VAR_15):...\n", "" ]
[ "def delete(self, item):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_4(VAR_5, VAR_1: 'projects.Project'):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = VAR_5.filename\n", "if VAR_15.startswith(VAR_1.source_directory):\n", "VAR_15 = VAR_15[len(VAR_1.source_directory) + 1:]\n", "VAR_16 = VAR_5.name\n", "if VAR_16 == '<module>':\n", "VAR_16 = None\n", "return dict(VAR_15=filename, VAR_16=location, line_number=stack_frame.\n lineno, line=stack_frame.line)\n" ]
[ "def format_stack_frame(stack_frame, project: 'projects.Project'):...\n", "\"\"\"docstring\"\"\"\n", "filename = stack_frame.filename\n", "if filename.startswith(project.source_directory):\n", "filename = filename[len(project.source_directory) + 1:]\n", "location = stack_frame.name\n", "if location == '<module>':\n", "location = None\n", "return dict(filename=filename, location=location, line_number=stack_frame.\n lineno, line=stack_frame.line)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_0():...\n", "register_parser(VAR_0, CLASS_0)\n", "register_renderer(VAR_0, CLASS_1)\n" ]
[ "def register():...\n", "register_parser(CONTENT_TYPE, JSONParser)\n", "register_renderer(CONTENT_TYPE, JSONRenderer)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "@FUNC_7...\n", "\"\"\"docstring\"\"\"\n", "FUNC_1(VAR_1, VAR_2)\n", "return redirect('/')\n" ]
[ "@oauth_error_handler...\n", "\"\"\"docstring\"\"\"\n", "response_token_setter(remote, resp)\n", "return redirect('/')\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Return'" ]
[ "@VAR_0.route('/tables')...\n", "return render_template('tables.html', User=User.query.all())\n" ]
[ "@app.route('/tables')...\n", "return render_template('tables.html', User=User.query.all())\n" ]
[ 0, 4 ]
[ "Condition", "Return'" ]
[ "def FUNC_0():...\n", "return {'header': {'to': ['[email protected]', '[email protected]'],\n 'cc': ['[email protected]', '[email protected]'], 'bcc': [\n '[email protected]', '[email protected]'], 'subject': 'Subject'},\n 'body': 'Body', 'ident': '', 'tags': []}\n" ]
[ "def mail_dict():...\n", "return {'header': {'to': ['[email protected]', '[email protected]'],\n 'cc': ['[email protected]', '[email protected]'], 'bcc': [\n '[email protected]', '[email protected]'], 'subject': 'Subject'},\n 'body': 'Body', 'ident': '', 'tags': []}\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import argparse\n", "import os\n", "import sys\n", "from time import sleep\n", "import kijiji_api\n", "import generate_inf_file as generator\n", "if sys.version_info < (3, 0):\n", "def FUNC_0():...\n", "VAR_3 = argparse.ArgumentParser(description='Post ads on Kijiji')\n", "VAR_3.add_argument('-u', '--username', help='username of your kijiji account')\n", "VAR_3.add_argument('-p', '--password', help='password of your kijiji account')\n", "VAR_4 = VAR_3.add_subparsers(help='sub-command help')\n", "VAR_5 = VAR_4.add_parser('post', help='post a new ad')\n", "VAR_5.add_argument('inf_file', type=str, help=\n '.inf file containing posting details')\n", "VAR_5.set_defaults(function=post_ad)\n", "VAR_6 = VAR_4.add_parser('folder', help='post ad from folder')\n", "VAR_6.add_argument('folderName', type=str, help='folder containing ad details')\n", "VAR_6.set_defaults(function=post_folder)\n", "VAR_7 = VAR_4.add_parser('repost_folder', help='post ad from folder')\n", "VAR_7.add_argument('folderName', type=str, help='folder containing ad details')\n", "VAR_7.set_defaults(function=repost_folder)\n", "VAR_8 = VAR_4.add_parser('show', help='show currently listed ads')\n", "VAR_8.set_defaults(function=show_ads)\n", "VAR_9 = VAR_4.add_parser('delete', help='delete a listed ad')\n", "VAR_9.add_argument('id', type=str, help='id of the ad you wish to delete')\n", "VAR_9.set_defaults(function=delete_ad)\n", "VAR_10 = VAR_4.add_parser('nuke', help='delete all ads')\n", "VAR_10.set_defaults(function=nuke)\n", "VAR_11 = VAR_4.add_parser('check_ad', help='check if ad is active')\n", "VAR_11.add_argument('folderName', type=str, help='folder containing ad details'\n )\n", "VAR_11.set_defaults(function=check_ad)\n", "VAR_12 = VAR_4.add_parser('repost', help='repost an existing ad')\n", "VAR_12.add_argument('inf_file', type=str, help=\n '.inf file containing posting details')\n", "VAR_12.set_defaults(function=repost_ad)\n", "VAR_13 = VAR_4.add_parser('build_ad', help=\n 'Generates the item.inf file for a new ad')\n", "VAR_13.set_defaults(function=generate_inf_file)\n", "VAR_0 = VAR_3.parse_args()\n", "VAR_0.function(VAR_0)\n", "VAR_3.print_help()\n", "def FUNC_1(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_0.inf_file = 'item.inf'\n", "VAR_14 = VAR_0.folderName + '/login.inf'\n", "VAR_15 = [line.strip() for line in open(VAR_14, 'r')]\n", "VAR_0.username = VAR_15[0]\n", "VAR_0.password = VAR_15[1]\n", "def FUNC_2(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = {VAR_24: VAR_25 for line in infFileLines for VAR_24, VAR_25 in (\n line.strip().split('='),)}\n", "VAR_16 = [open(picture, 'rb').read() for picture in VAR_17['imageCsv'].\n split(',')]\n", "return [VAR_17, VAR_16]\n" ]
[ "import argparse\n", "import os\n", "import sys\n", "from time import sleep\n", "import kijiji_api\n", "import generate_inf_file as generator\n", "if sys.version_info < (3, 0):\n", "def main():...\n", "parser = argparse.ArgumentParser(description='Post ads on Kijiji')\n", "parser.add_argument('-u', '--username', help='username of your kijiji account')\n", "parser.add_argument('-p', '--password', help='password of your kijiji account')\n", "subparsers = parser.add_subparsers(help='sub-command help')\n", "postParser = subparsers.add_parser('post', help='post a new ad')\n", "postParser.add_argument('inf_file', type=str, help=\n '.inf file containing posting details')\n", "postParser.set_defaults(function=post_ad)\n", "folderParser = subparsers.add_parser('folder', help='post ad from folder')\n", "folderParser.add_argument('folderName', type=str, help=\n 'folder containing ad details')\n", "folderParser.set_defaults(function=post_folder)\n", "repostFolderParser = subparsers.add_parser('repost_folder', help=\n 'post ad from folder')\n", "repostFolderParser.add_argument('folderName', type=str, help=\n 'folder containing ad details')\n", "repostFolderParser.set_defaults(function=repost_folder)\n", "showParser = subparsers.add_parser('show', help='show currently listed ads')\n", "showParser.set_defaults(function=show_ads)\n", "deleteParser = subparsers.add_parser('delete', help='delete a listed ad')\n", "deleteParser.add_argument('id', type=str, help=\n 'id of the ad you wish to delete')\n", "deleteParser.set_defaults(function=delete_ad)\n", "nukeParser = subparsers.add_parser('nuke', help='delete all ads')\n", "nukeParser.set_defaults(function=nuke)\n", "checkParser = subparsers.add_parser('check_ad', help='check if ad is active')\n", "checkParser.add_argument('folderName', type=str, help=\n 'folder containing ad details')\n", "checkParser.set_defaults(function=check_ad)\n", "repostParser = subparsers.add_parser('repost', help='repost an existing ad')\n", "repostParser.add_argument('inf_file', type=str, help=\n '.inf file containing posting details')\n", "repostParser.set_defaults(function=repost_ad)\n", "buildParser = subparsers.add_parser('build_ad', help=\n 'Generates the item.inf file for a new ad')\n", "buildParser.set_defaults(function=generate_inf_file)\n", "args = parser.parse_args()\n", "args.function(args)\n", "parser.print_help()\n", "def get_folder_data(args):...\n", "\"\"\"docstring\"\"\"\n", "args.inf_file = 'item.inf'\n", "cred_file = args.folderName + '/login.inf'\n", "creds = [line.strip() for line in open(cred_file, 'r')]\n", "args.username = creds[0]\n", "args.password = creds[1]\n", "def get_inf_details(inf_file):...\n", "\"\"\"docstring\"\"\"\n", "data = {key: val for line in infFileLines for key, val in (line.strip().\n split('='),)}\n", "files = [open(picture, 'rb').read() for picture in data['imageCsv'].split(',')]\n", "return [data, files]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "Import'", "Condition", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "for attr in self._attribute_iterator():\n", "if attr.kind != RESOURCE_ATTRIBUTE_KINDS.COLLECTION:\n", "VAR_35 = self._get_proxied_attribute_value(attr)\n", "yield attr, VAR_35\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "for attr in self._attribute_iterator():\n", "if attr.kind != RESOURCE_ATTRIBUTE_KINDS.COLLECTION:\n", "attr_val = self._get_proxied_attribute_value(attr)\n", "yield attr, attr_val\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "For", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_2 = find_repositories(VAR_0.path)\n", "if VAR_0.repos:\n", "VAR_8 = dict((VAR_12.path, VAR_12) for VAR_12 in VAR_2)\n", "VAR_3 = {}\n", "for k in sorted(VAR_8.keys()):\n", "for VAR_12 in VAR_2:\n", "VAR_12 = VAR_8[k]\n", "VAR_9 = VAR_0.get_command_line(VAR_12)\n", "VAR_4 = VAR_3.keys()\n", "print('%s (%s)' % (k, VAR_12.type))\n", "VAR_10 = {'client': VAR_12, 'cmd': VAR_9}\n", "while VAR_4:\n", "if not VAR_9:\n", "if len(VAR_3) > 1:\n", "VAR_14, VAR_15 = os.wait()\n", "VAR_14, VAR_15 = os.waitpid(VAR_4[0], 0)\n", "if VAR_14 in VAR_4:\n", "VAR_9 = ['echo', '\"%s\" is not implemented for client \"%s\"' % (VAR_0.\n __class__.__name__, VAR_12.type)]\n", "if VAR_0.debug:\n", "print('')\n", "VAR_5 = {VAR_10['client'].path: VAR_14 for VAR_14, VAR_10 in VAR_3.items()}\n", "VAR_4.remove(VAR_14)\n", "print('Executing shell command \"%s\" in \"%s\"' % (' '.join(VAR_9), VAR_12.path))\n", "VAR_11 = subprocess.Popen(VAR_9, shell=False, cwd=os.path.abspath(client.\n path), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n", "VAR_6 = [VAR_5[path] for path in sorted(VAR_5.keys())]\n", "VAR_10 = VAR_3[VAR_14]\n", "VAR_10['process'] = VAR_11\n", "for VAR_14 in VAR_6:\n", "VAR_10['retcode'] = VAR_15\n", "VAR_3[VAR_11.pid] = VAR_10\n", "VAR_10 = VAR_3[VAR_14]\n", "VAR_10['stdout'] = VAR_10['process'].stdout.read()\n", "VAR_12 = VAR_10['client']\n", "if len(VAR_3) > 1:\n", "print(FUNC_1('bluef') + '=== ' + FUNC_1('boldon') + VAR_12.path + FUNC_1(\n 'boldoff') + ' (' + VAR_12.type + ') ===' + FUNC_1('reset'))\n", "if VAR_10['cmd']:\n", "VAR_13 = VAR_10['stdout'].rstrip()\n", "if VAR_15 == 0:\n", "sys.stdout.write('s')\n", "if VAR_10['retcode'] != 0:\n", "sys.stdout.write('.')\n", "sys.stdout.write('E')\n", "sys.stdout.flush()\n", "if not VAR_13:\n", "if not VAR_10['cmd']:\n", "VAR_13 = 'Failed with retcode %d' % VAR_10['retcode']\n", "VAR_13 = FUNC_1('redf') + VAR_13 + FUNC_1('reset')\n", "VAR_13 = FUNC_1('yellowf') + VAR_13 + FUNC_1('reset')\n", "if VAR_13:\n", "print(VAR_13)\n" ]
[ "def execute(command):...\n", "clients = find_repositories(command.path)\n", "if command.repos:\n", "ordered_clients = dict((client.path, client) for client in clients)\n", "jobs = {}\n", "for k in sorted(ordered_clients.keys()):\n", "for client in clients:\n", "client = ordered_clients[k]\n", "cmd = command.get_command_line(client)\n", "wait_for = jobs.keys()\n", "print('%s (%s)' % (k, client.type))\n", "job = {'client': client, 'cmd': cmd}\n", "while wait_for:\n", "if not cmd:\n", "if len(jobs) > 1:\n", "pid, retcode = os.wait()\n", "pid, retcode = os.waitpid(wait_for[0], 0)\n", "if pid in wait_for:\n", "cmd = ['echo', '\"%s\" is not implemented for client \"%s\"' % (command.\n __class__.__name__, client.type)]\n", "if command.debug:\n", "print('')\n", "path_to_pid = {job['client'].path: pid for pid, job in jobs.items()}\n", "wait_for.remove(pid)\n", "print('Executing shell command \"%s\" in \"%s\"' % (' '.join(cmd), client.path))\n", "p = subprocess.Popen(cmd, shell=False, cwd=os.path.abspath(client.path),\n stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n", "pids_in_order = [path_to_pid[path] for path in sorted(path_to_pid.keys())]\n", "job = jobs[pid]\n", "job['process'] = p\n", "for pid in pids_in_order:\n", "job['retcode'] = retcode\n", "jobs[p.pid] = job\n", "job = jobs[pid]\n", "job['stdout'] = job['process'].stdout.read()\n", "client = job['client']\n", "if len(jobs) > 1:\n", "print(ansi('bluef') + '=== ' + ansi('boldon') + client.path + ansi(\n 'boldoff') + ' (' + client.type + ') ===' + ansi('reset'))\n", "if job['cmd']:\n", "output = job['stdout'].rstrip()\n", "if retcode == 0:\n", "sys.stdout.write('s')\n", "if job['retcode'] != 0:\n", "sys.stdout.write('.')\n", "sys.stdout.write('E')\n", "sys.stdout.flush()\n", "if not output:\n", "if not job['cmd']:\n", "output = 'Failed with retcode %d' % job['retcode']\n", "output = ansi('redf') + output + ansi('reset')\n", "output = ansi('yellowf') + output + ansi('reset')\n", "if output:\n", "print(output)\n" ]
[ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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'", "Condition", "Assign'", "Assign'", "For", "For", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_9(self, VAR_12, VAR_13):...\n", "VAR_21 = queryAdapter(VAR_12, IHttpRestSubViewFactory)\n", "if VAR_21:\n", "VAR_25 = VAR_21.resolve(VAR_13)\n", "VAR_25 = queryAdapter(VAR_12, IHttpRestView)\n", "if not VAR_25:\n", "return VAR_25\n" ]
[ "def find_view(self, obj, unresolved_path):...\n", "sub_view_factory = queryAdapter(obj, IHttpRestSubViewFactory)\n", "if sub_view_factory:\n", "view = sub_view_factory.resolve(unresolved_path)\n", "view = queryAdapter(obj, IHttpRestView)\n", "if not view:\n", "return view\n" ]
[ 0, 1, 1, 1, 0, 1, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_4(self):...\n", "VAR_14 = 'select comment from post where userid=%d order by date;'\n", "VAR_15 = sql.queryDB(self.conn, VAR_14)\n", "return VAR_15\n" ]
[ "def getAllPosts(self):...\n", "sqlText = 'select comment from post where userid=%d order by date;'\n", "allposts = sql.queryDB(self.conn, sqlText)\n", "return allposts\n" ]
[ 0, 4, 4, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(self, VAR_0, *VAR_2, **VAR_3):...\n", "VAR_11 = ManyURLSForm()\n", "return render(VAR_0, 'short-many-urls.html', {'form': VAR_11})\n" ]
[ "def get(self, request, *args, **kwargs):...\n", "form = ManyURLSForm()\n", "return render(request, 'short-many-urls.html', {'form': form})\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return CLASS_0.select(lambda g: g.metadata_type == REGULAR_TORRENT and g.\n status != LEGACY_ENTRY).random(VAR_19)\n" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return TorrentMetadata.select(lambda g: g.metadata_type == REGULAR_TORRENT and\n g.status != LEGACY_ENTRY).random(limit)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_10(VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "@wraps(VAR_7)...\n", "if VAR_1.is_expired():\n", "return VAR_1.redirect_to_goodbye()\n", "if VAR_1.is_authenticated():\n", "return VAR_7(*VAR_9, **kwargs)\n", "return VAR_1.redirect_to_goodbye()\n" ]
[ "def redirect_to_logout_if_no_auth(f):...\n", "\"\"\"docstring\"\"\"\n", "@wraps(f)...\n", "if user_mod.is_expired():\n", "return user_mod.redirect_to_goodbye()\n", "if user_mod.is_authenticated():\n", "return f(*args, **kwargs)\n", "return user_mod.redirect_to_goodbye()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_23(self, VAR_14):...\n", "" ]
[ "def is_unique(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "__author__ = 'Johannes Köster'\n", "__copyright__ = 'Copyright 2015, Johannes Köster'\n", "__email__ = '[email protected]'\n", "__license__ = 'MIT'\n", "import os\n", "import re\n", "import stat\n", "import time\n", "import json\n", "from itertools import product, chain\n", "from collections import Iterable, namedtuple\n", "from snakemake.exceptions import MissingOutputException, WorkflowError, WildcardError\n", "from snakemake.logging import logger\n", "def FUNC_0(VAR_0):...\n", "return os.stat(VAR_0, follow_symlinks=os.stat not in os.\n supports_follow_symlinks)\n" ]
[ "__author__ = 'Johannes Köster'\n", "__copyright__ = 'Copyright 2015, Johannes Köster'\n", "__email__ = '[email protected]'\n", "__license__ = 'MIT'\n", "import os\n", "import re\n", "import stat\n", "import time\n", "import json\n", "from itertools import product, chain\n", "from collections import Iterable, namedtuple\n", "from snakemake.exceptions import MissingOutputException, WorkflowError, WildcardError\n", "from snakemake.logging import logger\n", "def lstat(f):...\n", "return os.stat(f, follow_symlinks=os.stat not in os.supports_follow_symlinks)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0 ]
[ "Assign'", "Assign'", "Assign'", "Assign'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Return'" ]
[ "@detail_route(methods=['post'])...\n", "return self.set_pending_action(pending_actions.REMOVE, *VAR_13, VAR_12=(\n 'delete_project',), **kwargs)\n" ]
[ "@detail_route(methods=['post'])...\n", "return self.set_pending_action(pending_actions.REMOVE, *args, perms=(\n 'delete_project',), **kwargs)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_37(self, VAR_69):...\n", "if not_iterable(VAR_69):\n", "return flag(os.path.join(self.workdir, VAR_69), 'subworkflow', self)\n", "return [self.target(VAR_0) for VAR_0 in VAR_69]\n" ]
[ "def target(self, paths):...\n", "if not_iterable(paths):\n", "return flag(os.path.join(self.workdir, paths), 'subworkflow', self)\n", "return [self.target(path) for path in paths]\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_25(self, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_6.local:\n", "self.log_error('Error running sosreport: %s' % err)\n", "VAR_6.sosreport()\n", "if not self.config['no_local']:\n", "if VAR_6.retrieved:\n", "VAR_6.sosreport()\n", "self.retrieved += 1\n" ]
[ "def _collect(self, client):...\n", "\"\"\"docstring\"\"\"\n", "if not client.local:\n", "self.log_error('Error running sosreport: %s' % err)\n", "client.sosreport()\n", "if not self.config['no_local']:\n", "if client.retrieved:\n", "client.sosreport()\n", "self.retrieved += 1\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Expr'", "Condition", "Condition", "Expr'", "AugAssign'" ]
[ "def FUNC_1(self):...\n", "VAR_5 = database.users.get_current_user()\n", "if VAR_5:\n", "VAR_3 = database.Item()\n", "self.redirect('/')\n", "VAR_3.title = cgi.escape(self.request.get('title'))\n", "VAR_3.description = cgi.escape(self.request.get('description'))\n", "VAR_3.price = '%.2f' % float(cgi.escape(self.request.get('price')))\n", "VAR_3.created_by_id = VAR_5.user_id()\n", "VAR_3.put()\n", "database.logging.info(\n \"\"\"Created a new item.\nTitle: %s\nDescription: %s\nPrice: %s\nCreatedBy: %s\"\"\"\n , VAR_3.title, VAR_3.description, VAR_3.price, VAR_3.created_by_id)\n", "self.redirect('/items/')\n" ]
[ "def post(self):...\n", "user = database.users.get_current_user()\n", "if user:\n", "item = database.Item()\n", "self.redirect('/')\n", "item.title = cgi.escape(self.request.get('title'))\n", "item.description = cgi.escape(self.request.get('description'))\n", "item.price = '%.2f' % float(cgi.escape(self.request.get('price')))\n", "item.created_by_id = user.user_id()\n", "item.put()\n", "database.logging.info(\n \"\"\"Created a new item.\nTitle: %s\nDescription: %s\nPrice: %s\nCreatedBy: %s\"\"\"\n , item.title, item.description, item.price, item.created_by_id)\n", "self.redirect('/items/')\n" ]
[ 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(VAR_1=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = 'df -i'\n", "if VAR_1 is not None:\n", "VAR_4 = VAR_4 + ' -' + VAR_1\n", "VAR_2 = {}\n", "VAR_3 = __salt__['cmd.run'](VAR_4).splitlines()\n", "for line in VAR_3:\n", "if line.startswith('Filesystem'):\n", "return VAR_2\n", "VAR_5 = line.split()\n", "if not VAR_5:\n", "if __grains__['kernel'] == 'OpenBSD':\n", "VAR_0.warn('Problem parsing inode usage information')\n", "VAR_2[VAR_5[8]] = {'inodes': int(VAR_5[5]) + int(VAR_5[6]), 'used': VAR_5[5\n ], 'free': VAR_5[6], 'use': VAR_5[7], 'filesystem': VAR_5[0]}\n", "VAR_2[VAR_5[5]] = {'inodes': VAR_5[1], 'used': VAR_5[2], 'free': VAR_5[3],\n 'use': VAR_5[4], 'filesystem': VAR_5[0]}\n", "VAR_2 = {}\n" ]
[ "def inodeusage(args=None):...\n", "\"\"\"docstring\"\"\"\n", "cmd = 'df -i'\n", "if args is not None:\n", "cmd = cmd + ' -' + args\n", "ret = {}\n", "out = __salt__['cmd.run'](cmd).splitlines()\n", "for line in out:\n", "if line.startswith('Filesystem'):\n", "return ret\n", "comps = line.split()\n", "if not comps:\n", "if __grains__['kernel'] == 'OpenBSD':\n", "log.warn('Problem parsing inode usage information')\n", "ret[comps[8]] = {'inodes': int(comps[5]) + int(comps[6]), 'used': comps[5],\n 'free': comps[6], 'use': comps[7], 'filesystem': comps[0]}\n", "ret[comps[5]] = {'inodes': comps[1], 'used': comps[2], 'free': comps[3],\n 'use': comps[4], 'filesystem': comps[0]}\n", "ret = {}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "For", "Condition", "Return'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.norun = True\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.norun = True\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_30, VAR_41):...\n", "\"\"\"docstring\"\"\"\n", "self.obj = VAR_30\n", "self.tag_name = VAR_41\n" ]
[ "def __init__(self, obj, tag_name):...\n", "\"\"\"docstring\"\"\"\n", "self.obj = obj\n", "self.tag_name = tag_name\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'" ]
[ "def __str__(self):...\n", "if self.fatal:\n", "if not len(self.deps):\n", "return self.message + ' Install packages: %s' % ' '.join(self.deps)\n", "return self.message + ' Unresolvable.'\n", "return self.message + ' Unresolvable. Partially resolvable with packages: %s' % ' '.join(\n self.deps)\n" ]
[ "def __str__(self):...\n", "if self.fatal:\n", "if not len(self.deps):\n", "return self.message + ' Install packages: %s' % ' '.join(self.deps)\n", "return self.message + ' Unresolvable.'\n", "return self.message + ' Unresolvable. Partially resolvable with packages: %s' % ' '.join(\n self.deps)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Return'", "Return'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.config.getint(self.section, 'sso_session_lifetime')\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.config.getint(self.section, 'sso_session_lifetime')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]