From d5a277ba4d608284991428fc3f7d6e0dbe6f8300 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 29 Apr 2012 22:18:30 -0400 Subject: [PATCH] Switch a datastructure internal to the ORM to be a set, instead of a dictionary. --- django/contrib/gis/db/models/sql/query.py | 4 ++-- django/db/models/sql/constants.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/db/models/sql/query.py b/django/contrib/gis/db/models/sql/query.py index c300dcd5279..3b8245e8790 100644 --- a/django/contrib/gis/db/models/sql/query.py +++ b/django/contrib/gis/db/models/sql/query.py @@ -9,7 +9,7 @@ from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Area, Distance -ALL_TERMS = dict([(x, None) for x in ( +ALL_TERMS = set([ 'bbcontains', 'bboverlaps', 'contained', 'contains', 'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint', 'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte', @@ -18,7 +18,7 @@ ALL_TERMS = dict([(x, None) for x in ( 'left', 'right', 'overlaps_left', 'overlaps_right', 'overlaps_above', 'overlaps_below', 'strictly_above', 'strictly_below' - )]) + ]) ALL_TERMS.update(sql.constants.QUERY_TERMS) class GeoQuery(sql.Query): diff --git a/django/db/models/sql/constants.py b/django/db/models/sql/constants.py index b5fd0487991..612755a0120 100644 --- a/django/db/models/sql/constants.py +++ b/django/db/models/sql/constants.py @@ -2,11 +2,11 @@ from collections import namedtuple import re # Valid query types (a dictionary is used for speedy lookups). -QUERY_TERMS = dict([(x, None) for x in ( +QUERY_TERMS = set([ 'exact', 'iexact', 'contains', 'icontains', 'gt', 'gte', 'lt', 'lte', 'in', 'startswith', 'istartswith', 'endswith', 'iendswith', 'range', 'year', 'month', 'day', 'week_day', 'isnull', 'search', 'regex', 'iregex', -)]) +]) # Size of each "chunk" for get_iterator calls. # Larger values are slightly faster at the expense of more storage space.