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 |
|---|---|---|---|---|---|---|---|
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import os
import mimetypes
from weibopy.binder import bind_api
from weibopy.error import WeibopError
from weibopy.parsers import ModelParser
class API(object):
"""Twitter API"""
def __init__(self, auth_handler=None,
host='api.t.... | ajibawa-2023/Python-Code-Large/train/row_128 | 273 | 811 | 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_128:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0012, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from weibopy.error import WeibopError
class Cursor(object):
"""Pagination helper class"""
def __init__(self, method, *args, **kargs):
if hasattr(method, 'pagination_mode'):
if method.pagination_mode == 'cursor':
... | ajibawa-2023/Python-Code-Large/train/row_129 | 75 | 128 | 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_129:ImportFrom_L5_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0391, 0.0078, 0, 0.66, 0.0, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import time
import threading
import os
import cPickle as pickle
try:
import hashlib
except ImportError:
# python 2.4
import md5 as hashlib
try:
import fcntl
except ImportError:
# Probably on a windows system
# TODO: use win32f... | ajibawa-2023/Python-Code-Large/train/row_130 | 158 | 264 | 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_130:Import_L5_C0", "label": "time import time", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0038, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:T... |
#coding:utf8
import os, sys
from bottle import route, run, debug, template, request, validate, error, response, redirect
# only needed when you run Bottle on mod_wsgi
from bottle import default_app
from y_home import *
from y_apply import *
from y_admin import *
from y_login import *
#reload(sys)
#sys.setdefaultencodi... | ajibawa-2023/Python-Code-Large/train/row_131 | 14 | 25 | 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_131:Import_L2_C0", "label": "os import os, sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.08, 0.04, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "sys"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_131:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_13... |
import sys, uuid
from datetime import datetime
def now():
return str(datetime.now()) + " "
dic = open("tag_list.dict", "r")
result = []
dic2 = []
dic3 = []
for item in dic:
m = unicode(item, "utf-8").split()
if len(m) > 1:
tag, group = m
else:
tag, group = m[0], "0"
... | ajibawa-2023/Python-Code-Large/train/row_135 | 23 | 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_135:Import_L1_C0", "label": "sys import sys, uuid", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 0, 0.66, 0.0, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "uuid"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_135:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_135:Return_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
#coding:utf-8
from threading import Thread
from Queue import Queue
from time import sleep
import sqlite3
import sys, re, StringIO
import urllib2 as urllib
q = Queue()
NUM = 17
JOBS = 3000
results = []
def craw(arguments):
global results
try:
a = unicode(urllib.urlopen("http://tbole.com/result.php?searc... | ajibawa-2023/Python-Code-Large/train/row_136 | 41 | 53 | 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_136:ImportFrom_L2_C0", "label": "from threading import Thread", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0377, 0.0189, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Th... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
#coding:utf-8
#!/usr/bin/env python
from threading import Thread
from Queue import Queue
from time import sleep
import sqlite3
import sys, re, StringIO, os
import urllib2 as urllib
from datetime import datetime
q = Queue()
NUM = 20
TIMEOUT = 0.1
C = (u"名人堂", u"媒体汇", u"品牌馆")
def now():
return str(dateti... | ajibawa-2023/Python-Code-Large/train/row_137 | 92 | 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_137:ImportFrom_L3_C0", "label": "from threading import Thread", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0252, 0.0084, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Th... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Return_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#coding:utf-8
from threading import Thread
from Queue import Queue
import sqlite3
import sys, re, StringIO
from time import sleep
import urllib2, urllib
TARGET = 1000
NUM = 10
ids = []
results = []
count = 0
q = Queue()
KEYS = ['招聘']
class UserAgentProcessor(urllib2.BaseHandler):
"""A handler to add a custom UA... | ajibawa-2023/Python-Code-Large/train/row_138 | 73 | 98 | 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_138:ImportFrom_L2_C0", "label": "from threading import Thread", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0102, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Th... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
#!/usr/bin/env python
#coding=utf-8
catelist = [
(1, u"传统网络Internet"),
(2, u"移动互联"),
(3, u"网游"),
(4, u"电子商务_B2C/团购"),
(5, u"软件、电信"),
(6, u"新媒体"),
(7, u"风投/投行"),
(8, u"其他外企"),
]
idlist = [
[1, (u"超超Sandy", "d11c25990634d0e486235f1... | ajibawa-2023/Python-Code-Large/train/row_140 | 2 | 32 | 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_140:Assign_L4_C0", "label": "catelist =", "type": "assigned_variable", "loc": [4, 13], "level": 0, "parent": null, "vector": [14, 0, 0.2656, 0.3125, 0, 0.66, 0.0, 219, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "catelist", "arg_names": [], "import_names": [], "rhs_call_... | [] |
from pymining.segmenter import Segmenter
from pymining.configuration import Configuration
class detect:
def __init__(self):
self.cfg = Configuration.FromFile("pymining/conf/test.xml")
self.segmenter = Segmenter(self.cfg, "segmenter")
def Split(self, line):
wordList = self.segm... | ajibawa-2023/Python-Code-Large/train/row_141 | 9 | 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_141:ImportFrom_L1_C0", "label": "from pymining.segmenter import Segmenter", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "pymining.segmenter", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_141:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_141:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
class WeibopError(Exception):
"""Weibopy exception"""
def __init__(self, reason):
self.reason = reason.encode('utf-8')
def __str__(self):
return self.reason
| ajibawa-2023/Python-Code-Large/train/row_143 | 6 | 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_143:ClassDef_L5_C0", "label": "WeibopError", "type": "class", "loc": [5, 12], "level": 0, "parent": null, "vector": [3, 0, 0.6538, 0.6154, 0, 0.66, 0.0, 305, 0, 2, 0, 0, 645, 0, 1], "semantic": {"name": "WeibopError", "arg_names": [], "import_names": [], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_143:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from weibopy.utils import parse_datetime, parse_html_value, parse_a_href, \
parse_search_datetime, unescape_html
class ResultSet(list):
"""A list like object that holds results from a Twitter API query."""
class Model(object):
def _... | ajibawa-2023/Python-Code-Large/train/row_144 | 242 | 355 | 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_144:ImportFrom_L5_C0", "label": "from weibopy.utils import parse_datetime, parse_html_value, parse_a_href\u2026", "type": "import", "loc": [5, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0155, 0.0056, 0, 0.66, 0.0, 478, 0, 5, 0, 0, 478, 0, 0], "semantic": {"name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
"""
The MIT License
Copyright (c) 2007 Leah Culver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | ajibawa-2023/Python-Code-Large/train/row_145 | 389 | 654 | 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_145:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0183, 0.0352, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
"""
weibo API library
"""
__version__ = '1.5'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel
from weibopy.error import WeibopErr... | ajibawa-2023/Python-Code-Large/train/row_149 | 15 | 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_149:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 7], "level": 0, "parent": null, "vector": [8, 0, 0.2222, 0.1111, 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_149:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_149:Import_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_149:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_149:Assign_L26_C4"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import os
import mimetypes
from weibopy.binder import bind_api
from weibopy.error import WeibopError
from weibopy.parsers import ModelParser
class API(object):
"""Twitter API"""
def __init__(self, auth_handler=None,
host='api.t.... | ajibawa-2023/Python-Code-Large/train/row_151 | 273 | 811 | 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_151:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0012, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from weibopy.error import WeibopError
class Cursor(object):
"""Pagination helper class"""
def __init__(self, method, *args, **kargs):
if hasattr(method, 'pagination_mode'):
if method.pagination_mode == 'cursor':
... | ajibawa-2023/Python-Code-Large/train/row_152 | 75 | 128 | 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_152:ImportFrom_L5_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0391, 0.0078, 0, 0.66, 0.0, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import time
import threading
import os
import cPickle as pickle
try:
import hashlib
except ImportError:
# python 2.4
import md5 as hashlib
try:
import fcntl
except ImportError:
# Probably on a windows system
# TODO: use win32f... | ajibawa-2023/Python-Code-Large/train/row_153 | 158 | 264 | 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_153:Import_L5_C0", "label": "time import time", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0038, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:T... |
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from naive_bayes import NaiveBayes
if __name__ == "__main__":
config = Configuration.FromFile(... | ajibawa-2023/Python-Code-Large/train/row_155 | 17 | 21 | 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_155:ImportFrom_L1_C0", "label": "from matrix import Matrix", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0476, 0, 0.66, 0.0, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C... |
import math
from segmenter import Segmenter
from matrix import Matrix
from py_mining import PyMining
from configuration import Configuration
class ClassifierMatrix:
def __init__(self, config, nodeName, loadFromFile = False):
self.node = config.GetChild(nodeName)
self.segmenter = Segmenter(config, "... | ajibawa-2023/Python-Code-Large/train/row_156 | 123 | 203 | 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_156:Import_L1_C0", "label": "math import math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
if __name__ == "__main__":
"""
train
"""
#init dm platfrom, include segmenter..
config = Configuration.FromFile("test.conf")
PyMining.Init(config, "__global__")
matCreater = ClassifierMatrix(config, "__matrix__")
[trainx, trainy] = matCreater.CreateTrainMatrix("train.txt")
#or usin... | ajibawa-2023/Python-Code-Large/train/row_157 | 15 | 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_157:If_L1_C0", "label": "if", "type": "if", "loc": [1, 36], "level": 0, "parent": null, "vector": [4, 0, 0.5139, 1.0, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0"... |
#encoding=utf-8
import math
import pickle
import sys
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from twc_naive_bayes import TwcNaiveBayes
... | ajibawa-2023/Python-Code-Large/train/row_158 | 21 | 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_158:Import_L3_C0", "label": "math import math", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.037, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L1... |
from xml.dom import minidom
class Configuration:
mCurNode = None
def __init__(self, node):
self.mCurNode = node
"""
get first child
"""
def GetChild(self, name):
for node in self.mCurNode.childNodes:
if node.nodeName == name:
return Configurati... | ajibawa-2023/Python-Code-Large/train/row_159 | 34 | 46 | 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_159:ImportFrom_L1_C0", "label": "from xml.dom import minidom", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 0, 0.66, 0.0, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["min... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
#save materials produced during data-mining
class PyMining:
#dict store term -> id
termToId = {}
#dict store id -> term
idToTerm = {}
#dict store term -> how-many-docs-have-term
idToDocCount = {}
#dict store class -> how-many-docs-contained
classToDocCount = {}
#inverse document fre... | ajibawa-2023/Python-Code-Large/train/row_160 | 79 | 110 | 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_160:ClassDef_L2_C0", "label": "PyMining", "type": "class", "loc": [2, 110], "level": 0, "parent": null, "vector": [3, 0, 0.5091, 0.9909, 0, 0.66, 0.0, 518, 0, 6, 0, 0, 0, 0, 52], "semantic": {"name": "PyMining", "arg_names": [], "import_names": [], "rhs_call_name": "", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from naive_bayes import NaiveBayes
if __name__ == "__main__":
config = Configuration.FromFile(... | ajibawa-2023/Python-Code-Large/train/row_161 | 20 | 24 | 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_161:ImportFrom_L1_C0", "label": "from matrix import Matrix", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C... |
import random
import bisect
class Tripple:
def __init__(self, row, col, val):
self.row = row
self.col = col
self.val = val
def Transpose(self):
tmp = self.row
self.row = self.col
self.col = tmp
return self
def TrippleCmp(t1, t2):
if (t1.... | ajibawa-2023/Python-Code-Large/train/row_162 | 79 | 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_162:Import_L1_C0", "label": "random import random", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0077, 0.0077, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#coding=utf8=
#mmseg
from configuration import Configuration
class Segmenter:
def __init__(self, config, nodeName):
curNode = config.GetChild(nodeName)
self.mainDict = self.LoadMainDict(curNode.GetChild("main_dict").GetValue())
def Split(self, line):
line = line.lower()
index ... | ajibawa-2023/Python-Code-Large/train/row_163 | 37 | 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_163:ImportFrom_L4_C0", "label": "from configuration import Configuration", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0208, 0, 0.66, 0.0, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "im... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#encoding=utf8
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from naive_bayes import NaiveBayes
if __name__ == "__main__":
config = Configu... | ajibawa-2023/Python-Code-Large/train/row_164 | 21 | 26 | 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_164:ImportFrom_L3_C0", "label": "from matrix import Matrix", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1154, 0.0385, 0, 0.66, 0.0, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L1... |
import math
import pickle
import sys
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from twc_naive_bayes import TwcNaiveBayes
if __name__ == "... | ajibawa-2023/Python-Code-Large/train/row_167 | 22 | 26 | 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_167:Import_L1_C0", "label": "math import math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L1... |
#coding:utf-8
import sys
a=u"""3 工程师 Done.
1 php Done.
5 php 工程师 Done.
2 设计师 Done.
6 视觉设计 Done.
7 产品经理 Done.
9 web Done.
10 编辑 Done.
11 实习生 Done.
12 产品 Done.
13 交互设计 Done.
8 产品设计 Done.
18 java Done.
19 UI Done.
22 销售 Done.
25 医药代表 Done.
24 java php Done.
29 gongzhuo Done.
17 c++ Done.
30 css Done.
39 程序架构师 Done.
41 SUN... | ajibawa-2023/Python-Code-Large/train/row_168 | 11 | 1,927 | 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_168:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.001, 0.0005, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_168:For_L1920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L1921_C4"}] |
#!/usr/bin/env python
#coding=utf-8
catelist = [
(1, u"传统网络Internet"),
(2, u"移动互联"),
(3, u"网游"),
(4, u"电子商务_B2C/团购"),
(5, u"软件、电信"),
(6, u"新媒体"),
(7, u"风投/投行"),
(8, u"其他外企"),
]
idlist = [
[1, (u"超超Sandy", "d11c25990634d0e486235f1... | ajibawa-2023/Python-Code-Large/train/row_169 | 2 | 32 | 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_169:Assign_L4_C0", "label": "catelist =", "type": "assigned_variable", "loc": [4, 13], "level": 0, "parent": null, "vector": [14, 0, 0.2656, 0.3125, 0, 0.66, 0.0, 219, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "catelist", "arg_names": [], "import_names": [], "rhs_call_... | [] |
# -*- coding: utf-8 -*-
from ragendja.settings_pre import *
# Increase this when you update your on the production site, so users
# don't have to refresh their cache. By setting this your MEDIA_URL
# automatically becomes /media/MEDIA_VERSION/
MEDIA_VERSION = 1
# By hosting media on a different domain we can get a s... | ajibawa-2023/Python-Code-Large/train/row_170 | 23 | 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_170:ImportFrom_L2_C0", "label": "from ragendja.settings_pre import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.0065, 0, 0.66, 0.0, 978, 0, 1, 0, 0, 978, 0, 0], "semantic": {"name": "ragendja.settings_pre", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_170:If_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_170:If_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L29_C4"}] |
from ragendja.settings_post import settings
settings.add_app_media('combined-%(LANGUAGE_CODE)s.js',
'myapp/code.js',
)
| ajibawa-2023/Python-Code-Large/train/row_171 | 2 | 4 | 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_171:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names"... | [] |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
rootpatterns = patterns('',
(r'^person/', include('myapp.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_172 | 2 | 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_172:ImportFrom_L2_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.1667, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_nam... | [] |
# -*- coding: utf-8 -*-
from django.db.models import permalink, signals
from google.appengine.ext import db
from ragendja.dbutils import cleanup_relations
class Person(db.Model):
"""Basic user profile with personal details."""
first_name = db.StringProperty(required=True)
last_name = db.StringProperty(requ... | ajibawa-2023/Python-Code-Large/train/row_173 | 25 | 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_173:ImportFrom_L2_C0", "label": "from django.db.models import permalink, signals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0541, 0.027, 0, 0.66, 0.0, 680, 0, 2, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1... |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.models import User
from django.core.files.uploadedfile import UploadedFile
from django.utils.translation import ugettext_lazy as _, ugettext as __
from myapp.models import Person, File, Contract
from ragendja.auth.models import UserTraits
from ra... | ajibawa-2023/Python-Code-Large/train/row_174 | 55 | 108 | 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_174:ImportFrom_L2_C0", "label": "from django import forms", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0093, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
urlpatterns = patterns('myapp.views',
(r'^create_admin_user$', 'create_admin_user'),
(r'^$', 'list_people'),
(r'^create/$', 'add_person'),
(r'^show/(?P<key>.+)$', 'show_person'),
(r'^edit/(?P<key>.+)$', 'edit_person'),
(r'^delete/(... | ajibawa-2023/Python-Code-Large/train/row_175 | 2 | 12 | 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_175:ImportFrom_L2_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_nam... | [] |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.http import HttpResponse, Http404
from django.views.generic.list_detail import object_list, object_detail
from django.views.generic.create_update import create_object, delete_object, \
update... | ajibawa-2023/Python-Code-Large/train/row_176 | 32 | 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_176:ImportFrom_L2_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.02, 0, 0.66, 0.0, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "arg_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib import admin
from myapp.models import Person, File
class FileInline(admin.TabularInline):
model = File
class PersonAdmin(admin.ModelAdmin):
inlines = (FileInline,)
list_display = ('first_name', 'last_name')
admin.site.register(Person, PersonAdmin)
| ajibawa-2023/Python-Code-Large/train/row_177 | 8 | 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_177:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
#!/usr/bin/env python
if __name__ == '__main__':
from common.appenginepatch.aecmd import setup_env
setup_env(manage_py_env=True)
# Recompile translation files
from mediautils.compilemessages import updatemessages
updatemessages()
# Generate compressed media files for manage.py update
impor... | ajibawa-2023/Python-Code-Large/train/row_178 | 12 | 18 | 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_178:If_L2_C0", "label": "if", "type": "if", "loc": [2, 18], "level": 0, "parent": null, "vector": [4, 0, 0.5556, 0.9444, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2... |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
from django.template import Context, RequestCont... | ajibawa-2023/Python-Code-Large/train/row_180 | 57 | 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_180:ImportFrom_L3_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0108, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.aut... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext import db
from django.contrib.auth.models import User
#from datetime import *
import datetime
class HacoUser( db.Model):
user =db.ReferenceProperty( User)
zip =db.StringProperty()
twitterID =db.StringP... | ajibawa-2023/Python-Code-Large/train/row_181 | 23 | 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_181:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0357, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.models import User
from django.core.files.uploadedfile import UploadedFile
from django.utils.translation import ugettext_lazy as _, ugettext as __
from myapp.models import Person, File, Contract
from ragendja.auth.models import UserTraits
from ra... | ajibawa-2023/Python-Code-Large/train/row_182 | 79 | 216 | 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_182:ImportFrom_L2_C0", "label": "from django import forms", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0046, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
# -*- coding: utf8 -*-
from twitter import Api
import simplejson
import urllib2
import logging
class Api(Api):
''' twitter.Apiクラスの拡張
self._cacheの影響でファイル入出力が発生するため、
Apiクラスのラッパーとして利用する。
'''
def __init__(self,
username=None,
password=None,
inp... | ajibawa-2023/Python-Code-Large/train/row_185 | 31 | 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_185:ImportFrom_L2_C0", "label": "from twitter import Api", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0392, 0.0196, 0, 0.66, 0.0, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "twitter", "arg_names": [], "import_names": ["Api"], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
from django.conf.urls.defaults import *
from django.contrib.auth import views as auth_views
from views import *
from views2 import *
from twit import *
urlpatterns =patterns(
'',
#url( r'^login/$',
# auth_views.login,
# {'template_name': 'haco/login.html',
# 'redirect_field_name... | ajibawa-2023/Python-Code-Large/train/row_187 | 6 | 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_187:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_nam... | [] |
# -*- coding: utf-8 -*-
from decimal import *
from math import *
def v2W(volt):
if float(volt) < 0:
return -1
else:
watt = (float(volt) * 1100.0 / 1024.0) * 3000 / (0.9 * 100) / 1000 * 100
watt = Decimal(str(watt)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)
... | ajibawa-2023/Python-Code-Large/train/row_188 | 23 | 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_188:ImportFrom_L3_C0", "label": "from decimal import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0278, 0, 0.66, 0.0, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["*"], "rhs... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If... |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from haco.models import *
from haco.jsTime import *
import logging
import twython
from datetime import *
def twitBot( request):
mes ="<html><he... | ajibawa-2023/Python-Code-Large/train/row_189 | 37 | 54 | 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_189:ImportFrom_L3_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0185, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
from django.template import Context, RequestContext, lo... | ajibawa-2023/Python-Code-Large/train/row_191 | 110 | 212 | 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_191:ImportFrom_L3_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0142, 0.0047, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.aut... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
from django.template import Context, loader
f... | ajibawa-2023/Python-Code-Large/train/row_192 | 10 | 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_192:ImportFrom_L3_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0769, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.aut... | [] |
from django.contrib import admin
from haco.models import HacoUser, Haco
class HacoUserAdmin( admin.ModelAdmin):
list_display =( 'user', 'prefecture', 'city')
class HacoAdmin( admin.ModelAdmin):
list_display =( 'temp', 'light', 'watt', 'date')
admin.site.register( HacoUser)
admin.site.register( Haco)
| ajibawa-2023/Python-Code-Large/train/row_193 | 8 | 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_193:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_193:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_193:Assign_L8_C4"}] |
# -*- coding: utf-8 -*-
from datetime import *
def now():
return datetime.now() + timedelta(hours=9)
def today():
return now().replace(hour=0,minute=0,second=0,microsecond=0)
def tomorrow():
return (now() + timedelta(days=1)).replace(hour=0,minute=0,second=0,microsecond=0)
def someday(delta):
... | ajibawa-2023/Python-Code-Large/train/row_194 | 9 | 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_194:ImportFrom_L3_C0", "label": "from datetime import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0769, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["*"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from ragendja.settings_post import settings
settings.add_app_media('combined-%(LANGUAGE_DIR)s.css',
'blueprintcss/reset.css',
'blueprintcss/typography.css',
'blueprintcss/forms.css',
'blueprintcss/grid.css',
'blueprintcss/lang-%(LANGUAGE_DIR)s.css',
)
settings.add_app_media('combined-print-%(LANGUAG... | ajibawa-2023/Python-Code-Large/train/row_195 | 4 | 14 | 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_195:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_na... | [] |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from ragendja.urlsauto import urlpatterns
from ragendja.auth.urls import urlpatterns as auth_patterns
#from myapp.forms import UserRegistrationForm
from django.contrib import admin
from django.contrib.auth import views as auth_views
from haco import views... | ajibawa-2023/Python-Code-Large/train/row_196 | 10 | 38 | 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_196:ImportFrom_L2_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0263, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_nam... | [] |
from ragendja.settings_post import settings
if not hasattr(settings, 'ACCOUNT_ACTIVATION_DAYS'):
settings.ACCOUNT_ACTIVATION_DAYS = 30
| ajibawa-2023/Python-Code-Large/train/row_197 | 3 | 4 | 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_197:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_197:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_197:Assign_L4_C4"}] |
from django.conf.urls.defaults import *
rootpatterns = patterns('',
(r'^account/', include('registration.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_198 | 2 | 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_198:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [... | [] |
import datetime
import random
import re
import sha
from google.appengine.ext import db
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import models
from django.template.loader import render_to_string
from django.utils.translatio... | ajibawa-2023/Python-Code-Large/train/row_199 | 75 | 264 | 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_199:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0038, 0.0038, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
Forms and validation code for user registration.
"""
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
# I put this on all required fields, because it's easier to pick up
# on them wit... | ajibawa-2023/Python-Code-Large/train/row_200 | 44 | 136 | 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_200:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0184, 0.0294, 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_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
Unit tests for django-registration.
These tests assume that you've completed all the prerequisites for
getting django-registration running in the default setup, to wit:
1. You have ``registration`` in your ``INSTALLED_APPS`` setting.
2. You have created all of the templates mentioned in this
application's doc... | ajibawa-2023/Python-Code-Large/train/row_201 | 132 | 359 | 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_201:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 20], "level": 0, "parent": null, "vector": [8, 0, 0.0292, 0.0557, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
URLConf for Django user registration and authentication.
If the default behavior of the registration views is acceptable to
you, simply use a line like this in your root URLConf to set up the
default URLs for registration::
(r'^accounts/', include('registration.urls')),
This will also automatically set up th... | ajibawa-2023/Python-Code-Large/train/row_202 | 6 | 79 | 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_202:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 20], "level": 0, "parent": null, "vector": [8, 0, 0.1329, 0.2532, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
"""
A management command which deletes expired accounts (e.g.,
accounts which signed up but never activated) from the database.
Calls ``RegistrationProfile.objects.delete_expired_users()``, which
contains the actual logic for determining which accounts are deleted.
"""
from django.core.management.base import NoArgsC... | ajibawa-2023/Python-Code-Large/train/row_203 | 7 | 19 | 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_203:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2368, 0.4211, 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_203:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_203:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_203:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_203:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
Views which allow users to create and activate accounts.
"""
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template imp... | ajibawa-2023/Python-Code-Large/train/row_204 | 55 | 189 | 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_204:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0132, 0.0212, 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_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfile, RegistrationAdmin)
| ajibawa-2023/Python-Code-Large/train/row_205 | 6 | 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_205:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_205:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_205:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_205:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_205:Assign_L8_C4"}] |
from django.dispatch import Signal
# A new user has registered.
user_registered = Signal(providing_args=["user"])
# A user has activated his or her account.
user_activated = Signal(providing_args=["user"])
| ajibawa-2023/Python-Code-Large/train/row_206 | 3 | 8 | 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_206:ImportFrom_L1_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "import_... | [] |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | ajibawa-2023/Python-Code-Large/train/row_208 | 48 | 65 | 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_208:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0308, 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_208:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:F... |
"""Implementation of JSONEncoder
"""
import re
try:
from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
... | ajibawa-2023/Python-Code-Large/train/row_209 | 230 | 434 | 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_209:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0046, 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_209:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:T... |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | ajibawa-2023/Python-Code-Large/train/row_210 | 41 | 316 | 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_210:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 99], "level": 0, "parent": null, "vector": [8, 0, 0.1582, 0.3133, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#!/usr/bin/env python
if __name__ == '__main__':
from common.appenginepatch.aecmd import setup_env
setup_env(manage_py_env=True)
# Recompile translation files
from mediautils.compilemessages import updatemessages
updatemessages()
# Generate compressed media files for manage.py update
impor... | ajibawa-2023/Python-Code-Large/train/row_213 | 12 | 18 | 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_213:If_L2_C0", "label": "if", "type": "if", "loc": [2, 18], "level": 0, "parent": null, "vector": [4, 0, 0.5556, 0.9444, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2... |
# -*- coding: utf-8 -*-
import os, sys
# Add current folder to sys.path, so we can import aecmd.
# App Engine causes main.py to be reloaded if an exception gets raised
# on the first request of a main.py instance, so don't add current_dir multiple
# times.
current_dir = os.path.abspath(os.path.dirname(__file__))
if cu... | ajibawa-2023/Python-Code-Large/train/row_214 | 52 | 77 | 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_214:Import_L2_C0", "label": "os import os, sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.026, 0.013, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "sys"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Try_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21... |
# Empty file neeed to make this a Django app.
| ajibawa-2023/Python-Code-Large/train/row_215 | 0 | 1 | 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"] | [] | [] |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | ajibawa-2023/Python-Code-Large/train/row_216 | 3 | 26 | 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_216:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.7308, 0.1923, 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_216:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_216:Expr_L25_C2"}] |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext import db
| ajibawa-2023/Python-Code-Large/train/row_217 | 2 | 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_217:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [],... | [] |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
| ajibawa-2023/Python-Code-Large/train/row_218 | 3 | 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_218:ImportFrom_L2_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.1667, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], ... | [] |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | ajibawa-2023/Python-Code-Large/train/row_219 | 3 | 26 | 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_219:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.7308, 0.1923, 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_219:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_219:Expr_L25_C2"}] |
# -*- coding: utf-8 -*-
from django.db.models import signals
from django.test import TestCase
from ragendja.dbutils import cleanup_relations
from ragendja.testutils import ModelTestCase
from google.appengine.ext import db
from google.appengine.ext.db.polymodel import PolyModel
from datetime import datetime
# Test clas... | ajibawa-2023/Python-Code-Large/train/row_220 | 118 | 168 | 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_220:ImportFrom_L2_C0", "label": "from django.db.models import signals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.006, 0, 0.66, 0.0, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from google.appengine.api import apiproxy_stub_map
from google.appengine.ext import db
from django.dispatch import Signal
from django.db.models import signals
from django.utils._threading_local import local
from functools import wraps
# Add signals which can be run after a transaction has been committed
signals.post_... | ajibawa-2023/Python-Code-Large/train/row_222 | 56 | 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_222:ImportFrom_L1_C0", "label": "from google.appengine.api import apiproxy_stub_map", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
from google.appengine.api import apiproxy_stub_map
import os, sys
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = os.environ.get('APPLICATION_ID')
else:
try:
from google.appengine.tools import dev_appserver
from aecmd import PROJECT_DIR
... | ajibawa-2023/Python-Code-Large/train/row_223 | 12 | 18 | 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_223:ImportFrom_L1_C0", "label": "from google.appengine.api import apiproxy_stub_map", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_223:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4"... |
from google.appengine.api.memcache import *
| ajibawa-2023/Python-Code-Large/train/row_224 | 1 | 1 | 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_224:ImportFrom_L1_C0", "label": "from google.appengine.api.memcache import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "google.appengine.api.memcache", "arg_n... | [] |
from ragendja.settings_post import settings
from appenginepatcher import have_appserver, on_production_server
if have_appserver and not on_production_server and \
settings.MEDIA_URL.startswith('/'):
if settings.ADMIN_MEDIA_PREFIX.startswith(settings.MEDIA_URL):
settings.ADMIN_MEDIA_PREFIX = '/genera... | ajibawa-2023/Python-Code-Large/train/row_225 | 7 | 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_225:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_225:If_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_225:If_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_225:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", ... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.simplejson import dumps
from os.path import getmtime
import os, codecs, shutil, logging, re
path_re = re.compile(r'/[^/]+/\.\./')
MEDIA_VERSION = unicode(settings.MEDIA_VERSION)
COMPRESSOR = os.path.join(os.path.dirname(__file__), '.yuicompres... | ajibawa-2023/Python-Code-Large/train/row_226 | 231 | 342 | 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_226:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0058, 0.0029, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:Fun... |
# -*- coding: utf-8 -*-
from os.path import getmtime
import codecs, os
def updatemessages():
from django.conf import settings
if not settings.USE_I18N:
return
from django.core.management.commands.compilemessages import compile_messages
if any([needs_update(path) for path in settings.LOCALE_PATH... | ajibawa-2023/Python-Code-Large/train/row_227 | 89 | 112 | 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_227:ImportFrom_L2_C0", "label": "from os.path import getmtime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0089, 0, 0.66, 0.0, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["getm... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
# -*- coding: utf-8 -*-
"""
This app combines media files specified in the COMBINE_MEDIA setting into one
single file. It's a dictionary mapping the combined name to a tuple of files
that should be combined:
COMBINE_MEDIA = {
'global/js/combined.js': (
'global/js/main.js',
'app/js/other.js',
),... | ajibawa-2023/Python-Code-Large/train/row_228 | 16 | 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_228:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 26], "level": 0, "parent": null, "vector": [8, 0, 0.28, 0.5, 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_228:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
# -*- coding: utf-8 -*-
from django.http import HttpResponse, Http404
from django.views.decorators.cache import cache_control
from mediautils.generatemedia import get_targets, get_copy_targets, \
get_target_content, get_media_dirs
from mimetypes import guess_type
from ragendja.template import render_to_response
@c... | ajibawa-2023/Python-Code-Large/train/row_230 | 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_230:ImportFrom_L2_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.069, 0.0345, 0, 0.66, 0.0, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from django.conf import settings
from mediautils.views import get_file
class MediaMiddleware(object):
"""Returns media files.
This is a middleware, so it can handle the request as early as possible
and thus with minimum overhead."""
def process_request(self, request):
... | ajibawa-2023/Python-Code-Large/train/row_231 | 9 | 14 | 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_231:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_231:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_231:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_231:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_231:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
from django.conf import settings
from django.core.cache import cache
from django.contrib.sites.models import Site
from ragendja.dbutils import db_create
from ragendja.pyutils import make_tls_property
_default_site_id = getattr(settings, 'SITE_ID', None)
SITE_ID = settings.__class__.SITE_ID = make_tls_property()
class... | ajibawa-2023/Python-Code-Large/train/row_232 | 32 | 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_232:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_232:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
# -*- coding: utf-8 -*-
"""
Imports urlpatterns from apps, so we can have nice plug-n-play installation. :)
"""
from django.conf.urls.defaults import *
from django.conf import settings
IGNORE_APP_URLSAUTO = getattr(settings, 'IGNORE_APP_URLSAUTO', ())
check_app_imports = getattr(settings, 'check_app_imports', None)
u... | ajibawa-2023/Python-Code-Large/train/row_233 | 15 | 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_233:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.1034, 0.1034, 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_233:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_233:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:For_L... |
from django.conf import settings
import os
def import_module(module_name):
return __import__(module_name, {}, {}, [''])
def import_package(package_name):
package = [import_module(package_name)]
if package[0].__file__.rstrip('.pyc').rstrip('.py').endswith('__init__'):
package.extend([import_module(... | ajibawa-2023/Python-Code-Large/train/row_234 | 33 | 44 | 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_234:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
# -*- coding: utf-8 -*-
from django.utils._threading_local import local
def make_tls_property(default=None):
"""Creates a class-wide instance property with a thread-specific value."""
class TLSProperty(object):
def __init__(self):
self.local = local()
def __get__(self, instance, cl... | ajibawa-2023/Python-Code-Large/train/row_235 | 48 | 96 | 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_235:ImportFrom_L2_C0", "label": "from django.utils._threading_local import local", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0104, 0, 0.66, 0.0, 561, 0, 1, 0, 0, 561, 0, 0], "semantic": {"name": "django.utils._threading_loca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
# -*- coding: utf-8 -*-
from django.test import TestCase
from google.appengine.ext import db
from pyutils import object_list_to_table, equal_lists
import os
class ModelTestCase(TestCase):
"""
A test case for models that provides an easy way to validate the DB
contents against a given list of row-values.
... | ajibawa-2023/Python-Code-Large/train/row_236 | 19 | 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_236:ImportFrom_L2_C0", "label": "from django.test import TestCase", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0238, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_236:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
# -*- coding: utf-8 -*-
from copy import deepcopy
from django.forms.forms import NON_FIELD_ERRORS
from django.template import Library
from django.utils.datastructures import SortedDict
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from ragendja.dbutils import prefetch_... | ajibawa-2023/Python-Code-Large/train/row_238 | 56 | 102 | 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_238:ImportFrom_L2_C0", "label": "from copy import deepcopy", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0098, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["deepcopy... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L26_C4"}, {"f": "ajibawa-2023/Python-Co... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.template import Library
from django.utils.html import escape
from google.appengine.api import users
register = Library()
@register.simple_tag
def google_login_url(redirect=settings.LOGIN_REDIRECT_URL):
return escape(users.create_login_url(redire... | ajibawa-2023/Python-Code-Large/train/row_239 | 12 | 18 | 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_239:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0556, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_239:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_239:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib.auth.models import *
from django.contrib.auth.models import DjangoCompatibleUser as User
| ajibawa-2023/Python-Code-Large/train/row_240 | 2 | 2 | 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_240:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names":... | [] |
# -*- coding: utf-8 -*-
"""
Provides basic set of auth urls.
"""
from django.conf.urls.defaults import *
from django.conf import settings
urlpatterns = patterns('')
LOGIN = '^%s$' % settings.LOGIN_URL.lstrip('/')
LOGOUT = '^%s$' % settings.LOGOUT_URL.lstrip('/')
# If user set a LOGOUT_REDIRECT_URL we do a redirect.
... | ajibawa-2023/Python-Code-Large/train/row_241 | 9 | 39 | 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_241:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.0769, 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_241:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_241:If_L26_C0"}] |
# -*- coding: utf-8 -*-
from google.appengine.api import users
def google_user(request):
return {'google_user': users.get_current_user()}
| ajibawa-2023/Python-Code-Large/train/row_242 | 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_242:ImportFrom_L2_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "im... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_242:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_242:Return_L5_C4"}] |
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from google.appengine.api import users
from google.appengine.ext import db
from ragendja.auth.models import EmailUserTraits
class GoogleUserTraits(EmailUserTraits):
@classmethod
def get_djangouser_for_user(cls, user):
... | ajibawa-2023/Python-Code-Large/train/row_243 | 35 | 49 | 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_243:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0204, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/... |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from functools import wraps
from ragendja.auth.views import google_redirect_to_login
from ragendja.template import render_to_response
def staff_only(view):
"""
Decorator that requires user.is_staff. Otherwise renders no_access.ht... | ajibawa-2023/Python-Code-Large/train/row_244 | 17 | 23 | 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_244:ImportFrom_L2_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0435, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.auth... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import login, logout
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from google.appengine.api import users
from ragendja.template i... | ajibawa-2023/Python-Code-Large/train/row_245 | 41 | 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_245:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0172, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
class UserAdmin(admin.ModelAdmin):
fieldsets = (
(_('Personal info'), {'fields': ('user',)}),
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions')}),
(_('Important... | ajibawa-2023/Python-Code-Large/train/row_246 | 8 | 14 | 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_246:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
# Parts of this code are taken from Google's django-helper (license: Apache 2)
class LazyGoogleUser(object):
def __init__(self, middleware_class):
self._middleware_class = middleware_class
def __get__(self, request, obj_type=None):
if not hasattr(request, '_cached_user'):
from djan... | ajibawa-2023/Python-Code-Large/train/row_247 | 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_247:ClassDef_L3_C0", "label": "LazyGoogleUser", "type": "class", "loc": [3, 20], "level": 0, "parent": null, "vector": [3, 0, 0.4259, 0.6667, 0, 0.66, 0.0, 696, 0, 2, 0, 0, 186, 0, 6], "semantic": {"name": "LazyGoogleUser", "arg_names": [], "import_names": [], "rhs_call... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext import db
from ragendja.auth.google_models import GoogleUserTraits
class User(GoogleUserTraits):
"""User class that provides support for Django and Google Accounts."""
user = db.UserProperty()
username = db.StringProperty(req... | ajibawa-2023/Python-Code-Large/train/row_248 | 15 | 19 | 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_248:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2... |
# -*- coding: utf-8 -*-
"""
This is a set of utilities for faster development with Django templates.
render_to_response() and render_to_string() use RequestContext internally.
The app_prefixed_loader is a template loader that loads directly from the app's
'templates' folder when you specify an app prefix ('app/templa... | ajibawa-2023/Python-Code-Large/train/row_249 | 50 | 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_249:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0787, 0.1236, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
class LazyEncoder(DjangoJSONEncoder):
... | ajibawa-2023/Python-Code-Large/train/row_250 | 14 | 21 | 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_250:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0476, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_250:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_250:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.