TagRelations   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 21
loc 21
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __init__() 3 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
from .model import *
2
from . import tag as tagobject
3
4 View Code Duplication
class TagRelations(Base):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5
    __tablename__ = 'tag_relations'
6
7
    id            = Column(Integer, primary_key=True, nullable=False)
8
    tag_id        = Column(Integer, ForeignKey('tags.id'), nullable=False)
9
    parent_tag_id = Column(Integer, ForeignKey('tags.id'), nullable=False)
10
11
    deleted       = Column(Boolean, default=False, nullable=False)
12
13
    tag           = relationship(tagobject.Tag,
14
                                 primaryjoin=tag_id==tagobject.Tag.id,
15
                                 backref='parents')
16
17
    parent        = relationship(tagobject.Tag,
18
                                 primaryjoin=parent_tag_id==tagobject.Tag.id,
19
                                 backref='children')
20
21
22
    def __init__(self, tag, parent_tag):
23
        self.tag_id        = tag.id
24
        self.parent_tag_id = parent_tag.id
25