code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/python2.6
import gflags
import httplib2
import os
import sys
import time
from apiclient.discovery import build
from apiclient.errors import HttpError
from apiclient.http import MediaFileUpload
from oauth2client.file import Storage
from oauth2client.client import flow_from_clientsecrets
from oauth2client.to... | Python |
#!/usr/bin/python
import httplib2
import os
import sys
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import flow_from_clientsecrets
from oauth2client.tools import run
from optparse import OptionParser
# CLIENT_SECRETS_FILE, name of a file containing the OAuth 2... | Python |
#!/usr/bin/python
from apiclient.discovery import build
from optparse import OptionParser
import json
import urllib
# Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the
# Google APIs Console http://code.google.com/apis/console#access
# Please ensure that you have enabled the YouTube Data API and ... | Python |
#!/usr/bin/python
import httplib2
import os
import sys
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import flow_from_clientsecrets
from oauth2client.tools import run
from optparse import OptionParser
# CLIENT_SECRETS_FILE, name of a file containing the OAuth 2... | Python |
#!/usr/bin/python
import sys
import os
import os.path
import ConfigParser
import csv
import httplib
cwd = os.path.abspath((os.path.dirname(sys.argv[0])))
config_file = os.path.join(cwd, 'fetch_samples.conf')
#print 'config file: %s' % config_file
config = ConfigParser.RawConfigParser()
config.read(config_file)
samp... | Python |
#!/usr/bin/python
import sys
import os
import os.path
import ConfigParser
from xml.etree import ElementTree
cwd = os.path.abspath((os.path.dirname(sys.argv[0])))
config_file = os.path.join(cwd, 'analyze_samples.conf')
#print 'config file: %s' % config_file
config = ConfigParser.RawConfigParser()
config.read(config_f... | Python |
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
application = webapp.WSGIApplicat... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013-3-25
首页模块,将显示登陆界面和欢迎界面
@author: zhiyong.luo
'''
from framework.bottle import Bottle
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from framework.gaesessions import get_current_session
#jinja2
env = Environment(loader ... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.runtime
~~~~~~~~~~~~~~
Runtime helpers.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from itertools import chain, imap
from jinja2.nodes import EvalContext, _context_function_types
from jinja2.utils import Markup, partial, soft_unicode, escape, miss... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.bccache
~~~~~~~~~~~~~~
This module implements the bytecode cache system Jinja is optionally
using. This is useful if you have very complex template situations and
the compiliation of all those templates slow down your application too
much.
Situations whe... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.compiler
~~~~~~~~~~~~~~~
Compiles nodes into python code.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from cStringIO import StringIO
from itertools import chain
from copy import deepcopy
from jinja2 import nodes
from j... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.meta
~~~~~~~~~~~
This module implements various functions that exposes information about
templates that might be interesting for various kinds of applications.
:copyright: (c) 2010 by the Jinja Team, see AUTHORS for more details.
:license: BSD, see LICENSE fo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.nodes
~~~~~~~~~~~~
This module implements additional nodes derived from the ast base node.
It also provides some node tree helper functions like `in_lineno` and
`get_nodes` used by the parser and translator in order to normalize
python and jinja nodes.
:... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
try:
from collections import Mapping as MappingType
... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.debug
~~~~~~~~~~~~
Implements the debug interface for Jinja. This module does some pretty
ugly stuff with the Python traceback system in order to achieve tracebacks
with correct line numbers, locals and contents.
:copyright: (c) 2010 by the Jinja Team.
:... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.optimizer
~~~~~~~~~~~~~~~~
The jinja optimizer is currently trying to constant fold a few expressions
and modify the AST in place so that it should be easier to evaluate it.
Because the AST does not contain all the scoping information and the
compiler has to ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.lexer
~~~~~~~~~~~~
This module implements a Jinja / Python combination lexer. The
`Lexer` class provided by this module is used to do some preprocessing
for Jinja.
On the one hand it filters out invalid operators like the bitshift
operators we don't allow... | Python |
# -*- coding: utf-8 -*-
"""
jinja.constants
~~~~~~~~~~~~~~~
Various constants.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
#: list of lorem ipsum words used by the lipsum() helper function
LOREM_IPSUM_WORDS = u'''\
a ac accumsan ad adipiscing aenean a... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.sandbox
~~~~~~~~~~~~~~
Adds a sandbox layer to Jinja as it was the default behavior in the old
Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the
default behavior is easier to use.
The behavior can be changed by subclassing the environm... | Python |
import gc
import unittest
from jinja2._markupsafe import Markup, escape, escape_silent
class MarkupTestCase(unittest.TestCase):
def test_markup_operations(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="application/x-some-script">alert("foo");</script>'
sa... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe._constants
~~~~~~~~~~~~~~~~~~~~~
Highlevel implementation of the Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
HTML_ENTITIES = {
'AElig': 198,
'Aacute': 193,
'Acirc': 194,
'Agrave': 1... | Python |
# -*- coding: utf-8 -*-
"""
jinja2._markupsafe._bundle
~~~~~~~~~~~~~~~~~~~~~~~~~~
This script pulls in markupsafe from a source folder and
bundles it with Jinja2. It does not pull in the speedups
module though.
:copyright: Copyright 2010 by the Jinja team, see AUTHORS.
:license: BSD, see ... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
from itertools import imap
__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
_striptags_re = re.compile... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe._native
~~~~~~~~~~~~~~~~~~
Native Python implementation the C module is not compiled.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from jinja2._markupsafe import Markup
def escape(s):
"""Convert the characters... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.loaders
~~~~~~~~~~~~~~
Jinja loader classes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import weakref
from types import ModuleType
from os import path
try:
from hashlib import sha1
except Imp... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.utils
~~~~~~~~~~~~
Utility functions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import sys
import errno
try:
from thread import allocate_lock
except ImportError:
from dummy_thread import allocate_lo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.ext
~~~~~~~~~~
Jinja extensions allow to add custom tags similar to the way django custom
tags work. By default two example extensions exist: an i18n and a cache
extension.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from collections impor... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.exceptions
~~~~~~~~~~~~~~~~~
Jinja exceptions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
class TemplateError(Exception):
"""Baseclass for all template errors."""
def __init__(self, message=None):
i... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.environment
~~~~~~~~~~~~~~~~~~
Provides a class that holds runtime and parsing time options.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from jinja2 import nodes
from jinja2.defaults import *
from ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.filters
~~~~~~~~~~~~~~
Bundled jinja filters.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import math
from random import choice
from operator import itemgetter
from itertools import imap, groupby
from jinja2.... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.defaults
~~~~~~~~~~~~~~~
Jinja default filters and tags.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
# defaults for the parser / lexer
BLOCK_START_STRING ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.parser
~~~~~~~~~~~~~
Implements the template parser.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2 import nodes
from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError
from jinja2.utils impo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.visitor
~~~~~~~~~~~~~~
This module implements a visitor for the nodes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from jinja2.nodes import Node
class NodeVisitor(object):
"""Walks the abstract syntax tree and call visitor functions for every... | Python |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
import datetime
import hashlib
import hmac
import logging
import pickle
import os
import threading
import time
from google.appengine.api import memcache
f... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
# -*- coding: utf-8 -*-
import cgi, os,sys,math
import wsgiref.handlers
import google.appengine.api
# Google App Engine imports.
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template, \
WSGIApplication
from google.appengine.api import users
##import app.webapp as web... | Python |
# -*- coding: utf-8 -*-
import logging
from django import template
from model import *
import django.template.defaultfilters as defaultfilters
import urllib
register = template.Library()
from datetime import *
@register.filter
def datetz(date,format): #datetime with timedelta
t=timedelta(seconds=3600*g_b... | Python |
#!/usr/bin/env python
"""Simple PNG Canvas for Python"""
__version__ = "0.8"
__author__ = "Rui Carmo (http://the.taoofmac.com)"
__copyright__ = "CC Attribution-NonCommercial-NoDerivs 2.0 Rui Carmo"
__contributors__ = ["http://collaboa.weed.rbse.com/repository/file/branches/pgsql/lib/spark_pr.rb"], ["Eli Bendersky"]
i... | Python |
# gmemsess.py - memcache-backed session Class for Google Appengine
# Version 1.4
# Copyright 2008 Greg Fawcett <greg@vig.co.nz>
#
# 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 3... | Python |
from time import *
from calendar import timegm
# fix for mktime bug
# https://garage.maemo.org/tracker/index.php?func=detail&aid=4453&group_id=854&atid=3201
mktime = lambda time_tuple: calendar.timegm(time_tuple) + timezone
| Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright(C) 2008 SupDo.com
# Licensed under the GUN License, Version 3.0 (the "License");
#
# File: safecode.py
# Author: KuKei
# Create Date: 2008-07-16
# Description: 负责验证码生成。
# Modify Date: 2008-08-06
import md5
import random
from pngcanva... | Python |
#!/usr/bin/env python
"""Simple PNG Canvas for Python"""
__version__ = "0.8"
__author__ = "Rui Carmo (http://the.taoofmac.com)"
__copyright__ = "CC Attribution-NonCommercial-NoDerivs 2.0 Rui Carmo"
__contributors__ = ["http://collaboa.weed.rbse.com/repository/file/branches/pgsql/lib/spark_pr.rb"], ["Eli Bendersky"]
i... | Python |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | Python |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | Python |
# -*- coding: utf-8 -*-
"""
A Python HTML filtering library - html_filter.py, v 1.15.4
Translated to Python by Samuel Adam <samuel.adam@gmail.com>
http://amisphere.com/contrib/python-html-filter/
Original PHP code ( lib_filter.php, v 1.15 ) by Cal Henderson <cal@iamcal.com>
http://i... | Python |
from django.template import Library
from django.template import Node, NodeList, Template, Context
from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END
registe... | Python |
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2003, Mathieu Fenniak
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the abov... | Python |
"""tblib.py: A Trackback (client) implementation in Python
"""
__author__ = "Matt Croydon <matt@ooiio.com>"
__copyright__ = "Copyright 2003, Matt Croydon"
__license__ = "GPL"
__version__ = "0.1.0"
__history__ = """
0.1.0: 1/29/03 - Code cleanup, release. It can send pings, and autodiscover a URL to ping.
0.0.9... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright(C) 2008 SupDo.com
# Licensed under the GUN License, Version 3.0 (the "License");
#
# File: safecode.py
# Author: KuKei
# Create Date: 2008-07-16
# Description: 负责验证码生成。
# Modify Date: 2008-08-06
import md5
import random
from pngcanva... | Python |
# -*- coding: utf-8 -*-
import os,logging
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext.db import Model as DBModel
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import urlfetch
from google.appengi... | Python |
# -*- coding: utf-8 -*-
import wsgiref.handlers
import xmlrpclib
from xmlrpclib import Fault
import sys
import cgi
import base64
#from datetime import datetime
import app.mktimefix as datetime
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
from functools import wraps
from django.utils.html import stri... | Python |
# -*- coding: utf-8 -*-
import os,stat
import sys
import logging
import wsgiref.handlers
from mimetypes import types_map
from datetime import datetime, timedelta
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.api import memcache
from google.appen... | Python |
#!/usr/bin/python
# Code copied from http://code.google.com/appengine/articles/remote_api.html
# with minor modifications.
import code
import getpass
import os
import sys
DIR_PATH = "/root/dev/google_appengine"
sys.path.append(os.path.join(os.path.dirname(__file__), '..\\'))
SCRIPT_DIR = os.path.join(DI... | Python |
#!/usr/bin/python
# Code copied from http://code.google.com/appengine/articles/remote_api.html
# with minor modifications.
import code
import getpass
import os
import sys
DIR_PATH = "/root/dev/google_appengine"
sys.path.append(os.path.join(os.path.dirname(__file__), '..\\'))
SCRIPT_DIR = os.path.join(DI... | Python |
#!/usr/bin/env python
#
# Copyright 2007 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 a... | Python |
#!/usr/bin/env python
import optparse
import os
import sys
def compile_messages(locale=None):
basedir = None
if os.path.isdir(os.path.join('conf', 'locale')):
basedir = os.path.abspath(os.path.join('conf', 'locale'))
elif os.path.isdir('locale'):
basedir = os.path.abspath('locale')
el... | Python |
#!/usr/bin/env python
# Need to ensure that the i18n framework is enabled
from django.conf import settings
settings.configure(USE_I18N = True)
from django.utils.translation import templatize
import re
import os
import sys
import getopt
pythonize_re = re.compile(r'\n\s*//')
def make_messages():
localedir = None
... | Python |
#!/usr/bin/env python
import os
import sys
def unique_messages():
basedir = None
if os.path.isdir(os.path.join('conf', 'locale')):
basedir = os.path.abspath(os.path.join('conf', 'locale'))
elif os.path.isdir('locale'):
basedir = os.path.abspath('locale')
else:
print "this scri... | Python |
#!/usr/bin/env python
# Need to ensure that the i18n framework is enabled
from django.conf import settings
settings.configure(USE_I18N = True)
from django.utils.translation import templatize
import re
import os
import sys
import getopt
pythonize_re = re.compile(r'\n\s*//')
def make_messages():
localedir = None
... | Python |
#!/usr/bin/env python
import optparse
import os
import sys
def compile_messages(locale=None):
basedir = None
if os.path.isdir(os.path.join('conf', 'locale')):
basedir = os.path.abspath(os.path.join('conf', 'locale'))
elif os.path.isdir('locale'):
basedir = os.path.abspath('locale')
el... | Python |
#!/usr/bin/env python
import os
import sys
def unique_messages():
basedir = None
if os.path.isdir(os.path.join('conf', 'locale')):
basedir = os.path.abspath(os.path.join('conf', 'locale'))
elif os.path.isdir('locale'):
basedir = os.path.abspath('locale')
else:
print "this scri... | Python |
# -*- coding: utf-8 -*-
# Django settings for the example project.
import os
DEBUG = True
TEMPLATE_DEBUG = False
##LANGUAGE_CODE = 'zh-CN'
##LANGUAGE_CODE = 'fr'
LOCALE_PATHS = 'locale'
USE_I18N = True
TEMPLATE_LOADERS=('django.template.loaders.filesystem.load_template_source',
'zipl... | Python |
# Wrapper for loading templates from zipfile.
import zipfile,logging,os
from django.template import TemplateDoesNotExist
from django.conf import settings
logging.debug("zipload imported")
zipfile_cache={}
_TEMPLATES_='templates'
def get_from_zipfile(zipfilename,name):
logging.debug("get_from_zipfile(%s,%s)"%(zipfil... | Python |
# -*- coding: utf-8 -*-
import cgi, os,sys,traceback,logging
import wsgiref.handlers
##os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
##from django.conf import settings
##settings._target = None
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.utils.translation import check_for_language, activate... | Python |
from micolog_plugin import *
import logging
from model import *
from google.appengine.api import users
class highsyntax(Plugin):
def __init__(self):
Plugin.__init__(self,__file__)
self.author="xuming"
self.authoruri="http://xuming.net"
self.uri="http://xuming.net"
self.description="HighSyntax Plugi... | Python |
from highsyntax import * | 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 |
from live_import import * | Python |
# -*- coding: utf-8 -*-
from micolog_plugin import *
from BeautifulSoup import *
from datetime import datetime
from model import Entry,Comment,Media
import logging,math
import re
from base import BaseRequestHandler,urldecode
class Importhandler(BaseRequestHandler):
def post(self):
if not self.is_logi... | Python |
from micolog_plugin import *
from model import OptionSet
class googleAnalytics(Plugin):
def __init__(self):
Plugin.__init__(self,__file__)
self.author="xuming"
self.authoruri="http://xuming.net"
self.uri="http://xuming.net"
self.description="Plugin for put google Analytics into micolog."
self.name... | Python |
###Import post,page,category,tag from wordpress export file
import xml.etree.ElementTree as et
import logging, re
###import from wxr file
class import_wordpress:
def __init__(self, source):
self.categories = []
self.tags = []
self.entries = []
self.source = re.sub(r'<atom:... | Python |
from micolog_plugin import *
from google.appengine.api import memcache
from google.appengine.api.labs import taskqueue
from wp_import import *
from model import *
import logging,math
from django.utils import simplejson
from base import BaseRequestHandler,urldecode
class waphandler(BaseRequestHandler):
def... | Python |
from wordpress import * | Python |
from micolog_plugin import *
import logging,os
from model import *
from google.appengine.api import users
class xheditor(Plugin):
def __init__(self):
Plugin.__init__(self,__file__)
self.author="xuming"
self.authoruri="http://xuming.net"
self.uri="http://xuming.net"
self.description="xheditor."
s... | Python |
from xheditor import * | Python |
# -*- coding: utf-8 -*-
from micolog_plugin import *
import logging,re
from google.appengine.api import mail
from model import *
from google.appengine.api import users
from base import BaseRequestHandler,urldecode
from google.appengine.ext.webapp import template
SBODY='''New comment on your post "%(title)s"
... | Python |
from sys_plugin import * | Python |
# -*- coding: utf-8 -*-
import os,logging
import re
from functools import wraps
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.api import memcache
from google.appengine.api... | Python |
#!/usr/bin/env python
#
# Copyright 2007 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 a... | Python |
import os,logging,re
from model import OptionSet
from google.appengine.ext.webapp import template
from google.appengine.ext import zipserve
RE_FIND_GROUPS = re.compile('\(.*?\)')
class PluginIterator:
def __init__(self, plugins_path='plugins'):
self.iterating = False
self.plugins_path = plugins_path
sel... | Python |
'''
Created on 2013-3-26
google app engine data model
@author: lzy
'''
from google.appengine.ext import db
#words
class Words(db.Model):
title = db.StringProperty()
body = db.TextProperty()
created = db.DateTimeProperty(auto_now_add=True)
#comment
class Comment(db.Model):
pass
| Python |
'''
Created on 2013-3-25
@author: lzy
'''
from framework.bottle import Bottle
wordc = Bottle()
@wordc.route('/')
def welcome():
return "words words" | Python |
'''
Created on 2013-3-25
@author: zhiyong.luo
'''
from framework.bottle import Bottle,redirect,request
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from google.appengine.api import users
#jinja2
env = Environment(loader = FileSystemLoader('templates'))
indexc = Bo... | Python |
'''
Created on 2013-3-25
@author: zhiyong.luo
'''
from framework.bottle import Bottle, debug,redirect, static_file
from google.appengine.ext.webapp.util import run_wsgi_app
from app.index import indexc
from app.words import wordc
#root app
root = Bottle()
root.mount("/index.html", indexc)
root.mount("/... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013.6.29
记录note模块,负责查询所有的,更新的,保存新的note
@author: lzy
'''
import logging
import datetime
from framework.bottle import Bottle,redirect,request
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from db.NoteDO import Note
from db.NoteDAO import ... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013-3-25
首页模块,将显示登陆界面和欢迎界面
@author: zhiyong.luo
'''
from framework.bottle import Bottle
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from framework.gaesessions import get_current_session
#jinja2
env = Environment(loader ... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013.6.29
登陆控制检查模块
@author: lzy
'''
import logging
from framework import bottle
from framework.bottle import Bottle,redirect,request
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from framework.gaesessions import get_current_session
#ji... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013-3-25
@author: zhiyong.luo
'''
from framework.bottle import Bottle, debug,redirect, static_file
from google.appengine.ext.webapp.util import run_wsgi_app
from app.index import indexController
from app.login import loginController
from app.record import recordCo... | Python |
# -*- coding: utf-8 -*-
from framework.gaesessions import SessionMiddleware
COOKIE_KEY = 'h\xb79\xecp\xe1\xa0UE\x0f\x86\xdbs\xa6\x8e \xc1\x95\x0f#\xe9\xa5\xe7\xec\xa9\xf5\n\x88\xedn\rlM*M\x01\xe9t\xc07\xee0\x96\x86\xb8\xd8\xb9\x0b\xe5\x8fI\xbf\xf0o\xb2\x01\xd9Q\xaa\x9cc\xfe\xb4\xb8'
def webapp_add_wsgi_middleware(a... | Python |
import os
from google.appengine.api import users
from google.appengine.ext import db, webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from gaesessions import get_current_session
def redirect_with_msg(h, msg, dst='/'):
get_current_session()['msg'] ... | Python |
from gaesessions import SessionMiddleware
# suggestion: generate your own random key using os.urandom(64)
# WARNING: Make sure you run os.urandom(64) OFFLINE and copy/paste the output to
# this file. If you use os.urandom() to *dynamically* generate your key at
# runtime then any existing sessions will become junk ev... | Python |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
import datetime
import hashlib
import hmac
import logging
import pickle
import os
import threading
import time
from google.appengine.api import memcache
f... | Python |
from datetime import datetime
import os
import urllib
from django.utils import simplejson
from google.appengine.api import urlfetch
from google.appengine.ext import db, webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from gaesessions import get_current... | Python |
from gaesessions import SessionMiddleware
# suggestion: generate your own random key using os.urandom(64)
# WARNING: Make sure you run os.urandom(64) OFFLINE and copy/paste the output to
# this file. If you use os.urandom() to *dynamically* generate your key at
# runtime then any existing sessions will become junk ev... | Python |
from gaesessions import delete_expired_sessions
while not delete_expired_sessions():
pass
| 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.