Passed
Pull Request — master (#1339)
by Konstantin
02:11
created

ocrd.cli.bashlib.bashlib_input_files()   B

Complexity

Conditions 5

Size

Total Lines 75
Code Lines 45

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 45
dl 0
loc 75
rs 8.3333
c 0
b 0
f 0
cc 5
nop 3

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
"""
2
OCR-D CLI: bash library
3
4
.. click:: ocrd.cli.bashlib:bashlib_cli
5
    :prog: ocrd bashlib
6
    :nested: full
7
8
"""
9
10
# WARNING: bashlib processors have been deprecated as of v3 of the OCR-D/core API
11
#          and will be removed in v3.7.0. We retain the `ocrd bashlib` CLI only
12
#          to not break the `ocrd bashlib filename` command, which is used in CD
13
#          scripts to get the `share` directory of the core installation. 
14
15
import click
16
from ocrd.constants import BASHLIB_FILENAME
17
18
# ----------------------------------------------------------------------
19
# ocrd bashlib
20
# ----------------------------------------------------------------------
21
22
23
@click.group('bashlib')
24
def bashlib_cli():
25
    """
26
    Work with bash library
27
    """
28
29
# ----------------------------------------------------------------------
30
# ocrd bashlib filename
31
# ----------------------------------------------------------------------
32
33
34
@bashlib_cli.command('filename')
35
def bashlib_filename():
36
    """
37
    Dump the bash library filename for sourcing by shell scripts
38
39
    For functions exported by bashlib, see `<../../README.md>`_
40
    """
41
    print(BASHLIB_FILENAME)
42
43