Conditions | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
1 | """Interface to the operating system.""" |
||
11 | def launch(path): # pragma: no cover (manual test) |
||
12 | """Open a file with its default program.""" |
||
13 | name = platform.system() |
||
14 | log.info("Opening %s", path) |
||
15 | try: |
||
16 | function = { |
||
17 | 'Windows': _launch_windows, |
||
18 | 'Darwin': _launch_mac, |
||
19 | 'Linux': _launch_linux, |
||
20 | }[name] |
||
21 | except KeyError: |
||
22 | raise AssertionError("Unknown OS: {}".format(name)) |
||
23 | else: |
||
24 | 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.