100+ results results for 'python config loop' (206 ms)

Not the results you expected?
maintainer.py https://github.com/SLANG-foundation/SLANG.git | Python | 138 lines
                    
1#! /usr/bin/python
                    
2#
                    
12
                    
13import config
                    
14
                    
42        self.logger = logging.getLogger(self.__class__.__name__)
                    
43        self.config = config.Config()
                    
44        self.manager = manager
                    
60
                    
61            Start the Maintainer's infinite loop.
                    
62        """
                    
                
rescan_header.py https://gitlab.com/cdeclare/intcrypt | Python | 265 lines
                    
1#!/usr/bin/python
                    
2
                    
8
                    
9t = BoostBuild.Tester(use_test_config=False)
                    
10
                    
10
                    
11# Test a header loop that depends on (but does not contain) a generated header.
                    
12t.write("test.cpp", '#include "header1.h"\n')
                    
82
                    
83# Test a loop in generated headers.
                    
84t.write("test.cpp", '#include "header1.h"\n')
                    
132
                    
133# Test that all the dependencies of a loop are updated before any of the
                    
134# dependents.
                    
202
                    
203# Test a loop that includes a generated header
                    
204t.write("test1.cpp", '#include "header1.h"\n')
                    
                
WorkQueueManager.py https://github.com/dmwm/WMCore.git | Python | 80 lines
                    
16from WMCore.Agent.Harness import Harness
                    
17from WMCore.WorkQueue.WorkQueueUtils import queueFromConfig, queueConfigFromConfigObject
                    
18
                    
28        Harness.__init__(self, config)
                    
29        self.config = queueConfigFromConfigObject(config)
                    
30
                    
44                    WorkQueueManagerReqMgrPoller(
                    
45                            queueFromConfig(self.config),
                    
46                            getattr(self.config.WorkQueueManager,
                    
69        myThread.workerThreadManager.addWorker(
                    
70                WorkQueueManagerLocationPoller(queueFromConfig(self.config),
                    
71                                               self.config),
                    
75        myThread.workerThreadManager.addWorker(
                    
76                WorkQueueManagerCleaner(queueFromConfig(self.config),
                    
77                                        self.config),
                    
                
CyclicSymbolicBoundedLTLEvaluation.py https://github.com/dparalen/cycle-evaluation.git | Python | 151 lines
                    
38class Or(le.Or):
                    
39	def __call__(self, Expressions, position = 0, length = 0, loop = 0):
                    
40		ltl_expressions, other_expressions = _split_expressions(Expressions)
                    
41		return NOE(ee.Or(), Expressions = map(lambda x: x(position,
                    
42			length, loop), ltl_expressions) + map(lambda x: EvaluationExpression(x,
                    
43				position), other_expressions))
                    
60				# in loop
                    
61				return Expression(loop + ((position - loop + 1)%(length - loop)),
                    
62						length, loop)
                    
65class Globally(le.Globally):
                    
66	def __call__(self, Expression, position = 0, length = 0, loop = 0):
                    
67		if _ltl_expression(Expression):
                    
81					[ Expression(j, length, loop) for j in xrange(
                    
82						min(position, loop), length)]
                    
83				)
                    
                
test_converge.py https://gitlab.com/unofficial-mirrors/openstack-heat | Python | 42 lines
                    
1#!/usr/bin/env python
                    
2#
                    
20from heat.tests.convergence.framework import testutils
                    
21from oslo_config import cfg
                    
22
                    
40        runner = scenario.Scenario(self.name, self.path)
                    
41        runner(self.procs.event_loop,
                    
42               **testutils.scenario_globals(self.procs, self))
                    
                
test_tcp.py https://gitlab.com/x1046882802/flexiroutervpp | Python | 115 lines
                    
1#!/usr/bin/env python3
                    
2
                    
22        self.vapi.session_enable_disable(is_enable=1)
                    
23        self.create_loopback_interfaces(2)
                    
24
                    
31                tbl = VppIpTable(self, table_id)
                    
32                tbl.add_vpp_config()
                    
33
                    
34            i.set_table_ip4(table_id)
                    
35            i.config_ip4()
                    
36            table_id += 1
                    
37
                    
38        # Configure namespaces
                    
39        self.vapi.app_namespace_add_del(namespace_id="0",
                    
39        self.vapi.app_namespace_add_del(namespace_id="0",
                    
40                                        sw_if_index=self.loop0.sw_if_index)
                    
41        self.vapi.app_namespace_add_del(namespace_id="1",
                    
                
asp_tool.py https://bitbucket.org/duventj/nrfasp.git | Python | 137 lines
                    
1#!/usr/bin/env python3
                    
2# @author Mehdi MAAREF
                    
98    self.do_mirf_read_all()
                    
99  def do_mirf_config(self, args=''):
                    
100    print(self.device.set_rx())
                    
125    try:
                    
126      p.cmdloop()
                    
127    except KeyboardInterrupt:
                    
                
monitor.py https://github.com/ximenesuk/openmicroscopy.git | Python | 74 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
12import unittest, logging, threading, time
                    
13logging.basicConfig(level=logging.INFO)
                    
14
                    
32    def testBadFileId(self):
                    
33        # Could cause infinite loop
                    
34        self.assertRaises(omero.ApiUsageException, MockMonitor().fsEventHappened, '',[monitors.EventInfo()])
                    
                
monitor.py https://github.com/cneves/openmicroscopy.git | Python | 73 lines
                    
1#!/usr/bin/env python
                    
2
                    
11import unittest, logging, threading, time
                    
12logging.basicConfig(level=logging.INFO)
                    
13
                    
31    def testBadFileId(self):
                    
32        # Could cause infinite loop
                    
33        self.assertRaises(omero.ApiUsageException, MockMonitor().fsEventHappened, '',[monitors.EventInfo()])
                    
                
04_restore_withdevices_pos.py https://gitlab.com/wkyu/gxen | Python | 130 lines
                    
1#!/usr/bin/python
                    
2
                    
12
                    
13config = {"disk": ["phy:/dev/ram0,xvda1,w", "phy:/dev/ram1,xvdb2,w"],
                    
14          "vif":  ['', '']}
                    
14          "vif":  ['', '']}
                    
15domain = XmTestDomain(extraConfig=config)
                    
16
                    
50
                    
51    run = console.runCmd("ifconfig eth0 172.30.206.1 netmask 255.255.255.240")
                    
52    if run["return"] != 0:
                    
52    if run["return"] != 0:
                    
53        FAIL("Unable to configure DomU's eth0")
                    
54
                    
54
                    
55    run = console.runCmd("ifconfig eth1 172.30.206.17 netmask 255.255.255.240")
                    
56    if run["return"] != 0:
                    
                
poolqueue.py https://github.com/fish2000/django-signalqueue.git | Python | 102 lines
                    
1#!/usr/bin/env python
                    
2# encoding: utf-8
                    
12"""
                    
13from tornado.ioloop import PeriodicCallback
                    
14
                    
40        
                    
41        # use interval from the config if it exists
                    
42        interval = kwargs.get('interval', self.signalqueue.queue_interval)
                    
                
step5_export_for_map.py https://gitlab.com/dlts/github-africa | Python | 83 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
14logger = logging.getLogger(__name__)
                    
15logging.basicConfig(level=logging.DEBUG)
                    
16
                    
33
                    
34logger.info("Looping through users to build maps")
                    
35for user in all_users:
                    
52
                    
53logger.info("Looping through countries to write to CSV")
                    
54for country_code, country in countries_map.items():
                    
65
                    
66logger.info("Looping through cities to write to CSV")
                    
67for city_name, city in cities_map.items():
                    
                
run.py https://github.com/Caustic/netfpga.git | Python | 159 lines
                    
1#!/bin/env python
                    
2
                    
8
                    
9phy4loop0 = ('../connections/4phy', [])
                    
10
                    
10
                    
11nftest_init(sim_loop = [], hw_config = [phy4loop0])
                    
12nftest_start()
                    
                
shtest-timeout.py https://gitlab.com/lobl.pavel/llvm-tinymachine-backend | Python | 116 lines
                    
1# REQUIRES: python-psutil
                    
2
                    
4# RUN: not %{lit} \
                    
5# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
                    
6# RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
                    
16# RUN: not %{lit} \
                    
17# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
                    
18# RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
                    
25#
                    
26# CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
                    
27# CHECK-INTSH-OUT: Command 0 Reached Timeout: True
                    
28# CHECK-INTSH-OUT: Command 0 Output:
                    
29# CHECK-INTSH-OUT-NEXT: Running infinite loop
                    
30
                    
48
                    
49# Test per test timeout set via a config file rather than on the command line
                    
50# RUN: not %{lit} \
                    
                
preview.py https://github.com/eagleapex/BBstuff.git | Python | 69 lines
                    
12    print('You do not have the Python Imaging Library, which is needed by preview and gifview to view the gcode.')
                    
13    print('The Python Imaging Library can be downloaded from:\nwww.pythonware.com/products/pil/')
                    
14
                    
25        self.canvas.pack()
                    
26        self.canvas.config(scrollregion=self.canvas.bbox(Tkinter.ALL))
                    
27        self.exit_button = Tkinter.Button(frame, text = "Exit", fg = "red", command = frame.quit)
                    
33        self.update()
                    
34        self.root.mainloop()
                    
35
                    
41        if self.index < len(self.images) - 1:
                    
42            self.up_button.config(state = Tkinter.NORMAL)
                    
43        else:
                    
43        else:
                    
44            self.up_button.config(state = Tkinter.DISABLED)
                    
45        if self.index > 0:
                    
                
FileAnnotationDelete.py https://github.com/ximenesuk/openmicroscopy.git | Python | 52 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
12c = omero.client()
                    
13ice_config = c.getProperty("Ice.Config")
                    
14
                    
22    fa = FileAnnotationI()
                    
23    file = c.upload(ice_config)
                    
24    fa.setFile(file)
                    
36        try:
                    
37            cb.loop(10, 500)
                    
38        except omero.LockTimeout:
                    
                
listdir.py https://github.com/toastdriven/pydanny-event-notes.git | Python | 115 lines
                    
1#!/usr/bin/env python
                    
2
                    
26        self.dirs.bind('<Double-1>', self.setdirandgo)
                    
27        self.dirsb.config(command=self.dirs.yview)
                    
28        self.dirs.pack(side=LEFT, fill=BOTH)
                    
63        self.last = self.cwd.get()
                    
64        self.dirs.config(selectbackground='red')
                    
65        check = self.dirs.get(self.dirs.curselection())
                    
88            self.cwd.set(self.last)
                    
89            self.dirs.config( \
                    
90		selectbackground='LightSkyBlue')
                    
99        os.chdir(tdir)
                    
100        self.dirl.config(text=os.getcwd())
                    
101        self.dirs.delete(0, END)
                    
106        self.cwd.set(os.curdir)
                    
107        self.dirs.config( \
                    
108	    selectbackground='LightSkyBlue')
                    
                
main.py https://github.com/Ezphares/codename-Moving-Whales.git | Python | 54 lines
                    
1#!/usr/bin/env python
                    
2#
                    
25from websocket import Application
                    
26import tornado.ioloop
                    
27import tornado.options
                    
30
                    
31logging.basicConfig(
                    
32                    level=logging.INFO,
                    
47        logging.info("Starting whales websocket server")
                    
48        tornado.ioloop.IOLoop.instance().start()
                    
49
                    
                
proxy_example.py https://gitlab.com/ricardo.hernandez/salt | Python | 67 lines
                    
11
                    
12# Import Python libs
                    
13from __future__ import absolute_import
                    
35
                    
36def validate(config):
                    
37    '''
                    
37    '''
                    
38    Validate the beacon configuration
                    
39    '''
                    
39    '''
                    
40    if not isinstance(config, dict):
                    
41        return False, ('Configuration for rest_example beacon must be a dictionary.')
                    
41        return False, ('Configuration for rest_example beacon must be a dictionary.')
                    
42    return True, 'Valid beacon configuration'
                    
43
                    
                
__init__.py https://github.com/minrk/ipython.git | Python | 49 lines
                    
1"""Testing support (tools to test IPython itself).
                    
2"""
                    
4#-----------------------------------------------------------------------------
                    
5#  Copyright (C) 2009-2011  The IPython Development Team
                    
6#
                    
19def test(**kwargs):
                    
20    """Run the entire IPython test suite.
                    
21
                    
25    
                    
26        IPython.test(testgroups=['lib', 'config', 'utils'], fast=2)
                    
27    
                    
43# We scale all timeouts via this factor, slow machines can increase it
                    
44IPYTHON_TESTING_TIMEOUT_SCALE = float(os.getenv(
                    
45                                    'IPYTHON_TESTING_TIMEOUT_SCALE', 1))
                    
47# So nose doesn't try to run this as a test itself and we end up with an
                    
48# infinite test loop
                    
49test.__test__ = False
                    
                
buttonbars.py https://bitbucket.org/haploc/pythonscripts.git | Python | 53 lines
                    
33    root = Tk()
                    
34    lng = Checkbar(root, ['Python', 'C#', 'Java', 'C++'])
                    
35    gui = Radiobar(root, ['win', 'x11', 'mac'], side=TOP, anchor=NW)
                    
40    tgl.pack(side=LEFT)
                    
41    lng.config(relief=GROOVE, bd=2)
                    
42    gui.config(relief=RIDGE, bd=2)
                    
49    Button(root, text='Peek', command=allstates).pack(side=RIGHT)
                    
50    root.mainloop()
                    
51
                    
                
factory.py https://github.com/tinyclues/ipython.git | Python | 77 lines
                    
1"""Base config factories.
                    
2
                    
8#-----------------------------------------------------------------------------
                    
9#  Copyright (C) 2010-2011  The IPython Development Team
                    
10#
                    
23import zmq
                    
24from zmq.eventloop.ioloop import IOLoop
                    
25
                    
25
                    
26from IPython.config.configurable import Configurable
                    
27from IPython.utils.traitlets import Int, Instance, Unicode
                    
29from IPython.parallel.util import select_random_ports
                    
30from IPython.zmq.session import Session, SessionFactory
                    
31
                    
37class RegistrationFactory(SessionFactory):
                    
38    """The Base Configurable for objects that involve registration."""
                    
39    
                    
                
run.py https://github.com/Caustic/netfpga.git | Python | 114 lines
                    
1#!/bin/env python
                    
2
                    
6
                    
7phy2loop0 = ('../connections/2phy', [])
                    
8
                    
8
                    
9nftest_init(sim_loop = [], hw_config = [phy2loop0])
                    
10nftest_start()
                    
                
runAnalToBDT.py https://gitlab.com/brunel-physics/tqZ2012Code | Python | 30 lines
                    
1#Quick script to loop over all channels to make fitting plots
                    
2
                    
21for chanName in channelList.keys():
                    
22    print "bin/analysisMain.exe -c configs/"+chanName+"Conf.txt -u -t -k "+str(channelList[chanName])+" --jetRegion 2,1,3,4 -v 4095 -z --mvaDir mvaDirs/skims/met"+metStr+"mtw"+mtwStr + "/ --metCut " + str(metCut) + " --mtwCut " + str(mtwCut)
                    
23    subprocess.call("bin/analysisMain.exe -c configs/"+chanName+"Conf.txt -u -t -k "+str(channelList[chanName])+" --jetRegion 2,1,3,4 -v 4095 -z --mvaDir mvaDirs/skims/met"+metStr+"mtw"+mtwStr + "/ --metCut " + str(metCut) + " --mtwCut " + str(mtwCut),shell=True)
                    
27
                    
28print "python scripts/makeMVAInput.py [\\\"eee\\\",\\\"eemu\\\",\\\"emumu\\\",\\\"mumumu\\\"] mvaDirs/skims/met"+metStr+"mtw"+mtwStr+"/ mvaDirs/inputs/met"+metStr+"mtw"+mtwStr+"/"
                    
29subprocess.call("python scripts/makeMVAInput.py [\\\"eee\\\",\\\"eemu\\\",\\\"emumu\\\",\\\"mumumu\\\"] mvaDirs/skims/met"+metStr+"mtw"+mtwStr+"/ mvaDirs/inputs/met"+metStr+"mtw"+mtwStr+"/",shell=True)
                    
                
serviceProxy.py https://gitlab.com/essere.lab.public/qualitas.class-corpus | Python | 49 lines
                    
16"""HOD Service Proxy Implementation"""
                    
17# -*- python -*-
                    
18
                    
24from hodlib.Common.hodsvc import hodBaseService
                    
25from hodlib.Common.threads import loop
                    
26from hodlib.Common.tcp import tcpSocket
                    
30class svcpxy(hodBaseService):
                    
31    def __init__(self, config):
                    
32        hodBaseService.__init__(self, 'serviceProxy', config['service_proxy'],
                    
33                                xrtype='twisted')
                    
34        self.amcfg=config['allocation_manager']
                    
35
                    
                
StageOut.py https://github.com/PerilousApricot/WMCore.git | Python | 96 lines
                    
1#!/usr/bin/env python
                    
2"""
                    
10from WMCore.WMSpec.Steps.Template import CoreHelper
                    
11from WMCore.WMSpec.ConfigSectionTree import nodeName
                    
12
                    
34        """
                    
35            handy for testing, without the 10 minute retry loop
                    
36        """
                    
                
host_status.py https://github.com/tgiguere/ioncore-python.git | Python | 90 lines
                    
1#!/usr/bin/env python
                    
2
                    
45        self.client = xmlrpc.Proxy('http://localhost:9010')
                    
46        self.lc = task.LoopingCall(self.report)
                    
47        self.lc.start(self.INTERVAL)
                    
53        if self.count < 0:
                    
54            log.debug('Shutting down host status looping call')
                    
55            self.lc.stop()
                    
65
                    
66    def op_config(self, content, headers, msg):
                    
67        pass
                    
                
reduce_debugline_test.py https://bitbucket.org/peixuan/chromium_r197479_base.git | Python | 66 lines
                    
1#!/usr/bin/env python
                    
2# Copyright (c) 2013 The Chromium Authors. All rights reserved.
                    
30
                    
31      ../../base/message_loop.h:
                    
32      message_loop.h                               550            0xa41300
                    
33
                    
34      message_loop.h                               551            0xa41310
                    
35
                    
50      (0xa41210, '../../chrome/service/service_main.cc'),
                    
51      (0xa41300, '../../base/message_loop.h'),
                    
52      (0xa4141f, '../../chrome/service/service_main.cc'),
                    
62if __name__ == '__main__':
                    
63  logging.basicConfig(
                    
64      level=logging.DEBUG if '-v' in sys.argv else logging.ERROR,
                    
                
Raw_Data_advanced.py https://github.com/cneves/openmicroscopy.git | Python | 74 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
28
                    
29# Configuration
                    
30# =================================================================
                    
47
                    
48# Go through each channel (looping through Z and T not shown - go for mid-Z only)
                    
49# =================================================================
                    
                
PyShell.py https://github.com/Einstein-NTE/einstein.git | Python | 79 lines
                    
1"""PyShell is a python shell application."""
                    
2
                    
4# ``__main__`` and ``original``, serve the purpose of cleaning up the
                    
5# main namespace to look as much as possible like the regular Python
                    
6# shell environment.
                    
29        fileName = os.path.join(confDir, 'config')
                    
30        self.config = wx.FileConfig(localFilename=fileName)
                    
31        self.config.SetRecordDefaults(True)
                    
32
                    
33        self.frame = py.shell.ShellFrame(config=self.config, dataDir=confDir)
                    
34        self.frame.Show()
                    
39The main() function needs to handle being imported, such as with the
                    
40pyshell script that wxPython installs:
                    
41
                    
74    del sys
                    
75    # Start the wxPython event loop.
                    
76    app.MainLoop()
                    
                
halite.py https://github.com/prehensile/halite.git | Python | 173 lines
                    
1#!/usr/bin/env python
                    
2
                    
12from halitelogging import Logger
                    
13from haliteconfig import HaliteConfig
                    
14from haliteplaylist import PlaylistHandler
                    
15
                    
16config 			= HaliteConfig.default_config()
                    
17PIDFILE 		= config.get("halite","pidfile")
                    
17PIDFILE 		= config.get("halite","pidfile")
                    
18COMMANDFILE 	= config.get("halite","commandfile")
                    
19
                    
46				url_handler.handle_url( url )
                    
47				# exit the loop
                    
48				handled = True
                    
128	
                    
129	Logger.log_message( "Halite: end main loop" )
                    
130	os.remove(PIDFILE)
                    
                
example1.py https://github.com/hojonathanho/bulletsim.git | Python | 74 lines
                    
1#!/usr/bin/python
                    
2# example1.py
                    
7
                    
8# change these to match your configuration
                    
9
                    
39
                    
40# main loop
                    
41while(1):
                    
                
main.py https://github.com/nagn/PyGG2-old.git | Python | 97 lines
                    
1#!/usr/bin/env python
                    
2
                    
23    def __init__(self):
                    
24        self.load_config()
                    
25
                    
25
                    
26        self.port = self.config.setdefault('port', 8190)
                    
27        self.name = str(self.config.setdefault('name', 'Development Server'))
                    
27        self.name = str(self.config.setdefault('name', 'Development Server'))
                    
28        self.password = str(self.config.setdefault('password', ''))
                    
29        self.ID = uuid.uuid4()
                    
46
                    
47        self.save_config()
                    
48
                    
49    def run(self):
                    
50        # game loop
                    
51        while True:
                    
                
Raw_Data_advanced.py https://github.com/will-moore/openmicroscopy.git | Python | 76 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
28
                    
29# Configuration
                    
30# =================================================================
                    
47
                    
48# Go through each channel (looping through Z and T not shown - go for mid-Z
                    
49# only)
                    
                
comparator.py https://github.com/kailashbuki/predator.git | Python | 49 lines
                    
1#!/usr/bin/env python
                    
2#
                    
35
                    
36logging.basicConfig(level=logging.DEBUG)
                    
37
                    
42    logging.debug('Starting comparator ...')
                    
43    listening.listener_loop_runner()
                    
44
                    
                
factory.py https://github.com/JDShu/bravo.git | Python | 110 lines
                    
5from twisted.internet.protocol import Factory
                    
6from twisted.internet.task import LoopingCall
                    
7from twisted.python import log
                    
28
                    
29    def __init__(self, config, name):
                    
30        self.protocols = set()
                    
30        self.protocols = set()
                    
31        self.config = config
                    
32
                    
48
                    
49    broadcast_loop = None
                    
50
                    
58
                    
59        self.broadcast_loop = LoopingCall(self.broadcast)
                    
60        self.broadcast_loop.start(220)
                    
                
WorkQueueManager.py https://github.com/PerilousApricot/WMCore.git | Python | 75 lines
                    
16
                    
17from WMCore.WorkQueue.WorkQueueUtils import queueFromConfig, queueConfigFromConfigObject
                    
18
                    
27        Harness.__init__(self, config)
                    
28        self.config = queueConfigFromConfigObject(config)
                    
29
                    
43                                WorkQueueManagerReqMgrPoller(
                    
44                                        queueFromConfig(self.config),
                    
45                                        getattr(self.config.WorkQueueManager,
                    
54            myThread.workerThreadManager.addWorker(
                    
55                                WorkQueueManagerWorkPoller(queueFromConfig(self.config)),
                    
56                                pollInterval)
                    
71        myThread.workerThreadManager.addWorker(
                    
72                                WorkQueueManagerCleaner(queueFromConfig(self.config)),
                    
73                                pollInterval)
                    
                
RMix.py https://github.com/ssadler/pypy.git | Python | 68 lines
                    
1import sys
                    
2from pypy.rpython.lltypesystem import lltype, rffi
                    
3from pypy.rpython.tool import rffi_platform as platform
                    
25
                    
26class CConfig:
                    
27    _compilation_info_ = eci
                    
33
                    
34globals().update(platform.configure(CConfig))
                    
35
                    
62
                    
63def PlayChannel(channel,chunk,loops):
                    
64    return PlayChannelTimed(channel, chunk, loops, -1)
                    
                
btprox.py https://github.com/decibyte/btprox.git | Python | 86 lines
                    
1#!/usr/bin/python
                    
2# -*- coding: utf-8 -*-
                    
4import bluetooth
                    
5import config
                    
6
                    
13
                    
14# A helper for loading plugins (as seen on: http://stackoverflow.com/questions/452969/does-python-have-an-equivalent-to-java-class-forname).
                    
15def get_class(kls):
                    
24plugins = []
                    
25for (name, options, devices) in config.plugins:
                    
26	plugins.append({
                    
36
                    
37	# Loop through devices in range.
                    
38	for d in devices:
                    
41			devices_in_range[d] = bluetooth.lookup_name(d)
                    
42			if d in config.known_devices.values():
                    
43				print 'known device %s (%s) in range.' % (d, devices_in_range[d],)
                    
                
match_ends.py https://gitlab.com/jostikas/Thesis_final | Python | 65 lines
                    
1#!/usr/bin/python
                    
2
                    
16
                    
17logging.basicConfig()
                    
18log = logging.getLogger(__name__)
                    
39    parser = argparse.ArgumentParser(description=
                    
40"""Match the phase of the start and end to zero phase for glitchless looping and
                    
41instant lock with a PLL in gnuradio."""
                    
                
bot.py https://bitbucket.org/GloryFish/puppybot.git | Python | 102 lines
                    
1#! /usr/bin/python
                    
2
                    
16
                    
17    def preloop(self):
                    
18        """Hook method executed once when cmdloop() is called.
                    
26
                    
27        # Configure logging
                    
28        logging.basicConfig(level=logging.INFO)
                    
30
                    
31        # Configure RPi.GPIO
                    
32        GPIO.setwarnings(False)
                    
101if __name__ == '__main__':
                    
102    BotCommander().cmdloop()
                    
103
                    
                
psychopyApp.py https://github.com/smathot/psychopy.git | Python | 49 lines
                    
1#!/usr/bin/env python
                    
2
                    
19
                    
20Usage:  python PsychoPy.py [options] [file]
                    
21
                    
25
                    
26 Python script 'file.py' -- opens coder
                    
27
                    
36
                    
37    --firstrun       launches configuration wizard
                    
38    --nosplash       suppresses splash screen
                    
48        app = PsychoPyApp(0, showSplash=showSplash)
                    
49        app.MainLoop()
                    
50
                    
                
app.py https://github.com/Sidnicious/0xfe-experiments.git | Python | 60 lines
                    
1#!/usr/bin/env python2.7
                    
2
                    
9import tornado.options
                    
10from tornado import auth, ioloop, web
                    
11from tornado.options import define, options
                    
20
                    
21logging.basicConfig(level=logging.INFO)
                    
22
                    
22
                    
23class Config:
                    
24  port = int(options.port)
                    
50
                    
51  application.vexconfig = Config()
                    
52
                    
59  logging.info("Starting HTTP Server on port %d" % Config.port)
                    
60  ioloop.IOLoop.instance().start()
                    
61
                    
                
motorbase.py https://github.com/howie6879/owllook.git | Python | 140 lines
                    
1#!/usr/bin/env python
                    
2import asyncio
                    
6
                    
7from owllook.config import CONFIG
                    
8from owllook.utils.tools import singleton
                    
18    _collection = {}
                    
19    MONGODB = CONFIG.MONGODB
                    
20
                    
22        self.motor_uri = ''
                    
23        self.loop = loop or asyncio.get_event_loop()
                    
24
                    
33            database=db)
                    
34        return AsyncIOMotorClient(self.motor_uri, io_loop=self.loop)
                    
35
                    
124        """
                    
125        loop = asyncio.get_event_loop()
                    
126        task = asyncio.ensure_future(func(**kwargs))
                    
                
repeater.py https://github.com/batt/StratoSpera.git | Python | 99 lines
                    
1#!/usr/bin/env python
                    
2
                    
2
                    
3import config
                    
4
                    
16			time.sleep(0.1)
                    
17			os.system("python uploader.py")
                    
18	except:
                    
24			time.sleep(30)
                    
25			os.system("python downloader.py")
                    
26	except:
                    
29
                    
30def parse_loop():
                    
31	logfile = config.logdir + "/aprs.log"
                    
31	logfile = config.logdir + "/aprs.log"
                    
32	os.system("mkdir -p " + config.logdir)
                    
33	os.system("touch " + logfile)
                    
                
test_TamilNoun.py https://gitlab.com/manoj-makkuboy/amuthaa3 | Python | 147 lines
                    
1# -*- coding: utf-8 -*-
                    
2#!/usr/bin/python
                    
3
                    
16
                    
17logging.basicConfig(level=logging.DEBUG)
                    
18
                    
33
                    
34        Loops through words in Excel spreadsheet and ensures that the
                    
35        get_class() method returns the expected class number for each noun
                    
66
                    
67        Loops through words in Excel spreadsheet and ensures that the
                    
68        split_letters() method returns the expected list of letters_str
                    
102
                    
103        Loops through words in Excel spreadsheet and ensures that the
                    
104        method returns the expected direct object for each noun in
                    
                
loop_solution_1.py https://github.com/memimo/Theano.git | Python | 85 lines
                    
1#!/usr/bin/env python
                    
2# Theano tutorial
                    
2# Theano tutorial
                    
3# Solution to Exercise in section 'Loop'
                    
4from __future__ import print_function
                    
12
                    
13theano.config.warn.subtensor_merge_bug = False
                    
14
                    
60
                    
61theano.config.warn.subtensor_merge_bug = False
                    
62
                    
                
server.py https://github.com/xblaster/scrutator.git | Python | 61 lines
                    
1#!/usr/bin/env python
                    
2import sys
                    
29Pyro.core.initServer()
                    
30Pyro.config.PYRO_TRACELEVEL = 3
                    
31Pyro.config.PYRO_NS_DEFAULTGROUP = ':test'
                    
31Pyro.config.PYRO_NS_DEFAULTGROUP = ':test'
                    
32Pyro.config.PYRO_LOGFILE = 'server_log'
                    
33print 'Check the logfile for messages: server_log'
                    
46# make sure our namespace group exists
                    
47try: ns.createGroup(Pyro.config.PYRO_NS_DEFAULTGROUP)
                    
48except NamingError: pass
                    
57
                    
58# enter the service loop.
                    
59print 'Server object "ssl" ready.'
                    
59print 'Server object "ssl" ready.'
                    
60daemon.requestLoop()
                    
61
                    
                
netcfg.py https://github.com/willkelly/random.git | Python | 34 lines
                    
1#!/usr/bin/python
                    
2import sys
                    
13t = """auto lo
                    
14iface lo inet loopback
                    
15
                    
25        netmask {vmnet_netmask}
                    
26        up ifconfig eth0.{vmnet_vlan} up
                    
27
                    
31        netmask {mgmt_netmask}
                    
32        up ifconfig eth0.{mgmt_vlan} up""".format(**o)
                    
33
                    
                
HUD_run_me.py https://github.com/forrestdg/fpdb.git | Python | 69 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
33#    FreePokerTools modules
                    
34import Configuration
                    
35import Database
                    
39
                    
40def destroy(*args):             # call back for terminating the main eventloop
                    
41    gtk.main_quit()
                    
52
                    
53    HUD_main.config = Configuration.Config()
                    
54
                    
                
example.py https://github.com/cneves/openmicroscopy.git | Python | 56 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
22        from omero_cmd import SessionI
                    
23        session = Session() # username, password, host, etc from config
                    
24        session.connect()
                    
31        create = Create(type="Project", {"name": "test"})
                    
32        response = client.call(create) # , loop=10
                    
33
                    
                
preview.py https://github.com/sialan/autonomous-sprayer.git | Python | 70 lines
                    
13    print( 'You do not have the Python Imaging Library, which is needed by preview and gifview to view the gcode.' )
                    
14    print( 'The Python Imaging Library can be downloaded from:\nwww.pythonware.com/products/pil/' )
                    
15
                    
26        self.canvas.pack()
                    
27        self.canvas.config(scrollregion=self.canvas.bbox(Tkinter.ALL))
                    
28        self.exit_button = Tkinter.Button(frame, text = "Exit", fg = "red", command = frame.quit)
                    
34        self.update()
                    
35        self.root.mainloop()
                    
36
                    
42        if self.index < len(self.images) - 1:
                    
43            self.up_button.config(state = Tkinter.NORMAL)
                    
44        else:
                    
44        else:
                    
45            self.up_button.config(state = Tkinter.DISABLED)
                    
46        if self.index > 0:
                    
                
handlers.py https://github.com/Sidnicious/0xfe-experiments.git | Python | 107 lines
                    
1#!/usr/bin/env python2.7
                    
2
                    
7
                    
8from tornado import auth, ioloop, web
                    
9
                    
24
                    
25  def get_config(self):
                    
26    return self.application.vexconfig
                    
                
fastevents.py https://bitbucket.org/julian_meyer/boxes.git | Python | 130 lines
                    
1#!/usr/bin/env python
                    
2"""  This is a stress test for the fastevents module.
                    
16
                    
17# the config to try different settings out with the event queues.
                    
18
                    
25
                    
26# limit the game loop to 40 fps.
                    
27slow_tick = 0
                    
                
example-conf-mechanism.py git://pkgs.fedoraproject.org/python-slip | Python | 89 lines
                    
1#!/usr/bin/python
                    
2# -*- coding: utf-8 -*-
                    
7import dbus.service
                    
8import dbus.mainloop.glib
                    
9
                    
50        super(ExampleObject, self).__init__(*p, **k)
                    
51        self.config_data = """These are the contents of a configuration file.
                    
52
                    
72        print "%s.write ('%s')" % (self, config_data)
                    
73        self.config_data = config_data
                    
74
                    
76if __name__ == "__main__":
                    
77    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
                    
78
                    
84
                    
85    mainloop = gobject.MainLoop()
                    
86    slip.dbus.service.set_mainloop(mainloop)
                    
                
ObjectBrowser.py https://bitbucket.org/kbengine/kbengine.git | Python | 138 lines
                    
30        if not self.IsExpandable():
                    
31            return "python"
                    
32    def IsEditable(self):
                    
127    root = Tk()
                    
128    root.configure(bd=0, bg="yellow")
                    
129    root.focus_set()
                    
134    node.update()
                    
135    root.mainloop()
                    
136
                    
                
test_kraken_api_order_book_data_source.py https://github.com/CoinAlpha/hummingbot.git | Python | 63 lines
                    
1#!/usr/bin/env python
                    
2from os.path import join, realpath
                    
22    def setUpClass(cls):
                    
23        cls.ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop()
                    
24        cls.order_book_data_source: KrakenAPIOrderBookDataSource = KrakenAPIOrderBookDataSource(["ETHUSDC", "XBTUSDC", "ETHDAI"])
                    
26    def run_async(self, task):
                    
27        return self.ev_loop.run_until_complete(task)
                    
28
                    
57def main():
                    
58    logging.basicConfig(level=logging.INFO)
                    
59    unittest.main()
                    
                
FileAnnotationDelete.py https://github.com/qidane/openmicroscopy.git | Python | 58 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
12c = omero.client()
                    
13ice_config = c.getProperty("Ice.Config")
                    
14
                    
23
                    
24    file = c.upload(ice_config)
                    
25    fa = FileAnnotationI()
                    
44        callback = omero.callbacks.CmdCallbackI(c, handle)
                    
45        loops = 10
                    
46        delay = 500
                    
46        delay = 500
                    
47        callback.loop(loops, delay)  # Throw LockTimeout
                    
48        rsp = callback.getResponse()
                    
                
DQMUpload.py https://github.com/PerilousApricot/WMCore-OLDOLD.git | Python | 99 lines
                    
1#!/usr/bin/env python
                    
2"""
                    
10from WMCore.WMSpec.Steps.Template import CoreHelper
                    
11from WMCore.WMSpec.ConfigSectionTree import nodeName
                    
12
                    
33        """
                    
34        handy for testing, without the 10 minute retry loop
                    
35        """
                    
                
run.py https://github.com/Caustic/netfpga.git | Python | 120 lines
                    
1#!/bin/env python
                    
2
                    
6
                    
7phy0loop4 = ('../connections/conn', ['nf2c0', 'nf2c1', 'nf2c2', 'nf2c3'])
                    
8
                    
8
                    
9nftest_init(sim_loop = ['nf2c0', 'nf2c1', 'nf2c2', 'nf2c3'], hw_config = [phy0loop4])
                    
10nftest_start()
                    
                
generic.py https://github.com/igorbonadio/carbono.git | Python | 73 lines
                    
1#!/usr/bin/python
                    
2# coding: utf-8
                    
19
                    
20from carbono.config import *
                    
21from carbono.utils import *
                    
39
                    
40            # Loop untill find the the next slice or
                    
41            # cancel the operation
                    
                
train_pyceptron.py https://github.com/ricardokrieg/pyceptron.git | Python | 130 lines
                    
1#!/usr/bin/python
                    
2#-*- coding: utf-8 -*-
                    
121	#window.geometry('800x600')
                    
122	#window.configure(bg='black')
                    
123
                    
126
                    
127	#window.mainloop();
                    
128# main
                    
                
shtest-timeout.py https://gitlab.com/williamwp/riscv-rv32x-llvm | Python | 75 lines
                    
1# REQUIRES: python-psutil
                    
2
                    
12# RUN: not %{lit} \
                    
13# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
                    
14# RUN: %{inputs}/shtest-timeout/short.py \
                    
22# RUN: not %{lit} \
                    
23# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
                    
24# RUN: %{inputs}/shtest-timeout/short.py \
                    
29
                    
30# CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
                    
31# CHECK-INTSH-OUT: command output:
                    
35
                    
36# Test per test timeout set via a config file rather than on the command line
                    
37# RUN: not %{lit} \
                    
37# RUN: not %{lit} \
                    
38# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
                    
39# RUN: %{inputs}/shtest-timeout/short.py \
                    
                
runtests.py https://github.com/marinho/tornado.git | Python | 56 lines
                    
1#!/usr/bin/env python
                    
2
                    
17    'tornado.test.import_test',
                    
18    'tornado.test.ioloop_test',
                    
19    'tornado.test.iostream_test',
                    
38    # The -W command-line option does not work in a virtualenv with
                    
39    # python 3 (as of virtualenv 1.7), so configure warnings
                    
40    # programmatically instead.
                    
43    # ignored by default, including DeprecationWarnings and
                    
44    # python 3.2's ResourceWarnings.
                    
45    warnings.filterwarnings("error")
                    
                
pymaster_module.py https://gitlab.com/etlive/masterserver-tester | Python | 68 lines
                    
2from twisted.application import internet
                    
3from twisted.python import log
                    
4from twisted.python import usage
                    
24        ["master_server_file", "f", "master_servers.yaml",
                    
25            "the config file for masterservers"]
                    
26    ]
                    
50            for i in v:
                    
51                reactor.callLater(delay, self.server.protocol.loop_getservers,
                    
52                        (k, 27950), [str(i), "empty", "full"], 1800)
                    
                
runDilepton2016AnalToBDT.py https://gitlab.com/brunel-physics/tqZ2015Code | Python | 37 lines
                    
1#Quick script to loop over all channels to make fitting plots
                    
2
                    
27for chanName in channelList.keys():
                    
28    print "bin/analysisMain.exe -c configs/2016/"+chanName+"MCdataConf.txt -u -t -k "+str(channelList[chanName])+" -v 65535 -z --dilepton --mvaDir /scratch/data/TopPhysics/mvaDirs/skims/2016/mz"+mzStr+"mw"+mwStr + "/ --mzCut " + str(mzCut) + " --mwCut " + str(mwCut) + " --2016"
                    
29    subprocess.call("bin/analysisMain.exe -c configs/2016/"+chanName+"MCdataConf.txt -u -t -k "+str(channelList[chanName])+" -v 65535 -z --dilepton --mvaDir /scratch/data/TopPhysics/mvaDirs/skims/2016/mz"+mzStr+"mw"+mwStr + "/ --mzCut " + str(mzCut) + " --mwCut " + str(mwCut) + " --2016",shell=True)
                    
34
                    
35print "python scripts/makeMVAInputDilepton.py [\\\"ee\\\",\\\"mumu\\\"] /scratch/data/TopPhysics/mvaDirs/skims/2016/mz"+mzStr+"mw"+mwStr+"/ /scratch/data/TopPhysics/mvaDirs/inputs/2016/"+dirExt+"mz"+mzStr+"mw"+mwStr+"/ --2016 "+useSideBandRegion
                    
36subprocess.call("python scripts/makeMVAInputDilepton.py [\\\"ee\\\",\\\"mumu\\\"] /scratch/data/TopPhysics/mvaDirs/skims/2016/mz"+mzStr+"mw"+mwStr+"/ /scratch/data/TopPhysics/mvaDirs/inputs/2016/"+dirExt+"mz"+mzStr+"mw"+mwStr+"/ --2016 "+useSideBandRegion ,shell=True)
                    
                
main.py https://github.com/tsilochr/blackadder.git | Python | 63 lines
                    
1#!/usr/bin/python
                    
2# -*- coding: utf-8 -*-
                    
23import BitVector
                    
24from config import Config
                    
25from impacket import ImpactPacket
                    
41
                    
42#TmIgraph module gets configuration maps, uses igraph library to handle packet requests and produces response packets to the outgoing Queue
                    
43tigraph = TMIgraph.TMIgraphModule(sys.argv[1])
                    
56	
                    
57#ingress main loop. receives packets from BlackAdder Netlink interface and adds them to a processor queue. Currently only TMigraph is available 
                    
58while 1:
                    
                
submit.py https://github.com/aherbert/openmicroscopy.git | Python | 80 lines
                    
1#!/usr/bin/env python
                    
2"""
                    
52
                    
53    def _configure(self, parser):
                    
54        parser.add_argument("arg", nargs="*", help="single command with args")
                    
64            try:
                    
65                submit.invokeloop()
                    
66            except Save, s:
                    
                
gsm.py https://github.com/oluka/mapping_rapidsms.git | Python | 118 lines
                    
1#!/usr/bin/env python
                    
2# vim: ai ts=4 sts=4 et sw=4
                    
21
                    
22    def configure(self, **kwargs):
                    
23
                    
23
                    
24        # strip any config settings that
                    
25        # obviously aren't for the modem
                    
103        # If we got the connection, call superclass to
                    
104        # start the run loop--it just sets self._running to True
                    
105        # and calls run.
                    
112        # call superclass to stop--sets self._running
                    
113        # to False so that the 'run' loop will exit cleanly.
                    
114        BackendBase.stop(self)
                    
                
donna.py https://bitbucket.org/bumbolt/donna.git | Python | 69 lines
                    
5
                    
6# Some basic variables used to configure the bot        
                    
7server = "reinoutclaeys.be" # Server
                    
28  ircsock.send("PRIVMSG "+ channel +" :Niet met mij! Norma eerst!\n")
                    
29  Popen("python /home/bumbolt/Documents/git-repos/donna/reloader.py", shell=True) # start reloader
                    
30  exit("exit for updating all files")
                    
47
                    
48while 1: # Be careful with these! it might send you to an infinite loop
                    
49  ircmsg = ircsock.recv(2048) # receive data from the server
                    
                
DBS3Upload.py https://github.com/dmwm/WMCore.git | Python | 50 lines
                    
1#!/usr/bin/env python
                    
2#pylint: disable=E1101,E1103,C0103,R0902
                    
7        buffering in the database
                    
8        if buffer has hit the configured limit
                    
9"""
                    
33
                    
34    def __init__(self, config):
                    
35        # call the base class
                    
35        # call the base class
                    
36        Harness.__init__(self, config)
                    
37        self.pollTime = 1
                    
42
                    
43        # Add event loop to worker manager
                    
44        myThread = threading.currentThread()
                    
45
                    
46        pollInterval = self.config.DBS3Upload.pollInterval
                    
47        logging.info("Setting poll interval to %s seconds" % pollInterval)
                    
                
JobSubmitter.py https://github.com/PerilousApricot/WMCore.git | Python | 49 lines
                    
1#!/usr/bin/env python
                    
2#pylint: disable-msg=W6501
                    
26
                    
27    def __init__(self, config):
                    
28        # call the base class
                    
28        # call the base class
                    
29        Harness.__init__(self, config)
                    
30        self.pollTime = 1
                    
40
                    
41        # Add event loop to worker manager
                    
42        myThread = threading.currentThread()
                    
43
                    
44        pollInterval = self.config.JobSubmitter.pollInterval
                    
45        logging.info("Setting poll interval to %s seconds" % pollInterval)
                    
45        logging.info("Setting poll interval to %s seconds" % pollInterval)
                    
46        myThread.workerThreadManager.addWorker(JobSubmitterPoller(self.config),
                    
47                                               pollInterval)
                    
                
JobArchiver.py https://github.com/PerilousApricot/WMCore.git | Python | 53 lines
                    
1#!/usr/bin/env python
                    
2
                    
29
                    
30    def __init__(self, config):
                    
31        # call the base class
                    
31        # call the base class
                    
32        Harness.__init__(self, config)
                    
33        self.pollTime = 1
                    
34
                    
35        self.config = config
                    
36
                    
45
                    
46        # Add event loop to worker manager
                    
47        myThread = threading.currentThread()
                    
48
                    
49        pollInterval = self.config.JobArchiver.pollInterval
                    
50        logging.info("Setting poll interval to %s seconds" % pollInterval)
                    
                
cassandramanager.py https://github.com/chrischeyne/Cassandra-Monitor.git | Python | 55 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
20this instigates the web2py framework, instigates the handlers
                    
21and starts the main application 'loop' on each node
                    
22"""
                    
39SYSLOG.l.debug('booting....')
                    
40import myconfig.config as config
                    
41SYSCONFIG = config.MyConfig()
                    
41SYSCONFIG = config.MyConfig()
                    
42SYSLOG.l.info('mysql host is %s ' % SYSCONFIG.conf['mysql']['host'])
                    
43
                    
44
                    
45# MAIN LOOP
                    
46class CassandraManager():
                    
                
TilemapEditorGui.py https://github.com/d4rkh4re/d4rkh4re.git | Python | 63 lines
                    
13    """
                    
14    http://docs.python.org/py3k/library/tkinter.html
                    
15    http://infohost.nmt.edu/tcc/help/pubs/tkinter/
                    
34        # Link scroll bars and canvas
                    
35        x_scroll.config(command=self.tilemap_display.xview)
                    
36        y_scroll.config(command=self.tilemap_display.yview)
                    
53        # Link scroll bars and canvas
                    
54        y_scroll.config(command=self.tileset_display.yview)
                    
55        
                    
62app.master.minsize(100, 100)
                    
63app.mainloop()
                    
64
                    
                
loop_prevention.py git://github.com/rawler/bithorde.git | Python | 93 lines
                    
1#!/usr/bin/env python2
                    
2
                    
9if __name__ == '__main__':
                    
10    bithorded = BithordeD(config={
                    
11        'friend.upstream1.addr': '',
                    
57
                    
58    # Simulate loop on client1
                    
59    downstream1.send(message.BindRead(handle=1, ids=ASSET_IDS, timeout=500, requesters=[9873474, 12345]))
                    
59    downstream1.send(message.BindRead(handle=1, ids=ASSET_IDS, timeout=500, requesters=[9873474, 12345]))
                    
60    resp1 = downstream1.expect(message.AssetStatus(status=message.WOULD_LOOP))
                    
61
                    
71
                    
72    # Simulate late loop
                    
73    downstream1.send(message.BindRead(handle=1, ids=ASSET_IDS, timeout=500, requesters=req2.requesters))
                    
73    downstream1.send(message.BindRead(handle=1, ids=ASSET_IDS, timeout=500, requesters=req2.requesters))
                    
74    downstream1.expect(message.AssetStatus(status=message.WOULD_LOOP))
                    
75
                    
                
run.py https://github.com/Caustic/netfpga.git | Python | 111 lines
                    
1#!/bin/env python
                    
2
                    
7
                    
8phy2loop2 = ('../connections/2phy', ['nf2c2', 'nf2c3'])
                    
9
                    
9
                    
10nftest_init(sim_loop = ['nf2c2', 'nf2c3'], hw_config = [phy2loop2])
                    
11nftest_start()
                    
                
04_network_local_udp_pos.py https://gitlab.com/wkyu/gxen | Python | 76 lines
                    
1#!/usr/bin/python
                    
2
                    
8#  - sets up a single NIC
                    
9#  - conducts hping udp tests to the local loopback and IP address
                    
10
                    
25if xmtest_netconf.canRunNetTest(2) == False:
                    
26    SKIP("Don't have enough free configured IPs to run this test")
                    
27
                    
41
                    
42    # First do loopback 
                    
43    lofails=""
                    
70if len(lofails):
                    
71        failures += "UDP hping2 over loopback failed for size" + lofails + ". "
                    
72if len(eth0fails):
                    
                
__init__.py https://gitlab.com/pooja043/Globus_Docker_1 | Python | 38 lines
                    
1"""Testing support (tools to test IPython itself).
                    
2"""
                    
4#-----------------------------------------------------------------------------
                    
5#  Copyright (C) 2009-2011  The IPython Development Team
                    
6#
                    
16def test(**kwargs):
                    
17    """Run the entire IPython test suite.
                    
18
                    
22    
                    
23        IPython.test(testgroups=['lib', 'config', 'utils'], fast=2)
                    
24    
                    
36# So nose doesn't try to run this as a test itself and we end up with an
                    
37# infinite test loop
                    
38test.__test__ = False
                    
                
vomun.py https://github.com/AnonLEF/vomun.git | Python | 50 lines
                    
1#! /usr/bin/env python
                    
2'''Start the program. Load segments of the program that need to be started and
                    
16import libs.logs
                    
17import libs.config
                    
18
                    
38    
                    
39    ## main loop
                    
40    while libs.globals.global_vars['running']:
                    
45    friends.save_friends()
                    
46    libs.config.save_config()
                    
47    
                    
                
cuda_poly.py git://github.com/npinto/python-cuda.git | Python | 101 lines
                    
43    cudaThreadSynchronize()
                    
44    for i in range(loops):
                    
45        cudaConfigureCall(gridDim,blockDim,0,0)
                    
49
                    
50    flops = (2.e-9*m1*n2*(psize-1))*float(loops)
                    
51    cudaMemcpy(g_Y,d_Y,S4*n2,cudaMemcpyDeviceToHost)
                    
78    if len(sys.argv) > 2:
                    
79        loopx = int(sys.argv[2])
                    
80    m1 = 4
                    
89        elif l < 13:
                    
90            loops = 5000/m1
                    
91        elif l < 17:
                    
98        if loopx > 0:
                    
99            loops = loopx
                    
100        main(vlength,loops,m1)
                    
                
attributes.py https://bitbucket.org/yingted/pysandbox.git | Python | 84 lines
                    
7except ImportError:
                    
8    # Python < 2.6 has no type cache, so we don't have to clear it
                    
9    def _clear_type_cache():
                    
11
                    
12from .cpython import dictionary_of
                    
13from .restorable_dict import RestorableDict
                    
18    """
                    
19    Hide unsafe frame attributes from the Python space
                    
20    """
                    
29    def enable(self, sandbox):
                    
30        if not sandbox.config.cpython_restricted:
                    
31            # Deny access to func.func_code to avoid an attacker to modify a
                    
60
                    
61        # Hiding type.__bases__ crashs CPython 2.5 because of a infinite loop
                    
62        # in PyErr_ExceptionMatches(): it calls abstract_get_bases() but
                    
                
boutons_radio.py https://github.com/widowild/messcripts.git | Python | 38 lines
                    
1#! /usr/bin/env python
                    
2# -*- coding: Latin-1 -*-
                    
35        police = "Arial 15 " + self.choixPolice.get() 
                    
36        self.texte.configure(font =police)
                    
37                           
                    
37                           
                    
38RadioDemo().mainloop()
                    
39
                    
                
window-creation-w-location.py https://github.com/tmacreturns/XBMC_wireless_setup.git | Python | 45 lines
                    
3import sys
                    
4##sys.path.append("/users/mjc4y/projects/python/tkinter/utils")
                    
5##from TkinterUtils  import *
                    
40        Frame.__init__(self, master)
                    
41        Pack.config(self)
                    
42        self.createWidgets()
                    
44test = Test()
                    
45test.mainloop()
                    
46
                    
                
bot.py https://github.com/Alligator/homero.git | Python | 71 lines
                    
1#!/usr/bin/env python
                    
2
                    
30reload_core(init=True)
                    
31config()
                    
32reload_plugs(init=True)
                    
33
                    
34if not hasattr(bot, 'config'):
                    
35    exit()
                    
41try:
                    
42    for name, conf in bot.config['connections'].iteritems():
                    
43        if conf.get('ssl'):
                    
50except Exception, e:
                    
51    print 'ERROR: malformed config file', e
                    
52    sys.exit()
                    
57
                    
58print 'Running main loop'
                    
59
                    
                
image_button.py https://github.com/jasoncbautista/Focus-Motivator.git | Python | 49 lines
                    
2# note that Tkinter reads only GIF and PGM/PPM images
                    
3# for other image file types use the Python Image Library (PIL)
                    
4# replace the line photo1 = tk.PhotoImage(file="Press1.gif")
                    
10#
                    
11# tested with Python24     vegaseat     23dec2006
                    
12
                    
24    if button_flag:
                    
25        button1.config(bg="white")
                    
26        button_flag = False
                    
27    else:
                    
28        button1.config(bg="green")
                    
29        button_flag = True
                    
47
                    
48# start the event loop
                    
49root.mainloop()
                    
                
test-session.py https://gitlab.com/manoj-makkuboy/magnetism | Python | 81 lines
                    
1#!/usr/bin/python
                    
2
                    
9from ddm import DataModel
                    
10from dbus.mainloop.glib import DBusGMainLoop
                    
11import gobject
                    
12
                    
13logging.basicConfig(level=logging.DEBUG)
                    
14
                    
14
                    
15DBusGMainLoop(set_as_default=True)
                    
16
                    
79
                    
80loop = gobject.MainLoop()
                    
81loop.run()
                    
                
ex13.py https://bitbucket.org/korovamilk/python_for_kids.git | Python | 121 lines
                    
1#!/usr/bin/env python3
                    
2from tkinter import *
                    
86		self.score += 10
                    
87		self.canvas.itemconfig(self.id, text=self.score)
                    
88
                    
106
                    
107# main loop: tells tk to redraw screen
                    
108while 1:
                    
110##		time.sleep(1)
                    
111##		canvas.itemconfig(game_start_text, state='normal') 
                    
112
                    
117		time.sleep(1)
                    
118		canvas.itemconfig(game_over_text, state='normal')
                    
119	tk.update_idletasks()
                    
                
__init__.py https://github.com/AnimeDB/adb-browser-backend.git | Python | 98 lines
                    
18class Poller(Service, object):
                    
19    def __init__(self, options, config):
                    
20        super(Poller, self).__init__()
                    
22        self.options = options
                    
23        self.config = config
                    
24        
                    
40        kwargs = {
                    
41            'config': self.config,
                    
42            'queue': queue,
                    
43            'delegate': TwistedDelegate(),
                    
44            'vhost': self.config.get('amqp', 'vhost'),
                    
45            'spec': get_spec(),
                    
56        kwargs = {
                    
57            'host': self.config.get('database', 'host'),
                    
58            'port': int(self.config.get('database', 'port')),
                    
                
startup.py https://github.com/rmoore/phenny.git | Python | 72 lines
                    
1#!/usr/bin/env python
                    
2"""
                    
17    if hasattr(phenny.config, 'refresh_delay'):
                    
18        try: refresh_delay = float(phenny.config.refresh_delay)
                    
19        except: pass
                    
24      
                    
25        def pingloop():
                    
26            timer = threading.Timer(refresh_delay, close, ())
                    
30            phenny.write(('PING', phenny.config.host))
                    
31        phenny.data['startup.setup.pingloop'] = pingloop
                    
32
                    
37                time.sleep(refresh_delay + 60.0)
                    
38                pingloop()
                    
39            except: pass
                    
44
                    
45        # Need to wrap handle_connect to start the loop.
                    
46        inner_handle_connect = phenny.handle_connect
                    
                
loop_solution_1.py https://github.com/lamblin/Theano.git | Python | 85 lines
                    
1#!/usr/bin/env python
                    
2# Theano tutorial
                    
2# Theano tutorial
                    
3# Solution to Exercise in section 'Loop'
                    
4from __future__ import absolute_import, print_function, division
                    
12
                    
13theano.config.warn.subtensor_merge_bug = False
                    
14
                    
60
                    
61theano.config.warn.subtensor_merge_bug = False
                    
62
                    
                
submit.py https://github.com/will-moore/openmicroscopy.git | Python | 84 lines
                    
1#!/usr/bin/env python
                    
2# -*- coding: utf-8 -*-
                    
56
                    
57    def _configure(self, parser):
                    
58        parser.add_argument("arg", nargs="*", help="single command with args")
                    
68            try:
                    
69                submit.invokeloop()
                    
70            except Save:
                    
                
GUI_radiobutton_widget.py https://github.com/PacktPublishing/Python-GUI-Programming-Cookbook-Second-Edition.git | Python | 101 lines
                    
14# Add a title       
                    
15win.title("Python GUI")  
                    
16
                    
22def click_me(): 
                    
23    action.configure(text='Hello ' + name.get() + ' ' + 
                    
24                     number_chosen.get())
                    
63    # only enable one checkbutton
                    
64    if chVarUn.get(): check3.configure(state='disabled')
                    
65    else:             check3.configure(state='normal')
                    
65    else:             check3.configure(state='normal')
                    
66    if chVarEn.get(): check2.configure(state='disabled')
                    
67    else:             check2.configure(state='normal') 
                    
80    radSel=radVar.get()
                    
81    if   radSel == 1: win.configure(background=COLOR1)
                    
82    elif radSel == 2: win.configure(background=COLOR2)
                    
                
lifecycle.py https://github.com/holzschu/Carnets.git | Python | 131 lines
                    
7''' Bokeh Application Handler to look for Bokeh server lifecycle callbacks
                    
8in a specified Python module.
                    
9
                    
73    def on_server_loaded(self, server_context):
                    
74        ''' Execute `on_server_unloaded`` from the configured module (if
                    
75        it is defined) when the server is first started.
                    
83    def on_server_unloaded(self, server_context):
                    
84        ''' Execute ``on_server_unloaded`` from the configured module (if
                    
85        it is defined) when the server cleanly exits. (Before stopping the
                    
85        it is defined) when the server cleanly exits. (Before stopping the
                    
86        server's ``IOLoop``.)
                    
87
                    
98    def on_session_created(self, session_context):
                    
99        ''' Execute ``on_session_created`` from the configured module (if
                    
100        it is defined) when a new session is created.
                    
                
client.py https://bitbucket.org/zielmicha/colobot-py.git | Python | 51 lines
                    
1#!/usr/bin/python
                    
2# Copyright (C) 2012, Michal Zielinski <michal@zielinscy.org.pl>
                    
27
                    
28logging.basicConfig(level=logging.DEBUG)
                    
29
                    
39    win.setup()
                    
40    win.loop()
                    
41
                    
49
                    
50from IPython import embed
                    
51embed()
                    
                
ComboBox.py https://github.com/jackygrahamez/DrugDiscovery-Home.git | Python | 76 lines
                    
11    def __init__(self, parent):
                    
12        parent.configure(background = 'white')
                    
13
                    
13
                    
14        # Create and pack the widget to be configured.
                    
15	self.target = Tkinter.Label(parent,
                    
22	# Create and pack the simple ComboBox.
                    
23        words = ('Monti', 'Python', 'ik', 'den', 'Holie', 'Grailen', '(Bok)')
                    
24	simple = Pmw.ComboBox(parent,
                    
58	print 'Colour: ' + colour
                    
59	self.target.configure(background = colour)
                    
60
                    
62	print 'Text: ' + text
                    
63	self.target.configure(text = text)
                    
64
                    
                
factory.py https://github.com/cboos/ipython.git | Python | 77 lines
                    
1"""Base config factories.
                    
2
                    
8#-----------------------------------------------------------------------------
                    
9#  Copyright (C) 2010-2011  The IPython Development Team
                    
10#
                    
23import zmq
                    
24from zmq.eventloop.ioloop import IOLoop
                    
25
                    
25
                    
26from IPython.config.configurable import Configurable
                    
27from IPython.utils.traitlets import Integer, Instance, Unicode
                    
29from IPython.parallel.util import select_random_ports
                    
30from IPython.zmq.session import Session, SessionFactory
                    
31
                    
37class RegistrationFactory(SessionFactory):
                    
38    """The Base Configurable for objects that involve registration."""
                    
39    
                    
                
smtpreldaemon.py https://github.com/fragaria/fragapy.git | Python | 59 lines
                    
13    def __init__(self, pidfile):
                    
14        config = ConfigParser.SafeConfigParser()
                    
15        cfg_path = os.path.expanduser('~/.smtpreldaemon.cfg')
                    
17        if not os.path.exists(cfg_path):
                    
18            sys.stderr.write(u"Missing configuration file, %s does not exist." % cfg_path)
                    
19            sys.stderr.flush()
                    
21            
                    
22        config.readfp(open(cfg_path))
                    
23        self.ip_addr = config.get('remote', 'ip_addr')
                    
23        self.ip_addr = config.get('remote', 'ip_addr')
                    
24        self.port = config.getint('remote', 'port')
                    
25        self.key = config.get('credentials', 'key')
                    
25        self.key = config.get('credentials', 'key')
                    
26        self.secret = config.get('credentials', 'secret')
                    
27        
                    
                
factory.py https://github.com/ipython/ipyparallel.git | Python | 73 lines
                    
1"""Base config factories.
                    
2
                    
8#-----------------------------------------------------------------------------
                    
9#  Copyright (C) 2010-2011  The IPython Development Team
                    
10#
                    
30class RegistrationFactory(SessionFactory):
                    
31    """The Base Configurable for objects that involve registration."""
                    
32    
                    
32    
                    
33    url = Unicode('', config=True,
                    
34        help="""The 0MQ url used for registration. This sets transport, ip, and port
                    
37        ) # url takes precedence over ip,regport,transport
                    
38    transport = Unicode('tcp', config=True,
                    
39        help="""The 0MQ transport for communications.  This will likely be
                    
40        the default of 'tcp', but other values include 'ipc', 'epgm', 'inproc'.""")
                    
41    ip = Unicode(config=True,
                    
42        help="""The IP address for registration.  This is generally either
                    
                
test_memcached.py https://github.com/madkote/fastapi-plugins.git | Python | 155 lines
                    
46            app = fastapi_plugins.register_middleware(fastapi.FastAPI())
                    
47            config = self.fixture_get_config()
                    
48            await memcached_plugin.init_app(app=app, config=config)
                    
51
                    
52        event_loop = asyncio.new_event_loop()
                    
53        asyncio.set_event_loop(event_loop)
                    
62            app = fastapi_plugins.register_middleware(fastapi.FastAPI())
                    
63            config = self.fixture_get_config()
                    
64            await memcached_plugin.init_app(app=app, config=config)
                    
121
                    
122        event_loop = asyncio.new_event_loop()
                    
123        asyncio.set_event_loop(event_loop)
                    
146        event_loop = asyncio.new_event_loop()
                    
147        asyncio.set_event_loop(event_loop)
                    
148        coro = asyncio.coroutine(_test)
                    
                
compile.el git://github.com/emacsmirror/emacs.git | Emacs Lisp | 2829 lines
✨ Summary

This code starts a compilation process by creating a new buffer and setting its major mode to compilation-mode'. It also sets the default directory to the current directory, as specified in thedefault-directory’ variable. The `compilation-environment’ variable is used to set environment variables for the compilation process.

The code then checks if there is already a running compilation process in the current buffer. If so, it prompts the user whether to kill the process or not. If the user chooses to kill the process, the code deletes it using the `delete-process’ function.

After checking for any existing processes, the code creates a new process and sets its query on exit flag to nil. This means that when the process exits, Emacs will prompt the user whether to kill it or not. The code then runs the compilation command in the new process using the `start-process’ function.

Finally, the code displays the output of the compilation process in a separate window using the `display-buffer’ function.

                    
160
                    
161    (python-tracebacks-and-caml
                    
162     "^[ \t]*File \\(\"?\\)\\([^,\" \n\t<>]+\\)\\1, lines? \\([0-9]+\\)-?\\([0-9]+\\)?\\(?:$\\|,\
                    
533(defvar compilation-mode-font-lock-keywords
                    
534   '(;; configure output lines.
                    
535     ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to \\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: .+\\)?\\)\\|no\\|\\(.*\\)\\)$"
                    
                
 

Source

Language