GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 598b8e...6df1c2 )
by Andrew
01:03
created

DictJugglerTaskStart   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A load_from_issue() 0 6 3
1
# json parser implementation
2
from juggler import *
0 ignored issues
show
Coding Style introduced by
The usage of wildcard imports like juggler should generally be avoided.
Loading history...
Unused Code introduced by
JugglerSimpleProperty was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerTimesheet was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerTaskProperty was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
is_number was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
DEFAULT_OUTPUT was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerSource was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
os was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
set_logging_level was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
to_tj3interval was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerCompoundKeyword was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerIcalreport was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerOutputdir was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
icalendar was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerResource was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
TAB was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerTimezone was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
to_tj3time was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
shutil was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
logging was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
subprocess was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
tempfile was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
datetime was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
JugglerProject was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
DEFAULT_LOGLEVEL was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
to_identifier was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
from_identifier was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
TJP_DASH_PREFIX was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
TJP_NUM_ID_PREFIX was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
TJP_SPACE_PREFIX was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
OrderedDict was imported with wildcard, but is not used.
Loading history...
3
import json, re, math
0 ignored issues
show
introduced by
Multiple imports on one line (json, re, math)
Loading history...
introduced by
standard import "import json, re, math" should be placed before "from juggler import *"
Loading history...
4
import dateutil.parser
0 ignored issues
show
introduced by
Unable to import 'dateutil.parser'
Loading history...
5
6
class DictJugglerTaskDepends(JugglerTaskDepends):
7
    def load_from_issue(self, issue):
8
        """
9
        Args:
10
            issue["depends"] - a list of identifiers that this task depends on
11
        """
12
        if "depends" in issue: 
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
13
            # TODO HERE: remove ID normalization!
14
            if isinstance(issue["depends"], str) or isinstance(issue['depends'], unicode):
0 ignored issues
show
Unused Code introduced by
Consider merging these isinstance calls to isinstance(issue['depends'], (str, unicode))
Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'unicode'
Loading history...
15
                self.set_value([int(x) for x in re.findall(r"[\w']+", issue["depends"])])
16
            # TODO check for list, else add idfr
17
            else: self.set_value([int(x) for x in issue["depends"]])
18
19
class DictJugglerTaskPriority(JugglerTaskPriority):
20
    def load_from_issue(self, issue):
21
        if "priority" in issue: self.set_value(int(issue["priority"]))
0 ignored issues
show
Coding Style introduced by
More than one statement on a single line
Loading history...
22
        
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
23
class DictJugglerTaskStart(JugglerTaskStart):
24
    def load_from_issue(self, issue):
25
        if "start" in issue: 
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
26
            if isinstance(issue["start"], str):
27
                self.set_value(dateutil.parser.parse(issue["start"]))
28
            else:
29
                self.set_value(issue["start"])
30
        
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
31
class DictJugglerTaskEffort(JugglerTaskEffort):
32
    UNIT = "h"
33
    def load_from_issue(self, issue):
34
        if "effort" in issue: self.set_value(math.ceil(issue["effort"]))
0 ignored issues
show
Coding Style introduced by
More than one statement on a single line
Loading history...
35
36
class DictJugglerTaskAllocate(JugglerTaskAllocate):
37
    def load_from_issue(self, issue):
0 ignored issues
show
Bug Best Practice introduced by
Signature differs from overridden 'load_from_issue' method

It is generally a good practice to use signatures that are compatible with the Liskov substitution principle.

This allows to pass instances of the child class anywhere where the instances of the super-class/interface would be acceptable.

Loading history...
38
        if "allocate" in issue: self.set_value(issue["allocate"])
0 ignored issues
show
Coding Style introduced by
More than one statement on a single line
Loading history...
39
        else: self.set_value("me") # stub!
40
41
class DictJugglerTask(JugglerTask):
42
    def load_default_properties(self, issue):
0 ignored issues
show
Bug Best Practice introduced by
Signature differs from overridden 'load_default_properties' method

It is generally a good practice to use signatures that are compatible with the Liskov substitution principle.

This allows to pass instances of the child class anywhere where the instances of the super-class/interface would be acceptable.

Loading history...
43
        self.set_property(DictJugglerTaskDepends(issue))
44
        self.set_property(DictJugglerTaskEffort(issue))
45
        self.set_property(DictJugglerTaskAllocate(issue))
46
        self.set_property(DictJugglerTaskStart(issue))
47
        self.set_property(DictJugglerTaskPriority(issue))
48
    def load_from_issue(self, issue):
49
        self.set_id(issue["id"])
50
        if "summary" in issue: self.summary = issue["summary"]
0 ignored issues
show
Coding Style introduced by
More than one statement on a single line
Loading history...
51
52
class DictJuggler(GenericJuggler):
0 ignored issues
show
Bug introduced by
The method __inter__ which was declared abstract in the super-class GenericJuggler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method clean which was declared abstract in the super-class GenericJuggler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
53
    """ a simple dictionary based format parser """
54
    def __init__(self, issues):
0 ignored issues
show
Bug introduced by
The __init__ method of the super-class GenericJuggler is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
55
        self.issues = issues
56
    def load_issues(self):
57
        return self.issues
58
    def create_task_instance(self, issue):
59
        return DictJugglerTask(issue)
60
61
class JsonJuggler(DictJuggler):
0 ignored issues
show
Bug introduced by
The method __inter__ which was declared abstract in the super-class GenericJuggler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method clean which was declared abstract in the super-class GenericJuggler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
62
    def __init__(self, json_issues):
0 ignored issues
show
Bug introduced by
The __init__ method of the super-class DictJuggler is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
63
        self.issues = json.loads(json_issues)
64
    def toJSON(self):
65
        # TODO HERE: decode tasks back to JSON
66
        for t in self.walk(JugglerTask):
67
            for i in self.issues:
68
                if t.get_id() == i["id"]:
69
                    i["booking"] = t.walk(JugglerBooking)[0].decode()[0].isoformat()
70
        return json.dumps(self.issues, sort_keys=True, indent=4, separators=(',', ': '))
71
0 ignored issues
show
coding-style introduced by
Trailing newlines
Loading history...
72