File: findStatus.py

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 33,804 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,850; lisp: 1,106; xml: 1,049; makefile: 583; lex: 557
file content (25 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sys
import json
import argparse


def searchForContext(context):
    print('Searching for a status with context: %s' % context)
    statuses = json.load(sys.stdin)

    for stat in statuses:
        if 'context' in stat and stat['context'] == context:
            sys.exit(0)

    sys.exit(1)


# =============================================================================
# Main
# =============================================================================

if __name__ == "__main__":
    parser = argparse.ArgumentParser("Parse github api status list")
    parser.add_argument("--context", default=None, help="context of interest")
    args = parser.parse_args()
    searchForContext(args.context)