Conditions | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
1 | """Interface to the operating system.""" |
||
11 | 1 | def launch(path): |
|
12 | """Open a file with its default program.""" |
||
13 | 1 | name = platform.system() |
|
14 | 1 | log.info("Opening %s", path) |
|
15 | 1 | try: |
|
16 | 1 | function = { |
|
17 | 'Windows': _launch_windows, |
||
18 | 'Darwin': _launch_mac, |
||
19 | 'Linux': _launch_linux, |
||
20 | }[name] |
||
21 | 1 | except KeyError: |
|
22 | 1 | raise RuntimeError("Unrecognized platform: {}".format(name)) from None |
|
23 | else: |
||
24 | 1 | return function(path) |
|
25 | |||
38 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.