Skip to content

Commit fe713c3

Browse files
committed
chore(mypy): ignore present attr defined in custom model; note for tech debt
1 parent 3ae1575 commit fe713c3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

aws_lambda_powertools/event_handler/appsync.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def lambda_handler(event, context):
142142
ValueError
143143
If we could not find a field resolver
144144
"""
145+
# Maintenance: revisit generics/overload to fix [attr-defined] in mypy usage
145146
BaseRouter.current_event = data_model(event)
146147
BaseRouter.lambda_context = context
147148
resolver = self._get_resolver(BaseRouter.current_event.type_name, BaseRouter.current_event.field_name)

examples/event_handler_graphql/src/custom_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ class Location(TypedDict, total=False):
2323
class MyCustomModel(AppSyncResolverEvent):
2424
@property
2525
def country_viewer(self) -> str:
26-
return self.get_header_value(name="cloudfront-viewer-country", default_value="", case_sensitive=False) # type: ignore[return-value] sentinel typing # noqa: E501
26+
return self.get_header_value(name="cloudfront-viewer-country", default_value="", case_sensitive=False) # type: ignore[return-value] # sentinel typing # noqa: E501
2727

2828
@property
2929
def api_key(self) -> str:
30-
return self.get_header_value(name="x-api-key", default_value="", case_sensitive=False) # type: ignore[return-value] sentinel typing # noqa: E501
30+
return self.get_header_value(name="x-api-key", default_value="", case_sensitive=False) # type: ignore[return-value] # sentinel typing # noqa: E501
3131

3232

3333
@app.resolver(type_name="Query", field_name="listLocations")
3434
def list_locations(page: int = 0, size: int = 10) -> list[Location]:
3535
# additional properties/methods will now be available under current_event
36-
logger.debug(f"Request country origin: {app.current_event.country_viewer}")
36+
logger.debug(f"Request country origin: {app.current_event.country_viewer}") # type: ignore[attr-defined]
3737
return [{"id": scalar_types_utils.make_id(), "name": "Perry, James and Carroll"}]
3838

3939

0 commit comments

Comments
 (0)