lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_54():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = FUNC_5()\n",
"if not VAR_19:\n",
"session.flash = VAR_117\n",
"VAR_46 = FORM.confirm(T('Pull'), {T('Cancel'): URL('site')})\n",
"redirect(URL('site'))\n",
"if VAR_46.accepted:\n",
"if 'cancel' in request.vars:\n",
"VAR_195 = git.Repo(os.pa... | [
"def git_pull():...\n",
"\"\"\"docstring\"\"\"\n",
"app = get_app()\n",
"if not have_git:\n",
"session.flash = GIT_MISSING\n",
"dialog = FORM.confirm(T('Pull'), {T('Cancel'): URL('site')})\n",
"redirect(URL('site'))\n",
"if dialog.accepted:\n",
"if 'cancel' in request.vars:\n",
"repo = git.Repo(os... | [
0,
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",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"... |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_212 = VAR_2.GET.get('Image', None)\n",
"VAR_213 = VAR_2.GET.get('Dataset', None)\n",
"VAR_214 = VAR_2.GET.get('Well', None)\n",
"if VAR_214 is not None:\n",
"VAR_214 = [VAR_241(VAR_318) for VAR_318 in VAR_214.split(',')]\n",
"if VAR_212 is None... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"imageIds = request.GET.get('Image', None)\n",
"datasetIds = request.GET.get('Dataset', None)\n",
"wellIds = request.GET.get('Well', None)\n",
"if wellIds is not None:\n",
"wellIds = [long(i) for i in wellIds.split(',')]\n",
"if imageIds is None and... | [
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'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_6(VAR_20=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return formatdate(VAR_20, usegmt=True)\n"
] | [
"def http_date(epoch_seconds=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return formatdate(epoch_seconds, usegmt=True)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = VAR_0.POST.get('path') or VAR_0.META.get('HTTP_REFERER') or '/'\n",
"if VAR_1 == 'edit_on' or VAR_1 == 'edit_off':\n",
"set_edit_mode(VAR_0, VAR_1.endswith('_on'))\n",
"return HttpResponseRedirect(VAR_2)\n"
] | [
"def handle_command(request, command):...\n",
"\"\"\"docstring\"\"\"\n",
"path = request.POST.get('path') or request.META.get('HTTP_REFERER') or '/'\n",
"if command == 'edit_on' or command == 'edit_off':\n",
"set_edit_mode(request, command.endswith('_on'))\n",
"return HttpResponseRedirect(path)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_2(VAR_21, VAR_17, VAR_19, VAR_22):...\n",
"VAR_64 = ''\n",
"VAR_38 = []\n",
"VAR_65 = 0\n",
"while 1:\n",
"VAR_86, VAR_87 = None, None\n",
"for regex in VAR_17:\n",
"VAR_97 = VAR_65\n",
"if VAR_86 is None:\n",
"while 1:\n",
"if VAR_38:\n",
"VAR_61 = VAR_86.group(0)\n",
"VAR_103 = r... | [
"def _link_text(text, link_regexes, avoid_hosts, factory):...\n",
"leading_text = ''\n",
"links = []\n",
"last_pos = 0\n",
"while 1:\n",
"best_match, best_pos = None, None\n",
"for regex in link_regexes:\n",
"regex_pos = last_pos\n",
"if best_match is None:\n",
"while 1:\n",
"if links:\n",
"li... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"A... |
[
"def FUNC_37(self, VAR_90):...\n",
"self._queryset = VAR_90\n",
"self.widget.choices = self.choices\n"
] | [
"def _set_queryset(self, queryset):...\n",
"self._queryset = queryset\n",
"self.widget.choices = self.choices\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_7(self):...\n",
"return f'https://{self.hostname}/{self.namespace}.git'\n"
] | [
"def get_repo_url(self):...\n",
"return f'https://{self.hostname}/{self.namespace}.git'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_0.route('/api/query/star', methods=['POST'])...\n",
"if get_user() is None:\n",
"return 'Unauthorized access', 403\n",
"VAR_14 = g.conn.session.query(Query).get(request.form['query_id'])\n",
"if VAR_14:\n",
"VAR_34 = Star()\n",
"return 'Query not found', 404\n",
"VAR_34.user = get_user()\n",
"... | [
"@app.route('/api/query/star', methods=['POST'])...\n",
"if get_user() is None:\n",
"return 'Unauthorized access', 403\n",
"query = g.conn.session.query(Query).get(request.form['query_id'])\n",
"if query:\n",
"star = Star()\n",
"return 'Query not found', 404\n",
"star.user = get_user()\n",
"star.que... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4, VAR_6):...\n",
"self.room_id = self.helper.create_room_as(self.user_id)\n"
] | [
"def prepare(self, reactor, clock, hs):...\n",
"self.room_id = self.helper.create_room_as(self.user_id)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_28(VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"@wraps(VAR_14)...\n",
"VAR_112 = None\n",
"if 'X-Access-Token' in request.headers:\n",
"VAR_112 = request.headers['X-Access-Token']\n",
"if not VAR_112:\n",
"return jsonify({'success': False, 'message': 'Token is missing'}), 401\n",
"VAR_13 = ... | [
"def token_required(f):...\n",
"\"\"\"docstring\"\"\"\n",
"@wraps(f)...\n",
"token = None\n",
"if 'X-Access-Token' in request.headers:\n",
"token = request.headers['X-Access-Token']\n",
"if not token:\n",
"return jsonify({'success': False, 'message': 'Token is missing'}), 401\n",
"data = jwt.decode(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Return'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_3(self, VAR_4, VAR_5):...\n",
"print(storage.location)\n",
"VAR_18 = storage.save('test.jpg', f)\n",
"VAR_12 = VAR_4.post(reverse('upload'), {'file': json.dumps([VAR_18]),\n 's3file': '[\"file\"]'})\n",
"assert VAR_12.status_code == 201\n"
] | [
"def test_value_from_datadict(self, client, upload_file):...\n",
"print(storage.location)\n",
"uploaded_file = storage.save('test.jpg', f)\n",
"response = client.post(reverse('upload'), {'file': json.dumps([\n uploaded_file]), 's3file': '[\"file\"]'})\n",
"assert response.status_code == 201\n"
] | [
0,
1,
1,
1,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_156():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_355 = {'prefix': VAR_113, 'user': VAR_116 if self.user_id else None}\n",
"for i in VAR_250:\n",
"if i['name'] == VAR_28('Log In'):\n",
"self.bar = VAR_355\n",
"VAR_346 = 'login'\n",
"if i['name'] == VAR_28('Sign Up'):\n",
"VAR_355[VAR_346] = i[... | [
"def bare():...\n",
"\"\"\"docstring\"\"\"\n",
"bare = {'prefix': prefix, 'user': user_identifier if self.user_id else None}\n",
"for i in items:\n",
"if i['name'] == T('Log In'):\n",
"self.bar = bare\n",
"k = 'login'\n",
"if i['name'] == T('Sign Up'):\n",
"bare[k] = i['href']\n",
"k = 'register'\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"@VAR_8.route('/config/', methods=['GET'])...\n",
"if VAR_8.interface.auth is None or current_user.is_authenticated:\n",
"return jsonify(VAR_8.interface.config)\n",
"return {'auth_required': True, 'auth_message': VAR_8.interface.auth_message}\n"
] | [
"@app.route('/config/', methods=['GET'])...\n",
"if app.interface.auth is None or current_user.is_authenticated:\n",
"return jsonify(app.interface.config)\n",
"return {'auth_required': True, 'auth_message': app.interface.auth_message}\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"VAR_15 = self._makeOne()\n",
"VAR_16 = CLASS_1()\n",
"VAR_18 = {VAR_15.cookie_name: 'deleted', 'RESPONSE': VAR_16}\n",
"VAR_17 = CLASS_0(**req_data)\n",
"self.assertEqual(len(VAR_16.cookies), 0)\n",
"self.assertEqual(VAR_15.extractCredentials(VAR_17), {})\n"
] | [
"def test_extractCredentials_with_deleted_cookie(self):...\n",
"helper = self._makeOne()\n",
"response = FauxCookieResponse()\n",
"req_data = {helper.cookie_name: 'deleted', 'RESPONSE': response}\n",
"request = FauxSettableRequest(**req_data)\n",
"self.assertEqual(len(response.cookies), 0)\n",
"self.ass... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_1):...\n",
"@VAR_1.url_value_preprocessor...\n",
"g.auth_token = VAR_7.pop('auth_token')\n"
] | [
"def register_url_value_preprocessor(kobo):...\n",
"@kobo.url_value_preprocessor...\n",
"g.auth_token = values.pop('auth_token')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'"
] |
[
"def FUNC_21(self):...\n",
"VAR_29 = coreapi.Document(VAR_5='', title='Example API', content={'users':\n {'list': {}}})\n",
"VAR_30 = VAR_29['users']\n",
"VAR_31 = schema_links(VAR_30)\n",
"assert len(VAR_31) is 0\n"
] | [
"def test_schema_with_empty_links(self):...\n",
"schema = coreapi.Document(url='', title='Example API', content={'users': {\n 'list': {}}})\n",
"section = schema['users']\n",
"flat_links = schema_links(section)\n",
"assert len(flat_links) is 0\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"async def FUNC_5(self, VAR_11: str, VAR_6: str, VAR_12: int, VAR_13:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_43 = await self.store.get_threepid_validation_session('email', VAR_6,\n VAR_20=email_address, validated=False)\n",
"if VAR_43 and VAR_43.get('validated_at') is None:\n",
"VAR_33 = VAR_43['session_... | [
"async def send_threepid_validation(self, email_address: str, client_secret:...\n",
"\"\"\"docstring\"\"\"\n",
"session = await self.store.get_threepid_validation_session('email',\n client_secret, address=email_address, validated=False)\n",
"if session and session.get('validated_at') is None:\n",
"sessio... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"AugAssign'",
"AugAssign'",
"Expr'",
"Expr'",
"Assign'",
"AugAssign'",
"Expr'",
"Return'"
] |
[
"@FUNC_0...\n",
"return IdentityHandler(self)\n"
] | [
"@cache_in_self...\n",
"return IdentityHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"import urllib2\n",
"from flask import Flask, render_template, session, request, json\n",
"from core.trape import Trape\n",
"from core.db import Database\n",
"VAR_0 = Trape()\n",
"VAR_1 = Flask(__name__, template_folder='../templates', static_folder=\n '../static')\n",
"VAR_2 = Database()\n",
"VAR_... | [
"import urllib2\n",
"from flask import Flask, render_template, session, request, json\n",
"from core.trape import Trape\n",
"from core.db import Database\n",
"trape = Trape()\n",
"app = Flask(__name__, template_folder='../templates', static_folder='../static'\n )\n",
"db = Database()\n",
"trape.hea... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_11: IReactorPluggableNameResolver, VAR_8: Optional[...\n",
"\"\"\"docstring\"\"\"\n",
"self._reactor = VAR_11\n",
"self._ip_whitelist = VAR_8\n",
"self._ip_blacklist = VAR_9\n"
] | [
"def __init__(self, reactor: IReactorPluggableNameResolver, ip_whitelist:...\n",
"\"\"\"docstring\"\"\"\n",
"self._reactor = reactor\n",
"self._ip_whitelist = ip_whitelist\n",
"self._ip_blacklist = ip_blacklist\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_25(self, VAR_15, **VAR_14):...\n",
"if VAR_15.status_code != 401:\n",
"return VAR_15\n",
"if not self.prompting:\n",
"return VAR_15\n",
"VAR_75 = urllib_parse.urlparse(VAR_15.url)\n",
"VAR_4, VAR_73, VAR_76 = self._prompt_for_password(VAR_75.netloc)\n",
"self._credentials_to_save = None\n",
... | [
"def handle_401(self, resp, **kwargs):...\n",
"if resp.status_code != 401:\n",
"return resp\n",
"if not self.prompting:\n",
"return resp\n",
"parsed = urllib_parse.urlparse(resp.url)\n",
"username, password, save = self._prompt_for_password(parsed.netloc)\n",
"self._credentials_to_save = None\n",
"i... | [
0,
0,
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'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_68(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.jwt_handler:\n",
"VAR_380 = self.jwt_handler.jwt_token_manager()\n"
] | [
"def jwt(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.jwt_handler:\n",
"rtn = self.jwt_handler.jwt_token_manager()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'"
] |
[
"def FUNC_30(VAR_63):...\n",
"VAR_63 = io.StringIO(VAR_63)\n",
"VAR_82 = list(csv.reader(VAR_63))\n",
"VAR_83 = VAR_82[0]\n",
"VAR_84 = VAR_83.index('flag')\n",
"VAR_82[VAR_24][VAR_84] = VAR_23\n",
"VAR_47 = io.StringIO()\n",
"VAR_85 = csv.writer(VAR_47)\n",
"VAR_85.writerows(VAR_82)\n",
"return V... | [
"def replace_flag_at_index(file_content):...\n",
"file_content = io.StringIO(file_content)\n",
"content = list(csv.reader(file_content))\n",
"header = content[0]\n",
"flag_col_index = header.index('flag')\n",
"content[flag_index][flag_col_index] = flag_option\n",
"output = io.StringIO()\n",
"writer = ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_11):...\n",
"VAR_3 = VAR_11.dataroot\n",
"VAR_4 = VAR_11.yfcc100m_db_host\n",
"VAR_5 = VAR_11.yfcc100m_db_dbname\n",
"VAR_6 = VAR_11.yfcc100m_db_user\n",
"VAR_7 = VAR_11.yfcc100m_db_password\n",
"VAR_8 = VAR_11.yfcc100m_db_port\n"
] | [
"def init(config):...\n",
"DATAROOT = config.dataroot\n",
"DB_HOST = config.yfcc100m_db_host\n",
"DB_DBNAME = config.yfcc100m_db_dbname\n",
"DB_USER = config.yfcc100m_db_user\n",
"DB_PASSWORD = config.yfcc100m_db_password\n",
"DB_PORT = config.yfcc100m_db_port\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_74(self, VAR_44=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_77 = self.get_signature()\n",
"if file_lock.lock_exists(VAR_77):\n",
"VAR_96 = True\n",
"file_lock.create_lock(VAR_77)\n",
"if VAR_44:\n",
"for i in range(VAR_44):\n",
"if VAR_96:\n",
"time.sleep(1)\n",
"if not file_lock.loc... | [
"def lock(self, timeout=None):...\n",
"\"\"\"docstring\"\"\"\n",
"signature = self.get_signature()\n",
"if file_lock.lock_exists(signature):\n",
"lock_exists = True\n",
"file_lock.create_lock(signature)\n",
"if timeout:\n",
"for i in range(timeout):\n",
"if lock_exists:\n",
"time.sleep(1)\n",
"i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"For",
"Condition",
"Expr'",
"Condition",
"Assign'"
] |
[
"@pytest.fixture(scope='session')...\n",
"VAR_2 = webdriver.ChromeOptions()\n",
"VAR_2.headless = True\n",
"VAR_5 = webdriver.Chrome(options=chrome_options)\n",
"pytest.skip(force_str(e))\n",
"yield VAR_5\n",
"VAR_5.quit()\n"
] | [
"@pytest.fixture(scope='session')...\n",
"chrome_options = webdriver.ChromeOptions()\n",
"chrome_options.headless = True\n",
"b = webdriver.Chrome(options=chrome_options)\n",
"pytest.skip(force_str(e))\n",
"yield b\n",
"b.quit()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(*VAR_0, **VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_0:\n",
"if isinstance(VAR_0[0], BaseDocument):\n",
"if len(VAR_0) < 2 and VAR_1:\n",
"return VAR_0[0]\n",
"if isinstance(VAR_0[0], string_types):\n",
"if 'doctype' in VAR_1:\n",
"VAR_5 = get_controller(VAR_2)\n",
"VAR_2 = VAR_... | [
"def get_doc(*args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"if args:\n",
"if isinstance(args[0], BaseDocument):\n",
"if len(args) < 2 and kwargs:\n",
"return args[0]\n",
"if isinstance(args[0], string_types):\n",
"if 'doctype' in kwargs:\n",
"controller = get_controller(doctype)\n",
"doctype... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Condition",
"Return'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self, VAR_13: Text, VAR_14: Text) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"self.s3.Object(self.bucket_name, VAR_13).put(Body=f)\n"
] | [
"def _persist_tar(self, file_key: Text, tar_path: Text) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"self.s3.Object(self.bucket_name, file_key).put(Body=f)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"assert set(ClearableFileInput().build_attrs({}).keys()) == {'class',\n 'data-url', 'data-fields-x-amz-algorithm', 'data-fields-x-amz-date',\n 'data-fields-x-amz-signature', 'data-fields-x-amz-credential',\n 'data-fields-policy', 'data-fields-key'}\n",
"assert ClearableFileInp... | [
"def test_build_attr(self):...\n",
"assert set(ClearableFileInput().build_attrs({}).keys()) == {'class',\n 'data-url', 'data-fields-x-amz-algorithm', 'data-fields-x-amz-date',\n 'data-fields-x-amz-signature', 'data-fields-x-amz-credential',\n 'data-fields-policy', 'data-fields-key'}\n",
"assert Clearab... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_43(self, VAR_9):...\n",
"VAR_84 = cherry.config['media.basedir']\n",
"VAR_85 = os.path.join(VAR_84, VAR_9)\n",
"return json.dumps(metainfo.getSongInfo(VAR_85).dict())\n"
] | [
"def api_getsonginfo(self, path):...\n",
"basedir = cherry.config['media.basedir']\n",
"abspath = os.path.join(basedir, path)\n",
"return json.dumps(metainfo.getSongInfo(abspath).dict())\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_27(VAR_8, VAR_60, VAR_10=None, VAR_11=None, VAR_7=None):...\n",
"if VAR_10 is None and VAR_11 is None or g.locale is None:\n",
"return VAR_60\n",
"VAR_37 = FUNC_1(VAR_8, VAR_10=data, VAR_11=additional_request_data)\n",
"def FUNC_35():...\n",
"return FUNC_0(VAR_6=request.url_root, VAR_7=additiona... | [
"def get_preemptively_cached_view(key, view, data=None,...\n",
"if data is None and additional_request_data is None or g.locale is None:\n",
"return view\n",
"d = _preemptive_data(key, data=data, additional_request_data=\n additional_request_data)\n",
"def unless():...\n",
"return _preemptive_unless(ba... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_15(VAR_2, VAR_4, VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = VAR_2 / 'session.yml'\n",
"VAR_29.write('windows: []')\n",
"VAR_11 = FUNC_0(VAR_4.config) + ['--temp-basedir', '-r', str(VAR_29)]\n",
"VAR_6.start(VAR_11)\n",
"VAR_6.compare_session('string')\n",
"VAR_6.send_cmd(':quit')\n"... | [
"def test_loading_empty_session(tmpdir, request, quteproc_new):...\n",
"\"\"\"docstring\"\"\"\n",
"session = tmpdir / 'session.yml'\n",
"session.write('windows: []')\n",
"args = _base_args(request.config) + ['--temp-basedir', '-r', str(session)]\n",
"quteproc_new.start(args)\n",
"quteproc_new.compare_se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_4.route('/')...\n",
"VAR_15 = copy.deepcopy(VAR_3)\n",
"VAR_16 = {'total_munhak': len(VAR_15), 'source_list': sorted(set([\n munhak_row.source for munhak_row in VAR_15]))}\n",
"print(VAR_16)\n",
"VAR_17['quiz_count'] = 0\n",
"return render_template('quiz/index.html', VAR_16=data)\n"
] | [
"@app.route('/')...\n",
"munhak_rows = copy.deepcopy(munhak_rows_data)\n",
"data = {'total_munhak': len(munhak_rows), 'source_list': sorted(set([\n munhak_row.source for munhak_row in munhak_rows]))}\n",
"print(data)\n",
"session['quiz_count'] = 0\n",
"return render_template('quiz/index.html', data=dat... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_13(VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_39 = {}\n",
"VAR_40 = VAR_16.split(';')\n",
"for input_raw in filter(bool, VAR_40):\n",
"VAR_67 = re.match('([^=]+)=([^\\\\[\\\\]]+)\\\\[([^\\\\[\\\\]]+)\\\\]$', input_raw)\n",
"return VAR_39\n",
"if VAR_67:\n",
"VAR_39[VAR_67.group(1)] = ... | [
"def preprocess_inputs_arg_string(inputs_str):...\n",
"\"\"\"docstring\"\"\"\n",
"input_dict = {}\n",
"inputs_raw = inputs_str.split(';')\n",
"for input_raw in filter(bool, inputs_raw):\n",
"match = re.match('([^=]+)=([^\\\\[\\\\]]+)\\\\[([^\\\\[\\\\]]+)\\\\]$', input_raw)\n",
"return input_dict\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_39(VAR_33, VAR_34, VAR_101=None):...\n",
"if callable(VAR_64):\n",
"if VAR_34 and not isinstance(VAR_34, str):\n",
"VAR_143 = VAR_64()\n",
"VAR_0.exception(\n 'Error while trying to retrieve custom ETag value for plugin {}'.format\n (VAR_8))\n",
"from werkzeug.http import http_date\n",
"... | [
"def compute_etag(files, lastmodified, additional=None):...\n",
"if callable(custom_etag):\n",
"if lastmodified and not isinstance(lastmodified, str):\n",
"etag = custom_etag()\n",
"_logger.exception(\n 'Error while trying to retrieve custom ETag value for plugin {}'.format\n (key))\n",
"from werkze... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"ImportFrom'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Import'",
"Return'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_6(self, VAR_2, VAR_14, VAR_15):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14.SERVICE_OPTS.setOmeroShare()\n",
"if VAR_15 is None:\n",
"return None\n",
"VAR_26 = VAR_14.getShare(VAR_15)\n",
"if VAR_26.getOwner().id != VAR_14.getUserId():\n",
"VAR_0.error('Error retrieving share connection.', exc... | [
"def prepare_share_connection(self, request, conn, share_id):...\n",
"\"\"\"docstring\"\"\"\n",
"conn.SERVICE_OPTS.setOmeroShare()\n",
"if share_id is None:\n",
"return None\n",
"share = conn.getShare(share_id)\n",
"if share.getOwner().id != conn.getUserId():\n",
"logger.error('Error retrieving share ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self, *VAR_8, **VAR_9):...\n",
"VAR_12 = VAR_9.get('str', False)\n",
"VAR_13 = VAR_9.get('okayToFail', False)\n",
"VAR_10 = VAR_9.get('type', self.type)\n",
"VAR_11 = self._buildPath(VAR_8=segs, VAR_10=fileType)\n",
"if VAR_12:\n",
"if self.fallback:\n",
"return fh.read()\n",
"return ope... | [
"def fetch(self, *segs, **kwargs):...\n",
"str = kwargs.get('str', False)\n",
"okayToFail = kwargs.get('okayToFail', False)\n",
"fileType = kwargs.get('type', self.type)\n",
"location = self._buildPath(segs=segs, fileType=fileType)\n",
"if str:\n",
"if self.fallback:\n",
"return fh.read()\n",
"retur... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_82(self, VAR_2, VAR_57=None, VAR_22=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_22 is None:\n",
"VAR_337 = VAR_2.GET.get('server', VAR_2.POST.get('server'))\n",
"VAR_53 = {'version': omero_version, 'build_year': build_year, 'error':\n VAR_57, 'form': VAR_22}\n",
"if VAR_337 is not None:\... | [
"def handle_not_logged_in(self, request, error=None, form=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if form is None:\n",
"server_id = request.GET.get('server', request.POST.get('server'))\n",
"context = {'version': omero_version, 'build_year': build_year, 'error':\n error, 'form': form}\n",
"if server_... | [
0,
0,
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",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'"... |
[
"@FUNC_2.__func__...\n",
"\"\"\"docstring\"\"\"\n",
"self._submit()\n"
] | [
"@whitelist.__func__...\n",
"\"\"\"docstring\"\"\"\n",
"self._submit()\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'"
] |
[
"def FUNC_49(VAR_21, VAR_22, VAR_23):...\n",
"if VAR_87.filter_language() != 'all':\n",
"VAR_21 = VAR_21.filter(db.Books.languages.any(db.Languages.lang_code ==\n VAR_87.filter_language()))\n",
"for language in VAR_22:\n",
"return VAR_21\n",
"VAR_21 = VAR_21.filter(db.Books.languages.any(db.Languages.i... | [
"def adv_search_language(q, include_languages_inputs, exclude_languages_inputs):...\n",
"if current_user.filter_language() != 'all':\n",
"q = q.filter(db.Books.languages.any(db.Languages.lang_code == current_user.\n filter_language()))\n",
"for language in include_languages_inputs:\n",
"return q\n",
"q... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"For",
"Return'",
"Assign'",
"For",
"Assign'"
] |
[
"def __init__(self, VAR_7, VAR_8):...\n",
"self.errorstring = VAR_7\n",
"self.error = VAR_8\n",
"super().__init__(VAR_7)\n"
] | [
"def __init__(self, errorstring, error):...\n",
"self.errorstring = errorstring\n",
"self.error = error\n",
"super().__init__(errorstring)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_118(*VAR_11, **VAR_351):...\n",
""
] | [
"def f(*args, **kwargs):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_26(VAR_66):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_81 = StringIO()\n",
"VAR_82 = csv.writer(VAR_81)\n",
"VAR_82.writerow([VAR_63, VAR_64])\n",
"for csv_line in VAR_66:\n",
"VAR_82.writerow([str(csv_line[0][:-4]).replace('T', ' '), csv_line[1]])\n",
"VAR_81.seek(0)\n",
"yield VAR_81.read()\... | [
"def iter_csv(data):...\n",
"\"\"\"docstring\"\"\"\n",
"line = StringIO()\n",
"writer = csv.writer(line)\n",
"writer.writerow([col_1, col_2])\n",
"for csv_line in data:\n",
"writer.writerow([str(csv_line[0][:-4]).replace('T', ' '), csv_line[1]])\n",
"line.seek(0)\n",
"yield line.read()\n",
"line.t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_72(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._set_canonical_alias({'alias': self.alias, 'alt_aliases': [self.alias]})\n",
"VAR_61 = self._get_canonical_alias()\n",
"self.assertEqual(VAR_61, {'alias': self.alias, 'alt_aliases': [self.alias]})\n",
"self._set_canonical_alias({'alias': self.ali... | [
"def test_partial_modify(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._set_canonical_alias({'alias': self.alias, 'alt_aliases': [self.alias]})\n",
"res = self._get_canonical_alias()\n",
"self.assertEqual(res, {'alias': self.alias, 'alt_aliases': [self.alias]})\n",
"self._set_canonical_alias({'alias': se... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"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_3(VAR_0):...\n",
"from MoinMoin import search\n",
"VAR_8 = VAR_0.values.get('pagename', '')\n",
"if VAR_8:\n",
"VAR_30 = search.searchPages(VAR_0, 't:\"%s\"' % VAR_8)\n",
"VAR_31 = [VAR_8]\n",
"VAR_31 = [p.page_name for p in VAR_30.hits]\n",
"VAR_0.write('string' % ''.join([('<option>%s</opt... | [
"def page_list(request):...\n",
"from MoinMoin import search\n",
"name = request.values.get('pagename', '')\n",
"if name:\n",
"searchresult = search.searchPages(request, 't:\"%s\"' % name)\n",
"pages = [name]\n",
"pages = [p.page_name for p in searchresult.hits]\n",
"request.write(\n \"\"\"<!DOCTYP... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(self, VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.require_authentication:\n",
"if not is_authenticated(VAR_20.user):\n",
"VAR_35 = get_missing_permissions(VAR_20.user, self.permissions)\n",
"return _('Sign in to continue.')\n",
"if not getattr(VAR_20.user, 'is_staff', False):\n",
"... | [
"def _get_unauth_reason(self, request):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.require_authentication:\n",
"if not is_authenticated(request.user):\n",
"missing_permissions = get_missing_permissions(request.user, self.permissions)\n",
"return _('Sign in to continue.')\n",
"if not getattr(request.user... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Assign'",
"Return'",
"Condition",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_121(*VAR_79, **VAR_42):...\n",
"if VAR_13.read_from_replica:\n",
"FUNC_6()\n",
"VAR_225 = VAR_129(*VAR_79, **get_newargs(fn, kwargs))\n",
"if VAR_1 and hasattr(VAR_1, 'primary_db'):\n",
"return VAR_225\n",
"VAR_1.db.close()\n",
"VAR_1.db = VAR_1.primary_db\n"
] | [
"def wrapper_fn(*args, **kwargs):...\n",
"if conf.read_from_replica:\n",
"connect_replica()\n",
"retval = fn(*args, **get_newargs(fn, kwargs))\n",
"if local and hasattr(local, 'primary_db'):\n",
"return retval\n",
"local.db.close()\n",
"local.db = local.primary_db\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Assign'"
] |
[
"async def FUNC_17(self, VAR_3):...\n",
"await self.callback(VAR_3)\n"
] | [
"async def _async_render_GET(self, request):...\n",
"await self.callback(request)\n"
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Expr'"
] |
[
"def FUNC_5(VAR_23=None, VAR_26=None, VAR_27=True):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.database import get_db\n",
"if VAR_23:\n",
"FUNC_4(VAR_23)\n",
"VAR_1.db = get_db(VAR_10=db_name or local.conf.db_name)\n",
"if VAR_27:\n",
"FUNC_22('Administrator')\n"
] | [
"def connect(site=None, db_name=None, set_admin_as_user=True):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.database import get_db\n",
"if site:\n",
"init(site)\n",
"local.db = get_db(user=db_name or local.conf.db_name)\n",
"if set_admin_as_user:\n",
"set_user('Administrator')\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"self.export_doc()\n"
] | [
"def on_update(self):...\n",
"self.export_doc()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_118(VAR_120=None):...\n",
"VAR_184 = {}\n",
"for VAR_219 in ([VAR_120] if VAR_120 else FUNC_64(VAR_122=True)):\n",
"VAR_219 = 'frappe' if VAR_219 == 'webnotes' else VAR_219\n",
"return VAR_184\n",
"VAR_226 = FUNC_55(VAR_219 + '.hooks')\n",
"if VAR_1.flags.in_install_app:\n",
"for VAR_46 in d... | [
"def load_app_hooks(app_name=None):...\n",
"hooks = {}\n",
"for app in ([app_name] if app_name else get_installed_apps(sort=True)):\n",
"app = 'frappe' if app == 'webnotes' else app\n",
"return hooks\n",
"app_hooks = get_module(app + '.hooks')\n",
"if local.flags.in_install_app:\n",
"for key in dir(ap... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Condition",
"For",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"import logging\n",
"import urllib.parse\n",
"from typing import List, Optional\n",
"from netaddr import AddrFormatError, IPAddress\n",
"from zope.interface import implementer\n",
"from twisted.internet import defer\n",
"from twisted.internet.endpoints import HostnameEndpoint, wrapClientTLS\n",
"from ... | [
"import logging\n",
"import urllib.parse\n",
"from typing import List, Optional\n",
"from netaddr import AddrFormatError, IPAddress\n",
"from zope.interface import implementer\n",
"from twisted.internet import defer\n",
"from twisted.internet.endpoints import HostnameEndpoint, wrapClientTLS\n",
"from ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
... |
[
"def FUNC_21():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_47 = {'image_location': VAR_35, 'image_path': VAR_34}\n",
"VAR_10['properties']['image_state'] = 'downloading'\n",
"self.service.update(VAR_5, VAR_7, VAR_10)\n",
"VAR_49 = []\n",
"VAR_0.exception(_('Failed to download %(image_location)s to %(image_p... | [
"def delayed_create():...\n",
"\"\"\"docstring\"\"\"\n",
"log_vars = {'image_location': image_location, 'image_path': image_path}\n",
"metadata['properties']['image_state'] = 'downloading'\n",
"self.service.update(context, image_uuid, metadata)\n",
"parts = []\n",
"LOG.exception(_('Failed to download %(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"For",
"Assign'",
"Expr'... |
[
"def FUNC_29(VAR_16):...\n",
"VAR_41 = calibre_db.session.query(db.Tags).join(db.books_tags_link).join(db\n .Books).filter(calibre_db.common_filters()).group_by(text(\n 'books_tags_link.tag')).order_by(db.Tags.name).all()\n",
"VAR_73 = calibre_db.session.query(db.Series).join(db.books_series_link).join(db... | [
"def render_prepare_search_form(cc):...\n",
"tags = calibre_db.session.query(db.Tags).join(db.books_tags_link).join(db.Books\n ).filter(calibre_db.common_filters()).group_by(text('books_tags_link.tag')\n ).order_by(db.Tags.name).all()\n",
"series = calibre_db.session.query(db.Series).join(db.books_series_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_19(self):...\n",
"VAR_26 = np.array([[1], [2]])\n",
"VAR_31 = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(VAR_31, VAR_53=x0)\n",
"VAR_27 = np.ones([2, 10])\n",
"VAR_20 = 'x0=' + VAR_31 + '[a]'\n",
"VAR_21 = 'x0=np.ones([2,10])'\n",
"VAR_30 = saved_model_cli.load_inputs_from_... | [
"def testInputParserBothDuplicate(self):...\n",
"x0 = np.array([[1], [2]])\n",
"input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(input_path, a=x0)\n",
"x1 = np.ones([2, 10])\n",
"input_str = 'x0=' + input_path + '[a]'\n",
"input_expr_str = 'x0=np.ones([2,10])'\n",
"feed_dict =... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_65(self, VAR_112=VAR_3, VAR_134=VAR_3, VAR_135=VAR_3, VAR_136=VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.is_logged_in():\n",
"redirect(self.settings.login_url, client_side=self.settings.client_side)\n",
"if self.settings.login_form != self:\n",
"VAR_370 = self.settings.login_form\n",... | [
"def change_password(self, next=DEFAULT, onvalidation=DEFAULT, onaccept=...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.is_logged_in():\n",
"redirect(self.settings.login_url, client_side=self.settings.client_side)\n",
"if self.settings.login_form != self:\n",
"cas = self.settings.login_form\n",
"db = se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Expr'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Ass... |
[
"def FUNC_22(self):...\n",
"VAR_29 = coreapi.Document(VAR_5='', title='Example API', content={'users':\n {'list': coreapi.Link(url='/users/', action='get', fields=[])}})\n",
"VAR_30 = VAR_29['users']\n",
"VAR_31 = schema_links(VAR_30)\n",
"assert len(VAR_31) is 1\n",
"assert 'list' in VAR_31\n"
] | [
"def test_single_action(self):...\n",
"schema = coreapi.Document(url='', title='Example API', content={'users': {\n 'list': coreapi.Link(url='/users/', action='get', fields=[])}})\n",
"section = schema['users']\n",
"flat_links = schema_links(section)\n",
"assert len(flat_links) is 1\n",
"assert 'list' ... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"def FUNC_11(VAR_37):...\n",
"VAR_4, VAR_39 = VAR_37\n",
"VAR_25.write(VAR_4)\n",
"return VAR_39\n"
] | [
"def write_to(r):...\n",
"data, response = r\n",
"output_stream.write(data)\n",
"return response\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_111(VAR_129):...\n",
"from frappe.desk.search import validate_and_sanitize_search_inputs as func\n",
"return func(VAR_129)\n"
] | [
"def validate_and_sanitize_search_inputs(fn):...\n",
"from frappe.desk.search import validate_and_sanitize_search_inputs as func\n",
"return func(fn)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Return'"
] |
[
"def __str__(self):...\n",
"return '%s' % self.name\n"
] | [
"def __str__(self):...\n",
"return '%s' % self.name\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_4, VAR_58, *VAR_6, **VAR_7):...\n",
"\"\"\"docstring\"\"\"\n",
"super().__init__(*VAR_6, **kwargs)\n",
"self.fields['lang'].choices += VAR_58.languages.as_choices()\n",
"self.fields['component'].choices += VAR_58.component_set.filter_access(VAR_4\n ).order().values_list('slug', 'n... | [
"def __init__(self, user, project, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"super().__init__(*args, **kwargs)\n",
"self.fields['lang'].choices += project.languages.as_choices()\n",
"self.fields['component'].choices += project.component_set.filter_access(user\n ).order().values_list('slug', 'n... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"AugAssign'",
"AugAssign'"
] |
[
"def FUNC_12(self, VAR_3, VAR_4):...\n",
"return django.forms.CharField(widget=django.forms.HiddenInput, **options)\n"
] | [
"def create_hidden_field(self, field, options):...\n",
"return django.forms.CharField(widget=django.forms.HiddenInput, **options)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_61(VAR_70):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_137 = {' ': 'normal', '+': 'plus', '-': 'minus'}\n",
"return VAR_137[VAR_70[0]]\n"
] | [
"def getclass(item):...\n",
"\"\"\"docstring\"\"\"\n",
"operators = {' ': 'normal', '+': 'plus', '-': 'minus'}\n",
"return operators[item[0]]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_30(self, VAR_26):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_26, bytes):\n",
"VAR_26 = VAR_26.decode('utf-8')\n",
"if isinstance(VAR_26, str):\n",
"return '${len}\\r\\n{str}\\r\\n'.format(len=len(obj), str=obj)\n",
"if isinstance(VAR_26, int):\n",
"return ':{val}\\r\\n'.format(val=... | [
"def encode(self, obj):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(obj, bytes):\n",
"obj = obj.decode('utf-8')\n",
"if isinstance(obj, str):\n",
"return '${len}\\r\\n{str}\\r\\n'.format(len=len(obj), str=obj)\n",
"if isinstance(obj, int):\n",
"return ':{val}\\r\\n'.format(val=obj)\n",
"if isin... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Return'"
] |
[
"async def FUNC_8(self, VAR_10: str, VAR_11: str, VAR_20: Iterable[str]):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = await self.store.get_room_version(VAR_11)\n",
"VAR_60 = {}\n",
"async def FUNC_48(VAR_12: str):...\n",
"VAR_1 = await self.federation_client.get_pdu([VAR_10], VAR_12, VAR_28,\n outlier=... | [
"async def _get_events_and_persist(self, destination: str, room_id: str,...\n",
"\"\"\"docstring\"\"\"\n",
"room_version = await self.store.get_room_version(room_id)\n",
"event_map = {}\n",
"async def get_event(event_id: str):...\n",
"event = await self.federation_client.get_pdu([destination], event_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
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"AsyncFunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"For",
"Assign'",
"Expr'",
"For",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_174(VAR_212):...\n",
"if VAR_212.render:\n",
"if VAR_212.render in self.settings.render.keys():\n",
"VAR_472 = self.markmin_render\n",
"VAR_472 = self.settings.render[VAR_212.render]\n",
"VAR_472 = getattr(self, '%s_render' % VAR_212.render)\n",
"return VAR_472(VAR_212)\n"
] | [
"def custom_render(page):...\n",
"if page.render:\n",
"if page.render in self.settings.render.keys():\n",
"my_render = self.markmin_render\n",
"my_render = self.settings.render[page.render]\n",
"my_render = getattr(self, '%s_render' % page.render)\n",
"return my_render(page)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_33(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return json.dumps(cherry.config['media.playable'])\n"
] | [
"def api_getplayables(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return json.dumps(cherry.config['media.playable'])\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_2(VAR_2, VAR_3, VAR_4, **VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = {}\n",
"VAR_14 = {Change.ACTION_NEW: 'new', Change.ACTION_APPROVE: 'approve'}\n",
"VAR_11 = Change.objects.content().filter(unit__isnull=False)\n",
"if VAR_2:\n",
"VAR_11 = VAR_11.filter(author=user)\n",
"VAR_11 = V... | [
"def generate_counts(user, start_date, end_date, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"result = {}\n",
"action_map = {Change.ACTION_NEW: 'new', Change.ACTION_APPROVE: 'approve'}\n",
"base = Change.objects.content().filter(unit__isnull=False)\n",
"if user:\n",
"base = base.filter(author=user)\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
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"AugAssign'",
"AugAssign'",
"AugAs... |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_138 = datetime.timedelta(0)\n",
"for val in self.followup_set.all():\n",
"if val.time_spent:\n",
"return VAR_138\n",
"VAR_138 = VAR_138 + val.time_spent\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"total = datetime.timedelta(0)\n",
"for val in self.followup_set.all():\n",
"if val.time_spent:\n",
"return total\n",
"total = total + val.time_spent\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_75(VAR_79, VAR_130=False, VAR_131=True):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_79 = CLASS_0(VAR_79)\n",
"if not VAR_79.doctype_or_field:\n",
"VAR_79.doctype_or_field = 'DocField'\n",
"if not VAR_79.doctype:\n",
"if not VAR_79.property_type:\n",
"VAR_211 = VAR_12.sql_list(\n 'select disti... | [
"def make_property_setter(args, ignore_validate=False,...\n",
"\"\"\"docstring\"\"\"\n",
"args = _dict(args)\n",
"if not args.doctype_or_field:\n",
"args.doctype_or_field = 'DocField'\n",
"if not args.doctype:\n",
"if not args.property_type:\n",
"doctype_list = db.sql_list(\n 'select distinct paren... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_20(self):...\n",
"return [os.path.join(d, 'custom') for d in (self.config_dir, os.path.join(\n get_ipython_dir(), 'profile_default', 'static'), DEFAULT_STATIC_FILES_PATH)\n ]\n"
] | [
"def _static_custom_path_default(self):...\n",
"return [os.path.join(d, 'custom') for d in (self.config_dir, os.path.join(\n get_ipython_dir(), 'profile_default', 'static'), DEFAULT_STATIC_FILES_PATH)\n ]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"super(CLASS_0, self).setUp()\n",
"if platform.system() == 'Windows':\n",
"self.skipTest('Skipping failing tests on Windows.')\n"
] | [
"def setUp(self):...\n",
"super(SavedModelCLITestCase, self).setUp()\n",
"if platform.system() == 'Windows':\n",
"self.skipTest('Skipping failing tests on Windows.')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"For",
"Expr'"
] |
[
"def FUNC_24(self):...\n",
"VAR_5, VAR_15 = self._test_confirm_start()\n",
"VAR_3 = self.client.post(VAR_15, {'new_password1': 'anewpassword',\n 'new_password2': 'anewpassword'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, '/reset/done/')\n"
] | [
"def test_confirm_redirect_default(self):...\n",
"url, path = self._test_confirm_start()\n",
"response = self.client.post(path, {'new_password1': 'anewpassword',\n 'new_password2': 'anewpassword'})\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, '/reset/done/')\n"
... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_13(VAR_20):...\n",
"if VAR_8.interface.analytics_enabled:\n",
"requests.post(VAR_4, VAR_64={'ip_address': IP_ADDRESS, 'feature': feature},\n timeout=3)\n"
] | [
"def log_feature_analytics(feature):...\n",
"if app.interface.analytics_enabled:\n",
"requests.post(GRADIO_FEATURE_ANALYTICS_URL, data={'ip_address': IP_ADDRESS,\n 'feature': feature}, timeout=3)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'"
] |
[
"def FUNC_8(VAR_12):...\n",
""
] | [
"def migrate_guest_password(engine):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_27():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = FUNC_5(request.vars.app)\n",
"VAR_56 = apath(VAR_3, VAR_122=request)\n",
"VAR_57 = {'theme': 'web2py', 'editor': 'default', 'closetag': 'true',\n 'codefolding': 'false', 'tabwidth': '4', 'indentwithtabs': 'false',\n 'linenumbers': 'true', 'hig... | [
"def edit():...\n",
"\"\"\"docstring\"\"\"\n",
"app = get_app(request.vars.app)\n",
"app_path = apath(app, r=request)\n",
"preferences = {'theme': 'web2py', 'editor': 'default', 'closetag': 'true',\n 'codefolding': 'false', 'tabwidth': '4', 'indentwithtabs': 'false',\n 'linenumbers': 'true', 'highligh... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"AugAssign'",
"Return'",
"Assign'",
"Co... |
[
"def FUNC_0(VAR_5):...\n",
"VAR_3 = VAR_5.indexdir\n",
"VAR_4 = VAR_5.dataroot\n"
] | [
"def init(config):...\n",
"INDEXDIR = config.indexdir\n",
"DATAROOT = config.dataroot\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_26(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_52 = self.meta.get_set_only_once_fields()\n",
"if VAR_52 and self._doc_before_save:\n",
"for field in VAR_52:\n",
"return False\n",
"VAR_97 = False\n",
"VAR_26 = self.get(field.fieldname)\n",
"VAR_53 = self._doc_before_save.get(field.fieldna... | [
"def validate_set_only_once(self):...\n",
"\"\"\"docstring\"\"\"\n",
"set_only_once_fields = self.meta.get_set_only_once_fields()\n",
"if set_only_once_fields and self._doc_before_save:\n",
"for field in set_only_once_fields:\n",
"return False\n",
"fail = False\n",
"value = self.get(field.fieldname)\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"For",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_17(self):...\n",
"self.reactor.advance(1000000000000)\n",
"VAR_5 = self.helper.create_room_as(self.user_id)\n",
"self.helper.join(VAR_5, '@test2:server')\n",
"self.get_success(self.presence_handler.set_state(UserID.from_string(\n '@test2:server'), {'presence': PresenceState.ONLINE}))\n",
"sel... | [
"def test_remote_joins(self):...\n",
"self.reactor.advance(1000000000000)\n",
"room_id = self.helper.create_room_as(self.user_id)\n",
"self.helper.join(room_id, '@test2:server')\n",
"self.get_success(self.presence_handler.set_state(UserID.from_string(\n '@test2:server'), {'presence': PresenceState.ONLINE... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_1, **VAR_3):...\n",
"self.enable_registration = strtobool(str(VAR_1.get('enable_registration', \n False)))\n",
"if 'disable_registration' in VAR_1:\n",
"self.enable_registration = not strtobool(str(VAR_1['disable_registration']))\n",
"self.account_validity = CLASS_0(VAR_1.get('accou... | [
"def read_config(self, config, **kwargs):...\n",
"self.enable_registration = strtobool(str(config.get('enable_registration', \n False)))\n",
"if 'disable_registration' in config:\n",
"self.enable_registration = not strtobool(str(config['disable_registration']))\n",
"self.account_validity = AccountValidit... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",... |
[
"def FUNC_1(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = Mock(spec=['put_json'])\n",
"VAR_6.put_json.return_value = make_awaitable({})\n",
"self.make_worker_hs('synapse.app.federation_sender', {'send_federation': \n True}, http_client=mock_client)\n",
"VAR_2 = self.register_user('user', 'pass')\n"... | [
"def test_send_event_single_sender(self):...\n",
"\"\"\"docstring\"\"\"\n",
"mock_client = Mock(spec=['put_json'])\n",
"mock_client.put_json.return_value = make_awaitable({})\n",
"self.make_worker_hs('synapse.app.federation_sender', {'send_federation': \n True}, http_client=mock_client)\n",
"user = sel... | [
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@require_POST...\n",
"VAR_5 = get_object_or_404(TopicNotification, VAR_2=pk, user=request.user)\n",
"VAR_4 = NotificationForm(data=request.POST, instance=notification)\n",
"if VAR_4.is_valid():\n",
"VAR_4.save()\n",
"messages.error(VAR_0, utils.render_form_errors(VAR_4))\n",
"return redirect(VAR_0.POST... | [
"@require_POST...\n",
"notification = get_object_or_404(TopicNotification, pk=pk, user=request.user)\n",
"form = NotificationForm(data=request.POST, instance=notification)\n",
"if form.is_valid():\n",
"form.save()\n",
"messages.error(request, utils.render_form_errors(form))\n",
"return redirect(request.... | [
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"@TimeIt(logging.INFO)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = VAR_2.session['connector'].server_id\n",
"VAR_136 = FUNC_35(VAR_2)\n",
"VAR_54 = []\n",
"VAR_1.debug('searchObjects(%s)' % VAR_136['search'])\n",
"def FUNC_65(VAR_6):...\n",
"return reverse('webgateway_render_thumbnail', VAR_116=(iid,)... | [
"@TimeIt(logging.INFO)...\n",
"\"\"\"docstring\"\"\"\n",
"server_id = request.session['connector'].server_id\n",
"opts = searchOptFromRequest(request)\n",
"rv = []\n",
"logger.debug('searchObjects(%s)' % opts['search'])\n",
"def urlprefix(iid):...\n",
"return reverse('webgateway_render_thumbnail', arg... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Return'"
] |
[
"@VAR_0.filter...\n",
"if VAR_17 is None:\n",
"return ''\n",
"return '%s' % VAR_17\n"
] | [
"@register.filter...\n",
"if value is None:\n",
"return ''\n",
"return '%s' % value\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_11(VAR_51):...\n",
"self.reactor.callLater(_EPSILON, VAR_51)\n"
] | [
"def schedule(x):...\n",
"self.reactor.callLater(_EPSILON, x)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_15(VAR_41):...\n",
"VAR_2, VAR_6 = VAR_41\n",
"VAR_31 = await self.get_server_verify_key_v2_direct(VAR_2, VAR_6)\n",
"VAR_0.warning('Error looking up keys %s from %s: %s', VAR_6, VAR_2, e)\n",
"VAR_26[VAR_2] = VAR_31\n",
"VAR_0.exception('Error getting keys %s from %s', VAR_6, VAR_2)\n"
] | [
"async def get_key(key_to_fetch_item):...\n",
"server_name, key_ids = key_to_fetch_item\n",
"keys = await self.get_server_verify_key_v2_direct(server_name, key_ids)\n",
"logger.warning('Error looking up keys %s from %s: %s', key_ids, server_name, e)\n",
"results[server_name] = keys\n",
"logger.exception('... | [
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_28(VAR_5):...\n",
""
] | [
"def mock_smart_urlquote(url):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12 = self.helper.create_room_as(self.test_user, tok=self.test_user_tok)\n",
"self.get_success(self.handler.create_association(create_requester(self.\n admin_user), self.room_alias, VAR_12))\n"
] | [
"def test_create_alias_admin(self):...\n",
"\"\"\"docstring\"\"\"\n",
"other_room_id = self.helper.create_room_as(self.test_user, tok=self.\n test_user_tok)\n",
"self.get_success(self.handler.create_association(create_requester(self.\n admin_user), self.room_alias, other_room_id))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_21(self) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return self.should_retrain_core() or self.nlg\n"
] | [
"def should_retrain_nlg(self) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return self.should_retrain_core() or self.nlg\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_95(*VAR_79, **VAR_42):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils.background_jobs\n",
"return frappe.utils.background_jobs.enqueue(*VAR_79, **kwargs)\n"
] | [
"def enqueue(*args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils.background_jobs\n",
"return frappe.utils.background_jobs.enqueue(*args, **kwargs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Return'"
] |
[
"def FUNC_19(VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_20.inputs and not VAR_20.input_exprs and not VAR_20.input_examples:\n",
"VAR_42 = FUNC_17(VAR_20.inputs, VAR_20.input_exprs, VAR_20.input_examples)\n",
"FUNC_12(VAR_20.dir, VAR_20.tag_set, VAR_20.signature_def, VAR_42, VAR_20.\n outdir, ... | [
"def run(args):...\n",
"\"\"\"docstring\"\"\"\n",
"if not args.inputs and not args.input_exprs and not args.input_examples:\n",
"tensor_key_feed_dict = load_inputs_from_input_arg_string(args.inputs, args.\n input_exprs, args.input_examples)\n",
"run_saved_model_with_feed_dict(args.dir, args.tag_set, args... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_34(VAR_9, VAR_14, VAR_31):...\n",
"VAR_83 = {}\n",
"VAR_85 = read_po(FUNC_47, VAR_14=locale, VAR_31=domain)\n",
"for message in VAR_85:\n",
"VAR_141 = message.id\n",
"return VAR_83, VAR_85.plural_expr\n",
"if isinstance(VAR_141, (list, tuple)):\n",
"VAR_141 = VAR_141[0]\n",
"if message.str... | [
"def messages_from_po(path, locale, domain):...\n",
"messages = {}\n",
"catalog = read_po(f, locale=locale, domain=domain)\n",
"for message in catalog:\n",
"message_id = message.id\n",
"return messages, catalog.plural_expr\n",
"if isinstance(message_id, (list, tuple)):\n",
"message_id = message_id[0]\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_83(self, VAR_37, VAR_96):...\n",
"if self.settings.logger:\n",
"self.settings.logger.log_event(VAR_37, VAR_96, origin='crud')\n"
] | [
"def log_event(self, message, vars):...\n",
"if self.settings.logger:\n",
"self.settings.logger.log_event(message, vars, origin='crud')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_139 = 'false'\n",
"VAR_53 = VAR_2.GET\n",
"if VAR_8 is None:\n",
"VAR_92 = None\n",
"VAR_92 = VAR_8.getObject('Image', VAR_6)\n",
"if VAR_92 is not None:\n",
"VAR_115 = []\n",
"if VAR_53.get('callback', None):\n",
"for VAR_132 in VAR_92.g... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"json_data = 'false'\n",
"r = request.GET\n",
"if conn is None:\n",
"img = None\n",
"img = conn.getObject('Image', iid)\n",
"if img is not None:\n",
"imgs = []\n",
"if r.get('callback', None):\n",
"for ds in img.getProject().listChildren():\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"For",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Retur... |
[
"@property...\n",
"VAR_38 = self.ip if self.ip else 'localhost'\n",
"return self._url(VAR_38)\n"
] | [
"@property...\n",
"ip = self.ip if self.ip else 'localhost'\n",
"return self._url(ip)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def __getattr__(self, VAR_46):...\n",
"VAR_205 = self.get(VAR_46)\n",
"if not VAR_205 and VAR_46.startswith('__'):\n",
"return VAR_205\n"
] | [
"def __getattr__(self, key):...\n",
"ret = self.get(key)\n",
"if not ret and key.startswith('__'):\n",
"return ret\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'"
] |
[
"from __future__ import unicode_literals\n",
"import unittest\n",
"from django.template import Context, Template\n",
"from django.test import TestCase\n",
"from rest_framework.compat import coreapi, coreschema\n",
"from rest_framework.relations import Hyperlink\n",
"from rest_framework.templatetags impo... | [
"from __future__ import unicode_literals\n",
"import unittest\n",
"from django.template import Context, Template\n",
"from django.test import TestCase\n",
"from rest_framework.compat import coreapi, coreschema\n",
"from rest_framework.relations import Hyperlink\n",
"from rest_framework.templatetags impo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_20(self, VAR_0):...\n",
"from openapi_python_client import Project\n",
"VAR_8 = Project(VAR_3=mocker.MagicMock(title='My Test API'))\n",
"VAR_8.package_dir = VAR_0.MagicMock()\n",
"VAR_17 = VAR_0.MagicMock()\n",
"VAR_8.env = VAR_0.MagicMock()\n",
"VAR_8.env.get_template.return_value = VAR_17\n... | [
"def test__create_package(self, mocker):...\n",
"from openapi_python_client import Project\n",
"project = Project(openapi=mocker.MagicMock(title='My Test API'))\n",
"project.package_dir = mocker.MagicMock()\n",
"package_init_template = mocker.MagicMock()\n",
"project.env = mocker.MagicMock()\n",
"projec... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(VAR_35, VAR_36=''):...\n",
"return VAR_35\n"
] | [
"def deserialize_component(ui_value, widget_id=''):...\n",
"return ui_value\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.