code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
## module error_choleski
''' L= choleski(a).
Choleski decomposition: [L][L]transpose = [a].
'''
from numarray import array
from math import sqrt
def choleski(a):
n = len(a)
# Create zero matrix for L
L = [[0.0] * n for i in xrange(n)]
# Perform the Choleski decomposition
for i in x... | Python |
#===============================================================================
# encoding utf-8
# author :kanchan mahajan
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is onlly fo... | Python |
'''
#===============================================================================
# encoding utf-8
# author :michael dettling
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is onl... | Python |
stiffness_mat_dict={
(0, 0): 0,
(0, 1): 0,
(1, 0): 1,
(1, 1): 1,
(1, 2): 1,
(2, 1): 2,
(2, 2): 2,
(2, 3): 2,
(3, 2): 3,
(3, 3): 3,
(3, 4): 3,
(4, 3): 4,
(4, 4): 4,
(4, 5): 4,
(5, 4): 5,
(5, 5): 5,
(5, 6): 5,
(6, 5): 6,
(6, 6): 6,
(6, 7): 6,
(7, 6): 7,
(7, 7): 7,
(7, 8): 7,
(8, 7): 8,
(8, 8): 8... | Python |
'''
===============================================================================
# encoding utf-8
# author :michael dettling
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
# This part processes th... | Python |
#===============================================================================
# encoding utf-8
# author :kanchan mahajan
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is onlly fo... | Python |
class myDict(dict):
'''
dictionary representation of the matrix
this class is only for general matrix while for symmetric matrix another
subclass can be derived from this
V 1
'''
def __init__(self, **kwargs):
for arg in kwargs:
self.__setitem__(arg, kwargs.g... | Python |
#===============================================================================
# encoding utf-8
# author :kanchan mahajan
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is onlly fo... | Python |
#===============================================================================
# encoding utf-8
# author :kanchan mahajan
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is onlly fo... | Python |
#===============================================================================
# encoding utf-8
# author :kanchan mahajan
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is onlly fo... | Python |
#===============================================================================
# encoding utf-8
# author :kanchan mahajan
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is o... | Python |
#===============================================================================
# encoding utf-8
# author :kanchan mahajan
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Elelement Methods
#
# CAUTION: This code is onlly fo... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: This code ... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: This code ... | Python |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 01 08:01:05 2014
@author: Pisarn
"""
def ToArray(dic):
#=======================================================================
# returns 2D Array to represent the current object with 0 filled as in sparse matrices
# CAUTION : if exploit... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: Th... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: Th... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: Th... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: Th... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: Th... | Python |
'''
# -*- coding: utf-8 -*-
#==============================================================================
# # author :Pisarn Pasutanon
# module : this module is a part of educational project
# and the calculations here are done according to conventional theory
# book of Finite Element Methods
#
# CAUTION: Th... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2008 - 2012 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/... | Python |
import shutil, os
import tarfile
import json
def concat(dst, src1, src2):
destination = open(dst, 'wb')
shutil.copyfileobj(open(src1, 'rb'), destination)
shutil.copyfileobj(open(src2, 'rb'), destination)
destination.close()
def tarLinuxFiles(tarname, src):
tar = tarfile.open(tarname, "w:gz")
... | Python |
from ResourceManager import *
from Rendering import *
import GameClient
print "Python Scripting Loaded."
## Don't hardcode the base... instead get the "gameRoot" environment variable
resourceService.addResourceLocation("C:\\dev\\Zen\\examples\\taBBall\\resources",
... | Python |
from ResourceManager import *
from Rendering import *
import GameClient
#Establish the root skin directory
if MySkin:
addResourceLocation("~/resources/ui/skins/MySkin", "FileSystem", "KoZ", False)
elif MySkin2:
addResourceLocation("~/resources/ui/skins/MySkin2", "FileSystem", "KoZ", False)
else:
... | Python |
import csv
reader = csv.reader(open("character.csv", "rb"))
for row in reader:
print row
raw_input("press <enter>")
| Python |
#Defines is where all C++ calls are converted into readable Python variables
#Check out www.indiezen.org/wiki/wiki/KoZ/Scripts for the full complete list of available arguments.
from ResourceManager import *
from Rendering import *
import GameClient
#Allows the addition of a resource location with the follow... | Python |
from ResourceManager import *
from Rendering import *
import GameClient
print "Python Scripting Loaded."
## Don't hardcode the base... instead get the "gameRoot" environment variable
gameClient.getRenderingResourceService().addResourceLocation("~/resources",
... | Python |
"""Convert Wavefront OBJ / MTL files into Three.js (JSON model version, to be used with web worker based ascii / binary loader)
-------------------------
How to use this converter
-------------------------
python convert_obj_three.py -i infile.obj -o outfile.js [-m "morphfiles*.obj"] [-c "morphcolors*.obj"] [-a cente... | Python |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Python |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Python |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Python |
#!/usr/bin/env python
import os
import tempfile
files = [
'js/Error.js',
'js/lib/Logger.js',
'js/lib/Stats.js',
'js/lib/gui.min.js',
'js/lib/color.js',
'js/lib/js-signals.min.js',
'js/lib/Tween.js',
'js/lib/ThreeWebGL.js',
'js/lib/ThreeExtras.js',
'js/lib/LoadingBar.js',
'js/lib/RequestAnimationFrame.js',
'js/lib... | Python |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self... | Python |
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | Python |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | Python |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | Python |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | Python |
#!/usr/bin/python
import xml.parsers.expat;
import sys;
import re;
parser=xml.parsers.expat.ParserCreate('UTF-8');
values_en = {}
values_lang = {}
values_hash = {}
name=''
def parse(lang, values):
def start_element(n, attrs):
global name;
if n != u'string': return
name=attrs[u'name']
def end_element(... | Python |
#! /usr/bin/env python
# encoding: utf-8
# waf 1.6.10
VERSION='0.3.3'
import sys
APPNAME='p2t'
top = '.'
out = 'build'
CPP_SOURCES = ['poly2tri/common/shapes.cc',
'poly2tri/sweep/cdt.cc',
'poly2tri/sweep/advancing_front.cc',
'poly2tri/sweep/sweep_context.cc',
... | Python |
import sys
if sys.version_info < (2, 5):
raise Exception('Fenton requires Python 2.5 or higher.')
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name = 'Fenton',
version = '0.1',
description = 'Fenton is for apps',
author = 'Adrian Dries',
... | Python |
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
__test__ = False
import os
import sys
import time
import logging
import threading
import traceback
from unittest import _WritelnDecorator
from nose.config import Config
from nose.core import TestProgram
from nose.uti... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import thread
import fenton
# descriptor decorator
class resource:
def __init__(self, factory):
self.factory = factory
self.id = getattr(factory, '__name__', str(factory)... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import re
import time
import uuid
from sqlalchemy import event
from sqlalchemy.ext.declarative import DeclarativeMeta
from fenton import util
from fenton import view
from fenton import model... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import json
import urlparse
import os.path as op
import cPickle as pickle
import webob
import webob.exc
from weberror.errormiddleware import ErrorMiddleware
from fenton import app
from fento... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import re
import sys
import decimal
import datetime
import pytz
try:
import json
except:
import simplejson as json
from fenton import util
from fenton import widgets
from fenton imp... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
from fenton import util
from fenton import types
from fenton import getmeta
from fenton import security
EMPTY = (None, [], '', {})
# called only by web.Request.vars
# and therefore created... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import os
import sys
import time
import os.path as op
import fenton.app
MAXFD = 1024
def get_config(filename, vars=None):
import ConfigParser
parser = ConfigParser.ConfigParser(va... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import sys
import logging
DEBUG0 = logging.DEBUG
DEBUG1 = DEBUG0+1
DEBUG2 = DEBUG0+2
DEBUG3 = DEBUG0+3
logging.addLevelName(DEBUG0, 'DEBUG0')
logging.addLevelName(DEBUG1, 'DEBUG1')
logging.... | Python |
__metaclass__ = type
import os
import sys
import time
import signal
import threading
import subprocess
RELOADER_CODE = 125
def watch(f):
Watcher.extra.append(os.path.abspath(f))
def wait():
Watcher().start()
def run(key):
exe = sys.executable
args = [exe] + sys.argv
while True:
proc... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
from fenton import data
from fenton import view
from fenton import util
from fenton import types
from fenton import getmeta
from fenton import widgets
from fenton import security
def perms(d... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import sqlalchemy.orm as orm
from fenton import util
from fenton import view
from fenton import types
from fenton import logging
def compile_all():
for m in AbstractMeta.all_metas:
... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import os
import sqlalchemy as sql
from sqlalchemy import orm
METADATA = sql.MetaData()
ENV_KEY = 'FENTON_UPGRADING'
SCHEMA_HISTORY = sql.Table(
'SCHEMA_HISTORY',
METADATA,
sql.... | Python |
#!/usr/bin/python
# -*- coding: ascii -*-
###########################################################################
# PBKDF2.py - PKCS#5 v2.0 Password-Based Key Derivation
#
# Copyright (C) 2007, 2008 Dwayne C. Litzenberger <dlitz@dlitz.net>
# All rights reserved.
#
# Permission to use, copy, modify, and distribute ... | Python |
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import os
import sys
class colors:
@staticmethod
def capable():
return (hasattr(sys.stderr, 'fileno') and
os.isatty(sys.stderr.fileno()))
def random(self, text, choice=None):
... | Python |
from __future__ import absolute_import
import sys
import unittest
from fenton.util import decamel
__test__ = False
__metaclass__ = type
TestCase = unittest.TestCase
class T(unittest.TestCase):
__test__ = False
def runTest(self):
pass
def test(f):
f.__name__ = 'test_' + f.__name__
return f... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import time
import urllib2
import datetime
from xml.etree import cElementTree as etree
import sqlalchemy as sql
import sqlalchemy.orm as orm
from sqlalchemy.ext.associationproxy import assoc... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
# TODO: get messages from win32 error codes
import re
import os
import sys
import uuid
import pytz
import ldap
import datetime
from fenton import util
from fenton import insecure
from fenton... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import os
import string
import random
USABLE_PUNCTUATION = '''~!@#$%^&*()-=+[];:'",.<>?'''
def randint(max):
return random.randint(0, max)
class Generator:
def __init__(self, word... | Python |
if 0:
class schema_table(DbModel):
__classid__ = _object_guid = None
__tablename__ = 'tables'
table_schema = sql.Column(sql.String(), primary_key=True)
table_name = sql.Column(sql.String(), primary_key=True)
__table_args__ = {'schema': 'information_schema'}
class sch... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import time
import Queue
import smtplib
import threading
from email import encoders
from email.header import make_header
from email.utils import make_msgid
from email.mime.audio import MIMEAu... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import os
import re
import sys
import time
import string
import inspect
import threading
import functools
from collections import defaultdict
if sys.platform == 'win32':
timer = time.clo... | Python |
import sys
import pdb
__metaclass__ = type
class Debugger(pdb.Pdb):
def format_stack_entry(self, frame_lineno, lprefix=': '):
import linecache, repr
frame, lineno = frame_lineno
filename = self.canonic(frame.f_code.co_filename)
s = '%s(%r)' % (filename, lineno)
if frame.f_... | Python |
"""
(Possibly marginally secure) RPC server
Packet is:
octets meaning
4: seclen = length of secret
<seclen>: secret
4: msglen = length of message
<msglen>: message (code)
integers are big-endian, 32 bits.
A minimal windows service
Based on _Python Programming on win3... | Python |
from markupsafe import Markup, escape_silent as escape
__metaclass__ = type
empty = 'area base basefont br col frame hr img input isindex link meta param'
empty = set(empty.split())
def _make_tag(tag, args, kw):
if kw.has_key('_'):
assert not args, "The special '_' keyword argument cannot be used "\
... | Python |
import re
import datetime
MAX_OFFSET = 1440
DT_RX = re.compile(
r'^(?P<year>[0-9]{4})' # YYYY
r'(-(?P<month>[0-9]{2})' # -MM
r'(-(?P<day>[0-9]{2})' # -DD
r'([T: ]' # 'T', ':' or ' '
r'(?... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import markupsafe
from fenton import util
from fenton import getmeta
JQUERY_LOCAL = 'fenton/js/jquery-1.7.1.js'
JQUERY_CDN = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.j... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import urlparse
import functools
from fenton import util
from fenton import getmeta
from fenton import widgets
from fenton import logging
class MethodWrapper:
__func = property(lambda... | Python |
def getmeta(*x, **y):
import fenton, fenton.model
fenton.getmeta = fenton.model.getmeta
return fenton.getmeta(*x, **y)
| Python |
"""A high-speed, production ready, thread pooled, generic HTTP server.
Simplest example on how to use this module directly
(without using CherryPy's application machinery)::
from cherrypy import wsgiserver
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('... | Python |
# forward-compat boilerplate
from __future__ import absolute_import
from __future__ import with_statement
__metaclass__ = type
import os
import hmac
import hashlib
from fenton import util
DEFAULT_TTL = 600 # seconds
NONCELEN = 8
MACLEN = 20
def initialize(app):
BuiltinUser.config = app.config
def get_builti... | Python |
"""
Read and write ZIP files.
"""
# Improved by Chortos-2 in 2010 (added bzip2 support)
import struct, os, time, sys, shutil
import binascii, cStringIO, stat
import io
import re
try:
import zlib # We may need its compression method
crc32 = zlib.crc32
except ImportError:
zlib = None
crc32 = binascii.crc... | Python |
import os.path
import re
import shutil
import struct
import subprocess
import sys
import zipfile2 as zipfile
import bz2
def import_boto():
global Key, S3Connection, awscreds
try:
from boto.s3.key import Key
from boto.s3.connection import S3Connection
except:
print("You need boto librar... | Python |
#!/usr/bin/python
"""
Build LevelDB dlls, build a zip and upload to s3.
Command line arguments:
-test : run all tests
-upload : upload the zip
"""
import os
import os.path
import shutil
import sys
import time
import re
import json
from util import log, run_cmd_throw, test_for_flag, s3UploadFilePu... | Python |
#!/usr/bin/env python
"""
tesshelper.py -- Utility operations to compare, report stats, and copy
public headers for tesseract 3.0x VS2008 Project
$RCSfile: tesshelper.py,v $ $Revision: 7ca575b377aa $ $Date: 2012/03/07 17:26:31 $
"""
r"""
Requires:
python 2.7 or greater: activestate.co... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2012 Zdenko Podobný
# Author: Zdenko Podobný
#
# 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/LIC... | Python |
from os.path import dirname, join
import subprocess
basedir = dirname(__file__)
cmd = ['pybot', '--outputdir', join(basedir, 'results'), join(basedir, 'vacalc')]
pythonpath = '%s:%s' % (join(basedir, 'lib'), join(basedir, '..', 'src'))
subprocess.call(' '.join(cmd), shell=True, env={'PYTHONPATH': pythonpath})
| Python |
import os
import sys
import subprocess
import datetime
import tempfile
import vacalc
class VacalcLibrary(object):
def __init__(self):
self._db_file = os.path.join(tempfile.gettempdir(),
'vacalc-atestdb.csv')
def count_vacation(self, startdate, year):
res... | Python |
from __future__ import with_statement
import os
import sys
import csv
import datetime
import tempfile
class VacalcError(Exception): pass
class EmployeeStore(object):
def __init__(self, db_file):
self._db_file = db_file
if self._db_file and os.path.isfile(self._db_file):
self._employ... | Python |
VALUE_FROM_VAR_FILE='Expected Value'
| Python |
def this_keyword_is_in_funnylib():
print 'jee'
| Python |
from Queue import Queue
from threading import Event
try:
from multiprocessing.managers import BaseManager
except ImportError:
class Python26Required(object):
def __call__(self, *args):
raise RuntimeError('Requires Python > 2.6')
def __getattr__(self, name):
raise Runt... | Python |
# Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | Python |
# -*- python -*-
# ex: set syntax=python:
import os
ROBOT_FRAMEWORK_REPOSITORY = 'http://robotframework.googlecode.com/svn/trunk/'
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}
####### BUILDSLAVES
from buildbot.buildslave impo... | Python |
#!/usr/bin/env python
"""A tool for creating data driven test case for Robot Framework
Usage: testgen.py variablefile template output
This script reads the variable and template files and generates a test suite
which has all test cases found in the template multiplied with all the rows of
the variable file. Suite s... | Python |
import datetime
from vacalc.employeestore import Employee
def calculate_vacation(startdate, vacation_year, exp_vacation_days):
try:
sdate = datetime.date(*(int(item) for item in startdate.split('-')))
except Exception, err:
raise AssertionError('Invalid time format %s' % err)
actual_days =... | Python |
from __future__ import with_statement
import os
import csv
import datetime
class VacalcError(RuntimeError): pass
class EmployeeStore(object):
def __init__(self, db_file):
self._db_file = db_file
if self._db_file and os.path.isfile(self._db_file):
self._employees = self._read_employ... | Python |
from vacalcapp import VacalcApplication
| Python |
from javax.swing import JFrame, JList, JPanel, JLabel, JTextField, JButton, Box, BoxLayout, JTable
from javax.swing.event import ListSelectionListener
from javax.swing.table import AbstractTableModel
from java.awt.event import ActionListener
from java.awt import FlowLayout, BorderLayout, Dimension, Font, Color
class ... | Python |
import os
import tempfile
from org.robotframework.vacalc import VacationCalculator
from vacalc.ui import VacalcFrame
from vacalc.employeestore import EmployeeStore, VacalcError
class VacalcApplication(VacationCalculator):
def create(self):
default_db = os.path.join(tempfile.gettempdir(), 'vacalcdb.csv')... | Python |
from robot import run as run_robot
import cProfile
import pstats
filename = 'robot.profile'
cProfile.run('run_robot("/home/husa/workspace/robotframework/atest/testdata/misc/")', filename)
p = pstats.Stats(filename)
p.strip_dirs().sort_stats(-1).print_stats()
| Python |
#!/usr/bin/env python
"""Script to generate atest runners based on data files.
Usage: %s path/to/data.file
"""
from __future__ import with_statement
import sys, os
if len(sys.argv) != 2:
print __doc__ % os.path.basename(sys.argv[0])
sys.exit(1)
inpath = os.path.abspath(sys.argv[1])
outpath = inpath.replac... | Python |
#!/usr/bin/env python
"""A script for running Robot Framework's acceptance tests.
Usage: run_atests.py interpreter [options] datasource(s)
Data sources are paths to directories or files under `robot` folder.
Available options are the same that can be used with Robot Framework.
See its help (e.g. `pybot --help`) fo... | Python |
def get_variables(*args):
return { 'PPATH_VARFILE_2' : ' '.join(args),
'LIST__PPATH_VARFILE_2' : args }
| Python |
PPATH_VARFILE = "Variable from varible file in PYTHONPATH" | Python |
list1 = [1, 2, 3, 4, 'foo', 'bar']
dictionary1 = {'a': 1}
dictionary2 = {'a': 1, 'b': 2}
| Python |
class ParameterLibrary:
def __init__(self, host='localhost', port='8080'):
self.host = host
self.port = port
def parameters(self):
return self.host, self.port | Python |
some_string = 'Hello, World!'
class _SomeObject:
pass
some_object = _SomeObject() | Python |
library = "It should be OK to have an attribute with same name as the module"
def keyword_from_submodule(arg='World'):
return "Hello, %s!" % arg
| Python |
class TraceLogArgsLibrary(object):
def only_mandatory(self, mand1, mand2):
pass
def mandatory_and_default(self, mand, default="default value"):
pass
def multiple_default_values(self, a=1, a2=2, a3=3, a4=4):
pass
def mandatory_and_varargs(self, mand, *varargs):
pass
... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.