1010from .replicate import ObjectReplicationProxy
1111
1212
13- async def handle_get_object (
14- request : aiohttp .web .Request
15- ) -> aiohttp .web .StreamResponse :
13+ async def handle_get_object (request : aiohttp .web .Request ) -> aiohttp .web .StreamResponse :
1614 """Handle a request for getting object content."""
1715 auth = get_auth_instance (request )
1816
@@ -21,7 +19,7 @@ async def handle_get_object(
2119 await download .a_begin_download (
2220 request .match_info ["project" ],
2321 request .match_info ["container" ],
24- request .match_info ["object_name" ]
22+ request .match_info ["object_name" ],
2523 )
2624
2725 resp = aiohttp .web .StreamResponse ()
@@ -39,7 +37,7 @@ async def handle_get_object(
3937
4038
4139async def handle_replicate_container (
42- request : aiohttp .web .Request
40+ request : aiohttp .web .Request ,
4341) -> aiohttp .web .Response :
4442 """Handle request to replicating a container from a source."""
4543 auth = get_auth_instance (request )
@@ -51,22 +49,15 @@ async def handle_replicate_container(
5149 source_container = request .query ["from_container" ]
5250
5351 replicator = ObjectReplicationProxy (
54- auth ,
55- request .app ["client" ],
56- project ,
57- container ,
58- source_project ,
59- source_container
52+ auth , request .app ["client" ], project , container , source_project , source_container
6053 )
6154
6255 asyncio .ensure_future (replicator .a_copy_from_container ())
6356
6457 return aiohttp .web .Response (status = 202 )
6558
6659
67- async def handle_replicate_object (
68- request : aiohttp .web .Request
69- ) -> aiohttp .web .Response :
60+ async def handle_replicate_object (request : aiohttp .web .Request ) -> aiohttp .web .Response :
7061 """Handle a request to replicating an object from a source."""
7162 auth = get_auth_instance (request )
7263
@@ -78,22 +69,15 @@ async def handle_replicate_object(
7869 source_object = request .query ["from_object" ]
7970
8071 replicator = ObjectReplicationProxy (
81- auth ,
82- request .app ["client" ],
83- project ,
84- container ,
85- source_project ,
86- source_container
72+ auth , request .app ["client" ], project , container , source_project , source_container
8773 )
8874
8975 asyncio .ensure_future (replicator .a_copy_object (source_object ))
9076
9177 return aiohttp .web .Response (status = 202 )
9278
9379
94- async def handle_post_object_chunk (
95- request : aiohttp .web .Request
96- ) -> aiohttp .web .Response :
80+ async def handle_post_object_chunk (request : aiohttp .web .Request ) -> aiohttp .web .Response :
9781 """Handle a request for posting an object chunk."""
9882 if "from_object" in request .query .keys ():
9983 return await handle_replicate_object (request )
@@ -105,22 +89,12 @@ async def handle_post_object_chunk(
10589
10690 query , data = await parse_multipart_in (request )
10791
108- upload_session = await get_upload_instance (
109- request ,
110- project ,
111- container ,
112- p_query = query
113- )
92+ upload_session = await get_upload_instance (request , project , container , p_query = query )
11493
115- return await upload_session .a_add_chunk (
116- query ,
117- data
118- )
94+ return await upload_session .a_add_chunk (query , data )
11995
12096
121- async def handle_get_object_chunk (
122- request : aiohttp .web .Request
123- ) -> aiohttp .web .Response :
97+ async def handle_get_object_chunk (request : aiohttp .web .Request ) -> aiohttp .web .Response :
12498 """Handle a request for checking if a chunk exists."""
12599 get_auth_instance (request )
126100
@@ -134,19 +108,13 @@ async def handle_get_object_chunk(
134108 except KeyError :
135109 raise aiohttp .web .HTTPBadRequest (reason = "Malformed query string" )
136110
137- upload_session = await get_upload_instance (
138- request ,
139- project ,
140- container
141- )
111+ upload_session = await get_upload_instance (request , project , container )
142112
143- return await upload_session .a_check_segment (
144- chunk_number
145- )
113+ return await upload_session .a_check_segment (chunk_number )
146114
147115
148116async def handle_post_object_options (
149- request : aiohttp .web .Request
117+ request : aiohttp .web .Request ,
150118) -> aiohttp .web .Response :
151119 """Handle options request for posting the object chunk."""
152120 resp = aiohttp .web .Response (
@@ -160,7 +128,7 @@ async def handle_post_object_options(
160128
161129
162130async def handle_get_container (
163- request : aiohttp .web .Request
131+ request : aiohttp .web .Request ,
164132) -> aiohttp .web .StreamResponse :
165133 """Handle a request for getting container contents as an archive."""
166134 if "resumableChunkNumber" in request .query .keys ():
@@ -183,11 +151,7 @@ async def handle_get_container(
183151
184152 await resp .prepare (request )
185153
186- download = ContainerArchiveDownloadProxy (
187- auth ,
188- project ,
189- container
190- )
154+ download = ContainerArchiveDownloadProxy (auth , project , container )
191155
192156 await download .a_begin_container_download ()
193157
@@ -197,13 +161,13 @@ async def handle_get_container(
197161 return resp
198162
199163
200- async def handle_health_check (
201- request : aiohttp .web .Request
202- ) -> aiohttp .web .Response :
164+ async def handle_health_check (request : aiohttp .web .Request ) -> aiohttp .web .Response :
203165 """Answer a service health check."""
204166 # Case degraded
205167
206168 # Case nominal
207- return aiohttp .web .json_response ({
208- "status" : "Ok" ,
209- })
169+ return aiohttp .web .json_response (
170+ {
171+ "status" : "Ok" ,
172+ }
173+ )
0 commit comments