本文整理汇总了Python中psyco.full函数的典型用法代码示例。如果您正苦于以下问题:Python full函数的具体用法?Python full怎么用?Python full使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了full函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: simulationTestAllThread
def simulationTestAllThread(self):
self.lock = Lock()
import psyco
psyco.full()
settingsToRun = {}
settings = dir(Global)
settingsToRunLen = []
for setting in settings:
if setting.endswith("TESTSET"):
a = getattr(Global, setting)
settingName = setting.split("TESTSET")[0]
settingsToRun[settingName] = a
settingsToRunLen.append(len(a))
#settingsToRun contains all set data to run
if len(settingsToRunLen) < 1:
settingsCount = 1
else:
settingsCount = reduce(lambda x,y: x*y, settingsToRunLen)
self.testToRunCount = settingsCount * len(Config.GetConfigs()) * len(Global.RandomSeeds)
self.currentTestIndex = 0
self.testRunStarted = time.time()
self.simulationTestAllRecursive(settingsToRun)
开发者ID:jakubkotrla,项目名称:spacemap,代码行数:25,代码来源:MainWindow.py
示例2: main
def main():
psyco.full()
usage = "usage: %prog [options] arm_program"
parser = OptionParser(usage=usage)
parser.add_option(
"-e", "--entry", dest="entry_point", default=0, help="Entry point where te program starts, default 0"
)
parser.add_option("-l", "--loadaddr", dest="load_addr", default=0, help="Load addr of the program, default 0")
parser.add_option(
"-m", "--memsize", dest="memory_size", default=128 * 1024, help="Size of memory in bytes, default 131072 (128k)"
)
parser.add_option(
"-H", "--halt", dest="halt", default=False, action="store_true", help="Dont run the program automatically"
)
(options, args) = parser.parse_args()
if len(args) != 1:
parser.print_help()
return
else:
try:
programName = args[0]
program = open(programName, "r")
except IOError:
print "ARM Program %s does not exist" % programName
return
init(program, options)
开发者ID:iamedu,项目名称:armdev,代码行数:28,代码来源:simulator.py
示例3: main
def main(args):
psyco.full()
list_nodes = [str(n) for n in xrange(1,201)]
# test_list = [random.sample(list_nodes, 200) for i in xrange(100)]
edges = get_edges_from_file("./benchmarks/brock200_3.clq")
# edges = get_edges_from_file("./benchmarks/In200_40_13_0.txt")
# edges = get_edges_from_file("./benchmarks/MANN_a9.clq")
start = time.time()
graph = Graph(edges)
print "graph: elapsed time - ", time.time() - start
# psyco.cannotcompile(graph.induced_subgraph_2)
# print "graph: elapsed time - ", time.time() - start
start = time.time()
copy = graph.dcopy()
print "copy: elapsed time - ", time.time() - start
start = time.time()
for i in xrange(1, 201):
subgraph = graph.induced_subgraph(str(i))
print "subgraph: elapsed time - ", time.time() - start
# start = time.time()
# for i in xrange(1, 201):
# subgraph = graph.induced_subgraph_2(str(i))
# print "subgraph_c: elapsed time - ", time.time() - start
start = time.time()
graph.remove_nodes(list_nodes)
print "remove: elapsed time - ", time.time() - start
开发者ID:alsmadi,项目名称:clik,代码行数:26,代码来源:benchmark_networkx.py
示例4: makeService
def makeService(config):
# Use psyco if available
try:
import psyco
psyco.full()
except ImportError:
pass
# configuration file
configfile = yaml.load(file(config['config'], 'rb').read())
# database
dbpool = Database(configfile).pool
application = service.MultiService()
collector = CollectorService(configfile, dbpool)
collector.setServiceParent(application)
web = internet.TCPServer(int(config['port']),
appserver.NevowSite(MainPage(configfile,
dbpool,
collector)),
interface=config['interface'])
web.setServiceParent(application)
return application
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:25,代码来源:service.py
示例5: install_psyco
def install_psyco():
"Install the psyco optimizer."
try:
import psyco
psyco.full()
except ImportError:
logging.warning("Could not enable psyco.")
开发者ID:merriam,项目名称:beancount,代码行数:7,代码来源:__init__.py
示例6: __init__
def __init__(self, parent):
self._init_ctrls(parent)
psyco.full()
self.laserscanner = HokuyoLaserScanner()
self.localisation = Localisation(400)
self.naofinder = NAOFinder(self.localisation)
self.network = Network()
## control variables
self.control = numpy.zeros(3)
# automatic
self.state = 'init' # states: init, chase, position, lost
self.statecount = 0
self.targetnumber = 0
#self.targets = [[250, -100], [250, 100], [50, 100], [50, -100]]
#self.targets = [[275, -10], [275, 10], [50, 10], [50, -10]]
self.targets = [[275, 0], [50, 0]]
# manual
self.up = False # set these to true when the key is pressed!
self.down = False
self.left = False
self.right = False
self.distance = 0
self.bearing = 0
self.orientation = 0
self.CartesianPanel.setNaoFinder(self.naofinder)
self.NaoPanel.setNaoFinder(self.naofinder)
self.NaoPanel.setLocalisation(self.localisation)
self.closed = False
开发者ID:RJianCheng,项目名称:naowalkoptimiser,代码行数:32,代码来源:MainFrame.py
示例7: __init__
def __init__(self):
pygamesman.export(
gInitialPosition = long(self.gInitialPosition),
gNumberOfPositions = long(self.gNumberOfPositions),
kBadPosition = long(self.kBadPosition),
kGameSpecificMenu = bool(self.kGameSpecificMenu),
kPartizan = bool(self.kPartizan),
kDebugMenu = bool(self.kDebugMenu),
kTieIsPossible = bool(self.kTieIsPossible),
kLoopy = bool(self.kLoopy),
kDebugDetermineValue = bool(self.kDebugDetermineValue),
kAuthorName = str(self.kAuthorName),
kGameName = str(self.kGameName),
kHelpGraphicInterface = str(self.kHelpGraphicInterface),
kHelpTextInterface = str(self.kHelpTextInterface),
kHelpOnYourTurn = str(self.kHelpOnYourTurn),
kHelpStandardObjective = str(self.kHelpStandardObjective),
kHelpReverseObjective = str(self.kHelpReverseObjective),
kHelpTieOccursWhen = str(self.kHelpTieOccursWhen),
kHelpExample = str(self.kHelpExample),
kDBName = str(self.kDBName))
# Import psyco for JIT compilation, if available
try:
import psyco
psyco.full()
except ImportError:
pass
pygamesman.initialize(sys.argv, self.call)
开发者ID:DhruvRelwani,项目名称:GamesmanClassic,代码行数:28,代码来源:gamesman.py
示例8: main
def main(*argv):
try: # Import Psyco if available
import psyco
psyco.full()
except ImportError:
print "psyco not available"
mainwindow = gtk.Window()
mainwindow.connect("delete_event", delete_event)
mainwindow.set_default_size(WIDTH, HEIGHT)
mainwindow.add(TheWorld)
mainwindow.show()
TheWorld.create_width = WIDTH
TheWorld.create_height = HEIGHT
TheWorld.show()
TheEden.populate()
# choose one
TheSpaceTime.timer_id = gobject.idle_add(TheSpaceTime.tick)
#TheSpaceTime.start()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
开发者ID:antoinevg,项目名称:phail,代码行数:27,代码来源:main.py
示例9: mutate
def mutate(gens, settings=DEFAULT_SETTINGS, progress=__printProgress):
global best_pred, best_prey
try:
import psyco
psyco.full()
except ImportError:
pass
for i in range(gens):
progress(i, gens) #Update the progress
#preds, preys = MutateAndScore()
preds, preys = MultiThreadedMutateAndScore()
#Find the best Pred Mask
best = 0
best_pred_mask = {}
for s, mask in preds:
if s > best:
best = s
best_pred_mask = mask
#Find the best Prey Mask
best = 0
best_prey_mask = {}
for s, mask in preys:
if s > best:
best = s
best_prey_mask = mask
#Smash the mask into the best pdf
for k,v in best_pred_mask.iteritems(): best_pred[k] = v
for k,v in best_prey_mask.iteritems(): best_prey[k] = v
progress(gens,gens)#deniz was here
开发者ID:sbadame,项目名称:PredatorsAndPrey,代码行数:35,代码来源:predpreyalgorithm.py
示例10: main
def main():
import re, sys
for arg in sys.argv:
if re.search('-help', arg, re.IGNORECASE):
gotFeedAlready = True
usage()
sys.exit()
iPXSettings.progName = 'iPodderX'
for arg in sys.argv:
if re.search('-progName', arg, re.IGNORECASE):
progNameSplit = arg.split('==')
iPXSettings.progName = progNameSplit[len(progNameSplit)-1]
firstInit()
for arg in sys.argv:
if arg == '-debug':
printMSG( '--- DEBUG ENABLED ---')
iPXSettings.DEBUG = 1
elif arg == '-superdebug':
printMSG( '--- SUPER DEBUG ENABLED ---')
import httplib
httplib.HTTPConnection.debuglevel = 1
iPXSettings.DEBUG = 1
iPXSettings.SUPERDEBUG = 1
try:
import psyco
logIt('Enabling Psyco JIT Compiler...')
psyco.full()
print passed
except Exception, msg:
pass
开发者ID:rays,项目名称:ipodderx-core,代码行数:34,代码来源:iPXAgent.py
示例11: main_run
def main_run():
global cm, coords, WIDTH, HEIGHT
coords = [(random.randint(0, WIDTH), random.randint(0, HEIGHT))
for i in xrange(CITIES)]
cm = cartesian_matrix(coords)
genome = G1DList.G1DList(len(coords))
genome.evaluator.set(lambda chromosome: tour_length(cm, chromosome))
genome.crossover.set(Crossovers.G1DListCrossoverEdge)
genome.initializator.set(G1DListTSPInitializator)
# 3662.69
ga = GSimpleGA.GSimpleGA(genome)
ga.setGenerations(200000)
ga.setMinimax(Consts.minimaxType["minimize"])
ga.setCrossoverRate(1.0)
ga.setMutationRate(0.02)
ga.setPopulationSize(80)
# This is to make a video
ga.stepCallback.set(evolve_callback)
# 21666.49
import psyco
psyco.full()
ga.evolve(freq_stats=500)
best = ga.bestIndividual()
if PIL_SUPPORT:
write_tour_to_img(coords, best, "tsp_result.png")
else:
print "No PIL detected, cannot plot the graph !"
开发者ID:erikreed-public,项目名称:Pyevolve,代码行数:33,代码来源:pyevolve_ex12_tsp.py
示例12: doctests
def doctests():
try:
import psyco
psyco.full()
except ImportError:
pass
import sys
from timeit import default_timer as clock
filter = []
for i, arg in enumerate(sys.argv):
if '__init__.py' in arg:
filter = [sn for sn in sys.argv[i+1:] if not sn.startswith("-")]
break
import doctest
globs = globals().copy()
for obj in globs: #sorted(globs.keys()):
if filter:
if not sum([pat in obj for pat in filter]):
continue
sys.stdout.write(str(obj) + " ")
sys.stdout.flush()
t1 = clock()
doctest.run_docstring_examples(globs[obj], {}, verbose=("-v" in sys.argv))
t2 = clock()
print(round(t2-t1, 3))
开发者ID:AALEKH,项目名称:sympy,代码行数:25,代码来源:__init__.py
示例13: __init__
def __init__(self,input,logger=None,verbose=True):
"""
Initialize the ShelxC process
input is whatever is passed in
pipe is the communication back to the calling process
verbose is to set the level of output
logger is logging for debugging.
"""
psyco.full()
logger.info('ShelxC.__init__')
self.input = input
self.verbose = verbose
self.logger = logger
#Setting up data input
self.setup = self.input[1]
self.header = self.input[2]
self.preferences = self.input[3]
self.data = self.input[4]
self.controller_address = self.input[-1]
self.shelx_log = []
self.shelx_results = {}
self.cell = False
self.sca = False
multiprocessing.Process.__init__(self,name='ShelxC')
#starts the new process
self.start()
开发者ID:RAPD,项目名称:RAPD,代码行数:30,代码来源:rapd_agent_shelxc_res.py
示例14: __init__
def __init__(self, bot_class, universe_class=Universe, planet_class=Planet, fleet_class=Fleet, timeout=0.95):
options, _ = parser.parse_args()
self.logging_enabled = bool(options.logfile)
self.universe = universe_class(self, planet_class=planet_class, fleet_class=fleet_class)
self.bot = bot_class(self.universe)
self.timeout = timeout
self.turn_count = 0
self._fleets_to_send = {}
if self.logging_enabled:
logging.basicConfig(filename=options.logfile,
filemode='w',
level=getattr(logging, options.loglevel),
format="%(asctime)s %(levelname)s: %(message)s",
datefmt='%H:%M:%S',)
log.info("----------- GAME START -----------")
self.has_alarm = True
try:
signal.signal(signal.SIGALRM, timeout_handler)
except AttributeError:
# signal.SIGALRM not supported on this platform
self.has_alarm = False
try:
#noinspection PyUnresolvedReferences
import psyco
psyco.full()
except ImportError:
pass
self.main()
开发者ID:jonoff,项目名称:planetwars-python-kit,代码行数:32,代码来源:game.py
示例15: process_request
def process_request(self, request):
try:
import psyco
psyco.full()
except ImportError:
pass
return None
开发者ID:barraq,项目名称:conceptnet,代码行数:7,代码来源:__init__.py
示例16: getopts
def getopts():
'''parse options'''
from optparse import OptionParser
usage = "dumping the details of similarity calculation"
parser = OptionParser(usage=usage)
parser.add_option("-i", "--input",
dest="input", default="",
help="input file")
parser.add_option("-o", "--output",
dest="output", default="",
help="output file")
parser.add_option("-f", "--format",
dest="format", default="",
help="convert to format: svm/arff/cluto/triplet")
parser.add_option("-l", "--label",
dest="label", default="",
help="label file")
parser.add_option("-d", "--dict",
dest="dict", default="",
help="dict file")
parser.add_option("-e", "--encoding", dest="encoding", default="utf8",
help="default system encoding, utf8 by default")
parser.add_option("-p", "--psyco", action='store_true',
dest="psyco", default=False,
help="to enable psyco")
options = parser.parse_args()[0]
if not options.input or not options.output or not options.format:
print "-h to see usage"
sys.exit(-1)
if options.psyco:
import psyco
psyco.full()
return options.input, options.output, options.format, options.label, options.dict, options.encoding
开发者ID:coldcolour,项目名称:pywvtool,代码行数:33,代码来源:converter.py
示例17: main
def main(testlist, verbose=0, use_resources=None):
if use_resources is None:
use_resources = []
test_support.verbose = verbose # Tell tests to be moderately quiet
test_support.use_resources = use_resources
if type(testlist) == type(""):
testlist = [testlist]
if not verbose:
testlist = filter(python_check, testlist)
# Psyco selective compilation is only activated here
psyco.log(LOGFILE, 'a')
for test in testlist:
psyco.logger.write('with test ' + test, 1)
psyco.full()
#print "sleeping, time for a Ctrl-C !..."
#import time; time.sleep(1.5)
for test in testlist:
for i in range(repeat_counter):
print '%s, Psyco iteration %d' % (test, i+1)
ok = regrtest.runtest(test, 0, verbose, 0)
special_cleanup()
if ok == 0:
return 0
elif ok < 0:
break
return 1
开发者ID:Galland,项目名称:nodebox-opengl,代码行数:30,代码来源:classicregrtest.py
示例18: run_or_profile
def run_or_profile(suite):
runner = unittest.TextTestRunner(verbosity=2)
args = sys.argv[1:]
if '-P' in args or '-PP' in args:
try:
import psyco
if '-PP' in sys.argv[1:]:
psyco.profile()
else:
psyco.full()
print "Using Psyco."
except:
pass
if '-p' in args:
import os, hotshot, hotshot.stats
LOG_FILE="profile.log"
profiler = hotshot.Profile(LOG_FILE)
profiler.runcall(runner.run, suite)
profiler.close()
stats = hotshot.stats.load(LOG_FILE)
stats.strip_dirs()
stats.sort_stats('time', 'calls')
stats.print_stats(60)
try:
os.unlink(LOG_FILE)
except:
pass
else:
runner.run(suite)
开发者ID:BackupTheBerlios,项目名称:slow-svn,代码行数:35,代码来源:tests.py
示例19: postOptions
def postOptions(self):
self['_origdir'] = os.getcwd()
# Want to do this stuff as early as possible
_setUpTestdir()
_setUpLogging(self)
def _mustBeInt():
raise usage.UsageError("Argument to --random must be a positive integer")
if self['random'] is not None:
try:
self['random'] = long(self['random'])
except ValueError:
_mustBeInt()
else:
if self['random'] < 0:
_mustBeInt()
elif self['random'] == 0:
self['random'] = long(time.time() * 100)
if not self.has_key('tbformat'):
self['tbformat'] = 'default'
if self['psyco']:
try:
import psyco
psyco.full()
except ImportError:
print "couldn't import psyco, so continuing on without..."
if self['nopm']:
if not self['debug']:
raise usage.UsageError, "you must specify --debug when using --nopm "
failure.DO_POST_MORTEM = False
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:34,代码来源:trial.py
示例20: _activatePsyco
def _activatePsyco(self):
"""Import Psyco if available"""
try:
import psyco
psyco.full()
except ImportError:
pass
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:7,代码来源:sf_OIS.py
注:本文中的psyco.full函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论