lines
sequencelengths
1
383
raw_lines
sequencelengths
1
383
label
sequencelengths
1
383
type
sequencelengths
1
383
[ "\"\"\"string\"\"\"\n", "import os\n", "import json\n", "import cherrypy\n", "import codecs\n", "import sys\n", "from urllib.parse import unquote\n", "from backport.urllib.parse import unquote\n", "from urllib import parse\n", "from backport.urllib import parse\n", "import audiotranscode\n", "from tinytag import TinyTag\n", "from cherrymusicserver import userdb\n", "from cherrymusicserver import log\n", "from cherrymusicserver import albumartfetcher\n", "from cherrymusicserver import service\n", "from cherrymusicserver.pathprovider import readRes\n", "from cherrymusicserver.pathprovider import albumArtFilePath\n", "import cherrymusicserver as cherry\n", "import cherrymusicserver.metainfo as metainfo\n", "from cherrymusicserver.util import Performance, MemoryZipFile\n", "from cherrymusicserver.ext import zipstream\n", "import time\n", "VAR_0 = True\n", "def __init__(self, VAR_1):...\n", "self.config = VAR_1\n", "VAR_42 = 'res/dist/main.html'\n", "VAR_43 = 'res/login.html'\n", "VAR_44 = 'res/firstrun.html'\n", "self.mainpage = readRes(VAR_42)\n", "self.loginpage = readRes(VAR_43)\n", "self.firstrunpage = readRes(VAR_44)\n", "self.handlers = {'search': self.api_search, 'rememberplaylist': self.\n api_rememberplaylist, 'saveplaylist': self.api_saveplaylist,\n 'loadplaylist': self.api_loadplaylist, 'generaterandomplaylist': self.\n api_generaterandomplaylist, 'deleteplaylist': self.api_deleteplaylist,\n 'getmotd': self.api_getmotd, 'restoreplaylist': self.\n api_restoreplaylist, 'getplayables': self.api_getplayables,\n 'getuserlist': self.api_getuserlist, 'adduser': self.api_adduser,\n 'userdelete': self.api_userdelete, 'userchangepassword': self.\n api_userchangepassword, 'showplaylists': self.api_showplaylists,\n 'logout': self.api_logout, 'downloadpls': self.api_downloadpls,\n 'downloadm3u': self.api_downloadm3u, 'getsonginfo': self.\n api_getsonginfo, 'getencoders': self.api_getencoders, 'getdecoders':\n self.api_getdecoders, 'transcodingenabled': self.api_transcodingenabled,\n 'updatedb': self.api_updatedb, 'getconfiguration': self.\n api_getconfiguration, 'compactlistdir': self.api_compactlistdir,\n 'listdir': self.api_listdir, 'fetchalbumart': self.api_fetchalbumart,\n 'fetchalbumarturls': self.api_fetchalbumarturls, 'albumart_set': self.\n api_albumart_set, 'heartbeat': self.api_heartbeat, 'getuseroptions':\n self.api_getuseroptions, 'setuseroption': self.api_setuseroption,\n 'changeplaylist': self.api_changeplaylist, 'downloadcheck': self.\n api_downloadcheck, 'setuseroptionfor': self.api_setuseroptionfor}\n", "def FUNC_1(self, VAR_2):...\n", "return parse.urlparse(VAR_2).scheme == 'https'\n" ]
[ "\"\"\"This class provides the api to talk to the client.\nIt will then call the cherrymodel, to get the\nrequested information\"\"\"\n", "import os\n", "import json\n", "import cherrypy\n", "import codecs\n", "import sys\n", "from urllib.parse import unquote\n", "from backport.urllib.parse import unquote\n", "from urllib import parse\n", "from backport.urllib import parse\n", "import audiotranscode\n", "from tinytag import TinyTag\n", "from cherrymusicserver import userdb\n", "from cherrymusicserver import log\n", "from cherrymusicserver import albumartfetcher\n", "from cherrymusicserver import service\n", "from cherrymusicserver.pathprovider import readRes\n", "from cherrymusicserver.pathprovider import albumArtFilePath\n", "import cherrymusicserver as cherry\n", "import cherrymusicserver.metainfo as metainfo\n", "from cherrymusicserver.util import Performance, MemoryZipFile\n", "from cherrymusicserver.ext import zipstream\n", "import time\n", "debug = True\n", "def __init__(self, config):...\n", "self.config = config\n", "template_main = 'res/dist/main.html'\n", "template_login = 'res/login.html'\n", "template_firstrun = 'res/firstrun.html'\n", "self.mainpage = readRes(template_main)\n", "self.loginpage = readRes(template_login)\n", "self.firstrunpage = readRes(template_firstrun)\n", "self.handlers = {'search': self.api_search, 'rememberplaylist': self.\n api_rememberplaylist, 'saveplaylist': self.api_saveplaylist,\n 'loadplaylist': self.api_loadplaylist, 'generaterandomplaylist': self.\n api_generaterandomplaylist, 'deleteplaylist': self.api_deleteplaylist,\n 'getmotd': self.api_getmotd, 'restoreplaylist': self.\n api_restoreplaylist, 'getplayables': self.api_getplayables,\n 'getuserlist': self.api_getuserlist, 'adduser': self.api_adduser,\n 'userdelete': self.api_userdelete, 'userchangepassword': self.\n api_userchangepassword, 'showplaylists': self.api_showplaylists,\n 'logout': self.api_logout, 'downloadpls': self.api_downloadpls,\n 'downloadm3u': self.api_downloadm3u, 'getsonginfo': self.\n api_getsonginfo, 'getencoders': self.api_getencoders, 'getdecoders':\n self.api_getdecoders, 'transcodingenabled': self.api_transcodingenabled,\n 'updatedb': self.api_updatedb, 'getconfiguration': self.\n api_getconfiguration, 'compactlistdir': self.api_compactlistdir,\n 'listdir': self.api_listdir, 'fetchalbumart': self.api_fetchalbumart,\n 'fetchalbumarturls': self.api_fetchalbumarturls, 'albumart_set': self.\n api_albumart_set, 'heartbeat': self.api_heartbeat, 'getuseroptions':\n self.api_getuseroptions, 'setuseroption': self.api_setuseroption,\n 'changeplaylist': self.api_changeplaylist, 'downloadcheck': self.\n api_downloadcheck, 'setuseroptionfor': self.api_setuseroptionfor}\n", "def issecure(self, url):...\n", "return parse.urlparse(url).scheme == 'https'\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 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_23(self):...\n", "VAR_78 = self.cleaned_data.get('repo')\n", "if not VAR_78 or not is_repo_link(VAR_78) or '/' not in VAR_78[10:]:\n", "return VAR_78\n", "VAR_58, VAR_9 = VAR_78[10:].split('/', 1)\n", "VAR_55 = Component.objects.get(slug__iexact=component,\n project__slug__iexact=project)\n", "return VAR_78\n", "if not self.request.user.has_perm('component.edit', VAR_55):\n", "return VAR_78\n" ]
[ "def clean_repo(self):...\n", "repo = self.cleaned_data.get('repo')\n", "if not repo or not is_repo_link(repo) or '/' not in repo[10:]:\n", "return repo\n", "project, component = repo[10:].split('/', 1)\n", "obj = Component.objects.get(slug__iexact=component, project__slug__iexact=\n project)\n", "return repo\n", "if not self.request.user.has_perm('component.edit', obj):\n", "return repo\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Return'", "Condition", "Return'" ]
[ "@FUNC_0...\n", "return E2eKeysHandler(self)\n" ]
[ "@cache_in_self...\n", "return E2eKeysHandler(self)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_55():...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = FUNC_5()\n", "if not VAR_19:\n", "session.flash = VAR_117\n", "VAR_26 = SQLFORM.factory(Field('changelog', requires=IS_NOT_EMPTY()))\n", "redirect(URL('site'))\n", "VAR_26.element('input[type=submit]')['_value'] = T('Push')\n", "VAR_26.add_button(T('Cancel'), URL('site'))\n", "VAR_26.process()\n", "if VAR_26.accepted:\n", "return dict(VAR_3=app, VAR_26=form)\n", "VAR_195 = git.Repo(os.path.join(apath(VAR_122=request), VAR_3))\n", "session.flash = T(\n 'Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.'\n )\n", "VAR_197 = VAR_195.index\n", "redirect(URL('site'))\n", "VAR_197.add([apath(VAR_122=request) + VAR_3 + '/*'])\n", "VAR_198 = VAR_197.commit(VAR_26.vars.changelog)\n", "VAR_196 = VAR_195.remotes.origin\n", "VAR_196.push()\n", "session.flash = T('Git repo updated with latest application changes.')\n", "redirect(URL('site'))\n" ]
[ "def git_push():...\n", "\"\"\"docstring\"\"\"\n", "app = get_app()\n", "if not have_git:\n", "session.flash = GIT_MISSING\n", "form = SQLFORM.factory(Field('changelog', requires=IS_NOT_EMPTY()))\n", "redirect(URL('site'))\n", "form.element('input[type=submit]')['_value'] = T('Push')\n", "form.add_button(T('Cancel'), URL('site'))\n", "form.process()\n", "if form.accepted:\n", "return dict(app=app, form=form)\n", "repo = git.Repo(os.path.join(apath(r=request), app))\n", "session.flash = T(\n 'Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.'\n )\n", "index = repo.index\n", "redirect(URL('site'))\n", "index.add([apath(r=request) + app + '/*'])\n", "new_commit = index.commit(form.vars.changelog)\n", "origin = repo.remotes.origin\n", "origin.push()\n", "session.flash = T('Git repo updated with latest application changes.')\n", "redirect(URL('site'))\n" ]
[ 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'", "Assign'", "Expr'", "Expr'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_2: IReactorCore, VAR_3: Optional[...\n", "self._reactor = VAR_2\n", "self._tls_client_options_factory = VAR_3\n", "if VAR_11 is None:\n", "VAR_11 = SrvResolver()\n", "self._srv_resolver = VAR_11\n" ]
[ "def __init__(self, reactor: IReactorCore, tls_client_options_factory:...\n", "self._reactor = reactor\n", "self._tls_client_options_factory = tls_client_options_factory\n", "if srv_resolver is None:\n", "srv_resolver = SrvResolver()\n", "self._srv_resolver = srv_resolver\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_84(VAR_14):...\n", "for VAR_13 in VAR_43:\n", "VAR_104 = getattr(self.rules, VAR_13)\n", "return False\n", "VAR_44 = VAR_104.match(VAR_14)\n", "if not VAR_44:\n", "getattr(self, 'parse_%s' % VAR_13)(VAR_44)\n", "return VAR_44\n" ]
[ "def manipulate(text):...\n", "for key in rules:\n", "rule = getattr(self.rules, key)\n", "return False\n", "m = rule.match(text)\n", "if not m:\n", "getattr(self, 'parse_%s' % key)(m)\n", "return m\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Assign'", "Return'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_93(*VAR_79, **VAR_42):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.realtime\n", "return frappe.realtime.publish_realtime(*VAR_79, **kwargs)\n" ]
[ "def publish_realtime(*args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.realtime\n", "return frappe.realtime.publish_realtime(*args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Return'" ]
[ "def FUNC_7(self):...\n", "self.distribution.run_command('jsversion')\n", "VAR_60 = self.distribution.get_command_obj('jsdeps')\n", "VAR_61 = self.distribution.get_command_obj('js')\n", "VAR_62 = self.distribution.get_command_obj('css')\n", "VAR_60.force = VAR_61.force = VAR_18\n", "VAR_37 = [VAR_60.bower_dir]\n", "VAR_37.extend(VAR_61.targets)\n", "VAR_37.extend(VAR_62.targets)\n", "VAR_63 = [t for t in VAR_37 if not os.path.exists(t)]\n", "if not VAR_3 and not VAR_63:\n", "VAR_10.run(self)\n", "self.distribution.run_command('js')\n", "VAR_63 = [t for t in VAR_37 if not os.path.exists(t)]\n", "VAR_63 = [t for t in VAR_37 if not os.path.exists(t)]\n", "return\n", "self.distribution.run_command('css')\n", "if VAR_18 or VAR_63:\n", "if VAR_63:\n", "self.distribution.run_command('backendtranslations')\n", "VAR_67 = os.path.commonprefix([VAR_2 + os.sep] + VAR_63)\n", "log.warn('rebuilding js and css failed (not a problem)')\n", "VAR_67 = os.path.commonprefix([VAR_2 + os.sep] + VAR_63)\n", "VAR_10.run(self)\n", "VAR_63 = [m[len(VAR_67):] for m in VAR_63]\n", "log.warn(str(e))\n", "VAR_63 = [m[len(VAR_67):] for m in VAR_63]\n", "log.warn(\n 'rebuilding js and css failed. The following required files are missing: %s'\n % VAR_63)\n" ]
[ "def run(self):...\n", "self.distribution.run_command('jsversion')\n", "jsdeps = self.distribution.get_command_obj('jsdeps')\n", "js = self.distribution.get_command_obj('js')\n", "css = self.distribution.get_command_obj('css')\n", "jsdeps.force = js.force = strict\n", "targets = [jsdeps.bower_dir]\n", "targets.extend(js.targets)\n", "targets.extend(css.targets)\n", "missing = [t for t in targets if not os.path.exists(t)]\n", "if not is_repo and not missing:\n", "command.run(self)\n", "self.distribution.run_command('js')\n", "missing = [t for t in targets if not os.path.exists(t)]\n", "missing = [t for t in targets if not os.path.exists(t)]\n", "return\n", "self.distribution.run_command('css')\n", "if strict or missing:\n", "if missing:\n", "self.distribution.run_command('backendtranslations')\n", "prefix = os.path.commonprefix([repo_root + os.sep] + missing)\n", "log.warn('rebuilding js and css failed (not a problem)')\n", "prefix = os.path.commonprefix([repo_root + os.sep] + missing)\n", "command.run(self)\n", "missing = [m[len(prefix):] for m in missing]\n", "log.warn(str(e))\n", "missing = [m[len(prefix):] for m in missing]\n", "log.warn(\n 'rebuilding js and css failed. The following required files are missing: %s'\n % missing)\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 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Return'", "Expr'", "Condition", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "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_13(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_1.key_ids:\n", "return defer.fail(SynapseError(400, 'Not signed by %s' % (VAR_1.server_name\n ,), Codes.UNAUTHORIZED))\n", "VAR_0.debug('Verifying %s for %s with key_ids %s, min_validity %i', VAR_1.\n request_name, VAR_1.server_name, VAR_1.key_ids, VAR_1.\n minimum_valid_until_ts)\n", "VAR_24.append(VAR_1)\n", "return VAR_25(VAR_1)\n" ]
[ "def process(verify_request):...\n", "\"\"\"docstring\"\"\"\n", "if not verify_request.key_ids:\n", "return defer.fail(SynapseError(400, 'Not signed by %s' % (verify_request.\n server_name,), Codes.UNAUTHORIZED))\n", "logger.debug('Verifying %s for %s with key_ids %s, min_validity %i',\n verify_request.request_name, verify_request.server_name, verify_request\n .key_ids, verify_request.minimum_valid_until_ts)\n", "key_lookups.append(verify_request)\n", "return handle(verify_request)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Expr'", "Expr'", "Return'" ]
[ "@VAR_2.route('/ajax/table_settings', methods=['POST'])...\n", "VAR_87.view_settings['table'] = json.loads(request.data)\n", "VAR_3.error('Invalid request received: %r ', request)\n", "return ''\n", "flag_modified(VAR_87, 'view_settings')\n", "ub.session.commit()\n", "return 'Invalid request', 400\n" ]
[ "@web.route('/ajax/table_settings', methods=['POST'])...\n", "current_user.view_settings['table'] = json.loads(request.data)\n", "log.error('Invalid request received: %r ', request)\n", "return ''\n", "flag_modified(current_user, 'view_settings')\n", "ub.session.commit()\n", "return 'Invalid request', 400\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'", "Return'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_24(self):...\n", "self.client.logout()\n" ]
[ "def tearDown(self):...\n", "self.client.logout()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(self):...\n", "self.data = {'': lower(type(self).__name__)}\n" ]
[ "def encode(self):...\n", "self.data = {'': lower(type(self).__name__)}\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_41(*VAR_79, **VAR_42):...\n", "if VAR_79 and len(VAR_79) > 1 and isinstance(VAR_79[1], text_type):\n", "VAR_46 = FUNC_42(VAR_79[0], VAR_79[1])\n", "VAR_94 = FUNC_45(*VAR_79, **kwargs)\n", "VAR_94 = VAR_1.document_cache.get(VAR_46)\n", "return VAR_94\n", "if VAR_94:\n", "return VAR_94\n", "VAR_94 = FUNC_10().hget('document_cache', VAR_46)\n", "if VAR_94:\n", "VAR_94 = FUNC_45(VAR_94)\n", "VAR_1.document_cache[VAR_46] = VAR_94\n", "return VAR_94\n" ]
[ "def get_cached_doc(*args, **kwargs):...\n", "if args and len(args) > 1 and isinstance(args[1], text_type):\n", "key = get_document_cache_key(args[0], args[1])\n", "doc = get_doc(*args, **kwargs)\n", "doc = local.document_cache.get(key)\n", "return doc\n", "if doc:\n", "return doc\n", "doc = cache().hget('document_cache', key)\n", "if doc:\n", "doc = get_doc(doc)\n", "local.document_cache[key] = doc\n", "return doc\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_35, VAR_33):...\n", "self.lang = VAR_35\n", "self.nodelist = VAR_33\n" ]
[ "def __init__(self, lang, code):...\n", "self.lang = lang\n", "self.nodelist = code\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "\"\"\"Tests REST events for /rooms paths.\"\"\"\n", "from mock import Mock\n", "from twisted.internet import defer\n", "from synapse.rest.client.v1 import room\n", "from synapse.types import UserID\n", "from tests import unittest\n", "VAR_0 = '/_matrix/client/api/v1'\n", "\"\"\" Tests /rooms/$room_id/typing/$user_id REST API. \"\"\"\n", "VAR_1 = '@sid:red'\n", "VAR_2 = UserID.from_string(VAR_1)\n", "VAR_3 = [room.register_servlets]\n", "def FUNC_0(self, VAR_4, VAR_5):...\n", "VAR_6 = self.setup_test_homeserver('red', http_client=None,\n federation_client=Mock())\n", "self.event_source = VAR_6.get_event_sources().sources['typing']\n", "VAR_6.get_federation_handler = Mock()\n", "async def FUNC_5(VAR_7=None, VAR_8=False):...\n", "return {'user': UserID.from_string(self.auth_user_id), 'token_id': 1,\n 'is_guest': False}\n" ]
[ "\"\"\"Tests REST events for /rooms paths.\"\"\"\n", "from mock import Mock\n", "from twisted.internet import defer\n", "from synapse.rest.client.v1 import room\n", "from synapse.types import UserID\n", "from tests import unittest\n", "PATH_PREFIX = '/_matrix/client/api/v1'\n", "\"\"\" Tests /rooms/$room_id/typing/$user_id REST API. \"\"\"\n", "user_id = '@sid:red'\n", "user = UserID.from_string(user_id)\n", "servlets = [room.register_servlets]\n", "def make_homeserver(self, reactor, clock):...\n", "hs = self.setup_test_homeserver('red', http_client=None, federation_client=\n Mock())\n", "self.event_source = hs.get_event_sources().sources['typing']\n", "hs.get_federation_handler = Mock()\n", "async def get_user_by_access_token(token=None, allow_guest=False):...\n", "return {'user': UserID.from_string(self.auth_user_id), 'token_id': 1,\n 'is_guest': False}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "AsyncFunctionDef'", "Return'" ]
[ "def FUNC_44(self):...\n", "VAR_87 = VAR_1.query(CLASS_1).filter(CLASS_1.role.op('&')(constants.\n ROLE_ANONYMOUS) == constants.ROLE_ANONYMOUS).first()\n", "self.name = VAR_87.name\n", "self.role = VAR_87.role\n", "self.id = VAR_87.id\n", "self.sidebar_view = VAR_87.sidebar_view\n", "self.default_language = VAR_87.default_language\n", "self.locale = VAR_87.locale\n", "self.kindle_mail = VAR_87.kindle_mail\n", "self.denied_tags = VAR_87.denied_tags\n", "self.allowed_tags = VAR_87.allowed_tags\n", "self.denied_column_value = VAR_87.denied_column_value\n", "self.allowed_column_value = VAR_87.allowed_column_value\n", "self.view_settings = VAR_87.view_settings\n", "self.kobo_only_shelves_sync = VAR_87.kobo_only_shelves_sync\n" ]
[ "def loadSettings(self):...\n", "data = session.query(User).filter(User.role.op('&')(constants.\n ROLE_ANONYMOUS) == constants.ROLE_ANONYMOUS).first()\n", "self.name = data.name\n", "self.role = data.role\n", "self.id = data.id\n", "self.sidebar_view = data.sidebar_view\n", "self.default_language = data.default_language\n", "self.locale = data.locale\n", "self.kindle_mail = data.kindle_mail\n", "self.denied_tags = data.denied_tags\n", "self.allowed_tags = data.allowed_tags\n", "self.denied_column_value = data.denied_column_value\n", "self.allowed_column_value = data.allowed_column_value\n", "self.view_settings = data.view_settings\n", "self.kobo_only_shelves_sync = data.kobo_only_shelves_sync\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_10(self):...\n", "\"\"\"docstring\"\"\"\n", "if 'checksum' not in self.cleaned_data:\n", "return\n", "VAR_27 = self.unit_set\n", "self.cleaned_data['unit'] = VAR_27.filter(id_hash=self.cleaned_data['checksum']\n )[0]\n" ]
[ "def clean_checksum(self):...\n", "\"\"\"docstring\"\"\"\n", "if 'checksum' not in self.cleaned_data:\n", "return\n", "unit_set = self.unit_set\n", "self.cleaned_data['unit'] = unit_set.filter(id_hash=self.cleaned_data[\n 'checksum'])[0]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_13(self):...\n", "if self.report_type == 'Script Report':\n", "make_boilerplate('controller.py', self, {'name': self.name})\n", "make_boilerplate('controller.js', self, {'name': self.name})\n" ]
[ "def create_report_py(self):...\n", "if self.report_type == 'Script Report':\n", "make_boilerplate('controller.py', self, {'name': self.name})\n", "make_boilerplate('controller.js', self, {'name': self.name})\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_2(*, VAR_0: Client, VAR_5: AModel) ->Union[None, HTTPValidationError]:...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = '{}/tests/json_body'.format(VAR_0.base_url)\n", "VAR_12: Dict[str, Any] = VAR_0.get_headers()\n", "VAR_9 = VAR_5.to_dict()\n", "VAR_8 = httpx.post(VAR_6=url, VAR_12=headers, json=json_json_body)\n", "if VAR_8.status_code == 200:\n", "return None\n", "if VAR_8.status_code == 422:\n", "return HTTPValidationError.from_dict(cast(Dict[str, Any], VAR_8.json()))\n" ]
[ "def json_body_tests_json_body_post(*, client: Client, json_body: AModel...\n", "\"\"\"docstring\"\"\"\n", "url = '{}/tests/json_body'.format(client.base_url)\n", "headers: Dict[str, Any] = client.get_headers()\n", "json_json_body = json_body.to_dict()\n", "response = httpx.post(url=url, headers=headers, json=json_json_body)\n", "if response.status_code == 200:\n", "return None\n", "if response.status_code == 422:\n", "return HTTPValidationError.from_dict(cast(Dict[str, Any], response.json()))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "AnnAssign'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Return'" ]
[ "def FUNC_16(VAR_3, VAR_4, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = FUNC_0(VAR_4.config) + ['--basedir', str(VAR_3)]\n", "VAR_6.start(VAR_11)\n", "VAR_6.open_path('qute://settings/set?option=search.ignore_case&value=always')\n", "assert VAR_6.get_setting('search.ignore_case') == 'always'\n", "VAR_6.send_cmd(':quit')\n", "VAR_6.wait_for_quit()\n", "VAR_6.start(VAR_11)\n", "assert VAR_6.get_setting('search.ignore_case') == 'always'\n" ]
[ "def test_qute_settings_persistence(short_tmpdir, request, quteproc_new):...\n", "\"\"\"docstring\"\"\"\n", "args = _base_args(request.config) + ['--basedir', str(short_tmpdir)]\n", "quteproc_new.start(args)\n", "quteproc_new.open_path(\n 'qute://settings/set?option=search.ignore_case&value=always')\n", "assert quteproc_new.get_setting('search.ignore_case') == 'always'\n", "quteproc_new.send_cmd(':quit')\n", "quteproc_new.wait_for_quit()\n", "quteproc_new.start(args)\n", "assert quteproc_new.get_setting('search.ignore_case') == 'always'\n" ]
[ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Assert'", "Expr'", "Expr'", "Expr'", "Assert'" ]
[ "def FUNC_42():...\n", "VAR_129 = make_response(render_template('index.jinja2', **render_kwargs))\n", "if VAR_107:\n", "VAR_129 = util.flask.add_non_caching_response_headers(VAR_129)\n", "return VAR_129\n" ]
[ "def make_default_ui():...\n", "r = make_response(render_template('index.jinja2', **render_kwargs))\n", "if wizard:\n", "r = util.flask.add_non_caching_response_headers(r)\n", "return r\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_17(self):...\n", "VAR_15 = self._makeOne()\n", "VAR_16 = CLASS_1()\n", "VAR_17 = CLASS_0(RESPONSE=response)\n", "VAR_26 = 'NjE2NDZkNjk2ZTo3MDZjNmY2ZTY1MzQ3NQ%3D%3D'[:-1]\n", "VAR_17.set(VAR_15.cookie_name, VAR_26)\n", "self.assertEqual(VAR_15.extractCredentials(VAR_17), {})\n" ]
[ "def test_extractCredentials_from_cookie_with_bad_binascii(self):...\n", "helper = self._makeOne()\n", "response = FauxCookieResponse()\n", "request = FauxSettableRequest(RESPONSE=response)\n", "cookie_val = 'NjE2NDZkNjk2ZTo3MDZjNmY2ZTY1MzQ3NQ%3D%3D'[:-1]\n", "request.set(helper.cookie_name, cookie_val)\n", "self.assertEqual(helper.extractCredentials(request), {})\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_14(self):...\n", "def __init__(self):...\n", "self.called = False\n", "def FUNC_29(self):...\n", "self.called = True\n", "VAR_21 = CLASS_4()\n", "get_pagination_html(VAR_21)\n", "assert VAR_21.called is True\n" ]
[ "def test_get_pagination_html(self):...\n", "def __init__(self):...\n", "self.called = False\n", "def to_html(self):...\n", "self.called = True\n", "pager = MockPager()\n", "get_pagination_html(pager)\n", "assert pager.called is True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assert'" ]
[ "def FUNC_10(VAR_20):...\n", "return os.path.join(VAR_4, VAR_20)\n" ]
[ "def _get_obj_absolute_path(obj_path):...\n", "return os.path.join(DATAROOT, obj_path)\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_30(VAR_27):...\n", "print(VAR_26 + VAR_27)\n" ]
[ "def in_print(s):...\n", "print(indent_str + s)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_83(VAR_9, *VAR_2, **VAR_3):...\n", "VAR_164 = VAR_9.is_ajax() or VAR_9.META.get('HTTP_ACCEPT', '').startswith(\n 'application/json')\n", "return VAR_1(VAR_9, *VAR_2, **kwargs)\n", "VAR_74 = _('User does not exist.')\n", "return FUNC_83\n", "if VAR_164:\n", "return JsonResponse({'error': VAR_74}, 400)\n", "return HttpResponseBadRequest(VAR_74)\n" ]
[ "def common_exceptions_400(func):...\n", "\"\"\"docstring\"\"\"\n", "def wrapped(request, *args, **kwargs):...\n", "use_json = request.is_ajax() or request.META.get('HTTP_ACCEPT', '').startswith(\n 'application/json')\n", "return func(request, *args, **kwargs)\n", "message = _('User does not exist.')\n", "return wrapped\n", "if use_json:\n", "return JsonResponse({'error': message}, 400)\n", "return HttpResponseBadRequest(message)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Assign'", "Return'", "Assign'", "Return'", "Condition", "Return'", "Return'" ]
[ "async def FUNC_76(*VAR_20, **VAR_21):...\n", "return None\n" ]
[ "async def _insert_client_ip(*args, **kwargs):...\n", "return None\n" ]
[ 0, 0 ]
[ "AsyncFunctionDef'", "Return'" ]
[ "def __init__(self, VAR_12=True, **VAR_7):...\n", "if 'widget' not in VAR_7:\n", "VAR_7['widget'] = CLASS_1(VAR_12=datepicker)\n", "super().__init__(**kwargs)\n" ]
[ "def __init__(self, datepicker=True, **kwargs):...\n", "if 'widget' not in kwargs:\n", "kwargs['widget'] = WeblateDateInput(datepicker=datepicker)\n", "super().__init__(**kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_1(self, VAR_10):...\n", "self.appbuilder.sm.reset_password(g.user.id, VAR_10.password.data)\n", "flash(as_unicode(self.message), 'info')\n" ]
[ "def form_post(self, form):...\n", "self.appbuilder.sm.reset_password(g.user.id, form.password.data)\n", "flash(as_unicode(self.message), 'info')\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_11(self, VAR_11=None, VAR_17=None):...\n", "\"\"\"docstring\"\"\"\n", "if self.flags.in_print:\n", "return\n", "self.flags.notifications_executed = []\n", "if VAR_11 != None:\n", "self.flags.ignore_permissions = VAR_11\n", "self.flags.ignore_version = frappe.flags.in_test if VAR_17 is None else VAR_17\n", "if self.get('__islocal') or not self.get('name'):\n", "self.insert()\n", "self.check_permission('write', 'save')\n", "return\n", "self.set_user_and_timestamp()\n", "self.set_docstatus()\n", "self.check_if_latest()\n", "self.set_parent_in_children()\n", "self.set_name_in_children()\n", "self.validate_higher_perm_levels()\n", "self._validate_links()\n", "self.run_before_save_methods()\n", "if self._action != 'cancel':\n", "self._validate()\n", "if self._action == 'update_after_submit':\n", "self.validate_update_after_submit()\n", "self.set_docstatus()\n", "if self.meta.issingle:\n", "self.update_single(self.get_valid_dict())\n", "self.db_update()\n", "self.update_children()\n", "self.run_post_save_methods()\n", "if hasattr(self, '__unsaved'):\n", "delattr(self, '__unsaved')\n", "return self\n" ]
[ "def _save(self, ignore_permissions=None, ignore_version=None):...\n", "\"\"\"docstring\"\"\"\n", "if self.flags.in_print:\n", "return\n", "self.flags.notifications_executed = []\n", "if ignore_permissions != None:\n", "self.flags.ignore_permissions = ignore_permissions\n", "self.flags.ignore_version = (frappe.flags.in_test if ignore_version is None\n else ignore_version)\n", "if self.get('__islocal') or not self.get('name'):\n", "self.insert()\n", "self.check_permission('write', 'save')\n", "return\n", "self.set_user_and_timestamp()\n", "self.set_docstatus()\n", "self.check_if_latest()\n", "self.set_parent_in_children()\n", "self.set_name_in_children()\n", "self.validate_higher_perm_levels()\n", "self._validate_links()\n", "self.run_before_save_methods()\n", "if self._action != 'cancel':\n", "self._validate()\n", "if self._action == 'update_after_submit':\n", "self.validate_update_after_submit()\n", "self.set_docstatus()\n", "if self.meta.issingle:\n", "self.update_single(self.get_valid_dict())\n", "self.db_update()\n", "self.update_children()\n", "self.run_post_save_methods()\n", "if hasattr(self, '__unsaved'):\n", "delattr(self, '__unsaved')\n", "return self\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 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Return'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Return'" ]
[ "from django.utils import timezone\n", "from django.shortcuts import render, redirect, get_object_or_404\n", "from django.contrib import messages\n", "from django.utils.translation import gettext as _\n", "from spirit.core.utils.views import is_post\n", "from spirit.core.utils.decorators import moderator_required\n", "from spirit.comment.models import Comment\n", "from spirit.topic.models import Topic\n", "@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/moderate.html',\n context={'topic': topic})\n", "if VAR_7 and VAR_4 is not None:\n", "Comment.create_moderation_action(user=request.user, VAR_6=topic, VAR_4=action)\n", "if VAR_5 is not None:\n", "messages.info(VAR_0, VAR_5)\n", "return redirect(VAR_0.POST.get('next', VAR_6.get_absolute_url()))\n" ]
[ "from django.utils import timezone\n", "from django.shortcuts import render, redirect, get_object_or_404\n", "from django.contrib import messages\n", "from django.utils.translation import gettext as _\n", "from spirit.core.utils.views import is_post\n", "from spirit.core.utils.decorators import moderator_required\n", "from spirit.comment.models import Comment\n", "from spirit.topic.models import Topic\n", "@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/moderate.html',\n context={'topic': topic})\n", "if count and action is not None:\n", "Comment.create_moderation_action(user=request.user, topic=topic, action=action)\n", "if message is not None:\n", "messages.info(request, message)\n", "return redirect(request.POST.get('next', topic.get_absolute_url()))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "return 'components/{}'.format(VAR_17)\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "return 'components/{}'.format(file_id)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_40(self):...\n", "VAR_12 = 'hello'\n", "VAR_22, VAR_23 = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/join'.format(self.room_id), VAR_19={\n 'reason': reason}, VAR_16=self.second_tok)\n", "self.assertEqual(VAR_23.code, 200, VAR_23.result)\n", "self._check_for_reason(VAR_12)\n" ]
[ "def test_join_reason(self):...\n", "reason = 'hello'\n", "request, channel = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/join'.format(self.room_id), content={\n 'reason': reason}, access_token=self.second_tok)\n", "self.assertEqual(channel.code, 200, channel.result)\n", "self._check_for_reason(reason)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(VAR_7, VAR_9, VAR_13, VAR_14, VAR_15, VAR_16, VAR_4=-1):...\n", "if VAR_15 == 'divs':\n", "VAR_7[0].insert(VAR_4, DIV(DIV(LABEL(VAR_9), _class='w2p_fl'), DIV(VAR_13,\n _class='w2p_fw'), DIV(VAR_14, _class='w2p_fc'), VAR_16=_id))\n", "if VAR_15 == 'table2cols':\n", "VAR_7[0].insert(VAR_4, TR(TD(LABEL(VAR_9), _class='w2p_fl'), TD(VAR_14,\n _class='w2p_fc')))\n", "if VAR_15 == 'ul':\n", "VAR_7[0].insert(VAR_4 + 1, TR(TD(VAR_13, _class='w2p_fw'), _colspan=2,\n VAR_16=_id))\n", "VAR_7[0].insert(VAR_4, LI(DIV(LABEL(VAR_9), _class='w2p_fl'), DIV(VAR_13,\n _class='w2p_fw'), DIV(VAR_14, _class='w2p_fc'), VAR_16=_id))\n", "if VAR_15 == 'bootstrap':\n", "VAR_7[0].insert(VAR_4, DIV(LABEL(VAR_9, _class='control-label'), DIV(VAR_13,\n SPAN(VAR_14, _class='inline-help'), _class='controls'), _class=\n 'control-group', VAR_16=_id))\n", "if VAR_15 in ('bootstrap3_inline', 'bootstrap4_inline'):\n", "VAR_7[0].insert(VAR_4, DIV(LABEL(VAR_9, _class='control-label col-sm-3'),\n DIV(VAR_13, SPAN(VAR_14, _class='help-block'), _class='col-sm-9'),\n _class='form-group row', VAR_16=_id))\n", "if VAR_15 in ('bootstrap3_stacked', 'bootstrap4_stacked'):\n", "VAR_7[0].insert(VAR_4, DIV(LABEL(VAR_9, _class='control-label'), VAR_13,\n SPAN(VAR_14, _class='help-block'), _class='form-group row', VAR_16=_id))\n", "VAR_7[0].insert(VAR_4, TR(TD(LABEL(VAR_9), _class='w2p_fl'), TD(VAR_13,\n _class='w2p_fw'), TD(VAR_14, _class='w2p_fc'), VAR_16=_id))\n" ]
[ "def addrow(form, a, b, c, style, _id, position=-1):...\n", "if style == 'divs':\n", "form[0].insert(position, DIV(DIV(LABEL(a), _class='w2p_fl'), DIV(b, _class=\n 'w2p_fw'), DIV(c, _class='w2p_fc'), _id=_id))\n", "if style == 'table2cols':\n", "form[0].insert(position, TR(TD(LABEL(a), _class='w2p_fl'), TD(c, _class=\n 'w2p_fc')))\n", "if style == 'ul':\n", "form[0].insert(position + 1, TR(TD(b, _class='w2p_fw'), _colspan=2, _id=_id))\n", "form[0].insert(position, LI(DIV(LABEL(a), _class='w2p_fl'), DIV(b, _class=\n 'w2p_fw'), DIV(c, _class='w2p_fc'), _id=_id))\n", "if style == 'bootstrap':\n", "form[0].insert(position, DIV(LABEL(a, _class='control-label'), DIV(b, SPAN(\n c, _class='inline-help'), _class='controls'), _class='control-group',\n _id=_id))\n", "if style in ('bootstrap3_inline', 'bootstrap4_inline'):\n", "form[0].insert(position, DIV(LABEL(a, _class='control-label col-sm-3'), DIV\n (b, SPAN(c, _class='help-block'), _class='col-sm-9'), _class=\n 'form-group row', _id=_id))\n", "if style in ('bootstrap3_stacked', 'bootstrap4_stacked'):\n", "form[0].insert(position, DIV(LABEL(a, _class='control-label'), b, SPAN(c,\n _class='help-block'), _class='form-group row', _id=_id))\n", "form[0].insert(position, TR(TD(LABEL(a), _class='w2p_fl'), TD(b, _class=\n 'w2p_fw'), TD(c, _class='w2p_fc'), _id=_id))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "@VAR_5.route('/obj/start/<int:start>/span/<int:span>/<path:video>')...\n", "VAR_13 = str(FUNC_5(VAR_10))\n", "VAR_17 = FUNC_8(VAR_13, VAR_14=start, VAR_15=span)\n", "def FUNC_9():...\n", "while True:\n", "VAR_24 = VAR_17.stdout.read(4096)\n", "if not VAR_24:\n", "yield VAR_24\n", "VAR_16 = Headers([('Content-Type', 'video/mp4')])\n", "VAR_18 = Response(stream_with_context(FUNC_9()), status='200 OK', VAR_16=\n headers)\n", "VAR_19 = os.stat(VAR_13)\n", "VAR_20 = VAR_19.st_mtime\n", "VAR_21 = VAR_19.st_size\n", "VAR_22 = '{}_{}_{}_{}'.format(VAR_20, VAR_21, VAR_9, VAR_8)\n", "VAR_18.last_modified = VAR_20\n", "VAR_18.set_etag(VAR_22=etag)\n", "VAR_18.cache_control.public = True\n", "VAR_18.cache_control.max_age = datetime.timedelta(days=365).total_seconds()\n", "VAR_18.make_conditional(request)\n", "return VAR_18\n" ]
[ "@scope_blueprint.route('/obj/start/<int:start>/span/<int:span>/<path:video>')...\n", "video_path = str(_get_obj_absolute_path(video))\n", "proc = _create_ffmpeg_segment_proc(video_path, start_sec=start,\n duration_sec=span)\n", "def generate():...\n", "while True:\n", "data = proc.stdout.read(4096)\n", "if not data:\n", "yield data\n", "headers = Headers([('Content-Type', 'video/mp4')])\n", "response = Response(stream_with_context(generate()), status='200 OK',\n headers=headers)\n", "stat = os.stat(video_path)\n", "last_modified = stat.st_mtime\n", "size = stat.st_size\n", "etag = '{}_{}_{}_{}'.format(last_modified, size, start, span)\n", "response.last_modified = last_modified\n", "response.set_etag(etag=etag)\n", "response.cache_control.public = True\n", "response.cache_control.max_age = datetime.timedelta(days=365).total_seconds()\n", "response.make_conditional(request)\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "FunctionDef'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_4(VAR_1):...\n", "return FUNC_1(VAR_1, VAR_3=User.objects.filter(st__is_moderator=True,\n st__is_administrator=False), VAR_4='spirit/user/admin/mods.html')\n" ]
[ "def index_mods(request):...\n", "return _index(request, queryset=User.objects.filter(st__is_moderator=True,\n st__is_administrator=False), template='spirit/user/admin/mods.html')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@VAR_2.route('/formats')...\n", "if VAR_87.check_visibility(constants.SIDEBAR_FORMAT):\n", "if VAR_87.get_view_property('ratings', 'dir') == 'desc':\n", "abort(404)\n", "VAR_10 = db.Data.format.desc()\n", "VAR_10 = db.Data.format.asc()\n", "VAR_109 = 0\n", "VAR_109 = 1\n", "VAR_63 = calibre_db.session.query(db.Data, func.count('data.book').label(\n 'count'), db.Data.format.label('format')).join(db.Books).filter(calibre_db\n .common_filters()).group_by(db.Data.format).order_by(VAR_10).all()\n", "return render_title_template('list.html', VAR_63=entries, folder=\n 'web.books_list', VAR_107=list(), VAR_149=_(u'File formats list'),\n VAR_9='formatslist', VAR_8='formats', VAR_10=order_no)\n" ]
[ "@web.route('/formats')...\n", "if current_user.check_visibility(constants.SIDEBAR_FORMAT):\n", "if current_user.get_view_property('ratings', 'dir') == 'desc':\n", "abort(404)\n", "order = db.Data.format.desc()\n", "order = db.Data.format.asc()\n", "order_no = 0\n", "order_no = 1\n", "entries = calibre_db.session.query(db.Data, func.count('data.book').label(\n 'count'), db.Data.format.label('format')).join(db.Books).filter(calibre_db\n .common_filters()).group_by(db.Data.format).order_by(order).all()\n", "return render_title_template('list.html', entries=entries, folder=\n 'web.books_list', charlist=list(), title=_(u'File formats list'), page=\n 'formatslist', data='formats', order=order_no)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "For", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_27(VAR_87=False, VAR_88=False, VAR_89=None):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_89:\n", "VAR_89 = ['GET', 'POST', 'PUT', 'DELETE']\n", "def FUNC_115(VAR_129):...\n", "VAR_83.append(VAR_129)\n", "VAR_86[VAR_129] = VAR_89\n", "if VAR_87:\n", "VAR_84.append(VAR_129)\n", "return VAR_129\n", "if VAR_88:\n", "VAR_85.append(VAR_129)\n" ]
[ "def whitelist(allow_guest=False, xss_safe=False, methods=None):...\n", "\"\"\"docstring\"\"\"\n", "if not methods:\n", "methods = ['GET', 'POST', 'PUT', 'DELETE']\n", "def innerfn(fn):...\n", "whitelisted.append(fn)\n", "allowed_http_methods_for_whitelisted_func[fn] = methods\n", "if allow_guest:\n", "guest_methods.append(fn)\n", "return fn\n", "if xss_safe:\n", "xss_safe_methods.append(fn)\n" ]
[ 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Condition", "Expr'", "Return'", "Condition", "Expr'" ]
[ "def FUNC_42(self, VAR_25, *VAR_0, **VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "if 'flags' in VAR_1:\n", "if hasattr(self, VAR_25) and hasattr(getattr(self, VAR_25), '__call__'):\n", "VAR_72 = lambda self, *VAR_0, **VAR_1: getattr(self, VAR_25)(*VAR_0, **kwargs)\n", "VAR_72 = lambda self, *VAR_0, **VAR_1: None\n", "VAR_72.__name__ = str(VAR_25)\n", "VAR_66 = CLASS_0.hook(VAR_72)(self, *VAR_0, **kwargs)\n", "self.run_notifications(VAR_25)\n", "run_webhooks(self, VAR_25)\n", "run_server_script_for_doc_event(self, VAR_25)\n", "return VAR_66\n" ]
[ "def run_method(self, method, *args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "if 'flags' in kwargs:\n", "if hasattr(self, method) and hasattr(getattr(self, method), '__call__'):\n", "fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)\n", "fn = lambda self, *args, **kwargs: None\n", "fn.__name__ = str(method)\n", "out = Document.hook(fn)(self, *args, **kwargs)\n", "self.run_notifications(method)\n", "run_webhooks(self, method)\n", "run_server_script_for_doc_event(self, method)\n", "return out\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_6(VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_29 = VAR_21.get('front_url')\n", "if not VAR_29:\n", "return VAR_29\n", "VAR_29 = reverse('shuup:index')\n", "VAR_29 = None\n" ]
[ "def get_front_url(context):...\n", "\"\"\"docstring\"\"\"\n", "front_url = context.get('front_url')\n", "if not front_url:\n", "return front_url\n", "front_url = reverse('shuup:index')\n", "front_url = None\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Assign'", "Assign'" ]
[ "def __init__(self, VAR_84, *VAR_6, **VAR_7):...\n", "super().__init__(*VAR_6, **kwargs)\n", "self.fields['units'].queryset = VAR_84\n" ]
[ "def __init__(self, units, *args, **kwargs):...\n", "super().__init__(*args, **kwargs)\n", "self.fields['units'].queryset = units\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'" ]
[ "@transaction.non_atomic_requests...\n", "\"\"\"docstring\"\"\"\n", "VAR_38 = CourseKey.from_string(VAR_10)\n", "if VAR_43 == 'all':\n", "VAR_125 = 'all_whitelisted'\n", "if VAR_43 == 'new':\n", "instructor_task.api.generate_certificates_for_students(VAR_9, VAR_38,\n student_set=students)\n", "VAR_125 = 'whitelisted_not_generated'\n", "return JsonResponse({'success': False, 'message': _(\n 'Invalid data, generate_for must be \"new\" or \"all\".')}, status=400)\n", "VAR_63 = {'success': True, 'message': _(\n 'Certificate generation started for white listed students.')}\n", "return JsonResponse(VAR_63)\n" ]
[ "@transaction.non_atomic_requests...\n", "\"\"\"docstring\"\"\"\n", "course_key = CourseKey.from_string(course_id)\n", "if generate_for == 'all':\n", "students = 'all_whitelisted'\n", "if generate_for == 'new':\n", "instructor_task.api.generate_certificates_for_students(request, course_key,\n student_set=students)\n", "students = 'whitelisted_not_generated'\n", "return JsonResponse({'success': False, 'message': _(\n 'Invalid data, generate_for must be \"new\" or \"all\".')}, status=400)\n", "response_payload = {'success': True, 'message': _(\n 'Certificate generation started for white listed students.')}\n", "return JsonResponse(response_payload)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Return'", "Assign'", "Return'" ]
[ "def FUNC_20(self):...\n", "self.room_list_handler.enable_room_list_search = True\n", "self.directory_handler.enable_room_list_search = True\n", "VAR_20, VAR_21 = self.make_request('GET', b'publicRooms')\n", "self.assertEquals(200, VAR_21.code, VAR_21.result)\n", "self.assertTrue(len(VAR_21.json_body['chunk']) > 0)\n", "self.room_list_handler.enable_room_list_search = False\n", "self.directory_handler.enable_room_list_search = False\n", "VAR_20, VAR_21 = self.make_request('GET', b'publicRooms')\n", "self.assertEquals(200, VAR_21.code, VAR_21.result)\n", "self.assertTrue(len(VAR_21.json_body['chunk']) == 0)\n", "VAR_19 = self.helper.create_room_as(self.user_id)\n", "VAR_20, VAR_21 = self.make_request('PUT', b'directory/list/room/%s' % (\n VAR_19.encode('ascii'),), b'{}')\n", "self.assertEquals(403, VAR_21.code, VAR_21.result)\n" ]
[ "def test_disabling_room_list(self):...\n", "self.room_list_handler.enable_room_list_search = True\n", "self.directory_handler.enable_room_list_search = True\n", "request, channel = self.make_request('GET', b'publicRooms')\n", "self.assertEquals(200, channel.code, channel.result)\n", "self.assertTrue(len(channel.json_body['chunk']) > 0)\n", "self.room_list_handler.enable_room_list_search = False\n", "self.directory_handler.enable_room_list_search = False\n", "request, channel = self.make_request('GET', b'publicRooms')\n", "self.assertEquals(200, channel.code, channel.result)\n", "self.assertTrue(len(channel.json_body['chunk']) == 0)\n", "room_id = self.helper.create_room_as(self.user_id)\n", "request, channel = self.make_request('PUT', b'directory/list/room/%s' % (\n room_id.encode('ascii'),), b'{}')\n", "self.assertEquals(403, channel.code, channel.result)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_7():...\n", "return FUNC_4('email_on_ticket_assign')\n" ]
[ "def email_on_ticket_assign_default():...\n", "return get_default_setting('email_on_ticket_assign')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@CLASS_4('back')...\n", "\"\"\"docstring\"\"\"\n", "VAR_20 = jinja.render('back.html', title='Suspended: ' + urllib.parse.\n unquote(url.fragment()))\n", "return 'text/html', VAR_20\n" ]
[ "@add_handler('back')...\n", "\"\"\"docstring\"\"\"\n", "html = jinja.render('back.html', title='Suspended: ' + urllib.parse.unquote\n (url.fragment()))\n", "return 'text/html', html\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Return'" ]
[ "@app.route('/bookmarklet')...\n", "return render_template('bookmarklet.html', title='Bookmarklet')\n" ]
[ "@app.route('/bookmarklet')...\n", "return render_template('bookmarklet.html', title='Bookmarklet')\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_20(VAR_20):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_20.tag_set:\n", "FUNC_11(saved_model_utils.get_meta_graph_def(VAR_20.dir, VAR_20.tag_set))\n", "VAR_72 = saved_model_utils.read_saved_model(VAR_20.dir)\n", "for VAR_4 in VAR_72.meta_graphs:\n", "FUNC_11(VAR_4)\n" ]
[ "def scan(args):...\n", "\"\"\"docstring\"\"\"\n", "if args.tag_set:\n", "scan_meta_graph_def(saved_model_utils.get_meta_graph_def(args.dir, args.\n tag_set))\n", "saved_model = saved_model_utils.read_saved_model(args.dir)\n", "for meta_graph_def in saved_model.meta_graphs:\n", "scan_meta_graph_def(meta_graph_def)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Assign'", "For", "Expr'" ]
[ "def FUNC_12(VAR_5, VAR_21, VAR_22, VAR_23='crop'):...\n", "if VAR_5[0:6] != 'mxc://':\n", "return ''\n", "VAR_61 = VAR_5[6:]\n", "VAR_62 = None\n", "if '#' in VAR_61:\n", "VAR_61, VAR_62 = VAR_61.split('#', 1)\n", "VAR_63 = {'width': VAR_21, 'height': VAR_22, 'method': VAR_23}\n", "VAR_62 = '#' + VAR_62\n", "return '%s_matrix/media/v1/thumbnail/%s?%s%s' % (VAR_7, VAR_61, urllib.\n parse.urlencode(VAR_63), VAR_62 or '')\n" ]
[ "def mxc_to_http_filter(value, width, height, resize_method='crop'):...\n", "if value[0:6] != 'mxc://':\n", "return ''\n", "server_and_media_id = value[6:]\n", "fragment = None\n", "if '#' in server_and_media_id:\n", "server_and_media_id, fragment = server_and_media_id.split('#', 1)\n", "params = {'width': width, 'height': height, 'method': resize_method}\n", "fragment = '#' + fragment\n", "return '%s_matrix/media/v1/thumbnail/%s?%s%s' % (public_baseurl,\n server_and_media_id, urllib.parse.urlencode(params), fragment or '')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@property...\n", "VAR_4 = self.request.user\n", "if VAR_4.is_superuser:\n", "return False\n", "if settings.OFFER_HOSTING:\n", "return True\n", "return not any('component.edit' in permissions for permissions, _langs in\n VAR_4.component_permissions[self.instance.pk])\n" ]
[ "@property...\n", "user = self.request.user\n", "if user.is_superuser:\n", "return False\n", "if settings.OFFER_HOSTING:\n", "return True\n", "return not any('component.edit' in permissions for permissions, _langs in\n user.component_permissions[self.instance.pk])\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_80(VAR_31, VAR_136, VAR_138=None, VAR_5=None, VAR_139=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_67 = FUNC_37(VAR_100=8)\n", "VAR_51 = {'context': VAR_5 or {}, 'http_status_code': VAR_138 or 200}\n", "VAR_51['context'].update({'header': VAR_31, 'title': VAR_31, 'message':\n VAR_136})\n", "if VAR_139:\n", "VAR_51['context'].update({'indicator_color': VAR_139})\n", "FUNC_10().set_value('message_id:{0}'.format(VAR_67), VAR_51, expires_in_sec=60)\n", "VAR_197 = '/message?id={0}'.format(VAR_67)\n", "if not getattr(VAR_1, 'is_ajax', False):\n", "VAR_1.response['type'] = 'redirect'\n", "return VAR_197\n", "VAR_1.response['location'] = VAR_197\n" ]
[ "def redirect_to_message(title, html, http_status_code=None, context=None,...\n", "\"\"\"docstring\"\"\"\n", "message_id = generate_hash(length=8)\n", "message = {'context': context or {}, 'http_status_code': http_status_code or\n 200}\n", "message['context'].update({'header': title, 'title': title, 'message': html})\n", "if indicator_color:\n", "message['context'].update({'indicator_color': indicator_color})\n", "cache().set_value('message_id:{0}'.format(message_id), message,\n expires_in_sec=60)\n", "location = '/message?id={0}'.format(message_id)\n", "if not getattr(local, 'is_ajax', False):\n", "local.response['type'] = 'redirect'\n", "return location\n", "local.response['location'] = location\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_16(VAR_2):...\n", "VAR_53 = self.key_downloads.pop(VAR_2)\n", "VAR_53.callback(None)\n" ]
[ "def drop_server_lock(server_name):...\n", "d = self.key_downloads.pop(server_name)\n", "d.callback(None)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "@VAR_0.filter...\n", "\"\"\"docstring\"\"\"\n", "return VAR_17.data\n" ]
[ "@register.filter...\n", "\"\"\"docstring\"\"\"\n", "return value.data\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_5(self, VAR_3) ->Optional[CLASS_1]:...\n", "\"\"\"docstring\"\"\"\n", "return None\n" ]
[ "def relative(self, _) ->Optional[InputSource]:...\n", "\"\"\"docstring\"\"\"\n", "return None\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_12(self):...\n", "self.client.post('/password_reset/', {'email': '[email protected]'})\n", "self.assertEqual(len(mail.outbox), 1)\n", "return self._read_signup_email(mail.outbox[0])\n" ]
[ "def _test_confirm_start(self):...\n", "self.client.post('/password_reset/', {'email': '[email protected]'})\n", "self.assertEqual(len(mail.outbox), 1)\n", "return self._read_signup_email(mail.outbox[0])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_19(self):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_80():...\n", "VAR_84 = self.as_dict()\n", "for VAR_43, VAR_26 in iteritems(VAR_84):\n", "if VAR_26 == None:\n", "return VAR_84\n", "VAR_84[VAR_43] = ''\n" ]
[ "def set_title_field(self):...\n", "\"\"\"docstring\"\"\"\n", "def get_values():...\n", "values = self.as_dict()\n", "for key, value in iteritems(values):\n", "if value == None:\n", "return values\n", "values[key] = ''\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Assign'", "For", "Condition", "Return'", "Assign'" ]
[ "def FUNC_8(self, VAR_21):...\n", "VAR_21.changed_on = datetime.datetime.now()\n", "VAR_21.changed_by_fk = g.user.id\n" ]
[ "def pre_update(self, item):...\n", "item.changed_on = datetime.datetime.now()\n", "item.changed_by_fk = g.user.id\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def FUNC_15(VAR_37):...\n", "VAR_39, VAR_23 = VAR_37\n", "VAR_16.write(VAR_39)\n", "return VAR_23\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'" ]
[ "@administrator_required...\n", "VAR_8 = yt_paginate(VAR_3.order_by('-date_joined', '-pk'), per_page=config.\n topics_per_page, page_number=request.GET.get('page', 1))\n", "return render(VAR_1, VAR_4, context={'users': users})\n" ]
[ "@administrator_required...\n", "users = yt_paginate(queryset.order_by('-date_joined', '-pk'), per_page=\n config.topics_per_page, page_number=request.GET.get('page', 1))\n", "return render(request, template, context={'users': users})\n" ]
[ 0, 0, 0 ]
[ "Condition", "Assign'", "Return'" ]
[ "def FUNC_50(self):...\n", "\"\"\"docstring\"\"\"\n", "os.unlink(self.info_file)\n", "if e.errno != errno.ENOENT:\n" ]
[ "def remove_server_info_file(self):...\n", "\"\"\"docstring\"\"\"\n", "os.unlink(self.info_file)\n", "if e.errno != errno.ENOENT:\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Condition" ]
[ "def __init__(self):...\n", "self.reqparse = reqparse.RequestParser()\n", "super(CLASS_0, self).__init__()\n", "self.auth_dict = dict()\n", "if current_user.is_authenticated():\n", "VAR_15 = []\n", "if app.config.get('FRONTED_BY_NGINX'):\n", "for role in current_user.roles:\n", "VAR_16 = 'https://{}:{}{}'.format(app.config.get('FQDN'), app.config.get(\n 'NGINX_PORT'), '/login')\n", "VAR_16 = 'http://{}:{}{}'.format(app.config.get('FQDN'), app.config.get(\n 'API_PORT'), '/login')\n", "VAR_15.append(marshal(role.__dict__, VAR_9))\n", "VAR_15.append({'name': current_user.role})\n", "self.auth_dict = {'authenticated': False, 'user': None, 'url': VAR_16}\n", "for role in RBACRole.roles[current_user.role].get_parents():\n", "VAR_15.append({'name': role.name})\n", "self.auth_dict = {'authenticated': True, 'user': current_user.email,\n 'roles': VAR_15}\n" ]
[ "def __init__(self):...\n", "self.reqparse = reqparse.RequestParser()\n", "super(AuthenticatedService, self).__init__()\n", "self.auth_dict = dict()\n", "if current_user.is_authenticated():\n", "roles_marshal = []\n", "if app.config.get('FRONTED_BY_NGINX'):\n", "for role in current_user.roles:\n", "url = 'https://{}:{}{}'.format(app.config.get('FQDN'), app.config.get(\n 'NGINX_PORT'), '/login')\n", "url = 'http://{}:{}{}'.format(app.config.get('FQDN'), app.config.get(\n 'API_PORT'), '/login')\n", "roles_marshal.append(marshal(role.__dict__, ROLE_FIELDS))\n", "roles_marshal.append({'name': current_user.role})\n", "self.auth_dict = {'authenticated': False, 'user': None, 'url': url}\n", "for role in RBACRole.roles[current_user.role].get_parents():\n", "roles_marshal.append({'name': role.name})\n", "self.auth_dict = {'authenticated': True, 'user': current_user.email,\n 'roles': roles_marshal}\n" ]
[ 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Condition", "For", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "For", "Expr'", "Assign'" ]
[ "def FUNC_10(VAR_13: Callable[[Text], bool], VAR_12: Text) ->Type['Validator']:...\n", "\"\"\"docstring\"\"\"\n", "from prompt_toolkit.validation import Validator, ValidationError\n", "from prompt_toolkit.document import Document\n", "@staticmethod...\n", "VAR_26 = VAR_13(VAR_24.text)\n", "if not VAR_26:\n", "return CLASS_0\n" ]
[ "def create_validator(function: Callable[[Text], bool], error_message: Text...\n", "\"\"\"docstring\"\"\"\n", "from prompt_toolkit.validation import Validator, ValidationError\n", "from prompt_toolkit.document import Document\n", "@staticmethod...\n", "is_valid = function(document.text)\n", "if not is_valid:\n", "return FunctionValidator\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "ImportFrom'", "Condition", "Assign'", "Condition", "Return'" ]
[ "def FUNC_10(self):...\n", "VAR_5 = self._makeContext()\n", "self.assertEqual(VAR_5.evaluate('dummy2'), 'dummy')\n" ]
[ "def test_evaluate_with_render_DTML_template(self):...\n", "ec = self._makeContext()\n", "self.assertEqual(ec.evaluate('dummy2'), 'dummy')\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_9(self, VAR_15):...\n", "if VAR_15.tag not in self._tag_link_attrs:\n", "return False\n", "VAR_75 = self._tag_link_attrs[VAR_15.tag]\n", "if isinstance(VAR_75, (list, tuple)):\n", "for one_attr in VAR_75:\n", "VAR_57 = VAR_15.get(VAR_75)\n", "VAR_57 = VAR_15.get(one_attr)\n", "return True\n", "if not VAR_57:\n", "if not VAR_57:\n", "return False\n", "return self.allow_embedded_url(VAR_15, VAR_57)\n", "return False\n", "if not self.allow_embedded_url(VAR_15, VAR_57):\n", "return False\n" ]
[ "def allow_element(self, el):...\n", "if el.tag not in self._tag_link_attrs:\n", "return False\n", "attr = self._tag_link_attrs[el.tag]\n", "if isinstance(attr, (list, tuple)):\n", "for one_attr in attr:\n", "url = el.get(attr)\n", "url = el.get(one_attr)\n", "return True\n", "if not url:\n", "if not url:\n", "return False\n", "return self.allow_embedded_url(el, url)\n", "return False\n", "if not self.allow_embedded_url(el, url):\n", "return False\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "For", "Assign'", "Assign'", "Return'", "Condition", "Condition", "Return'", "Return'", "Return'", "Condition", "Return'" ]
[ "@FUNC_27()...\n", "\"\"\"docstring\"\"\"\n", "VAR_42.pop('ignore_permissions', None)\n", "VAR_42.pop('cmd', None)\n", "from frappe.model.rename_doc import rename_doc\n", "return FUNC_54(*VAR_79, **kwargs)\n" ]
[ "@whitelist()...\n", "\"\"\"docstring\"\"\"\n", "kwargs.pop('ignore_permissions', None)\n", "kwargs.pop('cmd', None)\n", "from frappe.model.rename_doc import rename_doc\n", "return rename_doc(*args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Expr'", "ImportFrom'", "Return'" ]
[ "def FUNC_0(self):...\n", "if not current_user.is_authenticated():\n", "return 'Must be logged in to log out', 200\n", "logout_user()\n", "return 'Logged Out', 200\n" ]
[ "def get(self):...\n", "if not current_user.is_authenticated():\n", "return 'Must be logged in to log out', 200\n", "logout_user()\n", "return 'Logged Out', 200\n" ]
[ 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_65(self) ->str:...\n", "return RoomAlias(random_string(5), self.hs.hostname).to_string()\n" ]
[ "def _random_alias(self) ->str:...\n", "return RoomAlias(random_string(5), self.hs.hostname).to_string()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "self.assertEqual(format_value(True), '<code>true</code>')\n", "self.assertEqual(format_value(False), '<code>false</code>')\n", "self.assertEqual(format_value(None), '<code>null</code>')\n" ]
[ "def test_format_value_boolean_or_none(self):...\n", "\"\"\"docstring\"\"\"\n", "self.assertEqual(format_value(True), '<code>true</code>')\n", "self.assertEqual(format_value(False), '<code>false</code>')\n", "self.assertEqual(format_value(None), '<code>null</code>')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'" ]
[ "@action('resetmypassword', lazy_gettext('Reset my password'), '', 'fa-lock',...\n", "return redirect(url_for(self.appbuilder.sm.resetmypasswordview.__name__ +\n '.this_form_get'))\n" ]
[ "@action('resetmypassword', lazy_gettext('Reset my password'), '', 'fa-lock',...\n", "return redirect(url_for(self.appbuilder.sm.resetmypasswordview.__name__ +\n '.this_form_get'))\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_29(VAR_90, VAR_51=False):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1.flags.in_test:\n", "return\n", "if not isinstance(VAR_90, (tuple, list)):\n", "VAR_90 = VAR_90,\n", "VAR_90 = set(VAR_90)\n", "VAR_182 = set(FUNC_24())\n", "if not VAR_90.intersection(VAR_182):\n", "if VAR_51:\n", "FUNC_15(FUNC_0('This action is only allowed for {}').format(FUNC_101(', '.\n join(VAR_90))), FUNC_0('Not Permitted'))\n" ]
[ "def only_for(roles, message=False):...\n", "\"\"\"docstring\"\"\"\n", "if local.flags.in_test:\n", "return\n", "if not isinstance(roles, (tuple, list)):\n", "roles = roles,\n", "roles = set(roles)\n", "myroles = set(get_roles())\n", "if not roles.intersection(myroles):\n", "if message:\n", "msgprint(_('This action is only allowed for {}').format(bold(', '.join(\n roles))), _('Not Permitted'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Expr'" ]
[ "def FUNC_26(VAR_14, VAR_16, VAR_19, VAR_32):...\n", "VAR_50 = False\n", "for VAR_28 in VAR_32:\n", "VAR_30 = 'custom_column_' + str(VAR_28.id)\n", "return VAR_50\n", "if not VAR_28.is_multiple:\n", "if len(getattr(VAR_16, VAR_30)) > 0:\n", "VAR_58 = VAR_19[VAR_30].split(',')\n", "VAR_29 = getattr(VAR_16, VAR_30)[0].value\n", "VAR_29 = None\n", "VAR_58 = list(map(lambda it: it.strip(), VAR_58))\n", "if VAR_19[VAR_30].strip():\n", "VAR_50 |= FUNC_7(VAR_58, getattr(VAR_16, VAR_30), db.cc_classes[VAR_28.id],\n calibre_db.session, 'custom')\n", "if VAR_28.datatype in ['int', 'bool', 'float', 'datetime', 'comments']:\n", "if VAR_29 is not None:\n", "VAR_50, VAR_19 = FUNC_22(VAR_14, VAR_16, VAR_28, VAR_19, VAR_29, VAR_30)\n", "VAR_50, VAR_19 = FUNC_23(VAR_16, VAR_28, VAR_19, VAR_29, VAR_30)\n", "VAR_104 = getattr(VAR_16, VAR_30)[0]\n", "getattr(VAR_16, VAR_30).remove(VAR_104)\n", "if not VAR_104.books or len(VAR_104.books) == 0:\n", "calibre_db.session.delete(VAR_104)\n", "VAR_50 = True\n" ]
[ "def edit_cc_data(book_id, book, to_save, cc):...\n", "changed = False\n", "for c in cc:\n", "cc_string = 'custom_column_' + str(c.id)\n", "return changed\n", "if not c.is_multiple:\n", "if len(getattr(book, cc_string)) > 0:\n", "input_tags = to_save[cc_string].split(',')\n", "cc_db_value = getattr(book, cc_string)[0].value\n", "cc_db_value = None\n", "input_tags = list(map(lambda it: it.strip(), input_tags))\n", "if to_save[cc_string].strip():\n", "changed |= modify_database_object(input_tags, getattr(book, cc_string), db.\n cc_classes[c.id], calibre_db.session, 'custom')\n", "if c.datatype in ['int', 'bool', 'float', 'datetime', 'comments']:\n", "if cc_db_value is not None:\n", "changed, to_save = edit_cc_data_value(book_id, book, c, to_save,\n cc_db_value, cc_string)\n", "changed, to_save = edit_cc_data_string(book, c, to_save, cc_db_value, cc_string\n )\n", "del_cc = getattr(book, cc_string)[0]\n", "getattr(book, cc_string).remove(del_cc)\n", "if not del_cc.books or len(del_cc.books) == 0:\n", "calibre_db.session.delete(del_cc)\n", "changed = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'" ]
[ "def FUNC_7(self):...\n", "return f'https://{self.hostname}/{self.user}/{self.repo}'\n" ]
[ "def get_repo_url(self):...\n", "return f'https://{self.hostname}/{self.user}/{self.repo}'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1():...\n", "\"\"\"docstring\"\"\"\n", "VAR_20 = []\n", "for dir, subdirs, VAR_65 in os.walk(VAR_5):\n", "VAR_44 = dir.replace(os.path.sep, '.')\n", "return VAR_20\n", "if '__init__.py' not in VAR_65:\n", "VAR_20.append(VAR_44)\n" ]
[ "def find_packages():...\n", "\"\"\"docstring\"\"\"\n", "packages = []\n", "for dir, subdirs, files in os.walk(name):\n", "package = dir.replace(os.path.sep, '.')\n", "return packages\n", "if '__init__.py' not in files:\n", "packages.append(package)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'" ]
[ "def FUNC_83(*VAR_2, **VAR_3):...\n", "VAR_9 = VAR_2[0]\n", "VAR_193 = {'error': 'Missing required query parameter(s)', 'parameters': [],\n 'info': {}}\n", "for VAR_209, extra in VAR_47:\n", "VAR_199 = object()\n", "if len(VAR_193['parameters']) > 0:\n", "if VAR_9.POST.get(VAR_209, VAR_199) == VAR_199:\n", "return JsonResponse(VAR_193, status=400)\n", "return VAR_1(*VAR_2, **kwargs)\n", "VAR_193['parameters'].append(VAR_209)\n", "VAR_193['info'][VAR_209] = extra\n" ]
[ "def wrapped(*args, **kwargs):...\n", "request = args[0]\n", "error_response_data = {'error': 'Missing required query parameter(s)',\n 'parameters': [], 'info': {}}\n", "for param, extra in required_params:\n", "default = object()\n", "if len(error_response_data['parameters']) > 0:\n", "if request.POST.get(param, default) == default:\n", "return JsonResponse(error_response_data, status=400)\n", "return func(*args, **kwargs)\n", "error_response_data['parameters'].append(param)\n", "error_response_data['info'][param] = extra\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Assign'", "Condition", "Condition", "Return'", "Return'", "Expr'", "Assign'" ]
[ "@pytest.mark.parametrize('path,body,expected_status,expected_response', [(...\n", "VAR_10 = VAR_0.post(VAR_6, json=body)\n", "assert VAR_10.status_code == VAR_8\n", "assert VAR_10.json() == VAR_9\n" ]
[ "@pytest.mark.parametrize('path,body,expected_status,expected_response', [(...\n", "response = client.post(path, json=body)\n", "assert response.status_code == expected_status\n", "assert response.json() == expected_response\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assert'", "Assert'" ]
[ "def FUNC_67(VAR_44, VAR_45, VAR_46, VAR_47, VAR_48):...\n", "VAR_55 = request.form.to_dict()\n", "VAR_87.random_books = 0\n", "if VAR_87.role_passwd() or VAR_87.role_admin():\n", "if VAR_55.get('password'):\n", "if VAR_55.get('kindle_mail', VAR_87.kindle_mail) != VAR_87.kindle_mail:\n", "flash(str(ex), category='error')\n", "VAR_98 = 0\n", "VAR_87.password = generate_password_hash(VAR_55['password'])\n", "VAR_87.kindle_mail = valid_email(VAR_55['kindle_mail'])\n", "if VAR_55.get('email', VAR_87.email) != VAR_87.email:\n", "return render_title_template('user_edit.html', VAR_116=current_user, VAR_47\n =translations, profile=1, VAR_48=languages, VAR_149=_(\n u\"%(name)s's profile\", name=current_user.name), VAR_9='me', VAR_44=\n kobo_support, registered_oauth=local_oauth_check, VAR_46=oauth_status)\n", "for key, VAR_64 in VAR_55.items():\n", "VAR_87.email = check_email(VAR_55['email'])\n", "if VAR_87.role_admin():\n", "if key.startswith('show'):\n", "VAR_87.sidebar_view = VAR_98\n", "if VAR_55.get('name', VAR_87.name) != VAR_87.name:\n", "VAR_87.random_books = 1 if VAR_55.get('show_random') == 'on' else 0\n", "VAR_98 += int(key[5:])\n", "if VAR_55.get('Show_detail_random'):\n", "VAR_87.name = check_username(VAR_55['name'])\n", "if VAR_55.get('default_language'):\n", "VAR_87.sidebar_view += constants.DETAIL_RANDOM\n", "ub.session.commit()\n", "ub.session.rollback()\n", "VAR_87.default_language = VAR_55['default_language']\n", "if VAR_55.get('locale'):\n", "flash(_(u'Profile updated'), category='success')\n", "flash(_(u'Found an existing account for this e-mail address'), category='error'\n )\n", "VAR_87.locale = VAR_55['locale']\n", "VAR_87.kobo_only_shelves_sync = int(VAR_55.get('kobo_only_shelves_sync') ==\n 'on') or 0\n", "VAR_3.debug(u'Profile updated')\n", "VAR_3.debug(u'Found an existing account for this e-mail address')\n", "ub.session.rollback()\n", "VAR_3.error('Database error: %s', e)\n", "flash(_(u'Database error: %(error)s.', VAR_139=e), category='error')\n" ]
[ "def change_profile(kobo_support, local_oauth_check, oauth_status,...\n", "to_save = request.form.to_dict()\n", "current_user.random_books = 0\n", "if current_user.role_passwd() or current_user.role_admin():\n", "if to_save.get('password'):\n", "if to_save.get('kindle_mail', current_user.kindle_mail\n", "flash(str(ex), category='error')\n", "val = 0\n", "current_user.password = generate_password_hash(to_save['password'])\n", "current_user.kindle_mail = valid_email(to_save['kindle_mail'])\n", "if to_save.get('email', current_user.email) != current_user.email:\n", "return render_title_template('user_edit.html', content=current_user,\n translations=translations, profile=1, languages=languages, title=_(\n u\"%(name)s's profile\", name=current_user.name), page='me', kobo_support\n =kobo_support, registered_oauth=local_oauth_check, oauth_status=\n oauth_status)\n", "for key, __ in to_save.items():\n", "current_user.email = check_email(to_save['email'])\n", "if current_user.role_admin():\n", "if key.startswith('show'):\n", "current_user.sidebar_view = val\n", "if to_save.get('name', current_user.name) != current_user.name:\n", "current_user.random_books = 1 if to_save.get('show_random') == 'on' else 0\n", "val += int(key[5:])\n", "if to_save.get('Show_detail_random'):\n", "current_user.name = check_username(to_save['name'])\n", "if to_save.get('default_language'):\n", "current_user.sidebar_view += constants.DETAIL_RANDOM\n", "ub.session.commit()\n", "ub.session.rollback()\n", "current_user.default_language = to_save['default_language']\n", "if to_save.get('locale'):\n", "flash(_(u'Profile updated'), category='success')\n", "flash(_(u'Found an existing account for this e-mail address'), category='error'\n )\n", "current_user.locale = to_save['locale']\n", "current_user.kobo_only_shelves_sync = int(to_save.get(\n 'kobo_only_shelves_sync') == 'on') or 0\n", "log.debug(u'Profile updated')\n", "log.debug(u'Found an existing account for this e-mail address')\n", "ub.session.rollback()\n", "log.error('Database error: %s', e)\n", "flash(_(u'Database error: %(error)s.', error=e), category='error')\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "For", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "AugAssign'", "Condition", "Assign'", "Condition", "AugAssign'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "from os import path\n", "from synapse.config import ConfigError\n", "from ._base import Config\n", "VAR_0 = 'string'\n", "VAR_1 = 'consent'\n", "def __init__(self, *VAR_2):...\n", "super().__init__(*VAR_2)\n", "self.user_consent_version = None\n", "self.user_consent_template_dir = None\n", "self.user_consent_server_notice_content = None\n", "self.user_consent_server_notice_to_guests = False\n", "self.block_events_without_consent_error = None\n", "self.user_consent_at_registration = False\n", "self.user_consent_policy_name = 'Privacy Policy'\n", "def FUNC_0(self, VAR_3, **VAR_4):...\n", "VAR_5 = VAR_3.get('user_consent')\n", "self.terms_template = self.read_templates(['terms.html'], autoescape=True)[0]\n", "if VAR_5 is None:\n", "return\n", "self.user_consent_version = str(VAR_5['version'])\n", "self.user_consent_template_dir = self.abspath(VAR_5['template_dir'])\n", "if not path.isdir(self.user_consent_template_dir):\n", "self.user_consent_server_notice_content = VAR_5.get('server_notice_content')\n", "self.block_events_without_consent_error = VAR_5.get('block_events_error')\n", "self.user_consent_server_notice_to_guests = bool(VAR_5.get(\n 'send_server_notice_to_guests', False))\n", "self.user_consent_at_registration = bool(VAR_5.get(\n 'require_at_registration', False))\n", "self.user_consent_policy_name = VAR_5.get('policy_name', 'Privacy Policy')\n", "def FUNC_1(self, **VAR_4):...\n", "return VAR_0\n" ]
[ "from os import path\n", "from synapse.config import ConfigError\n", "from ._base import Config\n", "DEFAULT_CONFIG = \"\"\"# User Consent configuration\n#\n# for detailed instructions, see\n# https://github.com/matrix-org/synapse/blob/master/docs/consent_tracking.md\n#\n# Parts of this section are required if enabling the 'consent' resource under\n# 'listeners', in particular 'template_dir' and 'version'.\n#\n# 'template_dir' gives the location of the templates for the HTML forms.\n# This directory should contain one subdirectory per language (eg, 'en', 'fr'),\n# and each language directory should contain the policy document (named as\n# '<version>.html') and a success page (success.html).\n#\n# 'version' specifies the 'current' version of the policy document. It defines\n# the version to be served by the consent resource if there is no 'v'\n# parameter.\n#\n# 'server_notice_content', if enabled, will send a user a \"Server Notice\"\n# asking them to consent to the privacy policy. The 'server_notices' section\n# must also be configured for this to work. Notices will *not* be sent to\n# guest users unless 'send_server_notice_to_guests' is set to true.\n#\n# 'block_events_error', if set, will block any attempts to send events\n# until the user consents to the privacy policy. The value of the setting is\n# used as the text of the error.\n#\n# 'require_at_registration', if enabled, will add a step to the registration\n# process, similar to how captcha works. Users will be required to accept the\n# policy before their account is created.\n#\n# 'policy_name' is the display name of the policy users will see when registering\n# for an account. Has no effect unless `require_at_registration` is enabled.\n# Defaults to \"Privacy Policy\".\n#\n#user_consent:\n# template_dir: res/templates/privacy\n# version: 1.0\n# server_notice_content:\n# msgtype: m.text\n# body: >-\n# To continue using this homeserver you must review and agree to the\n# terms and conditions at %(consent_uri)s\n# send_server_notice_to_guests: true\n# block_events_error: >-\n# To continue using this homeserver you must review and agree to the\n# terms and conditions at %(consent_uri)s\n# require_at_registration: false\n# policy_name: Privacy Policy\n#\n\"\"\"\n", "section = 'consent'\n", "def __init__(self, *args):...\n", "super().__init__(*args)\n", "self.user_consent_version = None\n", "self.user_consent_template_dir = None\n", "self.user_consent_server_notice_content = None\n", "self.user_consent_server_notice_to_guests = False\n", "self.block_events_without_consent_error = None\n", "self.user_consent_at_registration = False\n", "self.user_consent_policy_name = 'Privacy Policy'\n", "def read_config(self, config, **kwargs):...\n", "consent_config = config.get('user_consent')\n", "self.terms_template = self.read_templates(['terms.html'], autoescape=True)[0]\n", "if consent_config is None:\n", "return\n", "self.user_consent_version = str(consent_config['version'])\n", "self.user_consent_template_dir = self.abspath(consent_config['template_dir'])\n", "if not path.isdir(self.user_consent_template_dir):\n", "self.user_consent_server_notice_content = consent_config.get(\n 'server_notice_content')\n", "self.block_events_without_consent_error = consent_config.get(\n 'block_events_error')\n", "self.user_consent_server_notice_to_guests = bool(consent_config.get(\n 'send_server_notice_to_guests', False))\n", "self.user_consent_at_registration = bool(consent_config.get(\n 'require_at_registration', False))\n", "self.user_consent_policy_name = consent_config.get('policy_name',\n 'Privacy Policy')\n", "def generate_config_section(self, **kwargs):...\n", "return DEFAULT_CONFIG\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_13(self):...\n", "assert join(None) == '/'\n", "assert join(None, None, '', 0) == '/'\n" ]
[ "def test_it_works_with_garbage(self):...\n", "assert join(None) == '/'\n", "assert join(None, None, '', 0) == '/'\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assert'", "Assert'" ]
[ "def FUNC_23(self):...\n", "VAR_5 = self._makeContext()\n", "self.assertEqual(VAR_5.evaluate('path: '), None)\n" ]
[ "def test_empty_path_expression_explicit_with_trailing_whitespace(self):...\n", "ec = self._makeContext()\n", "self.assertEqual(ec.evaluate('path: '), None)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_2(VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = VAR_2.session.get('connector')\n", "if VAR_5 is not None:\n", "return VAR_5.is_public\n" ]
[ "def is_public_user(request):...\n", "\"\"\"docstring\"\"\"\n", "connector = request.session.get('connector')\n", "if connector is not None:\n", "return connector.is_public\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'" ]
[ "@app.route('/dataobj/delete/<int:dataobj_id>', methods=['DELETE', 'GET'])...\n", "" ]
[ "@app.route('/dataobj/delete/<int:dataobj_id>', methods=['DELETE', 'GET'])...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "def FUNC_3(VAR_2: str, VAR_3: pathlib.Path) ->typing.Tuple[pathlib.Path, dict]:...\n", "VAR_14 = FUNC_0(VAR_2, pathlib.Path(VAR_0.config['DATA_ROOT']))\n", "VAR_13, VAR_5 = FUNC_1(VAR_14)\n", "return VAR_13, FUNC_2(VAR_5)\n" ]
[ "def get_info(path: str, root: pathlib.Path) ->typing.Tuple[pathlib.Path, dict]:...\n", "dest_path = sanitized_join(path, pathlib.Path(app.config['DATA_ROOT']))\n", "data_file, metadata_file = get_paths(dest_path)\n", "return data_file, load_metadata(metadata_file)\n" ]
[ 0, 1, 1, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_21(VAR_8, VAR_9):...\n", "self.query_handlers[VAR_8] = VAR_9\n" ]
[ "def register_query_handler(query_type, handler):...\n", "self.query_handlers[query_type] = handler\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_14(self, VAR_46):...\n", "\"\"\"docstring\"\"\"\n", "self.log.info('Writing notebook server cookie secret to %s', self.\n cookie_secret_file)\n", "VAR_102.write(VAR_46)\n", "os.chmod(self.cookie_secret_file, 384)\n", "self.log.warn('Could not set permissions on %s', self.cookie_secret_file)\n" ]
[ "def _write_cookie_secret_file(self, secret):...\n", "\"\"\"docstring\"\"\"\n", "self.log.info('Writing notebook server cookie secret to %s', self.\n cookie_secret_file)\n", "f.write(secret)\n", "os.chmod(self.cookie_secret_file, 384)\n", "self.log.warn('Could not set permissions on %s', self.cookie_secret_file)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@ratelimit(field='username', rate='5/5m')...\n", "if VAR_7.user.is_authenticated:\n", "return redirect(VAR_7.GET.get('next', VAR_7.user.st.get_absolute_url()))\n", "if VAR_7.method == 'POST' and VAR_7.is_limited():\n", "return redirect(VAR_7.get_full_path())\n", "return VAR_1(VAR_7, authentication_form=LoginForm, **kwargs)\n" ]
[ "@ratelimit(field='username', rate='5/5m')...\n", "if request.user.is_authenticated:\n", "return redirect(request.GET.get('next', request.user.st.get_absolute_url()))\n", "if request.method == 'POST' and request.is_limited():\n", "return redirect(request.get_full_path())\n", "return _login_view(request, authentication_form=LoginForm, **kwargs)\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_2(VAR_3, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_3 or not VAR_69:\n", "return None\n", "VAR_1.warning('Keyring is skipped due to an exception: %s', str(exc))\n", "VAR_92 = VAR_69.get_credential\n", "VAR_1.debug('Getting credentials from keyring for %s', VAR_3)\n", "if VAR_4:\n", "VAR_93 = VAR_92(VAR_3, VAR_4)\n", "VAR_1.debug('Getting password from keyring for %s', VAR_3)\n", "if VAR_93 is not None:\n", "VAR_73 = VAR_69.get_password(VAR_3, VAR_4)\n", "return VAR_93.username, VAR_93.password\n", "return None\n", "if VAR_73:\n", "return VAR_4, VAR_73\n" ]
[ "def _get_keyring_auth(url, username):...\n", "\"\"\"docstring\"\"\"\n", "if not url or not keyring:\n", "return None\n", "logger.warning('Keyring is skipped due to an exception: %s', str(exc))\n", "get_credential = keyring.get_credential\n", "logger.debug('Getting credentials from keyring for %s', url)\n", "if username:\n", "cred = get_credential(url, username)\n", "logger.debug('Getting password from keyring for %s', url)\n", "if cred is not None:\n", "password = keyring.get_password(url, username)\n", "return cred.username, cred.password\n", "return None\n", "if password:\n", "return username, password\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Return'", "Return'", "Condition", "Return'" ]
[ "async def FUNC_10(self, VAR_17: str, VAR_16: str, VAR_39, VAR_36: Optional[...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = CLASS_0(VAR_15='GET', VAR_17=destination, VAR_16=path, VAR_20=args)\n", "VAR_11 = await self._send_request(VAR_10, VAR_28=retry_on_dns_fail, VAR_31=\n ignore_backoff)\n", "VAR_14 = dict(VAR_11.headers.getAllRawHeaders())\n", "VAR_46 = readBodyToFile(VAR_11, VAR_39, VAR_40)\n", "VAR_0.warning('{%s} [%s] Error reading response: %s', VAR_10.txn_id, VAR_10\n .destination, VAR_13)\n", "VAR_0.info('{%s} [%s] Completed: %d %s [%d bytes] %s %s', VAR_10.txn_id,\n VAR_10.destination, VAR_11.code, VAR_11.phrase.decode('ascii', errors=\n 'replace'), VAR_64, VAR_10.method, VAR_10.uri.decode('ascii'))\n", "VAR_46.addTimeout(self.default_timeout, self.reactor)\n", "return VAR_64, VAR_14\n", "VAR_64 = await make_deferred_yieldable(VAR_46)\n" ]
[ "async def get_file(self, destination: str, path: str, output_stream, args:...\n", "\"\"\"docstring\"\"\"\n", "request = MatrixFederationRequest(method='GET', destination=destination,\n path=path, query=args)\n", "response = await self._send_request(request, retry_on_dns_fail=\n retry_on_dns_fail, ignore_backoff=ignore_backoff)\n", "headers = dict(response.headers.getAllRawHeaders())\n", "d = readBodyToFile(response, output_stream, max_size)\n", "logger.warning('{%s} [%s] Error reading response: %s', request.txn_id,\n request.destination, e)\n", "logger.info('{%s} [%s] Completed: %d %s [%d bytes] %s %s', request.txn_id,\n request.destination, response.code, response.phrase.decode('ascii',\n errors='replace'), length, request.method, request.uri.decode('ascii'))\n", "d.addTimeout(self.default_timeout, self.reactor)\n", "return length, headers\n", "length = await make_deferred_yieldable(d)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'", "Assign'" ]
[ "def FUNC_49(self, VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "return '<li>%s</li>\\n' % VAR_14\n" ]
[ "def list_item(self, text):...\n", "\"\"\"docstring\"\"\"\n", "return '<li>%s</li>\\n' % text\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_67(self, VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "VAR_64 = \"\"\"<div class=\"footnotes\">\n%s<ol>%s</ol>\n</div>\n\"\"\"\n", "return VAR_64 % (self.hrule(), VAR_14)\n" ]
[ "def footnotes(self, text):...\n", "\"\"\"docstring\"\"\"\n", "html = \"\"\"<div class=\"footnotes\">\n%s<ol>%s</ol>\n</div>\n\"\"\"\n", "return html % (self.hrule(), text)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def __init__(self, VAR_3=None):...\n", "VAR_28 = {'class': 'vTextField'}\n", "if VAR_3 is not None:\n", "VAR_28.update(VAR_3)\n", "super(CLASS_11, self).__init__(VAR_3=final_attrs)\n" ]
[ "def __init__(self, attrs=None):...\n", "final_attrs = {'class': 'vTextField'}\n", "if attrs is not None:\n", "final_attrs.update(attrs)\n", "super(AdminTextInputWidget, self).__init__(attrs=final_attrs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "@app.route('/folders/create', methods=['POST'])...\n", "VAR_9 = forms.NewFolderForm()\n", "if VAR_9.validate_on_submit():\n", "VAR_7 = Path(VAR_9.parent_dir.data.strip('/')) / VAR_9.new_dir.data\n", "flash('Could not create folder.', 'error')\n", "VAR_35 = data.create_dir(str(VAR_7))\n", "return redirect(request.referrer or '/')\n", "flash('Folder successfully created.', 'success')\n", "return redirect(f'/?path={VAR_35}')\n" ]
[ "@app.route('/folders/create', methods=['POST'])...\n", "form = forms.NewFolderForm()\n", "if form.validate_on_submit():\n", "path = Path(form.parent_dir.data.strip('/')) / form.new_dir.data\n", "flash('Could not create folder.', 'error')\n", "new_path = data.create_dir(str(path))\n", "return redirect(request.referrer or '/')\n", "flash('Folder successfully created.', 'success')\n", "return redirect(f'/?path={new_path}')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Return'", "Expr'", "Return'" ]
[ "def FUNC_14(VAR_7, VAR_8=False, VAR_9='', VAR_10=False):...\n", "\"\"\"docstring\"\"\"\n", "import salt.utils.win_functions\n", "import salt.utils.win_dacl\n", "VAR_11 = VAR_7[0]\n", "while VAR_54.path.basename(VAR_11) not in ['salt', 'salt-tests-tmpdir']:\n", "VAR_11, VAR_48 = VAR_54.path.split(VAR_11)\n", "if not VAR_54.path.isdir(VAR_11):\n", "VAR_54.makedirs(VAR_11)\n", "VAR_34 = salt.utils.win_functions.get_current_user()\n", "if salt.utils.win_functions.is_admin(VAR_34):\n", "for dir_ in VAR_7:\n", "salt.utils.win_dacl.set_owner(VAR_11, 'S-1-5-32-544')\n", "VAR_32 = 'Unable to securely set the owner of \"{0}\".'.format(VAR_11)\n", "if not VAR_8:\n", "if not dir_:\n", "if VAR_10 is False:\n", "if is_console_configured():\n", "VAR_55 = salt.utils.win_dacl.dacl()\n", "VAR_32 = 'Unable to securely set the permissions of \"{0}\".'.format(VAR_11)\n", "if not VAR_54.path.isdir(dir_):\n", "FUNC_0()\n", "VAR_0.critical(VAR_32)\n", "sys.stderr.write('CRITICAL: {0}\\n'.format(VAR_32))\n", "VAR_55.add_ace('S-1-5-32-544', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "if is_console_configured():\n", "if dir_ == VAR_9:\n", "VAR_54.makedirs(dir_)\n", "VAR_32 = 'Failed to create directory path \"{0}\" - {1}\\n'\n", "VAR_55.add_ace('S-1-5-18', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "VAR_0.critical(VAR_32)\n", "sys.stderr.write('CRITICAL: {0}\\n'.format(VAR_32))\n", "salt.utils.win_dacl.set_owner(VAR_11, 'S-1-5-32-544')\n", "VAR_32 = 'Unable to securely set the permissions of \"{0}\".'\n", "sys.stderr.write(VAR_32.format(dir_, VAR_49))\n", "VAR_55.add_ace('S-1-3-4', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "VAR_55 = salt.utils.win_dacl.dacl()\n", "VAR_32 = VAR_32.format(dir_)\n", "sys.exit(VAR_49.errno)\n", "VAR_55.save(VAR_11, True)\n", "VAR_55.add_ace('S-1-5-32-544', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "if is_console_configured():\n", "VAR_55.add_ace('S-1-5-18', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "VAR_0.critical(VAR_32)\n", "sys.stderr.write('CRITICAL: {0}\\n'.format(VAR_32))\n", "VAR_55.add_ace('S-1-3-4', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "VAR_55.save(dir_, True)\n" ]
[ "def win_verify_env(dirs, permissive=False, pki_dir='', skip_extra=False):...\n", "\"\"\"docstring\"\"\"\n", "import salt.utils.win_functions\n", "import salt.utils.win_dacl\n", "path = dirs[0]\n", "while os.path.basename(path) not in ['salt', 'salt-tests-tmpdir']:\n", "path, base = os.path.split(path)\n", "if not os.path.isdir(path):\n", "os.makedirs(path)\n", "current_user = salt.utils.win_functions.get_current_user()\n", "if salt.utils.win_functions.is_admin(current_user):\n", "for dir_ in dirs:\n", "salt.utils.win_dacl.set_owner(path, 'S-1-5-32-544')\n", "msg = 'Unable to securely set the owner of \"{0}\".'.format(path)\n", "if not permissive:\n", "if not dir_:\n", "if skip_extra is False:\n", "if is_console_configured():\n", "dacl = salt.utils.win_dacl.dacl()\n", "msg = 'Unable to securely set the permissions of \"{0}\".'.format(path)\n", "if not os.path.isdir(dir_):\n", "zmq_version()\n", "log.critical(msg)\n", "sys.stderr.write('CRITICAL: {0}\\n'.format(msg))\n", "dacl.add_ace('S-1-5-32-544', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "if is_console_configured():\n", "if dir_ == pki_dir:\n", "os.makedirs(dir_)\n", "msg = 'Failed to create directory path \"{0}\" - {1}\\n'\n", "dacl.add_ace('S-1-5-18', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "log.critical(msg)\n", "sys.stderr.write('CRITICAL: {0}\\n'.format(msg))\n", "salt.utils.win_dacl.set_owner(path, 'S-1-5-32-544')\n", "msg = 'Unable to securely set the permissions of \"{0}\".'\n", "sys.stderr.write(msg.format(dir_, err))\n", "dacl.add_ace('S-1-3-4', 'grant', 'full_control', 'this_folder_subfolders_files'\n )\n", "dacl = salt.utils.win_dacl.dacl()\n", "msg = msg.format(dir_)\n", "sys.exit(err.errno)\n", "dacl.save(path, True)\n", "dacl.add_ace('S-1-5-32-544', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "if is_console_configured():\n", "dacl.add_ace('S-1-5-18', 'grant', 'full_control',\n 'this_folder_subfolders_files')\n", "log.critical(msg)\n", "sys.stderr.write('CRITICAL: {0}\\n'.format(msg))\n", "dacl.add_ace('S-1-3-4', 'grant', 'full_control', 'this_folder_subfolders_files'\n )\n", "dacl.save(dir_, True)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Import'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "For", "Expr'", "Assign'", "Condition", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "\"\"\"string\"\"\"\n", "import argparse\n", "import os\n", "import re\n", "import sys\n", "from absl import app\n", "import numpy as np\n", "import six\n", "from tensorflow.core.example import example_pb2\n", "from tensorflow.core.framework import types_pb2\n", "from tensorflow.python.client import session\n", "from tensorflow.python.debug.wrappers import local_cli_wrapper\n", "from tensorflow.python.eager import def_function\n", "from tensorflow.python.eager import function as defun\n", "from tensorflow.python.framework import meta_graph as meta_graph_lib\n", "from tensorflow.python.framework import ops as ops_lib\n", "from tensorflow.python.framework import tensor_spec\n", "from tensorflow.python.lib.io import file_io\n", "from tensorflow.python.platform import tf_logging as logging\n", "from tensorflow.python.saved_model import load\n", "from tensorflow.python.saved_model import loader\n", "from tensorflow.python.saved_model import save\n", "from tensorflow.python.saved_model import signature_constants\n", "from tensorflow.python.tools import saved_model_aot_compile\n", "from tensorflow.python.tools import saved_model_utils\n", "from tensorflow.python.tpu import tpu\n", "from tensorflow.python.util.compat import collections_abc\n", "VAR_0 = (\n 'https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/xla/debug_options_flags.cc'\n )\n", "VAR_1 = set(['WriteFile', 'ReadFile', 'PrintV2'])\n", "def FUNC_0(VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = saved_model_utils.get_saved_model_tag_sets(VAR_2)\n", "print('The given SavedModel contains the following tag-sets:')\n", "for VAR_3 in sorted(VAR_22):\n", "print('%r' % ', '.join(sorted(VAR_3)))\n", "def FUNC_1(VAR_2, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_23 = FUNC_10(VAR_2, VAR_3)\n", "print(\n 'The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:'\n )\n", "for VAR_5 in sorted(VAR_23.keys()):\n", "print('SignatureDef key: \"%s\"' % VAR_5)\n", "def FUNC_2(VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_5 not in VAR_4.signature_def:\n", "return VAR_4.signature_def[VAR_5].inputs\n" ]
[ "\"\"\"Command-line interface to inspect and execute a graph in a SavedModel.\n\nFor detailed usages and examples, please refer to:\nhttps://www.tensorflow.org/guide/saved_model#cli_to_inspect_and_execute_savedmodel\n\n\"\"\"\n", "import argparse\n", "import os\n", "import re\n", "import sys\n", "from absl import app\n", "import numpy as np\n", "import six\n", "from tensorflow.core.example import example_pb2\n", "from tensorflow.core.framework import types_pb2\n", "from tensorflow.python.client import session\n", "from tensorflow.python.debug.wrappers import local_cli_wrapper\n", "from tensorflow.python.eager import def_function\n", "from tensorflow.python.eager import function as defun\n", "from tensorflow.python.framework import meta_graph as meta_graph_lib\n", "from tensorflow.python.framework import ops as ops_lib\n", "from tensorflow.python.framework import tensor_spec\n", "from tensorflow.python.lib.io import file_io\n", "from tensorflow.python.platform import tf_logging as logging\n", "from tensorflow.python.saved_model import load\n", "from tensorflow.python.saved_model import loader\n", "from tensorflow.python.saved_model import save\n", "from tensorflow.python.saved_model import signature_constants\n", "from tensorflow.python.tools import saved_model_aot_compile\n", "from tensorflow.python.tools import saved_model_utils\n", "from tensorflow.python.tpu import tpu\n", "from tensorflow.python.util.compat import collections_abc\n", "_XLA_DEBUG_OPTIONS_URL = (\n 'https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/xla/debug_options_flags.cc'\n )\n", "_OP_DENYLIST = set(['WriteFile', 'ReadFile', 'PrintV2'])\n", "def _show_tag_sets(saved_model_dir):...\n", "\"\"\"docstring\"\"\"\n", "tag_sets = saved_model_utils.get_saved_model_tag_sets(saved_model_dir)\n", "print('The given SavedModel contains the following tag-sets:')\n", "for tag_set in sorted(tag_sets):\n", "print('%r' % ', '.join(sorted(tag_set)))\n", "def _show_signature_def_map_keys(saved_model_dir, tag_set):...\n", "\"\"\"docstring\"\"\"\n", "signature_def_map = get_signature_def_map(saved_model_dir, tag_set)\n", "print(\n 'The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:'\n )\n", "for signature_def_key in sorted(signature_def_map.keys()):\n", "print('SignatureDef key: \"%s\"' % signature_def_key)\n", "def _get_inputs_tensor_info_from_meta_graph_def(meta_graph_def,...\n", "\"\"\"docstring\"\"\"\n", "if signature_def_key not in meta_graph_def.signature_def:\n", "return meta_graph_def.signature_def[signature_def_key].inputs\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Expr'", "For", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Expr'", "For", "Expr'", "FunctionDef'", "Docstring", "Condition", "Return'" ]
[ "def FUNC_10(*VAR_17):...\n", "VAR_29 = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))\n", "return os.path.join(VAR_29, *VAR_17)\n" ]
[ "def scriptPath(*pathSegs):...\n", "startPath = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))\n", "return os.path.join(startPath, *pathSegs)\n" ]
[ 0, 0, 1 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_6(self):...\n", "VAR_7 = self.created_rmid\n", "self.helper.invite(VAR_7=room, src=self.rmcreator_id, targ=self.user_id)\n", "self._test_get_membership(VAR_8=[self.user_id, self.rmcreator_id], VAR_7=\n room, VAR_9=403)\n", "self.helper.join(VAR_7=room, user=self.user_id)\n", "self._test_get_membership(VAR_8=[self.user_id, self.rmcreator_id], VAR_7=\n room, VAR_9=200)\n", "self.helper.leave(VAR_7=room, user=self.user_id)\n", "self._test_get_membership(VAR_8=[self.user_id, self.rmcreator_id], VAR_7=\n room, VAR_9=200)\n" ]
[ "def test_membership_private_room_perms(self):...\n", "room = self.created_rmid\n", "self.helper.invite(room=room, src=self.rmcreator_id, targ=self.user_id)\n", "self._test_get_membership(members=[self.user_id, self.rmcreator_id], room=\n room, expect_code=403)\n", "self.helper.join(room=room, user=self.user_id)\n", "self._test_get_membership(members=[self.user_id, self.rmcreator_id], room=\n room, expect_code=200)\n", "self.helper.leave(room=room, user=self.user_id)\n", "self._test_get_membership(members=[self.user_id, self.rmcreator_id], room=\n room, expect_code=200)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_12(VAR_0, VAR_1: FlaskClient):...\n", "VAR_8 = VAR_1.post('/login', data={'username': 'halcyon', 'password':\n 'password'}, follow_redirects=True)\n", "assert VAR_8.status_code == 200\n", "assert request.path == '/'\n", "assert current_user\n" ]
[ "def test_logging_in(test_app, client: FlaskClient):...\n", "resp = client.post('/login', data={'username': 'halcyon', 'password':\n 'password'}, follow_redirects=True)\n", "assert resp.status_code == 200\n", "assert request.path == '/'\n", "assert current_user\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assert'", "Assert'", "Assert'" ]
[ "def FUNC_7(self, VAR_26: str, VAR_27: Callable[..., Any], *, VAR_29:...\n", "VAR_46 = VAR_49 or self.route_class\n", "VAR_35 = VAR_35 or {}\n", "VAR_60 = {**self.responses, **VAR_35}\n", "VAR_61 = get_value_or_default(VAR_14, self.default_response_class)\n", "VAR_62 = self.tags.copy()\n", "if VAR_30:\n", "VAR_62.extend(VAR_30)\n", "VAR_63 = self.dependencies.copy()\n", "if VAR_31:\n", "VAR_63.extend(VAR_31)\n", "VAR_64 = self.callbacks.copy()\n", "if VAR_40:\n", "VAR_64.extend(VAR_40)\n", "VAR_65 = VAR_46(self.prefix + VAR_26, VAR_27=endpoint, VAR_29=\n response_model, VAR_13=status_code, VAR_30=current_tags, VAR_31=\n current_dependencies, VAR_32=summary, VAR_33=description, VAR_34=\n response_description, VAR_35=combined_responses, VAR_36=deprecated or\n self.deprecated, VAR_37=methods, VAR_38=operation_id, VAR_16=\n response_model_include, VAR_17=response_model_exclude, VAR_18=\n response_model_by_alias, VAR_19=response_model_exclude_unset, VAR_20=\n response_model_exclude_defaults, VAR_21=response_model_exclude_none,\n VAR_39=include_in_schema and self.include_in_schema, VAR_14=\n current_response_class, VAR_28=name, VAR_22=self.\n dependency_overrides_provider, VAR_40=current_callbacks)\n", "self.routes.append(VAR_65)\n" ]
[ "def add_api_route(self, path: str, endpoint: Callable[..., Any], *,...\n", "route_class = route_class_override or self.route_class\n", "responses = responses or {}\n", "combined_responses = {**self.responses, **responses}\n", "current_response_class = get_value_or_default(response_class, self.\n default_response_class)\n", "current_tags = self.tags.copy()\n", "if tags:\n", "current_tags.extend(tags)\n", "current_dependencies = self.dependencies.copy()\n", "if dependencies:\n", "current_dependencies.extend(dependencies)\n", "current_callbacks = self.callbacks.copy()\n", "if callbacks:\n", "current_callbacks.extend(callbacks)\n", "route = route_class(self.prefix + path, endpoint=endpoint, response_model=\n response_model, status_code=status_code, tags=current_tags,\n dependencies=current_dependencies, summary=summary, description=\n description, response_description=response_description, responses=\n combined_responses, deprecated=deprecated or self.deprecated, methods=\n methods, operation_id=operation_id, response_model_include=\n response_model_include, response_model_exclude=response_model_exclude,\n response_model_by_alias=response_model_by_alias,\n response_model_exclude_unset=response_model_exclude_unset,\n response_model_exclude_defaults=response_model_exclude_defaults,\n response_model_exclude_none=response_model_exclude_none,\n include_in_schema=include_in_schema and self.include_in_schema,\n response_class=current_response_class, name=name,\n dependency_overrides_provider=self.dependency_overrides_provider,\n callbacks=current_callbacks)\n", "self.routes.append(route)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_20):...\n", "super().__init__(VAR_20)\n", "if self.param.form_type == 'text':\n", "self.link_name = request.form[self.key]\n", "self.file_suffix = '.out'\n", "self.file_suffix = request.form[self.key]\n" ]
[ "def __init__(self, fimeta):...\n", "super().__init__(fimeta)\n", "if self.param.form_type == 'text':\n", "self.link_name = request.form[self.key]\n", "self.file_suffix = '.out'\n", "self.file_suffix = request.form[self.key]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "For", "Assign'", "Assign'", "Assign'" ]
[ "@default('access_token')...\n", "return os.getenv('GITHUB_ACCESS_TOKEN', '')\n" ]
[ "@default('access_token')...\n", "return os.getenv('GITHUB_ACCESS_TOKEN', '')\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@CLASS_4('history')...\n", "\"\"\"docstring\"\"\"\n", "if VAR_3.path() == '/data':\n", "return 'text/html', jinja.render('history.html', title='History',\n gap_interval=config.val.history_gap_interval)\n", "VAR_6 = QUrlQuery(VAR_3).queryItemValue('offset')\n", "VAR_5 = QUrlQuery(VAR_3).queryItemValue('start_time')\n", "return 'text/html', json.dumps(FUNC_3(VAR_5, VAR_6))\n", "VAR_6 = int(VAR_6) if VAR_6 else None\n", "VAR_5 = float(VAR_5) if VAR_5 else time.time()\n" ]
[ "@add_handler('history')...\n", "\"\"\"docstring\"\"\"\n", "if url.path() == '/data':\n", "return 'text/html', jinja.render('history.html', title='History',\n gap_interval=config.val.history_gap_interval)\n", "offset = QUrlQuery(url).queryItemValue('offset')\n", "start_time = QUrlQuery(url).queryItemValue('start_time')\n", "return 'text/html', json.dumps(history_data(start_time, offset))\n", "offset = int(offset) if offset else None\n", "start_time = float(start_time) if start_time else time.time()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Return'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'" ]