loglan_db.model_db.base_author   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 73
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A BaseAuthor.contribution() 0 7 1
1
# -*- coding: utf-8 -*-
2
# pylint: disable=C0303
3 1
"""
4
This module contains a basic Author Model
5
"""
6 1
from loglan_db import db
7 1
from loglan_db.model_db import t_name_authors
8 1
from loglan_db.model_init import InitBase, DBBase
9 1
from loglan_db.model_db.base_connect_tables import t_connect_authors
10
11
12 1
__pdoc__ = {
13
    'BaseAuthor.created': False, 'BaseAuthor.updated': False,
14
}
15
16
17 1
class BaseAuthor(db.Model, InitBase, DBBase):
18
    """Base Author's DB Model
19
20
    Describes a table structure for storing information about words authors.
21
22
    Connects with words with "many-to-many" relationship. See `t_connect_authors`.
23
24
    <details><summary>Show Examples</summary><p>
25
    ```python
26
    {'id': 13, 'full_name': 'James Cooke Brown',
27
    'abbreviation': 'JCB', 'notes': ''}
28
29
    {'id': 29, 'full_name': 'Loglan 4&5',
30
    'abbreviation': 'L4',
31
    'notes': 'The printed-on-paper book,
32
              1975 version of the dictionary.'}
33
    ```
34
    </p></details>
35
    """
36
37 1
    __tablename__ = t_name_authors
38
39 1
    id = db.Column(db.Integer, primary_key=True)
40
    """*Author's internal ID number*  
41
        **int** : primary_key=True"""
42
43 1
    abbreviation = db.Column(db.String(64), nullable=False, unique=True)
44
    """*Author's abbreviation (used in the LOD dictionary)*  
45
        **str** : max_length=64, nullable=False, unique=True
46
    Example:
47
        > JCB, L4
48
    """
49
50 1
    full_name = db.Column(db.String(64), nullable=True, unique=False)
51
    """
52
    *Author's full name (if exists)*  
53
        **str** : max_length=64, nullable=True, unique=False
54
    Example:
55
        > James Cooke Brown, Loglan 4&5
56
    """
57
58 1
    notes = db.Column(db.String(128), nullable=True, unique=False)
59
    """*Any additional information about author*  
60
        **str** : max_length=128, nullable=True, unique=False
61
    """
62
63 1
    _contribution = db.relationship(
64
        "BaseWord", back_populates="_authors", secondary=t_connect_authors)
65
66 1
    @property
67
    def contribution(self):
68
        """
69
        *Relationship query for getting a list of words coined by this author*
70
         **query** : Optional[List[BaseWord]]
71
        """
72
        return self._contribution
73