code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
# sandbox for ast...
import ast
source = '''s=s+x'''
node = ast.parse(source, mode='exec')
from pprint import pprint
pprint( ast.dump(node, annotate_fields=False, include_attributes=False) )
#~ print (eval(compile(node, '<string>', mode='eval')))
"""
Module(
body=[
Assign(
targets=[Name(id=... | ajibawa-2023/Python-Code-Large/train/row_97920 | 13 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97920:Import_L2_C0", "label": "ast import ast", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0392, 0.0196, 0, 0.66, 0.0, 809, 0, 1, 0, 0, 809, 0, 0], "semantic": {"name": "ast", "arg_names": [], "import_names": ["ast"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97920:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97920:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97920:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97920:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code... |
# http://stackoverflow.com/questions/1515357/simple-example-of-how-to-use-ast-nodevisitor
#~ http://docs.python.org/3/library/ast.html
#~ http://eli.thegreenplace.net/wp-content/uploads/2009/11/codegen.py
#~ http://dev.pocoo.org/hg/sandbox/file/852a1248c8eb/ast/codegen.py
#~ https://github.com/llvmpy/llvmpy/blob/mas... | ajibawa-2023/Python-Code-Large/train/row_97921 | 73 | 184 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97921:Assign_L9_C0", "label": "code_example1 =", "type": "assigned_variable", "loc": [9, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0571, 0.0217, 0, 0.66, 0.0, 908, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "code_example1", "arg_names": [], "import_names": []... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97921:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97921:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97921:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97921:For_L79_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
codegen
~~~~~~~
Extension to ast that allow ast -> CPP code generation.
:copyright: Copyright 2008 by Armin Ronacher (adapted for C++ by Jurgis Pralgauskis)
:license: BSD.
https://pypi.python.org/pypi/codegen
also similar: http://svn.python.org/view/python/tru... | ajibawa-2023/Python-Code-Large/train/row_97922 | 583 | 804 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97922:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 15], "level": 0, "parent": null, "vector": [8, 0, 0.0106, 0.0174, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97922:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97922:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97922:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97922:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code... |
cat_sub_path='Testas-X'
def set_cat_sub_path( new ):
global cat_sub_path
cat_sub_path = new
__print_category("")
def __print_category(cat_name):
if cat_sub_path: cat_name = cat_sub_path+'/'+cat_name
cat_name = cat_name.rstrip('/')
print("\n\n$CATEGORY: $system$/%s\n" % cat_name )
... | ajibawa-2023/Python-Code-Large/train/row_97923 | 73 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97923:Assign_L2_C0", "label": "cat_sub_path =", "type": "assigned_variable", "loc": [2, 2], "level": 0, "parent": null, "vector": [14, 0, 0.0149, 0.0075, 0, 0.66, 0.0, 992, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "cat_sub_path", "arg_names": [], "import_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97923:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97923:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97923:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97923:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
#~ TYPE = "GIFT"
#~ questions_file = "loops"
#~ questions_file = "matrix"
#~ questions_file = "functions"
#~ questions_file = "variables_and_conditions"
TYPE = "CLOZE"
questions_file = "fill_missing_var_if_while_lists"
#~ questions_file = "fill_missing_2_defs_morelists_dicts_etc"
#~ questions_file = "fill_missing_test... | ajibawa-2023/Python-Code-Large/train/row_97924 | 91 | 173 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97924:Assign_L7_C0", "label": "TYPE =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0405, 0.0058, 0, 0.66, 0.0, 387, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE", "arg_names": [], "import_names": [], "rhs_call_name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97924:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97924:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97924:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97924:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code... |
import re
import helpers
import random
import hashlib
tpl = """#include <iostream>
/*directives*/
using namespace std;
/*functions*/
int main(){
/*code*/
return 0;
}
"""
COMPILE = False
with open('Questions_tpl/'+'questions_cpp_Errors.cpp') as f:
examples = f.read()
examples = examples.split('//')
quest... | ajibawa-2023/Python-Code-Large/train/row_97925 | 67 | 144 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97925:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0069, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97925:For_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97925:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97925:For_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97925:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_9... |
import re
import os
import helpers
#~ TASK = 'py2cpp' #can convert: py2img, cpp2img, py2cpp
#~ TASK = 'cpp2img' #can convert: py2cpp, py2img, cpp2img, *2img
TASK = 'cpp2img'
#~ NAME_SEARCH = ''
NAME_SEARCH = 'nonrandom'
LINENOS4IMG = False
html_entities = {
'"': '"',
'&': '&',
' ': ' ',... | ajibawa-2023/Python-Code-Large/train/row_97927 | 130 | 254 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97927:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0039, 0.0039, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97927:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97927:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97927:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97927:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Co... |
try:
from tpl_helpers import __rand_questions, __print_category
except ImportError:
from .tpl_helpers import __rand_questions, __print_category
def Loop_C( _list=[2, 8, 4, 6, 9, 0, 1] ): # {=%(track['S`1'])s}
S = 0 # >>>S`0
n = 0
for x in _list:
n = n + 1; S = S + x; print(S) # >>>S`... | ajibawa-2023/Python-Code-Large/train/row_97928 | 40 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97928:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.05, 0.08, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97928:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97928:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97928:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97928:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import tpl_helpers # calls parent_dir_2path() -- to let imports
from generate_via_decorators import generate_calls, set_cat_sub_path, call_functions_by_decorators
@generate_calls(
#_pinigai = [-10, 0, 1, 5, 9] ,
#groups = ["less", 1, "equal", 1, "more", 3] ,
_pini... | ajibawa-2023/Python-Code-Large/train/row_97929 | 27 | 89 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97929:Import_L1_C0", "label": "tpl_helpers import tpl_helpers", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0112, 0, 0.66, 0.0, 125, 0, 1, 0, 0, 125, 0, 0], "semantic": {"name": "tpl_helpers", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97929:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97929:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97929:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97929:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
try:
from tpl_helpers import __rand_questions, __print_category
except ImportError:
from .tpl_helpers import __rand_questions, __print_category
from random import randint as rint, choice
# **********************************
__print_category('Variables and Conditions', sub_path="FillGaps", _type="CLOZE")
... | ajibawa-2023/Python-Code-Large/train/row_97930 | 112 | 163 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97930:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0153, 0.0245, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97930:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97930:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97930:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97930:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from random import randint
#~ from helpers import *
#~ __print_category('FUNCTIONS')
def __rand_questions(fun, args_intervals, how_many):
__print_category(fun.__name__+'_RANDOM')
for i in range(how_many):
args = [randint(*interval) for interval in args_intervals]
fun( *args )
def __... | ajibawa-2023/Python-Code-Large/train/row_97931 | 149 | 233 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97931:ImportFrom_L2_C0", "label": "from random import randint", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0086, 0.0043, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["ran... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97931:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97931:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97931:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97931:For_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from random import randint, choice
#~ from helpers import *
#~ __print_category('FUNCTIONS')
def __rand_questions(fun, args_intervals, how_many):
__print_category(fun.__name__+'_RANDOM')
for i in range(how_many):
args = [randint(*interval) for interval in args_intervals]
fun( *args )
import ... | ajibawa-2023/Python-Code-Large/train/row_97932 | 151 | 349 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97932:ImportFrom_L2_C0", "label": "from random import randint, choice", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0029, 0, 0.66, 0.0, 715, 0, 2, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97932:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97932:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97932:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97932:For_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
# Also of interest:
# http://docs.moodle.org/25/en/Programmed_responses_question_type
# http://docs.moodle.org/25/en/question/type/correctwriting -- sakinio struktūros klausimai
# http://docs.moodle.org/25/en/Multinumerical_question_type
# http://docs.moodle.org/dev/Opaque
#~ from random import randint
#~ def Arith... | ajibawa-2023/Python-Code-Large/train/row_97933 | 71 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97933:Try_L17_C0", "label": "try", "type": "try", "loc": [17, 20], "level": 0, "parent": null, "vector": [7, 0, 0.1555, 0.0336, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97933:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97933:ImportFrom_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97933:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97933:ImportFrom_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from random import randint
import os
import inspect
def __print_category(cat_name, sub_path='Testas-X', _type="GIFT"):
if sub_path: cat_name = sub_path+'/'+cat_name
if _type=="GIFT":
print("\n$CATEGORY: $system$/%s\n" % cat_name )
if _type=="CLOZE":
print("""
<... | ajibawa-2023/Python-Code-Large/train/row_97934 | 33 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97934:ImportFrom_L1_C0", "label": "from random import randint", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["ran... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97934:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97934:If_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97934:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97934:Assign_L7_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
# http://docs.python.org/3.2/tutorial/errors.html
# http://docs.python.org/3.2/library/exceptions.html#bltin-exceptions
"""
invalid syntax
name '….' is not defined
unindent does not match any
outer indentation level
expected an indented block
can't assign to operator
can't assign to literal
"""
"""
a = 1
while b <... | ajibawa-2023/Python-Code-Large/train/row_97935 | 38 | 141 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97935:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0567, 0.0638, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97935:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97935:While_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97935:While_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97935:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/... |
try:
from tpl_helpers import __rand_questions, __print_category
except ImportError:
from .tpl_helpers import __rand_questions, __print_category
def test_gap_with_alternatives(_a=7):
x = _a
if x > 10: # alternative could be in C: "or" vs "||" HIDE(x >)~(=x>\=)
print("big")
else: ... | ajibawa-2023/Python-Code-Large/train/row_97936 | 64 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97936:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0287, 0.046, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snip... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97936:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97936:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97936:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97936:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import inspect
import pygments
import re
#~ from Questions_tpl.variables_and_conditions import *
from pygments.lexers import PythonLexer, CppLexer
pylexer = lexer = PythonLexer(ensurenl=False)
cpplexer = CppLexer(ensurenl=False)
def adapt_code_spacing(code, unneeded='', needed_once=' ', ignore_space_after_escape_... | ajibawa-2023/Python-Code-Large/train/row_97937 | 98 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97937:Import_L3_C0", "label": "inspect import inspect", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0197, 0.0066, 0, 0.66, 0.0, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "inspect", "arg_names": [], "import_names": ["inspect"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97937:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97937:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97937:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97937:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
# -*- coding: utf-8 -*-
"""
codegen
~~~~~~~
Extension to ast that allow ast -> python code generation.
:copyright: Copyright 2008 by Armin Ronacher.
:license: BSD.
"""
from ast import *
BOOLOP_SYMBOLS = {
And: 'and',
Or: 'or'
}
BINOP_SYMBOLS = {
Add: '+',
S... | ajibawa-2023/Python-Code-Large/train/row_97938 | 424 | 574 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97938:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0105, 0.0157, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97938:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97938:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97938:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97938:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code... |
s = 5
for x in [1, 3, 2]:
print('1st', x)
if x > 2:
for z in range(2): print('2nd')
print('bla')
for i in range(x):
a = i
print('3rd', i)
print('back to 1st')
print('end')
| ajibawa-2023/Python-Code-Large/train/row_97939 | 12 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97939:Assign_L1_C0", "label": "s =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 553, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97939:For_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97939:Expr_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97939:For_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97939:If_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97939:I... |
import re
re_docs = re.compile(r'"""(.*?)"""', re.DOTALL)
import py2cpp
from pygments.lexers import PythonLexer
lexer = PythonLexer(ensurenl=False)
def delete_comments(src, containing=''):
lines = src.split('\n')
for nr, line in enumerate(lines):
for t in lexer.get_tokens( line ):
... | ajibawa-2023/Python-Code-Large/train/row_97940 | 118 | 241 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97940:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97940:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97940:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97940:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97940:For_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import json
import re
file_name = 'a' #'demo'
with open(file_name+'.trace.json', 'r') as f:
trace_json_txt = f.read()
#~ data = json.load ( trace_json_txt )
data = eval ( trace_json_txt )
code = data['code']
linecodes = code.split('\n')
trace = data['trace']
print ( '\n### TRACE: ', json.dumps(trace, sort_keys... | ajibawa-2023/Python-Code-Large/train/row_97941 | 128 | 301 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97941:Import_L1_C0", "label": "json import json", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 0, 0.66, 0.0, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97941:For_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97941:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97941:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97941:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97... |
#! /usr/bin/env python
# coding=utf8
class TBaseGraph:
def GetVertexCount(self):
return 0
def GetAdj(self, vertexNum):
return []
def GetWeight(self, fromV, toV):
return 0
class TGraphMatrix(TBaseGraph):
def __init__(self, matrix):
self.Matrix = matrix
def GetVert... | ajibawa-2023/Python-Code-Large/train/row_97942 | 90 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97942:ClassDef_L4_C0", "label": "TBaseGraph", "type": "class", "loc": [4, 12], "level": 0, "parent": null, "vector": [3, 0, 0.0615, 0.0692, 0, 0.66, 0.0, 996, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "TBaseGraph", "arg_names": [], "import_names": [], "rhs_call_name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97942:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97942:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97942:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97942:Return_L6_C8"}, {"f": "ajibawa-2023/Python-Code... |
import numpy as np
import numpy.random as nprand
import matplotlib.pyplot as plt
def spline(x, y, yp1 = 1e30, ypn = 1e30):
"""Spline method from nrbook. Computes theorical 2nd derivative on every point"""
n = len(x)
u=range(1,n)
y2 = [0]*n
if yp1 > 0.99e30:
y2[0]= 0.0
u[0]=0.0
else:
y2[0] = -0.5
u[0]=(... | ajibawa-2023/Python-Code-Large/train/row_97943 | 127 | 161 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97943:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0062, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97943:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97943:Expr_L6_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97943:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97943:Assign_L7_C1"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import numpy as np
import re # regexp
import matplotlib.pyplot as plt
import splines as sp
################################################################
# Airfoil : load profile of a wing
#
# Reads a file whose lines contain coordinates of points,
# separated by an empty line.
# Every line not containing a couple o... | ajibawa-2023/Python-Code-Large/train/row_97944 | 37 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97944:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97944:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97944:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97944:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97944:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Co... |
import numpy as np
import splines as sp
import matplotlib.pyplot as plt
import time
import numpy.random as nprand
def Left(f, a, b):
return (b - a) * f(a)
def Middle(f, a, b):
return (b - a) * f( (a+b)/2. )
def Middle_raf(f, a, b, epsilon, val = None):
bma = b-a
if (val == None):
val = bma * f( (a+b)/2. )
va... | ajibawa-2023/Python-Code-Large/train/row_97945 | 119 | 154 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97945:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97945:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97945:Return_L9_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97945:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97945:Return_L12_C1"}, {"f": "ajibawa-2023/Python-Code... |
import numpy as np
import pylab as pl
import splines as sp
from integration import Length
from load_foil import load_foil
def f_lambda(f, Lambda, h):
"Returns the function f_lambda, with h = hmin or hmax"
return lambda x: (1 - Lambda) * f(x) + 3 * Lambda * h
def show_colored(f, a, b, colour = (0,0,1), width = 4... | ajibawa-2023/Python-Code-Large/train/row_97946 | 64 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97946:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97946:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97946:Expr_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97946:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97946:Return_L9_C1"}, {"f": "ajibawa-2023/Python-Code-Lar... |
__author__ = 'grigory'
import sympy as smp
import copy
import scipy as sc
def ch(alpha, index, is_plus):
beta = copy.copy(alpha)
if is_plus:
if beta[2 * index + 1] > 0:
beta[2 * index + 1] -= 1
beta[2 * index] += 1
return beta
else:
if beta[2 * index] >... | ajibawa-2023/Python-Code-Large/train/row_97947 | 164 | 266 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97947:Assign_L1_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0038, 0.0038, 0, 0.66, 0.0, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97947:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97947:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97947:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97947:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import numpy as np
import pylab as plt
import matplotlib.pyplot as mp
### Methodes de choix du pas ###
def step_euler(y, t, h, f):
return h*f(y,t) + y
def step_ptmilieu(y, t, h, f):
return y + h*f( y + (h/2.) * f(y,t) , t+(h/2.) )
def step_heun(y,t,h,f):
return y + (h/2.) * ( f(y,t) + f( y + h*f(y,t) ... | ajibawa-2023/Python-Code-Large/train/row_97948 | 63 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97948:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0122, 0.0122, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97948:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97948:Return_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97948:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97948:Return_L12_C4"}, {"f": "ajibawa-2023/Python-Code... |
#-*- coding=utf-8 -*-
import numpy as np
import matplotlib.pyplot as mp
from matplotlib.animation import ArtistAnimation
import partie1_methodes as p1
def SolveMaillon1(theta, w, g, l, N, times, meth):
"Fonction resolvant le problème du pendule simple"
h = times/N
eq = [(0.,[theta, w]),lambda X,t:np.array([X[1],(... | ajibawa-2023/Python-Code-Large/train/row_97949 | 215 | 310 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97949:Import_L2_C0", "label": "numpy import np", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0032, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97949:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97949:Expr_L10_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97949:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97949:Assign_L11_C1"}, {"f": "ajibawa-2023/Python-Code-L... |
import numpy as np
import matplotlib.pyplot as mp
import partie1_methodes as p1
### Test global ###
def test_meth():
"verifie l'exactitude de meth_epsilon (et donc de meth_n_step) dans plusieurs cas"
print "Tests de correction des methodes de resolution...\n"
# y = e^x
print "Equation : (y\'=y, y(0)=1) -> Solut... | ajibawa-2023/Python-Code-Large/train/row_97950 | 188 | 244 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97950:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97950:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97950:Expr_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97950:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97950:Expr_L9_C1"}, {"f": "ajibawa-2023/Python-Code-Large... |
import numpy as np
import partie1_methodes as meth
import matplotlib.pyplot as mp
def Malthus():
nmax = 200
x = np.arange(0.,10.+10./nmax,10./nmax)
mp.clf()
birth = 3.
death = 2.
eq = [(0., [7e9]), lambda X,t:np.array([(birth-death)*X[0]])]
res = meth.meth_n_step(eq, nmax, 10./nmax, m... | ajibawa-2023/Python-Code-Large/train/row_97951 | 107 | 131 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97951:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0076, 0.0076, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97951:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97951:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97951:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97951:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import numpy as np
import matplotlib.pyplot as mp
import partie1 as p1
def equation_2_corps(mA):
"""Cree une fonction decrivant les equations pour 2 corps pour le probleme de cauchy
Entree: mA reel masse du corps A
Sortie: f fonction equation du mouvement"""
def f(t,y):
return [y[2],y[3],(y... | ajibawa-2023/Python-Code-Large/train/row_97952 | 64 | 163 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97952:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0061, 0.0061, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97952:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97952:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97952:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97952:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Co... |
import numpy as np
import matplotlib.pyplot as mp
import partie1 as p1
#######################################################
## Modele de population malthusiens (Malthus) ##
#######################################################
def EquationMalthus (b,d):
def f(t,y):
return [b*y[0]-d... | ajibawa-2023/Python-Code-Large/train/row_97953 | 54 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97953:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0115, 0.0115, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97953:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97953:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97953:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97953:Return_L12_C8"}, {"f": "ajibawa-2023/Pyth... |
import numpy as np
import matplotlib.pyplot as mp
import partie5 as p5
import math
def Test_Video2Corps(r0,teta0,vr0,vteta0, t0, m, N, pas, nom):
res = p5.meca_2_corps(r0,teta0,vr0,vteta0,t0,m,N,pas)
minx = min(res[0])
maxx = max(res[0])
miny = min(res[1])
maxy = max(res[1])
for i in np.arange(... | ajibawa-2023/Python-Code-Large/train/row_97954 | 67 | 76 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97954:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0132, 0.0132, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97954:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97954:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97954:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97954:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import numpy as np
import matplotlib.pyplot as mp
################################################
# Calcul d'un pas selon 4 methodes differentes #
################################################
def step_euler (y, t, h, f):
""" fonction calculant un seul pas par la methode d'Euler """
n = len(y)
fty = f... | ajibawa-2023/Python-Code-Large/train/row_97955 | 99 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97955:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0077, 0.0077, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97955:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97955:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97955:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97955:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from os import listdir, system
from os.path import isfile, join
import re
import sys
import math
def digrafo(nodos, aristas, salida):
return '2 '+ str(nodos) + ' ' + str(aristas) + ' ' + '1' + ' ' + '1' + ' '\
+ salida +'_'+ str(nodos).zfill(5) +'_'+ str(aristas) + '.graph' + ' 0'
def dag(nodos, arista... | ajibawa-2023/Python-Code-Large/train/row_97956 | 24 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97956:ImportFrom_L1_C0", "label": "from os import listdir, system", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.027, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["listd... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97956:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97956:Return_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97956:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97956:Return_L12_C1"}, {"f": "ajibawa-2023/Python-Code... |
from os import listdir, system
from os.path import isfile, join
import sys
from StringIO import StringIO
import re
if __name__ == '__main__':
mypath = '.'
output = sys.argv[1]
files = [ f for f in listdir(mypath) if isfile(join(mypath,f)) and re.match(output+'.*\.graph$', f) ]
mo = re.match('([0-9 a-z A... | ajibawa-2023/Python-Code-Large/train/row_97957 | 20 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97957:ImportFrom_L1_C0", "label": "from os import listdir, system", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["listd... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97957:If_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97957:Assign_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97957:If_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97957:Assign_L9_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_979... |
from os import listdir, system
from os.path import isfile, join
import re
import sys
import math
def digrafo(nodos, aristas, salida):
return '2 '+ str(nodos) + ' ' + str(aristas) + ' ' + '1' + ' ' + '1' + ' '\
+ salida +'_'+ str(nodos) +'_'+ str(aristas).zfill(5) + '.graph' + ' 0'
def dag(nodos, arista... | ajibawa-2023/Python-Code-Large/train/row_97958 | 24 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97958:ImportFrom_L1_C0", "label": "from os import listdir, system", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.027, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["listd... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97958:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97958:Return_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97958:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97958:Return_L12_C1"}, {"f": "ajibawa-2023/Python-Code... |
import numpy as np
import newton as nw
import matplotlib.pyplot as plt
#------------------------------------------------------------------------#
# EQUILIBRE ELECTROSTATIQUE #
#------------------------------------------------------------------------#
def term_energy_E(n,k)... | ajibawa-2023/Python-Code-Large/train/row_97959 | 118 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97959:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97959:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97959:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97959:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97959:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-C... |
# -*- coding:utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
epsilon = 0.00000000000001
nmax = 1000
#------------------------------------------------------------------------#
# METHODE DE NEWTON-RAPHSON #
#-----------------------------------------------------... | ajibawa-2023/Python-Code-Large/train/row_97960 | 104 | 139 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97960:Import_L3_C0", "label": "numpy import np", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0216, 0.0072, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97960:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97960:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97960:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97960:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
#lista = [2,40,1,30,5] #en c se usa un vector n+1 dimension
def insertion_sort(list2):
for i in range(1, len(list2)):
j = i
while j > 0 and list2[j] < list2[j-1]:
list2[j], list2[j - 1] = list2[j-1], list2[j] #swap
j -= 1
return list2
def posMenor(ls,i,n):
posm = i
... | ajibawa-2023/Python-Code-Large/train/row_97962 | 68 | 93 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97962:FunctionDef_L3_C0", "label": "insertion_sort", "type": "function", "loc": [3, 9], "level": 0, "parent": null, "vector": [2, 0, 0.0645, 0.0753, 0, 0.66, 0.0, 413, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "insertion_sort", "arg_names": ["list2"], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97962:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97962:For_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97962:For_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97962:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
def facorial(n):
if n==1: return n
return n*facorial(n-1)
def multiplicar(a,b):
if b==1:
return a
return a+multiplicar(a,b-1)
def binario(n):
if n != 0:
binario(n/2)
print str(n%2),
def binario_ww(n):
if n<2:
print n%2,
else:
binario_ww(n/2)
print n%2,
def fibo(n):
if n<=2... | ajibawa-2023/Python-Code-Large/train/row_97963 | 27 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97963:FunctionDef_L2_C0", "label": "facorial", "type": "function", "loc": [2, 4], "level": 0, "parent": null, "vector": [2, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 833, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "facorial", "arg_names": ["n"], "import_names": [], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97963:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97963:If_L3_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97963:If_L3_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_97963:Return_L3_C11"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
#! /usr/bin/env python
from random import randint
from random import shuffle
import math
#n vertices y m aristas
# u
# b
# k
#defino el nombre de cada archivo
fo = open("instancias.in", "wb")
for q in range(500):
n = randint(5,200)
#calculo la cantidad de aristas del grafo completo
completo = n*(n-1)*0.5
#ar... | ajibawa-2023/Python-Code-Large/train/row_97964 | 34 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97964:ImportFrom_L3_C0", "label": "from random import randint", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.0167, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["randi... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97964:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97964:Assign_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97964:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97964:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=15139669
"""
Write a method that takes a camilCase string as a parameter and returns underscore_case as output. Assume that input can be null or ... | ajibawa-2023/Python-Code-Large/train/row_97965 | 42 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97965:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1034, 0.0517, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97965:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97965:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97965:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97965:Return_L17_C14"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14581715
#Google interview question
"""
Given an array of intergers. Write a program to print all the permu... | ajibawa-2023/Python-Code-Large/train/row_97966 | 32 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97966:Import_L1_C0", "label": "os import os, re, sys\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97966:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97966:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97966:If_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97966:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=15029918
#Google interview question
"""
Given two string S1 and S2. S1 contains from A-Z and S2 contains A-Z, * and ?
Where * means any character ... | ajibawa-2023/Python-Code-Large/train/row_97968 | 74 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97968:Import_L1_C0", "label": "os import os, re, sys\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0133, 0.0133, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97968:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97968:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97968:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97968:If_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=11532811
"""
Given an array A[], find (i, j) such that A[i] < A[j] and (j - i) is maximum.
"""
from utils import *
@time_profile
def find_max_... | ajibawa-2023/Python-Code-Large/train/row_97969 | 49 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97969:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0938, 0.0469, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97969:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97969:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97969:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97969:Return_L12_C14"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=6227714491023360
'''
suppose a string is consists of a, b, and c
Now given a integer N, output the amount of all possible strings of length N th... | ajibawa-2023/Python-Code-Large/train/row_97970 | 45 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97970:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1014, 0.0725, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97970:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97970:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97970:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97970:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=15139669
"""
Write a method that takes a camilCase string as a parameter and returns underscore_case as output. Assume that input can be null or ... | ajibawa-2023/Python-Code-Large/train/row_97972 | 42 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97972:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1034, 0.0517, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97972:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97972:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97972:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97972:Return_L17_C14"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14581715
#Google interview question
"""
Given an array of intergers. Write a program to print all the permu... | ajibawa-2023/Python-Code-Large/train/row_97976 | 32 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97976:Import_L1_C0", "label": "os import os, re, sys\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97976:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97976:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97976:If_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97976:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=11532811
"""
Given an array A[], find (i, j) such that A[i] < A[j] and (j - i) is maximum.
"""
from utils import *
@time_profile
def find_max_... | ajibawa-2023/Python-Code-Large/train/row_97977 | 49 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97977:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0938, 0.0469, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97977:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97977:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97977:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97977:Return_L12_C14"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=6227714491023360
'''
suppose a string is consists of a, b, and c
Now given a integer N, output the amount of all possible strings of length N th... | ajibawa-2023/Python-Code-Large/train/row_97978 | 45 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97978:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1014, 0.0725, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97978:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97978:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97978:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97978:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14991189
#Google interview question
"""
Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more ... | ajibawa-2023/Python-Code-Large/train/row_97979 | 21 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97979:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2414, 0.1034, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97979:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97979:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97979:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97979:For_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=5361917182869504
"""
a 32-bit integer could be splited into 32 small integers as:
1. bit 0~4
2. bit 1~5
...
31. bit 30~31 and... | ajibawa-2023/Python-Code-Large/train/row_97980 | 70 | 94 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97980:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 13], "level": 0, "parent": null, "vector": [8, 0, 0.0957, 0.0957, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97980:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97980:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97980:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97980:If_L24_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=14813758
"""
Given 2 arrays A,B, where x(A.length) < y(B.length), we want to
insert (y - x) 0's to A at various places such that A*B is minimum. ... | ajibawa-2023/Python-Code-Large/train/row_97981 | 65 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97981:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0872, 0.0698, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97981:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97981:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97981:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97981:Return_L16_C25"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=14736688
"""
The maximum suffix of a string is the lexicographically largest suffix of the string. The maximum
suffix problem is to find the maxi... | ajibawa-2023/Python-Code-Large/train/row_97982 | 67 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97982:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0684, 0.0421, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97982:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97982:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97982:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97982:Return_L18_C14"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=15029918
#Google interview question
"""
Given two string S1 and S2. S1 contains from A-Z and S2 contains A-Z, * and ?
Where * means any character ... | ajibawa-2023/Python-Code-Large/train/row_97984 | 74 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97984:Import_L1_C0", "label": "os import os, re, sys\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0133, 0.0133, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97984:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97984:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97984:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97984:If_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14851686
#Facebook interview question
import random
import time
def random_arr(length = random.randint(10, 20), min = 0, max = 100):
result ... | ajibawa-2023/Python-Code-Large/train/row_97986 | 33 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97986:Import_L7_C0", "label": "random import random", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1458, 0.0208, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97986:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97986:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97986:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97986:Return_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=5361917182869504
"""
a 32-bit integer could be splited into 32 small integers as:
1. bit 0~4
2. bit 1~5
...
31. bit 30~31 and... | ajibawa-2023/Python-Code-Large/train/row_97987 | 70 | 94 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97987:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 13], "level": 0, "parent": null, "vector": [8, 0, 0.0957, 0.0957, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97987:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97987:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97987:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97987:If_L24_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=14736688
"""
The maximum suffix of a string is the lexicographically largest suffix of the string. The maximum
suffix problem is to find the maxi... | ajibawa-2023/Python-Code-Large/train/row_97989 | 67 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97989:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0684, 0.0421, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97989:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97989:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97989:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97989:Return_L18_C14"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
# http://www.careercup.com/question?id=14813758
"""
Given 2 arrays A,B, where x(A.length) < y(B.length), we want to
insert (y - x) 0's to A at various places such that A*B is minimum. ... | ajibawa-2023/Python-Code-Large/train/row_97990 | 65 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97990:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0872, 0.0698, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97990:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97990:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97990:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97990:Return_L16_C25"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14991189
#Google interview question
"""
Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more ... | ajibawa-2023/Python-Code-Large/train/row_97991 | 21 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97991:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2414, 0.1034, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97991:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97991:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97991:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97991:For_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=9820788
#Facebook interview question
"""
there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so on..
It looks something like ... | ajibawa-2023/Python-Code-Large/train/row_97992 | 22 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97992:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 14], "level": 0, "parent": null, "vector": [8, 0, 0.2326, 0.2093, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97992:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97992:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97992:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97992:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=9332640
#Facebook interview question
"""
Really like the linear solution of this problem. You have an array of 0s and 1s and you want to output al... | ajibawa-2023/Python-Code-Large/train/row_97993 | 19 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97993:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 15], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.2857, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97993:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97993:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97993:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97993:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
"""
http://www.careercup.com/question?id=14967793
You are given an input form such as the following
(1, (2, 3), (4, (5, 6), 7))
Each element is either a number or a list (whose element... | ajibawa-2023/Python-Code-Large/train/row_97994 | 15 | 30 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97994:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 13], "level": 0, "parent": null, "vector": [8, 0, 0.2833, 0.3333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97994:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97994:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97994:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97994:For_L20_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=12945663
#Facebook interview question
"""
Write a function f(n) which computes the number of scoring sequences that add up to score n.
"""
def ca... | ajibawa-2023/Python-Code-Large/train/row_97995 | 10 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97995:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 8], "level": 0, "parent": null, "vector": [8, 0, 0.35, 0.15, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97995:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97995:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97995:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97995:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14633700
#Facebook interview question
"""
Determine winner of 2/9 number game
Two players play the following game: they pick a random number N (l... | ajibawa-2023/Python-Code-Large/train/row_97996 | 16 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97996:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 13], "level": 0, "parent": null, "vector": [8, 0, 0.3393, 0.2857, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97996:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97996:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97996:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_97996:Return_L16_C15"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14851686
#Facebook interview question
import random
def find_point_intersect_most(arr):
points = [(interval[0], 0) for interval in arr] + [(... | ajibawa-2023/Python-Code-Large/train/row_97997 | 20 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97997:Import_L6_C0", "label": "random import random", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2069, 0.0345, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97997:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97997:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97997:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97997:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14681714
#Facebook interview question
"""
Given a set {1,2,3,4,5...n} of n elements, write code that outputs all subsets of length k. For example,... | ajibawa-2023/Python-Code-Large/train/row_97998 | 16 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97998:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2414, 0.1034, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97998:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97998:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97998:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97998:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=9332640
#Facebook interview question
"""
Really like the linear solution of this problem. You have an array of 0s and 1s and you want to output al... | ajibawa-2023/Python-Code-Large/train/row_97999 | 19 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_97999:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 15], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.2857, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_97999:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97999:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97999:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97999:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14851686
#Facebook interview question
from utils import *
def find_non_adjacent_sub_sequence(arr):
if not arr: return (0, )
if len(arr) ... | ajibawa-2023/Python-Code-Large/train/row_98000 | 34 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98000:ImportFrom_L7_C0", "label": "from utils import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1489, 0.0213, 0, 0.66, 0.0, 970, 0, 1, 0, 0, 970, 0, 0], "semantic": {"name": "utils", "arg_names": [], "import_names": ["*"], "rhs_c... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98000:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98000:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98000:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98000:Return_L10_C16"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=12945663
#Facebook interview question
"""
Write a function f(n) which computes the number of scoring sequences that add up to score n.
"""
def ca... | ajibawa-2023/Python-Code-Large/train/row_98001 | 10 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98001:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 8], "level": 0, "parent": null, "vector": [8, 0, 0.35, 0.15, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98001:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98001:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98001:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98001:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14851686
#Facebook interview question
import random
import time
def random_arr(length = random.randint(10, 20), min = 0, max = 100):
result ... | ajibawa-2023/Python-Code-Large/train/row_98002 | 33 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98002:Import_L7_C0", "label": "random import random", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1458, 0.0208, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98002:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98002:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98002:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98002:Return_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14633700
#Facebook interview question
"""
Determine winner of 2/9 number game
Two players play the following game: they pick a random number N (l... | ajibawa-2023/Python-Code-Large/train/row_98003 | 16 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98003:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 13], "level": 0, "parent": null, "vector": [8, 0, 0.3393, 0.2857, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98003:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98003:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98003:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98003:Return_L16_C15"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14945498
#Google interview question
import os, re, sys, getopt
import logging
import locale
if __name__ == '__main__':
output = []
buf = ... | ajibawa-2023/Python-Code-Large/train/row_98004 | 29 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98004:Import_L6_C0", "label": "os import os, re, sys\u2026", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0238, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98004:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98004:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98004:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98004:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=9820788
#Facebook interview question
"""
there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so on..
It looks something like ... | ajibawa-2023/Python-Code-Large/train/row_98005 | 22 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98005:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 14], "level": 0, "parent": null, "vector": [8, 0, 0.2326, 0.2093, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98005:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98005:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98005:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98005:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
"""
http://www.careercup.com/question?id=14967793
You are given an input form such as the following
(1, (2, 3), (4, (5, 6), 7))
Each element is either a number or a list (whose element... | ajibawa-2023/Python-Code-Large/train/row_98006 | 15 | 30 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98006:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 13], "level": 0, "parent": null, "vector": [8, 0, 0.2833, 0.3333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98006:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98006:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98006:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98006:For_L20_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=13216725
#Facebook interview question
"""
An expression consisting of operands and binary operators can be written in Reverse Polish Notation (RPN... | ajibawa-2023/Python-Code-Large/train/row_98007 | 37 | 74 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98007:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 35], "level": 0, "parent": null, "vector": [8, 0, 0.277, 0.4054, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98007:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98007:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98007:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98007:If_L39_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14945498
#Google interview question
import os, re, sys, getopt
import logging
import locale
if __name__ == '__main__':
output = []
buf = ... | ajibawa-2023/Python-Code-Large/train/row_98008 | 29 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98008:Import_L6_C0", "label": "os import os, re, sys\u2026", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0238, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98008:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98008:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98008:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98008:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14851686
#Facebook interview question
import random
import time
def random_arr(length = random.randint(10, 20), min = 0, max = 100):
result ... | ajibawa-2023/Python-Code-Large/train/row_98009 | 33 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98009:Import_L7_C0", "label": "random import random", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1458, 0.0208, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98009:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98009:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98009:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98009:Return_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14681714
#Facebook interview question
"""
Given a set {1,2,3,4,5...n} of n elements, write code that outputs all subsets of length k. For example,... | ajibawa-2023/Python-Code-Large/train/row_98010 | 16 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98010:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2414, 0.1034, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98010:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98010:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98010:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98010:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14851686
#Facebook interview question
import random
def find_point_intersect_most(arr):
points = [(interval[0], 0) for interval in arr] + [(... | ajibawa-2023/Python-Code-Large/train/row_98011 | 20 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98011:Import_L6_C0", "label": "random import random", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2069, 0.0345, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98011:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98011:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98011:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98011:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import random
"""
http://www.careercup.com/question?id=14859694
Given an array and a key, sum min subarray whose sum is no less than key. O(n) Time needed
Assumption: all positive intergers in the array
"""
def minLength(arr, k):
min_length, sum, start = len(arr) + 1, 0, 0
s, e = -1, -1
for i in rang... | ajibawa-2023/Python-Code-Large/train/row_98012 | 50 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98012:Import_L1_C0", "label": "random import random", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0133, 0.0133, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98012:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98012:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98012:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98012:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=13216725
#Facebook interview question
"""
An expression consisting of operands and binary operators can be written in Reverse Polish Notation (RPN... | ajibawa-2023/Python-Code-Large/train/row_98013 | 37 | 74 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98013:Expr_L6_C0", "label": "expression", "type": "expression", "loc": [6, 35], "level": 0, "parent": null, "vector": [8, 0, 0.277, 0.4054, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98013:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98013:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98013:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98013:If_L39_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
#!/usr/bin/env python
# -*- indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
# vi: set ts=4 sts=4 sw=4 set smarttab set expandtab
#http://www.careercup.com/question?id=14851686
#Facebook interview question
from utils import *
def find_non_adjacent_sub_sequence(arr):
if not arr: return (0, )
if len(arr) ... | ajibawa-2023/Python-Code-Large/train/row_98014 | 34 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98014:ImportFrom_L7_C0", "label": "from utils import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1489, 0.0213, 0, 0.66, 0.0, 970, 0, 1, 0, 0, 970, 0, 0], "semantic": {"name": "utils", "arg_names": [], "import_names": ["*"], "rhs_c... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98014:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98014:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98014:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98014:Return_L10_C16"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
'''
Created on Apr 16, 2012
@author: Gangli
'''
import argparse;
import re;
import sys;
logcodes = [];
def addlogcode(logcode):
global logcodes;
if logcode not in logcodes:
logcodes.append(logcode);
def inlogcodelist(logcode):
global logcodes;
return (logcode in logcodes... | ajibawa-2023/Python-Code-Large/train/row_98022 | 21 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98022:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0833, 0.1389, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98022:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98022:If_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98022:If_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98022:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
import sys;
import re;
from fnmatch import fnmatch;
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: extractcods.py <javaloader-dir-file>";
sys.exit(1);
nCount = 0;
with open(sys.argv[1], "rt") as fin:
for line in fin:
mo = re.search("^(\... | ajibawa-2023/Python-Code-Large/train/row_98023 | 3 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98023:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", ... | [] |
import sys;
import os;
import os.path;
from fnmatch import fnmatch;
WHITELIST = ["build.xml" \
, "build-barebone.xml" \
, "build-component.xml" \
, "build-evacuated-component-macros.xml" \
, "build-core.xml" \
, "build-device.xml" \
];
if __name__ == '__main__':
if len(sys.argv) < 2:
prin... | ajibawa-2023/Python-Code-Large/train/row_98025 | 4 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98025:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name"... | [] |
import sys;
import os;
import os.path;
from fnmatch import fnmatch;
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: listpng.py <directory>";
sys.exit(1);
sDirectory = os.path.dirname(sys.argv[1]);
for (curdir, dirs, files) in os.walk(sDirectory):
... | ajibawa-2023/Python-Code-Large/train/row_98030 | 4 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98030:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name"... | [] |
import numpy as np
import numpy.linalg as nl
def stripe_length(A):
sup = -1
inf = -1
n = A.shape[0]
#calcul de la largeur de la bande sup: ballayage des lignes
#paralleles a la diagonale en commencant par la plus eloignee
#de la diagonale (i.e l'element A(1,n))
for i in np.arange(n):
... | ajibawa-2023/Python-Code-Large/train/row_98031 | 199 | 253 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98031:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98031:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98031:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98031:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98031:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import numpy as np
import matplotlib.pyplot as plt
import methodeIterative as mi
import methodeDirecte as md
#****************** Generations ************************************0
def generateMatrixHeat(n):
A = np.zeros([n*n,n*n])
A += np.diag(-4*np.ones(n*n, dtype=np.int),0)
A += np.diag(np.ones(n*n-1, dty... | ajibawa-2023/Python-Code-Large/train/row_98033 | 53 | 120 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98033:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0083, 0.0083, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98033:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98033:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98033:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98033:Return_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
def spacify(input, dict):
"""Given a string and a dictionary, if it is possible to seperate the string
into a set of words that are in the dictionary, returns a string equivilant to
the input string but with spaces between the valid dictionary words. If there
is no way to break up the input string into... | ajibawa-2023/Python-Code-Large/train/row_98034 | 16 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98034:FunctionDef_L2_C0", "label": "spacify", "type": "function", "loc": [2, 24], "level": 0, "parent": null, "vector": [2, 0, 0.4643, 0.8214, 0, 0.66, 0.0, 404, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "spacify", "arg_names": ["input", "dict"], "import_names": [], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98034:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98034:Expr_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98034:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98034:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import codeJamUtils
def _build_board(case):
numRows, numCols, numMines = case
freeSpaces = numCols * numRows - numMines
board = []
doTransposeResult = False
# for convenience make sure the board is either square or wider than it is tall
if numRows > numCols:
numCols, numRows = numRows,... | ajibawa-2023/Python-Code-Large/train/row_98035 | 67 | 126 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98035:Import_L1_C0", "label": "codeJamUtils import codeJamUtils", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0079, 0.0079, 0, 0.66, 0.0, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "codeJamUtils", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98035:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98035:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98035:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98035:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import codeJamUtils
import operator
def _calculate_optimal_deletions(case):
numVerticies, adjacencyList = case
# The key insight here is that only a single node in any full binary tree may serve as the
# root (the only node with degree 2, as inner nodes have degree 3 and leaves degree 1).
# It is rela... | ajibawa-2023/Python-Code-Large/train/row_98036 | 50 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98036:Import_L1_C0", "label": "codeJamUtils import codeJamUtils", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "codeJamUtils", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98036:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98036:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98036:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98036:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import codeJamUtils
import sys
def _find_best_flip_num(case):
outletFlowStrs, deviceFlowStrs = case
if (len(outletFlowStrs) == 0 or len(outletFlowStrs) != len(deviceFlowStrs)):
return -1
L = len(outletFlowStrs[0])
# for each possible flip string, apply it to out outlet flows, and check that
... | ajibawa-2023/Python-Code-Large/train/row_98037 | 38 | 83 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98037:Import_L1_C0", "label": "codeJamUtils import codeJamUtils", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.012, 0, 0.66, 0.0, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "codeJamUtils", "arg_names": [], "import_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98037:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98037:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98037:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98037:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import codeJamUtils
def compute_badrand_probability_matrix(N):
M_nextiter = [[0.0 for _ in range(N)] for _ in range(N)]
M_previter = [[0.0 for _ in range(N)] for _ in range(N)]
i = N
swapProb = 1/N
noSwapProb = 1 - swapProb
# working backwards from the last iteration of badrand, we can compu... | ajibawa-2023/Python-Code-Large/train/row_98038 | 42 | 83 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98038:Import_L1_C0", "label": "codeJamUtils import codeJamUtils", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.012, 0, 0.66, 0.0, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "codeJamUtils", "arg_names": [], "import_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98038:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98038:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98038:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98038:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import codeJamUtils
import sys
def _compute_time(case):
farmCost, farmRate, goal = case
maxRate = 2
prevTime = sys.maxsize
curTime = goal / 2
while curTime <= prevTime:
prevTime = curTime
# go back to before we went for goal
curTime -= goal/maxRate
# and this time... | ajibawa-2023/Python-Code-Large/train/row_98039 | 22 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98039:Import_L1_C0", "label": "codeJamUtils import codeJamUtils", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0222, 0, 0.66, 0.0, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "codeJamUtils", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98039:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98039:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98039:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98039:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import codeJamUtils
def _compute_scores(case):
return (_compute_optimal_deceitful_war_score(case), _compute_optimal_war_score(case))
def _compute_optimal_war_score(case):
# in war, p1 has no information about the weights of p2's blocks. p1 can assume
# that p2 will use a greedy algorithm; for each block B... | ajibawa-2023/Python-Code-Large/train/row_98040 | 30 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98040:Import_L1_C0", "label": "codeJamUtils import codeJamUtils", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0172, 0.0172, 0, 0.66, 0.0, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "codeJamUtils", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98040:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98040:Return_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98040:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98040:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
if __name__ == "__main__":
pass | ajibawa-2023/Python-Code-Large/train/row_98041 | 1 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98041:If_L6_C0", "label": "if", "type": "if", "loc": [6, 7], "level": 0, "parent": null, "vector": [4, 0, 0.9286, 0.2857, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippe... | [] |
def get_input_lines(filename):
with open("CodeJamSolutions\\Input\\" + filename) as inputFile:
return inputFile.readlines()
def write_output(filename, caseNum, result):
mode = "a"
if caseNum == 1:
mode = "w"
with open("CodeJamSolutions\\Output\\" + filename, mode) as outputFile:
... | ajibawa-2023/Python-Code-Large/train/row_98042 | 7 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98042:FunctionDef_L2_C0", "label": "get_input_lines", "type": "function", "loc": [2, 4], "level": 0, "parent": null, "vector": [2, 0, 0.2308, 0.2308, 0, 0.66, 0.0, 34, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_input_lines", "arg_names": ["filename"], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98042:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98042:Return_L4_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98042:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98042:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.