mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 02:50:12 +01:00
Add inline python docs
This commit is contained in:
parent
11f4165f37
commit
f35d965d2a
@ -27,6 +27,14 @@ class MetaDataException(Exception):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.value)
|
return repr(self.value)
|
||||||
|
|
||||||
|
# Designates a metadata field type and checks that it matches
|
||||||
|
#
|
||||||
|
# 'name' - The long name of the field type
|
||||||
|
# 'matching' - List of possible values or regex expression
|
||||||
|
# 'sep' - Separator to use if value may be a list
|
||||||
|
# 'fields' - Metadata fields (Field:Value) of this type
|
||||||
|
# 'attrs' - Build attributes (attr=value) of this type
|
||||||
|
#
|
||||||
class FieldType():
|
class FieldType():
|
||||||
def __init__(self, name, matching, sep, fields, attrs):
|
def __init__(self, name, matching, sep, fields, attrs):
|
||||||
self.name = name
|
self.name = name
|
||||||
@ -63,6 +71,7 @@ class FieldType():
|
|||||||
self._assert_regex(values, appid)
|
self._assert_regex(values, appid)
|
||||||
|
|
||||||
|
|
||||||
|
# Generic value types
|
||||||
valuetypes = {
|
valuetypes = {
|
||||||
'int' : FieldType("Integer",
|
'int' : FieldType("Integer",
|
||||||
r'^[0-9]+$', None,
|
r'^[0-9]+$', None,
|
||||||
@ -102,9 +111,10 @@ valuetypes = {
|
|||||||
'antifeatures' : FieldType("Anti-Feature",
|
'antifeatures' : FieldType("Anti-Feature",
|
||||||
[ "Ads", "Tracking", "NonFreeNet", "NonFreeDep", "NonFreeAdd" ], ',',
|
[ "Ads", "Tracking", "NonFreeNet", "NonFreeDep", "NonFreeAdd" ], ',',
|
||||||
[ "AntiFeatures" ],
|
[ "AntiFeatures" ],
|
||||||
[ ]),
|
[ ])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check an app's metadata information for integrity errors
|
||||||
def check_metadata(info):
|
def check_metadata(info):
|
||||||
for k, t in valuetypes.iteritems():
|
for k, t in valuetypes.iteritems():
|
||||||
for field in t.fields:
|
for field in t.fields:
|
||||||
|
Loading…
Reference in New Issue
Block a user