code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
"""Module to implement the RadixSortManagers for CPU and GPU"""
# OpenCL conditional imports
import pysph.solver.cl_utils as clu
if clu.HAS_CL:
import pyopencl as cl
mf = cl.mem_flags
import numpy
from scanClass import Scan
class AMDRadixSort:
"""AMD's OPenCL implementation of the radix sort.
The C... | Python |
import numpy
from pysph.solver.cl_utils import cl_read, get_real, HAS_CL, get_pysph_root,\
create_some_context, enqueue_copy
import pysph.solver.cl_utils as clu
if HAS_CL:
import pyopencl as cl
mf = cl.mem_flags
# Cython functions for neighbor list construction
from nnps_util import cbin, unflatten
fro... | Python |
# OpenCL conditional imports
import pysph.solver.cl_utils as clu
if clu.HAS_CL:
import pyopencl as cl
mf = cl.mem_flags
import numpy as np
class Scan(object):
def __init__(self, GPUContext,
CommandQueue,
numElements):
# Constants
MAX_WORKGROUP_INCLUSIVE... | Python |
#! python
'''
Module to collect and generate source files from template files
The template files have very similar syntax to php files.
* All text in input is copied straight to output except that within
`<?py` and `?>` tags.
* Text within `<?py=` and `?>` tags is evaluated and the result is written
into the out... | Python |
import nnps_util as util
import pysph.solver.cl_utils as clu
import numpy
# PySPH imports
from carray import LongArray
#CHANGE
class OpenCLNeighborLocatorType:
AllPairNeighborLocator = 0
LinkedListSPHNeighborLocator = 1
RadixSortNeighborLocator = 2
class OpenCLNeighborLocator(object):
pass
class Lin... | Python |
# standard imports
import numpy
# local imports
from pysph.base.particle_array import *
def generate_sample_dataset_1():
"""
Generate test test data.
Look at image test_cell_case1.png for details.
"""
x = numpy.array([0.25, 0.8, 0.5, 0.8, 0.2, 0.5, 1.5, 1.5])
y = numpy.array([0.25, 0.1, 0.5,... | Python |
"""
Tests for the particle array module.
"""
# standard imports
import unittest
import numpy
# local imports
import pysph
from pysph.base import particle_array
from pysph.base.carray import LongArray, IntArray, DoubleArray
from pysph.base import carray
import pickle
def check_array(x, y):
"""Check if two arrays... | Python |
class ParticleType:
"""
An empty class to provide an enum for the different particle types
used in PySPH.
The types defined are:
Fluid -- The default particle type used to represent fluids.
Solid -- Use this to represent solids
DummyFluid --
Probe --
Boundary -- Boundary partic... | Python |
"""
Extension to the dictionary class to access keys as attributes.
"""
class AttrDict(dict):
"""
Extension to the dictionary class to access keys as attributes.
If a key that is not present is accessed as an attribute, an AttributeError
is raised. To add a new key access the dictionary is the normal ... | Python |
from cell import CellManager
from nnps import NNPSManager, NeighborLocatorType
from particle_array import ParticleArray
from particle_types import ParticleType
from domain_manager import DomainManagerType as CLDomain
from locator import OpenCLNeighborLocatorType as CLLocator
import locator
import domain_manager
from... | Python |
"""API module to simplify import of common names from pysph.base package"""
# fast utils
from fast_utils import arange_long
# carray
from carray import LongArray, DoubleArray, IntArray, FloatArray
from cell import Cell, CellManager, PeriodicDomain
from kernels import KernelBase, DummyKernel, CubicSplineKernel, \
... | Python |
''' Implement infrastructure for the solver to add various interfaces '''
from functools import wraps, partial
import threading, thread
from pysph.base.particle_array import ParticleArray
import logging
logger = logging.getLogger()
class DummyComm(object):
''' A dummy MPI.Comm implementation as placeholder for f... | Python |
"""
Module contains some common functions.
"""
# standard imports
import pickle
import numpy
import sys
import os
import platform
import commands
from numpy.lib import format
HAS_PBAR = True
try:
import progressbar
except ImportError:
HAS_PBAR = False
import pysph
def check_array(x, y):
"""Check if two ... | Python |
""" An example solver for the circular patch of fluid """
import numpy
from optparse import OptionGroup, Option
import pysph.base.api as base
import pysph.sph.api as sph
from pysph.sph.funcs import stress_funcs
from pysph.sph.funcs import eos_funcs
from pysph.sph.funcs import viscosity_funcs
from solver import Sol... | Python |
from pysph.sph.sph_calc import SPHCalc
from pysph.sph.funcs.arithmetic_funcs import PropertyGet
import numpy
import logging
logger = logging.getLogger()
#############################################################################
#`Integrator` class
###################################################################... | Python |
import numpy
class TimeStep(object):
def compute_time_step(self, solver):
return solver.dt
class ViscousTimeStep(TimeStep):
def __init__(self, cfl, co, particles):
self.cfl = cfl
self.co = co
self.particles = particles
def compute_time_step(self, solver):
cfl =... | Python |
""" SImple plotting for the data """
from utils import get_pickled_data
import numpy
import pysph.base.api as base
#import visvis as vv
class ParticleInformation(object):
def __init__(self, fname, nprocs, array_name, time,
load_neighbors=True, load_cells=True):
self.fname = fname
... | Python |
from integrator import Integrator
from cl_utils import HAS_CL, get_pysph_root, get_cl_include,\
get_scalar_buffer, cl_read, get_real, enqueue_copy
if HAS_CL:
import pyopencl as cl
from os import path
import numpy
class CLIntegrator(Integrator):
def setup_integrator(self, context):
""" Setup the... | Python |
""" Post step functions for the solver """
import pickle
import os
import pysph.base.api as base
from pysph.base.cell import py_find_cell_id
class SaveCellManagerData(object):
"""Post-step function to save the cell manager's data.
Two files are created, 'neighbors' contains partile neighbor
information ... | Python |
# Standard imports.
import logging, os
from optparse import OptionParser, OptionGroup, Option
from os.path import basename, splitext, abspath
import sys
from utils import mkdir
# PySPH imports.
from pysph.base.particles import Particles, CLParticles, ParticleArray
from pysph.solver.controller import CommandManager
fr... | Python |
""" A simple shock tube solver """
from optparse import OptionGroup, Option
import numpy
import pysph.base.api as base
import pysph.sph.api as sph
from solver import Solver
from sph_equation import SPHOperation, SPHIntegration
from integrator import GSPHIntegrator
Fluids = base.Fluid
Solids = base.Solid
Boundary = ... | Python |
""" An implementation of a general solver base class """
# PySPH imports
from pysph.base.particle_types import ParticleType
from pysph.base.carray import LongArray
from pysph.base.kernels import CubicSplineKernel
from pysph.base.particle_array import get_particle_array
from pysph.sph.kernel_correction import KernelCo... | Python |
"""
Classes for generators of some simple elements.
"""
# standard imports
import logging
logger = logging.getLogger()
import numpy
# local imports
from pysph.base.carray import DoubleArray, LongArray
from pysph.base.nnps import *
from pysph.base.point import Point
from pysph.solver.particle_generator import *
from ... | Python |
import threading
import os
import socket
from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
from SimpleHTTPServer import SimpleHTTPRequestHandler
from multiprocessing.managers import BaseManager, BaseProxy
class MultiprocessingInterface(BaseManager):
""" A multiprocessing interface to... | Python |
""" A wrapper around the sph calc and function to make it simpler """
from pysph.sph.sph_calc import SPHCalc, CLCalc
from pysph.sph.sph_func import SPHFunctionParticle
from pysph.base.particle_types import ParticleType
Fluid = ParticleType.Fluid
Solid = ParticleType.Solid
class SPHOperation(object):
""" This cla... | Python |
HAS_CL = True
try:
import pyopencl as cl
except ImportError:
HAS_CL=False
from os import path
import numpy
from utils import get_pysph_root
# Return all available devices on the host
def get_cl_devices():
""" Return a dictionary keyed on device type for all devices """
_devices = {'CPU':[], 'GPU':[]... | Python |
from numpy import arccos, sin, cos, array, sqrt, pi
r = 2.0/pi
dt = 1e-3
def force(x,y):
theta = arccos(x/sqrt((x**2+y**2)))
return array([-sin(theta), cos(theta)])
def rk2(nsteps=1000, x0=r, y0=0):
t = 0
xinitial = x0
yinitial = y0
while t < nsteps:
_x = xinitial
_y = yiniti... | Python |
""" An example solver for the circular patch of fluid """
import numpy
import pysph.base.api as base
import pysph.sph.api as sph
from solver import Solver
from sph_equation import SPHOperation, SPHIntegration
Fluids = base.ParticleType.Fluid
Solids = base.ParticleType.Solid
def get_circular_patch(name="", type=0... | Python |
from integrator import EulerIntegrator, RK2Integrator, RK4Integrator,\
PredictorCorrectorIntegrator, LeapFrogIntegrator
from cl_integrator import CLEulerIntegrator
from sph_equation import SPHIntegration, SPHOperation
from solver import Solver
from shock_tube_solver import ShockTubeSolver, ADKEShockTubeSolver,\... | Python |
#! /usr/bin/env python
# Author: Stefan Behnel <scoder@users.berlios.de>
# http://hg.cython.org/cython-devel/file/tip/Tools/cython-epydoc.py
#
# --------------------------------------------------------------------
import re
from epydoc import docstringparser as dsp
CYTHON_SIGNATURE_RE = re.compile(
# Class name ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
| Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# 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 requir... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
"""ISO 8601 date time string parsing
Basic usage:
>>> import iso8601
>>> iso8601.parse_date("2007-01-25T12:00:00Z")
datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.iso8601.Utc ...>)
>>>
"""
from datetime import datetime, timedelta, tzinfo
import re
__all__ = ["parse_date", "ParseError"]
... | Python |
#!/usr/bin/env python
| Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#!/usr/bin/env python
#
# Copyright 2011 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 ... | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys,os
import re
import ConfigParser
import memcache
import urlparse
import smtplib
from email.mime.text import MIMEText
import urlparse
from BaseHTTPServer import HTTPServer,BaseHTTPRequestHandler
class RequestHandler(BaseHTTPRequestHandler):
... | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys,os
import re
import ConfigParser
import memcache
import urlparse
import smtplib
from email.mime.text import MIMEText
import urlparse
from BaseHTTPServer import HTTPServer,BaseHTTPRequestHandler
class RequestHandler(BaseHTTPRequestHandler):
... | Python |
import sys, string, re, Queue
arith = ['sub', 'div', 'mod', 'cmple', 'add', 'mul', 'cmpeq', 'cmplt']
operators = ['-', '/', '%', '<=', '+', '*', '==', '<']
arith1 = ['neg']
local_size = 0;
# get operand
def getOperand(t, sline, access_local):
#GP
if sline[t] == 'GP':
print '(char*)global',
return t+1
#FP... | Python |
import logging
from web.webbase import *
from classes import classes
from imports.n3tagvalue import svalue
def gettag(t):
return t if t[0].isalpha() else t[1:]
def getprop(t):
t=gettag(t)
ns = 'ofx' if t.isupper() else 'a3'
return ns+':'+t
def getclass(items,typ,acctids,dtstart,dtend,uniqueids,fltrex... | Python |
import os
from rdflib import Namespace, BNode, Literal, RDF, URIRef
from semprog.pysesame import connection
import cherrypy
from mako.lookup import TemplateLookup
import urllib
from simplejson import dumps
from classes import classes
user_cfg = os.path.expanduser("~/cherrypy.cfg")
if os.path.exists(user_cfg):
cher... | Python |
from web.webbase import *
from get import getclass,getpositions,getassets
def accounts():
items={}
getclass(items,'account',None,None,None,None)
return items.values()
def accounttotals(acctids,dtstart,dtend):
# collect information on positions
positions={}
getpositions(positions,acctids,dtstar... | Python |
from get import *
def asset(uniqueids):
items={}
getpositions(items,None,None,None,uniqueids)
gettransactions(items,None,None,None,uniqueids)
getassets(items,uniqueids)
return items.values() | Python |
"""A dictonary of all the classes of objects that can be found in flat lines.
the keys are the class types (names). The values describe each class:
* The key list describes all the tags that must appear in a flat line
in order for an object of the class to be said to be in the line.
The object is uniquely identi... | Python |
from get import *
def transactions(acctids,dtstart,dtend):
items={}
gettransactions(items,acctids,dtstart,dtend)
# add information on assets
uniqueids=set(o['UNIQUEID'][0]
for o in items.itervalues()
if 'UNIQUEID' in o) # get all uniqueids in use
getassets(items,... | Python |
from get import *
def positions(acctids,dtstart,dtend):
items={}
getpositions(items,acctids,dtstart,dtend)
# add information on assets
uniqueids=set(o['UNIQUEID'][0] for o in items.itervalues()) # get all uniqueids in use
getassets(items,uniqueids)
return items.values()
def positionspe... | Python |
from get import *
def checking(acctids,dtstart,dtend):
items={}
getchecking(items,acctids,dtstart,dtend)
return items.values()
| Python |
__version__ = "$Id$"
import os
import threading
import random
import urllib2
import cherrypy
from mako.template import Template
from mako.lookup import TemplateLookup
from urllib import quote_plus
from web.webbase import *
from web.position import positions,positionspercents
from web.asset import asset
from web.account... | Python |
# Load files into local sesame server
# run "load3account.py -h" for more info
__version__ = "$Id$"
import os
import sys
import logging
import StringIO
import ConfigParser
from optparse import OptionParser
from httplib import BadStatusLine
import rdflib
from rdflib import plugin
plugin.register(
'sparql', rdflib.... | Python |
########################################################################
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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... | Python |
# Load an RDF file into local sesame server
#import os
#import sys
#from optparse import OptionParser
#from httplib import BadStatusLine
from rdflib.graph import ConjunctiveGraph
from semprog import pysesame
__version__ = "$Id$"
def loadGraph2Server(g,url,fname=None):
data = g.serialize(format='xml')
c = pyses... | Python |
########################################################################
# Copyright (C) 2009 Ehud Ben-Reuven
# udi@benreuven.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.
#
... | Python |
########################################################################
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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... | Python |
########################################################################
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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... | Python |
########################################################################
# 3account - personal finance data-base
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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 ... | Python |
########################################################################
# 3account - personal finance data-base
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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 ... | Python |
########################################################################
# 3account - personal finance data-base
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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 ... | Python |
########################################################################
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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... | Python |
########################################################################
# Pyfm - personal finance data-base
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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 t... | Python |
"""ofx2n3.py -- interpret OFX format as RDF
Converts OFX format (as in downloaded back statements etc
The conversion is only syntactic. The OFX modelling is
pretty weel thought out, so taking it as defining an effecive
RDF ontolofy seems to make sense. Rules can then be used to
define mapping into your favor... | Python |
########################################################################
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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... | Python |
########################################################################
# xls2csv2 - convert excel to csv and handle encoding
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
#... | Python |
"""Init.py
I'm not actually sure what this does.
"""
__version__ = "$Revision: 1.1 $"
__all__ = [ "string"
]
| Python |
import hashlib
import logging
import re
import ConfigParser
# List of tags which we want their value to be hashed if "hashing" is True
hash_list = ["ACCTID", "INTU_USERID","owner"];
# List of tags that may contain a sub-string that needs to be hashed
# usually transfers write the account to which the transfer is... | Python |
########################################################################
# Copyright (C) 2007,8,9 Ehud Ben-Reuven
# udi@benreuven.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... | Python |
########################################################################
# Copyright (C) 2009 Ehud Ben-Reuven
# udi@benreuven.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.
#
... | Python |
########################################################################
# scanner - scanf with multiple line template and regex
# Copyright (C) 2007,8 Ehud Ben-Reuven
# udi@benreuven.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
#... | Python |
from rdflib import Namespace, URIRef, Literal, BNode
from rdflib.graph import Graph
from urllib import quote_plus
from httplib import HTTPConnection
from cStringIO import StringIO
import xml.dom
from simplejson import loads
owlNS = Namespace("http://www.w3.org/2002/07/owl#")
owlClass = owlNS["Class"]
owlObjectProperty... | Python |
import urllib2
from urllib import quote_plus
from simplejson import loads
from httplib import HTTPConnection
import urlparse
class connection:
def __init__(self,url):
self.baseurl=url
self.sparql_prefix=""
self.host=urlparse.urlparse(url).netloc
def addnamespace(self,id,ns):
... | Python |
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Sep 8 2010)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
##########################################################################... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# Author: Huang Jiahua <jhuangjiahua@gmail.com>
# License: LGPLv3+
# Last modified:
'''文档格式转换
'''
import os
import subprocess
def doc2html(docfile):
'''将 mso doc 转换为 html
依赖 wv
'''
dir = os.tmpnam()
... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''WebkitLinkView
@author: U{Jiahua Huang <jhuangjiahua@gmail.com>}
@license: LGPLv3+
'''
import gobject
import gtk
import webkit
import re
def proc(html):
"""处理 html 链接
>>> proc(' <a href="#3.2.1">3.2.1 heading</a>')
'<a href="#3.2.1" onDblClick="window.loca... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''Gtk 对话框
@author: U{Jiahua Huang <jhuangjiahua@gmail.com>}
@license: LGPLv3+
'''
import os
import gtk
import gobject
__all__ = ['error', 'info', 'inputbox', 'messagedialog', 'open', 'save', 'warning',
'yesno']
try: import i18n
except: from gettext import gettext a... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''Gtk LaTex
@author: U{Jiahua Huang <jhuangjiahua@gmail.com>}
@license: LGPLv3+
'''
import gtk, gobject
import thread
import time
import subprocess
import os, sys
import base64
try: import gtksourceview2
except: gtksourceview2 = None
try: import i18n
except: from gettext i... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''GWrite
@author: U{Jiahua Huang <jhuangjiahua@gmail.com>}
@license: LGPLv3+
'''
__version__ = '0.5.1'
import gtk, gobject
import gtkdialogs
import gtklatex
import config
import os, sys
import thread
import re
import urllib2
try: import i18n
except: from gettext import get... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# Author: Huang Jiahua <jhuangjiahua@gmail.com>
# License: LGPLv3+
# Last modified:
app = 'gwrite'
import os, sys
import gettext
if os.path.isdir(os.path.dirname(sys.argv[0]) + '/../build/mo'):
gettext.install(app,... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''config
@author: U{Jiahua Huang <jhuangjiahua@gmail.com>}
@license: LGPLv3+
'''
import gtk, gobject
import os, sys
try: import cPickle as pickle
except: import pickle
try: import i18n
except: from gettext import gettext as _
single_instance_mode = 0
mdi_mode = 1
def getc... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# Author: Huang Jiahua <jhuangjiahua@gmail.com>
# License: LGPLv3+
# Last modified:
__version__ = '0.5.1'
import gtk, gobject
import webkit
import jswebkit
import gtklatex
import urllib2
import os, errno
import re
impor... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# Author: Huang Jiahua <jhuangjiahua@gmail.com>
# License: GNU LGPL
# Last modified:
"""
"""
__revision__ = '0.1'
if __name__=="__main__":
import gwrite.gwrite
gwrite.gwrite.main()
| Python |
#!/usr/bin/python
from distutils.core import setup
from DistUtilsExtra.command import *
from glob import glob
setup(name='gwrite',
version='0.5.1',
description='HTML5 Doc Writer based on GTK2',
long_description ="""GWrite is a simple HTML5 Doc Writer base on Gtk2.
Features include:
1. HTML Form... | Python |
sfrom sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import backref, mapper, relation, sessionmaker
# Database module
from wrapper import Wrapper
Base = declarative_base()
class Wrapper(object):
... | Python |
#! /usr/bin/env python
class Wrapper(object):
_ignore_read = []
_ignore_write = []
def __init__(self, obj):
self.__dict__['_obj'] = obj
def __getattr__(self, key):
if key in self.__dict__:
return self.__dict[key]
elif key not in self._ignore_read:
retur... | Python |
from sqlalchemy import *
from sqlalchemy.orm import *
hostname = "127.0.0.1"
username = "userpython"
password = "python"
dbname = "test"
db = create_engine("mysql://%s:%s@%s/%s" %(username, password, hostname, dbname))
db.echo = True
metadata = MetaData(db)
users = Table('users', metadata,
Column('user_id', I... | Python |
import dbtest
dbtype = "mysql"
hostname = "db4free.net"
username = "userpython"
password = "python"
port = "3306"
dbname = "groupsixdatabase"
success = dbtest.init(dbtype, username, password, hostname, port, dbname)
john = dbtest.User('John', 42, 'pass')
mary = dbtest.User(name='Mary', age=30, password='secret')
jac... | Python |
# Note: this executes in the global scope
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer
import sqlalchemy
engine=sqlalchemy.create_engine('mysql://localhost/test')
debug=False # set this to true and only the generated code is printed.
MYSQL_TO_ALCHEMY_TYPE = d... | 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 |
#!/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 |
# -*- coding: utf-8 -*-
'''
Copyright Cobalys.com (c) 2011
This file is part of 365Video.
365Video 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 opt... | Python |
# -*- coding: utf-8 -*-
'''
Copyright Cobalys.com (c) 2011
This file is part of 365Video.
365Video 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 opt... | Python |
# -*- coding: utf-8 -*-
'''
Copyright Cobalys.com (c) 2011
This file is part of 365Video.
365Video 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 opt... | 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.