tracim.lib.core.group   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A GroupApi.get_one() 0 2 1
A GroupApi._base_query() 0 2 1
A GroupApi.__init__() 0 7 1
A GroupApi.get_one_with_name() 0 2 1
1
# -*- coding: utf-8 -*-
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
import typing
3
4
__author__ = 'damien'
5
6
from tracim.models.auth import Group, User
7
from sqlalchemy.orm import Query
8
from sqlalchemy.orm import Session
9
10
11
class GroupApi(object):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
12
13
    def __init__(
14
            self,
15
            session: Session,
16
            current_user: typing.Optional[User],
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable typing does not seem to be defined.
Loading history...
17
    ):
18
        self._user = current_user
19
        self._session = session
20
21
    def _base_query(self) -> Query:
22
        return self._session.query(Group)
23
24
    def get_one(self, group_id) -> Group:
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
25
        return self._base_query().filter(Group.group_id == group_id).one()
26
27
    def get_one_with_name(self, group_name) -> Group:
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
28
        return self._base_query().filter(Group.group_name == group_name).one()
29