From df3d7e66daedc2d4be8b7ca2f5046ac80e0297f8 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 8 Jul 2013 09:48:12 +1000 Subject: [PATCH] Replaced some dicts with sets. --- django/contrib/gis/db/backends/oracle/operations.py | 2 +- django/contrib/gis/db/backends/postgis/operations.py | 4 ++-- django/contrib/gis/db/backends/spatialite/operations.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index 84217c331b..628018320b 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -78,7 +78,7 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations): name = 'oracle' oracle = True - valid_aggregates = dict([(a, None) for a in ('Union', 'Extent')]) + valid_aggregates = {'Union', 'Extent'} Adapter = OracleSpatialAdapter Adaptor = Adapter # Backwards-compatibility alias. diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index 84dbda3239..3863bea992 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -56,6 +56,7 @@ class PostGISSphereDistance(PostGISDistance): class PostGISRelate(PostGISFunctionParam): "For PostGIS Relate(, ) calls." pattern_regex = re.compile(r'^[012TF\*]{9}$') + def __init__(self, prefix, pattern): if not self.pattern_regex.match(pattern): raise ValueError('Invalid intersection matrix pattern "%s".' % pattern) @@ -68,8 +69,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations): postgis = True geom_func_prefix = 'ST_' version_regex = re.compile(r'^(?P\d)\.(?P\d)\.(?P\d+)') - valid_aggregates = dict([(k, None) for k in - ('Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union')]) + valid_aggregates = {'Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'} Adapter = PostGISAdapter Adaptor = Adapter # Backwards-compatibility alias. diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py index 4281cafa23..9037240e64 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -56,7 +56,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): name = 'spatialite' spatialite = True version_regex = re.compile(r'^(?P\d)\.(?P\d)\.(?P\d+)') - valid_aggregates = dict([(k, None) for k in ('Extent', 'Union')]) + valid_aggregates = {'Extent', 'Union'} Adapter = SpatiaLiteAdapter Adaptor = Adapter # Backwards-compatibility alias.