Skip to content

Commit 38ed40a

Browse files
committed
Linting
1 parent e56bf17 commit 38ed40a

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

django_mongodb_backend/compiler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ def execute_sql(
359359
except EmptyResultSet:
360360
return iter([]) if result_type == MULTI else None
361361

362-
# print(f"Query: {query}")
363362
cursor = query.get_cursor()
364363
if result_type == SINGLE:
365364
try:
@@ -786,7 +785,6 @@ def explain_query(self):
786785
for option in self.connection.ops.explain_options:
787786
if value := options.get(option):
788787
kwargs[option] = value
789-
# print(f"PIPELINE: {pipeline}")
790788
explain = self.connection.database.command(
791789
"explain",
792790
{"aggregate": self.collection_name, "pipeline": pipeline, "cursor": {}},

django_mongodb_backend/gis/features.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ def django_test_skips(self):
4343
"gis_tests.distapp.tests.DistanceTest.test_distance_lookups",
4444
"gis_tests.distapp.tests.DistanceTest.test_distance_lookups_with_expression_rhs",
4545
"gis_tests.distapp.tests.DistanceTest.test_distance_annotation_group_by",
46-
# "gis_tests.distapp.tests.DistanceFunctionsTests.test_distance_simple",
47-
# "gis_tests.distapp.tests.DistanceFunctionsTests.test_distance_order_by",
4846
},
4947
"ImproperlyConfigured isn't raised when using RasterField": {
5048
# Normally RasterField.db_type() raises an error, but MongoDB

django_mongodb_backend/gis/lookups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def _gis_lookup(self, compiler, connection, as_expr=False):
99
rhs_mql = process_rhs(self, compiler, connection, as_expr=as_expr)
1010
try:
1111
rhs_op = self.get_rhs_op(connection, rhs_mql)
12-
except KeyError:
13-
raise NotSupportedError(f"MongoDB does not support the '{self.lookup_name}' lookup.")
12+
except KeyError as e:
13+
raise NotSupportedError(f"MongoDB does not support the '{self.lookup_name}' lookup.") from e
1414
return rhs_op.as_mql(lhs_mql, rhs_mql, self.rhs_params)
1515

1616

django_mongodb_backend/gis/operations.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
from .utils import SpatialOperator
1010

1111

12-
def _gis_within_operator(field, value, op=None, params=None):
13-
# print(f"Within value: {value}")
12+
def _gis_within_operator(field, value, op=None, params=None): # noqa: ARG001
1413
return {
1514
field: {
1615
"$geoWithin": {
@@ -23,7 +22,7 @@ def _gis_within_operator(field, value, op=None, params=None):
2322
}
2423

2524

26-
def _gis_intersects_operator(field, value, op=None, params=None):
25+
def _gis_intersects_operator(field, value, op=None, params=None): # noqa: ARG001
2726
return {
2827
field: {
2928
"$geoIntersects": {
@@ -36,7 +35,7 @@ def _gis_intersects_operator(field, value, op=None, params=None):
3635
}
3736

3837

39-
def _gis_disjoint_operator(field, value, op=None, params=None):
38+
def _gis_disjoint_operator(field, value, op=None, params=None): # noqa: ARG001
4039
return {
4140
field: {
4241
"$not": {
@@ -51,7 +50,7 @@ def _gis_disjoint_operator(field, value, op=None, params=None):
5150
}
5251

5352

54-
def _gis_contains_operator(field, value, op=None, params=None):
53+
def _gis_contains_operator(field, value, op=None, params=None): # noqa: ARG001
5554
value_type = value["type"]
5655
if value_type != "Point":
5756
raise NotSupportedError("MongoDB does not support contains on non-Point query geometries.")
@@ -68,11 +67,7 @@ def _gis_contains_operator(field, value, op=None, params=None):
6867

6968

7069
def _gis_distance_operator(field, value, op=None, params=None):
71-
# print(f"Distance: {params}")
72-
if hasattr(params[0], "m"):
73-
distance = params[0].m
74-
else:
75-
distance = params[0]
70+
distance = params[0].m if hasattr(params[0], "m") else params[0]
7671
if op == "distance_gt" or op == "distance_gte":
7772
cmd = {
7873
field: {
@@ -97,7 +92,6 @@ def _gis_distance_operator(field, value, op=None, params=None):
9792
}
9893
}
9994
}
100-
# print(f"Command: {cmd}")
10195
return cmd
10296

10397

0 commit comments

Comments
 (0)