Test Failed
Pull Request — master (#50)
by
unknown
02:48
created

LocalizedIntegerField.from_db_value()   A

Complexity

Conditions 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 3
1
from .field import LocalizedField
2
3
from django.conf import settings
0 ignored issues
show
Configuration introduced by
The import django.conf could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
5
class LocalizedIntegerField(LocalizedField):
6
7
    @classmethod
8
    def from_db_value(cls, value, *_):
9
10
        values = LocalizedField.from_db_value(value, *_)
11
        converted_values = {}
12
13
        for lang_code, _ in settings.LANGUAGES:
14
            value = values.get(lang_code)
15
            converted_values[lang_code] = int(value) if value else None
16
17
        return cls.attr_class(converted_values)
18