code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
import sys, string
base = {}
for line in sys.stdin.readlines():
words = string.split(line[:-1], '\t')
if len(words) != 2:
print "Error!"
exit
if base.has_key(words[0]):
base[words[0]] += [words[1]]
else:
base[words[0]] = [words[1]]
keys = base.keys()
keys.sort()
for key in keys:
print key,'\t... | Python |
#!/usr/bin/python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program... | Python |
#!/usr/bin/python
class IllegalMove(Exception):
pass
size = 3
dim = 4 # try to keep it as flexible as possible!
colours = {0: ' ', 1: 'X', -1: 'O'}
board_size = size ** dim
diag = [range(size), range(size-1,-1,-1)]
strt = [[k,k,k] for k in range(size)]
psbl = diag + strt # possibilities
def convert(coord):
... | Python |
#!/usr/bin/python
import board
from random import choice
def rate_position_1(pos):
""" Rate position
based on score plus open rows
"""
open_for_X, open_for_O = pos.count_patterns()
rating = 0
for k in range(board.size):
rating += open_for_X[k] * 0.5 ** k
rating -= open_for_O[k]... | Python |
#!/usr/bin/python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program... | Python |
from PIL import Image
tileArray = [ [ [0, 0] ] ]
#print tileArray[1][1][0]
width = 128
height = 128
tileSize = 32
outputFileName = "map.png"
tiles = Image.open('beachTiles.png')
tilePix = tiles.load()
tileMap = Image.new("RGBA", (width * tileSize, height * tileSize), "pink")
mapPix = tileMap.load()
#sandTile =... | Python |
#!/usr/bin/env python
"""
<p>4sqNoGPS - This webapp is similar to Foursquare's mobile website but allows
manual input of coordinates. That will allow nearest venue searches and
check-ins by phones that do not have GPS.
<p>Input is optimized for handsets without a full keyboard by allowing coordinate entry using only ... | Python |
#!/usr/bin/env python
"""
<p>4sqNoGPS - This webapp is similar to Foursquare's mobile website but allows
manual input of coordinates. That will allow nearest venue searches and
check-ins by phones that do not have GPS.
<p>Input is optimized for handsets without a full keyboard by allowing coordinate entry using only ... | Python |
"""
The MIT License
Copyright (c) 2010 AppHacker apphacker@gmail.com
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, mod... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import math, sys, os.path, glob, string, re, os, subprocess
is_windows = sys.platform == 'win32'
is_win64 = is_windows and (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or (os.environ.has_key('PROCESSOR_ARCHITEW6432') and os.environ['PROCESSOR_ARCHITEW6432'] == 'AM... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import math, sys, os.path, glob, string, re, os, subprocess
is_windows = sys.platform == 'win32'
is_win64 = is_windows and (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or (os.environ.has_key('PROCESSOR_ARCHITEW6432') and os.environ['PROCESSOR_ARCHITEW6432'] == 'AM... | Python |
#!/usr/bin/python
import os, sys, zenilib
def main():
os.chdir( zenilib.dir )
zenilib.auto_accept = True
zenilib.destroy("Visual Studio 2008/x64")
zenilib.destroy("Visual Studio 2010/x64")
zenilib.destroy("bin/x64")
zenilib.destroy("lib_win/x64")
zenilib.destroy("*_x64.exe")
zenilib.destroy("... | Python |
#!/usr/bin/python
import glob, os, shutil, sys
auto_accept = False
dir = os.path.dirname( os.path.realpath( __file__ ) ) + "/.."
def isspace(c):
return c == ' ' or c == '\t' or c == '\r' or c == '\n'
def yes_no_prompt(prompt):
if auto_accept:
return True
print prompt + " [y/N] " ,
line = sys.stdin.re... | Python |
#!/usr/bin/python
import os, sys, zenilib, zenilib_clean_extra, zenilib_strip_x64
def main():
zenilib_clean_extra.main()
zenilib_strip_x64.main()
os.chdir( zenilib.dir )
zenilib.auto_accept = False
zenilib.destroy("Frameworks")
if __name__ == '__main__':
main(*sys.argv[1:])
| Python |
#!/usr/bin/python
import os, sys, zenilib, zenilib_clean
def main():
zenilib_clean.main()
os.chdir( zenilib.dir )
zenilib.auto_accept = True
zenilib.destroy("Visual Studio 2008/*.suo")
zenilib.destroy("Visual Studio 2008/*.user", ["Application.vcproj.user", "Application_SoarSML.vcproj.user", "Launcher... | Python |
#!/usr/bin/python
import os, sys, zenilib
def main():
os.chdir( zenilib.dir )
zenilib.auto_accept = True
zenilib.destroy("Visual Studio 2008/SoarLibrary")
zenilib.destroy("Visual Studio 2008/Win32")
zenilib.destroy("Visual Studio 2008/x64")
zenilib.destroy("Visual Studio 2010/SoarLibrary")
zenilib.de... | Python |
#!/usr/bin/python
import glob, os, shutil, sys
auto_accept = False
dir = os.path.dirname( os.path.realpath( __file__ ) ) + "/.."
def isspace(c):
return c == ' ' or c == '\t' or c == '\r' or c == '\n'
def yes_no_prompt(prompt):
if auto_accept:
return True
print prompt + " [y/N] " ,
line = sys.stdin.re... | Python |
#!/usr/bin/python
import os, sys, zenilib, zenilib_clean
def main():
zenilib_clean.main()
os.chdir( zenilib.dir )
zenilib.auto_accept = True
zenilib.destroy("Visual Studio 2008/*.suo")
zenilib.destroy("Visual Studio 2008/*.user", ["Application.vcproj.user", "Application_SoarSML.vcproj.user", "Launcher... | Python |
#!/usr/bin/python
import os, sys, zenilib
def main():
os.chdir( zenilib.dir )
zenilib.auto_accept = False
zenilib.destroy("bin/x64/cgc.exe")
zenilib.destroy("bin/cgc.exe")
zenilib.destroy("bin/cgfxcat.exe")
zenilib.destroy("bin/cginfo.exe")
zenilib.destroy("config/zenilib.xml.bak")
zenilib.de... | Python |
#!/usr/bin/python
import os, sys, zenilib
def main():
os.chdir( zenilib.dir )
zenilib.auto_accept = True
zenilib.destroy("Visual Studio 2008/SoarLibrary")
zenilib.destroy("Visual Studio 2008/Win32")
zenilib.destroy("Visual Studio 2008/x64")
zenilib.destroy("Visual Studio 2010/SoarLibrary")
zenilib.de... | Python |
#!/usr/bin/python
import os, sys, zenilib
def main():
os.chdir( zenilib.dir )
zenilib.auto_accept = True
zenilib.destroy("Visual Studio 2008/x64")
zenilib.destroy("Visual Studio 2010/x64")
zenilib.destroy("bin/x64")
zenilib.destroy("lib_win/x64")
zenilib.destroy("*_x64.exe")
zenilib.destroy("... | Python |
#!/usr/bin/python
import os, sys, zenilib, zenilib_clean_extra, zenilib_strip_x64
def main():
zenilib_clean_extra.main()
zenilib_strip_x64.main()
os.chdir( zenilib.dir )
zenilib.auto_accept = False
zenilib.destroy("Frameworks")
if __name__ == '__main__':
main(*sys.argv[1:])
| Python |
#!/usr/bin/python
import os, sys, zenilib
def main():
os.chdir( zenilib.dir )
zenilib.auto_accept = False
zenilib.destroy("bin/x64/cgc.exe")
zenilib.destroy("bin/cgc.exe")
zenilib.destroy("bin/cgfxcat.exe")
zenilib.destroy("bin/cginfo.exe")
zenilib.destroy("config/zenilib.xml.bak")
zenilib.de... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
# encoding=utf-8
from django.db import models
class House(models.Model):
name=models.CharField('名称',max_length=30)
address=models.CharField('地址',max_length=80,null=True)
town=models.CharField('城镇', choices=(('beijiao','北滘'), ('chencun','陈村')),max_length=10,null=True)
detail=models.TextField('详细'... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'house'
db.create_table('house_house', (
('id', self.gf('django.db.... | Python |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'house'
db.create_table('house_house', (
('id', self.gf('django.db.... | Python |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'house'
db.create_table('house_house', (
('id', self.gf('django.db.... | Python |
# encoding=utf-8
from django.conf.urls.defaults import *
from django.conf import settings
from house import views
urlpatterns=patterns('',
url(r'^house/detail/(?P<id>\d+)/$', views.detail,{'template_name':'detail.html'}),
url(r'^house/', views.index,{'template_name':'house.html'}),
url(r'^contact... | Python |
# encoding=utf-8
from django.contrib import admin
from zhaofang.house.models import *
admin.site.register(House)
admin.site.register(Photo)
class HouseAdmin(admin.ModelAdmin):
formfield_overrides = {
#fields=('name')
#models.TextField: {'detail': RichTextEditor},
}
| Python |
# encoding=utf-8
from house.models import *
from django.shortcuts import render_to_response
from django.template import RequestContext
def index(request,template_name):
house_list=House.objects.all().reverse()[:8]
return render_to_response(template_name,locals(),context_instance=RequestContext(request... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^zhaofang/', include('zhaofang.foo.urls')),... | Python |
# Django settings for zhaofang project.
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
... | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nsgwsl.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests... | Python |
# Create your views here.
from django.shortcuts import render_to_response
from django.shortcuts import redirect
from django.core.context_processors import csrf
def badpasswords(request):
content = {}
content.update(csrf(request))
if request.method == 'POST':
if str(request.POST['pass']... | Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
# Create your views here.
from django.shortcuts import render_to_response
from django.shortcuts import redirect
from django.core.context_processors import csrf
import time
import random
import urllib
def unprotected(request):
content = {}
return render_to_response("Lab7/unprotected.html", content)
def unprote... | Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests... | Python |
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.core.context_processors import csrf
from django.http import HttpResponse
def index(request):
c = {}
c.update(csrf(request))
if request.method == 'POST':
data = {
'price' : ... | Python |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'nsgwsl.views.index'),
# url(r'^nsgwsl/', include('nsgwsl.foo.urls')),
url(r'^La... | Python |
# Django settings for ITP425 project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'N... | Python |
from django.shortcuts import render_to_response
def index(request):
return render_to_response('index.html')
| Python |
"""
WSGI config for ITP425 project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | Python |
from django.db import models
# Create your models here.
from django.db.models import Model
class Session(models.Model):
sessionindex = models.IntegerField(default=1234567)
def __unicode__(self):
return str(self.sessionindex) | Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests... | Python |
# Create your views here.
from django.shortcuts import render_to_response
from django.shortcuts import redirect
import time
import random
import urllib
def weaktoken1(request):
content = {}
if request.method == "POST":
if str(request.POST['user']) == 'Lassie' and str(request.POST['pass']) =... | Python |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | Python |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | Python |
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the terms of the Apache Software License 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
#
# Questions, comments, feature requests and patches are most welcome.
# Please direct all of these to the Google Code users group:
# http://groups.google.co... | Python |
import os
from google.appengine.ext.webapp import template
import cgi
from google.appengine.ext.webapp.util import login_required
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from goog... | Python |
SECRET_CODE = 'whateveryourcodeis'
| Python |
import sys, os, optparse, subprocess
# Avoid .pyc files
sys.dont_write_bytecode = True
# Auxilary
def toPosix(path):
if os.sep != "/" and os.sep in path:
return path.replace(os.sep, "/")
return path
# Parse command line
parser = optparse.OptionParser(usage='usage: %prog [options] settings... | Python |
#!/usr/bin/env pypy
import os, sys, logging, re
import argparse
import fnmatch
configurations = {'lite', 'pro'}
package_dirs = {
'lite': ('src/cx/hell/android/pdfview',),
'pro': ('src/cx/hell/android/pdfviewpro',)
}
file_replaces = {
'lite': (
'cx.hell.android.pdfview.',
'"cx.hell.an... | Python |
#This contains global definition of Browser class and other useful thing
#######################################################################################
# #
# File: browser_bogus.py ... | Python |
#! /usr/bin/python
# -*- coding: utf-8 -*-
from distutils.core import setup
import py2exe
import main
from glob import glob
data_files = [("Microsoft.VC100.CRT",
glob(r'E:\important\应用软件\开发工具\python\开发代码\Microsoft.VC100.CRT\*.*'))]
setup(
options = {"py2exe": {"optimize": 2,
... | Python |
#-*- coding: utf-8 -*-
#! /usr/bin/python
#######################################################################################
# #
# File: online_keeper.py #
# Pa... | Python |
# -*- coding: utf-8 -*-
#! /usr/bin/python
#######################################################################################
# #
# File: main.py #
# Par... | Python |
import random
NS_NTP = ["132.163.4.101",
"132.163.4.102",
"132.163.4.103",
"128.138.140.44",
"69.25.96.13",
"64.236.96.53"]
#print len(UA_MSIE10)
#print len(UA_MSIE9)
#print len(UA_MSIE8)
#print len(UA_MSIE7)
#print len(UA_MSIE6)
def get_random_ntp_server():
random.seed()
i = random.randra... | Python |
#! /usr/bin/python
# -*- coding: utf-8 -*-
from distutils.core import setup
import py2exe
import main
from glob import glob
data_files = [("Microsoft.VC100.CRT",
glob(r'E:\important\应用软件\开发工具\python\开发代码\Microsoft.VC100.CRT\*.*'))]
setup(
options = {"py2exe": {"optimize": 2,
... | Python |
#!/usr/bin/python
from socket import *
import struct,os,time,sys
from ntp_server_lib import get_random_ntp_server
# print get_random_ntp_server()
time_server = (get_random_ntp_server(), 123)
TIME1970 = 2208988800L # Thanks to F.Lundh
def get_ntp_time():
client = socket( AF_INET, SOC... | Python |
# -*- coding: utf-8 -*-
#######################################################################################
# #
# File: Core.py #
# Part of stage1st_cheater ... | Python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainDialog.ui'
#
# Created: Sun May 29 21:22:32 2011
# by: PyQt4 UI code generator 4.8.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8... | Python |
#######################################################################################
#
# File: user_agent_lib
# Part of 51cto-cheater
# Home: http://51cto-cheater.googlecode.com
#
# Th... | Python |
#!/usr/bin/python
from socket import *
import struct,os,time,sys
from ntp_server_lib import get_random_ntp_server
# print get_random_ntp_server()
time_server = (get_random_ntp_server(), 123)
TIME1970 = 2208988800L # Thanks to F.Lundh
def get_ntp_time():
client = socket( AF_INET, SOC... | Python |
print "Content-type: text/html\n\n"
print """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Python test page.</title>
<meta http-equiv="Content-Type" content="text/html;... | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fotohost.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python |
from django.db import models
# Create your models here.
class Minidb(models.Model):
link = models.CharField(max_length=20)
image = models.CharField(max_length=20)
def __unicode__(self):
return self.image
| Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
# Create your views here.
from django.http import HttpResponse
from models import Minidb
from django.shortcuts import render_to_response
def getimg(request, img, ext):
imglink = Minidb.objects.get(link=img).image
# html = '<center><img src = "http://4pic.kz/upload/images/%s" /></center>' % imglink
# return H... | Python |
#!/usr/bin/env python
source=open('images.txt', 'r')
dest=open('sql.txt', 'w')
for i in source.readlines():
link = i[:-5]
ext = "('%s', '%s'),\n" % (link, i[:-1])
dest.write(ext)
source.close()
dest.close() | Python |
#!/usr/bin/env python
source=open('images.txt', 'r')
dest=open('sql.txt', 'w')
for i in source.readlines():
link = i[:-5]
ext = "('%s', '%s'),\n" % (link, i[:-1])
dest.write(ext)
source.close()
dest.close() | Python |
# Django settings for fotohost project.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
FORCE_SCRIPT_NAME = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.... | Python |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from forpic.views import getimg, getimg2
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'fotohost.views.home', name='home'),
# url(r'^fotohos... | Python |
"""
WSGI config for fotohost project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fotohost.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fotohost.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python |
from django.db import models
# Create your models here.
class Minidb(models.Model):
link = models.CharField(max_length=20)
image = models.CharField(max_length=20)
def __unicode__(self):
return self.image
| Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
# Create your views here.
from django.http import HttpResponse
from models import Minidb
from django.shortcuts import render_to_response
def getimg(request, img, ext):
imglink = Minidb.objects.get(link=img).image
# html = '<center><img src = "http://4pic.kz/upload/images/%s" /></center>' % imglink
# return H... | Python |
'''
Created on 13.09.2012
@author: Admin
'''
| Python |
# Django settings for fotohost project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
FORCE_SCRIPT_NAME = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
... | Python |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from forpic.views import getimg, getimg2
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'fotohost.views.home', name='home'),
# url(r'^fotohos... | Python |
"""
WSGI config for fotohost project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fotohost.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python |
import os
import sys
from unittest import TestCase
here_dir = os.path.dirname(os.path.abspath(__file__))
conf_dir = os.path.dirname(os.path.dirname(here_dir))
sys.path.insert(0, conf_dir)
import pkg_resources
pkg_resources.working_set.add_entry(conf_dir)
pkg_resources.require('Paste')
pkg_resources.require('PasteS... | Python |
from sqlalchemy import *
meta = BoundMetaData('mysql://forlater:4l8r@localhost/forlater')
users_table = Table('users', meta, autoload=True)
researchers_table = Table('researchers', meta, autoload=True)
studies_table = Table('studies', meta, autoload=True)
entries_table = Table('entries', meta, autoload=True)
snippets... | Python |
import paste.deploy
def setup_config(command, filename, section, vars):
"""
Place any commands to setup forlater here.
"""
conf = paste.deploy.appconfig('config:' + filename)
conf.update(dict(app_conf=conf.local_conf, global_conf=conf.global_conf))
paste.deploy.CONFIG.push_process_config(conf)
... | Python |
"""
forlater
This file loads the finished app from forlater.config.middleware.
"""
from forlater.config.middleware import make_app
| Python |
from forlater.lib.base import *
from time import *
from sqlalchemy import *
from paste.request import get_cookie_dict
import os
import shutil
import sys
import urllib
import httplib
class AController(BaseController):
def index(self):
return Response('4l8r')
def send_sms_message(self):
if... | Python |
from forlater.lib.base import *
class TemplateController(BaseController):
def view(self, url):
"""
This is the last place which is tried during a request to try to find a
file to serve. It could be used for example to display a template::
def view(self, url):
... | Python |
from paste import fileapp
from forlater.lib.base import *
from sqlalchemy import *
from forlater.lib.entry import *
from time import *
import os
import shutil
class PController(BaseController):
def index(self, id):
user = session.get('user', None)
col = model.entries_table.c
if (id == Non... | Python |
from forlater.lib.base import *
from sqlalchemy import *
from paste import fileapp
import os
import shutil
class RController(BaseController):
def index(self):
user = session.get('user', None)
c.studies = None
c.recent_entries = None
c.users = None
try:
... | Python |
from forlater.lib.base import *
from sqlalchemy import *
class LoginController(BaseController):
def index(self):
c.msg = get_message()
c.error = get_error()
c.attempted_username = ''
if request.params.has_key('username') and request.params.has_key('password'):
c.attempte... | Python |
import os.path
from paste import fileapp
from pylons.middleware import media_path, error_document_template
from pylons.util import get_prefix
from forlater.lib.base import *
forlater_error_template = """\
<html>
<head>
<title>4l8r - Server Error %(code)s</title>
<style>
h1 {
font-family: calibri,verdana,sans-serif;
... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.