code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
# 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.... | [
[
1,
0,
0.0062,
0.0012,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0074,
0.0012,
0,
0.66,
0.2,
583,
0,
1,
0,
0,
583,
0,
0
],
[
1,
0,
0.0099,
0.0012,
0,
0.6... | [
"import os",
"import mimetypes",
"from weibopy.binder import bind_api",
"from weibopy.error import WeibopError",
"from weibopy.parsers import ModelParser",
"class API(object):\n \"\"\"Twitter API\"\"\"\n\n def __init__(self, auth_handler=None,\n host='api.t.sina.com.cn', search_host='api.... |
# 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':
... | [
[
1,
0,
0.0391,
0.0078,
0,
0.66,
0,
972,
0,
1,
0,
0,
972,
0,
0
],
[
3,
0,
0.1406,
0.1797,
0,
0.66,
0.2,
647,
0,
3,
0,
0,
186,
0,
5
],
[
8,
1,
0.0625,
0.0078,
1,
0.9... | [
"from weibopy.error import WeibopError",
"class Cursor(object):\n \"\"\"Pagination helper class\"\"\"\n\n def __init__(self, method, *args, **kargs):\n if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, ar... |
# 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... | [
[
1,
0,
0.0189,
0.0038,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0227,
0.0038,
0,
0.66,
0.125,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0265,
0.0038,
0,
0.6... | [
"import time",
"import threading",
"import os",
"import cPickle as pickle",
"try:\n import hashlib\nexcept ImportError:\n # python 2.4\n import md5 as hashlib",
" import hashlib",
" import md5 as hashlib",
"try:\n import fcntl\nexcept ImportError:\n # Probably on a windows system\... |
#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... | [
[
1,
0,
0.08,
0.04,
0,
0.66,
0,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.1111,
591,
0,
9,
0,
0,
591,
0,
0
],
[
1,
0,
0.2,
0.04,
0,
0.66,
0.2... | [
"import os, sys",
"from bottle import route, run, debug, template, request, validate, error, response, redirect",
"from bottle import default_app",
"from y_home import *",
"from y_apply import *",
"from y_admin import *",
"from y_login import *",
"debug(True)",
"def main():\n run(reloader=True);"... |
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"
... | [
[
1,
0,
0.0278,
0.0278,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
1,
0,
0.0556,
0.0278,
0,
0.66,
0.0625,
426,
0,
1,
0,
0,
426,
0,
0
],
[
2,
0,
0.0972,
0.0556,
0,
... | [
"import sys, uuid",
"from datetime import datetime",
"def now():\n return str(datetime.now()) + \" \"",
" return str(datetime.now()) + \" \"",
"dic = open(\"tag_list.dict\", \"r\")",
"result = []",
"dic2 = []",
"dic3 = []",
"for item in dic:\n m = unicode(item, \"utf-8\").split()\n if le... |
#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... | [
[
1,
0,
0.0377,
0.0189,
0,
0.66,
0,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0566,
0.0189,
0,
0.66,
0.0476,
952,
0,
1,
0,
0,
952,
0,
0
],
[
1,
0,
0.0755,
0.0189,
0,
0.... | [
"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):\n global results\n try:\n a = unicode(urllib... |
#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... | [
[
1,
0,
0.0252,
0.0084,
0,
0.66,
0,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0336,
0.0084,
0,
0.66,
0.0588,
952,
0,
1,
0,
0,
952,
0,
0
],
[
1,
0,
0.042,
0.0084,
0,
0.6... | [
"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():\n\tr... |
#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... | [
[
1,
0,
0.0204,
0.0102,
0,
0.66,
0,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0306,
0.0102,
0,
0.66,
0.0333,
952,
0,
1,
0,
0,
952,
0,
0
],
[
1,
0,
0.0408,
0.0102,
0,
0.... | [
"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(urlli... |
#!/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... | [
[
14,
0,
0.2656,
0.3125,
0,
0.66,
0,
219,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.7188,
0.5938,
0,
0.66,
1,
77,
0,
0,
0,
0,
0,
5,
0
]
] | [
"catelist = [\n (1, u\"传统网络Internet\"),\n (2, u\"移动互联\"),\n (3, u\"网游\"),\n (4, u\"电子商务_B2C/团购\"),\n (5, u\"软件、电信\"),\n (6, u\"新媒体\"),\n (7, u\"风投/投行\"),",
"idlist = [\n [1, (u\"超超Sandy\", \"d11c25990634d0e486235f1b42a55f9f\", \"89859ba49065135017b894df5e5a9... |
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... | [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.5,
954,
0,
1,
0,
0,
954,
0,
0
],
[
3,
0,
0.6818,
0.7273,
0,
0.6... | [
"from pymining.segmenter import Segmenter",
"from pymining.configuration import Configuration",
"class detect:\n def __init__(self):\n self.cfg = Configuration.FromFile(\"pymining/conf/test.xml\")\n self.segmenter = Segmenter(self.cfg, \"segmenter\")\n\n def Split(self, line):\n wordL... |
# 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
| [
[
3,
0,
0.6538,
0.6154,
0,
0.66,
0,
305,
0,
2,
0,
0,
645,
0,
1
],
[
8,
1,
0.4615,
0.0769,
1,
0.25,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
1,
0.6538,
0.1538,
1,
0.25,
... | [
"class WeibopError(Exception):\n \"\"\"Weibopy exception\"\"\"\n\n def __init__(self, reason):\n self.reason = reason.encode('utf-8')\n\n def __str__(self):\n return self.reason",
" \"\"\"Weibopy exception\"\"\"",
" def __init__(self, reason):\n self.reason = reason.encode('u... |
# 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 _... | [
[
1,
0,
0.0155,
0.0056,
0,
0.66,
0,
478,
0,
5,
0,
0,
478,
0,
0
],
[
3,
0,
0.0239,
0.0056,
0,
0.66,
0.0667,
885,
0,
0,
0,
0,
430,
0,
0
],
[
8,
1,
0.0254,
0.0028,
1,
... | [
"from weibopy.utils import parse_datetime, parse_html_value, parse_a_href, \\\n parse_search_datetime, unescape_html",
"class ResultSet(list):\n \"\"\"A list like object that holds results from a Twitter API query.\"\"\"",
" \"\"\"A list like object that holds results from a Twitter API query.\"\"\... |
"""
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... | [
[
8,
0,
0.0183,
0.0352,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0382,
0.0015,
0,
0.66,
0.0385,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.0398,
0.0015,
0,
0.66... | [
"\"\"\"\nThe MIT License\n\nCopyright (c) 2007 Leah Culver\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights",
"import cgi",
... |
# 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... | [
[
8,
0,
0.2222,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2963,
0.037,
0,
0.66,
0.0833,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.037,
0,
0.66,
... | [
"\"\"\"\nweibo API library\n\"\"\"",
"__version__ = '1.5'",
"__author__ = 'Joshua Roesslein'",
"__license__ = 'MIT'",
"from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel",
"from weibopy.error import WeibopError",
"from weibopy.api import... |
# 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.... | [
[
1,
0,
0.0062,
0.0012,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0074,
0.0012,
0,
0.66,
0.2,
583,
0,
1,
0,
0,
583,
0,
0
],
[
1,
0,
0.0099,
0.0012,
0,
0.6... | [
"import os",
"import mimetypes",
"from weibopy.binder import bind_api",
"from weibopy.error import WeibopError",
"from weibopy.parsers import ModelParser",
"class API(object):\n \"\"\"Twitter API\"\"\"\n\n def __init__(self, auth_handler=None,\n host='api.t.sina.com.cn', search_host='api.... |
# 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':
... | [
[
1,
0,
0.0391,
0.0078,
0,
0.66,
0,
972,
0,
1,
0,
0,
972,
0,
0
],
[
3,
0,
0.1406,
0.1797,
0,
0.66,
0.2,
647,
0,
3,
0,
0,
186,
0,
5
],
[
8,
1,
0.0625,
0.0078,
1,
0.3... | [
"from weibopy.error import WeibopError",
"class Cursor(object):\n \"\"\"Pagination helper class\"\"\"\n\n def __init__(self, method, *args, **kargs):\n if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, ar... |
# 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... | [
[
1,
0,
0.0189,
0.0038,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0227,
0.0038,
0,
0.66,
0.125,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0265,
0.0038,
0,
0.6... | [
"import time",
"import threading",
"import os",
"import cPickle as pickle",
"try:\n import hashlib\nexcept ImportError:\n # python 2.4\n import md5 as hashlib",
" import hashlib",
" import md5 as hashlib",
"try:\n import fcntl\nexcept ImportError:\n # Probably on a windows system\... |
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(... | [
[
1,
0,
0.0476,
0.0476,
0,
0.66,
0,
162,
0,
1,
0,
0,
162,
0,
0
],
[
1,
0,
0.0952,
0.0476,
0,
0.66,
0.1429,
3,
0,
1,
0,
0,
3,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66... | [
"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_... |
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, "... | [
[
1,
0,
0.0049,
0.0049,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0099,
0.0049,
0,
0.66,
0.1667,
404,
0,
1,
0,
0,
404,
0,
0
],
[
1,
0,
0.0148,
0.0049,
0,
... | [
"import math",
"from segmenter import Segmenter",
"from matrix import Matrix",
"from py_mining import PyMining",
"from configuration import Configuration",
"class ClassifierMatrix:\n def __init__(self, config, nodeName, loadFromFile = False):\n self.node = config.GetChild(nodeName)\n self... |
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... | [
[
4,
0,
0.5139,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
12
],
[
8,
1,
0.0833,
0.0833,
1,
0.56,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.1667,
0.0278,
1,
0.56,
0.0769... | [
"if __name__ == \"__main__\":\n \"\"\"\n train\n \"\"\"\n #init dm platfrom, include segmenter..\n config = Configuration.FromFile(\"test.conf\")\n\n PyMining.Init(config, \"__global__\")",
" \"\"\"\n train\n \"\"\"",
" config = Configuration.FromFile(\"test.conf\")",
" PyMini... |
#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
... | [
[
1,
0,
0.1111,
0.037,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
0.1,
848,
0,
1,
0,
0,
848,
0,
0
],
[
1,
0,
0.1852,
0.037,
0,
0.66,
... | [
"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_nai... |
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... | [
[
1,
0,
0.0217,
0.0217,
0,
0.66,
0,
290,
0,
1,
0,
0,
290,
0,
0
],
[
3,
0,
0.4022,
0.6957,
0,
0.66,
0.5,
618,
0,
6,
0,
0,
0,
0,
5
],
[
14,
1,
0.087,
0.0217,
1,
0.45,... | [
"from xml.dom import minidom",
"class Configuration:\n mCurNode = None\n\n def __init__(self, node):\n self.mCurNode = node\n\n \n \"\"\"",
" mCurNode = None",
" def __init__(self, node):\n self.mCurNode = node",
" self.mCurNode = node",
" \"\"\"\n get first ch... |
#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... | [
[
3,
0,
0.5091,
0.9909,
0,
0.66,
0,
518,
0,
6,
0,
0,
0,
0,
52
],
[
14,
1,
0.0364,
0.0091,
1,
0.45,
0,
256,
0,
0,
0,
0,
0,
6,
0
],
[
14,
1,
0.0545,
0.0091,
1,
0.45,
... | [
"class PyMining:\n #dict store term -> id\n termToId = {} \n #dict store id -> term\n idToTerm = {}\n #dict store term -> how-many-docs-have-term\n idToDocCount = {}\n #dict store class -> how-many-docs-contained",
" termToId = {}",
" idToTerm = {}",
" idToDocCount = {}",
" ... |
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(... | [
[
1,
0,
0.0417,
0.0417,
0,
0.66,
0,
162,
0,
1,
0,
0,
162,
0,
0
],
[
1,
0,
0.0833,
0.0417,
0,
0.66,
0.1429,
3,
0,
1,
0,
0,
3,
0,
0
],
[
1,
0,
0.125,
0.0417,
0,
0.66,... | [
"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_... |
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.... | [
[
1,
0,
0.0077,
0.0077,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0154,
0.0077,
0,
0.66,
0.25,
325,
0,
1,
0,
0,
325,
0,
0
],
[
3,
0,
0.0692,
0.0846,
0,
0.... | [
"import random",
"import bisect",
"class Tripple:\n def __init__(self, row, col, val):\n self.row = row\n self.col = col\n self.val = val\n \n def Transpose(self):\n tmp = self.row",
" def __init__(self, row, col, val):\n self.row = row\n self.col = col\n ... |
#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 ... | [
[
1,
0,
0.0833,
0.0208,
0,
0.66,
0,
627,
0,
1,
0,
0,
627,
0,
0
],
[
3,
0,
0.4688,
0.7083,
0,
0.66,
0.5,
461,
0,
3,
0,
0,
0,
0,
15
],
[
2,
1,
0.1667,
0.0625,
1,
0.02... | [
"from configuration import Configuration",
"class Segmenter:\n def __init__(self, config, nodeName):\n curNode = config.GetChild(nodeName)\n self.mainDict = self.LoadMainDict(curNode.GetChild(\"main_dict\").GetValue())\n\n def Split(self, line):\n line = line.lower()\n index = 0"... |
#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... | [
[
1,
0,
0.1154,
0.0385,
0,
0.66,
0,
162,
0,
1,
0,
0,
162,
0,
0
],
[
1,
0,
0.1538,
0.0385,
0,
0.66,
0.1429,
3,
0,
1,
0,
0,
3,
0,
0
],
[
1,
0,
0.1923,
0.0385,
0,
0.66... | [
"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_... |
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__ == "... | [
[
1,
0,
0.0385,
0.0385,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0769,
0.0385,
0,
0.66,
0.1,
848,
0,
1,
0,
0,
848,
0,
0
],
[
1,
0,
0.1154,
0.0385,
0,
0.6... | [
"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_nai... |
#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... | [
[
1,
0,
0.001,
0.0005,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.4982,
0.9938,
0,
0.66,
0.1111,
475,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.9953,
0.0005,
0,
0... | [
"import sys",
"a=u\"\"\"3 工程师 Done.\n1 php Done.\n5 php 工程师 Done.\n2 设计师 Done.\n6 视觉设计 Done.\n7 产品经理 Done.\n9 web Done.\n10 编辑 Done.",
"b=a.split('\\n')",
"e=[]",
"for c in b:\n d=\" \".join(c.split()[:-1])\n e+=[d]",
" d=\" \".join(c.split()[:-1])",
"g=\"\\r\\n\".join(e).encode('utf-8')",
"f... |
#!/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... | [
[
14,
0,
0.2656,
0.3125,
0,
0.66,
0,
219,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.7188,
0.5938,
0,
0.66,
1,
77,
0,
0,
0,
0,
0,
5,
0
]
] | [
"catelist = [\n (1, u\"传统网络Internet\"),\n (2, u\"移动互联\"),\n (3, u\"网游\"),\n (4, u\"电子商务_B2C/团购\"),\n (5, u\"软件、电信\"),\n (6, u\"新媒体\"),\n (7, u\"风投/投行\"),",
"idlist = [\n [1, (u\"超超Sandy\", \"d11c25990634d0e486235f1b42a55f9f\", \"89859ba49065135017b894df5e5a9... |
# -*- 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... | [
[
1,
0,
0.013,
0.0065,
0,
0.66,
0,
978,
0,
1,
0,
0,
978,
0,
0
],
[
14,
0,
0.0455,
0.0065,
0,
0.66,
0.05,
130,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.1266,
0.0649,
0,
0.6... | [
"from ragendja.settings_pre import *",
"MEDIA_VERSION = 1",
"COMBINE_MEDIA = {\n 'combined-%(LANGUAGE_CODE)s.js': (\n # See documentation why site_data can be useful:\n # http://code.google.com/p/app-engine-patch/wiki/MediaGenerator\n '.site_data.js',\n ),\n 'combined-%(LANGUAGE_DI... |
from ragendja.settings_post import settings
settings.add_app_media('combined-%(LANGUAGE_CODE)s.js',
'myapp/code.js',
)
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
898,
0,
1,
0,
0,
898,
0,
0
],
[
8,
0,
0.75,
0.75,
0,
0.66,
1,
197,
3,
2,
0,
0,
0,
0,
1
]
] | [
"from ragendja.settings_post import settings",
"settings.add_app_media('combined-%(LANGUAGE_CODE)s.js',\n 'myapp/code.js',\n)"
] |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
rootpatterns = patterns('',
(r'^person/', include('myapp.urls')),
)
| [
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.8333,
0.5,
0,
0.66,
1,
319,
3,
2,
0,
0,
75,
10,
2
]
] | [
"from django.conf.urls.defaults import *",
"rootpatterns = patterns('',\n (r'^person/', include('myapp.urls')),\n)"
] |
# -*- 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... | [
[
1,
0,
0.0541,
0.027,
0,
0.66,
0,
680,
0,
2,
0,
0,
680,
0,
0
],
[
1,
0,
0.0811,
0.027,
0,
0.66,
0.1667,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.1081,
0.027,
0,
0.6... | [
"from django.db.models import permalink, signals",
"from google.appengine.ext import db",
"from ragendja.dbutils import cleanup_relations",
"class Person(db.Model):\n \"\"\"Basic user profile with personal details.\"\"\"\n first_name = db.StringProperty(required=True)\n last_name = db.StringProperty(... |
# -*- 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... | [
[
1,
0,
0.0185,
0.0093,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0278,
0.0093,
0,
0.66,
0.0833,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.037,
0.0093,
0,
0... | [
"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",... |
# -*- 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/(... | [
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.6667,
0.75,
0,
0.66,
1,
990,
3,
8,
0,
0,
75,
10,
1
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('myapp.views',\n (r'^create_admin_user$', 'create_admin_user'),\n (r'^$', 'list_people'),\n (r'^create/$', 'add_person'),\n (r'^show/(?P<key>.+)$', 'show_person'),\n (r'^edit/(?P<key>.+)$', 'edit_person'),\n (r'^delete/(?P<key>.+... |
# -*- 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... | [
[
1,
0,
0.04,
0.02,
0,
0.66,
0,
749,
0,
1,
0,
0,
749,
0,
0
],
[
1,
0,
0.06,
0.02,
0,
0.66,
0.0588,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.08,
0.02,
0,
0.66,
0.... | [
"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, \\\n upd... |
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)
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.25,
0,
0,
2,
0,
0,
0,
0,
0
],
[
3,
0,
0.4091,
0.1818,
0,
0.66,
... | [
"from django.contrib import admin",
"from myapp.models import Person, File",
"class FileInline(admin.TabularInline):\n model = File",
" model = File",
"class PersonAdmin(admin.ModelAdmin):\n inlines = (FileInline,)\n list_display = ('first_name', 'last_name')",
" inlines = (FileInline,)",
... |
#!/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... | [
[
4,
0,
0.5556,
0.9444,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
5
],
[
1,
1,
0.1667,
0.0556,
1,
0.75,
0,
448,
0,
1,
0,
0,
448,
0,
0
],
[
8,
1,
0.2222,
0.0556,
1,
0.75,
... | [
"if __name__ == '__main__':\n from common.appenginepatch.aecmd import setup_env\n setup_env(manage_py_env=True)\n\n # Recompile translation files\n from mediautils.compilemessages import updatemessages\n updatemessages()",
" from common.appenginepatch.aecmd import setup_env",
" setup_env(ma... |
# -*- 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... | [
[
1,
0,
0.0323,
0.0108,
0,
0.66,
0,
885,
0,
1,
0,
0,
885,
0,
0
],
[
1,
0,
0.043,
0.0108,
0,
0.66,
0.0556,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0538,
0.0108,
0,
0... | [
"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, RequestContex... |
# -*- 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... | [
[
1,
0,
0.0714,
0.0357,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.1071,
0.0357,
0,
0.66,
0.1667,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.1429,
0.0357,
0,
... | [
"from django.utils.translation import ugettext_lazy as _",
"from google.appengine.ext import db",
"from django.contrib.auth.models import User",
"import datetime",
"class HacoUser( db.Model):\n user =db.ReferenceProperty( User)\n zip =db.StringProperty()\n twitterID =db.StringProperty()\n addres... |
# -*- 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... | [
[
1,
0,
0.0093,
0.0046,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0139,
0.0046,
0,
0.66,
0.0714,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0185,
0.0046,
0,
... | [
"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",... |
# -*- 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... | [
[
1,
0,
0.0392,
0.0196,
0,
0.66,
0,
234,
0,
1,
0,
0,
234,
0,
0
],
[
1,
0,
0.0588,
0.0196,
0,
0.66,
0.2,
386,
0,
1,
0,
0,
386,
0,
0
],
[
1,
0,
0.0784,
0.0196,
0,
0.6... | [
"from twitter import Api",
"import simplejson",
"import urllib2",
"import logging",
"class Api(Api):\n ''' twitter.Apiクラスの拡張\n self._cacheの影響でファイル入出力が発生するため、\n Apiクラスのラッパーとして利用する。\n '''\n def __init__(self,\n username=None,\n password=None,",
" '''... |
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... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.2,
895,
0,
1,
0,
0,
895,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0.6... | [
"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(\n '',\n \n #url( r'^login/$', \n # auth_views.login, \n # {'template_name': 'haco/login.html... |
# -*- 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)
... | [
[
1,
0,
0.0833,
0.0278,
0,
0.66,
0,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.1111,
0.0278,
0,
0.66,
0.25,
526,
0,
1,
0,
0,
526,
0,
0
],
[
2,
0,
0.2639,
0.2222,
0,
0.... | [
"from decimal import *",
"from math import *",
"def v2W(volt):\n if float(volt) < 0:\n return -1\n else: \n watt = (float(volt) * 1100.0 / 1024.0) * 3000 / (0.9 * 100) / 1000 * 100\n watt = Decimal(str(watt)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)\n\n return watt",... |
# -*- 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... | [
[
1,
0,
0.0556,
0.0185,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0741,
0.0185,
0,
0.66,
0.0769,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0926,
0.0185,
0,
... | [
"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):\n mes =\"<h... |
# -*- 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... | [
[
1,
0,
0.0142,
0.0047,
0,
0.66,
0,
885,
0,
1,
0,
0,
885,
0,
0
],
[
1,
0,
0.0189,
0.0047,
0,
0.66,
0.0435,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0236,
0.0047,
0,
... | [
"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, RequestContex... |
# -*- 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... | [
[
1,
0,
0.2308,
0.0769,
0,
0.66,
0,
885,
0,
1,
0,
0,
885,
0,
0
],
[
1,
0,
0.3846,
0.0769,
0,
0.66,
0.1111,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.4615,
0.0769,
0,
... | [
"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... |
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)
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.2,
209,
0,
2,
0,
0,
209,
0,
0
],
[
3,
0,
0.4091,
0.1818,
0,
0.6... | [
"from django.contrib import admin",
"from haco.models import HacoUser, Haco",
"class HacoUserAdmin( admin.ModelAdmin):\n list_display =( 'user', 'prefecture', 'city')",
" list_display =( 'user', 'prefecture', 'city')",
"class HacoAdmin( admin.ModelAdmin):\n list_display =( 'temp', 'light', 'watt', ... |
# -*- 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):
... | [
[
1,
0,
0.2308,
0.0769,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
2,
0,
0.5,
0.1538,
0,
0.66,
0.25,
894,
0,
0,
1,
0,
0,
0,
2
],
[
13,
1,
0.5385,
0.0769,
1,
0.75,
... | [
"from datetime import *",
"def now():\n return datetime.now() + timedelta(hours=9)",
" return datetime.now() + timedelta(hours=9)",
"def today():\n return now().replace(hour=0,minute=0,second=0,microsecond=0)",
" return now().replace(hour=0,minute=0,second=0,microsecond=0)",
"def tomorrow():\n... |
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... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
898,
0,
1,
0,
0,
898,
0,
0
],
[
8,
0,
0.3571,
0.5,
0,
0.66,
0.3333,
197,
3,
6,
0,
0,
0,
0,
1
],
[
8,
0,
0.7143,
0.2143,
0,
0.66,... | [
"from ragendja.settings_post import settings",
"settings.add_app_media('combined-%(LANGUAGE_DIR)s.css',\n 'blueprintcss/reset.css',\n 'blueprintcss/typography.css',\n 'blueprintcss/forms.css',\n 'blueprintcss/grid.css',\n 'blueprintcss/lang-%(LANGUAGE_DIR)s.css',\n)",
"settings.add_app_media('com... |
# -*- 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... | [
[
1,
0,
0.0526,
0.0263,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0789,
0.0263,
0,
0.66,
0.1111,
517,
0,
1,
0,
0,
517,
0,
0
],
[
1,
0,
0.1053,
0.0263,
0,
... | [
"from django.conf.urls.defaults import *",
"from ragendja.urlsauto import urlpatterns",
"from ragendja.auth.urls import urlpatterns as auth_patterns",
"from django.contrib import admin",
"from django.contrib.auth import views as auth_views",
"from haco import views as haco_views",
"from haco.forms impor... |
from ragendja.settings_post import settings
if not hasattr(settings, 'ACCOUNT_ACTIVATION_DAYS'):
settings.ACCOUNT_ACTIVATION_DAYS = 30
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
898,
0,
1,
0,
0,
898,
0,
0
],
[
4,
0,
0.875,
0.5,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
14,
1,
1,
0.25,
1,
0.61,
0,
827,
... | [
"from ragendja.settings_post import settings",
"if not hasattr(settings, 'ACCOUNT_ACTIVATION_DAYS'):\n settings.ACCOUNT_ACTIVATION_DAYS = 30",
" settings.ACCOUNT_ACTIVATION_DAYS = 30"
] |
from django.conf.urls.defaults import *
rootpatterns = patterns('',
(r'^account/', include('registration.urls')),
)
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.8,
0.6,
0,
0.66,
1,
319,
3,
2,
0,
0,
75,
10,
2
]
] | [
"from django.conf.urls.defaults import *",
"rootpatterns = patterns('',\n (r'^account/', include('registration.urls')),\n)"
] |
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... | [
[
1,
0,
0.0038,
0.0038,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0076,
0.0038,
0,
0.66,
0.0769,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0114,
0.0038,
0,
... | [
"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 impo... |
"""
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... | [
[
8,
0,
0.0184,
0.0294,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0441,
0.0074,
0,
0.66,
0.1111,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0515,
0.0074,
0,
0.66... | [
"\"\"\"\nForms and validation code for user registration.\n\n\"\"\"",
"from django.contrib.auth.models import User",
"from django import forms",
"from django.utils.translation import ugettext_lazy as _",
"from registration.models import RegistrationProfile",
"attrs_dict = { 'class': 'required' }",
"clas... |
"""
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... | [
[
8,
0,
0.0292,
0.0557,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0613,
0.0028,
0,
0.66,
0.0625,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0641,
0.0028,
0,
0.66... | [
"\"\"\"\nUnit tests for django-registration.\n\nThese tests assume that you've completed all the prerequisites for\ngetting django-registration running in the default setup, to wit:\n\n1. You have ``registration`` in your ``INSTALLED_APPS`` setting.",
"import datetime",
"import sha",
"from django.conf import ... |
"""
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... | [
[
8,
0,
0.1329,
0.2532,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2911,
0.0127,
0,
0.66,
0.2,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.3038,
0.0127,
0,
0.66,
... | [
"\"\"\"\nURLConf for Django user registration and authentication.\n\nIf the default behavior of the registration views is acceptable to\nyou, simply use a line like this in your root URLConf to set up the\ndefault URLs for registration::\n\n (r'^accounts/', include('registration.urls')),",
"from django.conf.ur... |
"""
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... | [
[
8,
0,
0.2368,
0.4211,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5263,
0.0526,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.6316,
0.0526,
0,
0.66... | [
"\"\"\"\nA management command which deletes expired accounts (e.g.,\naccounts which signed up but never activated) from the database.\n\nCalls ``RegistrationProfile.objects.delete_expired_users()``, which\ncontains the actual logic for determining which accounts are deleted.\n\n\"\"\"",
"from django.core.manageme... |
"""
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... | [
[
8,
0,
0.0132,
0.0212,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0317,
0.0053,
0,
0.66,
0.0667,
885,
0,
1,
0,
0,
885,
0,
0
],
[
1,
0,
0.037,
0.0053,
0,
0.66,... | [
"\"\"\"\nViews which allow users to create and activate accounts.\n\n\"\"\"",
"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 rende... |
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)
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.2727,
0.0909,
0,
0.66,
0.3333,
103,
0,
1,
0,
0,
103,
0,
0
],
[
3,
0,
0.6364,
0.2727,
0,
... | [
"from django.contrib import admin",
"from registration.models import RegistrationProfile",
"class RegistrationAdmin(admin.ModelAdmin):\n list_display = ('__unicode__', 'activation_key_expired')\n search_fields = ('user__username', 'user__first_name')",
" list_display = ('__unicode__', 'activation_key... |
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"])
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.625,
0.125,
0,
0.66,
0.5,
929,
3,
1,
0,
0,
592,
10,
1
],
[
14,
0,
1,
0.125,
0,
0.66,
... | [
"from django.dispatch import Signal",
"user_registered = Signal(providing_args=[\"user\"])",
"user_activated = Signal(providing_args=[\"user\"])"
] |
"""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... | [
[
8,
0,
0.0231,
0.0308,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.0846,
0.0615,
0,
0.66... | [
"\"\"\"JSON token scanner\n\"\"\"",
"import re",
"try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None",
" from simplejson._speedups import make_scanner as c_make_scanner",
" c_make_scanner = None",
"__all__ = ['make_scanner']",
... |
"""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
... | [
[
8,
0,
0.0035,
0.0046,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0069,
0.0023,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.015,
0.0092,
0,
0.66,... | [
"\"\"\"Implementation of JSONEncoder\n\"\"\"",
"import re",
"try:\n from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None",
" from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii",... |
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 ... | [
[
8,
0,
0.1582,
0.3133,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3165,
0.0032,
0,
0.66,
0.1,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3244,
0.0127,
0,
0.66,
... | [
"r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintaine... |
#!/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... | [
[
4,
0,
0.5556,
0.9444,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
5
],
[
1,
1,
0.1667,
0.0556,
1,
0.27,
0,
448,
0,
1,
0,
0,
448,
0,
0
],
[
8,
1,
0.2222,
0.0556,
1,
0.27,
... | [
"if __name__ == '__main__':\n from common.appenginepatch.aecmd import setup_env\n setup_env(manage_py_env=True)\n\n # Recompile translation files\n from mediautils.compilemessages import updatemessages\n updatemessages()",
" from common.appenginepatch.aecmd import setup_env",
" setup_env(ma... |
# -*- 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... | [
[
1,
0,
0.026,
0.013,
0,
0.66,
0,
688,
0,
2,
0,
0,
688,
0,
0
],
[
14,
0,
0.1039,
0.013,
0,
0.66,
0.0769,
467,
3,
1,
0,
0,
142,
10,
2
],
[
4,
0,
0.1234,
0.026,
0,
0.... | [
"import os, sys",
"current_dir = os.path.abspath(os.path.dirname(__file__))",
"if current_dir not in sys.path:\n sys.path = [current_dir] + sys.path",
" sys.path = [current_dir] + sys.path",
"import aecmd",
"aecmd.setup_project()",
"from appenginepatcher.patch import patch_all, setup_logging",
"... |
# Empty file neeed to make this a Django app.
| [] | [] |
#!/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... | [
[
8,
0,
0.7308,
0.1923,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.9615,
0.1154,
0,
0.66,
1,
222,
0,
2,
0,
0,
0,
0,
0
],
[
8,
1,
0.9615,
0.0385,
1,
0.28,
0... | [
"\"\"\"This file acts as a very minimal replacement for the 'imp' module.\n\nIt contains only what Django expects to use and does not actually implement the\nsame functionality as the real 'imp' module.\n\"\"\"",
"def find_module(name, path=None):\n \"\"\"Django needs imp.find_module, but it works fine if nothin... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext import db
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.6,
0.2,
0,
0.66,
1,
167,
0,
1,
0,
0,
167,
0,
0
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"from google.appengine.ext import db"
] |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
| [
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.6667,
0.1667,
0,
0.66,
... | [
"from django.http import HttpResponseRedirect",
"from django.utils.translation import ugettext as _",
"from ragendja.template import render_to_response"
] |
#!/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... | [
[
8,
0,
0.7308,
0.1923,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.9615,
0.1154,
0,
0.66,
1,
222,
0,
2,
0,
0,
0,
0,
0
],
[
8,
1,
0.9615,
0.0385,
1,
0.08,
0... | [
"\"\"\"This file acts as a very minimal replacement for the 'imp' module.\n\nIt contains only what Django expects to use and does not actually implement the\nsame functionality as the real 'imp' module.\n\"\"\"",
"def find_module(name, path=None):\n \"\"\"Django needs imp.find_module, but it works fine if nothin... |
# -*- 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... | [
[
1,
0,
0.0119,
0.006,
0,
0.66,
0,
680,
0,
1,
0,
0,
680,
0,
0
],
[
1,
0,
0.0179,
0.006,
0,
0.66,
0.0455,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0238,
0.006,
0,
0.6... | [
"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",... |
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_... | [
[
1,
0,
0.0125,
0.0125,
0,
0.66,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.025,
0.0125,
0,
0.66,
0.0526,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.0375,
0.0125,
0,
0... | [
"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",
"signals.post_save_committed = Signal()",
"signal... |
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
... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0.25,
688,
0,
2,
0,
0,
688,
0,
0
],
[
14,
0,
0.2222,
0.0556,
0,
0... | [
"from google.appengine.api import apiproxy_stub_map",
"import os, sys",
"have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))",
"if have_appserver:\n appid = os.environ.get('APPLICATION_ID')\nelse:\n try:\n from google.appengine.tools import dev_appserver\n from aecmd ... |
from google.appengine.api.memcache import *
| [
[
1,
0,
1,
1,
0,
0.66,
0,
901,
0,
1,
0,
0,
901,
0,
0
]
] | [
"from google.appengine.api.memcache import *"
] |
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... | [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
898,
0,
1,
0,
0,
898,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.5,
519,
0,
2,
0,
0,
519,
0,
0
],
[
4,
0,
0.6364,
0.8182,
0,
0.6... | [
"from ragendja.settings_post import settings",
"from appenginepatcher import have_appserver, on_production_server",
"if have_appserver and not on_production_server and \\\n settings.MEDIA_URL.startswith('/'):\n if settings.ADMIN_MEDIA_PREFIX.startswith(settings.MEDIA_URL):\n settings.ADMIN_MEDI... |
# -*- 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... | [
[
1,
0,
0.0058,
0.0029,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0088,
0.0029,
0,
0.66,
0.0357,
480,
0,
1,
0,
0,
480,
0,
0
],
[
1,
0,
0.0117,
0.0029,
0,
... | [
"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__), '... |
# -*- 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... | [
[
1,
0,
0.0179,
0.0089,
0,
0.66,
0,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0268,
0.0089,
0,
0.66,
0.2,
220,
0,
2,
0,
0,
220,
0,
0
],
[
2,
0,
0.1339,
0.1875,
0,
0.66,... | [
"from os.path import getmtime",
"import codecs, os",
"def updatemessages():\n from django.conf import settings\n if not settings.USE_I18N:\n return\n from django.core.management.commands.compilemessages import compile_messages\n if any([needs_update(path) for path in settings.LOCALE_PATHS]):\... |
# -*- 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',
),... | [
[
8,
0,
0.28,
0.5,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.54,
0.02,
0,
0.66,
0.2,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.56,
0.02,
0,
0.66,
0.4,
3... | [
"\"\"\"\nThis app combines media files specified in the COMBINE_MEDIA setting into one\nsingle file. It's a dictionary mapping the combined name to a tuple of files\nthat should be combined:\n\nCOMBINE_MEDIA = {\n 'global/js/combined.js': (\n 'global/js/main.js',",
"from django.core.management.base impo... |
# -*- 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... | [
[
1,
0,
0.069,
0.0345,
0,
0.66,
0,
779,
0,
2,
0,
0,
779,
0,
0
],
[
1,
0,
0.1034,
0.0345,
0,
0.66,
0.2,
305,
0,
1,
0,
0,
305,
0,
0
],
[
1,
0,
0.1552,
0.069,
0,
0.66,... | [
"from django.http import HttpResponse, Http404",
"from django.views.decorators.cache import cache_control",
"from mediautils.generatemedia import get_targets, get_copy_targets, \\\n get_target_content, get_media_dirs",
"from mimetypes import guess_type",
"from ragendja.template import render_to_response"... |
# -*- 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):
... | [
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.2143,
0.0714,
0,
0.66,
0.5,
376,
0,
1,
0,
0,
376,
0,
0
],
[
3,
0,
0.6786,
0.7143,
0,
0.6... | [
"from django.conf import settings",
"from mediautils.views import get_file",
"class MediaMiddleware(object):\n \"\"\"Returns media files.\n \n This is a middleware, so it can handle the request as early as possible\n and thus with minimum overhead.\"\"\"\n def process_request(self, request):\n ... |
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... | [
[
1,
0,
0.0208,
0.0208,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0417,
0.0208,
0,
0.66,
0.1429,
734,
0,
1,
0,
0,
734,
0,
0
],
[
1,
0,
0.0625,
0.0208,
0,
... | [
"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__.SI... |
# -*- 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... | [
[
8,
0,
0.1034,
0.1034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1724,
0.0345,
0,
0.66,
0.1667,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.2069,
0.0345,
0,
0.66... | [
"\"\"\"\nImports urlpatterns from apps, so we can have nice plug-n-play installation. :)\n\"\"\"",
"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', ... |
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(... | [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0455,
0.0227,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
2,
0,
0.1023,
0.0455,
0,
... | [
"from django.conf import settings",
"import os",
"def import_module(module_name):\n return __import__(module_name, {}, {}, [''])",
" return __import__(module_name, {}, {}, [''])",
"def import_package(package_name):\n package = [import_module(package_name)]\n if package[0].__file__.rstrip('.pyc')... |
# -*- 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... | [
[
1,
0,
0.0208,
0.0104,
0,
0.66,
0,
561,
0,
1,
0,
0,
561,
0,
0
],
[
2,
0,
0.1458,
0.2188,
0,
0.66,
0.1667,
317,
0,
1,
1,
0,
0,
0,
4
],
[
8,
1,
0.0521,
0.0104,
1,
0.... | [
"from django.utils._threading_local import local",
"def make_tls_property(default=None):\n \"\"\"Creates a class-wide instance property with a thread-specific value.\"\"\"\n class TLSProperty(object):\n def __init__(self):\n self.local = local()\n\n def __get__(self, instance, cls):... |
# -*- 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.
... | [
[
1,
0,
0.0476,
0.0238,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0714,
0.0238,
0,
0.66,
0.25,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.0952,
0.0238,
0,
0.... | [
"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):\n \"\"\"\n A test case for models that provides an easy way to validate the DB\n contents against a given list of row-valu... |
# -*- 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_... | [
[
1,
0,
0.0196,
0.0098,
0,
0.66,
0,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0294,
0.0098,
0,
0.66,
0.0667,
975,
0,
1,
0,
0,
975,
0,
0
],
[
1,
0,
0.0392,
0.0098,
0,
... | [
"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 impor... |
# -*- 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... | [
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
0.66,
0.1667,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.2222,
0.0556,
0,
... | [
"from django.conf import settings",
"from django.template import Library",
"from django.utils.html import escape",
"from google.appengine.api import users",
"register = Library()",
"def google_login_url(redirect=settings.LOGIN_REDIRECT_URL):\n return escape(users.create_login_url(redirect))",
" re... |
from django.contrib.auth.models import *
from django.contrib.auth.models import DjangoCompatibleUser as User
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
1,
0.5,
0,
0.66,
1,
808,
0,
1,
0,
0,
808,
0,
0
]
] | [
"from django.contrib.auth.models import *",
"from django.contrib.auth.models import DjangoCompatibleUser as User"
] |
# -*- 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.
... | [
[
8,
0,
0.0769,
0.0769,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1282,
0.0256,
0,
0.66,
0.1429,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1538,
0.0256,
0,
0.66... | [
"\"\"\"\nProvides basic set of auth urls.\n\"\"\"",
"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('/')",
"LOGOUT_DATA = {'next_page': getattr(se... |
# -*- coding: utf-8 -*-
from google.appengine.api import users
def google_user(request):
return {'google_user': users.get_current_user()}
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
2,
0,
0.9,
0.4,
0,
0.66,
1,
708,
0,
1,
1,
0,
0,
0,
1
],
[
13,
1,
1,
0.2,
1,
0.62,
0,
0,
0,... | [
"from google.appengine.api import users",
"def google_user(request):\n return {'google_user': users.get_current_user()}",
" return {'google_user': users.get_current_user()}"
] |
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):
... | [
[
1,
0,
0.0204,
0.0204,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0408,
0.0204,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0612,
0.0204,
0,
... | [
"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):\n @classmethod\n def get_djang... |
# -*- 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... | [
[
1,
0,
0.087,
0.0435,
0,
0.66,
0,
885,
0,
1,
0,
0,
885,
0,
0
],
[
1,
0,
0.1304,
0.0435,
0,
0.66,
0.2,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.1739,
0.0435,
0,
0.66... | [
"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):\n \"\"\"\n Decorator that requires user.is_staff. Otherwise renders no_acce... |
# -*- 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... | [
[
1,
0,
0.0345,
0.0172,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0517,
0.0172,
0,
0.66,
0.0714,
895,
0,
1,
0,
0,
895,
0,
0
],
[
1,
0,
0.069,
0.0172,
0,
0... | [
"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... |
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... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
3,
0,
0.6429,
0.7857,
0,
0.6... | [
"from django.contrib import admin",
"from django.utils.translation import ugettext_lazy as _",
"class UserAdmin(admin.ModelAdmin):\n fieldsets = (\n (_('Personal info'), {'fields': ('user',)}),\n (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions')}),\n ... |
# 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... | [
[
3,
0,
0.4259,
0.6667,
0,
0.66,
0,
696,
0,
2,
0,
0,
186,
0,
6
],
[
2,
1,
0.1667,
0.0741,
1,
0.49,
0,
555,
0,
2,
0,
0,
0,
0,
0
],
[
14,
2,
0.1852,
0.037,
2,
0.07,
... | [
"class LazyGoogleUser(object):\n def __init__(self, middleware_class):\n self._middleware_class = middleware_class\n\n def __get__(self, request, obj_type=None):\n if not hasattr(request, '_cached_user'):\n from django.contrib.auth import get_user\n from django.contrib.auth... |
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... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.3333,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.1579,
0.0526,
0,
... | [
"from django.utils.translation import ugettext_lazy as _",
"from google.appengine.ext import db",
"from ragendja.auth.google_models import GoogleUserTraits",
"class User(GoogleUserTraits):\n \"\"\"User class that provides support for Django and Google Accounts.\"\"\"\n user = db.UserProperty()\n user... |
# -*- 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... | [
[
8,
0,
0.0787,
0.1236,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1461,
0.0112,
0,
0.66,
0.0667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1573,
0.0112,
0,
0.66... | [
"\"\"\"\nThis is a set of utilities for faster development with Django templates.\n\nrender_to_response() and render_to_string() use RequestContext internally.\n\nThe app_prefixed_loader is a template loader that loads directly from the app's\n'templates' folder when you specify an app prefix ('app/template.html').... |
# -*- 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):
... | [
[
1,
0,
0.0952,
0.0476,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.1429,
521,
0,
1,
0,
0,
521,
0,
0
],
[
1,
0,
0.1905,
0.0476,
0,
... | [
"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(DjangoJSON... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.