Completed
Push — master ( 3c108b...266306 )
by Oleksandr
03:35
created

verboselib.core.set_language_bypass()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 0
1
import threading
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
3
from typing import Optional
4
from typing import Text
5
6
from verboselib.utils import export
7
8
9
_bypass_value  = "__bypass__"
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Loading history...
Coding Style Naming introduced by
Constant name "_bypass_value" doesn't conform to UPPER_CASE naming style ('([^\\W\\da-z][^\\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...
10
_local_storage = threading.local()
11
12
13
@export
14
def get_default_language() -> Optional[Text]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
15
  return getattr(_local_storage, "default_value", None)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
16
17
18
@export
19
def set_default_language(value: Optional[Text]) -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
20
  setattr(_local_storage, "default_value", value)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
21
22
23
@export
24
def drop_default_language() -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
25
  set_default_language(None)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
26
27
28
@export
29
def set_language(value: Optional[Text]) -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
30
  setattr(_local_storage, "current_value", value)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
31
32
33
@export
34
def set_language_bypass() -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
35
  set_language(_bypass_value)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
36
37
38
@export
39
def drop_language() -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
40
  set_language(None)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
41
42
43
@export
44
def get_language() -> Optional[Text]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
45
  language = getattr(_local_storage, "current_value", None)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
46
47
  if language is _bypass_value:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
48
    return None
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
49
50
  return language or getattr(_local_storage, "default_value", None)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
51