lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_1(VAR_14, VAR_2, VAR_3='text', VAR_4=bconfig....\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0.info('Analyzing keywords for local file %s.' % VAR_14)\n",
"VAR_15 = extractor.text_lines_from_local_file(VAR_14)\n",
"return FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5=\n spires, VAR_... | [
"def get_keywords_from_local_file(local_file, taxonomy_name, output_mode=...\n",
"\"\"\"docstring\"\"\"\n",
"log.info('Analyzing keywords for local file %s.' % local_file)\n",
"text_lines = extractor.text_lines_from_local_file(local_file)\n",
"return get_keywords_from_text(text_lines, taxonomy_name, output_... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"VAR_8 = self.get_datadocument_count()\n",
"VAR_9 = 0 if VAR_8 == 0 else self.get_qa_complete_extractedtext_count(\n ) / VAR_8 * 100\n",
"return VAR_9\n"
] | [
"def get_pct_checked_numeric(self):...\n",
"count = self.get_datadocument_count()\n",
"pct = 0 if count == 0 else self.get_qa_complete_extractedtext_count(\n ) / count * 100\n",
"return pct\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = self.to_str()\n",
"if not VAR_7.startswith('/'):\n",
"VAR_7 = '/' + VAR_7\n",
"return VAR_7\n"
] | [
"def to_abs_str(self):...\n",
"\"\"\"docstring\"\"\"\n",
"path = self.to_str()\n",
"if not path.startswith('/'):\n",
"path = '/' + path\n",
"return path\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_0():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = {'TEST_STACK': str(CLASS_0.DEFAULT_TEST_ID), 'TEST_APP': \n 'smoketest' + CLASS_0.DEFAULT_TEST_ID}\n",
"return st.ScenarioTestRunner.main(CLASS_0, default_binding_overrides=\n defaults, test_case_list=[AwsSmokeTest])\n"
] | [
"def main():...\n",
"\"\"\"docstring\"\"\"\n",
"defaults = {'TEST_STACK': str(AwsSmokeTestScenario.DEFAULT_TEST_ID),\n 'TEST_APP': 'smoketest' + AwsSmokeTestScenario.DEFAULT_TEST_ID}\n",
"return st.ScenarioTestRunner.main(AwsSmokeTestScenario,\n default_binding_overrides=defaults, test_case_list=[AwsSmo... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_40(*VAR_19, **VAR_20):...\n",
"VAR_62 = Thread(target=function, VAR_19=args, VAR_46=ka)\n",
"VAR_62.daemon = True\n",
"VAR_62.start()\n"
] | [
"def decorator(*args, **ka):...\n",
"t = Thread(target=function, args=args, kwargs=ka)\n",
"t.daemon = True\n",
"t.start()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_0):...\n",
"resource.Resource.__init__(self)\n",
"self.session = VAR_0\n",
"self.events_requests = []\n",
"self.infohashes_sent = set()\n",
"self.channel_cids_sent = set()\n",
"self.session.add_observer(self.on_upgrader_started, NTFY_UPGRADER, [\n NTFY_STARTED])\n",
"self.se... | [
"def __init__(self, session):...\n",
"resource.Resource.__init__(self)\n",
"self.session = session\n",
"self.events_requests = []\n",
"self.infohashes_sent = set()\n",
"self.channel_cids_sent = set()\n",
"self.session.add_observer(self.on_upgrader_started, NTFY_UPGRADER, [\n NTFY_STARTED])\n",
"sel... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Exp... |
[
"def FUNC_2(self, **VAR_6):...\n",
"return self.sendstring(json.dumps(VAR_6))\n"
] | [
"def response_func(self, **kw):...\n",
"return self.sendstring(json.dumps(kw))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5():...\n",
"VAR_34 = FUNC_3(VAR_18, VAR_19)\n",
"return CLASS_16, VAR_34\n"
] | [
"def two():...\n",
"FunctionalUseFormSet = make_formset(parent, child)\n",
"return ExtractedTextForm, FunctionalUseFormSet\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self, VAR_11):...\n",
"self.get(VAR_11.parentfield).remove(VAR_11)\n"
] | [
"def remove(self, doc):...\n",
"self.get(doc.parentfield).remove(doc)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __init__(self, *VAR_3, **VAR_4):...\n",
"super(CLASS_1, self).__init__(*VAR_3, **kwargs)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"super(SanISCSIDriver, self).__init__(*args, **kwargs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __str__(self):...\n",
"return Config.get('stretch', self.flag)(super(CLASS_7, self).__str__())\n"
] | [
"def __str__(self):...\n",
"return Config.get('stretch', self.flag)(super(Stretch, self).__str__())\n"
] | [
0,
2
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_19(VAR_8, **VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_8.format(**{wildcard: '{{{},{}}}'.format(wildcard, '|'.join(\n values)) for wildcard, values in wildcards.items()})\n"
] | [
"def limit(pattern, **wildcards):...\n",
"\"\"\"docstring\"\"\"\n",
"return pattern.format(**{wildcard: '{{{},{}}}'.format(wildcard, '|'.join(\n values)) for wildcard, values in wildcards.items()})\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def __init__(self, VAR_1, VAR_3=None):...\n",
"FUNC_0(self)\n",
"self.list_columns = dict()\n",
"self.list_properties = dict()\n",
"self.session = VAR_3\n",
"for VAR_36 in sa.orm.class_mapper(VAR_1).iterate_properties:\n",
"if type(VAR_36) != SynonymProperty:\n",
"for VAR_14 in VAR_1.__mapper__.colum... | [
"def __init__(self, obj, session=None):...\n",
"_include_filters(self)\n",
"self.list_columns = dict()\n",
"self.list_properties = dict()\n",
"self.session = session\n",
"for prop in sa.orm.class_mapper(obj).iterate_properties:\n",
"if type(prop) != SynonymProperty:\n",
"for col_name in obj.__mapper__... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_7(VAR_14, VAR_15, VAR_17, VAR_18=None):...\n",
"for VAR_20 in VAR_4:\n",
"if VAR_20 in VAR_5:\n",
"VAR_45 = VAR_5[VAR_20]\n",
"VAR_45 = list()\n",
"if VAR_20 in VAR_7:\n",
"VAR_5[VAR_20] = VAR_45\n",
"VAR_53 = VAR_7[VAR_20]\n",
"VAR_53 = set()\n",
"VAR_31 = FUNC_5(VAR_14, VAR_15)\n",
"... | [
"def create_spawn(proxy, proxytype, pc, uq=None):...\n",
"for domain in domains:\n",
"if domain in targets:\n",
"tlist = targets[domain]\n",
"tlist = list()\n",
"if domain in forums:\n",
"targets[domain] = tlist\n",
"fset = forums[domain]\n",
"fset = set()\n",
"net = make_net(proxy, proxytype)\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def __getitem__(self, VAR_7):...\n",
"for VAR_19 in reversed(self.contexts):\n",
"VAR_15 = VAR_19.get(VAR_7, VAR_0)\n",
"if VAR_15 is not VAR_0:\n",
"return VAR_15\n"
] | [
"def __getitem__(self, path):...\n",
"for context in reversed(self.contexts):\n",
"value = context.get(path, MISSING)\n",
"if value is not MISSING:\n",
"return value\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_9(self, VAR_16, VAR_12=None):...\n",
"return self._rest_call(VAR_16, VAR_24='DELETE', VAR_12=headers)\n"
] | [
"def url_delete(self, url, headers=None):...\n",
"return self._rest_call(url, method='DELETE', headers=headers)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(VAR_12):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = f.read()\n",
"return VAR_28\n"
] | [
"def getLocalFile(filepath):...\n",
"\"\"\"docstring\"\"\"\n",
"data = f.read()\n",
"return data\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@staticmethod...\n",
"VAR_6, VAR_7 = None, 0\n",
"def FUNC_9(VAR_18, VAR_19):...\n",
"VAR_20 = None\n",
"if line.startswith(VAR_18):\n",
"VAR_20 = line.rstrip()[len(VAR_18):]\n",
"return VAR_20 or VAR_19\n"
] | [
"@staticmethod...\n",
"etag, mtime = None, 0\n",
"def extract(comment, current_value):...\n",
"value = None\n",
"if line.startswith(comment):\n",
"value = line.rstrip()[len(comment):]\n",
"return value or current_value\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"VAR_23 = 'katotest-server-group'\n",
"VAR_21 = self.agent.type_to_payload('upsertGoogleServerGroupTagsDescription',\n {'credentials': self.bindings['GCE_CREDENTIALS'], 'zone': self.bindings\n ['TEST_GCE_ZONE'], 'serverGroupName': 'katotest-server-group', 'tags':\n ['test-tag-... | [
"def upsert_google_server_group_tags(self):...\n",
"server_group_name = 'katotest-server-group'\n",
"payload = self.agent.type_to_payload('upsertGoogleServerGroupTagsDescription',\n {'credentials': self.bindings['GCE_CREDENTIALS'], 'zone': self.bindings\n ['TEST_GCE_ZONE'], 'serverGroupName': 'katotest-se... | [
0,
0,
0,
0,
1,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_10(self, VAR_13):...\n",
"return VAR_13.name in self._localrules or VAR_13.norun\n"
] | [
"def is_local(self, rule):...\n",
"return rule.name in self._localrules or rule.norun\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_6, VAR_7=None, VAR_8=None, VAR_9=None):...\n",
"super(CLASS_1, self).__init__(VAR_6, VAR_7=url_prefix, VAR_8=RESTClient.\n merge_headers(JSONRESTClient._DEFAULT_HEADERS, default_headers), VAR_9=None\n )\n"
] | [
"def __init__(self, connection, url_prefix=None, default_headers=None,...\n",
"super(JSONRESTClient, self).__init__(connection, url_prefix=url_prefix,\n default_headers=RESTClient.merge_headers(JSONRESTClient.\n _DEFAULT_HEADERS, default_headers), client_obj=None)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(VAR_1):...\n",
"async def FUNC_15(*VAR_8, **VAR_9):...\n",
"VAR_12 = await get_session(VAR_8[0])\n",
"if 'uname' in VAR_12 and 'ignore_timeout' not in VAR_12:\n",
"VAR_23 = time.time()\n",
"VAR_12['visit_time'] = time.time()\n",
"VAR_24 = VAR_12['visit_time']\n",
"VAR_11 = await VAR_1(*VAR... | [
"def handle_html(func):...\n",
"async def ret(*args, **kwargs):...\n",
"session = await get_session(args[0])\n",
"if 'uname' in session and 'ignore_timeout' not in session:\n",
"t = time.time()\n",
"session['visit_time'] = time.time()\n",
"prev = session['visit_time']\n",
"text = await func(*args, **k... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"AsyncFunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"VAR_10 = self.fetch()\n",
"return ' '.join(VAR_10)\n"
] | [
"def printAll(self):...\n",
"baddies = self.fetch()\n",
"return ' '.join(baddies)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_29(self):...\n",
"VAR_49 = re.split(self.dynamic_fill, self.file)[0]\n",
"VAR_50 = os.path.dirname(VAR_49)\n",
"if len(VAR_50) > 0 and not os.path.exists(VAR_50):\n",
"os.makedirs(VAR_50)\n",
"if e.errno != 17:\n"
] | [
"def prepare(self):...\n",
"path_until_wildcard = re.split(self.dynamic_fill, self.file)[0]\n",
"dir = os.path.dirname(path_until_wildcard)\n",
"if len(dir) > 0 and not os.path.exists(dir):\n",
"os.makedirs(dir)\n",
"if e.errno != 17:\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition"
] |
[
"import logging\n",
"from bulk_update.helper import bulk_update\n",
"from django.contrib.auth.decorators import login_required\n",
"from django.db import transaction\n",
"from django.http import HttpResponseBadRequest, HttpResponseForbidden, JsonResponse\n",
"from django.shortcuts import get_object_or_404... | [
"import logging\n",
"from bulk_update.helper import bulk_update\n",
"from django.contrib.auth.decorators import login_required\n",
"from django.db import transaction\n",
"from django.http import HttpResponseBadRequest, HttpResponseForbidden, JsonResponse\n",
"from django.shortcuts import get_object_or_404... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"For",
"Expr'",
"... |
[
"def FUNC_10(VAR_16):...\n",
"return isinstance(VAR_16, str) or not isinstance(VAR_16, Iterable)\n"
] | [
"def not_iterable(value):...\n",
"return isinstance(value, str) or not isinstance(value, Iterable)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.format_wildcards(self.rule.shellcmd\n ) if self.rule.shellcmd else None\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.format_wildcards(self.rule.shellcmd\n ) if self.rule.shellcmd else None\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"\"\"\"Functions for interfacing with the SQL databases.\n\"\"\"\n",
"import sqlite3 as sql\n",
"import traceback\n",
"def FUNC_0(VAR_0, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = sql.connect('./resources/users.db')\n",
"VAR_19 = False\n",
"VAR_20 = \"\"\"SELECT * FROM users\n WHE... | [
"\"\"\"Functions for interfacing with the SQL databases.\n\"\"\"\n",
"import sqlite3 as sql\n",
"import traceback\n",
"def authenticate(username, password):...\n",
"\"\"\"docstring\"\"\"\n",
"con = sql.connect('./resources/users.db')\n",
"authenticated = False\n",
"cmd = \"\"\"SELECT * FROM users\n ... | [
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"VAR_9 = []\n",
"VAR_10 = {}\n",
"for kid in self.child_groups:\n",
"VAR_13 = kid.get_hosts()\n",
"for VAR_14 in self.hosts:\n",
"for VAR_15 in VAR_13:\n",
"if VAR_14 not in VAR_10:\n",
"return VAR_9\n",
"if VAR_15 not in VAR_10:\n",
"VAR_10[VAR_14] = 1\n",
"VAR_10[V... | [
"def _get_hosts(self):...\n",
"hosts = []\n",
"seen = {}\n",
"for kid in self.child_groups:\n",
"kid_hosts = kid.get_hosts()\n",
"for mine in self.hosts:\n",
"for kk in kid_hosts:\n",
"if mine not in seen:\n",
"return hosts\n",
"if kk not in seen:\n",
"seen[mine] = 1\n",
"seen[kk] = 1\n",
"i... | [
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"For",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self, VAR_10, VAR_5):...\n",
"VAR_11 = 'string'.format(self.columns[VAR_10].select(), VAR_5, self.\n build_filter_string(), self.columns[VAR_10].name)\n",
"print(VAR_11)\n",
"return self.query_boilerplate(VAR_11)\n"
] | [
"def topn_sum(self, column, sum_by):...\n",
"q = (\n \"\"\"\n SELECT {0}, sum({1}) AS c FROM test_goflow_records {2} GROUP BY {3} ORDER BY c DESC\n \"\"\"\n .format(self.columns[column].select(), sum_by, self.build_filter_string\n (), self.columns[column].name))\n",
"print(q)\n",
"retur... | [
0,
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_0=None, VAR_1=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not go.ANAGONDA_PRESENT:\n",
"return\n",
"if get_settings(VAR_0, 'anaconda_go_fast_linters_only', False):\n",
"FUNC_1(VAR_0, VAR_1)\n",
"FUNC_3(VAR_0, VAR_1)\n"
] | [
"def run_linter(view=None, hook=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not go.ANAGONDA_PRESENT:\n",
"return\n",
"if get_settings(view, 'anaconda_go_fast_linters_only', False):\n",
"fast_linters(view, hook)\n",
"all_linters(view, hook)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Expr'",
"Expr'"
] |
[
"@api.model_cr...\n",
"tools.drop_view_if_exists(self._cr, self._table)\n",
"self._cr.execute(\n \"\"\"\n create or replace view %s as (\n %s\n %s\n )\"\"\"\n % (self._table, self._select(), self._from()))\n"
] | [
"@api.model_cr...\n",
"tools.drop_view_if_exists(self._cr, self._table)\n",
"self._cr.execute(\n \"\"\"\n create or replace view %s as (\n %s\n %s\n )\"\"\"\n % (self._table, self._select(), self._from()))\n"
] | [
0,
0,
4
] | [
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_1, VAR_3):...\n",
"VAR_17 = VAR_3['source']['serial_id']\n",
"VAR_18, VAR_19, VAR_4 = self.get_previous_yields(VAR_17)\n",
"VAR_6 = 'OK'\n",
"self.add_day_data_row(VAR_1, VAR_3, VAR_4)\n",
"if self.is_timestamps_from_same_day(VAR_18, VAR_1):\n",
"self.update_inverter(VAR_17, VAR_1,... | [
"def add_inverter_data(self, ts, data):...\n",
"inv_serial = data['source']['serial_id']\n",
"prev_ts, prev_etoday, prev_etotal = self.get_previous_yields(inv_serial)\n",
"status = 'OK'\n",
"self.add_day_data_row(ts, data, prev_etotal)\n",
"if self.is_timestamps_from_same_day(prev_ts, ts):\n",
"self.upd... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@permission_required('tournament.add_game')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = get_modifiable_tournament_or_404(VAR_3, VAR_2.user)\n",
"VAR_8 = FUNC_0(VAR_7, VAR_1)\n",
"VAR_21 = VAR_8.game_set.all()\n",
"VAR_11 = []\n",
"for VAR_39 in VAR_21:\n",
"VAR_28 = {'game_name': VAR_39.name, 'the_set... | [
"@permission_required('tournament.add_game')...\n",
"\"\"\"docstring\"\"\"\n",
"t = get_modifiable_tournament_or_404(tournament_id, request.user)\n",
"r = get_round_or_404(t, round_num)\n",
"games = r.game_set.all()\n",
"data = []\n",
"for g in games:\n",
"current = {'game_name': g.name, 'the_set': g.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"For",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"Return'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"... |
[
"def FUNC_13(self, VAR_25='default.yaml'):...\n",
"self.config = load(data_file, Loader)\n"
] | [
"def load_config(self, filename='default.yaml'):...\n",
"self.config = load(data_file, Loader)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"@property...\n",
"return self.dag.priority(self)\n"
] | [
"@property...\n",
"return self.dag.priority(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_11(VAR_12):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = f.read()\n",
"return VAR_28\n"
] | [
"def getLocalFile(filepath):...\n",
"\"\"\"docstring\"\"\"\n",
"data = f.read()\n",
"return data\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_10(self, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"self.post_event('bot_rebooting', VAR_8)\n",
"self.cancel_all_timers()\n",
"if self._shutdown_hook:\n",
"self._shutdown_hook(self)\n",
"logging.exception('shutdown hook failed: %s', e)\n",
"os_utilities.restart(VAR_8, timeout=15 * 60)\n",
... | [
"def restart(self, message):...\n",
"\"\"\"docstring\"\"\"\n",
"self.post_event('bot_rebooting', message)\n",
"self.cancel_all_timers()\n",
"if self._shutdown_hook:\n",
"self._shutdown_hook(self)\n",
"logging.exception('shutdown hook failed: %s', e)\n",
"os_utilities.restart(message, timeout=15 * 60)\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_18(self):...\n",
"if self.contains('yunohost app setting'):\n",
"FUNC_3('string')\n",
"if self.contains('yunohost app checkurl'):\n",
"FUNC_3(\n \"'yunohost app checkurl' is deprecated. Please use 'ynh_webpath_register' instead.\"\n )\n",
"if self.contains('yunohost app checkport'):\n",
... | [
"def check_deprecated_practices(self):...\n",
"if self.contains('yunohost app setting'):\n",
"print_warning(\n \"'yunohost app setting' shouldn't be used directly. Please use 'ynh_app_setting_(set,get,delete)' instead.\"\n )\n",
"if self.contains('yunohost app checkurl'):\n",
"print_warning(\n \"'y... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_3(VAR_2, VAR_3):...\n",
"VAR_2.browser = webdriver.PhantomJS()\n",
"VAR_2.browser.set_window_size(1280, 1024)\n",
"VAR_2.browser.implicitly_wait(DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S)\n",
"VAR_2.browser.set_page_load_timeout(60)\n",
"VAR_2.browser.get(HOMEPAGE_URL)\n"
] | [
"def before_feature(context, feature):...\n",
"context.browser = webdriver.PhantomJS()\n",
"context.browser.set_window_size(1280, 1024)\n",
"context.browser.implicitly_wait(DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S)\n",
"context.browser.set_page_load_timeout(60)\n",
"context.browser.get(HOMEPAGE_URL)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_2):...\n",
"if self == VAR_2:\n",
"if VAR_2 not in self.child_groups:\n",
"self.child_groups.append(VAR_2)\n",
"VAR_2.depth = max([self.depth + 1, VAR_2.depth])\n",
"VAR_2._check_children_depth()\n",
"if self.name not in [VAR_12.name for VAR_12 in VAR_2.parent_groups]:\n",
"VAR_2... | [
"def add_child_group(self, group):...\n",
"if self == group:\n",
"if group not in self.child_groups:\n",
"self.child_groups.append(group)\n",
"group.depth = max([self.depth + 1, group.depth])\n",
"group._check_children_depth()\n",
"if self.name not in [g.name for g in group.parent_groups]:\n",
"group.... | [
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
1
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Expr'",
"For",
"Expr'"
] |
[
"@eqlx.with_timeout...\n",
"time.sleep(1)\n"
] | [
"@eqlx.with_timeout...\n",
"time.sleep(1)\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_1(self, VAR_1=False):...\n",
"\"\"\"docstring\"\"\"\n",
"self.testbed.setup_env(user_email='kay@mib.gov', user_id=ViewTestsBase.\n _USER_ID, user_is_admin='1' if is_admin else '0', overwrite=True)\n"
] | [
"def login(self, is_admin=False):...\n",
"\"\"\"docstring\"\"\"\n",
"self.testbed.setup_env(user_email='kay@mib.gov', user_id=ViewTestsBase.\n _USER_ID, user_is_admin='1' if is_admin else '0', overwrite=True)\n"
] | [
0,
0,
5
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def __call__(self, VAR_0):...\n",
"VAR_31 = ResourceTreeTraverser.__call__(self, VAR_0)\n",
"VAR_32 = VAR_31['context']\n",
"VAR_33 = VAR_31['view_name']\n",
"if IResource.providedBy(VAR_32) and '.' in VAR_33:\n",
"VAR_43, VAR_44 = VAR_33.split('.')\n",
"return VAR_31\n",
"VAR_51 = VAR_32[VAR_43]\n",... | [
"def __call__(self, request):...\n",
"system = ResourceTreeTraverser.__call__(self, request)\n",
"context = system['context']\n",
"view_name = system['view_name']\n",
"if IResource.providedBy(context) and '.' in view_name:\n",
"rc_name, repr_name = view_name.split('.')\n",
"return system\n",
"child_rc... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"@staticmethod...\n",
"VAR_20 = bot.get_file(VAR_1.document.file_id).file_path\n",
"VAR_21 = f'https://api.telegram.org/file/bot{config.TELEGRAM_TOKEN}/{VAR_20}'\n",
"if machine == 'prod':\n",
"VAR_45 = requests.get(VAR_21)\n",
"VAR_46 = {'https': config.PROXY_CONFIG}\n",
"return BytesIO(VAR_45.content)... | [
"@staticmethod...\n",
"file_path = bot.get_file(message.document.file_id).file_path\n",
"link = f'https://api.telegram.org/file/bot{config.TELEGRAM_TOKEN}/{file_path}'\n",
"if machine == 'prod':\n",
"r = requests.get(link)\n",
"proxies = {'https': config.PROXY_CONFIG}\n",
"return BytesIO(r.content)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._check_flags()\n"
] | [
"def check_for_setup_error(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._check_flags()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_7(self, VAR_1=QModelIndex()):...\n",
"return len(self.columns)\n"
] | [
"def columnCount(self, parent=QModelIndex()):...\n",
"return len(self.columns)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(VAR_0, VAR_1, VAR_2):...\n",
"VAR_1['VMWARE_USER'] = VAR_0.get_input('username', default='')\n",
"VAR_1['VMWARE_PASSWORD'] = VAR_0.get_input('password', default='')\n",
"VAR_1['VMWARE_HOST'] = VAR_0.get_input('host', default='')\n",
"VAR_1['VMWARE_VALIDATE_CERTS'] = str(settings.VMWARE_VALIDATE_... | [
"def vmware(cred, env, private_data_dir):...\n",
"env['VMWARE_USER'] = cred.get_input('username', default='')\n",
"env['VMWARE_PASSWORD'] = cred.get_input('password', default='')\n",
"env['VMWARE_HOST'] = cred.get_input('host', default='')\n",
"env['VMWARE_VALIDATE_CERTS'] = str(settings.VMWARE_VALIDATE_CER... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_12, VAR_13=1000, VAR_14=(), VAR_6=None, VAR_15=False):...\n",
"super(CLASS_1, self).__init__()\n",
"self._conn = VAR_12\n",
"self._seq = VAR_13\n",
"self._timeout = VAR_6\n",
"self._owned = VAR_15\n",
"self._handlers = []\n",
"for VAR_18 in VAR_14:\n",
"if callable(VAR_18):\n... | [
"def __init__(self, conn, seq=1000, handlers=(), timeout=None, owned=False):...\n",
"super(DebugSession, self).__init__()\n",
"self._conn = conn\n",
"self._seq = seq\n",
"self._timeout = timeout\n",
"self._owned = owned\n",
"self._handlers = []\n",
"for handler in handlers:\n",
"if callable(handler)... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_34(self):...\n",
"\"\"\"docstring\"\"\"\n",
"FUNC_5(VAR_1='Mark German', VAR_2='Germany')\n",
"self.assertEqual(tournament.list_players(), 0)\n"
] | [
"def test_list_players(self):...\n",
"\"\"\"docstring\"\"\"\n",
"dummy_player(player_name='Mark German', country='Germany')\n",
"self.assertEqual(tournament.list_players(), 0)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"VAR_5 = VAR_0.name.replace(' ', '_')\n",
"VAR_6 = '{0}/{0}_{1}'.format(VAR_5, VAR_1)\n",
"return VAR_6\n"
] | [
"def update_filename(instance, filename):...\n",
"name_fill_space = instance.name.replace(' ', '_')\n",
"name = '{0}/{0}_{1}'.format(name_fill_space, filename)\n",
"return name\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"return 'submit source %s for task %s (ID %d) %s' % (self.source_path, self.\n task[1], self.task[0], self.url)\n"
] | [
"def describe(self):...\n",
"return 'submit source %s for task %s (ID %d) %s' % (self.source_path, self.\n task[1], self.task[0], self.url)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(VAR_15):...\n",
"return len(VAR_15) == 3 and VAR_15[1\n ] in schemas.CONDITION_OPERATORS and isinstance(VAR_15[0], (six.\n string_types, tuple, list))\n"
] | [
"def is_condition(cond_or_list):...\n",
"return len(cond_or_list) == 3 and cond_or_list[1\n ] in schemas.CONDITION_OPERATORS and isinstance(cond_or_list[0], (six.\n string_types, tuple, list))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self, VAR_2, VAR_1='='):...\n",
"for regex, VAR_10 in self.filter_map.items():\n",
"if re.search(regex, VAR_2):\n",
"VAR_34 = re.search(regex, VAR_2)\n",
"VAR_35 = VAR_34.group(1)\n",
"self.columns[VAR_10].filter(VAR_35, VAR_1)\n"
] | [
"def add_filter(self, value, op='='):...\n",
"for regex, column in self.filter_map.items():\n",
"if re.search(regex, value):\n",
"m = re.search(regex, value)\n",
"v = m.group(1)\n",
"self.columns[column].filter(v, op)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"self.assertTrue(self.client.login(username='autotest', password='password'))\n"
] | [
"def setUp(self):...\n",
"self.assertTrue(self.client.login(username='autotest', password='password'))\n"
] | [
0,
5
] | [
"FunctionDef'",
"Expr'"
] |
[
"import stack.commands\n",
"from stack.exception import CommandError\n",
"\"\"\"string\"\"\"\n",
"def FUNC_0(self, VAR_0, VAR_1):...\n",
"VAR_2, VAR_3 = self.fillParams([('attr', None, True), ('doc', None, True)])\n",
"VAR_4 = self.db.execute(\n \"\"\"\n\t\t\tselect attr from attributes where attr='%s'... | [
"import stack.commands\n",
"from stack.exception import CommandError\n",
"\"\"\"\n\tChanges a string containing documention for an attribute\n\n\t<param type='string' name='attr' optional='0'>\n\tName of the attribute\n\t</param>\n\n\t<param type='string' name='doc' optional='0'>\n\tDocumentation of the attribu... | [
0,
0,
0,
0,
0,
2,
0,
2,
0,
2
] | [
"Import'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_7(VAR_11):...\n",
"return True\n"
] | [
"def directory_filter(_path):...\n",
"return True\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(self, VAR_5):...\n",
"VAR_14 = 'string'.format(VAR_5)\n",
"self.cur.execute(VAR_14)\n",
"return self.cur.fetchall()\n"
] | [
"def get_events(self, server_id):...\n",
"sql = (\n \"\"\"SELECT events.event_id as e, title, description, start_time, time_zone, (\n SELECT GROUP_CONCAT(DISTINCT username)\n FROM user_event, events\n WHERE user_event.event_id = e\n AND ev... | [
0,
4,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_8(self, VAR_4, VAR_5):...\n",
"if VAR_4 == 'ansible_group_priority':\n",
"self.set_priority(int(VAR_5))\n",
"self.vars[VAR_4] = VAR_5\n"
] | [
"def set_variable(self, key, value):...\n",
"if key == 'ansible_group_priority':\n",
"self.set_priority(int(value))\n",
"self.vars[key] = value\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_0():...\n",
"VAR_11 = 'string'\n"
] | [
"def update_sold_statusDONOTUSE():...\n",
"sql = \"\"\"\n DONT DO THIS UNLESS ABSOLUTELT SURE ABOUT QTY BETTER TO DO VIA IMPORT???????\n update set it.workflow_state = 'Sold'\n\n select it.item_code, bin.actual_qty\n from `tabItem` it\n right join `tabBin` bin\n on bin.item_code = it.item_code\n... | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
""
] | [
"@utils.synchronized('3par', external=True)...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"@VAR_0.route('/delete_video/<filename>')...\n",
"if 'username' in VAR_19:\n",
"print(VAR_19['username'], file=sys.stdout)\n",
"return 'test'\n",
"VAR_14 = CLASS_0.query.filter_by(VAR_6=session['username']).first()\n",
"VAR_15 = CLASS_1.query.filter_by(VAR_5=data.UserID, VAR_11=filename).first()\n",
"if... | [
"@app.route('/delete_video/<filename>')...\n",
"if 'username' in session:\n",
"print(session['username'], file=sys.stdout)\n",
"return 'test'\n",
"data = users.query.filter_by(Username=session['username']).first()\n",
"video = Video.query.filter_by(UserID=data.UserID, Name=filename).first()\n",
"if vide... | [
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(self, VAR_4):...\n",
"VAR_11 = super(CLASS_2, self).run(VAR_4)\n",
"self.logger.print_response_code(VAR_11)\n",
"self.logger.print_headers(VAR_11.getheaders())\n",
"VAR_6 = VAR_11.read()\n",
"if self.pipe_command:\n",
"VAR_6 = self.pipe(self.pip_command, VAR_6)\n",
"if VAR_6:\n",
"self.l... | [
"def run(self, headers):...\n",
"response = super(HttpGet, self).run(headers)\n",
"self.logger.print_response_code(response)\n",
"self.logger.print_headers(response.getheaders())\n",
"data = response.read()\n",
"if self.pipe_command:\n",
"data = self.pipe(self.pip_command, data)\n",
"if data:\n",
"s... | [
0,
0,
0,
0,
0,
0,
1,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"@app.route('/auth/register')...\n",
"return FUNC_7()\n"
] | [
"@app.route('/auth/register')...\n",
"return render_register()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@login_required()...\n",
"VAR_5 = get_object_or_404(DataGroup, VAR_2=pk)\n",
"VAR_5.doc_types = DocumentType.objects.filter(group_type=dg.group_type)\n",
"VAR_6 = VAR_5.datadocument_set.get_queryset()\n",
"VAR_7 = ProductDocument.objects.filter(document__in=docs)\n",
"VAR_8 = VAR_0.GET.get('page')\n",
... | [
"@login_required()...\n",
"dg = get_object_or_404(DataGroup, pk=pk)\n",
"dg.doc_types = DocumentType.objects.filter(group_type=dg.group_type)\n",
"docs = dg.datadocument_set.get_queryset()\n",
"prod_link = ProductDocument.objects.filter(document__in=docs)\n",
"page = request.GET.get('page')\n",
"paginat... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"... |
[
"def FUNC_12(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = None\n",
"self._timers_dying = True\n",
"for t in self._timers:\n",
"t.cancel()\n",
"VAR_15, self._timers = self._timers, []\n",
"for t in VAR_15:\n",
"t.join(timeout=5)\n",
"if t.isAlive():\n",
"logging.error('Timer thread did not ... | [
"def cancel_all_timers(self):...\n",
"\"\"\"docstring\"\"\"\n",
"timers = None\n",
"self._timers_dying = True\n",
"for t in self._timers:\n",
"t.cancel()\n",
"timers, self._timers = self._timers, []\n",
"for t in timers:\n",
"t.join(timeout=5)\n",
"if t.isAlive():\n",
"logging.error('Timer threa... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"For",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_4(VAR_0):...\n",
"VAR_0.clear_filters()\n",
"for arg in request.args:\n",
"VAR_8 = re.findall('_flt_(\\\\d)_(.*)', arg)\n",
"if VAR_8:\n",
"VAR_0.add_filter_index(VAR_8[0][1], int(VAR_8[0][0]), request.args.get(arg))\n"
] | [
"def get_filter_args(filters):...\n",
"filters.clear_filters()\n",
"for arg in request.args:\n",
"re_match = re.findall('_flt_(\\\\d)_(.*)', arg)\n",
"if re_match:\n",
"filters.add_filter_index(re_match[0][1], int(re_match[0][0]), request.args.\n get(arg))\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"For",
"Assign'",
"Condition",
"Expr'"
] |
[
"async def FUNC_3(self, VAR_0):...\n",
"VAR_9 = {'username': self.username, 'email': self.email, 'password': VAR_0}\n",
"VAR_10 = await VAR_2.users.insert_one(VAR_9)\n"
] | [
"async def do_insert(self, hashed_password):...\n",
"document = {'username': self.username, 'email': self.email, 'password':\n hashed_password}\n",
"result = await async_db.users.insert_one(document)\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_21(self):...\n",
"self.run_test_case(self.scenario.list_available_images())\n"
] | [
"def test_available_images(self):...\n",
"self.run_test_case(self.scenario.list_available_images())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_9(self, *VAR_15, **VAR_75):...\n",
""
] | [
"def newfn(self, *a, **env):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_3(self):...\n",
"VAR_6 = {'message': '', 'title': 'Config: Chrome Infra Monitoring Proxy'}\n",
"VAR_7 = common.MonAcqData.get_by_id(common.CONFIG_DATA_KEY)\n",
"if VAR_7:\n",
"self.setParams(VAR_6, VAR_7)\n",
"self.render_response('set_credentials.html', **params)\n"
] | [
"def get(self):...\n",
"params = {'message': '', 'title': 'Config: Chrome Infra Monitoring Proxy'}\n",
"data = common.MonAcqData.get_by_id(common.CONFIG_DATA_KEY)\n",
"if data:\n",
"self.setParams(params, data)\n",
"self.render_response('set_credentials.html', **params)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = self.request.headers.get('X-XSRF-TOKEN')\n",
"if not VAR_22:\n",
"VAR_22 = self.get_argument('xsrf-token', default=None)\n",
"if not VAR_22:\n",
"if self.xsrf_token != VAR_22:\n"
] | [
"def check_xsrf_cookie(self):...\n",
"\"\"\"docstring\"\"\"\n",
"token = self.request.headers.get('X-XSRF-TOKEN')\n",
"if not token:\n",
"token = self.get_argument('xsrf-token', default=None)\n",
"if not token:\n",
"if self.xsrf_token != token:\n"
] | [
0,
0,
0,
0,
0,
0,
5
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition"
] |
[
"def FUNC_5(self):...\n",
""
] | [
"def Start(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(self):...\n",
"VAR_8 = Event.objects.order_by('-publish_timestamp')\n",
"VAR_9 = self.request.GET.get('tag')\n",
"if VAR_9 is not None:\n",
"VAR_8 = VAR_8.filter(tags__id=tag)\n",
"VAR_10 = self.request.GET.get('org')\n",
"if VAR_10 is not None:\n",
"VAR_8 = VAR_8.filter(orgc=org)\n",
"V... | [
"def get_queryset(self):...\n",
"query = Event.objects.order_by('-publish_timestamp')\n",
"tag = self.request.GET.get('tag')\n",
"if tag is not None:\n",
"query = query.filter(tags__id=tag)\n",
"org = self.request.GET.get('org')\n",
"if org is not None:\n",
"query = query.filter(orgc=org)\n",
"level... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_32(*VAR_26):...\n",
""
] | [
"def mocked_check(*_args):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_10(self, *VAR_11, **VAR_12):...\n",
"for VAR_9 in VAR_11:\n",
"self._set_params_item(VAR_9)\n",
"for VAR_10, VAR_9 in VAR_12.items():\n",
"self._set_params_item(VAR_9, VAR_10=name)\n"
] | [
"def set_params(self, *params, **kwparams):...\n",
"for item in params:\n",
"self._set_params_item(item)\n",
"for name, item in kwparams.items():\n",
"self._set_params_item(item, name=name)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'",
"For",
"Expr'"
] |
[
"def FUNC_7(VAR_6, VAR_1):...\n",
"VAR_1.execute(\n 'UPDATE video SET position = position - 1 WHERE position > {removed_position}'\n .format(VAR_6=removed_position))\n"
] | [
"def update_video_positions(removed_position, db):...\n",
"db.execute(\n 'UPDATE video SET position = position - 1 WHERE position > {removed_position}'\n .format(removed_position=removed_position))\n"
] | [
0,
4
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"self._mox = mox.Mox()\n",
"self.mock(logging, 'error', lambda *_: None)\n",
"self.mock(logging, 'exception', lambda *_: None)\n",
"self.mock(logging, 'info', lambda *_: None)\n",
"self.mock(logging, 'warning', lambda *_: None)\n",
"self._mox.StubOutWithMock(time, 'sleep')\n",
... | [
"def setUp(self):...\n",
"self._mox = mox.Mox()\n",
"self.mock(logging, 'error', lambda *_: None)\n",
"self.mock(logging, 'exception', lambda *_: None)\n",
"self.mock(logging, 'info', lambda *_: None)\n",
"self.mock(logging, 'warning', lambda *_: None)\n",
"self._mox.StubOutWithMock(time, 'sleep')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@api.public...\n",
"self.response.write(ipaddr.ip_to_string(api.get_peer_ip()))\n"
] | [
"@api.public...\n",
"self.response.write(ipaddr.ip_to_string(api.get_peer_ip()))\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return 'Running check for remote component %s with pid %s on host %s' % (self\n .comp_name, self.pid, self.hostname)\n"
] | [
"def info(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return 'Running check for remote component %s with pid %s on host %s' % (self\n .comp_name, self.pid, self.hostname)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"self.parse_args()\n",
"self.sanitize_fields()\n",
"self.extract_tables()\n",
"self.set_optional_columns()\n",
"self.build_conditions()\n",
"VAR_2 = frappe._dict()\n",
"if self.with_childnames:\n",
"for t in self.tables:\n",
"VAR_2.tables = self.tables[0]\n",
"if t != '... | [
"def prepare_args(self):...\n",
"self.parse_args()\n",
"self.sanitize_fields()\n",
"self.extract_tables()\n",
"self.set_optional_columns()\n",
"self.build_conditions()\n",
"args = frappe._dict()\n",
"if self.with_childnames:\n",
"for t in self.tables:\n",
"args.tables = self.tables[0]\n",
"if t ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"For",
"Assign'",
"Condition",
"For",
"Expr'",
"AugAssign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"AugAssign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"A... |
[
"def FUNC_1(VAR_2: str, VAR_3: str):...\n",
"if not VAR_2 == VAR_3:\n",
"return False\n",
"if len(VAR_2) < 6:\n",
"return False\n",
"if VAR_2.isupper():\n",
"return False\n",
"if VAR_2.islower():\n",
"return False\n",
"return True\n"
] | [
"def check_password_conformity(pw1: str, pw2: str):...\n",
"if not pw1 == pw2:\n",
"return False\n",
"if len(pw1) < 6:\n",
"return False\n",
"if pw1.isupper():\n",
"return False\n",
"if pw1.islower():\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_21 = self.agent.type_to_payload(\n 'deregisterInstancesFromGoogleLoadBalancerDescription', {\n 'loadBalancerNames': [self.__use_lb_name], 'instanceIds': self.\n use_instance_names[:2], 'region': self.bindings['TEST_GCE_REGION'],\n 'credentia... | [
"def deregister_load_balancer_instances(self):...\n",
"\"\"\"docstring\"\"\"\n",
"payload = self.agent.type_to_payload(\n 'deregisterInstancesFromGoogleLoadBalancerDescription', {\n 'loadBalancerNames': [self.__use_lb_name], 'instanceIds': self.\n use_instance_names[:2], 'region': self.bindings['TEST_G... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@property...\n",
"return self.exists and not os.access(self.file, os.W_OK)\n"
] | [
"@property...\n",
"return self.exists and not os.access(self.file, os.W_OK)\n"
] | [
0,
7
] | [
"Condition",
"Return'"
] |
[
"def FUNC_0(VAR_6):...\n",
"if call(VAR_6['cmd'][1]['check'], shell=True) == 0:\n",
"return True\n",
"return False\n"
] | [
"def run_component_check(comp):...\n",
"if call(comp['cmd'][1]['check'], shell=True) == 0:\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def __repr__(self):...\n",
"return self.get_name()\n"
] | [
"def __repr__(self):...\n",
"return self.get_name()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(VAR_7=None, VAR_8=0, VAR_9=0):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_7 is None:\n",
"return True\n",
"return False\n",
"VAR_21 = re.match('^([^;]+)(; length=([0-9]+))?$', VAR_7, re.IGNORECASE)\n",
"VAR_22 = parse_http_date(VAR_21.group(1))\n",
"VAR_23 = VAR_21.group(3)\n",
"if VAR_23... | [
"def was_modified_since(header=None, mtime=0, size=0):...\n",
"\"\"\"docstring\"\"\"\n",
"if header is None:\n",
"return True\n",
"return False\n",
"matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)\n",
"header_mtime = parse_http_date(matches.group(1))\n",
"header_len = matche... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition"
] |
[
"def FUNC_3(VAR_5, VAR_6=''):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = urllib2.Request(VAR_5)\n",
"if VAR_6:\n",
"VAR_18.add_header('User-Agent', VAR_6)\n",
"VAR_20 = VAR_8(VAR_18)\n",
"VAR_0.error('Unable to read from URL %s.' % VAR_5)\n",
"VAR_11 = FUNC_1(VAR_21, VAR_3=True)\n",
"VAR_21 = tempf... | [
"def text_lines_from_url(url, user_agent=''):...\n",
"\"\"\"docstring\"\"\"\n",
"request = urllib2.Request(url)\n",
"if user_agent:\n",
"request.add_header('User-Agent', user_agent)\n",
"distant_stream = urlopen(request)\n",
"log.error('Unable to read from URL %s.' % url)\n",
"lines = text_lines_from_... | [
0,
0,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
0,
7,
0,
7,
0,
0,
7,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"For",
"AugAssign'",
"Expr'",
"Return'"
] |
[
"\"\"\"Versioned singleton entity with the global configuration.\"\"\"\n",
"import logging\n",
"from google.appengine.ext import ndb\n",
"from gae_libs.model.versioned_model import VersionedModel\n",
"\"\"\"string\"\"\"\n",
"VAR_0 = ndb.DateTimeProperty(indexed=False, auto_now=True)\n",
"VAR_1 = ndb.Str... | [
"\"\"\"Versioned singleton entity with the global configuration.\"\"\"\n",
"import logging\n",
"from google.appengine.ext import ndb\n",
"from gae_libs.model.versioned_model import VersionedModel\n",
"\"\"\"Singleton entity with the global configuration of the service.\n\n All changes are stored in the rev... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"VAR_2 = CLASS_1.construct_testscript_command('test_program.py')\n",
"VAR_3, VAR_4 = run_shell_command(VAR_2)\n",
"VAR_5 = \"\"\"test_program Z\nnon-interactive mode.\nExiting...\n\"\"\"\n",
"self.assertEqual(VAR_3, VAR_5)\n",
"self.assertEqual(VAR_4, '')\n"
] | [
"def test_run_shell_command_without_stdin(self):...\n",
"command = RunShellCommandTest.construct_testscript_command('test_program.py')\n",
"stdout, stderr = run_shell_command(command)\n",
"expected = \"\"\"test_program Z\nnon-interactive mode.\nExiting...\n\"\"\"\n",
"self.assertEqual(stdout, expected)\n",
... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_8(self):...\n",
"VAR_9 = {}\n",
"VAR_9['inventory_hostname'] = self.name\n",
"VAR_9['inventory_hostname_short'] = self.name.split('.')[0]\n",
"VAR_9['group_names'] = sorted([VAR_10.name for VAR_10 in self.get_groups() if\n VAR_10.name != 'all'])\n",
"return VAR_9\n"
] | [
"def get_magic_vars(self):...\n",
"results = {}\n",
"results['inventory_hostname'] = self.name\n",
"results['inventory_hostname_short'] = self.name.split('.')[0]\n",
"results['group_names'] = sorted([g.name for g in self.get_groups() if g.\n name != 'all'])\n",
"return results\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_5, VAR_4=None):...\n",
"if not VAR_4:\n",
"VAR_4 = 'This field needs to have a different value than ' + orm[VAR_5\n ].label + '.'\n",
"def FUNC_3(VAR_6, VAR_7):...\n",
"if VAR_7.data is VAR_6[VAR_5].data:\n",
"return FUNC_3\n"
] | [
"def different(fieldname, message=None):...\n",
"if not message:\n",
"message = 'This field needs to have a different value than ' + orm[fieldname\n ].label + '.'\n",
"def _different(form, field):...\n",
"if field.data is form[fieldname].data:\n",
"return _different\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"FunctionDef'",
"Condition",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(self.fields, string_types):\n",
"if self.fields == '*':\n",
"for filter_name in ['filters', 'or_filters']:\n",
"self.fields = ['*']\n",
"self.fields = json.loads(self.fields)\n",
"self.fields = [VAR_34.strip() for VAR_34 in self.field... | [
"def parse_args(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(self.fields, string_types):\n",
"if self.fields == '*':\n",
"for filter_name in ['filters', 'or_filters']:\n",
"self.fields = ['*']\n",
"self.fields = json.loads(self.fields)\n",
"self.fields = [f.strip() for f in self.fields.spli... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"For",
"Expr'"
] |
[
"def __init__(self, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"super(CLASS_5, self).__init__(VAR_2)\n",
"self.message = 'Component %s crashed on localhost' % VAR_2\n"
] | [
"def __init__(self, comp_name):...\n",
"\"\"\"docstring\"\"\"\n",
"super(LocalCrashEvent, self).__init__(comp_name)\n",
"self.message = 'Component %s crashed on localhost' % comp_name\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'"
] |
[
"def FUNC_6():...\n",
"VAR_13.throw(_('Invalid Search Field'), VAR_13.DataError)\n"
] | [
"def _raise_exception():...\n",
"frappe.throw(_('Invalid Search Field'), frappe.DataError)\n"
] | [
0,
4
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_18(VAR_10, **VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3[VAR_10] = VAR_19\n"
] | [
"def add_existing_user(user_id, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"created_users[user_id] = kwargs\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_13(self, VAR_9, VAR_10=None, VAR_11=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = self.get_and_check_task(VAR_9, VAR_10, VAR_11, VAR_16={\n 'orthophoto_area': Envelope(Cast('orthophoto', GeometryField()))})\n",
"VAR_30 = get_tile_json(VAR_28.name, [\n '/api/projects/{}/tasks/{}/tiles/{{z}... | [
"def get(self, request, pk=None, project_pk=None):...\n",
"\"\"\"docstring\"\"\"\n",
"task = self.get_and_check_task(request, pk, project_pk, annotate={\n 'orthophoto_area': Envelope(Cast('orthophoto', GeometryField()))})\n",
"json = get_tile_json(task.name, [\n '/api/projects/{}/tasks/{}/tiles/{{z}}/{{... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import logging\n",
"from datetime import timedelta\n",
"import voluptuous as vol\n",
"from homeassistant.components.sensor import PLATFORM_SCHEMA\n",
"from homeassistant.const import TEMP_CELSIUS, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, STATE_UNKNOWN\n",
"from homeassis... | [
"\"\"\"\nSupport for the NetAtmo Weather Service.\n\nFor more details about this platform, please refer to the documentation at\nhttps://home-assistant.io/components/sensor.netatmo/\n\"\"\"\n",
"import logging\n",
"from datetime import timedelta\n",
"import voluptuous as vol\n",
"from homeassistant.componen... | [
0,
0,
7,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Impo... |
[
"def __init__(self, VAR_0, VAR_1, VAR_2):...\n",
"super(CLASS_2, self).__init__(VAR_0, VAR_1, VAR_2, 'GET')\n"
] | [
"def __init__(self, connection, args, logger):...\n",
"super(HttpGet, self).__init__(connection, args, logger, 'GET')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __init__(self, *VAR_2, **VAR_3):...\n",
"super(CLASS_0, self).__init__(*VAR_2, **kwargs)\n",
"self.common = None\n",
"self.configuration.append_config_values(hpcommon.hp3par_opts)\n",
"self.configuration.append_config_values(san.san_opts)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"super(HP3PARFCDriver, self).__init__(*args, **kwargs)\n",
"self.common = None\n",
"self.configuration.append_config_values(hpcommon.hp3par_opts)\n",
"self.configuration.append_config_values(san.san_opts)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.