예제 #1
0
def command(bot, update):
    cmd_match = re.search(r"(" + prefixes + r")([^\s]+)(( )(.+)|)",
                          update.message.text)
    args = get_arguments(update.message.text)
    if len(args) == 0:
        cmds.run(cmd_match[2], CTX(bot, config, Checks(bot), update, None))
    else:
        cmds.run(
            cmd_match[2],
            CTX(bot, config, Checks(bot), update,
                get_arguments(update.message.text)))
예제 #2
0
    def _run_checks(self, spec, srpm, outfile=None):
        ''' Register and run all checks. '''
        def apply_color(s, formatter):
            ''' Return s formatted by formatter or plain s. '''
            return formatter(s) if Settings.use_colors else s

        self.checks = Checks(spec, srpm)
        if outfile:
            self.outfile = outfile
        elif Settings.no_report:
            self.outfile = '/dev/null'
        else:
            self.outfile = ReviewDirs.report_path()
        with open(self.outfile, "w") as output:
            self.log.info('Running checks and generating report')
            self.checks.run_checks(output=output,
                                   writedown=not Settings.no_report)
        if not Settings.no_report:
            print apply_color("Review template in: " + self.outfile,
                              ansi.green)
            print apply_color(_EXIT_MESSAGE, ansi.red)
예제 #3
0
import connexion
from api.resolver import tensor_bridge_api_resolver
from connexion.resolver import Resolver
from checks import Checks

DEBUG = False

app = connexion.App(__name__, specification_dir='swagger/', debug=DEBUG)
app.add_api('tensor_bridge.json',
            resolver=Resolver(function_resolver=tensor_bridge_api_resolver))

Checks(app.app)

if DEBUG:
    app.run(port=8999, debug=False)
else:
    application = app.app
예제 #4
0
#    print('Battery Needs a charge')
#else:
#    print('Battery okay')

# roughly works ...
vin = Vin('P16', 'P10')
led = Led('P11')
battery = Battery(py)

# still need work
stateMachine = StateMachine()
bilgeSwitch = BilgeSwitch('P13')
temp = Temp('P9')
button = Button('P14')

check = Checks(led, vin, bilgeSwitch, battery, temp, stateMachine)
check.whichToDo()

# https://forum.pycom.io/topic/1626/pytrack-gps-api/12

# to sleep with GPS VBACKUP on
# should go down to 17ua
# https://forum.pycom.io/topic/2525/power-consumption/16
#
# py.go_to_sleep(True)

# tell us why we woke
# display the reset reason code and the sleep remaining in seconds
# possible values of wakeup reason are:
# WAKE_REASON_ACCELEROMETER = 1
# WAKE_REASON_PUSH_BUTTON = 2