lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_4(VAR_4):...\n",
"if hasattr(VAR_4, '__iter__'):\n",
"return True\n",
"return isinstance(VAR_4, basestring)\n"
] | [
"def is_iterable(thing):...\n",
"if hasattr(thing, '__iter__'):\n",
"return True\n",
"return isinstance(thing, basestring)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_119(VAR_174):...\n",
"for df in VAR_174.meta.get('fields', {'no_copy': 1}):\n",
"if hasattr(VAR_174, df.fieldname):\n",
"VAR_174.set(df.fieldname, None)\n"
] | [
"def remove_no_copy_fields(d):...\n",
"for df in d.meta.get('fields', {'no_copy': 1}):\n",
"if hasattr(d, df.fieldname):\n",
"d.set(df.fieldname, None)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Expr'"
] |
[
"@VAR_0.route('/past/<unique_id>/<measure_type>/<measurement_id>/<past_seconds>'...\n",
"\"\"\"docstring\"\"\"\n",
"if not str_is_float(VAR_15):\n",
"return '', 204\n",
"if VAR_12 == 'tag':\n",
"VAR_76 = []\n",
"if VAR_12 in ['input', 'math', 'function', 'output', 'pid']:\n",
"VAR_77 = NoteTags.query.... | [
"@blueprint.route(...\n",
"\"\"\"docstring\"\"\"\n",
"if not str_is_float(past_seconds):\n",
"return '', 204\n",
"if measure_type == 'tag':\n",
"notes_list = []\n",
"if measure_type in ['input', 'math', 'function', 'output', 'pid']:\n",
"tag = NoteTags.query.filter(NoteTags.unique_id == unique_id).fir... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Return'",
"Return'",
"Return'",
"Condition",
"Assign'",
"As... |
[
"def FUNC_8(self):...\n",
"self.room_members = [VAR_0, VAR_1]\n",
"self.assertEquals(self.event_source.get_current_key(), 0)\n",
"self.get_success(self.handler.started_typing(target_user=U_APPLE, requester\n =create_requester(U_APPLE), VAR_16=ROOM_ID, timeout=10000))\n",
"self.on_new_event.assert_has_cal... | [
"def test_typing_timeout(self):...\n",
"self.room_members = [U_APPLE, U_BANANA]\n",
"self.assertEquals(self.event_source.get_current_key(), 0)\n",
"self.get_success(self.handler.started_typing(target_user=U_APPLE, requester\n =create_requester(U_APPLE), room_id=ROOM_ID, timeout=10000))\n",
"self.on_new_e... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_44(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for modulename in self.server_extensions:\n",
"VAR_11 = importlib.import_module(modulename)\n",
"if self.reraise_server_extension_failures:\n",
"VAR_106 = getattr(VAR_11, 'load_jupyter_server_extension', None)\n",
"self.log.warn('Error loading serve... | [
"def init_server_extensions(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for modulename in self.server_extensions:\n",
"mod = importlib.import_module(modulename)\n",
"if self.reraise_server_extension_failures:\n",
"func = getattr(mod, 'load_jupyter_server_extension', None)\n",
"self.log.warn('Error loading... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_1(VAR_11, VAR_12=''):...\n",
"\"\"\"docstring\"\"\"\n",
"return force_text(urllib_parse.quote_plus(force_str(VAR_11), force_str(VAR_12))\n )\n"
] | [
"def urlquote_plus(url, safe=''):...\n",
"\"\"\"docstring\"\"\"\n",
"return force_text(urllib_parse.quote_plus(force_str(url), force_str(safe)))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def __init__(self, *VAR_13, **VAR_14):...\n",
"super(CLASS_2, self).__init__(*VAR_13, **kwargs)\n",
"if not check_path_owner(self.directory):\n",
"VAR_1.warning('string', self.directory)\n",
"self.directory = None\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"super(SafeFileCache, self).__init__(*args, **kwargs)\n",
"if not check_path_owner(self.directory):\n",
"logger.warning(\n \"The directory '%s' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_9(VAR_26: Optional[Dict[Text, Any]]) ->Text:...\n",
"if not VAR_26:\n",
"return ''\n",
"VAR_58 = copy.deepcopy(VAR_26)\n",
"for key in ['pipeline', 'policies']:\n",
"if VAR_58.get(key):\n",
"return rasa.shared.utils.io.deep_container_fingerprint(VAR_58)\n",
"for p in VAR_58[key]:\n",
"if '... | [
"def _get_fingerprint_of_config_without_epochs(config: Optional[Dict[Text, Any]]...\n",
"if not config:\n",
"return ''\n",
"copied_config = copy.deepcopy(config)\n",
"for key in ['pipeline', 'policies']:\n",
"if copied_config.get(key):\n",
"return rasa.shared.utils.io.deep_container_fingerprint(copied_c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"For",
"Condition",
"Return'",
"For",
"Condition"
] |
[
"def FUNC_74(VAR_129, VAR_42):...\n",
"if hasattr(VAR_129, 'fnargs'):\n",
"VAR_210 = VAR_129.fnargs\n",
"VAR_210, VAR_220, VAR_221, VAR_222 = inspect.getargspec(VAR_129)\n",
"VAR_210 = inspect.getfullargspec(VAR_129).args\n",
"VAR_194 = {}\n",
"VAR_220 = inspect.getfullargspec(VAR_129).varargs\n",
"fo... | [
"def get_newargs(fn, kwargs):...\n",
"if hasattr(fn, 'fnargs'):\n",
"fnargs = fn.fnargs\n",
"fnargs, varargs, varkw, defaults = inspect.getargspec(fn)\n",
"fnargs = inspect.getfullargspec(fn).args\n",
"newargs = {}\n",
"varargs = inspect.getfullargspec(fn).varargs\n",
"for a in kwargs:\n",
"varkw = ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_70(VAR_15, VAR_145):...\n",
"VAR_107 = FUNC_12(VAR_145, 'inverted', VAR_15.getSizeC())\n",
"VAR_50, VAR_51, VAR_52 = FUNC_2(VAR_145['c'])\n",
"VAR_15.setActiveChannels(VAR_50, VAR_51, VAR_52, VAR_107)\n",
"if VAR_145['m'] == 'g':\n",
"VAR_15.setGreyscaleRenderingModel()\n",
"VAR_15.setColorRen... | [
"def applyRenderingSettings(image, rdef):...\n",
"invert_flags = _get_maps_enabled(rdef, 'inverted', image.getSizeC())\n",
"channels, windows, colors = _split_channel_info(rdef['c'])\n",
"image.setActiveChannels(channels, windows, colors, invert_flags)\n",
"if rdef['m'] == 'g':\n",
"image.setGreyscaleRend... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_31(VAR_31):...\n",
"VAR_63 = \"'\" * isinstance(VAR_31, str)\n",
"return VAR_63 + str(VAR_31) + VAR_63\n"
] | [
"def _maybe_add_quotes(value):...\n",
"is_quotes = \"'\" * isinstance(value, str)\n",
"return is_quotes + str(value) + is_quotes\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_19(VAR_9, VAR_10, VAR_11):...\n",
"if VAR_87.role_admin():\n",
"VAR_11 = int(VAR_11)\n",
"VAR_11 = VAR_87.id\n",
"if VAR_87.check_visibility(constants.SIDEBAR_DOWNLOAD):\n",
"if VAR_87.show_detail_random():\n",
"abort(404)\n",
"VAR_68 = calibre_db.session.query(db.Books).filter(calibre_db.co... | [
"def render_downloaded_books(page, order, user_id):...\n",
"if current_user.role_admin():\n",
"user_id = int(user_id)\n",
"user_id = current_user.id\n",
"if current_user.check_visibility(constants.SIDEBAR_DOWNLOAD):\n",
"if current_user.show_detail_random():\n",
"abort(404)\n",
"random = calibre_db.se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_43(self, VAR_21, VAR_22, VAR_20):...\n",
"if not self.view_settings.get(VAR_21):\n",
"self.view_settings[VAR_21] = dict()\n",
"self.view_settings[VAR_21][VAR_22] = VAR_20\n",
"flag_modified(self, 'view_settings')\n",
"VAR_1.commit()\n",
"VAR_1.rollback()\n"
] | [
"def set_view_property(self, page, prop, value):...\n",
"if not self.view_settings.get(page):\n",
"self.view_settings[page] = dict()\n",
"self.view_settings[page][prop] = value\n",
"flag_modified(self, 'view_settings')\n",
"session.commit()\n",
"session.rollback()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"if not self.json:\n",
"print('Currently running servers:')\n",
"for serverinfo in FUNC_2(self.runtime_dir):\n",
"if self.json:\n",
"print(VAR_27.dumps(serverinfo))\n",
"print(serverinfo['url'], '::', serverinfo['notebook_dir'])\n"
] | [
"def start(self):...\n",
"if not self.json:\n",
"print('Currently running servers:')\n",
"for serverinfo in list_running_servers(self.runtime_dir):\n",
"if self.json:\n",
"print(json.dumps(serverinfo))\n",
"print(serverinfo['url'], '::', serverinfo['notebook_dir'])\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"For",
"Condition",
"Expr'",
"Expr'"
] |
[
"@VAR_2.route('/ajax/editrestriction/<int:res_type>', defaults={'user_id': 0...\n",
"VAR_10 = request.form.to_dict()\n",
"if VAR_10['id'].startswith('a'):\n",
"if VAR_8 == 0:\n",
"if VAR_10['id'].startswith('d'):\n",
"VAR_69 = config.list_allowed_tags()\n",
"if VAR_8 == 1:\n",
"if VAR_8 == 0:\n",
"r... | [
"@admi.route('/ajax/editrestriction/<int:res_type>', defaults={'user_id': 0},...\n",
"element = request.form.to_dict()\n",
"if element['id'].startswith('a'):\n",
"if res_type == 0:\n",
"if element['id'].startswith('d'):\n",
"elementlist = config.list_allowed_tags()\n",
"if res_type == 1:\n",
"if res_t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",... |
[
"def FUNC_55(VAR_21, VAR_33, VAR_34):...\n",
"VAR_21 = VAR_21.outerjoin(ub.BookShelf, db.Books.id == ub.BookShelf.book_id\n ).filter(or_(ub.BookShelf.shelf == None, ub.BookShelf.shelf.notin_(VAR_34))\n )\n",
"if len(VAR_33) > 0:\n",
"VAR_21 = VAR_21.filter(ub.BookShelf.shelf.in_(VAR_33))\n",
"return V... | [
"def adv_search_shelf(q, include_shelf_inputs, exclude_shelf_inputs):...\n",
"q = q.outerjoin(ub.BookShelf, db.Books.id == ub.BookShelf.book_id).filter(or_\n (ub.BookShelf.shelf == None, ub.BookShelf.shelf.notin_(\n exclude_shelf_inputs)))\n",
"if len(include_shelf_inputs) > 0:\n",
"q = q.filter(ub.Book... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"VAR_21 = 'input1=/path/file.txt[ab3];input2=file2'\n",
"VAR_22 = 'input3=np.zeros([2,2]);input4=[4,5]'\n",
"VAR_23 = saved_model_cli.preprocess_inputs_arg_string(VAR_21)\n",
"VAR_24 = saved_model_cli.preprocess_input_exprs_arg_string(VAR_22, safe=False)\n",
"self.assertTrue(VAR... | [
"def testInputPreProcessFormats(self):...\n",
"input_str = 'input1=/path/file.txt[ab3];input2=file2'\n",
"input_expr_str = 'input3=np.zeros([2,2]);input4=[4,5]'\n",
"input_dict = saved_model_cli.preprocess_inputs_arg_string(input_str)\n",
"input_expr_dict = saved_model_cli.preprocess_input_exprs_arg_string(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_41(self):...\n",
"VAR_29 = models.Individual._meta.get_field('parent').rel\n",
"VAR_27 = widgets.AdminRadioSelect()\n",
"VAR_27 = widgets.RelatedFieldWidgetWrapper(VAR_27, VAR_29, widget_admin_site)\n",
"self.assertFalse(VAR_27.can_add_related)\n"
] | [
"def test_no_can_add_related(self):...\n",
"rel = models.Individual._meta.get_field('parent').rel\n",
"w = widgets.AdminRadioSelect()\n",
"w = widgets.RelatedFieldWidgetWrapper(w, rel, widget_admin_site)\n",
"self.assertFalse(w.can_add_related)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_40(VAR_48):...\n",
"return VAR_48\n"
] | [
"def fake_wrapper_session(sess):...\n",
"return sess\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_6(self, VAR_12):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12.setattr(filescheme.jinja.utils, 'resource_filename', lambda name:\n '/test path/foo.svg')\n",
"VAR_19 = filescheme.dirbrowser_html(os.getcwd()).decode('utf-8')\n",
"VAR_20 = bs4.BeautifulSoup(VAR_19, 'html.parser')\n",
"print(VAR_20.p... | [
"def test_icons(self, monkeypatch):...\n",
"\"\"\"docstring\"\"\"\n",
"monkeypatch.setattr(filescheme.jinja.utils, 'resource_filename', lambda\n name: '/test path/foo.svg')\n",
"html = filescheme.dirbrowser_html(os.getcwd()).decode('utf-8')\n",
"soup = bs4.BeautifulSoup(html, 'html.parser')\n",
"print(... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assert'"
] |
[
"def FUNC_64(VAR_122=False, VAR_123=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(VAR_19, 'in_install_db', True):\n",
"return []\n",
"if not VAR_12:\n",
"FUNC_5()\n",
"if not VAR_1.all_apps:\n",
"VAR_1.all_apps = FUNC_10().get_value('all_apps', FUNC_63)\n",
"VAR_190 = json.loads(VAR_12.get_g... | [
"def get_installed_apps(sort=False, frappe_last=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(flags, 'in_install_db', True):\n",
"return []\n",
"if not db:\n",
"connect()\n",
"if not local.all_apps:\n",
"local.all_apps = cache().get_value('all_apps', get_all_apps)\n",
"installed = json.loads... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Expr'"
] |
[
"@VAR_2.route('/send/<int:book_id>/<book_format>/<int:convert>')...\n",
"if not config.get_mail_server_configured():\n",
"flash(_(u'Please configure the SMTP mail settings first...'), category='error')\n",
"if VAR_87.kindle_mail:\n",
"if 'HTTP_REFERER' in request.environ:\n",
"VAR_136 = send_mail(VAR_5, V... | [
"@web.route('/send/<int:book_id>/<book_format>/<int:convert>')...\n",
"if not config.get_mail_server_configured():\n",
"flash(_(u'Please configure the SMTP mail settings first...'), category='error')\n",
"if current_user.kindle_mail:\n",
"if 'HTTP_REFERER' in request.environ:\n",
"result = send_mail(book_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Condition",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, **VAR_20):...\n",
"self.options = VAR_20\n"
] | [
"def __init__(self, **kwargs):...\n",
"self.options = kwargs\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __init__(self, *, VAR_3: GeneratorData) ->None:...\n",
"self.openapi: GeneratorData = VAR_3\n",
"self.env: Environment = Environment(loader=PackageLoader(__package__),\n trim_blocks=True, lstrip_blocks=True)\n",
"self.project_name: str = (self.project_name_override or\n f\"{VAR_3.title.replace(' ',... | [
"def __init__(self, *, openapi: GeneratorData) ->None:...\n",
"self.openapi: GeneratorData = openapi\n",
"self.env: Environment = Environment(loader=PackageLoader(__package__),\n trim_blocks=True, lstrip_blocks=True)\n",
"self.project_name: str = (self.project_name_override or\n f\"{openapi.title.replac... | [
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"AnnAssign'",
"AnnAssign'",
"AnnAssign'",
"AnnAssign'",
"AnnAssign'",
"AnnAssign'",
"AnnAssign'",
"AnnAssign'",
"Expr'"
] |
[
"def FUNC_24(VAR_45=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_1.session:\n",
"return ['Guest']\n",
"import frappe.permissions\n",
"return frappe.permissions.get_roles(VAR_45 or VAR_1.session.user)\n"
] | [
"def get_roles(username=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not local.session:\n",
"return ['Guest']\n",
"import frappe.permissions\n",
"return frappe.permissions.get_roles(username or local.session.user)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Import'",
"Return'"
] |
[
"def FUNC_55(VAR_21, VAR_33, VAR_34):...\n",
"VAR_21 = VAR_21.outerjoin(ub.BookShelf, db.Books.id == ub.BookShelf.book_id\n ).filter(or_(ub.BookShelf.shelf == None, ub.BookShelf.shelf.notin_(VAR_34))\n )\n",
"if len(VAR_33) > 0:\n",
"VAR_21 = VAR_21.filter(ub.BookShelf.shelf.in_(VAR_33))\n",
"return V... | [
"def adv_search_shelf(q, include_shelf_inputs, exclude_shelf_inputs):...\n",
"q = q.outerjoin(ub.BookShelf, db.Books.id == ub.BookShelf.book_id).filter(or_\n (ub.BookShelf.shelf == None, ub.BookShelf.shelf.notin_(\n exclude_shelf_inputs)))\n",
"if len(include_shelf_inputs) > 0:\n",
"q = q.filter(ub.Book... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_22(self):...\n",
"VAR_27 = np.array([[1], [2]])\n",
"VAR_28 = np.array(range(5))\n",
"VAR_32 = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(VAR_32, VAR_54=x0, VAR_55=x1)\n",
"VAR_21 = 'x=' + VAR_32 + '[c]'\n",
"saved_model_cli.load_inputs_from_input_arg_string(VAR_21, '', '')\n... | [
"def testInputParserErrorWrongName(self):...\n",
"x0 = np.array([[1], [2]])\n",
"x1 = np.array(range(5))\n",
"input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(input_path, a=x0, b=x1)\n",
"input_str = 'x=' + input_path + '[c]'\n",
"saved_model_cli.load_inputs_from_input_arg_strin... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_5, VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0 = '/groups/%s/profile' % (VAR_5,)\n",
"VAR_12, VAR_13 = self.make_request('GET', VAR_0.encode('ascii'), VAR_7=self\n .admin_user_tok)\n",
"self.assertEqual(VAR_6, int(VAR_13.result['code']), msg=channel.result['body'])\n"
] | [
"def _check_group(self, group_id, expect_code):...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/groups/%s/profile' % (group_id,)\n",
"request, channel = self.make_request('GET', url.encode('ascii'),\n access_token=self.admin_user_tok)\n",
"self.assertEqual(expect_code, int(channel.result['code']), msg=channel... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_68(self, VAR_42: int=5) ->str:...\n",
"return jwt.encode({'public_id': self.public_id, 'exp': datetime.datetime.\n utcnow() + datetime.timedelta(days=expires_in_days)}, VAR_0.config[\n 'SECRET_KEY'], algorithm='HS256')\n"
] | [
"def generate_auth_token(self, expires_in_days: int=5) ->str:...\n",
"return jwt.encode({'public_id': self.public_id, 'exp': datetime.datetime.\n utcnow() + datetime.timedelta(days=expires_in_days)}, gui.config[\n 'SECRET_KEY'], algorithm='HS256')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, *VAR_6, **VAR_7):...\n",
"super().__init__(*VAR_6, **kwargs)\n",
"self.helper = FormHelper(self)\n",
"self.helper.form_tag = False\n",
"self.helper.layout = Layout(SearchField('q'), InlineRadios('format'))\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"super().__init__(*args, **kwargs)\n",
"self.helper = FormHelper(self)\n",
"self.helper.form_tag = False\n",
"self.helper.layout = Layout(SearchField('q'), InlineRadios('format'))\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_4):...\n",
"self.server_name = VAR_4.hostname\n",
"self.client = VAR_4.get_http_client()\n"
] | [
"def __init__(self, hs):...\n",
"self.server_name = hs.hostname\n",
"self.client = hs.get_http_client()\n"
] | [
0,
0,
4
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"@moderator_required...\n",
"VAR_6 = get_object_or_404(Topic, VAR_1=pk)\n",
"if is_post(VAR_0):\n",
"VAR_7 = Topic.objects.filter(VAR_1=pk).exclude(**{field_name: to_value}\n ).update(**{field_name: to_value, 'reindex_at': timezone.now()})\n",
"return render(VAR_0=request, template_name='spirit/topic/mod... | [
"@moderator_required...\n",
"topic = get_object_or_404(Topic, pk=pk)\n",
"if is_post(request):\n",
"count = Topic.objects.filter(pk=pk).exclude(**{field_name: to_value}).update(**\n {field_name: to_value, 'reindex_at': timezone.now()})\n",
"return render(request=request, template_name='spirit/topic/moder... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_75(self):...\n",
"\"\"\"docstring\"\"\"\n",
"file_lock.delete_lock(self.get_signature())\n"
] | [
"def unlock(self):...\n",
"\"\"\"docstring\"\"\"\n",
"file_lock.delete_lock(self.get_signature())\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"@csrf_exempt...\n",
"from ee.clickhouse.sql.events import TRUNCATE_EVENTS_TABLE_SQL\n",
"from posthog.client import sync_execute\n",
"sync_execute(TRUNCATE_EVENTS_TABLE_SQL())\n",
"return HttpResponse()\n"
] | [
"@csrf_exempt...\n",
"from ee.clickhouse.sql.events import TRUNCATE_EVENTS_TABLE_SQL\n",
"from posthog.client import sync_execute\n",
"sync_execute(TRUNCATE_EVENTS_TABLE_SQL())\n",
"return HttpResponse()\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"return [d.as_dict(no_default_fields=True) for d in self.columns]\n"
] | [
"def get_columns(self):...\n",
"return [d.as_dict(no_default_fields=True) for d in self.columns]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(*, VAR_0: Client, VAR_1: List[AnEnum], VAR_2: Union[date, datetime]...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = '{}/tests/'.format(VAR_0.base_url)\n",
"VAR_12: Dict[str, Any] = VAR_0.get_headers()\n",
"VAR_7 = []\n",
"for an_enum_value_item_data in VAR_1:\n",
"VAR_10 = an_enum_value_item_data... | [
"def get_user_list(*, client: Client, an_enum_value: List[AnEnum], some_date:...\n",
"\"\"\"docstring\"\"\"\n",
"url = '{}/tests/'.format(client.base_url)\n",
"headers: Dict[str, Any] = client.get_headers()\n",
"json_an_enum_value = []\n",
"for an_enum_value_item_data in an_enum_value:\n",
"an_enum_valu... | [
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"AnnAssign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"AnnAssign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_12(self, VAR_12):...\n",
"if not self.isAuthorized():\n",
"VAR_11 = [VAR_69 for VAR_69 in json.loads(unquote(VAR_12))]\n",
"VAR_61 = self.download_check_files(VAR_11)\n",
"if VAR_61 == 'ok':\n",
"FUNC_0()\n",
"return VAR_61\n",
"VAR_82 = 'application/x-zip-compressed'\n",
"VAR_53.response.... | [
"def download(self, value):...\n",
"if not self.isAuthorized():\n",
"filelist = [filepath for filepath in json.loads(unquote(value))]\n",
"dlstatus = self.download_check_files(filelist)\n",
"if dlstatus == 'ok':\n",
"_save_and_release_session()\n",
"return dlstatus\n",
"zipmime = 'application/x-zip-co... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_31(VAR_31):...\n",
"VAR_63 = \"'\" * isinstance(VAR_31, str)\n",
"return VAR_63 + str(VAR_31) + VAR_63\n"
] | [
"def _maybe_add_quotes(value):...\n",
"is_quotes = \"'\" * isinstance(value, str)\n",
"return is_quotes + str(value) + is_quotes\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_11(VAR_14: Union[Text, Path]) ->Any:...\n",
"\"\"\"docstring\"\"\"\n",
"import jsonpickle.ext.numpy as jsonpickle_numpy\n",
"import jsonpickle\n",
"jsonpickle_numpy.register_handlers()\n",
"VAR_22 = rasa.shared.utils.io.read_file(VAR_14)\n",
"return jsonpickle.loads(VAR_22)\n"
] | [
"def json_unpickle(file_name: Union[Text, Path]) ->Any:...\n",
"\"\"\"docstring\"\"\"\n",
"import jsonpickle.ext.numpy as jsonpickle_numpy\n",
"import jsonpickle\n",
"jsonpickle_numpy.register_handlers()\n",
"file_content = rasa.shared.utils.io.read_file(file_name)\n",
"return jsonpickle.loads(file_cont... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Import'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self, VAR_2):...\n",
"def FUNC_29(self):...\n",
"VAR_2.add_url_rule('/about-us', endpoint='site_controller.about_us')\n",
"assert url_for('about_us', _cls=SiteController) == '/about-us'\n"
] | [
"def test_it_works_with_controller_method_names(self, app):...\n",
"def about_us(self):...\n",
"app.add_url_rule('/about-us', endpoint='site_controller.about_us')\n",
"assert url_for('about_us', _cls=SiteController) == '/about-us'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"Assert'"
] |
[
"def FUNC_17(self):...\n",
"VAR_22, VAR_23 = self.make_request('POST', '/createRoom', b'{\"custom\":\"stuff\"}'\n )\n",
"self.assertEquals(200, VAR_23.code)\n",
"self.assertTrue('room_id' in VAR_23.json_body)\n"
] | [
"def test_post_room_custom_key(self):...\n",
"request, channel = self.make_request('POST', '/createRoom',\n b'{\"custom\":\"stuff\"}')\n",
"self.assertEquals(200, channel.code)\n",
"self.assertTrue('room_id' in channel.json_body)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0.debug('backfill dest=%s, room_id=%s, event_tuples=%r, limit=%s',\n VAR_5, VAR_6, VAR_9, str(VAR_10))\n",
"if not VAR_9:\n",
"return\n",
"VAR_2 = FUNC_1('/backfill/%s', VAR_6)\n",
"VAR_3 = {'v': VAR_9, 'limit': [str(VAR_10)]}\n",
"return self.c... | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"logger.debug('backfill dest=%s, room_id=%s, event_tuples=%r, limit=%s',\n destination, room_id, event_tuples, str(limit))\n",
"if not event_tuples:\n",
"return\n",
"path = _create_v1_path('/backfill/%s', room_id)\n",
"args = {'v': event_tuples, 'limit... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, *VAR_12):...\n",
"self.transitiveDependencies.update(VAR_12)\n"
] | [
"def recordDependencies(self, *inputSources):...\n",
"self.transitiveDependencies.update(inputSources)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_3(self):...\n",
"VAR_26 = b'{\"topic\":\"My Topic Name\"}'\n",
"VAR_27 = '/rooms/%s/state/m.room.topic' % self.created_rmid\n",
"VAR_22, VAR_23 = self.make_request('PUT', '/rooms/%s/state/m.room.topic' %\n self.uncreated_rmid, VAR_26)\n",
"self.assertEquals(403, VAR_23.code, msg=channel.result[... | [
"def test_topic_perms(self):...\n",
"topic_content = b'{\"topic\":\"My Topic Name\"}'\n",
"topic_path = '/rooms/%s/state/m.room.topic' % self.created_rmid\n",
"request, channel = self.make_request('PUT', '/rooms/%s/state/m.room.topic' %\n self.uncreated_rmid, topic_content)\n",
"self.assertEquals(403, ch... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",... |
[
"@pytest.mark.linux...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_4.config.webengine:\n",
"pytest.skip()\n",
"VAR_26 = VAR_2 / 'downloads'\n",
"VAR_26.ensure(dir=True)\n",
"(VAR_2 / 'user-dirs.dirs').write('XDG_DOWNLOAD_DIR={}'.format(VAR_26))\n",
"VAR_16 = {'XDG_CONFIG_HOME': str(VAR_2)}\n",
"VAR_1... | [
"@pytest.mark.linux...\n",
"\"\"\"docstring\"\"\"\n",
"if not request.config.webengine:\n",
"pytest.skip()\n",
"download_dir = tmpdir / 'downloads'\n",
"download_dir.ensure(dir=True)\n",
"(tmpdir / 'user-dirs.dirs').write('XDG_DOWNLOAD_DIR={}'.format(download_dir))\n",
"env = {'XDG_CONFIG_HOME': str(t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"def FUNC_36(self, VAR_31, VAR_32, VAR_6=''):...\n",
"VAR_75 = VAR_6 == ''\n",
"if VAR_75:\n",
"VAR_6 = VAR_53.session['username']\n",
"if VAR_75 or VAR_53.session['admin']:\n",
"VAR_107 = self.userdb.auth(VAR_6, VAR_31)\n",
"return self.userdb.changePassword(VAR_6, VAR_32)\n",
"VAR_108 = userdb.User.... | [
"def api_userchangepassword(self, oldpassword, newpassword, username=''):...\n",
"isself = username == ''\n",
"if isself:\n",
"username = cherrypy.session['username']\n",
"if isself or cherrypy.session['admin']:\n",
"authed_user = self.userdb.auth(username, oldpassword)\n",
"return self.userdb.changePas... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition"
] |
[
"def FUNC_13(VAR_15, VAR_16, VAR_18):...\n",
"VAR_19 = {}\n",
"if current_user.role_delete_books():\n",
"VAR_17 = calibre_db.get_book(VAR_15)\n",
"return FUNC_12(VAR_16, VAR_18, VAR_19, VAR_15)\n",
"if VAR_17:\n",
"VAR_2.error('Book with id \"%s\" could not be deleted: not found', VAR_15)\n",
"VAR_68,... | [
"def delete_book(book_id, book_format, jsonResponse):...\n",
"warning = {}\n",
"if current_user.role_delete_books():\n",
"book = calibre_db.get_book(book_id)\n",
"return render_delete_book_result(book_format, jsonResponse, warning, book_id)\n",
"if book:\n",
"log.error('Book with id \"%s\" could not be ... | [
0,
0,
0,
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'",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Condition",
"Condition",
"Return'",
"Expr'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Return'",
"Assign'",
"Expr'",
"Expr'",... |
[
"def FUNC_119(VAR_174):...\n",
"for df in VAR_174.meta.get('fields', {'no_copy': 1}):\n",
"if hasattr(VAR_174, df.fieldname):\n",
"VAR_174.set(df.fieldname, None)\n"
] | [
"def remove_no_copy_fields(d):...\n",
"for df in d.meta.get('fields', {'no_copy': 1}):\n",
"if hasattr(d, df.fieldname):\n",
"d.set(df.fieldname, None)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Expr'"
] |
[
"def FUNC_117(VAR_10):...\n",
"def FUNC_168(*VAR_9, **VAR_13):...\n",
"VAR_27 = None\n",
"VAR_27 = VAR_10(*VAR_9, **b)\n",
"thread.start_new_thread(VAR_26, (VAR_27,))\n",
"return FUNC_168\n",
"return VAR_27\n"
] | [
"def _completion(f):...\n",
"def __completion(*a, **b):...\n",
"d = None\n",
"d = f(*a, **b)\n",
"thread.start_new_thread(callback, (d,))\n",
"return __completion\n",
"return d\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_23(VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_47 = 'string'\n",
"VAR_48 = VAR_21.add_parser('show', description=show_msg, formatter_class=\n argparse.RawTextHelpFormatter)\n",
"VAR_48.add_argument('--dir', type=str, required=True, help=\n 'directory containing the SavedModel to inspect'... | [
"def add_show_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"show_msg = \"\"\"Usage examples:\nTo show all tag-sets in a SavedModel:\n$saved_model_cli show --dir /tmp/saved_model\n\nTo show all available SignatureDef keys in a MetaGraphDef specified by its tag-set:\n$saved_model_cli show --dir /tmp/s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_117():...\n",
"return VAR_12.sql_list('select name from tabDocType where istable=1')\n"
] | [
"def get_tables():...\n",
"return db.sql_list('select name from tabDocType where istable=1')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@override_settings(LOGIN_URL='/login/')...\n",
"self.assertLoginURLEquals('/login/?next=/login_required/')\n"
] | [
"@override_settings(LOGIN_URL='/login/')...\n",
"self.assertLoginURLEquals('/login/?next=/login_required/')\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_73(self, VAR_144, VAR_145=True, VAR_90=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_153(VAR_114):...\n",
"def FUNC_118(*VAR_9, **VAR_13):...\n",
"VAR_431, VAR_432, VAR_141 = self.basic()\n",
"VAR_141 = VAR_141 or self.user\n",
"VAR_433 = VAR_145\n",
"if callable(VAR_433):\n",
"VAR_43... | [
"def requires(self, condition, requires_login=True, otherwise=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def decorator(action):...\n",
"def f(*a, **b):...\n",
"basic_allowed, basic_accepted, user = self.basic()\n",
"user = user or self.user\n",
"login_required = requires_login\n",
"if callable(login_re... | [
0,
0,
0,
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'",
"Docstring",
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Return'... |
[
"def FUNC_13(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return FILTERS.get_search_name(self.cleaned_data.get('q', ''))\n"
] | [
"def get_name(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return FILTERS.get_search_name(self.cleaned_data.get('q', ''))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_23(self, VAR_12, VAR_6):...\n",
"VAR_29 = VAR_12.get('filters') or []\n",
"if VAR_6:\n",
"for key, value in iteritems(VAR_6):\n",
"return VAR_29\n",
"VAR_39, VAR_40 = '=', value\n",
"if isinstance(value, (list, tuple)):\n",
"VAR_39, VAR_40 = value\n",
"VAR_29.append([key, VAR_39, VAR_40])\... | [
"def get_standard_report_filters(self, params, filters):...\n",
"_filters = params.get('filters') or []\n",
"if filters:\n",
"for key, value in iteritems(filters):\n",
"return _filters\n",
"condition, _value = '=', value\n",
"if isinstance(value, (list, tuple)):\n",
"condition, _value = value\n",
"_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"For",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_25(self):...\n",
"VAR_21 = self.client.get('%s/admin_widgets/car/' % self.admin_root)\n",
"self.assertContains(VAR_21, '%s/auth/user/add/' % self.admin_root)\n"
] | [
"def test_changelist_foreignkey(self):...\n",
"response = self.client.get('%s/admin_widgets/car/' % self.admin_root)\n",
"self.assertContains(response, '%s/auth/user/add/' % self.admin_root)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_2, VAR_3, VAR_10, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = CLASS_0(VAR_2, VAR_3, VAR_10, VAR_5)\n",
"VAR_23 = VAR_22,\n",
"return make_deferred_yieldable(self._verify_objects(VAR_23)[0])\n"
] | [
"def verify_json_for_server(self, server_name, json_object, validity_time,...\n",
"\"\"\"docstring\"\"\"\n",
"req = VerifyJsonRequest(server_name, json_object, validity_time, request_name)\n",
"requests = req,\n",
"return make_deferred_yieldable(self._verify_objects(requests)[0])\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"async def FUNC_9(self, VAR_17, VAR_18, VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = VAR_18['valid_until_ts']\n",
"VAR_33 = {}\n",
"for VAR_43, key_data in VAR_18['verify_keys'].items():\n",
"if is_signing_algorithm_supported(VAR_43):\n",
"VAR_2 = VAR_18['server_name']\n",
"VAR_56 = key_data['... | [
"async def process_v2_response(self, from_server, response_json, time_added_ms):...\n",
"\"\"\"docstring\"\"\"\n",
"ts_valid_until_ms = response_json['valid_until_ts']\n",
"verify_keys = {}\n",
"for key_id, key_data in response_json['verify_keys'].items():\n",
"if is_signing_algorithm_supported(key_id):\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
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"For",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
... |
[
"def FUNC_13(self, VAR_0):...\n",
"VAR_13 = VAR_0.patch('httpx.get')\n",
"VAR_15 = VAR_0.patch('yaml.safe_load')\n",
"from openapi_python_client import _get_document\n",
"VAR_7 = VAR_0.MagicMock()\n",
"VAR_2(VAR_6=None, VAR_7=path)\n",
"VAR_13.assert_not_called()\n",
"VAR_7.read_bytes.assert_called_on... | [
"def test__get_document_path_no_url(self, mocker):...\n",
"get = mocker.patch('httpx.get')\n",
"loads = mocker.patch('yaml.safe_load')\n",
"from openapi_python_client import _get_document\n",
"path = mocker.MagicMock()\n",
"_get_document(url=None, path=path)\n",
"get.assert_not_called()\n",
"path.read... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_31(self):...\n",
"if VAR_53.session['admin'] and cherry.config['general.update_notification']:\n",
"FUNC_0()\n",
"return {'type': 'wisdom', 'data': self.model.motd()}\n",
"VAR_104 = self.model.check_for_updates()\n",
"if VAR_104:\n",
"VAR_115 = VAR_104[0]['version']\n",
"VAR_116 = []\n",
"... | [
"def api_getmotd(self):...\n",
"if cherrypy.session['admin'] and cherry.config['general.update_notification']:\n",
"_save_and_release_session()\n",
"return {'type': 'wisdom', 'data': self.model.motd()}\n",
"new_versions = self.model.check_for_updates()\n",
"if new_versions:\n",
"newest_version = new_ver... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"For",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_45(self, VAR_112=VAR_3, VAR_134=VAR_3, VAR_135=VAR_3, VAR_136=...\n",
"VAR_56 = VAR_263.request\n",
"VAR_244 = VAR_263.response\n",
"VAR_139 = VAR_263.session\n",
"VAR_101, VAR_153 = self.db, self.table_cas()\n",
"VAR_139._cas_service = VAR_56.vars.service or VAR_139._cas_service\n",
"if VAR_5... | [
"def cas_login(self, next=DEFAULT, onvalidation=DEFAULT, onaccept=DEFAULT,...\n",
"request = current.request\n",
"response = current.response\n",
"session = current.session\n",
"db, table = self.db, self.table_cas()\n",
"session._cas_service = request.vars.service or session._cas_service\n",
"if request... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Funct... |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_65 = get_course_by_id(VAR_38)\n",
"VAR_78 = instructor_analytics.basic.AVAILABLE_FEATURES\n",
"VAR_68 = list(microsite.get_value('student_profile_download_fields', []))\n",
"if not VAR_68... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = CourseKey.from_string(course_id)\n",
"course = get_course_by_id(course_key)\n",
"available_features = instructor_analytics.basic.AVAILABLE_FEATURES\n",
"query_features = list(microsite.get_value('student_profile_download_fie... | [
0,
0,
0,
0,
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'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"A... |
[
"def FUNC_4(VAR_9):...\n",
"VAR_17 = list()\n",
"for element in VAR_9:\n",
"VAR_17.append(element.id)\n",
"VAR_4[VAR_18.id] = VAR_17\n"
] | [
"def store_ids(result):...\n",
"ids = list()\n",
"for element in result:\n",
"ids.append(element.id)\n",
"searched_ids[current_user.id] = ids\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Assign'"
] |
[
"def FUNC_11(self):...\n",
"if not self.json:\n",
"self.json = '{}'\n"
] | [
"def update_report_json(self):...\n",
"if not self.json:\n",
"self.json = '{}'\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'"
] |
[
"def FUNC_34(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_10 = self.parser.parse_args(['scan', '--dir', VAR_9])\n",
"saved_model_cli.scan(VAR_10)\n",
"VAR_11 = out.getvalue().strip()\n",
"self.assertTrue('does not contain denylisted ops... | [
"def testScanCommand(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"args = self.parser.parse_args(['scan', '--dir', base_path])\n",
"saved_model_cli.scan(args)\n",
"output = out.getvalue().strip()\n",
"self.assertTrue('does not... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(VAR_4):...\n",
"from helpdesk.settings import DEFAULT_USER_SETTINGS\n",
"return DEFAULT_USER_SETTINGS[VAR_4]\n"
] | [
"def get_default_setting(setting):...\n",
"from helpdesk.settings import DEFAULT_USER_SETTINGS\n",
"return DEFAULT_USER_SETTINGS[setting]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_1(self, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_4 in self._exempt:\n",
"self._exempt.append(VAR_4)\n"
] | [
"def exempt(self, view_func):...\n",
"\"\"\"docstring\"\"\"\n",
"if not view_func in self._exempt:\n",
"self._exempt.append(view_func)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"VAR_3 = [{'boom': {}}, {'account_data': 'Hello World'}, {'event_fields': [\n '\\\\\\\\foo']}, {'room': {'timeline': {'limit': 0}, 'state': {'not_bars':\n ['*']}}}, {'event_format': 'other'}, {'room': {'not_rooms': [\n '#foo:pik-test']}}, {'presence': {'senders': ['@bar;pik.test... | [
"def test_errors_on_invalid_filters(self):...\n",
"invalid_filters = [{'boom': {}}, {'account_data': 'Hello World'}, {\n 'event_fields': ['\\\\\\\\foo']}, {'room': {'timeline': {'limit': 0},\n 'state': {'not_bars': ['*']}}}, {'event_format': 'other'}, {'room': {\n 'not_rooms': ['#foo:pik-test']}}, {'pres... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = [e.upper() for e in VAR_2.name().split('-')]\n",
"if VAR_2.usedBits() < 128:\n",
"return False\n",
"if VAR_2.keyExchangeMethod() == 'DH' and utils.is_windows:\n",
"return False\n",
"if VAR_2.encryptionMethod().upper().startswith('RC4'):\n"... | [
"def _is_secure_cipher(cipher):...\n",
"\"\"\"docstring\"\"\"\n",
"tokens = [e.upper() for e in cipher.name().split('-')]\n",
"if cipher.usedBits() < 128:\n",
"return False\n",
"if cipher.keyExchangeMethod() == 'DH' and utils.is_windows:\n",
"return False\n",
"if cipher.encryptionMethod().upper().star... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_37(self):...\n",
"from zope.interface.verify import verifyClass\n",
"from zope.tal.interfaces import ITALExpressionEngine\n",
"verifyClass(ITALExpressionEngine, self._getTargetClass())\n"
] | [
"def test_class_conforms_to_ITALExpressionEngine(self):...\n",
"from zope.interface.verify import verifyClass\n",
"from zope.tal.interfaces import ITALExpressionEngine\n",
"verifyClass(ITALExpressionEngine, self._getTargetClass())\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"ImportFrom'",
"Expr'"
] |
[
"@VAR_2.route('/download/<int:book_id>/<book_format>', defaults={'anyname':...\n",
"VAR_96 = 'kobo' if 'Kobo' in request.headers.get('User-Agent') else ''\n",
"return get_download_link(VAR_5, VAR_6, VAR_96)\n"
] | [
"@web.route('/download/<int:book_id>/<book_format>', defaults={'anyname':...\n",
"client = 'kobo' if 'Kobo' in request.headers.get('User-Agent') else ''\n",
"return get_download_link(book_id, book_format, client)\n"
] | [
0,
0,
0
] | [
"For",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"from django.contrib.admin.views.main import TO_FIELD_VAR\n",
"VAR_12 = self.base_url_parameters()\n",
"VAR_12.update({TO_FIELD_VAR: self.rel.get_related_field().name})\n",
"return VAR_12\n"
] | [
"def url_parameters(self):...\n",
"from django.contrib.admin.views.main import TO_FIELD_VAR\n",
"params = self.base_url_parameters()\n",
"params.update({TO_FIELD_VAR: self.rel.get_related_field().name})\n",
"return params\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Expr'",
"Return'"
] |
[
"async def FUNC_5(self):...\n",
"if hasattr(self, 'resolved_ref'):\n",
"return self.resolved_ref\n",
"VAR_28 = '{api_base_path}/repos/{user}/{repo}/commits/{ref}'.format(VAR_25=\n self.api_base_path.format(hostname=self.hostname), user=self.user, repo\n =self.repo, ref=self.unresolved_ref)\n",
"self.l... | [
"async def get_resolved_ref(self):...\n",
"if hasattr(self, 'resolved_ref'):\n",
"return self.resolved_ref\n",
"api_url = '{api_base_path}/repos/{user}/{repo}/commits/{ref}'.format(\n api_base_path=self.api_base_path.format(hostname=self.hostname), user=\n self.user, repo=self.repo, ref=self.unresolved_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Expr'"... |
[
"@VAR_25.whitelist(allow_guest=True)...\n",
"return 'pong'\n"
] | [
"@frappe.whitelist(allow_guest=True)...\n",
"return 'pong'\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_88(self, VAR_156, VAR_166=False):...\n",
"if VAR_156 in '_cloud':\n",
"return self.cloud()\n",
"if VAR_156 in '_search':\n",
"return self.search()\n",
"VAR_212 = self.auth.db.wiki_page(VAR_156=slug)\n",
"if VAR_212 and not self.can_read(VAR_212):\n",
"return self.not_authorized(VAR_212)\n",
... | [
"def read(self, slug, force_render=False):...\n",
"if slug in '_cloud':\n",
"return self.cloud()\n",
"if slug in '_search':\n",
"return self.search()\n",
"page = self.auth.db.wiki_page(slug=slug)\n",
"if page and not self.can_read(page):\n",
"return self.not_authorized(page)\n",
"if current.request.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_13():...\n",
"VAR_3 = FUNC_5()\n",
"if len(request.args) == 2:\n",
"VAR_120 = 'web2py.plugin.%s.w2p' % request.args[1]\n",
"if VAR_5:\n",
"VAR_5 = plugin_pack(VAR_3, request.args[1], request)\n",
"VAR_43.headers['Content-Type'] = 'application/w2p'\n",
"session.flash = T('internal error')\n",... | [
"def pack_plugin():...\n",
"app = get_app()\n",
"if len(request.args) == 2:\n",
"fname = 'web2py.plugin.%s.w2p' % request.args[1]\n",
"if filename:\n",
"filename = plugin_pack(app, request.args[1], request)\n",
"response.headers['Content-Type'] = 'application/w2p'\n",
"session.flash = T('internal erro... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self, VAR_31: Dict[str, Any], VAR_30: EventBase) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"if 'url' in VAR_30.content:\n",
"VAR_31['image_url'] = VAR_30.content['url']\n"
] | [
"def add_image_message_vars(self, messagevars: Dict[str, Any], event: EventBase...\n",
"\"\"\"docstring\"\"\"\n",
"if 'url' in event.content:\n",
"messagevars['image_url'] = event.content['url']\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'"
] |
[
"def FUNC_4(VAR_23, VAR_24=None, VAR_25=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(VAR_1, 'initialised', None):\n",
"return\n",
"if not VAR_24:\n",
"VAR_24 = '.'\n",
"VAR_1.error_log = []\n",
"VAR_1.message_log = []\n",
"VAR_1.debug_log = []\n",
"VAR_1.realtime_log = []\n",
"VAR_1.fla... | [
"def init(site, sites_path=None, new_site=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(local, 'initialised', None):\n",
"return\n",
"if not sites_path:\n",
"sites_path = '.'\n",
"local.error_log = []\n",
"local.message_log = []\n",
"local.debug_log = []\n",
"local.realtime_log = []\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assig... |
[
"def __call__(VAR_20, VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_19(VAR_2, *VAR_23, **VAR_24):...\n",
"VAR_3 = VAR_2.GET.get('url')\n",
"if VAR_3 is None or len(VAR_3) == 0:\n",
"VAR_3 = VAR_2.get_full_path()\n",
"VAR_9 = False\n",
"VAR_14 = VAR_24.get('conn', None)\n",
"VAR_16 = None\n",
... | [
"def __call__(ctx, f):...\n",
"\"\"\"docstring\"\"\"\n",
"def wrapped(request, *args, **kwargs):...\n",
"url = request.GET.get('url')\n",
"if url is None or len(url) == 0:\n",
"url = request.get_full_path()\n",
"doConnectionCleanup = False\n",
"conn = kwargs.get('conn', None)\n",
"error = None\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
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Return'",
"... |
[
"@VAR_2.route('/language')...\n",
"if VAR_87.check_visibility(constants.SIDEBAR_LANGUAGE):\n",
"VAR_107 = list()\n",
"abort(404)\n",
"if VAR_87.filter_language() == u'all':\n",
"VAR_48 = calibre_db.speaking_language()\n",
"VAR_48 = calibre_db.session.query(db.Languages).filter(db.Languages.\n lang_co... | [
"@web.route('/language')...\n",
"if current_user.check_visibility(constants.SIDEBAR_LANGUAGE):\n",
"charlist = list()\n",
"abort(404)\n",
"if current_user.filter_language() == u'all':\n",
"languages = calibre_db.speaking_language()\n",
"languages = calibre_db.session.query(db.Languages).filter(db.Langua... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_63(self, VAR_64):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.options.get('escape'):\n",
"return VAR_19(VAR_64)\n",
"return VAR_64\n"
] | [
"def inline_html(self, html):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.options.get('escape'):\n",
"return escape(html)\n",
"return html\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_11(VAR_3):...\n",
"import datetime\n",
"VAR_20 = os.path.join(apath(VAR_3, VAR_122=request), 'progress.log')\n",
"VAR_32 = re.compile('\\\\[(.*?)\\\\][^\\\\:]+\\\\:\\\\s+(\\\\-?\\\\d+)')\n",
"if not os.path.exists(VAR_20):\n",
"return []\n",
"VAR_35 = VAR_32.findall(open(VAR_20, 'r').read())\n... | [
"def report_progress(app):...\n",
"import datetime\n",
"progress_file = os.path.join(apath(app, r=request), 'progress.log')\n",
"regex = re.compile('\\\\[(.*?)\\\\][^\\\\:]+\\\\:\\\\s+(\\\\-?\\\\d+)')\n",
"if not os.path.exists(progress_file):\n",
"return []\n",
"matches = regex.findall(open(progress_fi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"AugAssign'",
"Expr'"
] |
[
"def FUNC_3():...\n",
"return VAR_6\n"
] | [
"def getEngine():...\n",
"return _engine\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_2.route('/', defaults={'page': 1})...\n",
"VAR_20 = (request.args.get('sort') or 'stored').lower()\n",
"return FUNC_15('newest', VAR_20, 1, VAR_9)\n"
] | [
"@web.route('/', defaults={'page': 1})...\n",
"sort_param = (request.args.get('sort') or 'stored').lower()\n",
"return render_books_list('newest', sort_param, 1, page)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self, VAR_14):...\n",
"VAR_87 = self.output(FUNC_4(VAR_14))\n",
"VAR_88 = self.block.def_footnotes\n",
"self.block.def_links = {}\n",
"self.block.def_footnotes = {}\n",
"self.inline.links = {}\n",
"self.inline.footnotes = {}\n",
"if not self.footnotes:\n",
"return VAR_87\n",
"VAR_61 = ... | [
"def parse(self, text):...\n",
"out = self.output(preprocessing(text))\n",
"keys = self.block.def_footnotes\n",
"self.block.def_links = {}\n",
"self.block.def_footnotes = {}\n",
"self.inline.links = {}\n",
"self.inline.footnotes = {}\n",
"if not self.footnotes:\n",
"return out\n",
"footnotes = fil... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"AugAssign'",
"AugAssign'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_12, VAR_13 = self.make_request('GET', self.url, shorthand=False)\n",
"self.assertEqual(200, int(VAR_13.result['code']), msg=channel.result['body'])\n",
"self.assertEqual({'server_version', 'python_version'}, set(VAR_13.json_body\n .keys()))\n"
] | [
"def test_version_string(self):...\n",
"request, channel = self.make_request('GET', self.url, shorthand=False)\n",
"self.assertEqual(200, int(channel.result['code']), msg=channel.result['body'])\n",
"self.assertEqual({'server_version', 'python_version'}, set(channel.\n json_body.keys()))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_1):...\n",
"VAR_17 = VAR_1.MagicMock(class_name='MyTestEnum')\n",
"VAR_1.patch(f'{VAR_0}.Reference.from_ref', return_value=fake_reference)\n",
"from openapi_python_client.parser import properties\n",
"VAR_22 = properties.EnumProperty(VAR_5='test', VAR_26=True, default=None,\n VAR_21... | [
"def test_get_type_string(self, mocker):...\n",
"fake_reference = mocker.MagicMock(class_name='MyTestEnum')\n",
"mocker.patch(f'{MODULE_NAME}.Reference.from_ref', return_value=fake_reference)\n",
"from openapi_python_client.parser import properties\n",
"enum_property = properties.EnumProperty(name='test', r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"ImportFrom'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'"
] |
[
"def FUNC_2(VAR_3, VAR_4):...\n",
"if VAR_3['aggregate_function'] == 'count':\n",
"VAR_31 = 'count(*) as _aggregate_column'\n",
"VAR_31 = '{0}(`tab{1}`.{2}) as _aggregate_column'.format(VAR_3.\n aggregate_function, VAR_4, VAR_3.aggregate_on)\n",
"return VAR_31\n"
] | [
"def get_group_by_field(args, doctype):...\n",
"if args['aggregate_function'] == 'count':\n",
"group_by_field = 'count(*) as _aggregate_column'\n",
"group_by_field = '{0}(`tab{1}`.{2}) as _aggregate_column'.format(args.\n aggregate_function, doctype, args.aggregate_on)\n",
"return group_by_field\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_37(VAR_37, VAR_42):...\n",
"if VAR_37.cover:\n",
"VAR_98 = VAR_37.cover\n",
"VAR_98 = os.path.join(constants.STATIC_DIR, 'generic_cover.jpg')\n",
"VAR_76 = os.path.join(config.config_calibre_dir, VAR_42.path, 'cover.jpg')\n",
"copyfile(VAR_98, VAR_76)\n",
"VAR_1.error('Failed to move cover fil... | [
"def move_coverfile(meta, db_book):...\n",
"if meta.cover:\n",
"coverfile = meta.cover\n",
"coverfile = os.path.join(constants.STATIC_DIR, 'generic_cover.jpg')\n",
"new_coverpath = os.path.join(config.config_calibre_dir, db_book.path,\n 'cover.jpg')\n",
"copyfile(coverfile, new_coverpath)\n",
"log.er... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"self.reactor = ThreadedMemoryReactorClock()\n"
] | [
"def setUp(self):...\n",
"self.reactor = ThreadedMemoryReactorClock()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_44(VAR_16):...\n",
"VAR_83 = False\n",
"VAR_83 |= FUNC_38(VAR_16, 'config_log_level')\n",
"VAR_83 |= FUNC_41(VAR_16, 'config_logfile')\n",
"if not logger.is_valid_logfile(config.config_logfile):\n",
"return VAR_83, FUNC_50(_(\n 'Logfile Location is not Valid, Please Enter Correct Path'))\n",
... | [
"def _configuration_logfile_helper(to_save):...\n",
"reboot_required = False\n",
"reboot_required |= _config_int(to_save, 'config_log_level')\n",
"reboot_required |= _config_string(to_save, 'config_logfile')\n",
"if not logger.is_valid_logfile(config.config_logfile):\n",
"return reboot_required, _configur... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"AugAssign'",
"AugAssign'",
"Condition",
"Return'",
"AugAssign'",
"AugAssign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_2(VAR_0):...\n",
"VAR_0.DEBUG = True\n",
"VAR_6 = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' parent=view\"\n )\n",
"VAR_7 = unicorn(None, VAR_6)\n",
"VAR_10 = CLASS_0(component_name='test', component_id='asdf')\n",
"VAR_8 = {'view': VAR_1... | [
"def test_unicorn_render_parent(settings):...\n",
"settings.DEBUG = True\n",
"token = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' parent=view\"\n )\n",
"unicorn_node = unicorn(None, token)\n",
"view = FakeComponentParent(component_name='test', compone... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assert'",
"Assert'"
] |
[
"def FUNC_9():...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_12:\n",
"VAR_12.close()\n",
"release_local(VAR_1)\n"
] | [
"def destroy():...\n",
"\"\"\"docstring\"\"\"\n",
"if db:\n",
"db.close()\n",
"release_local(local)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Expr'"
] |
[
"@wraps(VAR_3)...\n",
"VAR_12 = FUNC_2()\n",
"if VAR_12 is not None:\n",
"VAR_16 = ub.session.query(ub.User).join(ub.RemoteAuthToken).filter(ub.\n RemoteAuthToken.auth_token == VAR_12).filter(ub.RemoteAuthToken.\n token_type == 1).first()\n",
"if VAR_16 is not None:\n",
"login_user(VAR_16)\n",
"VA... | [
"@wraps(f)...\n",
"auth_token = get_auth_token()\n",
"if auth_token is not None:\n",
"user = ub.session.query(ub.User).join(ub.RemoteAuthToken).filter(ub.\n RemoteAuthToken.auth_token == auth_token).filter(ub.RemoteAuthToken.\n token_type == 1).first()\n",
"if user is not None:\n",
"login_user(user)... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_2(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9 = [p.get_type_string() for p in self.inner_properties]\n",
"VAR_10 = ', '.join(VAR_9)\n",
"if self.required:\n",
"return f'Union[{VAR_10}]'\n",
"return f'Optional[Union[{VAR_10}]]'\n"
] | [
"def get_type_string(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"inner_types = [p.get_type_string() for p in self.inner_properties]\n",
"inner_prop_string = ', '.join(inner_types)\n",
"if self.required:\n",
"return f'Union[{inner_prop_string}]'\n",
"return f'Optional[Union[{inner_prop_string}]]'\n"
... | [
0,
0,
0,
0,
5,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_16(self, VAR_6, VAR_7=None):...\n",
"self.request_profile(VAR_6, VAR_7=access_token)\n",
"self.request_profile(VAR_6, VAR_8='/displayname', VAR_7=access_token)\n",
"self.request_profile(VAR_6, VAR_8='/avatar_url', VAR_7=access_token)\n"
] | [
"def try_fetch_profile(self, expected_code, access_token=None):...\n",
"self.request_profile(expected_code, access_token=access_token)\n",
"self.request_profile(expected_code, url_suffix='/displayname', access_token\n =access_token)\n",
"self.request_profile(expected_code, url_suffix='/avatar_url', access_... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from openapi_python_client import utils\n",
"def FUNC_0():...\n",
"assert utils.snake_case('HTTP') == 'http'\n",
"assert utils.snake_case('HTTP RESPONSE') == 'http_response'\n",
"def FUNC_1():...\n",
"assert utils.snake_case('HTTPResponse') == 'http_response'\n",
"assert utils.snake_case('APIClientHTTP... | [
"from openapi_python_client import utils\n",
"def test_snake_case_uppercase_str():...\n",
"assert utils.snake_case('HTTP') == 'http'\n",
"assert utils.snake_case('HTTP RESPONSE') == 'http_response'\n",
"def test_snake_case_from_pascal_with_acronyms():...\n",
"assert utils.snake_case('HTTPResponse') == 'ht... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1
] | [
"ImportFrom'",
"FunctionDef'",
"Assert'",
"Assert'",
"FunctionDef'",
"Assert'",
"Assert'",
"Assert'",
"FunctionDef'",
"Assert'",
"FunctionDef'",
"Assert'",
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_52():...\n",
"self.http_server.stop()\n",
"self.io_loop.stop()\n"
] | [
"def _stop():...\n",
"self.http_server.stop()\n",
"self.io_loop.stop()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(self, VAR_5, VAR_8):...\n",
"return [self._translate_uuid_to_id(VAR_5, img) for img in VAR_8]\n"
] | [
"def _translate_uuids_to_ids(self, context, images):...\n",
"return [self._translate_uuid_to_id(context, img) for img in images]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_16(self, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_39 = VAR_1(VAR_12, VAR_5, 'js', 'main.min.js')\n",
"if not self.should_run(VAR_5, VAR_39):\n",
"log.info('%s up to date' % VAR_39)\n",
"log.info('Rebuilding %s' % VAR_39)\n",
"return\n",
"FUNC_7(['node', 'tools/build-main.js', VAR_5])\n... | [
"def build_main(self, name):...\n",
"\"\"\"docstring\"\"\"\n",
"target = pjoin(static, name, 'js', 'main.min.js')\n",
"if not self.should_run(name, target):\n",
"log.info('%s up to date' % target)\n",
"log.info('Rebuilding %s' % target)\n",
"return\n",
"run(['node', 'tools/build-main.js', name])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.