code
stringlengths
1
1.72M
language
stringclasses
1 value
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## This scaffolding model makes your app work on Google App Engine too ######################################################################...
Python
### we prepend t_ to tablenames and f_ to fieldnames for disambiguity
Python
# -*- coding: utf-8 -*- ### required - do no delete def js(): import gluon.contenttype response.headers['Content-Type'] = gluon.contenttype.contenttype('.js') #Check if there is invite number limit if not current_settings.force_count_number: invreq_string = '' else: if current_setti...
Python
# -*- coding: utf-8 -*- # ########################################################## # ## make sure administrator is on localhost # ########################################################### import os import socket import datetime import copy import gluon.contenttype import gluon.fileutils # ## critical --- make a ...
Python
@auth.requires_login() def index(): app_settings = 'app settings' record = db(db.settings).select().first() users = db().select(db.users.ALL, orderby=~db.users.join_time) user_number = len(users) last_join_time = users.first().join_time form = SQLFORM(db.settings, record = record, la...
Python
# -*- coding: utf-8 -*- ### required - do no delete def user(): return dict(form=auth()) def download(): return response.download(request,db) def call(): session.forget() return service() ### end requires from google.appengine.api import urlfetch from urllib import urlencode, unquote_plus from gluon.tools impor...
Python
#!/usr/bin/env python from distutils.core import setup from gluon.fileutils import tar, untar, read_file, write_file import tarfile import sys def tar(file, filelist, expression='^.+$'): """ tars dir/files into file, only tars file that match expression """ tar = tarfile.TarFile(file, 'w') try: ...
Python
password="cfcd208495d565ef66e7dff9f98764da"
Python
password="cfcd208495d565ef66e7dff9f98764da"
Python
def webapp_add_wsgi_middleware(app): from google.appengine.ext.appstats import recording app = recording.appstats_wsgi_middleware(app) return app
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ import os import sys import wsgiref.handlers path = os.path.dirname(os.path.abspath(__file__)) os.chdi...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- # default_application, default_controller, default_function # are used when the respective element is missing from the # (possibly rewritten) incoming URL # default_application = 'init' # ordinarily set in base routes.py default_controller = 'default' # ordinarily set in a...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys if '__file__' in globals(): path = os.path.dirname(os.path.abspath(__file__)) os.chdir(path) else: path = os.getcwd() # Seems necessary for py2exe sys.path = [path]+[p for p in sys.path if not p==path] # import gluon.import_all ##### Thi...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ ############################################################################## # Configuration paramete...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Usage: Install py2exe: http://sourceforge.net/projects/py2exe/files/ Copy script to the web2py directory c:\bin\python26\python build_windows_exe.py py2exe Adapted from http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/to...
Python
from google.appengine.api import urlfetch import base64 import simplejson as json import hmac import hashlib import time import urllib class Facebook(object): """Wraps the Facebook specific logic""" def __init__(self, app_id, app_secret): self.app_id = app_id self.app_secret = app_secret ...
Python
#Page html code, do not change! html_code = """ <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.facebook.multifriend.select.js"></script> <link rel="stylesheet" href="ht...
Python
app_id = '199187756818254' # your facebook app id app_secret = '319bb935676f58c9f98bb5828b63f604' fan_page_url= 'https://www.facebook.com/pages/Index_demo/159420610812099' #your facebook fan page url host_url = 'http://index-demo.appspot.com/' #You google app url landing = '<img src=\\"http://img199.images...
Python
from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.api import urlfetch from app_settings import * from html_code import * from facebook_sdk import Facebook class MainPage(webapp.RequestHandler): def get(self): self.response.headers['C...
Python
from google.appengine.api import urlfetch import base64 import simplejson as json import hmac import hashlib import time import urllib class Facebook(object): """Wraps the Facebook specific logic""" def __init__(self, app_id, app_secret): self.app_id = app_id self.app_secret = app_secret ...
Python
#app_id = '272691136095890' # your facebook app id #app_secret = 'd9584755d71747b5079df4f198045841' #fan_page_url= 'http://www.facebook.com/pages/Southwest/266778513374176?sk=app_272691136095890' #your facebook fan page url #host_url = 'southwest-offers.appspot.com' #You google app url, notice there is no htt...
Python
import os, logging from google.appengine.dist import use_library use_library('django', '1.2') from google.appengine.ext.webapp import template from google.appengine.ext import webapp from google.appengine.api import urlfetch from google.appengine.ext.webapp.util import run_wsgi_...
Python
from django.conf.urls.defaults import * from feedbackcn import settings from django.contrib.auth.views import login, logout from django.contrib import admin admin.autodiscover() # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', ...
Python
""" URLConf for Django user registration and authentication. Recommended usage is a call to ``include()`` in your project's root URLConf to include this URLConf for any URL beginning with ``/accounts/``. """ from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from djan...
Python
""" Forms and validation code for user registration. """ from django import forms #from django.core.validators import alnum_re from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User from registration.models import RegistrationProfile # I put this on all required fields...
Python
import datetime import random import re import sha from django.conf import settings from django.db import models from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User from django.contrib.sites.models import Site SHA1_RE...
Python
""" Views which allow users to create and activate accounts. """ 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 import RequestContext from registration.forms import Regist...
Python
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)
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 have to ...
Python
from django.db import models # Create your models here. class Message(models.Model): username = models.CharField(max_length=255) email = models.EmailField() telephone = models.CharField(max_length=50) public = models.BooleanField() title = models.CharField(max_length=255) content = models.CharField(max_...
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
# Create your views here. from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext import time from django.core.paginator import Paginator, InvalidPage, EmptyPage from feedbackcn.fb.models import Message def feedback(request): if request.method...
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 have to ...
Python
#!/usr/bin/env python # # Copyright (C) 2007 Juan Manuel Caicedo. # # 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 ap...
Python
#!/usr/bin/env python # # Copyright (C) 2007 Juan Manuel Caicedo. # # 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 ap...
Python
#!/usr/bin/env python # # Copyright (C) 2007 Juan Manuel Caicedo. # # 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 ap...
Python
#!/usr/bin/env python # # Copyright (C) 2007 Juan Manuel Caicedo. # # 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 ap...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2007 manatlan ## ## 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; version 2 only. ## ## This program is distributed in the hop...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2007 manatlan ## ## 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; version 2 only. ## ## This program is distributed in the hop...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2007 manatlan manatlan[at]gmail(dot)com ## ## 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; version 2 only. ## ## This pro...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2007 manatlan manatlan[at]gmail(dot)com ## ## 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; version 2 only. ## ## This pro...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2005 manatlan manatlan[at]gmail(dot)com ## ## 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; version 2 only. ## ## This prog...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from sgmllib import SGMLParser import urllib2,os,re from datetime import datetime,timedelta def __getHtmlSource( url,cookie=[] ): """ recupere le source html de l'url """ import urllib txheaders = { #~ "Host": "www.humanclock.com", "U...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from sgmllib import SGMLParser import urllib2,os,re from datetime import datetime,timedelta def __getHtmlSource( url,cookie=[] ): """ recupere le source html de l'url """ import urllib txheaders = { #~ "Host": "www.humanclock.com", "U...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2005 manatlan manatlan[at]gmail(dot)com ## ## 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; version 2 only. ## ## This prog...
Python
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.1 or later Recommended: Python 2.3 or later Recommended: CJKCodecs and iconv_codec <...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from sgmllib import SGMLParser import urllib2,os,re from datetime import datetime,timedelta def __getHtmlSource( url,cookie=[] ): """ recupere le source html de l'url """ import urllib txheaders = { #~ "Host": "www.humanclock.com", "U...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from sgmllib import SGMLParser import urllib2,os,re from datetime import datetime,timedelta def __getHtmlSource( url,cookie=[] ): """ recupere le source html de l'url """ import urllib txheaders = { #~ "Host": "www.humanclock.com", "U...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2005 alexisoft (manatlan[at]gmail(dot)com) ## ## 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; version 2 only. ## ## This p...
Python
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.1 or later Recommended: Python 2.3 or later Recommended: CJKCodecs and iconv_codec <...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2005 alexisoft (manatlan[at]gmail(dot)com) ## ## 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; version 2 only. ## ## This p...
Python
#!/usr/bin/env python # -*- coding: UTF8 -*- # ============================================================================== # field type descriptions as (length, abbreviation, full name) tuples FIELD_TYPES=( (0, 'X', 'Proprietary'), # no such type (1, 'B', 'Byte'), (1, 'A', 'ASCII'), (2, '...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2005 manatlan manatlan[at]gmail(dot)com ## ## 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; version 2 only. ## ## This prog...
Python
#!/usr/bin/env python # -*- coding: UTF8 -*- # ============================================================================== # field type descriptions as (length, abbreviation, full name) tuples FIELD_TYPES=( (0, 'X', 'Proprietary'), # no such type (1, 'B', 'Byte'), (1, 'A', 'ASCII'), (2, '...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ## Copyright (C) 2005 manatlan manatlan[at]gmail(dot)com ## ## 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; version 2 only. ## ## This prog...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os,sys from dict4ini import DictIni import os def getHomeFolder(): """ return the home folder of the user (platform independant) return an existing folder or None """ if "APPDATA" in os.environ: #windows NT,2k,XP,etc. fallback ...
Python
"""Beautiful Soup Elixir and Tonic "The Screen-Scraper's Friend" v2.1.0 http://www.crummy.com/software/BeautifulSoup/ Beautiful Soup parses arbitrarily invalid XML- or HTML-like substance into a tree representation. It provides methods and Pythonic idioms that make it easy to search and modify the tree. A well-formed...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ ## Simplification Wrapper around minidom ## ensure "unicode" manipulation ## ## manatlan ################################################################################ ## XmlDoc wrap D...
Python
""" EasyGui provides an easy-to-use interface for simple GUI interaction with a user. It does not require the programmer to know anything about tkinter, frames, widgets, callbacks or lambda. All GUI interactions are invoked by simple function calls that return results. Documentation is in an accompanying file,...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import xml.dom.minidom as dom """ Title: Pickle Python Objects to a DOM tree and vice versa Submitter: Uwe Schmitt (other recipes) Last Updated: 2004/12/04 Version no: 1.1 url:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355487 manatlan modifications : - unic...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- import os,sys import stat #========================================================= def getFiles(rep,exts=[]): #========================================================= assert type(rep)==unicode files = [] dirs=[] if os.path.isdir(rep): for i...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from base64 import urlsafe_b64encode,urlsafe_b64decode def u64enc(f): assert type(f)==unicode a=f.encode("utf_8") b=urlsafe_b64encode( a) return unicode(b,"utf_8") def u64dec(f): assert type(f)==unicode a=f.encode("utf_8") b=urlsafe_b64decode( ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os,sys from dict4ini import DictIni import os def getHomeFolder(): """ return the home folder of the user (platform independant) return an existing folder or None """ if "APPDATA" in os.environ: #windows NT,2k,XP,etc. fallback ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import xml.dom.minidom as dom """ Title: Pickle Python Objects to a DOM tree and vice versa Submitter: Uwe Schmitt (other recipes) Last Updated: 2004/12/04 Version no: 1.1 url:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355487 manatlan modifications : - unic...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import os import subprocess import errno import time import sys import locale isNumber = lambda x: re.compile(r"^[-+]?\d+$").match(x) #:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: # http://aspn.activestate.com/ASPN/Cookbook/Pytho...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import inspect from mako.template import Template as MakoTemplate from mako.lookup import TemplateLookup import os #MYLOOKUP = TemplateLookup(directories=["common/","../../common/",".","../.."]) MYLOOKUP = TemplateLookup(directories=[os.path.dirname(__file__),os.getcwd()...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os,sys from xmldoc import XmlDoc,XmlNode from xpickle import node2data,data2node class Conf(object): def __init__(self,fb,nodeConf): assert type(nodeConf == XmlNode) self.__nodeConf = nodeConf self.__fb = fb def __iter__(self...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ ## Simplification Wrapper around minidom ## ensure "unicode" manipulation ## ## manatlan ################################################################################ ## XmlDoc wrap D...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- import os,sys import stat #========================================================= def getFiles(rep,exts=[]): #========================================================= assert type(rep)==unicode files = [] dirs=[] if os.path.isdir(rep): for i...
Python
#coding=utf-8 # dump python dict to ini format file # Author: limodou (limodou@gmail.com) # Copyleft GPL # $Revision$ import sys import locale import os.path section_delimeter = '/' class DictNode(object): def __init__(self, values, encoding=None, root=None, section=[]): self._items = values ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import os import subprocess import errno import time import sys import locale isNumber = lambda x: re.compile(r"^[-+]?\d+$").match(x) #:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: # http://aspn.activestate.com/ASPN/Cookbook/Pytho...
Python
# runtime.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides runtime services for templates, including Context, Namespace, and various helper functions.""" from mak...
Python
# pygen.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """utilities for generating and formatting literal Python code.""" import re, string from StringIO import StringIO c...
Python
# lookup.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import os, stat, posixpath, re from mako import exceptions, util from mako.template import Template try: import ...
Python
# lexer.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides the Lexer class for parsing template strings into parse trees.""" import re, codecs from mako import pars...
Python
# parsetree.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """defines the parse tree components for Mako templates.""" from mako import exceptions, ast, util, filters impor...
Python
"""adds autohandler functionality to Mako templates. requires that the TemplateLookup class is used with templates. usage: <%! from mako.ext.autohandler import autohandler %> <%inherit file="${autohandler(template, context)}"/> or with custom autohandler filename: <%! from mako.ext.autohandler import autohandle...
Python
"""preprocessing functions, used with the 'preprocessor' argument on Template, TemplateLookup""" import re def convert_comments(text): """preprocess old style comments. example: from mako.ext.preprocessors import convert_comments t = Template(..., preprocessor=preprocess_comments)""" ret...
Python
import re try: set except NameError: from sets import Set as set from pygments.lexers.web import \ HtmlLexer, XmlLexer, JavascriptLexer, CssLexer from pygments.lexers.agile import PythonLexer from pygments.lexer import Lexer, DelegatingLexer, RegexLexer, bygroups, \ include, using, this from pygments...
Python
import re from mako.lookup import TemplateLookup from mako.template import Template class TGPlugin(object): """TurboGears compatible Template Plugin.""" extension = 'mak' def __init__(self, extra_vars_func=None, options=None): self.extra_vars_func = extra_vars_func if not options: ...
Python
# codegen.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides functionality for rendering a parsetree constructing into module source code.""" import time import re ...
Python
# util.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php try: Set = set except: import sets Set = sets.Set try: from cStringIO import StringIO except: from ...
Python
# ast.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """utilities for analyzing expressions and blocks of Python code, as well as generating Python from AST nodes""" from c...
Python
# exceptions.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """exception classes""" import traceback, sys, re class MakoException(Exception): pass class RuntimeExcept...
Python
# __init__.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php
Python
# template.py # Copyright (C) 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides the Template class, a facade for parsing, generating and executing template strings, as well as templat...
Python
# filters.py # Copyright (C) 2006, 2007 Geoffrey T. Dairiki <dairiki@dairiki.org> and Michael Bayer <mike_mp@zzzcomputing.com> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import re, cgi, urllib, htmlentitydefs, codecs from StringIO import...
Python
from mako import exceptions try: import beaker.container as container import beaker.exceptions try: import beaker.ext.memcached as memcached clsmap = { 'memory':container.MemoryContainer, 'dbm':container.DBMContainer, 'file':container.FileContainer, ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os,sys from xmldoc import XmlDoc,XmlNode from xpickle import node2data,data2node class Conf(object): def __init__(self,fb,nodeConf): assert type(nodeConf == XmlNode) self.__nodeConf = nodeConf self.__fb = fb def __iter__(self...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from base64 import urlsafe_b64encode,urlsafe_b64decode def u64enc(f): assert type(f)==unicode a=f.encode("utf_8") b=urlsafe_b64encode( a) return unicode(b,"utf_8") def u64dec(f): assert type(f)==unicode a=f.encode("utf_8") b=urlsafe_b64decode( ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import inspect from mako.template import Template as MakoTemplate from mako.lookup import TemplateLookup import os #MYLOOKUP = TemplateLookup(directories=["common/","../../common/",".","../.."]) MYLOOKUP = TemplateLookup(directories=[os.path.dirname(__file__),os.getcwd()...
Python
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.1 or later Recommended: Python 2.3 or later Recommended: CJKCodecs...
Python
"""Beautiful Soup Elixir and Tonic "The Screen-Scraper's Friend" http://www.crummy.com/software/BeautifulSoup/ Beautiful Soup parses a (possibly invalid) XML or HTML document into a tree representation. It provides methods and Pythonic idioms that make it easy to navigate, search, and modify the tree. A well-formed X...
Python
import operator import math class vec2d(object): """2d vector class, supports vector and scalar operators, and also provides a bunch of high level functions """ __slots__ = ['x', 'y'] def __init__(self, x_or_pair, y = None): if y == None: self.x = x_or_pair[0...
Python
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.1 or later Recommended: Python 2.3 or later Recommended: CJKCodecs...
Python
# -*- coding:utf-8 -*- """ Created on 21.12.2010 @author: Leon """ import feedparser as fp import re re.LOCALE from BeautifulSoup import * import urllib import nltk import threading from threading import Thread def transformUmlaute(h): p = '' p.encode("utf-8") for c in h: c ...
Python
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.1 or later Recommended: Python 2.3 or later Recommended: CJKCodecs...
Python
"""Beautiful Soup Elixir and Tonic "The Screen-Scraper's Friend" http://www.crummy.com/software/BeautifulSoup/ Beautiful Soup parses a (possibly invalid) XML or HTML document into a tree representation. It provides methods and Pythonic idioms that make it easy to navigate, search, and modify the tree. A well-formed X...
Python
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.1 or later Recommended: Python 2.3 or later Recommended: CJKCodecs...
Python
# -*- coding:utf-8 -*- """ Created on 21.12.2010 @author: Leon """ import feedparser as fp import re import urllib import nltk import threading import pickle from threading import Thread import numpy from BeautifulSoup import * ###### Globals ######### # dictionary to save URL -> Paragraph Lists ...
Python