tracim.views.example_api.schema   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 35
dl 0
loc 57
rs 10
c 0
b 0
f 0
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
# TODO - G.M - 10-04-2018 - [cleanup][tempExample] - Drop this file
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
3
import marshmallow
4
5
6
class NoContentSchema(marshmallow.Schema):
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...
7
    pass
8
9
10
class AboutResponseSchema(marshmallow.Schema):
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...
11
    version = marshmallow.fields.String(required=True,)
12
    datetime = marshmallow.fields.DateTime(required=True)
13
14
15
class UserPathSchema(marshmallow.Schema):
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...
16
    id = marshmallow.fields.Int(
0 ignored issues
show
Coding Style Naming introduced by
The name id does not conform to the class attribute naming conventions (([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
17
        required=True,
18
        validate=marshmallow.validate.Range(min=1),
19
    )
20
21
22
class UserSchema(marshmallow.Schema):
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...
23
    id = marshmallow.fields.Int(required=True)
0 ignored issues
show
Coding Style Naming introduced by
The name id does not conform to the class attribute naming conventions (([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
24
    username = marshmallow.fields.String(
25
        required=True,
26
        validate=marshmallow.validate.Regexp(regex='[\w-]+'),
0 ignored issues
show
Bug introduced by
A suspicious escape sequence \w was found. Did you maybe forget to add an r prefix?

Escape sequences in Python are generally interpreted according to rules similar to standard C. Only if strings are prefixed with r or R are they interpreted as regular expressions.

The escape sequence that was used indicates that you might have intended to write a regular expression.

Learn more about the available escape sequences. in the Python documentation.

Loading history...
27
    )
28
    email_address = marshmallow.fields.Email(required=True)
29
    first_name = marshmallow.fields.String(required=True)
30
    last_name = marshmallow.fields.String(required=True)
31
    display_name = marshmallow.fields.String(required=True)
32
    company = marshmallow.fields.String(required=True)
33
34
35
class PaginationSchema(marshmallow.Schema):
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...
36
    first_id = marshmallow.fields.Int(required=True)
37
    last_id = marshmallow.fields.Int(required=True)
38
    current_id = marshmallow.fields.Int(required=True)
39
40
41
class ListsUserSchema(marshmallow.Schema):
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...
42
    item_nb = marshmallow.fields.Int(
43
        required=True,
44
        validate=marshmallow.validate.Range(min=0)
45
    )
46
    items = marshmallow.fields.Nested(
47
        UserSchema,
48
        many=True,
49
        only=['id', 'username', 'display_name', 'company']
50
    )
51
    # TODO - G.M - 2017-12-05 - Fix nested schema import into doc !
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
52
    # Can't add doc for nested Schema properly
53
    # When schema item isn't added through their own method
54
    # Ex : Pagination Schema doesn't work here but UserSchema is ok.
55
    pagination = marshmallow.fields.Nested(
56
        PaginationSchema
57
    )
58