Conditions | 3 |
Total Lines | 14 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | """Interface to the operating system.""" |
||
10 | def launch(path): |
||
11 | 1 | """Open a file with its default program.""" |
|
12 | name = platform.system() |
||
13 | 1 | log.info("Opening %s", path) |
|
14 | 1 | try: |
|
15 | 1 | function = { |
|
16 | 1 | 'Windows': _launch_windows, |
|
17 | 'Darwin': _launch_mac, |
||
18 | 'Linux': _launch_linux, |
||
19 | }[name] |
||
20 | except KeyError: |
||
21 | 1 | raise RuntimeError("Unrecognized platform: {}".format(name)) from None |
|
22 | 1 | else: |
|
23 | return function(path) |
||
24 | 1 | ||
38 |