Replaced some dicts with sets.

This commit is contained in:
Alex Gaynor 2013-07-08 09:48:12 +10:00
parent 5ac7f777cd
commit df3d7e66da
3 changed files with 4 additions and 4 deletions

View File

@ -78,7 +78,7 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
name = 'oracle' name = 'oracle'
oracle = True oracle = True
valid_aggregates = dict([(a, None) for a in ('Union', 'Extent')]) valid_aggregates = {'Union', 'Extent'}
Adapter = OracleSpatialAdapter Adapter = OracleSpatialAdapter
Adaptor = Adapter # Backwards-compatibility alias. Adaptor = Adapter # Backwards-compatibility alias.

View File

@ -56,6 +56,7 @@ class PostGISSphereDistance(PostGISDistance):
class PostGISRelate(PostGISFunctionParam): class PostGISRelate(PostGISFunctionParam):
"For PostGIS Relate(<geom>, <pattern>) calls." "For PostGIS Relate(<geom>, <pattern>) calls."
pattern_regex = re.compile(r'^[012TF\*]{9}$') pattern_regex = re.compile(r'^[012TF\*]{9}$')
def __init__(self, prefix, pattern): def __init__(self, prefix, pattern):
if not self.pattern_regex.match(pattern): if not self.pattern_regex.match(pattern):
raise ValueError('Invalid intersection matrix pattern "%s".' % pattern) raise ValueError('Invalid intersection matrix pattern "%s".' % pattern)
@ -68,8 +69,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
postgis = True postgis = True
geom_func_prefix = 'ST_' geom_func_prefix = 'ST_'
version_regex = re.compile(r'^(?P<major>\d)\.(?P<minor1>\d)\.(?P<minor2>\d+)') version_regex = re.compile(r'^(?P<major>\d)\.(?P<minor1>\d)\.(?P<minor2>\d+)')
valid_aggregates = dict([(k, None) for k in valid_aggregates = {'Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'}
('Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union')])
Adapter = PostGISAdapter Adapter = PostGISAdapter
Adaptor = Adapter # Backwards-compatibility alias. Adaptor = Adapter # Backwards-compatibility alias.

View File

@ -56,7 +56,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
name = 'spatialite' name = 'spatialite'
spatialite = True spatialite = True
version_regex = re.compile(r'^(?P<major>\d)\.(?P<minor1>\d)\.(?P<minor2>\d+)') version_regex = re.compile(r'^(?P<major>\d)\.(?P<minor1>\d)\.(?P<minor2>\d+)')
valid_aggregates = dict([(k, None) for k in ('Extent', 'Union')]) valid_aggregates = {'Extent', 'Union'}
Adapter = SpatiaLiteAdapter Adapter = SpatiaLiteAdapter
Adaptor = Adapter # Backwards-compatibility alias. Adaptor = Adapter # Backwards-compatibility alias.