-
Notifications
You must be signed in to change notification settings - Fork 25
/
__init__.py
40 lines (31 loc) · 1.49 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from __future__ import unicode_literals, print_function, division, absolute_import
from collections import namedtuple
from clld.db.models import common
from clld import interfaces
__version__ = "3.2.3"
class Resource(namedtuple('Resource', 'name model interface with_index with_rdfdump')):
def __new__(cls, name, model, interface, with_index=True, with_rdfdump=True):
return super(Resource, cls).__new__(cls, name, model, interface, with_index, with_rdfdump)
@property
def plural(self):
return self.name + 's'
RESOURCES = [
Resource('dataset', common.Dataset, interfaces.IDataset, with_index=False),
Resource('contribution', common.Contribution, interfaces.IContribution),
Resource('parameter', common.Parameter, interfaces.IParameter),
Resource('language', common.Language, interfaces.ILanguage),
Resource('contributor', common.Contributor, interfaces.IContributor),
Resource('source', common.Source, interfaces.ISource),
Resource('sentence', common.Sentence, interfaces.ISentence),
Resource('valueset', common.ValueSet, interfaces.IValueSet),
Resource('value', common.Value, interfaces.IValue),
Resource('unitparameter', common.UnitParameter, interfaces.IUnitParameter),
Resource('unit', common.Unit, interfaces.IUnit),
Resource('unitvalue', common.UnitValue, interfaces.IUnitValue),
Resource(
'combination',
common.Combination,
interfaces.ICombination,
with_index=False,
with_rdfdump=False),
]