code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
"""Classes to build sanitized HTML."""
__author__ = 'John Orr (jorr@google.com)'
import cgi
import re
def escape(strg):
return cgi.escape(strg, quote=1).replace("'", ''').replace('`', '`')
class Node(object):
"""Base class for the sanitizing module."""
@property
def sanitized(self):
... | Python |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python |
#!/usr/bin/env python
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python |
#!/usr/bin/env python
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python |
#!/usr/bin/env python
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python |
#!/usr/bin/env python
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python |
'''
Experimental attempt to port the genetic algorithm to active learning,
thus removing the need for a test file. This is a big deal, as it
means we only need the data sources set up in order to produce a full,
working configuration.
The basic idea is stolen from this paper
http://svn.aksw.org/papers/2012/ESWC_EAGL... | Python |
'''
Genetic algorithm for automatically creating a configuration. See
http://code.google.com/p/duke/wiki/GeneticAlgorithm
for information on how to use it.
NOTE that this script has now been superceded by Java code in the
no.priv.garshol.duke.genetic package.
'''
import random, sys, threading, time, os
from java.u... | Python |
#"This is a pain in the butt"
class party:
def __init__(self):
self.first_name = ""
self.last_name = ""
self.street_address = ""
self.city = ""
self.zip = ""
self.mobile = ""
self.home = ""
self.work = ""
self.email = ""
self.cases = [... | Python |
#!/usr/bin/python
import tkinter
#from tkinter.constants import *
#def prompt_question(question):
#class gui:
application = tkinter.Tk()
#label = tkinter.Label(application, text="bob")
#label.pack()
#frame = tkinter.Frame(self.application, relief=RIDGE, borderwidth=17)
#frame.pack(fill=BOTH,expand=1)#
label = ... | Python |
#Homicide
class crime:
def set_person(name):
if type(name) == str:
name = crime.actor()
return name
class person:
__definition = "\"Person,\" when referring to the victim of a homicide, means a h... | Python |
from tkinter import *
from tkinter import ttk
class display:
def __init__(self):
self.question = "question"
root = Tk()
root.title("Tom's sample program")
mainframe = ttk.Frame(root, padding="3 8 13 18")
mainframe.pack()
def getvalue():
arb = display.entry.get()
... | Python |
import tkinter
import tkinter.constants as TKC
import tkinter.ttk as ttk
import time
import calendar
#from tkinter.constants import *
style = ttk.Style()
style.configure("day_header", width=20, foreground="black", background="white", relief=TKC.FLAT)
#Python handles time in a funny fashion
localtime = time.localti... | Python |
#
class time_tracker:
benchmark = {} #activity will be the key; the value will be time()
def __init__():
from time import *
time_tracker.begin_time = time()
def set_benchmark(activity):
if type(activity) == str:
time_tracker.benchmark[activity] = time()
... | Python |
#!/usr/bin/python
#from tkinter import *
# Name
# Class
# Teacher
# Room Location
# Schedule
# Days
# Time on said days
# Other information from syllabus
# Assignment for each day.
#
#Example (Hello, World):
import tkinter
import tkinter.constants as TKC
import tkinter.ttk as ttk
class View(object):
... | Python |
class CalendarHelp:
def __init__(self):
from time import localtime
self.Months = {'1':'Jan','2':'Feb','3':'Mar','4':'Apr','5':'May','6':'Jun','7':'Jul','8':'Aug','9':'Sep','10':'Oct','11':'Nov','12':'Dec'}
#Python handles time in a funny fashion
self.localtime = localtime()
... | Python |
class case:
plaintiffs = []
prosecution = plaintiffs
defendants = []
statement_of_case = ""
criminal = False
court = ""
def add_plaintiff(party):
case.plaintiffs.append(party)
case.show_plaintiffs()
def add_defendant(party):
case.defendants.append(party)
... | Python |
#Rules.py
#Agencies must should inherit
class FRCP:
def __init__(self):
if case.jurisdiction != "Federal":
return "This is not a federal matter."
if case.criminal == True:
return "This is not a civil case. Please use rules of criminal procedure."
class filing:
... | Python |
from tkinter import *
from tkinter import ttk
def calculate(*args):
try:
value = float(display.feet.get())
display.meters.set((0.3048 * value * 10000.0 + 0.5)/10000.0)
except ValueError:
pass
class display:
root = Tk()
root.title("Feet to Meters")
style = ttk.Style()
st... | Python |
import tkinter
import tkinter.constants as TKC
import tkinter.ttk as ttk
import database #my own class for database functions.
#import UI #my own class. It is an empty class to hold tkinter UI variables, so that they are not in the global namespace.
import calendarHelp
application = tkinter.Tk()
DB = database.Databa... | Python |
########################## MODEL ######################################
class Model(object):
import database
DB = database.Database('puffin')
#OLD CODE: sql = sqlite3.connect('puffin') #connects to database. creates it if it does not exist.
#OLD CODE: queryCurs = sql.cursor() #cursor allows you... | Python |
import sqlite3
class Database:
def __init__(self, databaseName="puffin"):
self.sql = sqlite3.connect('puffin') #connects to database. creates it if it does not exist.
self.queryCurs = self.sql.cursor() #cursor allows you to run queries.
def select(self, table_name, params, requested_field... | Python |
import tkinter
import tkinter.constants as TKC
import tkinter.ttk as ttk
class View:
def __init__(self):
global root
root = tkinter.Tk()
class tk:
def Entry(parent, varRegister):
variable = tkinter.StringVar()
varRegister.append(variable)
self = tkinter.Ent... | Python |
#!/usr/bin/env python
"""
Simple tests for basic python-csp functionality.
Copyright (C) Sarah Mount, 2009.
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 y... | Python |
#!/usr/bin/env python
# -*- mode:python; coding:utf-8; -*-
# Calculation of Pi using quadrature. Using the python-csp package by Sarah Mount.
#
# Copyright © 2009-10 Russel Winder
import time
import multiprocessing
import sys
sys.path.insert(0, "../..")
from csp.csp import *
@process
def calculator ( channel , ... | Python |
#!/usr/bin/env python
# -*- mode:python; coding:utf-8; -*-
# Calculation of Pi using quadrature. Using the python-csp package by Sarah Mount.
#
# Copyright © 2009-10 Russel Winder
import time
import multiprocessing
import sys
sys.path.insert(0, "../..")
from csp.csp import *
def execute ( processCount ) :
n... | Python |
#!/usr/bin/env python
# -*- mode:python; coding:utf-8; -*-
# Calculation of Pi using quadrature. Using the python-csp package by Sarah Mount.
#
# Copyright © 2009-10 Russel Winder
import time
import multiprocessing
import sys
sys.path.insert(0, "../..")
from csp.csp import *
@process
def calculator ( channel , ... | Python |
#!/usr/bin/env python
# -*- mode:python; coding:utf-8; -*-
# Calculation of Pi using quadrature. Using the python-csp package by Sarah Mount.
#
# Copyright © 2009-10 Russel Winder
import time
import multiprocessing
import sys
sys.path.insert(0, "../..")
from csp.csp import *
def execute ( processCount ) :
n... | Python |
#!/usr/bin/env python
# -*- mode:python; coding:utf-8; -*-
# Calculation of Pi using quadrature. Using the python-csp package by Sarah Mount.
#
# Copyright © 2009-10 Russel Winder
import time
import multiprocessing
import sys
sys.path.insert(0, "../..")
from csp.csp import *
def execute ( processCount ) :
n... | Python |
#!/usr/bin/env python
# -*- mode:python; coding:utf-8; -*-
# Calculation of Pi using quadrature. Using the python-csp package by Sarah Mount.
#
# Copyright © 2009-10 Russel Winder
import time
import multiprocessing
import sys
sys.path.insert(0, "../..")
from csp.csp import *
def execute ( processCount ) :
n... | Python |
import socket
HOST = socket.gethostbyname(socket.gethostname())
PORT = 8887
data = 'flibble'
# sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# # Connect to server and send data
# sock.connect((HOST, PORT))
# sock.send(data + "\n")
# # Receive data from the server and shut down
# received = sock.recv(102... | Python |
import sys
sys.path.insert(0, "..")
from csp.csp import *
from csp.guards import Timer
@process
def hello():
t = Timer()
for i in range(5):
print i
t.sleep(1)
if __name__ == '__main__':
hello() * 3
2 * hello()
| Python |
#!/usr/bin/env python
import sys
sys.path.insert(0, "..")
from csp.csp import *
from csp.builtins import Generate, Plus, Printer
in1, in2, out = Channel(), Channel(), Channel()
@process
def foo():
# Previously deadlocked
Skip() // (Generate(in1), Generate(in2), Plus(in1, in2, out), Printer(out))
# Inf... | Python |
from csp.csp import *
import random, time
@process
def customer_child(cchildout, n):
for i in xrange(3):
print "Customer's "+str(n)+" child sending "+str(i)
cchildout.write(i)
time.sleep(random.random() * 3)
return
@process
def customer(cparentout, cchildout, n):
for i in xrange(5):
#print 'customer ', n, ... | Python |
#!/usr/bin/env python
"""
Simple oscilloscope traces for python-csp.
Requires Pygame.
Features:
* Press 's' to save an oscilloscope trace as a PNG.
* Press UP and DOWN to scale the input more / less.
Copyright (C) Sarah Mount, 2009.
This program is free software; you can redistribute it and/or
modify it und... | Python |
#!/usr/bin/env python
#
# Example oscilloscope traces.
#
import sys
from csp.csp import *
from csp.builtins import Sin, Cos, GenerateFloats, Mux2, Delta2
from oscilloscope import Oscilloscope
@forever
def Random(outchan):
"""Random process.
Generates random data and writes it to outchan.
"""
import... | Python |
# Example program from Part 01 of the python-csp tutorial
# Copyright (C) Sarah Mount, 2010.
# 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 opti... | Python |
#!/usr/bin/env python
"""
Count the words in every file in a given directory.
Copyright (C) Sarah Mount, 2010.
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 (a... | Python |
#!/usr/bin/env python
# Mandelbrot set computed in parallel using python-csp.
# Multiple-producer, single consumer architecture.
# Copyright (C) Sarah Mount, 2009.
# 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 ... | Python |
#!/usr/bin/env python
from csp.csp import *
from math import sqrt
from decimal import Decimal
def genPair():
return random.random(),random.random()
g = lambda x: sqrt(1-(x*x))
perProcess = 100000
workers = 320
@process
def worker(c):
"""
readset =
writeset = c
"""
count = 0
i = 0
... | Python |
#!/usr/bin/env python
import copy, math, struct, time
from csp.csp import *
INFINITY = float('infinity')
delta = 0.000000001 # in Java this is java.lang.Math.ulp(1.0)
class Vector(object): # Use numpy arrays instead.
def __init__(self, x, y, z):
self.x, self.y, self.z = x, y, z
return
def __... | Python |
#!/usr/bin/env python
"""Python CSP full adder.
Based on code from PyCSP - Communicating Sequential Processes for
Python. John Markus Bjorndalen, Brian Vinter, Otto Anshus. CPA 2007,
Surrey, UK, July 8-11, 2007. IOS Press 2007, ISBN 978-1-58603-767-3,
Concurrent Systems Engineering Series (ISSN 1383-7575).
Copyri... | Python |
#!/usr/bin/env python
# FIXME: Nowhere near PEP8 compatible :(
from csp.csp import *
def calculateRowColumnProduct(self, A, row, B, col):
product = 0
for i in range(len(A[row])):
product += A[row][i] * B[i][col]
return product
@process
def ParcalculateRowColumnProduct(cout, A, row, B, col):
... | Python |
#!/usr/bin/env python
from csp.csp import *
from csp.builtins import Fibonacci, Generate, Multiply, Printer
if __name__ == '__main__':
c = []
c.append(Channel())
c.append(Channel())
c.append(Channel())
f = Fibonacci(c[0])
g = Generate(c[1])
m = Multiply(c[0],c[1],c[2])
p = Print... | Python |
#!/usr/bin/env python
"""
This is a python-csp implementation of the Kamaelia box, based on
Michael Spark's OCCAM code: http://pastebin.com/B1kqx88G
Copyright (C) Sarah Mount, 2010.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published ... | Python |
"""
Solution to the sleeping barber problem in python-csp.
Copyright (C) Sarah Mount, 2010.
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 l... | Python |
#!/usr/bin/env python
"""Mandelbrot set computed in parallel using python-csp.
Multiple-producer, single consumer architecture.
"""
from csp.csp import *
import logging, math, Numeric, pygame, time
__author__ = 'Sarah Mount <s.mount@wlv.ac.uk>'
__date__ = 'December 2008'
MAXITER = 100
"""@var: Number of iterations ... | Python |
#!/usr/bin/env python
"""Mandelbrot set computed in parallel using python-csp.
Multiple-producer, single consumer architecture.
Copyright (C) Sarah Mount, 2009.
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 ... | Python |
#!/usr/bin/env python
"""Mandelbrot set computed in parallel using python-csp.
Multiple-producer, single consumer architecture.
"""
from csp.csp import *
import logging, math, Numeric, pygame, time
__author__ = 'Sarah Mount <s.mount@wlv.ac.uk>'
__date__ = 'December 2008'
MAXITER = 100
"""@var: Number of iterations ... | Python |
#!/usr/bin/env python
"""Mandelbrot set computed in parallel using python-csp.
Multiple-producer, single consumer architecture.
Copyright (C) Sarah Mount, 2009.
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 ... | Python |
"""
Boids simulation using python-csp and pygame.
Part4 -- Adding full flocking behaviour.
Copyright (C) Sarah Mount, 2009.
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 L... | Python |
"""
Boids simulation using python-csp and pygame.
Part 2 -- Adding movement to the boids.
Copyright (C) Sarah Mount, 2009.
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 Li... | Python |
"""
Boids simulation using python-csp and pygame.
Part3 -- Adding basic flocking behaviour.
Copyright (C) Sarah Mount, 2009.
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 ... | Python |
"""
Boids simulation using python-csp and pygame.
Part 1 -- Setting up Pygame.
Copyright (C) Sarah Mount, 2009.
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 (... | Python |
"""
Boids simulation using python-csp and pygame.
Part4 -- Adding full flocking behaviour.
Copyright (C) Sarah Mount, 2009.
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 L... | Python |
#!/usr/bin/env python
"""
Generic interface to any USB HID sensor.
Copyright (C) Sarah Mount 2008.
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 optio... | Python |
#!/usr/bin/env python
"""
Simple oscilloscope traces for python-csp.
Requires Pygame.
Features:
* Press 's' to save an oscilloscope trace as a PNG.
* Press UP and DOWN to scale the input more / less.
Copyright (C) Sarah Mount, 2009.
This program is free software; you can redistribute it and/or
modify it und... | Python |
#!/usr/bin/env python
"""
python-csp process for Toradex Oak sensors.
Copyright (C) Sarah Mount, 2009.
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 o... | Python |
#!/usr/bin/env python
"""
Generic interface to all Toradex OAK sensors.
Copyright (C) Sarah Mount, 2008.
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... | Python |
#!/usr/bin/env python
"""
Digital signal processing for python-csp.
Copyright (C) Sarah Mount, 2009.
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 opt... | Python |
#!/usr/bin/env python
"""
Chart the output of a Toradex Oak accelerometer.
Copyright (C) Sarah Mount, 2009.
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 y... | Python |
#!/usr/bin/env python
"""Interactive interpreter for python-csp, with online help.
Features:
* CSP primitives are imported automatically.
* History is saved between sessions in C{~/.csp-console-history}.
* Tab-completion can be used to complete keywords or variables.
Copyright (C) Sarah Mount, 2009.
This program... | Python |
#!/usr/bin/env python
"""
Debugger for the pyyhon-csp library.
Copyright (C) Sarah Mount, 2010.
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) ... | Python |
#!/usr/bin/env python
from optparse import OptionParser
import csp.lint.lint
import sys
parser = OptionParser()
parser.add_option('-l', '--list', dest='listall',
action='store_true',
help='List all error messages and exit')
parser.add_option('-p', '--prog', dest='program',... | Python |
#!/usr/bin/env python
from setuptools import setup, find_packages
version = '0.1'
setup(name='python-csp',
version=version,
description="Communicating sequential processes for Python",
long_description="""\
python-csp adds communicating sequential processes to Python""",
classifiers=["Intende... | Python |
#!/usr/bin/env python
"""
Generic warnings and errors for Exstatic.
TODO: Document this module.
Copyright (C) Sarah Mount, 2010.
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... | Python |
#!/usr/bin/env python
"""
Exstatic errors and warnings for CSP.
TODO: Document this module.
Copyright (C) Sarah Mount, 2010.
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... | Python |
#!/usr/bin/env python
"""
Visitor pattern for ICODE.
Copyright (C) Sarah Mount, 2010.
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 ... | Python |
#!/usr/bin/env python
"""
Generic stack type for Python.
Copyright (C) Sarah Mount, 2010.
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 la... | Python |
"""ICODE types defined in Python.
Copyright (C) Sarah Mount, 2009.
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 progr... | Python |
#!/usr/bin/env python
"""
py2icode.py produces an ICODE representation of a Python file.
Usage: py2icode.py <in_file> ?<out_file>
<in_file> should be a python file for processing. The full path is not
needed. <out_file> is the name of the file which should store the
ICODE translation of <in_file>. If no name is gi... | Python |
import Channel as chnl
import cPickle
import uuid
from csp.guards import Guard
class CChannel(Guard):
def __init__(self):
p = uuid.uuid4().int & 0xffffff
av = uuid.uuid4().int & 0xffffff
tak = uuid.uuid4().int & 0xffffff
shm = uuid.uuid4().int & 0xffffff
self.channel = ch... | Python |
#!/usr/bin/env python
"""CSP Commstime benchmark.
See F.R.M. Barnes (2006) Compiling CSP. In Proceedings of
Communicating Process Architectures 2006.
Code adapted from PyCSP by John Markus Bjorndalen, available:
http://www.cs.uit.no/~johnm/code/PyCSP/
PyCSP - Communicating Sequential Processes for Python. John Mark... | Python |
#! /bin/env python2.6
"""
Benchmark based on variable sized ring buffer.
See also PyCSP papers in CPA2009 proceedings.
Usage: tokenring-processes.py [options]
Options:
-h, --help show this help message and exit
-t TOKENS, --tokens=TOKENS
Number of tokens in token ring
-n NODE... | Python |
#!/usr/bin/env python
"""Design pattern support for python-csp.
Copyright (C) Sarah Mount, 2010.
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)... | Python |
from csp.csp import Par, process
import sys
sys.path.append('../')
from CChannel import CChannel as Channel
del sys
@process
def out(cout):
i = 0
while True:
print ( "PYTHON: About to write " + str ( i ) + "\n" )
cout.write(i)
print ( "PYTHON: Have written " + str ( i ) + "\n" )
... | Python |
#!/usr/bin/env python
"""Python CSP full adder.
Based on code from PyCSP - Communicating Sequential Processes for
Python. John Markus Bjorndalen, Brian Vinter, Otto Anshus. CPA 2007,
Surrey, UK, July 8-11, 2007. IOS Press 2007, ISBN 978-1-58603-767-3,
Concurrent Systems Engineering Series (ISSN 1383-7575).
Copyri... | Python |
#!/usr/bin/env python
"""
Check that every process in a file has correct readsets and writesets.
Copyright (C) Sarah Mount, 2010.
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... | Python |
#!/usr/bin/env python
"""
Check for errors in process definitions.
Copyright (C) Sarah Mount, 2010.
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 opti... | Python |
#!/usr/bin/env python
"""
Combined linting for python-csp.
Copyright (C) Sarah Mount, 2010.
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 ... | 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.