Test Failed
Push — dev ( 3a28f6...0451e7 )
by Konstantinos
05:08
created

FFProbeProxy.__call__()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
import json
2
import logging
3
from typing import Any, Protocol
4
5
from software_patterns import Proxy
6
7
__all__ = ['FFProbeProxy']
8
9
10
logger = logging.getLogger(__name__)
11
12
13
class CLIResult(Protocol):
14
    exit_code: int
15
    stdout: str
16
    stderr: str
17
18
19
class FFProbeSubjectType(Protocol):
20
    def __init__(self, ffprobe_binary: str):
21
        ...
22
23
    def __call__(self, *ffprobe_cli_args, **subprocess_settings) -> CLIResult:
24
        ...
25
26
27
class FFProbeProxy(Proxy[FFProbeSubjectType]):
28
    """Proxy class for the ffprobe CLI."""
29
30
    def __call__(self, *ffprobe_cli_args: str, **subprocess_settings: Any) -> CLIResult:
31
        logger.info(
32
            "Running ffmpeg: %s", json.dumps(list(ffprobe_cli_args), indent=4, sort_keys=True)
33
        )
34
        return self._proxy_subject(*ffprobe_cli_args, **subprocess_settings)
35