Passed
Push — main ( da77b5...65730f )
by Douglas
02:28
created

mandos.entry.tools.paths   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A EntryPaths.output_path_of() 0 8 3
A EntryPaths.default_path_of() 0 8 2
1
from pathlib import Path
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
from typing import Optional
3
4
from pocketutils.tools.path_tools import PathTools
0 ignored issues
show
introduced by
Unable to import 'pocketutils.tools.path_tools'
Loading history...
5
6
from mandos import logger
7
from mandos.model.searches import Search
8
from mandos.model.settings import SETTINGS
9
10
11
class EntryPaths:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
12
    @classmethod
13
    def output_path_of(cls, what: Search, input_path: Path, to: Optional[Path]) -> Path:
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
14
        if to is None:
0 ignored issues
show
unused-code introduced by
Unnecessary "elif" after "return"
Loading history...
15
            return cls.default_path_of(what, input_path)
16
        elif str(to).startswith("."):
17
            return cls.default_path_of(what, input_path).with_suffix(str(to))
18
        else:
19
            return to
20
21
    @classmethod
22
    def default_path_of(cls, what: Search, input_path: Path) -> Path:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
23
        parent = input_path.parent / (input_path.stem + "-output")
24
        child = what.key + SETTINGS.table_suffix
25
        node = PathTools.sanitize_path_node(child)
26
        if (parent / node).resolve() != (parent / child).resolve():
27
            logger.debug(f"Path {child} sanitized to {node}")
28
        return parent / node
29
30
31
__all__ = ["EntryPaths"]
32