lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_8(self, VAR_13):...\n", "self.cursor.execute('SELECT * FROM log_' + VAR_13 + ' WHERE result_id=? ',\n [self.result['id']])\n", "return self.cursor.fetchall()\n" ]
[ "def get_item(self, item):...\n", "self.cursor.execute('SELECT * FROM log_' + item + ' WHERE result_id=? ', [\n self.result['id']])\n", "return self.cursor.fetchall()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self\n", "VAR_12 = []\n", "@api.require(lambda : False)...\n", "VAR_6.fail('Handler code should not be called')\n", "def FUNC_37(self, VAR_29):...\n", "VAR_12.append('authorization_error')\n", "super(CLASS_7, self).authorization_error(VAR_29)\n", "VAR_7 = self.make_test_app('/request', CLASS_7)\n", "VAR_15 = VAR_7.get('/request', expect_errors=True)\n", "self.assertEqual(['authorization_error'], VAR_12)\n", "self.assertEqual(403, VAR_15.status_int)\n" ]
[ "def test_authorization_error(self):...\n", "\"\"\"docstring\"\"\"\n", "test = self\n", "calls = []\n", "@api.require(lambda : False)...\n", "test.fail('Handler code should not be called')\n", "def authorization_error(self, err):...\n", "calls.append('authorization_error')\n", "super(Handler, self).authorization_error(err)\n", "app = self.make_test_app('/request', Handler)\n", "response = app.get('/request', expect_errors=True)\n", "self.assertEqual(['authorization_error'], calls)\n", "self.assertEqual(403, response.status_int)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_6(*VAR_16, **VAR_17):...\n", "return VAR_15.translate(VAR_1(*VAR_16, **kwargs))\n" ]
[ "def auto_translate(*args, **kwargs):...\n", "return localizer.translate(translation_string_factory(*args, **kwargs))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, *VAR_10, **VAR_11):...\n", "VAR_18 = []\n", "VAR_19 = {'widget': self.widget, 'max_length': VAR_11.pop('max_length', None)}\n", "self.scheme_name = VAR_11.pop('scheme')\n", "self.scheme = PERSON_NAME_SCHEMES.get(self.scheme_name)\n", "self.one_required = VAR_11.get('required', True)\n", "VAR_20 = VAR_11.pop('require_all_fields', False)\n", "VAR_11['required'] = False\n", "VAR_11['widget'] = (VAR_11.get('widget') or self.widget)(VAR_2=self.scheme,\n VAR_3=self, **kwargs.pop('widget_kwargs', {}))\n", "VAR_19.update(**kwargs)\n", "for VAR_31, VAR_32, VAR_33 in self.scheme['fields']:\n", "VAR_19['label'] = VAR_32\n", "super().__init__(*VAR_10, VAR_18=fields, VAR_20=False, **kwargs)\n", "VAR_3 = forms.CharField(**defaults)\n", "self.require_all_fields = VAR_20\n", "VAR_3.part_name = VAR_31\n", "self.required = self.one_required\n", "VAR_18.append(VAR_3)\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "fields = []\n", "defaults = {'widget': self.widget, 'max_length': kwargs.pop('max_length', None)\n }\n", "self.scheme_name = kwargs.pop('scheme')\n", "self.scheme = PERSON_NAME_SCHEMES.get(self.scheme_name)\n", "self.one_required = kwargs.get('required', True)\n", "require_all_fields = kwargs.pop('require_all_fields', False)\n", "kwargs['required'] = False\n", "kwargs['widget'] = (kwargs.get('widget') or self.widget)(scheme=self.scheme,\n field=self, **kwargs.pop('widget_kwargs', {}))\n", "defaults.update(**kwargs)\n", "for fname, label, size in self.scheme['fields']:\n", "defaults['label'] = label\n", "super().__init__(*args, fields=fields, require_all_fields=False, **kwargs)\n", "field = forms.CharField(**defaults)\n", "self.require_all_fields = require_all_fields\n", "field.part_name = fname\n", "self.required = self.one_required\n", "fields.append(field)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "For", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_4(VAR_11):...\n", "VAR_17 = []\n", "for r in VAR_11:\n", "VAR_18 = {'value': r[0], 'description': ', '.join(unique(cstr(d) for d in r if\n d)[1:])}\n", "return VAR_17\n", "VAR_17.append(VAR_18)\n" ]
[ "def build_for_autosuggest(res):...\n", "results = []\n", "for r in res:\n", "out = {'value': r[0], 'description': ', '.join(unique(cstr(d) for d in r if\n d)[1:])}\n", "return results\n", "results.append(out)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_7(self):...\n", "VAR_13 = FUNC_0(self.groups['path'])\n", "if self.groups['path'] != VAR_13:\n", "self.response.headers.set('Location', self.remote + VAR_13)\n", "self.filename = self.local + urllib.parse.unquote(self.groups['path'])\n", "return 307, ''\n", "return VAR_5.respond(self)\n" ]
[ "def respond(self):...\n", "norm_request = normpath(self.groups['path'])\n", "if self.groups['path'] != norm_request:\n", "self.response.headers.set('Location', self.remote + norm_request)\n", "self.filename = self.local + urllib.parse.unquote(self.groups['path'])\n", "return 307, ''\n", "return handler.respond(self)\n" ]
[ 0, 0, 0, 0, 1, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Assign'", "Return'", "Return'" ]
[ "def FUNC_10(self, VAR_12):...\n", "VAR_33 = super().get_transform(VAR_12)\n", "if VAR_33:\n", "return VAR_33\n", "return CLASS_18(VAR_12)\n" ]
[ "def get_transform(self, name):...\n", "transform = super().get_transform(name)\n", "if transform:\n", "return transform\n", "return JsonKeyTransformFactory(name)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def __init__(self, VAR_0, VAR_1, VAR_2=None):...\n", "GenericRequest.__init__(self, VAR_0, VAR_2)\n", "self.submission_id = VAR_1\n", "self.url = '%ssubmission/%s' % (self.base_url, VAR_1)\n" ]
[ "def __init__(self, browser, submission_id, base_url=None):...\n", "GenericRequest.__init__(self, browser, base_url)\n", "self.submission_id = submission_id\n", "self.url = '%ssubmission/%s' % (self.base_url, submission_id)\n" ]
[ 0, 0, 0, 5 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_4(self, VAR_1, VAR_2, VAR_5, VAR_10=None, VAR_11=False, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_10:\n", "VAR_10 = []\n", "if VAR_4 is None:\n", "VAR_4 = {}\n", "VAR_29 = {}\n", "for VAR_48 in VAR_5:\n", "VAR_29[VAR_48] = {}.fromkeys(VAR_10, 0.0)\n", "for VAR_55 in VAR_10:\n", "VAR_49 = VAR_4.copy()\n", "return VAR_29\n", "if VAR_55 == 'qty_available':\n", "VAR_49.update({'states': ('done',), 'what': ('in', 'out')})\n", "if VAR_55 == 'virtual_available':\n", "VAR_49.update({'states': ('confirmed', 'waiting', 'assigned', 'done'),\n 'what': ('in', 'out')})\n", "if VAR_55 == 'incoming_qty':\n", "VAR_49.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': ('in',)}\n )\n", "if VAR_55 == 'outgoing_qty':\n", "VAR_49.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': (\n 'out',)})\n", "VAR_50 = self.get_product_available(VAR_1, VAR_2, VAR_5, VAR_4=c)\n", "for VAR_48 in VAR_5:\n", "VAR_29[VAR_48][VAR_55] = VAR_50.get(VAR_48, 0.0)\n" ]
[ "def _product_available(self, cr, uid, ids, field_names=None, arg=False,...\n", "\"\"\"docstring\"\"\"\n", "if not field_names:\n", "field_names = []\n", "if context is None:\n", "context = {}\n", "res = {}\n", "for id in ids:\n", "res[id] = {}.fromkeys(field_names, 0.0)\n", "for f in field_names:\n", "c = context.copy()\n", "return res\n", "if f == 'qty_available':\n", "c.update({'states': ('done',), 'what': ('in', 'out')})\n", "if f == 'virtual_available':\n", "c.update({'states': ('confirmed', 'waiting', 'assigned', 'done'), 'what': (\n 'in', 'out')})\n", "if f == 'incoming_qty':\n", "c.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': ('in',)})\n", "if f == 'outgoing_qty':\n", "c.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': ('out',)})\n", "stock = self.get_product_available(cr, uid, ids, context=c)\n", "for id in ids:\n", "res[id][f] = stock.get(id, 0.0)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "For", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "For", "Assign'" ]
[ "@app.route('/api/sequences', methods=['GET'])...\n", "return [x.to_map() for x in controller.sequences]\n" ]
[ "@app.route('/api/sequences', methods=['GET'])...\n", "return [x.to_map() for x in controller.sequences]\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_6(self, VAR_11):...\n", "self._portal = VAR_11\n" ]
[ "def set_portal(self, portal):...\n", "self._portal = portal\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_25(self, VAR_10, VAR_9, VAR_6):...\n", "assert self.dbsession is not None, 'Missing dbsession'\n", "VAR_3 = self.dbsession()\n", "VAR_15 = VAR_3.query(VAR_10).options(undefer_group('edit')).filter(getattr(\n VAR_10, self.id_key) == VAR_9).scalar()\n", "if VAR_15 is None:\n", "VAR_15.__name__ = VAR_6\n", "return VAR_15\n" ]
[ "def _get_item(self, klass, key, object_name):...\n", "assert self.dbsession is not None, 'Missing dbsession'\n", "dbsession = self.dbsession()\n", "obj = dbsession.query(klass).options(undefer_group('edit')).filter(getattr(\n klass, self.id_key) == key).scalar()\n", "if obj is None:\n", "obj.__name__ = object_name\n", "return obj\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assert'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_3, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = 'string'\n", "VAR_3.execute(VAR_7 % VAR_4)\n", "return VAR_3.fetchone()[0]\n" ]
[ "def option_ispreset(cursor, option):...\n", "\"\"\"docstring\"\"\"\n", "query = \"\"\"\n SELECT EXISTS\n (SELECT 1\n FROM pg_settings\n WHERE context = 'internal'\n AND name = '%s')\n \"\"\"\n", "cursor.execute(query % option)\n", "return cursor.fetchone()[0]\n" ]
[ 0, 0, 4, 4, 4 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_20(self, VAR_19, VAR_20):...\n", "\"\"\"docstring\"\"\"\n", "for clause in reversed(self.order):\n", "VAR_40 = VAR_20.has_wildcards() - VAR_19.has_wildcards()\n", "VAR_51 = clause.index(VAR_19.name)\n", "if VAR_40 != 0:\n", "VAR_52 = clause.index(VAR_20.name)\n", "return VAR_40\n", "return 0\n", "VAR_39 = VAR_52 - VAR_51\n", "if VAR_39 < 0:\n", "VAR_39 = -1\n", "if VAR_39 > 0:\n", "return VAR_39\n", "VAR_39 = 1\n" ]
[ "def compare(self, rule1, rule2):...\n", "\"\"\"docstring\"\"\"\n", "for clause in reversed(self.order):\n", "wildcard_cmp = rule2.has_wildcards() - rule1.has_wildcards()\n", "i = clause.index(rule1.name)\n", "if wildcard_cmp != 0:\n", "j = clause.index(rule2.name)\n", "return wildcard_cmp\n", "return 0\n", "comp = j - i\n", "if comp < 0:\n", "comp = -1\n", "if comp > 0:\n", "return comp\n", "comp = 1\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Assign'" ]
[ "def FUNC_0(VAR_0, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_0.round_numbered(VAR_1)\n" ]
[ "def get_round_or_404(tournament, round_num):...\n", "\"\"\"docstring\"\"\"\n", "return tournament.round_numbered(round_num)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_22(self):...\n", "return bool(self._latest_file_parse_request and self.\n _latest_file_parse_request.Done())\n" ]
[ "def DiagnosticsForCurrentFileReady(self):...\n", "return bool(self._latest_file_parse_request and self.\n _latest_file_parse_request.Done())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_6():...\n", "VAR_2.test_locals = dict()\n", "VAR_2.test_locals.update(VAR_8.__dict__)\n", "exec(VAR_3, VAR_2.test_locals)\n" ]
[ "def exec_test():...\n", "step.test_locals = dict()\n", "step.test_locals.update(module.__dict__)\n", "exec(code, step.test_locals)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_2(VAR_34):...\n", "VAR_15.pack_forget()\n", "VAR_10.pack(expand=True, fill='both')\n", "VAR_9.pack_forget()\n", "VAR_39 = 'meal_planner.db'\n", "print(VAR_34)\n", "VAR_48 = conn.cursor()\n", "VAR_49 = VAR_48.execute('SELECT * FROM recipe WHERE name = ' + '\"' + VAR_34 +\n '\"')\n", "for result in [VAR_49]:\n", "for VAR_32 in result.fetchall():\n", "Label(VAR_10, text=string, font=MEDIUM_FONT, bg='#f8f8f8', fg='#000000').pack(\n side=TOP)\n", "VAR_51 = VAR_32[0]\n", "Label(VAR_10, text=secondString, font=MEDIUM_FONT, bg='#f8f8f8', fg='#000000'\n ).pack(side=TOP)\n", "VAR_52 = VAR_32[1]\n", "Label(VAR_10, text=thirdString, font=MEDIUM_FONT, bg='#f8f8f8', fg='#000000'\n ).pack(side=TOP)\n", "VAR_53 = VAR_32[2]\n", "VAR_42 = Button(VAR_4, text='Return to Menu', highlightbackground='#e7e7e7',\n command=lambda : [viewRecipeFrame.pack_forget(), menu.pack(),\n returnButton.pack_forget(), label.configure(text='Meal Planer'),\n groceryButton.pack(side=RIGHT)])\n", "VAR_30 = VAR_32[4]\n", "VAR_42.pack(side=RIGHT)\n", "VAR_54 = VAR_32[5]\n", "VAR_55 = \"\"\"Name: {} \n Cook time: {} \n Number of Servings: {} \n \"\"\".format(\n VAR_51, VAR_52, VAR_53)\n", "VAR_56 = 'Ingredients: {}'.format(VAR_30)\n", "VAR_57 = 'Directions: {}'.format(VAR_54)\n" ]
[ "def callback(recipeName):...\n", "menu.pack_forget()\n", "viewRecipeFrame.pack(expand=True, fill='both')\n", "groceryButton.pack_forget()\n", "database_file = 'meal_planner.db'\n", "print(recipeName)\n", "cursor = conn.cursor()\n", "selection = cursor.execute('SELECT * FROM recipe WHERE name = ' + '\"' +\n recipeName + '\"')\n", "for result in [selection]:\n", "for row in result.fetchall():\n", "Label(viewRecipeFrame, text=string, font=MEDIUM_FONT, bg='#f8f8f8', fg=\n '#000000').pack(side=TOP)\n", "name = row[0]\n", "Label(viewRecipeFrame, text=secondString, font=MEDIUM_FONT, bg='#f8f8f8',\n fg='#000000').pack(side=TOP)\n", "time = row[1]\n", "Label(viewRecipeFrame, text=thirdString, font=MEDIUM_FONT, bg='#f8f8f8', fg\n ='#000000').pack(side=TOP)\n", "servings = row[2]\n", "returnButton = Button(menuFrame, text='Return to Menu', highlightbackground\n ='#e7e7e7', command=lambda : [viewRecipeFrame.pack_forget(), menu.pack(\n ), returnButton.pack_forget(), label.configure(text='Meal Planer'),\n groceryButton.pack(side=RIGHT)])\n", "ingredients = row[4]\n", "returnButton.pack(side=RIGHT)\n", "directions = row[5]\n", "string = \"\"\"Name: {} \n Cook time: {} \n Number of Servings: {} \n \"\"\".format(name\n , time, servings)\n", "secondString = 'Ingredients: {}'.format(ingredients)\n", "thirdString = 'Directions: {}'.format(directions)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "For", "For", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = self.add_argument_group('ParlAI Model Arguments')\n", "VAR_28.add_argument('-m', '--model', default=None, help=\n 'the model class name. can match parlai/agents/<model> for agents in that directory, or can provide a fully specified module for `from X import Y` via `-m X:Y` (e.g. `-m parlai.agents.seq2seq.seq2seq:Seq2SeqAgent`)'\n )\n", "VAR_28.add_argument('-mf', '--model-file', default=None, help=\n 'model file name for loading and saving models')\n", "VAR_28.add_argument('--dict-class', help=\n 'the class of the dictionary agent uses')\n" ]
[ "def add_model_args(self):...\n", "\"\"\"docstring\"\"\"\n", "model_args = self.add_argument_group('ParlAI Model Arguments')\n", "model_args.add_argument('-m', '--model', default=None, help=\n 'the model class name. can match parlai/agents/<model> for agents in that directory, or can provide a fully specified module for `from X import Y` via `-m X:Y` (e.g. `-m parlai.agents.seq2seq.seq2seq:Seq2SeqAgent`)'\n )\n", "model_args.add_argument('-mf', '--model-file', default=None, help=\n 'model file name for loading and saving models')\n", "model_args.add_argument('--dict-class', help=\n 'the class of the dictionary agent uses')\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_13(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.run_tracker.background_worker_pool()\n" ]
[ "def background_worker_pool(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.run_tracker.background_worker_pool()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_12(self, VAR_2, VAR_17, VAR_18, VAR_3=None):...\n", "VAR_36 = FUNC_0(VAR_2, VAR_3)\n" ]
[ "def _raise_error(self, status_code, operation, result_msg, error_code=None):...\n", "error = http_error_to_exception(status_code, error_code)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_4(VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16=None,...\n", "\"\"\"docstring\"\"\"\n", "VAR_33, VAR_34 = VAR_14\n", "VAR_35 = glob.glob(os.path.join(VAR_10, VAR_12, VAR_13, VAR_11, '*.tif'))\n", "VAR_35 = FUNC_0(FUNC_1(VAR_35, VAR_4=decade_begin, VAR_5=decade_end, VAR_1=\n '_', VAR_3=-1))\n", "VAR_36 = pd.Series(VAR_35).groupby([os.path.basename(i).split('_')[-2] for\n i in VAR_35])\n", "VAR_36 = {i: j.tolist() for i, j in VAR_36}\n", "VAR_37 = {}\n", "for VAR_59 in VAR_36:\n", "VAR_32 = VAR_36[VAR_59]\n", "return {'_'.join([VAR_12, VAR_13, VAR_11, VAR_16, VAR_58(VAR_33), VAR_58(\n VAR_34)]): VAR_37}\n", "VAR_31 = [fn.replace(VAR_12, '5ModelAvg') for fn in VAR_32]\n", "VAR_8 = zip(VAR_31, VAR_32)\n", "VAR_54 = mp.Pool(VAR_17)\n", "VAR_55 = np.array(VAR_54.map(FUNC_3, VAR_8))\n", "VAR_54.close()\n", "VAR_54.join()\n", "VAR_54.terminate()\n", "VAR_54 = None\n", "VAR_56 = np.mean(VAR_55, axis=0)\n", "VAR_55 = None\n", "VAR_57 = np.ma.masked_array(VAR_56, VAR_15 == 0)\n", "VAR_37[VAR_58(VAR_59)] = {'stdev': VAR_58(np.std(VAR_57)), 'mean': VAR_58(\n np.mean(VAR_57)), 'min': VAR_58(np.min(VAR_57)), 'max': VAR_58(np.max(\n VAR_57))}\n", "if VAR_16 == None:\n", "VAR_16, = VAR_58(np.unique(VAR_15 > 0))\n" ]
[ "def get_metrics(base_path, variable, model, scenario, decade, mask,...\n", "\"\"\"docstring\"\"\"\n", "decade_begin, decade_end = decade\n", "modeled_files = glob.glob(os.path.join(base_path, model, scenario, variable,\n '*.tif'))\n", "modeled_files = sort_files(only_years(modeled_files, begin=decade_begin,\n end=decade_end, split_on='_', elem_year=-1))\n", "month_grouped = pd.Series(modeled_files).groupby([os.path.basename(i).split\n ('_')[-2] for i in modeled_files])\n", "month_grouped = {i: j.tolist() for i, j in month_grouped}\n", "month_dict = {}\n", "for month in month_grouped:\n", "modeled = month_grouped[month]\n", "return {'_'.join([model, scenario, variable, domain_name, str(decade_begin),\n str(decade_end)]): month_dict}\n", "baseline = [fn.replace(model, '5ModelAvg') for fn in modeled]\n", "args = zip(baseline, modeled)\n", "pool = mp.Pool(ncpus)\n", "arr = np.array(pool.map(wrap_diff, args))\n", "pool.close()\n", "pool.join()\n", "pool.terminate()\n", "pool = None\n", "mean_arr = np.mean(arr, axis=0)\n", "arr = None\n", "masked = np.ma.masked_array(mean_arr, mask == 0)\n", "month_dict[str(month)] = {'stdev': str(np.std(masked)), 'mean': str(np.mean\n (masked)), 'min': str(np.min(masked)), 'max': str(np.max(masked))}\n", "if domain_name == None:\n", "domain_name, = str(np.unique(mask > 0))\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 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_5(self):...\n", "self._tab_after(' s')\n", "eq_(self.terminal.method_calls, [('write', ('et ',), {})])\n" ]
[ "def test_command_completion_spaces(self):...\n", "self._tab_after(' s')\n", "eq_(self.terminal.method_calls, [('write', ('et ',), {})])\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "VAR_5['clusterName'] = self.configuration.san_clustername\n", "if self.configuration.san_thin_provision:\n", "VAR_5['thinProvision'] = '1'\n", "VAR_5['thinProvision'] = '0'\n", "VAR_5['volumeName'] = VAR_10['name']\n", "if int(VAR_10['size']) == 0:\n", "VAR_5['size'] = '100MB'\n", "VAR_5['size'] = '%sGB' % VAR_10['size']\n", "self._cliq_run_xml('createVolume', VAR_5)\n", "VAR_27 = self._cliq_get_volume_info(VAR_10['name'])\n", "VAR_8 = VAR_27['volume.clusterName']\n", "VAR_28 = VAR_27['volume.iscsiIqn']\n", "VAR_29 = '1'\n", "if not self.cluster_vip:\n", "self.cluster_vip = self._cliq_get_cluster_vip(VAR_8)\n", "VAR_30 = self.cluster_vip + ':3260,' + VAR_29\n", "VAR_31 = {}\n", "VAR_31['provider_location'] = '%s %s %s' % (VAR_30, VAR_28, 0)\n", "return VAR_31\n" ]
[ "def create_volume(self, volume):...\n", "\"\"\"docstring\"\"\"\n", "cliq_args = {}\n", "cliq_args['clusterName'] = self.configuration.san_clustername\n", "if self.configuration.san_thin_provision:\n", "cliq_args['thinProvision'] = '1'\n", "cliq_args['thinProvision'] = '0'\n", "cliq_args['volumeName'] = volume['name']\n", "if int(volume['size']) == 0:\n", "cliq_args['size'] = '100MB'\n", "cliq_args['size'] = '%sGB' % volume['size']\n", "self._cliq_run_xml('createVolume', cliq_args)\n", "volume_info = self._cliq_get_volume_info(volume['name'])\n", "cluster_name = volume_info['volume.clusterName']\n", "iscsi_iqn = volume_info['volume.iscsiIqn']\n", "cluster_interface = '1'\n", "if not self.cluster_vip:\n", "self.cluster_vip = self._cliq_get_cluster_vip(cluster_name)\n", "iscsi_portal = self.cluster_vip + ':3260,' + cluster_interface\n", "model_update = {}\n", "model_update['provider_location'] = '%s %s %s' % (iscsi_portal, iscsi_iqn, 0)\n", "return model_update\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'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_6(self, VAR_44=None):...\n", "if not VAR_101.user_is_loggedin:\n", "if VAR_44 is not None and not valid_password(VAR_101.user, VAR_44):\n", "VAR_101.errors.add(errors.WRONG_PASSWORD)\n" ]
[ "def run(self, password=None):...\n", "if not c.user_is_loggedin:\n", "if password is not None and not valid_password(c.user, password):\n", "c.errors.add(errors.WRONG_PASSWORD)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Expr'" ]
[ "def FUNC_1():...\n", "if not os.path.isfile(VAR_0):\n", "VAR_9 = lite.connect(VAR_0)\n", "VAR_7 = VAR_9.cursor()\n" ]
[ "def check_files():...\n", "if not os.path.isfile(DATABASE_PATH):\n", "conn = lite.connect(DATABASE_PATH)\n", "c = conn.cursor()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_5(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.bindings\n", "VAR_6 = VAR_1['TEST_APP_COMPONENT_NAME']\n", "VAR_7 = '{0}/targetPools/{1}-tp'.format(VAR_1['TEST_GCE_REGION'], VAR_6)\n", "VAR_8 = {'checkIntervalSec': 9, 'healthyThreshold': 3, 'unhealthyThreshold':\n 5, 'timeoutSec': 2, 'port': 80}\n", "VAR_9 = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'provider': 'gce', 'stack': bindings['TEST_STACK'], 'detail':\n bindings['TEST_COMPONENT_DETAIL'], 'credentials': bindings[\n 'GCE_CREDENTIALS'], 'region': bindings['TEST_GCE_REGION'], 'ipProtocol':\n 'TCP', 'portRange': spec['port'], 'loadBalancerName':\n load_balancer_name, 'healthCheck': {'port': spec['port'], 'timeoutSec':\n spec['timeoutSec'], 'checkIntervalSec': spec['checkIntervalSec'],\n 'healthyThreshold': spec['healthyThreshold'], 'unhealthyThreshold':\n spec['unhealthyThreshold']}, 'type': 'upsertLoadBalancer',\n 'availabilityZones': {bindings['TEST_GCE_REGION']: []}, 'user':\n '[anonymous]'}], description='Create Load Balancer: ' +\n load_balancer_name, application=self.TEST_APP)\n", "VAR_10 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_10.new_clause_builder('Health Check Added', retryable_for_secs=30\n ).list_resources('http-health-checks').contains_pred_list([jc.\n PathContainsPredicate('name', '%s-hc' % VAR_6), jc.DICT_SUBSET(VAR_8)])\n", "VAR_10.new_clause_builder('Target Pool Added', retryable_for_secs=30\n ).list_resources('target-pools').contains_path_value('name', '%s-tp' %\n VAR_6)\n", "VAR_10.new_clause_builder('Forwarding Rules Added', retryable_for_secs=30\n ).list_resources('forwarding-rules').contains_pred_list([jc.\n PathContainsPredicate('name', VAR_6), jc.PathContainsPredicate('target',\n VAR_7)])\n", "return st.OperationContract(self.new_post_operation(title=\n 'upsert_load_balancer', data=payload, path='tasks'), VAR_5=builder.build())\n" ]
[ "def upsert_load_balancer(self):...\n", "\"\"\"docstring\"\"\"\n", "bindings = self.bindings\n", "load_balancer_name = bindings['TEST_APP_COMPONENT_NAME']\n", "target_pool_name = '{0}/targetPools/{1}-tp'.format(bindings[\n 'TEST_GCE_REGION'], load_balancer_name)\n", "spec = {'checkIntervalSec': 9, 'healthyThreshold': 3, 'unhealthyThreshold':\n 5, 'timeoutSec': 2, 'port': 80}\n", "payload = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'provider': 'gce', 'stack': bindings['TEST_STACK'], 'detail':\n bindings['TEST_COMPONENT_DETAIL'], 'credentials': bindings[\n 'GCE_CREDENTIALS'], 'region': bindings['TEST_GCE_REGION'], 'ipProtocol':\n 'TCP', 'portRange': spec['port'], 'loadBalancerName':\n load_balancer_name, 'healthCheck': {'port': spec['port'], 'timeoutSec':\n spec['timeoutSec'], 'checkIntervalSec': spec['checkIntervalSec'],\n 'healthyThreshold': spec['healthyThreshold'], 'unhealthyThreshold':\n spec['unhealthyThreshold']}, 'type': 'upsertLoadBalancer',\n 'availabilityZones': {bindings['TEST_GCE_REGION']: []}, 'user':\n '[anonymous]'}], description='Create Load Balancer: ' +\n load_balancer_name, application=self.TEST_APP)\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Health Check Added', retryable_for_secs=30\n ).list_resources('http-health-checks').contains_pred_list([jc.\n PathContainsPredicate('name', '%s-hc' % load_balancer_name), jc.\n DICT_SUBSET(spec)])\n", "builder.new_clause_builder('Target Pool Added', retryable_for_secs=30\n ).list_resources('target-pools').contains_path_value('name', '%s-tp' %\n load_balancer_name)\n", "builder.new_clause_builder('Forwarding Rules Added', retryable_for_secs=30\n ).list_resources('forwarding-rules').contains_pred_list([jc.\n PathContainsPredicate('name', load_balancer_name), jc.\n PathContainsPredicate('target', target_pool_name)])\n", "return st.OperationContract(self.new_post_operation(title=\n 'upsert_load_balancer', data=payload, path='tasks'), contract=builder.\n build())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_2(VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = FUNC_1(VAR_4)\n", "VAR_7 = pd.read_csv(\n 'https://projects.fivethirtyeight.com/soccer-api/club/spi_matches.csv'\n ).drop(columns=['league_id'])\n", "VAR_7['date'] = pd.to_datetime(VAR_7['date'], format='%Y-%m-%d')\n", "VAR_8 = [VAR_1[league_id] for league_id in VAR_4]\n", "VAR_7 = VAR_7[VAR_7['league'].isin(VAR_8)]\n", "VAR_9 = {league: league_id for league_id, league in VAR_1.items()}\n", "VAR_7['league'] = VAR_7['league'].apply(lambda league: VAR_9[league])\n", "VAR_10 = ~VAR_7['score1'].isna() & ~VAR_7['score2'].isna()\n", "VAR_11, VAR_12 = VAR_7[VAR_10], VAR_7[~VAR_10]\n", "for VAR_48, VAR_50 in zip(['spi_historical', 'spi_fixtures'], [VAR_11, VAR_12]\n", "VAR_50.to_sql(VAR_48, VAR_0, index=False, if_exists='replace')\n" ]
[ "def create_spi_tables(leagues_ids):...\n", "\"\"\"docstring\"\"\"\n", "leagues_ids = check_leagues_ids(leagues_ids)\n", "spi = pd.read_csv(\n 'https://projects.fivethirtyeight.com/soccer-api/club/spi_matches.csv'\n ).drop(columns=['league_id'])\n", "spi['date'] = pd.to_datetime(spi['date'], format='%Y-%m-%d')\n", "leagues = [LEAGUES_MAPPING[league_id] for league_id in leagues_ids]\n", "spi = spi[spi['league'].isin(leagues)]\n", "inverse_leagues_mapping = {league: league_id for league_id, league in\n LEAGUES_MAPPING.items()}\n", "spi['league'] = spi['league'].apply(lambda league: inverse_leagues_mapping[\n league])\n", "mask = ~spi['score1'].isna() & ~spi['score2'].isna()\n", "spi_historical, spi_fixtures = spi[mask], spi[~mask]\n", "for name, df in zip(['spi_historical', 'spi_fixtures'], [spi_historical,\n", "df.to_sql(name, DB_CONNECTION, index=False, if_exists='replace')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'" ]
[ "@login_required...\n", "if VAR_14.method == 'POST':\n", "VAR_20 = int(VAR_14.POST['revision'])\n", "return HttpResponseNotAllowed(['POST'])\n", "VAR_27 = {'title': VAR_19}\n", "VAR_8 = None\n", "if VAR_3 is not None:\n", "VAR_8 = get_object_or_404(VAR_5, **{group_slug_field: group_slug})\n", "VAR_46 = VAR_47 = True\n", "VAR_27.update({'content_type': get_ct(VAR_8), 'object_id': VAR_8.id})\n", "if not (VAR_46 or VAR_47):\n", "VAR_46 = FUNC_3(VAR_14.user, VAR_8, VAR_12, VAR_13)\n", "return HttpResponseForbidden()\n", "VAR_28 = get_object_or_404(VAR_2, **article_args)\n", "VAR_47 = FUNC_4(VAR_14.user, VAR_8, VAR_12)\n", "VAR_56 = VAR_28.changeset_set.filter(VAR_20=revision + 1).get().old_title\n", "VAR_62 = Article.objects.exclude(pk=article.pk).get(VAR_19=old_title)\n", "if VAR_14.user.is_authenticated():\n", "messages.error(VAR_14, \n \"Reverting not possible because an article with name '%s' already exists\" %\n VAR_56)\n", "VAR_28.revert_to(VAR_20, get_real_ip(VAR_14), VAR_14.user)\n", "VAR_28.revert_to(VAR_20, get_real_ip(VAR_14))\n", "return redirect(VAR_28)\n", "return redirect(VAR_28)\n" ]
[ "@login_required...\n", "if request.method == 'POST':\n", "revision = int(request.POST['revision'])\n", "return HttpResponseNotAllowed(['POST'])\n", "article_args = {'title': title}\n", "group = None\n", "if group_slug is not None:\n", "group = get_object_or_404(group_qs, **{group_slug_field: group_slug})\n", "allow_read = allow_write = True\n", "article_args.update({'content_type': get_ct(group), 'object_id': group.id})\n", "if not (allow_read or allow_write):\n", "allow_read = has_read_perm(request.user, group, is_member, is_private)\n", "return HttpResponseForbidden()\n", "article = get_object_or_404(article_qs, **article_args)\n", "allow_write = has_write_perm(request.user, group, is_member)\n", "old_title = article.changeset_set.filter(revision=revision + 1).get().old_title\n", "art = Article.objects.exclude(pk=article.pk).get(title=old_title)\n", "if request.user.is_authenticated():\n", "messages.error(request, \n \"Reverting not possible because an article with name '%s' already exists\" %\n old_title)\n", "article.revert_to(revision, get_real_ip(request), request.user)\n", "article.revert_to(revision, get_real_ip(request))\n", "return redirect(article)\n", "return redirect(article)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_7(self, VAR_14):...\n", "" ]
[ "def is_image(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_18(self, VAR_19, VAR_20):...\n", "self.cursor.execute(\n 'update store set storename = \"%s\" where storeid = \"%s\"' % (VAR_20, VAR_19)\n )\n", "self.connection.commit()\n" ]
[ "def update_store(self, storeid, storename):...\n", "self.cursor.execute(\n 'update store set storename = \"%s\" where storeid = \"%s\"' % (storename,\n storeid))\n", "self.connection.commit()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "@property...\n", "return self.meta.get('Iptc.Application2.Headline').value\n" ]
[ "@property...\n", "return self.meta.get('Iptc.Application2.Headline').value\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_0():...\n", "VAR_1 = tornado.web.Application([('^/$', module_index.MainframeHandler), (\n '/static/.*', module_static.StaticHandler), ('^/home', module_home.\n HomeHandler), ('^/files/?()$', module_files.FilesListHandler), (\n '^/files/list/(.*)', module_files.FilesListHandler), (\n '^/files/download/(.*)/(.*)/?$', module_files.FilesDownloadHandler), (\n '^/files/upload/(.*)/(.*)$', module_files.FilesUploadHandler), (\n '^/files/operation/?', module_files.FilesOperationHandler), ('.*',\n module_error404.Error404Handler)], xsrf_cookies=False)\n", "VAR_2 = tornado.netutil.bind_sockets(const.get_const('server-port'), family\n =socket.AF_INET)\n", "if const.get_const('server-threads') > 1:\n", "if hasattr(os, 'fork'):\n", "VAR_3 = tornado.httpserver.HTTPServer(VAR_1, xheaders=True)\n", "tornado.process.fork_processes(const.get_const('server-threads') - 1)\n", "VAR_3.add_sockets(VAR_2)\n", "tornado.ioloop.IOLoop.instance().start()\n", "return\n" ]
[ "def main():...\n", "web_app = tornado.web.Application([('^/$', module_index.MainframeHandler),\n ('/static/.*', module_static.StaticHandler), ('^/home', module_home.\n HomeHandler), ('^/files/?()$', module_files.FilesListHandler), (\n '^/files/list/(.*)', module_files.FilesListHandler), (\n '^/files/download/(.*)/(.*)/?$', module_files.FilesDownloadHandler), (\n '^/files/upload/(.*)/(.*)$', module_files.FilesUploadHandler), (\n '^/files/operation/?', module_files.FilesOperationHandler), ('.*',\n module_error404.Error404Handler)], xsrf_cookies=False)\n", "web_sockets = tornado.netutil.bind_sockets(const.get_const('server-port'),\n family=socket.AF_INET)\n", "if const.get_const('server-threads') > 1:\n", "if hasattr(os, 'fork'):\n", "web_server = tornado.httpserver.HTTPServer(web_app, xheaders=True)\n", "tornado.process.fork_processes(const.get_const('server-threads') - 1)\n", "web_server.add_sockets(web_sockets)\n", "tornado.ioloop.IOLoop.instance().start()\n", "return\n" ]
[ 0, 5, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "For", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_19(self):...\n", "VAR_16 = self.mox.CreateMock(paramiko.SSHClient)\n", "VAR_12 = self.mox.CreateMock(paramiko.Channel)\n", "VAR_17 = self.mox.CreateMock(paramiko.Transport)\n", "self.mox.StubOutWithMock(self.driver, '_get_output')\n", "self.mox.StubOutWithMock(VAR_12, 'invoke_shell')\n", "VAR_15 = ['NoError: test run']\n", "VAR_16.get_transport().AndReturn(VAR_17)\n", "VAR_17.open_session().AndReturn(VAR_12)\n", "VAR_12.invoke_shell()\n", "self.driver._get_output(VAR_12).AndReturn(VAR_15)\n", "VAR_18 = 'this is dummy command'\n", "VAR_12.send('stty columns 255' + '\\r')\n", "self.driver._get_output(VAR_12).AndReturn(VAR_15)\n", "VAR_12.send(VAR_18 + '\\r')\n", "self.driver._get_output(VAR_12).AndReturn(VAR_15)\n", "VAR_12.close()\n", "self.mox.ReplayAll()\n", "self.assertEqual(self.driver._ssh_execute(VAR_16, VAR_18), VAR_15)\n" ]
[ "def test_ssh_execute(self):...\n", "ssh = self.mox.CreateMock(paramiko.SSHClient)\n", "chan = self.mox.CreateMock(paramiko.Channel)\n", "transport = self.mox.CreateMock(paramiko.Transport)\n", "self.mox.StubOutWithMock(self.driver, '_get_output')\n", "self.mox.StubOutWithMock(chan, 'invoke_shell')\n", "expected_output = ['NoError: test run']\n", "ssh.get_transport().AndReturn(transport)\n", "transport.open_session().AndReturn(chan)\n", "chan.invoke_shell()\n", "self.driver._get_output(chan).AndReturn(expected_output)\n", "cmd = 'this is dummy command'\n", "chan.send('stty columns 255' + '\\r')\n", "self.driver._get_output(chan).AndReturn(expected_output)\n", "chan.send(cmd + '\\r')\n", "self.driver._get_output(chan).AndReturn(expected_output)\n", "chan.close()\n", "self.mox.ReplayAll()\n", "self.assertEqual(self.driver._ssh_execute(ssh, cmd), expected_output)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, *VAR_17, VAR_18=None):...\n", "VAR_18 = list(VAR_18) if VAR_18 is not None else []\n", "VAR_18.extend(self._get_context(VAR_16) for VAR_16 in VAR_17)\n", "return CLASS_2(self, VAR_18)\n" ]
[ "def include(self, *names, contexts=None):...\n", "contexts = list(contexts) if contexts is not None else []\n", "contexts.extend(self._get_context(name) for name in names)\n", "return ContextView(self, contexts)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_6(self):...\n", "for node in self.G.nodes(1):\n", "for otherNode in self.G.nodes():\n", "if not node == otherNode and not self.G.has_edge(node[0], otherNode[0]\n", "self.G.add_edge(node[0], otherNode[0])\n" ]
[ "def addEdges(self):...\n", "for node in self.G.nodes(1):\n", "for otherNode in self.G.nodes():\n", "if not node == otherNode and not self.G.has_edge(node[0], otherNode[0]\n", "self.G.add_edge(node[0], otherNode[0])\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "For", "Condition", "Expr'" ]
[ "def FUNC_0(self, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12,...\n", "\"\"\"docstring\"\"\"\n", "if VAR_13 is None:\n", "VAR_13 = {}\n", "VAR_30 = self.pool.get('budget.line')\n", "VAR_31 = VAR_30.filter_by_items(VAR_5, VAR_6, VAR_9, [VAR_7], VAR_13=context)\n", "VAR_32 = VAR_30.get_analytic_accounts(VAR_5, VAR_6, VAR_31, VAR_10, VAR_13=\n context)\n", "VAR_33 = self.get_accounts(VAR_5, VAR_6, [VAR_7], VAR_10, VAR_13=context)\n", "VAR_34 = None\n", "VAR_35 = None\n", "for period in VAR_8:\n", "if VAR_34 is None or VAR_34 > period.date_start:\n", "VAR_36 = self.pool.get('account.analytic.line')\n", "VAR_34 = period.date_start\n", "if VAR_35 is None or VAR_35 < period.date_stop:\n", "VAR_37 = VAR_36.search(VAR_5, VAR_6, [('date', '>=', VAR_34), ('date', '<=',\n VAR_35), ('general_account_id', 'in', VAR_33), ('account_id', 'in',\n VAR_32)], VAR_13=context)\n", "VAR_35 = period.date_stop\n", "VAR_38 = VAR_36.browse(VAR_5, VAR_6, VAR_37, VAR_13=context)\n", "VAR_39 = 0\n", "VAR_40 = self.pool.get('res.currency')\n", "VAR_41 = VAR_13.copy()\n", "VAR_41['date'] = VAR_12.strptime(DEFAULT_SERVER_DATE_FORMAT)\n", "for line in VAR_38:\n", "VAR_59 = line.general_account_id.company_id.currency_id.id\n", "return VAR_39\n", "VAR_39 += VAR_40.compute(VAR_5, VAR_6, VAR_59, VAR_11, line.amount, VAR_13=ctx)\n" ]
[ "def get_real_values_from_analytic_accounts(self, cr, uid, item_id, periods,...\n", "\"\"\"docstring\"\"\"\n", "if context is None:\n", "context = {}\n", "budget_line_obj = self.pool.get('budget.line')\n", "budget_lines = budget_line_obj.filter_by_items(cr, uid, lines, [item_id],\n context=context)\n", "aa_ids = budget_line_obj.get_analytic_accounts(cr, uid, budget_lines,\n company_id, context=context)\n", "general_accounts_ids = self.get_accounts(cr, uid, [item_id], company_id,\n context=context)\n", "start_date = None\n", "end_date = None\n", "for period in periods:\n", "if start_date is None or start_date > period.date_start:\n", "aa_lines_obj = self.pool.get('account.analytic.line')\n", "start_date = period.date_start\n", "if end_date is None or end_date < period.date_stop:\n", "aa_lines_ids = aa_lines_obj.search(cr, uid, [('date', '>=', start_date), (\n 'date', '<=', end_date), ('general_account_id', 'in',\n general_accounts_ids), ('account_id', 'in', aa_ids)], context=context)\n", "end_date = period.date_stop\n", "aa_lines = aa_lines_obj.browse(cr, uid, aa_lines_ids, context=context)\n", "result = 0\n", "currency_obj = self.pool.get('res.currency')\n", "ctx = context.copy()\n", "ctx['date'] = change_date.strptime(DEFAULT_SERVER_DATE_FORMAT)\n", "for line in aa_lines:\n", "from_ccy_id = line.general_account_id.company_id.currency_id.id\n", "return result\n", "result += currency_obj.compute(cr, uid, from_ccy_id, currency_id, line.\n amount, context=ctx)\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 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "AugAssign'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "if not self._home:\n", "VAR_24 = self._get_system_properties(self.java)['java.home']\n", "return self._home\n", "if os.path.basename(VAR_24) == 'jre':\n", "VAR_44 = os.path.dirname(VAR_24)\n", "self._home = VAR_24\n", "if self._is_executable(os.path.join(VAR_44, 'bin', 'javac')):\n", "VAR_24 = VAR_44\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "if not self._home:\n", "home = self._get_system_properties(self.java)['java.home']\n", "return self._home\n", "if os.path.basename(home) == 'jre':\n", "jdk_dir = os.path.dirname(home)\n", "self._home = home\n", "if self._is_executable(os.path.join(jdk_dir, 'bin', 'javac')):\n", "home = jdk_dir\n" ]
[ 0, 0, 0, 0, 7, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_13(self, VAR_1):...\n", "VAR_25 = datetime.strptime(VAR_1, '%Y-%m-%d')\n", "VAR_26 = VAR_25.replace(VAR_25=28) + timedelta(days=4)\n", "return (VAR_26 - timedelta(days=next_month.day)).day\n" ]
[ "def get_last_day_of_month(self, date):...\n", "day = datetime.strptime(date, '%Y-%m-%d')\n", "next_month = day.replace(day=28) + timedelta(days=4)\n", "return (next_month - timedelta(days=next_month.day)).day\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(VAR_11, VAR_8, VAR_12, VAR_13):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_8 is None or VAR_12 is None or VAR_12(VAR_11, VAR_8):\n", "return True\n", "if VAR_13 is not None and VAR_13(VAR_8):\n", "return False\n", "return True\n" ]
[ "def has_read_perm(user, group, is_member, is_private):...\n", "\"\"\"docstring\"\"\"\n", "if group is None or is_member is None or is_member(user, group):\n", "return True\n", "if is_private is not None and is_private(group):\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_16(self, VAR_16, VAR_19):...\n", "\"\"\"docstring\"\"\"\n", "VAR_46 = self.configuration.volume_name_template % VAR_19['id']\n", "VAR_0.error(_('Failed to create clone of volume %s'), VAR_16['name'])\n", "VAR_25 = self._eql_execute('volume', 'select', VAR_46, 'clone', VAR_16['name'])\n", "return self._get_volume_data(VAR_25)\n" ]
[ "def create_cloned_volume(self, volume, src_vref):...\n", "\"\"\"docstring\"\"\"\n", "src_volume_name = self.configuration.volume_name_template % src_vref['id']\n", "LOG.error(_('Failed to create clone of volume %s'), volume['name'])\n", "out = self._eql_execute('volume', 'select', src_volume_name, 'clone',\n volume['name'])\n", "return self._get_volume_data(out)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_18(self):...\n", "VAR_13 = ['Line1 passed', 'Line1 failed']\n", "VAR_14 = ['Line1', 'Line2']\n", "VAR_15 = [' passed', None]\n", "self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[0]), VAR_15[0])\n", "self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[1]), VAR_15[1])\n" ]
[ "def test_get_prefixed_value(self):...\n", "lines = ['Line1 passed', 'Line1 failed']\n", "prefix = ['Line1', 'Line2']\n", "expected_output = [' passed', None]\n", "self.assertEqual(self.driver._get_prefixed_value(lines, prefix[0]),\n expected_output[0])\n", "self.assertEqual(self.driver._get_prefixed_value(lines, prefix[1]),\n expected_output[1])\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "import os\n", "import vim\n", "import tempfile\n", "import json\n", "import signal\n", "from subprocess import PIPE\n", "from ycm import vimsupport\n", "from ycm import utils\n", "from ycm.diagnostic_interface import DiagnosticInterface\n", "from ycm.completers.all.omni_completer import OmniCompleter\n", "from ycm.completers.general import syntax_parse\n", "from ycm.completers.completer_utils import FiletypeCompleterExistsForFiletype\n", "from ycm.client.ycmd_keepalive import YcmdKeepalive\n", "from ycm.client.base_request import BaseRequest, BuildRequestData\n", "from ycm.client.command_request import SendCommandRequest\n", "from ycm.client.completion_request import CompletionRequest\n", "from ycm.client.omni_completion_request import OmniCompletionRequest\n", "from ycm.client.event_notification import SendEventNotificationAsync, EventNotification\n", "from ycm.server.responses import ServerError\n", "from UltiSnips import UltiSnips_Manager\n", "VAR_6 = False\n", "VAR_0.environ['no_proxy'] = '127.0.0.1,localhost'\n", "VAR_6 = True\n", "signal.signal(signal.SIGINT, signal.SIG_IGN)\n", "VAR_1 = 30\n", "VAR_2 = ('The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +\n \"\"\"Stderr (last {0} lines):\n\n\"\"\".format(VAR_1))\n", "VAR_3 = (\n 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). check console output for logs!'\n )\n", "VAR_4 = 10800\n", "def __init__(self, VAR_7):...\n", "self._user_options = VAR_7\n", "self._user_notified_about_crash = False\n", "self._diag_interface = DiagnosticInterface(VAR_7)\n", "self._omnicomp = OmniCompleter(VAR_7)\n", "self._latest_completion_request = None\n", "self._latest_file_parse_request = None\n", "self._server_stdout = None\n", "self._server_stderr = None\n", "self._server_popen = None\n", "self._filetypes_with_keywords_loaded = set()\n", "self._temp_options_filename = None\n", "self._ycmd_keepalive = YcmdKeepalive()\n", "self._SetupServer()\n", "self._ycmd_keepalive.Start()\n", "def FUNC_2(self):...\n", "VAR_14 = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "VAR_21 = [utils.PathToPythonInterpreter(), FUNC_0(), '--port={0}'.format(\n VAR_14), '--options_file={0}'.format(options_file.name), '--log={0}'.\n format(self._user_options['server_log_level']),\n '--idle_suicide_seconds={0}'.format(VAR_4)]\n", "if not self._user_options['server_use_vim_stdout']:\n", "VAR_26 = VAR_0.path.join(utils.PathToTempDir(), 'server_{port}_{std}.log')\n", "self._server_popen = utils.SafePopen(VAR_21, stdout=PIPE, stderr=PIPE)\n", "self._server_stdout = VAR_26.format(port=server_port, std='stdout')\n", "BaseRequest.server_location = 'http://localhost:' + str(VAR_14)\n", "self._server_stderr = VAR_26.format(port=server_port, std='stderr')\n", "self._NotifyUserIfServerCrashed()\n", "VAR_21.append('--stdout={0}'.format(self._server_stdout))\n", "def FUNC_3(self):...\n", "VAR_21.append('--stderr={0}'.format(self._server_stderr))\n", "VAR_15 = self._server_popen.poll()\n", "if self._user_options['server_keep_logfiles']:\n", "return VAR_15 is None\n", "VAR_21.append('--keep_logfiles')\n" ]
[ "import os\n", "import vim\n", "import tempfile\n", "import json\n", "import signal\n", "from subprocess import PIPE\n", "from ycm import vimsupport\n", "from ycm import utils\n", "from ycm.diagnostic_interface import DiagnosticInterface\n", "from ycm.completers.all.omni_completer import OmniCompleter\n", "from ycm.completers.general import syntax_parse\n", "from ycm.completers.completer_utils import FiletypeCompleterExistsForFiletype\n", "from ycm.client.ycmd_keepalive import YcmdKeepalive\n", "from ycm.client.base_request import BaseRequest, BuildRequestData\n", "from ycm.client.command_request import SendCommandRequest\n", "from ycm.client.completion_request import CompletionRequest\n", "from ycm.client.omni_completion_request import OmniCompletionRequest\n", "from ycm.client.event_notification import SendEventNotificationAsync, EventNotification\n", "from ycm.server.responses import ServerError\n", "from UltiSnips import UltiSnips_Manager\n", "USE_ULTISNIPS_DATA = False\n", "os.environ['no_proxy'] = '127.0.0.1,localhost'\n", "USE_ULTISNIPS_DATA = True\n", "signal.signal(signal.SIGINT, signal.SIG_IGN)\n", "NUM_YCMD_STDERR_LINES_ON_CRASH = 30\n", "SERVER_CRASH_MESSAGE_STDERR_FILE = (\n 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +\n \"\"\"Stderr (last {0} lines):\n\n\"\"\".format(NUM_YCMD_STDERR_LINES_ON_CRASH))\n", "SERVER_CRASH_MESSAGE_SAME_STDERR = (\n 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). check console output for logs!'\n )\n", "SERVER_IDLE_SUICIDE_SECONDS = 10800\n", "def __init__(self, user_options):...\n", "self._user_options = user_options\n", "self._user_notified_about_crash = False\n", "self._diag_interface = DiagnosticInterface(user_options)\n", "self._omnicomp = OmniCompleter(user_options)\n", "self._latest_completion_request = None\n", "self._latest_file_parse_request = None\n", "self._server_stdout = None\n", "self._server_stderr = None\n", "self._server_popen = None\n", "self._filetypes_with_keywords_loaded = set()\n", "self._temp_options_filename = None\n", "self._ycmd_keepalive = YcmdKeepalive()\n", "self._SetupServer()\n", "self._ycmd_keepalive.Start()\n", "def _SetupServer(self):...\n", "server_port = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "args = [utils.PathToPythonInterpreter(), _PathToServerScript(),\n '--port={0}'.format(server_port), '--options_file={0}'.format(\n options_file.name), '--log={0}'.format(self._user_options[\n 'server_log_level']), '--idle_suicide_seconds={0}'.format(\n SERVER_IDLE_SUICIDE_SECONDS)]\n", "if not self._user_options['server_use_vim_stdout']:\n", "filename_format = os.path.join(utils.PathToTempDir(), 'server_{port}_{std}.log'\n )\n", "self._server_popen = utils.SafePopen(args, stdout=PIPE, stderr=PIPE)\n", "self._server_stdout = filename_format.format(port=server_port, std='stdout')\n", "BaseRequest.server_location = 'http://localhost:' + str(server_port)\n", "self._server_stderr = filename_format.format(port=server_port, std='stderr')\n", "self._NotifyUserIfServerCrashed()\n", "args.append('--stdout={0}'.format(self._server_stdout))\n", "def _IsServerAlive(self):...\n", "args.append('--stderr={0}'.format(self._server_stderr))\n", "returncode = self._server_popen.poll()\n", "if self._user_options['server_keep_logfiles']:\n", "return returncode is None\n", "args.append('--keep_logfiles')\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, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Condition", "Return'", "Expr'" ]
[ "def FUNC_6(self, VAR_11):...\n", "VAR_33 = CLASS_43.run(self, VAR_11)\n", "if VAR_33 is None:\n", "return ''\n", "return VAR_33\n" ]
[ "def run(self, url):...\n", "val = VSanitizedUrl.run(self, url)\n", "if val is None:\n", "return ''\n", "return val\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1():...\n", "VAR_16 = sqlite3.connect(VAR_5)\n", "VAR_17 = VAR_16.cursor()\n", "VAR_17.execute('SELECT DiscordId, OsuId FROM users')\n", "VAR_18 = VAR_17.fetchall()\n", "for VAR_13 in VAR_18:\n", "FUNC_2(VAR_13[1], VAR_13[0])\n" ]
[ "def refresh_all_pp_stats():...\n", "conn = sqlite3.connect(databasePath)\n", "cursor = conn.cursor()\n", "cursor.execute('SELECT DiscordId, OsuId FROM users')\n", "usersToRefresh = cursor.fetchall()\n", "for user in usersToRefresh:\n", "update_pp_stats(user[1], user[0])\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "For", "Expr'" ]
[ "def FUNC_3(self, VAR_3):...\n", "VAR_6 = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email\n =member)\n", "self.cursor.execute(VAR_6)\n", "VAR_9 = self.cursor.fetchone()\n", "if int(VAR_9[0]) > 0:\n", "return True\n", "return False\n" ]
[ "def verify_email(self, member):...\n", "query = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email\n =member)\n", "self.cursor.execute(query)\n", "result = self.cursor.fetchone()\n", "if int(result[0]) > 0:\n", "return True\n", "return False\n" ]
[ 0, 4, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_24(VAR_25, VAR_23, *VAR_24):...\n", "if VAR_23 == 'on_after_task':\n", "VAR_50, VAR_51, VAR_5, VAR_52 = VAR_24\n", "self.assertEqual(False, VAR_50)\n", "self.assertEqual(True, VAR_51)\n", "self.assertEqual({'pool': 'default'}, VAR_5)\n", "self.assertEqual({}, VAR_52)\n" ]
[ "def call_hook(_botobj, name, *args):...\n", "if name == 'on_after_task':\n", "failure, internal_failure, dimensions, summary = args\n", "self.assertEqual(False, failure)\n", "self.assertEqual(True, internal_failure)\n", "self.assertEqual({'pool': 'default'}, dimensions)\n", "self.assertEqual({}, summary)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_3, VAR_4):...\n", "self.name = VAR_3\n", "self.connection = VAR_4\n", "self.cursor = self.connection.cursor()\n" ]
[ "def __init__(self, name, connection):...\n", "self.name = name\n", "self.connection = connection\n", "self.cursor = self.connection.cursor()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'" ]
[ "@contextlib.contextmanager...\n", "if VAR_6 is None:\n", "VAR_6 = self.TIMEOUT\n", "VAR_36, VAR_32 = get_locked_and_waiter()\n", "def FUNC_28(VAR_21):...\n", "if not VAR_25(VAR_21):\n", "return VAR_21, False\n", "VAR_36.release()\n", "return VAR_21, True\n" ]
[ "@contextlib.contextmanager...\n", "if timeout is None:\n", "timeout = self.TIMEOUT\n", "lock, wait = get_locked_and_waiter()\n", "def handler(msg):...\n", "if not match(msg):\n", "return msg, False\n", "lock.release()\n", "return msg, True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "FunctionDef'", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_8():...\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "create_test_db()\n", "os.rename(filename, 'temp_' + filename)\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "os.rename('test_' + filename, filename)\n" ]
[ "def setUpClass():...\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "create_test_db()\n", "os.rename(filename, 'temp_' + filename)\n", "for filename in ['cert_db.sqlite3', 'rf_model.pkl', 'rf_features.pkl']:\n", "os.rename('test_' + filename, filename)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'", "Expr'", "For", "Expr'" ]
[ "def __eq__(self, VAR_11):...\n", "if VAR_11 is None:\n", "return False\n", "return self.rule == VAR_11.rule and (self.dynamic_output or self.\n wildcards_dict == VAR_11.wildcards_dict)\n" ]
[ "def __eq__(self, other):...\n", "if other is None:\n", "return False\n", "return self.rule == other.rule and (self.dynamic_output or self.\n wildcards_dict == other.wildcards_dict)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "@frappe.whitelist()...\n", "\"\"\"docstring\"\"\"\n", "VAR_3.pop('cmd', None)\n", "return CLASS_0(VAR_0).execute(None, *VAR_2, **kwargs)\n" ]
[ "@frappe.whitelist()...\n", "\"\"\"docstring\"\"\"\n", "kwargs.pop('cmd', None)\n", "return DatabaseQuery(doctype).execute(None, *args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Return'" ]
[ "def FUNC_20(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_34 = []\n", "for value in self.iscsi_ips.values():\n", "VAR_34.append(value['nsp'])\n", "return VAR_34\n" ]
[ "def _get_iscsi_nsps(self):...\n", "\"\"\"docstring\"\"\"\n", "nsps = []\n", "for value in self.iscsi_ips.values():\n", "nsps.append(value['nsp'])\n", "return nsps\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_5(VAR_5, VAR_6, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = {}\n", "if 'title' in VAR_8:\n", "VAR_12['title'] = VAR_8['title']\n", "if 'description' in VAR_8:\n", "VAR_12['description'] = VAR_8['description']\n", "VAR_13 = ', '.join(map(lambda kv: f'{kv[0]} = \"{kv[1]}\"', VAR_12.items()))\n", "if len(VAR_12) != 0:\n", "VAR_5.execute(\n f\"\"\"\n UPDATE issue\n SET {VAR_13}\n WHERE id = {VAR_6}\n \"\"\"\n )\n", "VAR_5.execute(\n f\"\"\"\n DELETE FROM tag\n WHERE issue_id = {VAR_6}\n \"\"\")\n", "for tag in VAR_8.get('tags', []):\n", "VAR_5.execute(\n f\"\"\"string{tag['namespace']}\",\n \"{tag['predicate']}\",\n \"{tag['value']}\",\n \"{VAR_6}\"\n )\n \"\"\"\n )\n" ]
[ "def update_issue(cursor, id, fields):...\n", "\"\"\"docstring\"\"\"\n", "updated_fields = {}\n", "if 'title' in fields:\n", "updated_fields['title'] = fields['title']\n", "if 'description' in fields:\n", "updated_fields['description'] = fields['description']\n", "set_clause_args = ', '.join(map(lambda kv: f'{kv[0]} = \"{kv[1]}\"',\n updated_fields.items()))\n", "if len(updated_fields) != 0:\n", "cursor.execute(\n f\"\"\"\n UPDATE issue\n SET {set_clause_args}\n WHERE id = {id}\n \"\"\"\n )\n", "cursor.execute(\n f\"\"\"\n DELETE FROM tag\n WHERE issue_id = {id}\n \"\"\")\n", "for tag in fields.get('tags', []):\n", "cursor.execute(\n f\"\"\"\n INSERT INTO tag (\n namespace,\n predicate,\n value,\n issue_id\n )\n VALUES (\n \"{tag['namespace']}\",\n \"{tag['predicate']}\",\n \"{tag['value']}\",\n \"{id}\"\n )\n \"\"\"\n )\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 4, 0, 4 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "For", "Expr'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed('string')\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed(\n 'While following the guide, after installing boot9strap, if you get an error that says \"Failed to mount CTRNAND\", just continue on with the guide.'\n )\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_4():...\n", "\"\"\"docstring\"\"\"\n", "if not os.path.exists(VAR_1):\n", "os.makedirs(VAR_1)\n", "if exc.errno != errno.EEXIST:\n" ]
[ "def goals_dir_check():...\n", "\"\"\"docstring\"\"\"\n", "if not os.path.exists(GOALS_CONFIG_FOLDER_PATH):\n", "os.makedirs(GOALS_CONFIG_FOLDER_PATH)\n", "if exc.errno != errno.EEXIST:\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Condition" ]
[ "@wraps(VAR_7)...\n", "if VAR_12:\n", "return VAR_7(VAR_8[0], VAR_1, *VAR_8[1:], **kwargs)\n", "return VAR_7(VAR_1, *VAR_8, **kwargs)\n" ]
[ "@wraps(f)...\n", "if with_response:\n", "return f(args[0], remote, *args[1:], **kwargs)\n", "return f(remote, *args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_20(VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = os.path.normpath(VAR_8)\n", "VAR_33 = re.search('{[^{]', VAR_8)\n", "VAR_34 = os.path.dirname(VAR_8[:VAR_33.start()]\n ) if VAR_33 else os.path.dirname(VAR_8)\n", "if not VAR_34:\n", "VAR_34 = '.'\n", "VAR_35 = [VAR_29.group('name') for VAR_29 in VAR_5.finditer(VAR_8)]\n", "VAR_36 = namedtuple('Wildcards', VAR_35)\n", "VAR_11 = VAR_36(*[list() for VAR_40 in VAR_35])\n", "VAR_8 = re.compile(FUNC_8(VAR_8))\n", "for dirpath, dirnames, filenames in os.walk(VAR_34):\n", "for VAR_0 in chain(filenames, dirnames):\n", "return VAR_11\n", "if dirpath != '.':\n", "VAR_0 = os.path.join(dirpath, VAR_0)\n", "VAR_29 = re.match(VAR_8, VAR_0)\n", "if VAR_29:\n", "for VAR_40, VAR_16 in VAR_29.groupdict().items():\n", "getattr(VAR_11, VAR_40).append(VAR_16)\n" ]
[ "def glob_wildcards(pattern):...\n", "\"\"\"docstring\"\"\"\n", "pattern = os.path.normpath(pattern)\n", "first_wildcard = re.search('{[^{]', pattern)\n", "dirname = os.path.dirname(pattern[:first_wildcard.start()]\n ) if first_wildcard else os.path.dirname(pattern)\n", "if not dirname:\n", "dirname = '.'\n", "names = [match.group('name') for match in _wildcard_regex.finditer(pattern)]\n", "Wildcards = namedtuple('Wildcards', names)\n", "wildcards = Wildcards(*[list() for name in names])\n", "pattern = re.compile(regex(pattern))\n", "for dirpath, dirnames, filenames in os.walk(dirname):\n", "for f in chain(filenames, dirnames):\n", "return wildcards\n", "if dirpath != '.':\n", "f = os.path.join(dirpath, f)\n", "match = re.match(pattern, f)\n", "if match:\n", "for name, value in match.groupdict().items():\n", "getattr(wildcards, name).append(value)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "For", "Return'", "Condition", "Assign'", "Assign'", "Condition", "For", "Expr'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if VAR_0 is None:\n", "return True\n", "return shutil.which(VAR_0) is not None\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if executable is None:\n", "return True\n", "return shutil.which(executable) is not None\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Return'", "Return'" ]
[ "def FUNC_16(self):...\n", "return log_check_output(['git', 'status', '--porcelain']) != b''\n" ]
[ "def has_local_edit(self):...\n", "return log_check_output(['git', 'status', '--porcelain']) != b''\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_9(self, VAR_10):...\n", "if VAR_10:\n", "return 'TRUE'\n", "return 'FALSE'\n" ]
[ "def sqlForNonNone(self, value):...\n", "if value:\n", "return 'TRUE'\n", "return 'FALSE'\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_3(self):...\n", "for VAR_5 in self.groups:\n", "self.add_group(VAR_5)\n" ]
[ "def populate_ancestors(self):...\n", "for group in self.groups:\n", "self.add_group(group)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'" ]
[ "def FUNC_39(self):...\n", "" ]
[ "def _update_case_status(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4='en-US'):...\n", "self.chat_id = VAR_0\n", "self.first_name = VAR_1\n", "self.nickname = VAR_2\n", "self.last_name = VAR_3\n", "self.language = VAR_4\n" ]
[ "def __init__(self, chat_id, first_name, nickname, last_name, language='en-US'):...\n", "self.chat_id = chat_id\n", "self.first_name = first_name\n", "self.nickname = nickname\n", "self.last_name = last_name\n", "self.language = language\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def __str__(self):...\n", "VAR_10 = 'Serial Port: ' + self.serial.port + '\\n\\tTimeout: ' + str(self.\n serial.timeout) + \"\"\" seconds\n\tPrompt: \\\"\"\"\" + self.prompt + '\"'\n", "VAR_10 += '\\n\\tIP Address: ' + self.ip_address\n", "VAR_10 += '\\n\\tSCP Port: ' + str(self.options.dut_scp_port if not self.aux else\n self.options.aux_scp_port)\n", "return VAR_10\n" ]
[ "def __str__(self):...\n", "string = 'Serial Port: ' + self.serial.port + '\\n\\tTimeout: ' + str(self.\n serial.timeout) + \"\"\" seconds\n\tPrompt: \\\"\"\"\" + self.prompt + '\"'\n", "string += '\\n\\tIP Address: ' + self.ip_address\n", "string += '\\n\\tSCP Port: ' + str(self.options.dut_scp_port if not self.aux else\n self.options.aux_scp_port)\n", "return string\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "AugAssign'", "AugAssign'", "Return'" ]
[ "@FUNC_0...\n", "VAR_14 = await database.select_tags(VAR_3)\n", "VAR_15 = '\\n\\t'.join(\n f'<input type=\"checkbox\" name=\"tag\" value=\"{ID}\"> {label}<br>' for ID,\n label in VAR_14)\n", "return VAR_4.format(VAR_14=tag_checkboxes)\n" ]
[ "@handle_html...\n", "tags = await database.select_tags(request)\n", "tag_checkboxes = '\\n\\t'.join(\n f'<input type=\"checkbox\" name=\"tag\" value=\"{ID}\"> {label}<br>' for ID,\n label in tags)\n", "return base.format(tags=tag_checkboxes)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_8(self, VAR_7):...\n", "return self._job_percent[VAR_7]\n" ]
[ "def copy_percent(self, job_id):...\n", "return self._job_percent[job_id]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "return os.path.exists(os.path.join(VAR_0, '__init__.py'))\n" ]
[ "def _is_package(directory):...\n", "return os.path.exists(os.path.join(directory, '__init__.py'))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self):...\n", "os_ext.rmtree(rt.runtime().resources.prefix)\n" ]
[ "def tearDown(self):...\n", "os_ext.rmtree(rt.runtime().resources.prefix)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_6(self, VAR_11, VAR_10, VAR_12):...\n", "self.current = Current(VAR_11=session, VAR_23=data)\n", "self.current.headers = VAR_12\n", "VAR_14 = get_object_from_path(settings.BG_JOBS[VAR_10['job']])\n", "VAR_14(self.current)\n" ]
[ "def _handle_job(self, session, data, headers):...\n", "self.current = Current(session=session, input=data)\n", "self.current.headers = headers\n", "method = get_object_from_path(settings.BG_JOBS[data['job']])\n", "method(self.current)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_45 = UserRole[VAR_18.upper()]\n", "VAR_36 = CLASS_1.get_user_by_id(VAR_17)\n", "VAR_37 = UserRole(VAR_36.role)\n", "if VAR_37 == UserRole.PROJECT_MANAGER and VAR_45 == UserRole.ADMIN:\n", "if VAR_37 == UserRole.PROJECT_MANAGER and VAR_45 == UserRole.PROJECT_MANAGER:\n", "VAR_22 = CLASS_1.get_user_by_username(VAR_4)\n", "VAR_22.set_user_role(VAR_45)\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "requested_role = UserRole[role.upper()]\n", "admin = UserService.get_user_by_id(admin_user_id)\n", "admin_role = UserRole(admin.role)\n", "if admin_role == UserRole.PROJECT_MANAGER and requested_role == UserRole.ADMIN:\n", "if admin_role == UserRole.PROJECT_MANAGER and requested_role == UserRole.PROJECT_MANAGER:\n", "user = UserService.get_user_by_username(username)\n", "user.set_user_role(requested_role)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_0(self, VAR_0):...\n", "return VAR_0.id\n" ]
[ "def to_representation(self, obj):...\n", "return obj.id\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_12():...\n", "VAR_18 = requests.get(FUNC_2('healthy'))\n", "VAR_18.raise_for_status()\n", "return VAR_18.json()\n" ]
[ "def _ServerIsHealthy():...\n", "response = requests.get(_BuildUri('healthy'))\n", "response.raise_for_status()\n", "return response.json()\n" ]
[ 0, 7, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_14(self, VAR_23, VAR_24=0, VAR_25='***', VAR_7={}):...\n", "return VAR_25 + ' ' + (VAR_23.user_id and VAR_23.user_id.name.upper() or ''\n ) + (VAR_24 and ': L' + str(VAR_24) or '') + ' - %.1fh / %.1fh' % (\n VAR_23.effective_hours or 0.0, VAR_23.planned_hours\n ) + ' ' + VAR_25 + '\\n' + VAR_25[0] + ' ' + (VAR_23.name or '') + '\\n' + (\n VAR_23.description or '') + '\\n\\n'\n" ]
[ "def _str_get(self, task, level=0, border='***', context={}):...\n", "return border + ' ' + (task.user_id and task.user_id.name.upper() or '') + (\n level and ': L' + str(level) or '') + ' - %.1fh / %.1fh' % (task.\n effective_hours or 0.0, task.planned_hours) + ' ' + border + '\\n' + border[\n 0] + ' ' + (task.name or '') + '\\n' + (task.description or '') + '\\n\\n'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_18(self):...\n", "super(CLASS_3, self).setUp()\n", "VAR_19 = Blueprint('testing', __name__)\n", "@VAR_19.route('/test')...\n", "return 'OK'\n" ]
[ "def setUp(self):...\n", "super(NoAuthnAPITestCase, self).setUp()\n", "test_views = Blueprint('testing', __name__)\n", "@test_views.route('/test')...\n", "return 'OK'\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_3(self):...\n", "self._check_key(VAR_1)\n" ]
[ "def test_ecdsa_key(self):...\n", "self._check_key(ECDSA_PUBKEY)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_10(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = VAR_9.args.get('csessid')[0]\n", "self.last_alive[VAR_8] = time.time(), False\n", "VAR_23 = self.databuffer.get(VAR_8, [])\n", "if VAR_23:\n", "return VAR_23.pop(0)\n", "VAR_9.notifyFinish().addErrback(self._responseFailed, VAR_8, VAR_9)\n", "if VAR_8 in self.requests:\n", "self.requests[VAR_8].finish()\n", "self.requests[VAR_8] = VAR_9\n", "return server.NOT_DONE_YET\n" ]
[ "def mode_receive(self, request):...\n", "\"\"\"docstring\"\"\"\n", "csessid = request.args.get('csessid')[0]\n", "self.last_alive[csessid] = time.time(), False\n", "dataentries = self.databuffer.get(csessid, [])\n", "if dataentries:\n", "return dataentries.pop(0)\n", "request.notifyFinish().addErrback(self._responseFailed, csessid, request)\n", "if csessid in self.requests:\n", "self.requests[csessid].finish()\n", "self.requests[csessid] = request\n", "return server.NOT_DONE_YET\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Expr'", "Condition", "Expr'", "Assign'", "Return'" ]
[ "from gi.repository import Gio, Gdk, Gtk\n", "from keepassgtk.logging_manager import LoggingManager\n", "from keepassgtk.database_manager import DatabaseManager\n", "from keepassgtk.create_database import CreateDatabase\n", "from keepassgtk.container_page import ContainerPage\n", "from keepassgtk.unlock_database import UnlockDatabase\n", "import keepassgtk.config_manager\n", "import os\n", "from os.path import exists\n", "import ntpath\n", "import gi\n", "gi.require_version('Gtk', '3.0')\n", "gi.require_version('Gdk', '3.0')\n", "VAR_0 = NotImplemented\n", "VAR_1 = NotImplemented\n", "VAR_2 = NotImplemented\n", "VAR_3 = NotImplemented\n", "VAR_4 = NotImplemented\n", "VAR_5 = NotImplemented\n", "VAR_6 = NotImplemented\n", "VAR_7 = NotImplemented\n", "VAR_8 = LoggingManager(True)\n", "VAR_9 = []\n", "VAR_10 = []\n", "def __init__(self, *VAR_11, **VAR_12):...\n", "super().__init__(*VAR_11, **kwargs)\n", "keepassgtk.config_manager.configure()\n", "self.assemble_window()\n", "def FUNC_0(self):...\n", "self.set_default_size(800, 500)\n", "self.create_headerbar()\n", "self.first_start_screen()\n", "self.connect('delete-event', self.on_application_quit)\n", "self.custom_css()\n", "def FUNC_1(self):...\n", "VAR_28 = Gtk.Builder()\n", "VAR_28.add_from_resource('/run/terminal/KeepassGtk/main_window.ui')\n", "self.headerbar = VAR_28.get_object('headerbar')\n", "VAR_29 = VAR_28.get_object('open_button')\n", "VAR_29.connect('clicked', self.open_filechooser, None)\n", "VAR_30 = VAR_28.get_object('new_button')\n", "VAR_30.connect('clicked', self.create_filechooser, None)\n", "self.set_titlebar(self.headerbar)\n", "def FUNC_2(self):...\n", "self.set_titlebar(self.headerbar)\n", "def FUNC_3(self):...\n", "return self.headerbar\n" ]
[ "from gi.repository import Gio, Gdk, Gtk\n", "from keepassgtk.logging_manager import LoggingManager\n", "from keepassgtk.database_manager import DatabaseManager\n", "from keepassgtk.create_database import CreateDatabase\n", "from keepassgtk.container_page import ContainerPage\n", "from keepassgtk.unlock_database import UnlockDatabase\n", "import keepassgtk.config_manager\n", "import os\n", "from os.path import exists\n", "import ntpath\n", "import gi\n", "gi.require_version('Gtk', '3.0')\n", "gi.require_version('Gdk', '3.0')\n", "application = NotImplemented\n", "database_manager = NotImplemented\n", "container = NotImplemented\n", "override_dialog = NotImplemented\n", "quit_dialog = NotImplemented\n", "filechooser_creation_dialog = NotImplemented\n", "headerbar = NotImplemented\n", "first_start_grid = NotImplemented\n", "logging_manager = LoggingManager(True)\n", "opened_databases = []\n", "databases_to_save = []\n", "def __init__(self, *args, **kwargs):...\n", "super().__init__(*args, **kwargs)\n", "keepassgtk.config_manager.configure()\n", "self.assemble_window()\n", "def assemble_window(self):...\n", "self.set_default_size(800, 500)\n", "self.create_headerbar()\n", "self.first_start_screen()\n", "self.connect('delete-event', self.on_application_quit)\n", "self.custom_css()\n", "def create_headerbar(self):...\n", "builder = Gtk.Builder()\n", "builder.add_from_resource('/run/terminal/KeepassGtk/main_window.ui')\n", "self.headerbar = builder.get_object('headerbar')\n", "file_open_button = builder.get_object('open_button')\n", "file_open_button.connect('clicked', self.open_filechooser, None)\n", "file_new_button = builder.get_object('new_button')\n", "file_new_button.connect('clicked', self.create_filechooser, None)\n", "self.set_titlebar(self.headerbar)\n", "def set_headerbar(self):...\n", "self.set_titlebar(self.headerbar)\n", "def get_headerbar(self):...\n", "return self.headerbar\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 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "Import'", "Import'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Return'" ]
[ "def FUNC_1(self, VAR_11):...\n", "return 'jsonb'\n" ]
[ "def db_type(self, connection):...\n", "return 'jsonb'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __getitem__(self, VAR_9):...\n", "return self._get_item(self.factory, VAR_9, self.object_name)\n" ]
[ "def __getitem__(self, key):...\n", "return self._get_item(self.factory, key, self.object_name)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self, VAR_13):...\n", "VAR_31 = get_uniformed_tracker_url(VAR_13)\n", "if VAR_31:\n", "VAR_39 = VAR_0.TrackerState.get(url=sanitized_url) or VAR_0.TrackerState(url\n =sanitized_url)\n", "self.health.trackers.add(VAR_39)\n" ]
[ "def add_tracker(self, tracker_url):...\n", "sanitized_url = get_uniformed_tracker_url(tracker_url)\n", "if sanitized_url:\n", "tracker = db.TrackerState.get(url=sanitized_url) or db.TrackerState(url=\n sanitized_url)\n", "self.health.trackers.add(tracker)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "@inlineCallbacks...\n", "VAR_2 = self.database.generate_insert(self)\n", "if self.return_id:\n", "VAR_3 = yield self.database.runQuery(VAR_2)\n", "yield self.database.runOperation(VAR_2)\n", "if VAR_3 and self.model_class._meta.primary_key:\n", "returnValue(None)\n", "returnValue(VAR_3[0][0])\n" ]
[ "@inlineCallbacks...\n", "query = self.database.generate_insert(self)\n", "if self.return_id:\n", "result = yield self.database.runQuery(query)\n", "yield self.database.runOperation(query)\n", "if result and self.model_class._meta.primary_key:\n", "returnValue(None)\n", "returnValue(result[0][0])\n" ]
[ 0, 4, 0, 4, 4, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n", "VAR_7 = []\n", "VAR_8 = self.pool.get('ir.model.data')\n", "VAR_9 = self.pool.get('account.bank.statement')\n", "VAR_10 = self.pool.get('account.journal')\n", "VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n", "VAR_11 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_11)))\n", "VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "for journal in VAR_10.browse(VAR_2, VAR_3, VAR_12):\n", "VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n", "VAR_13 = self.pool.get('ir.model.data')\n", "if not VAR_4:\n", "VAR_14 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n", "VAR_7.append(VAR_4[0])\n", "VAR_15 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n", "if not journal.check_dtls:\n", "if VAR_14:\n", "VAR_9.button_confirm_cash(VAR_2, VAR_3, VAR_4, VAR_5)\n", "VAR_14 = VAR_13.browse(VAR_2, VAR_3, VAR_14, VAR_5=context).res_id\n", "if VAR_15:\n", "VAR_15 = VAR_13.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n", "return {'domain': \"[('id','in',\" + str(VAR_7) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(VAR_14, 'tree'), (\n VAR_15, 'form')], 'type': 'ir.actions.act_window'}\n" ]
[ "def close_statement(self, cr, uid, ids, context):...\n", "\"\"\"docstring\"\"\"\n", "company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n", "list_statement = []\n", "mod_obj = self.pool.get('ir.model.data')\n", "statement_obj = self.pool.get('account.bank.statement')\n", "journal_obj = self.pool.get('account.journal')\n", "cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n", "j_ids = map(lambda x1: x1[0], cr.fetchall())\n", "cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n", "journal_ids = map(lambda x1: x1[0], cr.fetchall())\n", "for journal in journal_obj.browse(cr, uid, journal_ids):\n", "ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n", "data_obj = self.pool.get('ir.model.data')\n", "if not ids:\n", "id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n", "list_statement.append(ids[0])\n", "id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n", "if not journal.check_dtls:\n", "if id2:\n", "statement_obj.button_confirm_cash(cr, uid, ids, context)\n", "id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n", "if id3:\n", "id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n", "return {'domain': \"[('id','in',\" + str(list_statement) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(id2, 'tree'), (id3,\n 'form')], 'type': 'ir.actions.act_window'}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_2 = self.connect()\n", "VAR_3 = 'SELECT description FROM crimes;'\n", "VAR_2.close()\n", "cursor.execute(VAR_3)\n", "return cursor.fetchall()\n" ]
[ "def get_all_inputs(self):...\n", "connection = self.connect()\n", "query = 'SELECT description FROM crimes;'\n", "connection.close()\n", "cursor.execute(query)\n", "return cursor.fetchall()\n" ]
[ 0, 0, 0, 0, 4, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "from django import template\n", "from django.core.urlresolvers import reverse\n", "from exercise.templatetags.exercise import _prepare_context\n", "from ..grade import assign_grade\n", "from ..models import CourseDiplomaDesign\n", "VAR_0 = template.Library()\n", "@VAR_0.inclusion_tag('diploma/_diploma_button.html', takes_context=True)...\n", "VAR_3 = _prepare_context(VAR_1, VAR_2)\n", "VAR_4 = CourseDiplomaDesign.objects.filter(course=points.instance).first()\n", "VAR_5 = None\n", "if VAR_4 and VAR_3.user.is_authenticated():\n", "VAR_5 = reverse('diploma-create', kwargs={'coursediploma_id': design.id,\n 'userprofile_id': points.user.userprofile.id})\n", "return {'grade': assign_grade(VAR_3, VAR_4), 'url': VAR_5,\n 'is_course_staff': VAR_1.get('is_course_staff')}\n" ]
[ "from django import template\n", "from django.core.urlresolvers import reverse\n", "from exercise.templatetags.exercise import _prepare_context\n", "from ..grade import assign_grade\n", "from ..models import CourseDiplomaDesign\n", "register = template.Library()\n", "@register.inclusion_tag('diploma/_diploma_button.html', takes_context=True)...\n", "points = _prepare_context(context, student)\n", "design = CourseDiplomaDesign.objects.filter(course=points.instance).first()\n", "url = None\n", "if design and points.user.is_authenticated():\n", "url = reverse('diploma-create', kwargs={'coursediploma_id': design.id,\n 'userprofile_id': points.user.userprofile.id})\n", "return {'grade': assign_grade(points, design), 'url': url,\n 'is_course_staff': context.get('is_course_staff')}\n" ]
[ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return gate.new_agent(VAR_1)\n" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return gate.new_agent(bindings)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_11(self, VAR_14):...\n", "" ]
[ "def is_integer(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_4(VAR_0):...\n", "VAR_8 = {'disabled': 0, 'is_stock_item': 1}\n", "if VAR_0.get('item_group'):\n", "VAR_8.update({'item_group': VAR_0['item_group']})\n", "if VAR_0.get('item'):\n", "VAR_8.update({'name': VAR_0['item']})\n", "VAR_3 = frappe.get_all('Item', fields=['name', 'item_group', 'item_name'],\n VAR_0=filters_dict, order_by='name')\n", "return VAR_3\n" ]
[ "def get_items(filters):...\n", "filters_dict = {'disabled': 0, 'is_stock_item': 1}\n", "if filters.get('item_group'):\n", "filters_dict.update({'item_group': filters['item_group']})\n", "if filters.get('item'):\n", "filters_dict.update({'name': filters['item']})\n", "items = frappe.get_all('Item', fields=['name', 'item_group', 'item_name'],\n filters=filters_dict, order_by='name')\n", "return items\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "@wraps(VAR_7)...\n", "if VAR_12:\n", "return VAR_7(VAR_8[0], VAR_1, *VAR_8[1:], **kwargs)\n", "return VAR_7(VAR_1, *VAR_8, **kwargs)\n" ]
[ "@wraps(f)...\n", "if with_response:\n", "return f(args[0], remote, *args[1:], **kwargs)\n", "return f(remote, *args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_12(self, *VAR_9, **VAR_10):...\n", "self.render('app.html', VAR_2={})\n" ]
[ "def get(self, *a, **kwargs):...\n", "self.render('app.html', page_json={})\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_26(self):...\n", "if self._IsServerAlive():\n", "VAR_23 = BaseRequest.PostDataToHandler(BuildRequestData(), 'debug_info')\n", "VAR_23 = 'Server crashed, no debug info from server'\n", "VAR_23 += \"\"\"\nServer running at: {0}\"\"\".format(BaseRequest.server_location)\n", "VAR_23 += \"\"\"\nServer process ID: {0}\"\"\".format(self._server_popen.pid)\n", "if self._server_stderr or self._server_stdout:\n", "VAR_23 += \"\"\"\nServer logfiles:\n {0}\n {1}\"\"\".format(self._server_stdout,\n self._server_stderr)\n", "return VAR_23\n" ]
[ "def DebugInfo(self):...\n", "if self._IsServerAlive():\n", "debug_info = BaseRequest.PostDataToHandler(BuildRequestData(), 'debug_info')\n", "debug_info = 'Server crashed, no debug info from server'\n", "debug_info += \"\"\"\nServer running at: {0}\"\"\".format(BaseRequest.server_location)\n", "debug_info += \"\"\"\nServer process ID: {0}\"\"\".format(self._server_popen.pid)\n", "if self._server_stderr or self._server_stdout:\n", "debug_info += \"\"\"\nServer logfiles:\n {0}\n {1}\"\"\".format(self.\n _server_stdout, self._server_stderr)\n", "return debug_info\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "AugAssign'", "AugAssign'", "Condition", "AugAssign'", "Return'" ]
[ "def FUNC_0():...\n", "VAR_3 = sublime.load_settings('urtext-default.sublime-settings')\n", "VAR_4 = VAR_3.get('meta_separator')\n", "return VAR_4\n" ]
[ "def meta_separator():...\n", "settings = sublime.load_settings('urtext-default.sublime-settings')\n", "meta_separator = settings.get('meta_separator')\n", "return meta_separator\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_9(self, *VAR_15, **VAR_75):...\n", "" ]
[ "def newfn(self, *a, **env):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_6(self, VAR_72):...\n", "VAR_92 = set(self.separator.findall(VAR_72) if VAR_72 else [])\n", "VAR_93 = set(VAR_17 for VAR_17 in VAR_92 if not self.email_re.match(VAR_17))\n", "VAR_92 = VAR_92 - VAR_93\n", "if self.num > 0 and len(VAR_92) + len(VAR_93) > self.num:\n", "if self.num == 1:\n", "if VAR_93:\n", "VAR_101.errors.add(errors.BAD_EMAILS, {'emails': '\"%s\"' % VAR_72})\n", "VAR_101.errors.add(errors.TOO_MANY_EMAILS, {'num': self.num})\n", "VAR_101.errors.add(errors.BAD_EMAILS, {'emails': ', '.join(VAR_93)})\n", "if not VAR_92:\n", "VAR_101.errors.add(errors.NO_EMAILS)\n", "return list(VAR_92)[0] if self.num == 1 else VAR_92\n" ]
[ "def run(self, emails0):...\n", "emails = set(self.separator.findall(emails0) if emails0 else [])\n", "failures = set(e for e in emails if not self.email_re.match(e))\n", "emails = emails - failures\n", "if self.num > 0 and len(emails) + len(failures) > self.num:\n", "if self.num == 1:\n", "if failures:\n", "c.errors.add(errors.BAD_EMAILS, {'emails': '\"%s\"' % emails0})\n", "c.errors.add(errors.TOO_MANY_EMAILS, {'num': self.num})\n", "c.errors.add(errors.BAD_EMAILS, {'emails': ', '.join(failures)})\n", "if not emails:\n", "c.errors.add(errors.NO_EMAILS)\n", "return list(emails)[0] if self.num == 1 else emails\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Return'" ]
[ "import sqlite3\n", "def __init__(self, VAR_0):...\n", "self.cursor = VAR_0\n", "self.rides = []\n", "def FUNC_0(self, VAR_1):...\n", "VAR_6 = 'string'.format(VAR_1=driver)\n", "self.cursor.execute(VAR_6)\n", "self.rides = self.cursor.fetchall()\n", "def FUNC_1(self, VAR_2):...\n", "VAR_7 = self.rides[VAR_2 * 5:min(VAR_2 * 5 + 5, len(self.rides))]\n", "for ride in VAR_7:\n", "print(str(ride[0]) + '.', end='')\n", "if VAR_2 * 5 + 5 < len(self.rides):\n", "print(ride)\n", "VAR_10 = input('string')\n", "VAR_10 = input(\n \"To book a member on a ride, please enter 'b'. To exit, press 'e': \")\n", "if VAR_10 == 'y':\n", "if VAR_10 == 'b':\n", "self.display_rides(VAR_2 + 1)\n", "def FUNC_2(self):...\n", "self.book_ride()\n", "VAR_6 = 'SELECT MAX(bno) FROM bookings'\n", "self.cursor.execute(VAR_6)\n", "VAR_8 = self.cursor.fetchone()\n", "return int(VAR_8[0]) + 1\n" ]
[ "import sqlite3\n", "def __init__(self, cursor):...\n", "self.cursor = cursor\n", "self.rides = []\n", "def find_rides(self, driver):...\n", "query = (\n \"\"\"\n SELECT r.rno, r.price, r.rdate, r.seats, r.lugDesc, r.src, r.dst, r.driver, r.cno, r.seats-COUNT(b.bno) \n FROM rides r, bookings b\n WHERE driver = '{driver}'\n AND r.rno = b.bno \n GROUP BY r.rno, r.price, r.rdate, r.seats, r.lugDesc, r.src, r.dst, r.driver, r.cno\n \"\"\"\n .format(driver=driver))\n", "self.cursor.execute(query)\n", "self.rides = self.cursor.fetchall()\n", "def display_rides(self, page_num):...\n", "page = self.rides[page_num * 5:min(page_num * 5 + 5, len(self.rides))]\n", "for ride in page:\n", "print(str(ride[0]) + '.', end='')\n", "if page_num * 5 + 5 < len(self.rides):\n", "print(ride)\n", "user_input = input(\n \"To book a member on a ride, please enter 'b'. To see more rides, please enter 'y'. To exit, press 'e': \"\n )\n", "user_input = input(\n \"To book a member on a ride, please enter 'b'. To exit, press 'e': \")\n", "if user_input == 'y':\n", "if user_input == 'b':\n", "self.display_rides(page_num + 1)\n", "def generate_bno(self):...\n", "self.book_ride()\n", "query = 'SELECT MAX(bno) FROM bookings'\n", "self.cursor.execute(query)\n", "max_bno = self.cursor.fetchone()\n", "return int(max_bno[0]) + 1\n" ]
[ 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "FunctionDef'", "Assign'", "For", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_1 = sqlite3.connect('app.db')\n", "VAR_2 = VAR_1.execute('select * from {} order by timestamp desc'.format(VAR_0))\n", "VAR_3 = [column[0] for column in VAR_2.description]\n", "VAR_4 = []\n", "for row in VAR_2.fetchall():\n", "VAR_4.append(dict(zip(VAR_3, row)))\n", "return VAR_4\n" ]
[ "def get_table_dict(table):...\n", "database = sqlite3.connect('app.db')\n", "cur = database.execute('select * from {} order by timestamp desc'.format(table)\n )\n", "columns = [column[0] for column in cur.description]\n", "results = []\n", "for row in cur.fetchall():\n", "results.append(dict(zip(columns, row)))\n", "return results\n" ]
[ 0, 4, 4, 4, 4, 4, 4, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_56 = not os.path.exists(CLASS_0.db_path)\n", "self.con = sqlite3.connect(CLASS_0.db_path)\n", "self.con.row_factory = FUNC_1\n", "self.c = self.con.cursor()\n", "if VAR_56:\n", "self.create_history_db()\n", "if not CLASS_0.done_cleaning:\n", "self.execute('PRAGMA user_version;')\n", "CLASS_0.done_cleaning = True\n", "VAR_75 = self.c.fetchone()['user_version']\n", "VAR_75 = 0\n", "if VAR_75 < 1:\n", "self.execute('VACUUM')\n", "VAR_76 = self.execute('PRAGMA user_version = 1;') and self.execute(\n 'ALTER TABLE \"history\" ADD COLUMN series TEXT;') and self.execute(\n 'ALTER TABLE \"history\" ADD COLUMN md5sum TEXT;')\n", "if VAR_75 < 2:\n", "VAR_76 = self.execute('PRAGMA user_version = 2;') and self.execute(\n 'ALTER TABLE \"history\" ADD COLUMN password TEXT;')\n" ]
[ "def connect(self):...\n", "\"\"\"docstring\"\"\"\n", "create_table = not os.path.exists(HistoryDB.db_path)\n", "self.con = sqlite3.connect(HistoryDB.db_path)\n", "self.con.row_factory = dict_factory\n", "self.c = self.con.cursor()\n", "if create_table:\n", "self.create_history_db()\n", "if not HistoryDB.done_cleaning:\n", "self.execute('PRAGMA user_version;')\n", "HistoryDB.done_cleaning = True\n", "version = self.c.fetchone()['user_version']\n", "version = 0\n", "if version < 1:\n", "self.execute('VACUUM')\n", "_ = self.execute('PRAGMA user_version = 1;') and self.execute(\n 'ALTER TABLE \"history\" ADD COLUMN series TEXT;') and self.execute(\n 'ALTER TABLE \"history\" ADD COLUMN md5sum TEXT;')\n", "if version < 2:\n", "_ = self.execute('PRAGMA user_version = 2;') and self.execute(\n 'ALTER TABLE \"history\" ADD COLUMN password TEXT;')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Assign'" ]