Passed
Push — master ( d90139...c44661 )
by Mingyu
49s
created

app.context   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A _ContextProperty.user_agent() 0 3 1
A _ContextProperty.remote_addr() 0 3 1
A _ContextProperty.secret_key() 0 3 1
1
from flask import current_app, request
2
3
4
class _ContextProperty:
5
    @property
6
    def secret_key(self) -> str:
7
        return current_app.secret_key
8
9
    @property
10
    def user_agent(self) -> str:
11
        return request.headers['user_agent']
12
13
    @property
14
    def remote_addr(self) -> str:
15
        return request.remote_addr
16
17
18
context_property = _ContextProperty()
19