code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/python import os, sys sys.path.append(os.getcwd() + '/lib') sys.path.append(os.getcwd() + '/lib/general') sys.path.append(os.getcwd() + '/lib/gtk') sys.path.append(os.getcwd() + '/lib/c') # my libraries from CFileRunnerGUI import CFileRunnerGUI def real_main(): oApp = CFileRunnerGUI() oApp.run() return...
Python
# Name: CFileRunnerGUI.py # Date: Sat Mar 27 09:56:02 CET 2010 # Purpose: Common FileRunner constants import os ### general const HOME = os.path.expanduser('~') #HOME = os.path.expanduser('~/tmp/filerunner_testing/CFG') VERSION = '<DEVEL-VERSION>' AUTHOR = 'Filip Husak' CFG_DIR = HOME + '/.filerunner' CFG_FILE =...
Python
# Name: CDataHnd.py # Date: Tue Mar 23 23:18:22 CET 2010 # Purpose: main data class of fileRunner application. It loads data from config and data files. # Def: CDataHnd() # Inputs: import os import sys import string import fnmatch import re import commands import errno import time # my libraries from CFil...
Python
# Name: CFileRunnerGUI.py # Date: Tue Mar 23 22:26:28 CET 2010 # Purpose: main GUI class of fileRunner application # Def: CFileRunnerGUI() # Inputs: import os import sys import gtk import gobject import time import errno from threading import Lock # my libraries from CDataHnd import CDataHnd from CTrayIcon ...
Python
# Name: CProfile.py # Date: Thu Apr 8 22:04:26 CEST 2010 # Purpose: Create and update profile. The profile is often created in the $HOME directory. # Def: CProfile(profileDir) # Inputs: import os # my libraries from CProcMngr import CProcMngr #############################################################...
Python
# Name: CProcMngr.py # Date: Sat Mar 27 10:42:41 CET 2010 # Purpose: Create and show about dialog # Depends: myconst module # Def: CProcMngr(widget = None) # Inputs: import os import commands #################################################################################################### class CProcM...
Python
# Name: CThread.py # Date: Sat May 1 19:59:54 CEST 2010 # Purpose: The abstract thread class with callback function. # The base class (which inherits CThread) MUST call run method. # super(ClassName, self).run() # Def CThread(name) # Inputs: name - the name of the thread [string]. import t...
Python
# Name: CExceptionHnd.py # Date: Sun May 2 15:18:25 CEST 2010 # Purpose: Handles exceptions # Def CExceptionHnd(extExcHnd_cb) # Inputs: import sys #################################################################################################### class CExceptionHnd(): ''' '' Base class for handling e...
Python
# Name: CFile.py # Date: Tue Mar 9 15:30:27 CET 2010 # Purpose: The class handles file descriptor # Def: CFile(filename, mode) # Inputs: filename - the name of file to work with # mode - the mode in which the file is opened [r, w] import os import sys #############################################...
Python
# Name: CConfigReader.py # Date: Sun Mar 21 19:11:46 CET 2010 # Purpose: Load and parse config file and get variables/valus for given section # Def: ConfigReader(fileName) # Inputs: filename - the name of config file import ConfigParser class CConfigReader(): ''' '' Load and parse config file and get var...
Python
#!/usr/bin/python from distutils.core import setup, Extension module1 = Extension('mmStrMatch', sources = ['mmStrMatch.c']) setup (name = 'mmStrMatch', version = '1.0', description = 'My Module for matching string and pattern. Module is written in C.', ext_modules = [module1])
Python
#!/usr/bin/python from distutils.core import setup, Extension module1 = Extension('mmStrMatch', sources = ['mmStrMatch.c']) setup (name = 'mmStrMatch', version = '1.0', description = 'My Module for matching string and pattern. Module is written in C.', ext_modules = [module1])
Python
# Name: CTrayIcon.py # Date: Sat Mar 27 09:41:29 CET 2010 # Purpose: # Def: CTrayIcon() # Inputs: import gtk #################################################################################################### class CTrayIcon(gtk.StatusIcon): __file = None __tooltip = None #----------------------------...
Python
# Name: CProgressWndRnd.py # Date: Sat May 1 20:56:56 CEST 2010 # Purpose: Show random status of progress bar. It is used while running long-time operation. # Depends: CThread # Def: CProgressWndRnd() # Inputs: from threading import Event import random, time import gtk import gobject # my libraries from ...
Python
# Name: CKeyPressHnd.py # Date: Sun Mar 28 21:24:42 CEST 2010 # Purpose: Handles key pressing # Def: CKeyPressHnd() # Inputs: import gtk #################################################################################################### class CKeyPressHnd(): __event = None #---------------------------...
Python
# Name: CAboutDlg.py # Date: Sat Mar 27 10:42:41 CET 2010 # Purpose: Create and show about dialog # Depends: myconst module # Def: CAboutDlg(widget = None) # Inputs: widget import gtk # my libraries import myconst ############################################################################################...
Python
# Name: CSimpleMsgDlg.py # Date: Sat Mar 27 10:42:41 CET 2010 # Purpose: Create and show simple message dialog # Def: CSimpleMsgDlg(msg) # Inputs: msg - message to be diplayed in the dialog import gtk #################################################################################################### clas...
Python
# Name: CGenerateDb.py # Date: Sat May 1 20:37:18 CEST 2010 # Purpose: Generate DB file. # Depends: CThread, CFile # Def: CGenerateDB(dataHandler) # Inputs: dataHandler - instance of CDataHnd import sys import gtk # my libraries from CThread import CThread from CFile import CFile from CProcMngr import CPr...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus & ...
Python
from scipy.sparse import coo_matrix from scipy.io import mmwrite from numpy.random import permutation M = N = 10 for nnz in [0, 1, 2, 5, 8, 10, 15, 20, 30, 50, 80, 100]: P = permutation(M * N)[:nnz] I = P / N J = P % N V = permutation(nnz) + 1 A = coo_matrix( (V,(I,J)) , shape=(M,N)) filename ...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus & ...
Python
import os import glob from warnings import warn cusp_abspath = os.path.abspath("../../cusp/") # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # this function builds a trivial source file from a Cusp header def trivial_source_from_header(...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
#!/usr/bin/env python import os,csv device_id = '0' # index of the device to use binary_filename = '../spmv' # command used to run the tests output_file = 'benchmark_output.log' # file where results are stored # The unstructured matrices are available online: # http://www.nvidia.com/con...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
#!/usr/bin/env python2 import os import re def rmlast(flist): """ Given a package filename list, this function removes from the list only the latest version of the package, examples: >>> rmlast(['b-1.0', 'd-2.0', 'a-10.1', 'b-2.0', 'b-3.0', 'c-1.0', 'a-2.0']) ['a-2.0', 'b-1.0', 'b-2.0'] >>> r...
Python
"""Setup the fileupload application""" import logging from paste.deploy import appconfig from pylons import config from fileupload.config.environment import load_environment log = logging.getLogger(__name__) def setup_config(command, filename, section, vars): """Place any commands to setup fileupload here""" ...
Python
# -*- coding: utf-8 -*- import formencode from formencode import validators from formencode import NestedVariables __all__ = ['FileUploadForm'] class FileUploadForm(formencode.Schema): allow_extra_fields = True pre_validators = [NestedVariables()] files = formencode.ForEach(validators.FileUploadKeeper())...
Python
from fileupload.lib.base import * class TemplateController(BaseController): def form(self): return render('/form.mako') def view(self, url): """By default, the final controller tried to fulfill the request when no other routes match. It may be used to display a template wh...
Python
# -*- coding: utf-8 -*- import logging import shutil import os import formencode.validators from pylons.decorators import decorator from fileupload.lib.base import * from fileupload.model.forms import FileUploadForm log = logging.getLogger(__name__) class BaseUploadController(BaseController): validate_sc...
Python
import os.path import paste.fileapp from pylons.middleware import error_document_template, media_path from fileupload.lib.base import * class ErrorController(BaseController): """Generates error documents as and when they are required. The ErrorDocuments middleware forwards to ErrorController when error ...
Python
"""Pylons application test package When the test runner finds and executes tests within this directory, this file will be loaded to setup the test environment. It registers the root directory of the project in sys.path and pkg_resources, in case the project hasn't been installed with setuptools. It also initializes t...
Python
"""Pylons environment configuration""" import os from pylons import config import fileupload.lib.app_globals as app_globals import fileupload.lib.helpers from fileupload.config.routing import make_map def load_environment(global_conf, app_conf): """Configure the Pylons environment via the ``pylons.config`` o...
Python
"""Pylons middleware initialization""" from paste.cascade import Cascade from paste.registry import RegistryManager from paste.urlparser import StaticURLParser from paste.deploy.converters import asbool from pylons import config from pylons.error import error_template from pylons.middleware import error_mapper, ErrorD...
Python
"""Routes configuration The more specific and detailed routes should be defined first so they may take precedent over the more generic routes. For more information refer to the routes manual at http://routes.groovie.org/docs/ """ from pylons import config from routes import Mapper def make_map(): """Create, confi...
Python
"""The base Controller API Provides the BaseController class for subclassing, and other objects utilized by Controllers. """ from pylons import c, cache, config, g, request, response, session from pylons.controllers import WSGIController from pylons.controllers.util import abort, etag_cache, redirect_to from pylons.de...
Python
"""The application's Globals object""" from pylons import config class Globals(object): """Globals acts as a container for objects available throughout the life of the application """ def __init__(self): """One instance of Globals is created during application initialization and is ava...
Python
"""Helper functions Consists of functions to typically be used within templates, but also available to Controllers. This module is available to both as 'h'. """ from webhelpers import *
Python
try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages setup( name='fileupload', version="", #description='', #author='', #author_email='', #url='', install_require...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import htmlentitydefs import logging import logging.handlers import os import re import string import sys import time import ConfigParser import cPickle as pickle SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0])) CONFIG_FILE = os.path.join(SCRIPT_DIR, 'wfg.cfg...
Python
import os.path import fjol from zope.app.testing.functional import ZCMLLayer ftesting_zcml = os.path.join( os.path.dirname(fjol.__file__), 'ftesting.zcml') FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')
Python
import grok class fjol(grok.Application, grok.Container): pass class Index(grok.View): pass # see app_templates/index.pt
Python
# this directory is a package
Python
# vim:fileencoding=utf-8 Include("Page.py") vPool['Head'] = "个人信息" vPool['SectionName'] = "Member" vPool['SectionLink'] = '#' vPool['PageName'] = "个人信息" sess = Session() try: try: uid = THIS.path.split('?',1)[1] other = True except (ValueError,IndexError): other = False ...
Python
# vim:fileencoding=utf-8 from buzhug import Base from datetime import date,datetime from database import thread_to_tr from database import get_max from database import article_to_div from database import article_to_textarea article = Base('database/article').open() Include("Page.py") vPool['Head'] = "Forum" vPool['Se...
Python
# vim:fileencoding=utf-8 Include("Page.py") try: problem_id = _pid except (NameError): problem_id = "" vPool['Head'] = "Submit Your Answer" vPool['SectionName'] = "Problems" vPool['SectionLink'] = 'browse' vPool['PageName'] = "Submit" vPool['Main'] = ''' <form action="#" method="post" class="f-wrap-1...
Python
# vim:fileencoding=utf-8 Include("Page.py") vPool['Head'] = "Running Status" vPool['SectionName'] = "Problems" vPool['SectionLink'] = 'browse' vPool['PageName'] = "Runs Status" vPool['moreMeta'] = '<META HTTP-EQUIV="REFRESH" CONTENT=20>\n' sess = Session() try: argument = THIS.path.split('?',1)[1] #print a...
Python
# vim:fileencoding=utf-8 from buzhug import Base from datetime import date,datetime from database import problem_to_tr Include("Page.py") def show_all(): '''show all problem sets''' problem = Base('database/problem').open() vPool['Main'] = ''' <p>Currently, we only have a few test probl...
Python
# vim:fileencoding=utf-8 from buzhug import Base if not locals().has_key('_sid'): print "Tell Me Which Submission You Want to see." else: submit = Base('database/submit').open() record = submit[int(_sid)] lang = ["unknow","shBrushUnknow.js"] if record.lang in ['C','C++']: lang = ["cpp","shB...
Python
# vim:fileencoding=utf-8 # from database import SameNameError Include('Page.py') vPool['moreJS'] ='''<script type="text/javascript" src="js/validation.js"></script> <script type="text/javascript"> // 密码两此相同 ( from http://ajaxcn.org/comments/start/2006-05-22/1 ,thanks macro...
Python
# vim:fileencoding=utf-8 import os cmd = "bash judge/run.sh /deal/result.exe " os.system("dir")
Python
# vim:fileencoding=utf-8 #简化引用对象名 from Cheetah.Template import Template as ctTpl vPool = {} vPool['moreMeta'] = "" vPool['moreJS'] = "" vPool['moreCSS'] = "" vPool['Head'] = "Welcome To Filia's Judge Online" vPool['status'] = ''' Click Here to <a href="login">Login</a> or <a href="register">register</a> ''' vPool[...
Python
# vim:fileencoding=utf-8 Include("Page.py") vPool['Head'] = "Solve Problems" vPool['SectionName'] = "Problems" vPool['SectionLink'] = 'browse' vPool['PageName'] = "Solve Record" sess = Session(); try: uid = sess.user_id except AttributeError: uid = "" try: uid = uid = THIS.path.split('?',1)[1] except (...
Python
# vim:fileencoding=utf-8 session=Session() session.close() raise HTTP_REDIRECTION, "index"
Python
# vim:fileencoding=utf-8 Include("Page.py") ShowPage();
Python
# vim:fileencoding=utf-8 Include("Page.py") vPool['Head'] = "Login" vPool['SectionName'] = "Member" vPool['SectionLink'] = '#' vPool['PageName'] = "Login" vPool['Main'] = ''' <form action="#" method="post" class="f-wrap-1"> <fieldset> <!--h3>Form title here</h3--> ...
Python
# vim:fileencoding=utf-8 from buzhug import Base from datetime import date,datetime import string,os,time import filecmp subcode = Base('database/submit').open() sleep_time = 5 ret ="" while True: unjudged = subcode.select_for_update(status = 6) if len(unjudged) == 0: print "No Unjudged S...
Python
# vim:fileencoding=utf-8 from buzhug import Base from datetime import date,datetime from database import contest_to_tr from database import contest_detail_to_div contests = Base('database/contest').open() Include("Page.py") vPool['Head'] = "Contests" vPool['SectionName'] = "Contests" vPool['SectionLink'] = '#' vPool[...
Python
# vim:fileencoding=utf-8 from buzhug import Base from datetime import date,datetime def build_problem(): try: print "Build the problem Database........" problem = Base('database/problem') problem.create(('problem_id',str),('title',unicode),('time_limit',int),('memory_limit',int),("source",u...
Python
import string import random lletras = [c for c in string.printable if c in string.letters] random.shuffle(lletras) letras = ''.join(lletras) lnumeros = [d for d in string.digits] random.shuffle(lnumeros) numeros = ''.join(lnumeros) random.shuffle(lletras) random.shuffle(lnumeros) letrasnumeros = (''.joi...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # estructuras.py # TODO # # Ver que si se está en la raíz, el directorio de trabajo se toma como "None" o "/" # from datetime import datetime class Error(Exception): """Clase base para excepciones""" pass class SistemaArchivosError(Error): """Clase base...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # estructuras.py # TODO # # Ver que si se está en la raíz, el directorio de trabajo se toma como "None" o "/" # from datetime import datetime class Error(Exception): """Clase base para excepciones""" pass class SistemaArchivosError(Error): """Clase base...
Python
import wsgiref.handlers from google.appengine.ext import webapp import unittest from datetime import datetime import frontpage import gallery from pixeltoy import model from pixeltoy import colorlib from pixeltoy import datelib class PixelToyTest(unittest.TestCase): def testMakeMainPageOnLocalhost(self): hand...
Python
#!/usr/bin/env python # png.py - PNG encoder in pure Python # Copyright (C) 2006 Johann C. Rocholl <johann@browsershots.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restrict...
Python
import wsgiref.handlers from google.appengine.ext import webapp from pixeltoy import model class GetSnapshotImage(webapp.RequestHandler): def get(self): try: id = int(self.request.get('id')) except ValueError: return snapshot = model.Snapshot.get_by_id(ids=id) if snapshot is None: ...
Python
import wsgiref.handlers from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.api import users from datetime import datetime import logging import string import StringIO import urllib from pixeltoy import datelib from pixeltoy import header from pixeltoy import model from p...
Python
import wsgiref.handlers from google.appengine.ext import webapp from google.appengine.ext import db import string import StringIO from pixeltoy import colorlib from pixeltoy import model from pixeltoy import tracker from pixeltoy import header page_template = string.Template(''' <!DOCTYPE html PUBLIC "-//W3C//DTD XH...
Python
print "Content-Type: text/plain" print print "ok"
Python
from google.appengine.api import users import string not_signed_in_template = string.Template(''' <div id='header'><a href="$login_url">Sign in</a></div> ''') signed_in_template = string.Template(''' <div id='header'>$nickname | <a href="$logout_url">Sign out</a></p></div> ''') def make_header_html(login_dest_url):...
Python
import array import math starting_color = None color_names = [] snapshot_pixel_size = 8 color_rgb_chunks = {} palette_size = (4,20) def _make_spectrum_rgb(): "Creates a list of (r,g,b) triplets for colors in a spectrum from red to violet" corners = [(1,0,0), (1,1,0), (0,1,0), (0,1,1), (0,0,1), (1,0,1), (1,...
Python
import string tracker_template = string.Template(''' <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <s...
Python
from google.appengine.ext import db import array import logging import png import StringIO from pixeltoy import colorlib class Props(object): pass grid_size = Props() grid_size.width = 32 grid_size.height = 32 snapshot_pixel_size = colorlib.snapshot_pixel_size class Pixels(db.Model): """A grid of pixels where ...
Python
import re from datetime import datetime iso_format = re.compile(r"(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).(\d\d\d\d\d\d)Z$") class ParseError(Exception): pass def to_isodate(a_datetime): return a_datetime.isoformat() + 'Z' def from_isodate(date_string): m = iso_format.search(date_string) if not ...
Python
import logging import wsgiref.handlers from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext import db from pixeltoy import model def show_error_page(response, message): response.headers['Content-Type'] = "text/plain" response.set_status(400) response.out.wri...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus & ...
Python
from scipy.sparse import coo_matrix from scipy.io import mmwrite from numpy.random import permutation M = N = 10 for nnz in [0, 1, 2, 5, 8, 10, 15, 20, 30, 50, 80, 100]: P = permutation(M * N)[:nnz] I = P / N J = P % N V = permutation(nnz) + 1 A = coo_matrix( (V,(I,J)) , shape=(M,N)) filename ...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus & ...
Python
import os import glob from warnings import warn cusp_abspath = os.path.abspath("../../cusp/") # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # this function builds a trivial source file from a Cusp header def trivial_source_from_header(...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
#!/usr/bin/env python import os,csv device_id = '0' # index of the device to use binary_filename = '../spmv' # command used to run the tests output_file = 'benchmark_output.log' # file where results are stored # The unstructured matrices are available online: # http://www.nvidia.com/con...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus...
Python
import unittest class Test(unittest.TestCase): def testPrueba(self): a=2 b=2 c= a+b self.assertEqual(c, 4) if __name__ == "__main__": #import sys;sys.argv = ['', 'Test.testPrueba'] unittest.main()
Python
import unittest from disc import Disc from fileSystem import FileSystem from directoryEntry import DirectoryEntry class Test(unittest.TestCase): def testDirectoryRoot(self): disc= Disc(12) fs= FileSystem(disc) root = fs.currentDirectory self.assertF...
Python
import unittest from disc import Disc from fileSystem import FileSystem class Test(unittest.TestCase): def testCreateArchive(self): disc= Disc(16) fs= FileSystem(disc) fs.createArchive("tp.txt", 2) currentDirectory= fs.currentDirectory ...
Python
from datetime import datetime class Inode: def __init__(self,inodeId): ''' La variable directiones, solo almacena 3 direciones de bloques de disco. Porque nuestra estructura de Inode esta definida asi. las claves para acceder a los campos son 1, 2 y 3. ''' self...
Python
from freeBlocksTable import FreeBlocksTable from freeInodesTable import FreeInodesTable class Disc: def __init__(self, size): self.dataBlocks = [] self.size = size self.freeblocks = FreeBlocksTable() self.freeInodes = FreeInodesTable() self.inodos={} ...
Python
class FreeInodesTable: def __init__(self): self.table={} def setAsFree(self,iNodeId): self.table[iNodeId]=True def findFreeInode(self): if not self.isEmpty(): for i in self.table: if self.table[i]==True: self.t...
Python
from directoryEntry import DirectoryEntry from iNode import Inode class FileSystem: def __init__(self, disc): self.disc = disc self.formatDisc() self.currentDirectory = self.rootDir("/") def formatDisc(self): self.disc.freeblocks.initialize(self.di...
Python