コード例 #1
0
ファイル: main.py プロジェクト: awnowlin/lisabot
def commandparser(line, line2, nick, chan, host, lockdown, s2, lastlink):
	if line2[1] == "PRIVMSG" and (line2[3].startswith(":!") or line2[3].startswith(":.")):
		command = string.lower(line2[3][2:])
		thread.start_new_thread(meta_reporting,(line2, nick, chan, command))
		authorization = cparser.authtest(host, chan, "no")
		if command != "null" and lockdown != "true":
			 cparser.main(command, line, line2, nick, chan, host, authorization, notice, say, reply, s, s2, lastlink)
コード例 #2
0
def commandparser(line, line2, nick, chan, host, lockdown, s2, lastlink):
    if line2[1] == "PRIVMSG" and line2[3].startswith(":!"):
        command = string.lower(line2[3][2:])
        thread.start_new_thread(meta_reporting, (line2, nick, chan, command))
        if command != "null" and lockdown != "true":
            cparser.main(command, line, line2, nick, chan, host, notice, say,
                         reply, s, s2, lastlink)
コード例 #3
0
def commandparser(line, line2, nick, chan, host, lockdown, s2, lastlink):
	if line2[1] == "PRIVMSG" and (line2[3].startswith(":!") or line2[3].startswith(":.")):
		command = string.lower(line2[3][2:])
		if command == "refreshrc":
                        actionlevel = cparser.authtest(host, chan)
                        if actionlevel[4]==1:
                                return
                        else:
                                refreshRClist()
                                reply("RC List refreshed.", chan, nick)
                        return
		thread.start_new_thread(meta_reporting,(line2, nick, chan, command))
		authorization = cparser.authtest(host, chan)
		if command != "null" and lockdown != "true":
			 cparser.main(command, line, line2, nick, chan, host, authorization, notice, say, reply, s, s2, lastlink)
コード例 #4
0
def X_test_each_required_env_var_missing(capsys):
    for env_var in make_command_env_vars():
        if env_var.is_required:
            ev = new_log_artifact_env()
            ev.pop(env_var.name)
            with dry_run(ev) as env, scoped_merkelypipe_json():
                status = main(External(env=env))
                assert status != 0
    verify_approval(capsys)
コード例 #5
0
def test_non_zero_status_when_no_data_directory(capsys, mocker):
    _image_name = "acme/widget:4.67"
    sha256 = "aecdaef69c676c2466571d3233380d559ccc2032b258fc5e73f99a103db462ef"
    build_url = "https://gitlab/build/1457"
    evidence_type = "coverage"
    env = old_control_junit_env()
    set_env_vars = {}
    with dry_run(env, set_env_vars):
        mocker.patch('cdb.cdb_utils.calculate_sha_digest_for_docker_image',
                     return_value=sha256)
        control_junit("tests/integration/test-pipefile.json")

    verify_approval(capsys, ["out"])

    # extract data from approved cdb text file
    import inspect
    this_test = inspect.stack()[0].function
    approved = f"{APPROVAL_DIR}/{APPROVAL_FILE}.{this_test}.approved.txt"
    with open(approved) as file:
        old_approval = file.read()
    _old_blurb, old_method, old_payload, old_url = extract_blurb_method_payload_url(
        old_approval)

    expected_method = "Putting"
    expected_url = f"https://{DOMAIN}/api/v1/projects/{OWNER}/{PIPELINE}/artifacts/{sha256}"
    expected_payload = {
        "contents": {
            "description":
            "JUnit results xml verified by compliancedb/cdb_controls: All tests passed in 0 test suites",
            "is_compliant": True,
            "url": build_url
        },
        "evidence_type": evidence_type
    }

    # verify data from approved cdb text file
    assert old_method == expected_method
    assert old_url == expected_url
    assert old_payload == expected_payload

    # new behaviour is to fail with non-zero exit status
    ev = new_log_test_env()
    ev.pop('MERKELY_USER_DATA')
    with dry_run(ev) as env:
        status = main(External(env=env))

    assert status != 0
    output = capsys_read(capsys)
    lines = list(output.split("\n"))
    assert lines == [
        'MERKELY_COMMAND=log_test', "Error: no directory /data/junit/", ''
    ]
コード例 #6
0
ファイル: main.py プロジェクト: merkely-development/change
from commands import External, main
import sys

if __name__ == '__main__':
    external = External()
    sys.exit(main(external))
コード例 #7
0
#!/usr/bin/env python
import sys
import commands

if __name__ == '__main__':
    commands.main(sys.argv[1:])
コード例 #8
0
def main(args):
    commands.main(args)
コード例 #9
0
recognizer = sr.Recognizer()
microphone = sr.Microphone()
isLoop = True
isSpeech = True
wakeUp = True

commands()

while isLoop:
    with microphone as source:
        recognizer.adjust_for_ambient_noise(source)
        audio = recognizer.listen(source)
    try:
        audio = str(recognizer.recognize_google(audio)).lower()

        main(audio)

        if 'goodbye' in audio:
            isLoop = False
            isSpeech = False

        if 'bye' in audio:
            isLoop = False
            isSpeech = False

        if isSpeech:
            #if wakeUp:
            #  if 'dispatch' in audio:
            #     wakeUp = False;
            #    print('Speech: Listening {0}...'.format(getuser()));
            #wakeUp = True;
コード例 #10
0
def main():
    """{{cookiecutter.project_slug}} main command."""
    commands.main(){% elif cookiecutter.cli_type == "click" %}
コード例 #11
0
              help="Ops against egress rules only.")
@click.pass_context
def securitygroup(ctx, name, add, remove, direction):
    """Orchestrates AWS Security Group Profiles
  """
    commands.securitygroup.command(ctx, name, add, remove, direction)


@main.command()
@click.option("--name", required=True, help="Ipset Friendly Name.")
@click.option("--add", multiple=True, help="Add IP range(s) to an ipset.")
@click.option("--remove",
              help="Remove IP ranges from an ipset by regular expression.")
@click.pass_context
def waf(ctx, name, add, remove):
    """Manages A Cloudfront Distribution's WAF IPSet
  """
    commands.waf.command(ctx, name, add, remove)


## main #########################################

if __name__ == "__main__":
    try:
        main(obj={})
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)

    sys.exit(0)
コード例 #12
0
ファイル: staticcompiler.py プロジェクト: ObjectJS/opm-python
# python
# encoding=utf-8

import commands

if __name__ == "__main__":
    commands.main()
コード例 #13
0
ファイル: cli.py プロジェクト: cavagrill/helium-commander
import commands
import click
import helium

_commands = [
    "label",
    "sensor",
    "element",
    "sensor-script",
    "cloud-script",
    "organization",
    "user"
]

@click.option('--api-key',
              envvar='HELIUM_API_KEY',
              help='your Helium API key. Can also be specified using the HELIUM_API_KEY environment variable')
@click.option('--host',
              envvar='HELIUM_API_URL',
              default=None,
              help= 'The Helium base API URL. Can also be specified using the HELIUM_API_URL environment variable.' )
@commands.cli(version=helium.__version__, package='helium.commands', commands = _commands)
def cli(ctx, api_key, host, **kwargs):
    ctx.obj = helium.Service(api_key, host)

main = commands.main(cli)

if __name__ == '__main__':
    main()
コード例 #14
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4

import sys

import api
import commands
import server

if len(sys.argv) > 1 and sys.argv[1] == 'server':
    server.run()
else:
    commands.main()
コード例 #15
0
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
from commands import main

if __name__ == "__main__":
    main()
コード例 #16
0
#!/usr/bin/env python
import sys
import commands

if __name__ == "__main__":
    commands.main(sys.argv[1:])
コード例 #17
0
def main():
    """{{cookiecutter.project_slug}} main command."""
    commands.main()
コード例 #18
0
#!/usr/bin/env python
from commands import main

if __name__ == '__main__':
    raise SystemExit(main())