Skip to content

Commit

Permalink
types: fix mypy type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JaffarA committed Oct 8, 2024
1 parent e1a5c01 commit 53c3606
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions demos/dashboard/demo/kitchensink/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class ScatterChartSerializer(ChartSerializer):
color: Optional[str] = None
mode: Optional[str] = "markers"

def get_x(self, df) -> str:
def get_x(self, df) -> str | None:
return self.x

def get_y(self, df) -> str:
def get_y(self, df) -> str | None:
return self.y

def get_size(self, df) -> str:
def get_size(self, df) -> str | None:
return self.size

def to_fig(self, df) -> go.Figure:
Expand All @@ -42,10 +42,10 @@ class BarChartSerializer(ChartSerializer):
color: Optional[str] = None
barmode: Optional[str] = "group"

def get_x(self, df) -> str:
def get_x(self, df) -> str | None:
return self.x

def get_y(self, df) -> str:
def get_y(self, df) -> str | None:
return self.y

def to_fig(self, df) -> go.Figure:
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/kitchensink/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class DemoDashboard(Dashboard):
grid_css_classes=Grid.TWO.value,
)
stat_two = Stat(
value=StatData(text="88%", sub_text="decrease", change_by="12%"),
value=StatData(text="88%", sub_text="decrease", change_by_text="12%"),
icon="<i data-feather='users'></i>",
grid_css_classes=Grid.TWO.value,
)
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/kitchensink/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def as_view(cls, **initkwargs):
Needed prior to 4.1 for CBV
"""
view = super().as_view(**initkwargs)
view._is_coroutine = asyncio.coroutines._is_coroutine
view._is_coroutine = asyncio.coroutines._is_coroutine # type: ignore
return view

async def get(self, request: HttpRequest, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def CACHES(self):
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": f"redis://{self.REDIS_HOST}:{self.REDIS_PORT}/1",
"KEY_PREFIX": f"{self.PROJECT_ENVIRONMENT_SLUG}_",
"KEY_PREFIX": f"{self.PROJECT_ENVIRONMENT_SLUG}_", # type: ignore
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PARSER_CLASS": "redis.connection.HiredisParser",
Expand Down
4 changes: 2 additions & 2 deletions demos/dashboard/demo/vehicle/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def fetch_service_count(request, **kwargs):

@staticmethod
def fetch_vehicle_details(*args, **kwargs):
vehicle = kwargs.get("object")
vehicle: Vehicle = kwargs.get("object") # type: ignore
return StatData(
text=dict_to_table(
{
Expand All @@ -92,7 +92,7 @@ def fetch_vehicle_details(*args, **kwargs):

@staticmethod
def fetch_last_route(*args, **kwargs):
vehicle = kwargs.get("object")
vehicle: Vehicle = kwargs.get("object") # type: ignore
locations = vehicle.get_locations_for_last_job()
lat_coords = [location.lat for location in locations]
lon_coords = [location.lon for location in locations]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class Command(BaseCommand):
def handle(self, *args, **options):
if Data.objects.count() == 0:
vehicles = baker.make("Vehicle", _quantity=5, _bulk_create=True)
vehicles = baker.make("Vehicle", _quantity=5, _bulk_create=True) # type: ignore
location_param, _ = Parameter.objects.get_or_create(
name="Current Location", cast_type=Parameter.CastType.COORDINATE
)
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/vehicle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ def convert(self):
Coord = namedtuple("Coord", ["lon", "lat"])
return Coord(lon=lon, lat=lat)
elif self.parameter.cast_type == "datetime":
return datetime.strptime(self.value, self.DT_FORMAT)
return datetime.strptime(self.value, self.DT_FORMAT) # type: ignore
2 changes: 1 addition & 1 deletion docs/docs_dj_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PROJECT_NAME = "docs"


ADMINS = []
ADMINS = [] # type: ignore


SECRET_KEY = "somesecretvalue"
Expand Down

0 comments on commit 53c3606

Please sign in to comment.