GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

main()   B
last analyzed

Complexity

Conditions 5

Size

Total Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 5
c 2
b 0
f 0
dl 0
loc 31
rs 8.0894
1
#!/usr/bin/env python
2
# Nat Morris (c) 2017
3
4
import argparse
5
import logging
6
import os
7
import signal
8
import sys
9
import yaml
10
11
from cctvgifbuffer.service import Service
12
13
LOG = logging.getLogger(__name__)
14
15
16
def main():
17
18
    logging.basicConfig(level=logging.INFO, format='%(levelname)8s [%(asctime)s] %(message)s')
19
20
    parser = argparse.ArgumentParser(description="CCTV GIF Buffer")
21
    parser.add_argument("-c", "--config", help="Config file", required=True)
22
    parser.add_argument("-v", "--verbose", help="Increase verbosity", action="store_true")
23
    args = parser.parse_args()
24
25
    # check config exists
26
    cfgpath = args.config.strip()
27
    if os.path.isfile(cfgpath) is False:
28
        LOG.fatal("Specified config file does not exist: %s", cfgpath)
29
        sys.exit(1)
30
31
    # load the config
32
    with open(cfgpath, 'r') as stream:
33
        try:
34
            config = yaml.load(stream)
35
        except yaml.YAMLError as exc:
36
            print(exc)
37
            sys.exit(1)
38
39
    if type(config) is not dict:
40
        LOG.fatal("Invalid YAML config")
41
        sys.exit(1)
42
43
    svc = Service(config=config)
44
    svc.start()
45
46
    sys.exit(0)
47
48
49
if __name__ == "__main__":
50
    main()
51