code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/bin/env python import os import re import sys ws = re.compile(r'-') f = open("list.txt") names = f.readlines() f.close() for name in names: name = name[0:-1] newname = "" for token in ws.split(name): newname += token[0].upper() newname += token[1:] cmd = "cp %s %s" % (name,newname) p...
Python
import types as t import os, imp import inspect def scan_folder_recurse(folder, excl_names=['__']): """ Recurse search for PY files in given folder """ all_files = [] ...
Python
try: from flask import _app_ctx_stack as stack except ImportError: from flask import _request_ctx_stack as stack #@UnusedImport from flask_metaroute.func import attach_controllers import importlib class MetaRoute(object): def __init__(self, app = None, ctrl_pkg = None): if app is not Non...
Python
import inspect def enhance_ctrl_class(cls, path, args, kwargs): cls.METAROUTE_CONTROLLER_PATH = path cls.METAROUTE_CONTROLLER_ARGS = args cls.METAROUTE_CONTROLLER_KWARGS = kwargs return cls def Controller(*args, **kwargs): if not inspect.isclass(args[0]): def d(cls): return...
Python
from flask_metaroute.decorators import Controller, Error, Route from flask_metaroute.metaroute import MetaRoute __all__ = ["Controller", "Error", "Route", "MetaRoute"]
Python
""" Flask-MetaRoute ------------- Flask-MetaRoute adds some useful decorators for routing """ from setuptools import setup setup( name='Flask-MetaRoute', version='1.2', url='http://code.google.com/p/flask-metaroute/', license='BSD', author='Orca', author_email='deep.orca@gmail.com', descri...
Python
import string class Message: player_id = None action = None parameters = [] fieldSeparator = ':' address = None # actions PLAYER_JOIN = 'join' PLAYER_LEAVE = 'leave' PLAYER_MOVE = 'move' PLAYER_PLANT_BOMB = 'plant_bomb' PLAYER_STOP_BOMB = 'stop_bomb' PLAYER_PAUSE_GAME = 'pause_game' PLA...
Python
class Game: GAME_NOT_STARTED_YET = 0 GAME_STARTED = 1 players = [] server = None currentArena = None def __init__(self, server): self.server = server def addPlayer(self, player): self.players.append(player) def handleMessage(self, message): for p in self.players: print p ...
Python
import socket class Player: id = "" connection = None address = None position = (0, 0) extraBombs = 0 extraFlames = 0 def __init__(self, conn, addr): self.connection = conn self.address = addr def sendMessage(self, message): try: self.connection.send(message) except sock...
Python
#server-test.py from server import Server import unittest class SomeTest(unittest.TestCase): def someFunctionality(self): self.assertEqual(1, 1)
Python
#!/usr/bin/env python import socket HOST = 'localhost' # The remote host PORT = 50007 # The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) # Test player join #s.send("player_2:join:pos_x:pos_y"); # Test player location change ...
Python
#!/usr/bin/env python import sys from server import Server print """ ===== FlashBomber 2008 Server ===== Software written by Mikko Saarela, 2008. (Press Ctrl-Break to stop the server.) Copyright, GNU General Public Licence version 3. Server started ... """ server = Server(); server.start();
Python
#!/usr/bin/env python import socket HOST = 'localhost' # The remote host PORT = 50007 # The remote port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) # Test player join s.send("player_1:join"); # Test player location change #s.send("player_1:move:pos_x:po...
Python
import socket, sys, time from player import Player from message import Message from game import Game class Server: SERVERNAME = 'Java-teamserver' HOST = 'localhost' PORT = 50007 socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #players = [] game = None def __init__(self): self.soc...
Python
#!/usr/bin/env python import socket HOST = 'localhost' # The remote host PORT = 50007 # The remote port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) # Test player join s.send("player_1:join"); # Test player location change #s.send("player_1:move:pos_x:po...
Python
#!/usr/bin/env python import sys from server import Server print """ ===== FlashBomber 2008 Server ===== Software written by Mikko Saarela, 2008. (Press Ctrl-Break to stop the server.) Copyright, GNU General Public Licence version 3. Server started ... """ server = Server(); server.start();
Python
class Arena: players = [] map = [ [W,W,W,W,W,W,W,W,W,W,W,W,W], [W,B,B,B,B,_,_,_,_,_,_,_,W], [W,_,W,_,W,_,W,_,W,_,W,_,W], [W,_,_,_,_,_,_,_,_,_,_,_,W], [W,_,W,_,W,_,W,_,W,_,W,_,W], [W,_,_,B,B,B,B,B,_,_,_,_,W], [W,_,W,_,W,B,W,B,W,_,W,_,W], [W,_,_,B,_,B,_,B,B,B,_,_,W], [W,_,W,_,W...
Python
#!/usr/bin/env python import socket HOST = 'localhost' # The remote host PORT = 50007 # The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) # Test player join #s.send("player_2:join:pos_x:pos_y"); # Test player location change ...
Python
class Match: matchOn = False arena = None def __init__(self): pass
Python
import sys print
Python
import pygame, random # ---------------------------------------------------------------------- # Bonus Item # ---------------------------------------------------------------------- class BonusItem(pygame.sprite.Sprite): EXTRA_BOMB = 1; EXTRA_FLAME = 2; KICK = 3; TRIPLE_BOMB = 4; position = (0, 0)...
Python
import pygame class Player(pygame.sprite.Sprite): RED = 1 BLUE = 2 WHITE = 3 BLACK = 4 GREEN = 5 NORMAL_STATE = 1 MAGIC_STATE = 2 state = NORMAL_STATE playerName = "unnamedPlayer" color = 0 startPosition = (0, 0) currentPosition = (0, 0) amountOfBombs = 1 lenghtOfFlames = 2 hasKic...
Python
#!/usr/bin/env python import pygame import os, sys import gc import lounge_screen from ctypes import * from pygame.locals import * os.environ['SDL_VIDEO_CENTERED'] = '1' screen = None screenW = 800 screenH = 600 tileSize = 32 screen = None sinewave = [ 100,97,95,92,90,87,85,82,80,78,75,73,70,68...
Python
import pygame class Tile(pygame.sprite.Sprite): SOLID = 1 BREAKABLE = 2 EMPTY = 3 type = 1 # default type = SOLID item = None image = None size = 0 def __init__(self, type): self.type = type if type == self.SOLID: self.image = pygame.image.load('images/tile_desert_solid.png') eli...
Python
import sys print
Python
import sys print
Python
#!/usr/bin/env python import pygame import os, sys import gc import lounge_screen from ctypes import * from pygame.locals import * os.environ['SDL_VIDEO_CENTERED'] = '1' screen = None screenW = 800 screenH = 600 tileSize = 32 screen = None sinewave = [ 100,97,95,92,90,87,85,82,80,78,75,73,70,68...
Python
#!/usr/bin/env python import pygame import os, sys from pygame.locals import * os.environ['SDL_VIDEO_CENTERED'] = '1' screen = None screenW = 800 screenH = 600 tileSize = 32 k_up = k_down = k_left = k_right = 0 map = [ ['W','W','W','W','W','W','W','W','W','W','W','W','W'], ['W','B','B','B','B','_'...
Python
#!/usr/bin/env python import pygame import os, sys from pygame.locals import * from player import Player import inter_results_screen import final_results_screen from arena import Arena from match import Match os.environ['SDL_VIDEO_CENTERED'] = '1' screen = None screenW = 800 screenH = 600 tileSize = 32...
Python
#!/usr/bin/env python import os, sys import title_screen print("GBomber") title_screen.main()
Python
#!/usr/bin/env python import os, sys import title_screen print("GBomber") title_screen.main()
Python
#!/usr/bin/env python import pygame import os, sys from pygame.locals import * from player import Player import inter_results_screen import final_results_screen from arena import Arena from match import Match os.environ['SDL_VIDEO_CENTERED'] = '1' screen = None screenW = 800 screenH = 600 tileSize = 32...
Python
import sys print
Python
#!/usr/bin/env python import pygame import os, sys from pygame.locals import * os.environ['SDL_VIDEO_CENTERED'] = '1' screen = None screenW = 800 screenH = 600 tileSize = 32 k_up = k_down = k_left = k_right = 0 map = [ ['W','W','W','W','W','W','W','W','W','W','W','W','W'], ['W','B','B','B','B','_'...
Python
from tile import Tile class Arena: name = "The Name Of Arena" dimensions = (30, 20) players = [] amountOfExtraBombs = 15 amountOfExtraFlames = 15 amountOFKicks = 4 # # this should be just initial character map, but there needs to be also # object map. # initMap = [ ['W','W','W','W','W',...
Python
class Match: date = None matchOn = False arena = None neededVictories = 4 durationSeconds = 120 players = [] winner = None # player over = False def __init__(self): pass def addPlayer(self, player): self.players.append(player) def isOver(self): for p in self.players: if p.vict...
Python
__author__ = 'Brad'
Python
import this
Python
__author__ = 'Ian' def clinic(): """Function gives operator two options, and then prints results to screen""" print "You've just entered the clinic!" print "Do you take the door on the left or the right?" answer = raw_input("Type left or right and hit 'Enter'.").lower() if answer == "left" or ...
Python
__author__ = 'Ian' def PygLatin(): """A function used for turing any english word into its Piglatin equavelent""" print "Welcome to the English to Pig Latin Translator!" word = raw_input("Please provide a word to be translated:") pyg = "ay" newword = word.lower() firstletter= newword[0] ...
Python
__author__ = 'Ian' import translator,clinic translator.PygLatin()
Python
import sys __author__ = 'Ian' loginDict={"Ian":"Bouldin", "Brad":"Zylstra"} print ("Welcome to Inferno v1.0") while True: prompt1 = "Please Provide Your User Name: " username = raw_input(prompt1) try: passwordLogin=loginDict[username] print "Welcome %s!" % username break except: ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- #pylint: disable=C0103 "Fake answers for testing Control the monochromator CM-110" print "%c" % chr(27) #CM.echo() print "%c" % chr(27) #CM.echo() print "%c" % chr(27) #CM.echo() print "%c\n%c" % (chr(1), chr(24)) #CM.select(1) print "%c\n%c" % (chr(1), chr(24)) #CM.selec...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- "Control the monochromator CM-110" import logging import inspect from serial import Serial def show_frame(): "Show info about the program place where called" stack = inspect.stack() for record in stack[1:]: print "Module %s, file %s, line %s, function...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- "Test PyGTK" import pygtk pygtk.require('2.0') import gtk from CM110 import CM110 class StreamLike(object): # pylint: disable=R0903 "A stream-like class to show logs in a window" def __init__(self, textview): self.textview = textview def write(self,...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- #pylint: disable=C0103 "Fake answers for testing Control the monochromator CM-110" print "%c" % chr(27) #CM.echo() print "%c" % chr(27) #CM.echo() print "%c" % chr(27) #CM.echo() print "%c\n%c" % (chr(1), chr(24)) #CM.select(1) print "%c\n%c" % (chr(1), chr(24)) #CM.selec...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- "Control the monochromator CM-110" import logging import inspect from serial import Serial def show_frame(): "Show info about the program place where called" stack = inspect.stack() for record in stack[1:]: print "Module %s, file %s, line %s, function...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- "Test PyGTK" import pygtk pygtk.require('2.0') import gtk from CM110 import CM110 class StreamLike(object): # pylint: disable=R0903 "A stream-like class to show logs in a window" def __init__(self, textview): self.textview = textview def write(self,...
Python
''' Created on Aug 15, 2012 @author: Chung Leong ''' from flaczki.abc.structures import * from struct import Struct class ABCParser(object): def __init__(self): self.u8 = Struct('<B') self.u16 = Struct('<H') self.f64 = Struct('d') def parse(self, byte_codes): self.byte_codes = byte_code...
Python
''' Created on Aug 15, 2012 @author: Chung Leong ''' class ABCFile(object): major_version = None minor_version = None int_table = None uint_table = None double_table = None string_table = None namespace_table = None namespace_set_table = None multiname_table = None ...
Python
''' Created on Jul 21, 2012 @author: Chung Leong ''' from zlib import decompressobj from struct import Struct from flaczki.swf.tags import * class SWFFile(object): ''' classdocs ''' version = None compressed = False frame_size = None tags = [] class SWFParser(object): ...
Python
''' Created on Jul 21, 2012 @author: Chung Leong ''' from zlib import compressobj from struct import Struct from flaczki.swf.tags import * class SWFAssembler(object): ''' classdocs ''' def __init__(self): ''' Constructor ''' self.ui8 = Struct('<B') ...
Python
''' Created on Jul 21, 2012 @author: Chung Leong ''' class Generic(object): code = None header_length = None length = None data = None class Character(object): character_id = None class CSMTextSettings(object): character_id = None renderer = None grid_fit = None ...
Python
# -*- coding: utf-8 -*- __author__ = 'gongqf' from gevent.wsgi import WSGIServer from gis import app http_server = WSGIServer(('', 5001), app) http_server.serve_forever()
Python
# -*- coding: utf-8 -*- __author__ = 'gongqf' from flask.ext.sqlalchemy import SQLAlchemy from gis import app from datetime import datetime db = SQLAlchemy(app) def setnone(v): if v=='': return None else: return v def setzero(v): if v=='': return 0 else: ...
Python
# -*- coding: utf-8 -*- import cx_Oracle con = cx_Oracle.connect('gis/ndtvgis@192.168.20.79/GIS') # print con.version cur = con.cursor() # tegjsbdz 面板端子 # teqy 区域 type=2 # tejz 分前端 zqybm=teqy.bm # tejf 机房 jflx=1,jzbm=tejz.bm # tegjjx 光交 jzbm=tejz.bm # teodf ODF sysm=0,jfbm.tejf.bm 不确定 # 或者 sysm=0,jzbm=tejz...
Python
# -*- coding: utf-8 -*- import cx_Oracle con = cx_Oracle.connect('gis/ndtvgis@192.168.20.79/GIS') print con.version cursor = con.cursor() cursor.execute("select * from tegjd where bm=:bm",{'bm':'HS.ZFY/SQY/GJD01'}) rows=cursor.fetchall() for row in rows: print row cursor.execute("select * from teg...
Python
# -*- coding: utf-8 -*- from sqlalchemy import * from sqlalchemy.sql import select from sqlalchemy.schema import * # create the engine for oracle db # we need to install cx_Oracle and sqlalchemy in advance. db_engine=create_engine('oracle://gis:ndtvgis@192.168.20.79:1521/GIS', echo=True) # test the ddl to db ...
Python
# -*- coding: utf-8 -*- __author__ = 'gongqf' import os basedir = os.path.abspath(os.path.dirname(__file__)) # SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') # SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') DEBUG=True DEBUG_TOOLBAR=True SECRET_KEY='development key...
Python
# -*- coding: utf-8 -*- import os from flask.ext.openid import OpenID from config import basedir __author__ = 'gongqf' from flask_login import LoginManager from flask import Flask from flask_appconfig import AppConfig from flask_debugtoolbar import DebugToolbarExtension login_manager = LoginManager() def cr...
Python
# -*- coding: utf-8 -*- __author__ = 'gongqf' import win32com from win32com.client import Dispatch, constants w = win32com.client.Dispatch('Word.Application') # 或者使用下面的方法,使用启动独立的进程: # w = win32com.client.DispatchEx('Word.Application') # 后台运行,不显示,不警告 w.Visible = True w.DisplayAlerts = True # 打开新的文件 # do...
Python
# -*- coding: utf-8 -*- import cx_Oracle con = cx_Oracle.connect('gis/ndtvgis@192.168.20.79/GIS') # print con.version cursor = con.cursor() cursor.execute("select sum(gdcd) from tegdd t") for result in cursor: print u'统计管道段长度:',result[0] cursor.execute("select count(*) from tersj") for res...
Python