AbstractEndpoint   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 9
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A allowed_methods() 0 3 1
A get_allowed_methods() 0 4 3
1
import abc
2
from typing import Set
3
4
HTTP_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'OPTIONS']
5
6
7
class AbstractEndpoint(metaclass=abc.ABCMeta):
8
    @property
9
    def allowed_methods(self) -> Set[str]:
10
        return self.get_allowed_methods()
11
12
    @classmethod
13
    def get_allowed_methods(cls) -> Set[str]:
14
        return {
15
            method for method in HTTP_METHODS if hasattr(cls, method.lower())
16
        }
17