tcllib.requests.tclrequest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 18
dl 0
loc 36
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A TclRequest.get_headers() 0 3 1
A TclRequest.is_done() 0 3 1
A TclRequest.get_params() 0 3 1
A TclRequest.get_result() 0 3 1
A TclRequest.__init__() 0 8 1
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
"""Generic TCL request object."""
5
6
from . import tclresult
7
8
9
class TclRequest:
0 ignored issues
show
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
10
    """Generic TCL request object."""
11
12
    def __init__(self):
13
        """Populate variables."""
14
        self.uri = ""
15
        self.rawmode = False
16
        self.response = None
17
        self.result = None
18
        self.error = None
19
        self.success = False
20
21
    def get_headers(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
22
        """Return request headers."""
23
        return {}
24
25
    def get_params(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
26
        """Return request parameters."""
27
        return {}
28
29
    def is_done(self, http_status: int, contents: str):
0 ignored issues
show
Unused Code introduced by
The argument http_status seems to be unused.
Loading history...
Unused Code introduced by
The argument contents seems to be unused.
Loading history...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
30
        """Check if query is done or needs retry."""
31
        return False
32
33
    def get_result(self) -> tclresult.TclResult:
34
        """Return Result object."""
35
        return self.result
36