Skip to content

Commit bfecd7a

Browse files
dsotirho-ucschannes-ucsc
authored andcommitted
Replace use of attr with attrs in AppController subclasses
Fixes regression from fb58b01. The problem manifested as an error with the `app` property in an AppController subclass, and this wasn't noticed until now due to the `app` property not being accessed in a controller that had this problem, namely ManifestController.
1 parent 4aae82e commit bfecd7a

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/azul/health.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Optional,
1616
)
1717

18-
import attr
18+
import attrs
1919
from botocore.exceptions import (
2020
ClientError,
2121
)
@@ -83,7 +83,7 @@ def description(self):
8383
return self.fget.__doc__
8484

8585

86-
@attr.s(frozen=True, kw_only=True, auto_attribs=True)
86+
@attrs.frozen(kw_only=True, slots=False)
8787
class HealthController(AppController):
8888
lambda_name: str
8989

@@ -158,7 +158,7 @@ def _make_response(self, body: JSON) -> Response:
158158
return Response(body=json.dumps(body), status_code=status)
159159

160160

161-
@attr.s(frozen=True, kw_only=True, auto_attribs=True)
161+
@attrs.frozen(kw_only=True, slots=False)
162162
class Health:
163163
"""
164164
Encapsulates information about the health status of an Azul deployment. All

src/azul/service/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
TypedDict,
1111
)
1212

13-
import attr
13+
import attrs
1414
from chalice import (
1515
ForbiddenError,
1616
)
@@ -59,7 +59,7 @@
5959
FiltersJSON = Mapping[str, FilterOperator]
6060

6161

62-
@attr.s(auto_attribs=True, kw_only=True, frozen=True)
62+
@attrs.frozen(kw_only=True)
6363
class Filters:
6464
explicit: FiltersJSON
6565
source_ids: set[str]
@@ -82,7 +82,7 @@ def to_json(self) -> JSON:
8282
}
8383

8484
def update(self, filters: FiltersJSON) -> 'Filters':
85-
return attr.evolve(self, explicit={**self.explicit, **filters})
85+
return attrs.evolve(self, explicit={**self.explicit, **filters})
8686

8787
def reify(self,
8888
plugin: MetadataPlugin,
@@ -177,7 +177,7 @@ def __call__(self,
177177
) -> mutable_furl: ...
178178

179179

180-
@attr.s(auto_attribs=True, frozen=True, kw_only=True)
180+
@attrs.frozen(kw_only=True)
181181
class ServiceAppController(AppController):
182182
file_url_func: FileUrlFunc
183183

src/azul/service/catalog_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import attr
1+
import attrs
22

33
from azul import (
44
CatalogName,
@@ -53,7 +53,7 @@ def list_catalogs(self) -> schema.object(
5353
'atlas': catalog.atlas,
5454
'plugins': {
5555
plugin_type: {
56-
**attr.asdict(plugin),
56+
**attrs.asdict(plugin),
5757
**self._plugin_config(plugin_type, catalog.name)
5858
}
5959
for plugin_type, plugin in catalog.plugins.items()

src/azul/service/manifest_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
get_type_hints,
99
)
1010

11-
import attr
11+
import attrs
1212
from chalice import (
1313
BadRequestError,
1414
ChaliceViewError,
@@ -76,7 +76,7 @@ class ManifestGenerationState(TypedDict, total=False):
7676
assert manifest_state_key in get_type_hints(ManifestGenerationState)
7777

7878

79-
@attr.s(frozen=True, auto_attribs=True, kw_only=True)
79+
@attrs.frozen(kw_only=True)
8080
class ManifestController(SourceController):
8181
manifest_url_func: ManifestUrlFunc
8282

0 commit comments

Comments
 (0)