code
stringlengths
1
1.72M
language
stringclasses
1 value
# # Copyright (c) 2010 Xavier Garcia xavi.garcia@gmail.com # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, thi...
Python
# # Copyright (c) 2010 Xavier Garcia xavi.garcia@gmail.com # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, thi...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
#!/usr/bin/python # # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # o...
Python
"""Friendly Python SSH2 interface.""" """By zeth0 from http://commandline.org.uk/""" import os import tempfile paramikoInstalled = True try: import paramiko except: print "SSH functionallity disabled because paramiko is not installed!" paramikoInstalled = False class Connection(object): """Connects a...
Python
from plugininterface import basePlugin # This plugin is based on Insomnia Security's Whitepaper: # http://www.insomniasec.com/publications/LFI%20With%20PHPInfo%20Assistance.pdf # # Plugin by Iman Karim <fimap.dev@gmail.com> # License: GPLv2 import urlparse, re, socket, threading, base64, urllib, string, random cla...
Python
from plugininterface import basePlugin # Plugin by Iman Karim <fimap.dev@gmail.com> # License: GPLv2 import urlparse, socket, threading, base64, urllib, string, random, time class FindFirstFileAbuse(basePlugin): egg = "c:\\\\xampp\\\\tmp\\\\egg" remotetmpdir = "c:\\xampp\\tmp" maxAttempts = 5000 ...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds the Bing class which is use...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds the logic for dealing with ...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds a mixin to specify a query ...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds the base Query class used b...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds the Bing WebQuery class use...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds the QueryMixin base class u...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. # Mixins from mixin import QueryMixin from pagabl...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds the any constants used when...
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. from bing import Bing
Python
# This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 JJ Geewax http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds the base BingResult class. ...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-sets/ # # Code is licensed under MIT license. # import re import urllib import random from htmlentitydefs import name2codepoint...
Python
"""Beautiful Soup Elixir and Tonic "The Screen-Scraper's Friend" http://www.crummy.com/software/BeautifulSoup/ Beautiful Soup parses a (possibly invalid) XML or HTML document into a tree representation. It provides methods and Pythonic idioms that make it easy to navigate, search, and modify the tree. A well-formed X...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-search/ # # Code is licensed under MIT license. # import re import urllib from htmlentitydefs import name2codepoint from BeautifulSoup impor...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-search/ # # Code is licensed under MIT license. # import random import socket import urllib import urllib2 import httplib B...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # A Google Python library: # http://www.catonmat.net/blog/python-library-for-google-search/ # # Distributed under MIT license: # # Copyright (c) 2009 Peteris Krumins # # Permission is hereby granted...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-sponsored-links-search/ # # Code is licensed under MIT license. # import re import urllib import random from htmlentitydefs imp...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
# # This file is part of fimap. # # Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de). # http://fimap.googlecode.com # # This file may be licensed under the terms of of the # GNU General Public License Version 2 (the ``GPL''). # # Software distributed under the License is distributed # on an ``AS IS'' bas...
Python
''' Created on Nov 17, 2011 @author: rupam ''' import sys import csv from pylab import * from mpl_toolkits.mplot3d import Axes3D def main(): x1steps = x2steps = 50.0 x1range = linspace(0, 6-6/x1steps, x1steps) x2range = linspace(0, 6-6/x2steps, x2steps) cr = csv.reader(open(sys.argv[1], 'rt'), delimit...
Python
import random, math def gen_line(mean, std, n): for i in range(n): print random.gauss(mean, std) def gen_linear(a, b, std, n): for i in range(n): x = i y = (a * x + b) print random.gauss(y, std) # nao vai funcionar por que o kalman so consegue lidar com funcoes lineares def gen_sigmoid(std, n): start = -5...
Python
import sys, random def generate_random_cluster_centroids(num_clusters, dimension): cluster_centroids = [] for i in range(num_clusters): cluster_centroids.append([]) for j in range(dimension): cluster_centroids[i].append(random.randint(-1000, 1000)) return cluster_centroids def generate_random_points(num_p...
Python
import sys def write_groups(points_filename, index_points_map): keys = index_points_map.keys() for key in keys: fptr = open(points_filename + "." + key, "w") points_of_group = index_points_map[key] for line in points_of_group: fptr.write(line + "\n") fptr.close() def split_files(points_filename, ind...
Python
import numpy, math def normalize(data): # find the bias to make all points positive shift = 999999.0 for i in range(len(data)): if data[i][1] < shift: shift = data[i][1] shift = abs(shift) # apply the bias for i in range(len(data)): data[i][1] = (data[i][1] + shift) # find the max y value max_value...
Python
import sys, random def generate_random_cluster_centroids(num_clusters, dimension): cluster_centroids = [] for i in range(num_clusters): cluster_centroids.append([]) for j in range(dimension): cluster_centroids[i].append(random.randint(-1000, 1000)) return cluster_centroids def generate_random_points(num_p...
Python
import sys def write_groups(points_filename, index_points_map): keys = index_points_map.keys() for key in keys: fptr = open(points_filename + "." + key, "w") points_of_group = index_points_map[key] for line in points_of_group: fptr.write(line + "\n") fptr.close() def split_files(points_filename, ind...
Python
NORTH = 0 EAST = 1 SOUTH = 2 WEST = 3
Python
import ika import engine from const import * #### Generic enemy class ####################################################### class Enemy(object): def __init__(self, x, y, f): self.x = x self.y = y self.startx = x self.starty = y self.facing = f self.curframe = ...
Python
import ika import engine #### Inventory System ############################################################################################ class Inventory(object): def __init__(self): #None = empty #DummyItem = filled box, points to the item object that fills it #Item object = obvious...
Python
import ika import engine def Start(): ika.Video.DrawRect(0,0,320,240,ika.RGB(0,0,0), 1) ika.Video.ShowPage() music = ika.Music("music/intro.ogg") music.loop = True music.Play() img = ika.Image("Img/logo/ika_work.png") fridge=[] for i in range(1, 10): fridge.append(ika....
Python
import ika import engine class PDA(object): def __init__(self): self.mode = 0 self.buttons = [ika.Image("Img/ui/hudbmap.png"), ika.Image("Img/ui/hudbstat.png"), ika.Image("Img/ui/hudbobj.png"), ika.Image("Img/ui/hudblog.png")] ...
Python
import engine
Python
import ika import engine def Start(): planet = ika.Image("Img/title/planet.png") background = ika.Image("Img/title/background.png") title = ika.Image("Img/title/finaleclipse.png") titleglow = ika.Image("Img/title/finaleclipse_glow.png") sunglow = ika.Image("Img/title/sunglow.png") frid...
Python
"""Record of phased-in incompatible language changes. Each line is of the form: FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease "," CompilerFlag ")" where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as sys.version_info...
Python
#!/usr/bin/env python import ika """ [Controls] UP DOWN LEFT RIGHT JUMP FIRE MISSILE_FIRE BOOST SPIDER_BALL AIM_UP AIM_DOWN BEAM_SELECT MISSILE_SELECT MISSILE_HOLD [Scheme] Depending on scheme, some of the buttons work differently. MISSILE_SELECT either changes type of missile (#1)...
Python
import engine
Python
import ika class Sound(object): def __init__(self, maxsize=24): self.sounds = [] self.maxsize = maxsize def Play(self, filename, volume=0.5): s = ika.Sound("sfx/"+filename) s.volume = volume s.Play() self.sounds.append(s) if len(self.sounds) > self.maxsize: ...
Python
import ika from inventory import * import intro from const import * import entity import sound import pda import credits import controls ika.SetCaption(ika.GetCaption() + " - Final Eclipse") engine = None #intro.Start() #credits.Start() class Engine(object): def __init__(self): self.t...
Python
#!/usr/bin/env python import ika """ [Controls] UP DOWN LEFT RIGHT JUMP FIRE MISSILE_FIRE BOOST SPIDER_BALL AIM_UP AIM_DOWN BEAM_SELECT MISSILE_SELECT MISSILE_HOLD [Scheme] Depending on scheme, some of the buttons work differently. MISSILE_SELECT either changes type of missile (#1)...
Python
import os import sys import glob import re def shelloutput(cmd): pipe = os.popen(cmd, 'r') ret = pipe.read() pipe.close() return ret.strip() def gccversion(): ver = re.search('\d*\.\d*\.\d*', shelloutput('gcc --version')).group(0) return map(int, ver.split('.')) def arch(): if os.n...
Python
Import('env') fenv = env.Clone() fenv.Append(CPPDEFINES=[ ['ASMCALL', { 'arm': '"bl"', 'i386': '"nop;nop;nop;call"', 'mips': '"bal"', 'powerpc': '"bl"', 'x64': '"nop;nop;nop;call"', }[env['ARCH']]], ['ASMCELL', {...
Python
''' Created on 30.01.2013 @author: Marko ''' def percentile(data, percentile): percentile = percentile array = data array.sort() r = (percentile / 100.0) * (len(array) + 1.0) rindex = int(r) if rindex <= 0: rindex = 1 if rindex <= len(array) - 1: ...
Python
from sqlalchemy import Column, Integer, Text, ForeignKeyConstraint, ForeignKey, Float, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import ( scoped_session, sessionmaker, relationship, ) from zope.sqlalchemy import ZopeTransactionExtension DBSession = scoped_ses...
Python
''' Created on Jan 17, 2013 @author: dheigl ''' from PeriodicReturns import PeriodicReturns from PeriodicReturnsList import PeriodicReturnsList from Stock import Stock from StockList import StockList from fetchPortfolio import GoogleQuote from IndexedVector import IndexedVector from IndexedVectorList import IndexedVec...
Python
''' Created on Dec 19, 2012 @author: dheigl ''' from Stock import Stock from StockList import StockList import datetime import json import urllib class GoogleQuote: ''' Daily quotes from Google. Date format='yyyy-mm-dd' ''' def getData(self, symbol, start_date, end_date=datetime.date.today().isoformat()): ...
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class IndexedVectorList(object): ''' classdocs ''' iVectorList = [] def add(self, indexedVector): self.iVectorList.append(indexedVector) def __init__(self): ''' Constructor ''' print "NEW IndexedVecto...
Python
import unittest import transaction from pyramid import testing from .models import DBSession class TestMyView(unittest.TestCase): def setUp(self): self.config = testing.setUp() from sqlalchemy import create_engine engine = create_engine('sqlite://') from .models import ( ...
Python
''' Created on Jan 27, 2013 @author: dheigl ''' from IndexedVectorList import IndexedVectorList from RandomizedList import RandomizedList from StockList import StockList from fin2012.SimulationList import SimulationList from os import path import csv import math import os class Simulation: ''' classdocs ''...
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class PeriodicReturns: ''' classdocs ''' def add(self, value): self.value.append(value) def __init__(self, key): self.key = key self.value = [] def get_key(self): return self.__key def set_key(self, val...
Python
import os import sys import transaction from sqlalchemy import engine_from_config from pyramid.paster import ( get_appsettings, setup_logging, ) from ..models import ( DBSession, MyModel, Base, ) def usage(argv): cmd = os.path.basename(argv[0]) print('usage: %s <config_uri>\n' ...
Python
# package
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class Stock: def __init__(self, key, date, quotes, actualValue=0.0): self.key = key self.date = date self.quotes = quotes self.actualValue = actualValue def get_actual_value(self): return self.__actualValue def set_...
Python
''' Created on Jan 30, 2013 @author: dheigl ''' from fin2012.RandomizedList import RandomizedList from fin2012.Simulation import Simulation from fin2012.SimulationList import SimulationList from fin2012.fetchPortfolio import GoogleQuote import CalculateValueAtRisk import datetime class Start(): ''' classdocs ...
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class RandomizedList: ''' classdocs ''' rList = [] def add(self, indexedVector): RandomizedList.rList.append(indexedVector) def kill(self): del self def __init__(self, indexedVector): print "*******...
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class IndexedVector(object): ''' classdocs ''' def add(self, value): self.value.append(value) def __init__(self, key): ''' Constructor ''' self.key = key self.value = [] def get_key(self): ...
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class SimulationList: ''' classdocs ''' simList =[] summe = [] def add(self, simulation): SimulationList.simList.append(simulation) def __init__(self): ''' Constructor '''
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class PeriodicReturnsList(object): ''' classdocs ''' returnsList = [] def add(self, returns): PeriodicReturnsList.returnsList.append(returns) def __init__(self, returns): self.add(returns)
Python
from pyramid.config import Configurator from sqlalchemy import engine_from_config from .models import ( DBSession, Base, ) help = 0 symbols = [] settings = [] def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, '...
Python
from .models import DBSession, MyModel from IndexedVector import IndexedVector from IndexedVectorList import IndexedVectorList from PeriodicReturns import PeriodicReturns from PeriodicReturnsList import PeriodicReturnsList from RandomizedList import RandomizedList from Simulation import Simulation from SimulationList i...
Python
''' Created on Jan 27, 2013 @author: dheigl ''' class StockList: ''' classdocs ''' stockList = [] def add(self, stock): StockList.stockList.append(stock) def __init__(self, stock): self.add(stock) print "########### NEW STOCKLIST ##############"
Python
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.txt')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', 'SQLAlchemy', 'transaction', 'pyramid_tm', 'pyramid_debug...
Python
import os.path import unittest import fimero.core.disk.PathKit as PK class TestPathKit(unittest.TestCase): def test_parent_folder(self): parent_path = PK.parent_folder(__file__) self.assertEqual("disk", os.path.basename(parent_path)) if __name__ == "__main__": uni...
Python
import unittest import fimero.core.disk.TextFileKit as TFK class TestTextFileKit(unittest.TestCase): def test_write_text(self): tf = TFK.make('/tmp/foo.txt') tf.touch() tf.write_text('hello')
Python
#!/usr/bin/env python import unittest import fimero.core.util.LogKit as LogKit import fimero.core.text.TemplateKit as TK LOGGER = LogKit.get_logger(__name__) LOGGER.debug('from initialize') class TestTemplateKit(unittest.TestCase): def test_lookup_template(self): template = TK.lookup_templ...
Python
import unittest import sys import logging import fimero.core.util.LogKit as LogKit LOGGER = LogKit.get_logger('test') class TestLogKit(unittest.TestCase): def test_logger(self): LOGGER.warn('this is a test warning') if __name__ == "__main__": unittest.main()
Python
#!/usr/bin/env python """An example script that uses MainKit 'city', 'state', and 'country' are ordered arguments 'country' is optional if a long description is set to a case-insensitive match to itself, no default is set. usage: %prog [options] city state [country] -i, --interact : interactive mode -o, --o...
Python
""" FileKit creates file objects. """ import os import shutil import tempfile import fimero.core.disk.PathKit as PathKit import fimero.core.disk.NodeKit as NodeKit import fimero.core.util.LogKit as LogKit from NodeKit import TNode MODE_TEXT = 'r' MODE_TEXT_APPEND = 'a' MODE_TEXT_WRITE = 'w' MODE_BYTE = 'rb' MODE_APPE...
Python
""" Base file system node Includes all elements on a file system including folders, files and links. """ import shutil class TNode(object): """ A TNode is a common base class for file system objects. """ def __init__(self, path): """Initializes this node with the specified path instance."...
Python
""" TextFileKit creates text file objects that can be manipulated accordingly. """ import fimero.core.disk.PathKit as PathKit import fimero.core.disk.FileKit as FileKit import fimero.core.util.LogKit as LogKit LOG = LogKit.get_logger(__name__) class TTextFile(FileKit.TFile): """ TTextFile represents a text fi...
Python
""" Folder on file system. """ import os import sys import fnmatch import tempfile import warnings import fimero.core.disk as disk import fimero.core.disk.NodeKit as NodeKit import fimero.core.disk.PathKit as PathKit import fimero.core.disk.FileKit as FileKit ##########################################################...
Python
""" file system classes and utilities. """ STRICT = 'strict' WARN = 'warn' IGNORE = 'ignore' ERRORS = (STRICT, WARN, IGNORE) #def wiki(): # DocKit.wiki(None) class FilerError(Exception): """Exceptions indicating problems with the file system.""" def __init__(self, message): """create file error ...
Python
""" Path is an object-oriented path to a file system node. It is responsible for modeling the organization of a file system. It must NOT modify the file system in any way--that task is delegated to Node instances (File and Folder) A path segment has two properties {absolute|relative} and {node|leaf} absol...
Python
import os.path import fimero.core.util.LogKit as LogKit import fimero.core.disk.PathKit as PathKit import fimero.core.disk.TextFileKit as TextFileKit from mako.template import Template from mako.lookup import TemplateLookup from mako.runtime import Context from StringIO import StringIO LOGGER = LogKit.get_logger(__nam...
Python
# the fimero.core package contains common utilities and classes # including disk, network, and security
Python
""" OptionKit is a wrapper for Python's optparse module that forces the script writer to provide documentation. It works by parsing the script's docstring for the the args and options for the script. For example, we write a module level docstring: '''usage: %prog files [options] -d, --delete: delete all files ...
Python
""" Logging module. """ import sys import getpass import logging import tempfile # When running python from cron, the logger seems to throw exceptions. This # suppresses those exceptions (and does not appear to have detrimental effects # on the logging output). logging.raiseExceptions = False #FORMAT = '%(asctime)s %...
Python
""" The MainKit provides a base class for executable modules. """ import sys import optparse import fimero.core.util.OptionKit as OptionKit class TMain(object): """ TMain is a base class that should be extended by any class that is intended to be executed. """ def _execute(self, options, args): ...
Python
# base package of all fimero python code
Python
from math import * import unittest def bascara(a, b, c): if not (type(a) == int and type(b) == int and type(c) == int): return "ingrese un valor correcto" X = (b**2)-(4*a*c) if X < 0: return "Solucion en numeros complejos" elif X == 0: X1 = (-b) / (2*a) ...
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
Python
import simplejson import cgi class JSONFilter(object): def __init__(self, app, mime_type='text/x-json'): self.app = app self.mime_type = mime_type def __call__(self, environ, start_response): # Read JSON POST input to jsonfilter.json if matching mime type response = {'status': ...
Python
""" Implementation of JSONDecoder """ import re from scanner import Scanner, pattern FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconstants(): import struct import sys _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') if sys.byteorder != 'big': # NOTE(kgibbs): These lines m...
Python
""" Iterator based sre token scanner """ # NOTE(kgibbs): This line must be added to make this file work under # Python 2.2, which is commonly used at Google. from __future__ import generators # NOTE(kgibbs): End changes. import sre_parse, sre_compile, sre_constants from sre_constants import BRANCH, SUBPATTERN from re i...
Python