code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
from zope.interface import implements
from nevow import tags as T, util
from formal import iformal
from formal.util import render_cssid
class TextAreaWithSelect(object):
"""
A large text entry area that accepts newline characters.
<textarea>...</textarea>
"""
implements( iformal.IWidget )
co... | Python |
"""Adapters for converting to and from a type's value according to an
IConvertible protocol.
"""
from datetime import date, time
try:
import decimal
haveDecimal = True
except ImportError:
haveDecimal = False
from formal import iformal, validation
from zope.interface import implements
class _Adapter(objec... | Python |
import re
from zope.interface import implements
from nevow import inevow, tags
from formal import iformal
_IDENTIFIER_REGEX = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*$')
def titleFromName(name):
def _():
it = iter(name)
last = None
while 1:
ch = it.next()
if ch == '... | Python |
"""
Widgets are small components that render form fields for inputing data in a
certain format.
"""
import itertools
from nevow import inevow, loaders, tags as T, util, url, static, rend
from nevow.i18n import _
from formal import converters, iformal, validation
from formal.util import render_cssid
from formal.form im... | Python |
import re
from zope.interface import implements
from formal import iformal
class FormsError(Exception):
"""
Base class for all Forms errors. A single string, message, is accepted and
stored as an attribute.
The message is not passed on to the Exception base class because it doesn't
seem to be... | Python |
from nevow import url
import formal
from formal.examples import main
class ActionButtonsPage(main.FormExamplePage):
title = 'Action Button'
description = 'Example of non-validating button, buttons with non-default labels, etc'
def form_example(self, ctx):
form = formal.Form()
form.add... | Python |
import formal
from formal.examples import main
# Let the examples run if docutils is not installed
try:
import docutils
except ImportError:
import warnings
warnings.warn("docutils is not installed")
docutilsAvailable = False
else:
docutilsAvailable = True
if docutilsAvailable:
from docutils.... | Python |
from zope.interface import implements
from twisted.internet import defer
import formal
from formal import iformal
from formal.examples import main
# A not-too-good regex for matching an IP address.
IP_ADDRESS_PATTERN = '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'
class ValidatorFormPage(main.FormExamplePage):
ti... | Python |
import formal
from formal.examples import main
class SimpleFormPage(main.FormExamplePage):
title = 'Simple Form'
description = 'Probably the simplest form possible.'
def form_example(self, ctx):
form = formal.Form()
form.addField('aString', formal.String())
form.addAction(... | Python |
try:
import decimal
haveDecimal = True
except ImportError:
haveDecimal = False
import formal
from formal.examples import main
class TypesFormPage(main.FormExamplePage):
title = 'Form Types'
description = 'Example of using different typed fields.'
def form_example(self, ctx):
form = fo... | Python |
from datetime import date
import formal
from formal.examples import main
class MissingFormPage(main.FormExamplePage):
title = 'Missing Values'
description = 'Providing default values when missing'
def form_example(self, ctx):
form = formal.Form()
form.addField('aString', formal.String... | Python |
import formal
from formal.examples import main
class FileUploadFormPage(main.FormExamplePage):
title = 'File Upload'
description = 'Uploading a file'
def form_example(self, ctx):
form = formal.Form()
form.addField('file', formal.File())
form.addAction(self.submitted)
r... | Python |
import pkg_resources
from zope.interface import implements
from twisted.python import reflect
from nevow import appserver, inevow, loaders, rend, static, tags as T, url
import formal
DOCTYPE = T.xml('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
CHARSET... | Python |
import formal
from formal.examples import main
class SmartUploadFormPage(main.FormExamplePage):
title = 'Smart File Upload'
description = 'Smart uploading of files where the file is "carried across" when the validation fails'
def form_example(self, ctx):
form = formal.Form()
form.addF... | Python |
import formal
from formal.examples import main
class GroupFormPage(main.FormExamplePage):
title = 'Field Group Form'
description = 'Groups of fields on a form'
def form_example(self, ctx):
def makeAddressGroup(name):
address = formal.Group(name)
address.add(formal... | Python |
import formal
from formal.examples import main
class HiddenFieldsFormPage(main.FormExamplePage):
title = 'Hidden Fields Form'
description = 'A form with a hidden field.'
def form_example(self, ctx):
form = formal.Form()
form.addField('hiddenString', formal.String(), widgetFactory=... | Python |
from datetime import datetime
import formal
from formal.examples import main
class PrepopulateFormPage(main.FormExamplePage):
title = 'Prepopulate'
description = 'Example of prepopulating form fields'
def form_example(self, ctx):
form = formal.Form()
form.addField('aString', formal.St... | Python |
import formal
from formal.examples import main
from formal import RichText
class RichTextAreaFormPage(main.FormExamplePage):
title = 'Rich Text widget'
description = 'The Rich widget captures a textarea value and a type.'
def form_example(self, ctx):
form = formal.Form()
form.ad... | Python |
import formal
from formal.examples import main
class DatesTimesFormPage(main.FormExamplePage):
title = 'Dates'
description = 'Date entry examples'
def form_example(self, ctx):
form = formal.Form()
form.addField('isoFormatDate', formal.Date(), formal.TextInput)
form.addField('d... | Python |
from twisted.internet import defer
from datetime import date
import formal
from formal.examples import main
# A boring list of (value, label) pairs.
strings = [
('foo', 'Foo'),
('bar', 'Bar'),
]
# A list of dates with meaningful names.
dates = [
(date(2005, 01, 01), 'New Year Day'),
(date(2005, 11... | Python |
import formal
from formal.examples import main
class NoFieldsFormPage(main.FormExamplePage):
title = 'Form With no Fields'
description = 'A form with no fields, just button(s). (Just to prove ' \
'it works.)'
def form_example(self, ctx):
form = formal.Form()
form.addAc... | Python |
from formal import Field, Form, Group, String
from formal.examples import main
class StanStyleFormPage(main.FormExamplePage):
title = 'Stan-Style Form'
description = 'Building a Form in a stan style'
def form_example(self, ctx):
form = Form()[
Group("me")[
Fiel... | Python |
import formal
from formal.examples import main
from formal.widgets.textareawithselect import TextAreaWithSelect
class TextAreaWithSelectFormPage(main.FormExamplePage):
title = 'Text area with select'
description = 'text area with a select box to append new info'
def form_example(self, ctx):
... | Python |
import formal
from formal.examples import main
class RequiredFormPage(main.FormExamplePage):
title = 'Required Fields'
description = 'Demonstration of required fields'
def form_example(self, ctx):
form = formal.Form()
form.addField('name', formal.String(required=True))
form.addFie... | Python |
from zope.interface import Interface
class IType(Interface):
def validate(self, value):
pass
class IStructure(Interface):
pass
class IWidget(Interface):
def render(self, ctx, key, args, errors):
pass
def renderImmutable(self, ctx, key, args, errors):
pass
def process... | Python |
"""A package (for Nevow) for defining the schema, validation and rendering of
HTML forms.
"""
version_info = (0, 12, 0)
version = '.'.join([str(i) for i in version_info])
from nevow import static
from formal.types import *
from formal.validation import *
from formal.widget import *
from formal.widgets.restwidget im... | Python |
from twisted.application import internet, service
from nevow import appserver
from formal.examples import main
application = service.Application('examples')
service = internet.TCPServer(8000, main.makeSite())
service.setServiceParent(application)
| Python |
from setuptools import setup, find_packages
setup(
name='formal',
version='0.16.0',
description='HTML forms framework for Nevow',
author='Matt Goodall',
author_email='matt@pollenation.net',
packages=find_packages(),
include_package_data=True,
zip_safe = True,
)
| Python |
# sample Python program to set IPTC data in a JPEG file.
# This puts IPTC data in a format suitable for Flickr to get metadata
# about the photo; it is probably wrong for other uses.
import sys
from optparse import OptionParser
import iptcdata
def check_for_dataset(f, rs):
for ds in f.datasets:
if (ds.r... | Python |
import gdata.photos.service
import gdata.media
import gdata.geo
import urllib
username = "tbfoote@gmail.com"
gd_client = gdata.photos.service.PhotosService()
gd_client.email = username
gd_client.password = 'none'
gd_client.source = 'tullys-exampleApp-1'
gd_client.ProgrammaticLogin()
#album = gd_client.InsertAlbum(... | Python |
#!/usr/bin/env python
#small example program to print out IPTC data from a file
import sys
import iptcdata
try:
f = iptcdata.open(sys.argv[1])
except IndexError:
print "show_iptc.py filename"
if (len(f.datasets) == 0):
print "No IPTC data!"
sys.exit(0)
for ds in f.datasets:
print "Tag: %d\nRec... | Python |
#!/usr/bin/env python
import gdata.photos.service
import gdata.media
#import gdata.geo
import sys, os
from optparse import OptionParser
import yaml
import urllib
import iptcdata
import getpass
def check_for_dataset(f, rs):
for ds in f.datasets:
if (ds.record, ds.tag) == rs:
return ds
re... | Python |
#!/usr/bin/env python
import subprocess
import os
from optparse import OptionParser
def run(cmd_str):
cmd = cmd_str.split()
print "Running cmd: %s"%cmd
subprocess.check_call(cmd)
parser = OptionParser()
parser.add_option("-o", "--outdir", dest="outdir",
help="write files to outdir",... | Python |
# Used successfully in Python2.5 with matplotlib 0.91.2 and PyQt4 (and Qt 4.3.3)
from distutils.core import setup
import py2exe
# We need to import the glob module to search for all files.
import glob
# We need to exclude matplotlib backends not being used by this executable. You may find
# that you need different e... | Python |
import UserModel
import LinRel
import os
'''
-----------------------------------------------------------------------------------------
Class to test the performance of LinRel algorithm
For using, determine:
File = 'features_lewis'
numberofImages = 1000
setsize = 10
expnumber = 100
Writes statistics to /Statistics/fil... | Python |
import numpy
import os
from scipy import spatial
import math
'''#########################################################'''
'''################## Initialisation ##################'''
'''#########################################################'''
# Number of model vectors
grid_nodes_num = 3
grid_dimentionality =... | Python |
from ete2 import Tree
import UserModel
import MCTS
import os
class Experiment(object):
MAXDISTANCE = 0.01
MAXITERATIONS = 100
def __init__(self, filename, number_of_images, setsize=10):
self.setsize = setsize
self.number_of_images = number_of_images
self.user = UserModel.UserModel... | Python |
import numpy
import os
from ete2 import Tree
'''filename = os.path.dirname(__file__) + '-files/' + 'test'
mu, sigma = 1.5, 1
s11 = numpy.random.normal(mu, sigma, 100)
mu, sigma = 3.5, 0.8
s12 = numpy.random.normal(mu, sigma, 100)
mu, sigma = 4.5, 1.2
s13 = numpy.random.normal(mu, sigma, 100)
mu, sigma = 7.5, 1
s14 = nu... | Python |
from ete2 import Tree
import numpy
import math
import linecache
import os
from scipy.io.numpyio import fwrite
'''
-----------------------------------------------------------------------------------------------------------------
class PathProximity helps to calculate distances between pathes in the tree
INPUT: tree in ... | Python |
import random
import linecache
import numpy
import os
'''
----------------------------------------------------------------------------------------------------------
User model used in all sets of experiments
Uses distances (always Euclidean) from /ProximityMatrix/ + filename + number_of_images + '_Euclidean.dist'
The... | Python |
import numpy
import linecache
import os
import random
'''
LinRel algorithm
Uses distance matrix from '/ProximityMatrix/features_lewis1000_Euclidean.dist'
The algorithm is called in ExperimentLinRel
'''
class LinRel(object):
MU = 0.5
C = 0.4
E = 0.001
def __init__(self, filename, N):
sel... | Python |
import linecache
import math
import numpy
from scipy import spatial
import os
'''
---------------------------------------------------------------------------------
Class to calculate distances for instances in lines of file self.input
Writes the result in ProximityMatrix folder, filename depends on type of distance
po... | Python |
'''
---------------------------------------------------------------------------------------------------
Name takes origine from Monte Carlo Tree Search
From Monte Carlo Tree Search takes only idea of navigating through the tree when looking for target
Includes a number of classes for different search strategies:
RANDOM... | Python |
'''
-----------------------------
This file contains 3 classes:
AgglomerativeClustering,
DivisiveHierarchicalKMeans,
KMeansClustering
-----------------------------
'''
import numpy
import linecache
from ete2 import Tree
import random
import math
import os
'''
----------------------------------------------------------... | Python |
#############
#
# Author: Harry Eakins
# Date: 9th April 2009
# Description: Function generates random strings
#
#############
from random import choice
import string
def randStringGen(length=15):
letters = string.ascii_letters + string.digits
randString = ''
for i in range(length):
randString += c... | Python |
from anki.hooks import addHook
from anki.db import *
from anki.models import Model, CardModel, FieldModel
import anki.stdmodels
# Create a defualt model called "English" for use with the English Helper plugin
def EnglishModel():
m = Model(_("English"))
tempFieldModel = FieldModel(u'English Word', False, False... | Python |
import urllib, re
# Returns a pronunciation wav file from Merriam-Webster.com
# If no audio found, returns None
def getAudio(word):
try:
# Download the dictionary webpage
webpage = urllib.urlopen("http://www.merriam-webster.com/dictionary/" + word)
# webpage = open(word + ".html")
... | Python |
# -*- coding: utf-8 -*-
"""
Copyright 2008 Serge Matveenko
This file is part of PyStarDict.
PyStarDict 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 of the License, or
(at your option) any lat... | Python |
# English Helper for Chinese
# v0.08 - 11th April 2010
# Harry Eakins - harry.eakins at googlemail dot com
#
# This plugin adds an English model and auto-generates English and Chinese definitions for the inputted word.
import sys, os, re
from ankiqt import mw
ankidir = mw.config.configPath
plugdir = os.path.join(an... | Python |
# -*- coding: utf-8 -*-
#
# FormAlchemy documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 4 22:53:00 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pic... | Python |
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... | Python |
"""Routes configuration
The more specific and detailed routes should be defined first so they
may take precedent over the more generic routes. For more information
refer to the routes manual at http://routes.groovie.org/docs/
"""
from routes import Mapper
def make_map(config):
"""Create, configure and return the ... | Python |
"""Pylons middleware initialization"""
from beaker.middleware import SessionMiddleware
from paste.cascade import Cascade
from paste.registry import RegistryManager
from paste.urlparser import StaticURLParser
from paste.deploy.converters import asbool
from pylons.middleware import ErrorHandler, StatusCodeRedirect
from p... | Python |
"""Pylons environment configuration"""
import os
from mako.lookup import TemplateLookup
from pylons.configuration import PylonsConfig
from pylons.error import handle_mako_error
from sqlalchemy import engine_from_config
import pylonsapp.lib.app_globals as app_globals
import pylonsapp.lib.helpers
from pylonsapp.config.... | Python |
"""Pylons application test package
This package assumes the Pylons environment is already loaded, such as
when this script is imported from the `nosetests --with-pylons=test.ini`
command.
This module initializes the application via ``websetup`` (`paster
setup-app`) and provides the base testing objects.
"""
from unit... | Python |
import logging
from pylons import request, response, session, url, tmpl_context as c
from pylons.controllers.util import abort, redirect
from pylonsapp.lib.base import BaseController, render
from pylonsapp.model import meta
from pylonsapp import model
from pylonsapp.forms.fsblob import Files
log = logging.getLogger(__... | Python |
import cgi
from paste.urlparser import PkgResourcesParser
from pylons.middleware import error_document_template
from webhelpers.html.builder import literal
from pylonsapp.lib.base import BaseController
class ErrorController(BaseController):
"""Generates error documents as and when they are required.
The Err... | Python |
import logging
from pylons import request, response, session, url, tmpl_context as c
from pylons.controllers.util import abort, redirect
from pylonsapp.lib.base import BaseController, render
from pylonsapp.model import meta
from pylonsapp import model
from pylonsapp.forms import FieldSet
log = logging.getLogger(__name... | Python |
import logging
from pylons import request, response, session, url, tmpl_context as c
from pylons.controllers.util import abort, redirect
from pylonsapp.lib.base import BaseController, render
from pylonsapp import model
from pylonsapp.model import meta
from formalchemy.ext.pylons.controller import RESTController
log... | Python |
import logging
from formalchemy.ext.pylons.controller import ModelsController
from webhelpers.paginate import Page
from pylonsapp.lib.base import BaseController, render
from pylonsapp import model
from pylonsapp import forms
from pylonsapp.model import meta
log = logging.getLogger(__name__)
class AdminControllerBase(... | Python |
__doc__ = """This is an example on ow to setup a CRUD UI with couchdb as
backend"""
import os
import logging
import pylonsapp
from couchdbkit import *
from webhelpers.paginate import Page
from pylonsapp.lib.base import BaseController, render
from couchdbkit.loaders import FileSystemDocsLoader
from formalchemy.ext impor... | Python |
"""Setup the pylonsapp application"""
import logging
import pylons.test
from pylonsapp.config.environment import load_environment
from pylonsapp.model.meta import Session, metadata
log = logging.getLogger(__name__)
def setup_app(command, conf, vars):
"""Place any commands to setup pylonsapp here"""
# Don't ... | Python |
# -*- coding: utf-8 -*-
from pylons import config
from pylonsapp import model
from pylonsapp.forms import FieldSet
from formalchemy.ext.fsblob import FileFieldRenderer
# get the storage path from configuration
FileFieldRenderer.storage_path = config['app_conf']['storage_path']
Files = FieldSet(model.Files)
Files.conf... | Python |
from pylons import config
from pylonsapp import model
from pylonsapp.lib.base import render
from formalchemy import config as fa_config
from formalchemy import templates
from formalchemy import validators
from formalchemy import fields
from formalchemy import forms
from formalchemy import tables
from formalchemy.ext.fs... | Python |
"""The application's Globals object"""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
class Globals(object):
"""Globals acts as a container for objects available throughout the
life of the application
"""
def __init__(self, config):
"""One instance o... | Python |
"""Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
# Import helpers as desired, or define your own, ie:
#from webhelpers.html.tags import checkbox, password
| Python |
"""The base Controller API
Provides the BaseController class for subclassing.
"""
from pylons.controllers import WSGIController
from pylons.templating import render_mako as render
from pylonsapp.model.meta import Session
class BaseController(WSGIController):
def __call__(self, environ, start_response):
... | Python |
"""SQLAlchemy Metadata and Session object"""
from sqlalchemy import MetaData
from sqlalchemy.orm import scoped_session, sessionmaker
__all__ = ['Session', 'metadata']
# SQLAlchemy session manager. Updated by model.init_model()
Session = scoped_session(sessionmaker())
# Global metadata. If you have multiple databases... | Python |
"""The application's model objects"""
import sqlalchemy as sa
from sqlalchemy import orm
from pylonsapp.model.meta import Session, metadata
def init_model(engine):
"""Call me before using any of the tables or classes in the model"""
Session.configure(bind=engine)
foo_table = sa.Table("Foo", meta.metadata,
... | Python |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='pylonsapp',
version='0.1',
description='',
author='',
author_email='',
url='',
install_requires=... | Python |
#!bin/python
import webob
import formalchemy
import sqlalchemy as sa
from sqlalchemy.orm import relation, backref
from sqlalchemy.ext.declarative import declarative_base
from repoze.profile.profiler import AccumulatingProfileMiddleware
def make_middleware(app):
return AccumulatingProfileMiddleware(
app,
... | Python |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import xml.sax.saxutils
from os.path import join
import sys
import os
try:
from msgfmt import Msgfmt
except:
sys.path.insert(0, join(os.getcwd(), 'formalchemy'))
from msgfmt import Msgfmt
def compile_po(path):
for language in os.listd... | Python |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | Python |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import warnings
import logging
logger = logging.getLogger('formalchemy.' + __name__)
import base, fields... | Python |
# -*- coding: utf-8 -*-
import os
import sys
from formalchemy.i18n import get_translator
from formalchemy import helpers
from tempita import Template as TempitaTemplate
try:
from mako.lookup import TemplateLookup
from mako.template import Template as MakoTemplate
from mako.exceptions import TopLevelLookup... | Python |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import os
import cgi
import logging
logger = logging.getLogger('formalchemy.' + __name__)
from copy impo... | Python |
# -*- coding: utf-8 -*-
#used to simulate the library module used in doctests
| Python |
# -*- coding: utf-8 -*-
import os
import glob
import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
from BeautifulSoup import BeautifulSoup # required for html prettification
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
loggin... | Python |
# -*- coding: utf-8 -*-
import sys
from formalchemy import templates
__doc__ = """
There is two configuration settings available in a global config object.
- encoding: the global encoding used by FormAlchemy to deal with unicode. Default: utf-8
- engine: A valide :class:`~formalchemy.templates.TemplateEngine`
- dat... | Python |
# -*- coding: utf-8 -*-
import os
import stat
import string
import random
import formalchemy.helpers as h
from formalchemy.fields import FileFieldRenderer as Base
from formalchemy.validators import regex
from formalchemy.i18n import _
try:
from pylons import config
except ImportError:
config = {}
__all__ = ['... | Python |
# -*- coding: utf-8 -*-
__doc__ = """This module provides an experimental subclass of
:class:`~formalchemy.forms.FieldSet` to support RDFAlchemy_.
.. _RDFAlchemy: http://www.openvest.com/trac/wiki/RDFAlchemy
Usage
=====
>>> from rdfalchemy.samples.company import Company
>>> c = Company(stockDescription='desc... | Python |
# -*- coding: utf-8 -*-
try:
from tempita import paste_script_template_renderer
from paste.script.templates import Template, var
except ImportError:
class PylonsTemplate(object):
pass
else:
class PylonsTemplate(Template):
_template_dir = ('formalchemy', 'paster_templates/pylons_fa')
... | Python |
# standard pylons controller imports
import os
import logging
log = logging.getLogger(__name__)
from pylons import request, response, session, config
from pylons import tmpl_context as c
from pylons import url
from pylons.controllers.util import redirect
import pylons.controllers.util as h
from webhelpers.paginate im... | Python |
# -*- coding: utf-8 -*-
import pylons
import logging
log = logging.getLogger(__name__)
try:
version = pylons.__version__.split('.')
except AttributeError:
version = ['0', '6']
def format(environ, result):
if environ.get('HTTP_ACCEPT', '') == 'application/json':
result['format'] = 'json'
re... | Python |
# -*- coding: utf-8 -*-
| Python |
# -*- coding: utf-8 -*-
import os
from paste.urlparser import StaticURLParser
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect
from pylons.templating import render_mako as render
from pylons import url
from webhelpers.paginate import Page
from sqlalche... | Python |
# -*- coding: utf-8 -*-
import os
from paste.urlparser import StaticURLParser
from webhelpers.paginate import Page
from sqlalchemy.orm import class_mapper, object_session
from formalchemy.fields import _pk
from formalchemy.fields import _stringify
from formalchemy import Grid, FieldSet
from formalchemy.i18n import get_... | Python |
registry = dict(version=0)
| Python |
# -*- coding: utf-8 -*-
| Python |
# -*- coding: utf-8 -*-
| Python |
# -*- coding: utf-8 -*-
__doc__ = """This module provides an experimental subclass of
:class:`~formalchemy.forms.FieldSet` to support zope.schema_'s schema. `Simple
validation`_ is supported. `Invariant`_ is not supported.
.. _zope.schema: http://pypi.python.org/pypi/zope.schema
.. _simple validation: http://pypi.pyt... | Python |
# -*- coding: utf-8 -*-
__doc__ = """
Define a couchdbkit schema::
>>> from couchdbkit import schema
>>> from formalchemy.ext import couchdb
>>> class Person(couchdb.Document):
... name = schema.StringProperty(required=True)
... @classmethod
... def _render_options(self, fs):
.... | Python |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
# todo 2.0 pass field and value (so exception can refer to field name, for instance)
from exceptions impo... | Python |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Written by Martin v. Loewis <loewis@informatik.hu-berlin.de>
#
# Changed by Christian 'Tiran' Heimes <tiran@cheimes.de> for the placeless
# translation service (PTS) of zope
#
# Slightly updated by Hanno Schlichting <plone@hannosch.info>
#
# Included by Ingeniweb fr... | Python |
"""
A small module to wrap WebHelpers in FormAlchemy.
"""
from webhelpers.html.tags import text
from webhelpers.html.tags import hidden
from webhelpers.html.tags import password
from webhelpers.html.tags import textarea
from webhelpers.html.tags import checkbox
from webhelpers.html.tags import radio
from webhelpers.htm... | Python |
# -*- coding: utf-8 -*-
class PkError(Exception):
"""An exception raised when a primary key conflict occur"""
class ValidationError(Exception):
"""an exception raised when the validation failed
"""
@property
def message(self):
return self.args[0]
def __repr__(self):
return 'Val... | Python |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import cgi
import warnings
import logging
logger = logging.getLogger('formalchemy.' + __name__)
MIN_SA_V... | Python |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from formalchemy import templates
from formalchemy import config
from formalchemy.base import SimpleMulti... | Python |
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from sqlalchemy.types import TypeEngine, Integer, Float, String, Unicode, Text, Boolean, Date, DateTime, Time, Numeric, Interval
try:
from sqlalchemy.types import LargeBinary
except Imp... | Python |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import os
from gettext import GNUTranslations
i18n_path = os.path.join(os.path.dirname(__file__), 'i18n_... | 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.