Skip to content

Commit 0414130

Browse files
fix lint
1 parent 0c607ed commit 0414130

4 files changed

Lines changed: 25 additions & 20 deletions

File tree

drift/core/drift_sdk.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def _init_auto_instrumentations(self) -> None:
443443
pass
444444

445445
try:
446-
import httpx # type: ignore[unresolved-import]
446+
import httpx
447447

448448
from ..instrumentation.httpx import HttpxInstrumentation
449449

@@ -473,7 +473,7 @@ def _init_auto_instrumentations(self) -> None:
473473
pass
474474

475475
try:
476-
import sqlalchemy # type: ignore[unresolved-import]
476+
import sqlalchemy
477477

478478
from ..instrumentation.sqlalchemy import SqlAlchemyInstrumentation
479479

@@ -490,7 +490,7 @@ def _init_auto_instrumentations(self) -> None:
490490

491491
# Try psycopg2 first
492492
try:
493-
import psycopg2 # type: ignore[unresolved-import]
493+
import psycopg2
494494

495495
from ..instrumentation.psycopg2 import Psycopg2Instrumentation
496496

@@ -502,7 +502,7 @@ def _init_auto_instrumentations(self) -> None:
502502

503503
# Try psycopg (v3)
504504
try:
505-
import psycopg # type: ignore[unresolved-import]
505+
import psycopg
506506

507507
from ..instrumentation.psycopg import PsycopgInstrumentation
508508

@@ -518,7 +518,7 @@ def _init_auto_instrumentations(self) -> None:
518518
logger.debug("Both psycopg2 and psycopg available - instrumented both")
519519

520520
try:
521-
import redis # type: ignore[unresolved-import]
521+
import redis
522522

523523
from ..instrumentation.redis import RedisInstrumentation
524524

@@ -528,7 +528,7 @@ def _init_auto_instrumentations(self) -> None:
528528
pass
529529

530530
try:
531-
import grpc # type: ignore[unresolved-import]
531+
import grpc
532532

533533
from ..instrumentation.grpc import GrpcInstrumentation
534534

drift/instrumentation/django/instrumentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def patched_setup(*args, **kwargs):
130130
finally:
131131
django.setup = original_setup
132132

133-
django.setup = patched_setup
133+
django.setup = patched_setup # ty: ignore[invalid-assignment]
134134
logger.debug("Deferred middleware injection to django.setup()")
135135

136136
def _force_database_reconnect(self) -> None:

drift/instrumentation/urllib3/e2e-tests/src/app.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,7 @@ def test_preload_content_false_gzip():
548548

549549
@app.route("/test/preload-false-decode-content-false-gzip", methods=["GET"])
550550
def test_preload_false_decode_content_false_gzip():
551-
"""Test preload_content=False + decode_content=False with gzip response.
552-
"""
551+
"""Test preload_content=False + decode_content=False with gzip response."""
553552
import gzip as gzip_mod
554553

555554
try:
@@ -570,20 +569,24 @@ def test_preload_false_decode_content_false_gzip():
570569
try:
571570
decompressed = gzip_mod.decompress(raw_bytes)
572571
data = json.loads(decompressed.decode("utf-8"))
573-
return jsonify({
574-
"raw_bytes_length": len(raw_bytes),
575-
"decompressed_length": len(decompressed),
576-
"was_compressed": len(raw_bytes) != len(decompressed),
577-
"data": data,
578-
})
572+
return jsonify(
573+
{
574+
"raw_bytes_length": len(raw_bytes),
575+
"decompressed_length": len(decompressed),
576+
"was_compressed": len(raw_bytes) != len(decompressed),
577+
"data": data,
578+
}
579+
)
579580
except gzip_mod.BadGzipFile:
580581
# If we get here during replay, it means the bytes were already
581582
# decompressed - this is the bug
582-
return jsonify({
583-
"error": "BadGzipFile - bytes were not compressed as expected",
584-
"raw_bytes_length": len(raw_bytes),
585-
"raw_bytes_preview": raw_bytes[:100].decode("utf-8", errors="replace"),
586-
}), 500
583+
return jsonify(
584+
{
585+
"error": "BadGzipFile - bytes were not compressed as expected",
586+
"raw_bytes_length": len(raw_bytes),
587+
"raw_bytes_preview": raw_bytes[:100].decode("utf-8", errors="replace"),
588+
}
589+
), 500
587590
except Exception as e:
588591
return jsonify({"error": str(e)}), 500
589592

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ exclude = ["**/e2e-tests/**", "**/stack-tests/**"]
133133
[[tool.ty.overrides]]
134134
# Disable unresolved-import errors for instrumentation files with optional dependencies
135135
include = [
136+
"drift/core/**",
136137
"drift/instrumentation/django/**",
137138
"drift/instrumentation/grpc/**",
138139
"drift/instrumentation/psycopg/**",
@@ -141,6 +142,7 @@ include = [
141142
"drift/instrumentation/pyjwt/**",
142143
"drift/instrumentation/redis/**",
143144
"drift/instrumentation/kinde/**",
145+
"drift/instrumentation/urllib3/**",
144146
"drift/instrumentation/http/transform_engine.py",
145147
]
146148

0 commit comments

Comments
 (0)