Browse Source

add docstring

Bastien Sevajol 6 years ago
parent
commit
57708de917
2 changed files with 16 additions and 0 deletions
  1. 4 0
      hapic/decorator.py
  2. 12 0
      hapic/hapic.py

+ 4 - 0
hapic/decorator.py View File

337
 
337
 
338
 
338
 
339
 class AsyncOutputStreamControllerWrapper(OutputControllerWrapper):
339
 class AsyncOutputStreamControllerWrapper(OutputControllerWrapper):
340
+    """
341
+    This controller wrapper produce a wrapper who caught the http view items
342
+    to check and serialize them into a stream response.
343
+    """
340
     def get_wrapper(
344
     def get_wrapper(
341
         self,
345
         self,
342
         func: 'typing.Callable[..., typing.Any]',
346
         func: 'typing.Callable[..., typing.Any]',

+ 12 - 0
hapic/hapic.py View File

180
         error_http_code: HTTPStatus = HTTPStatus.INTERNAL_SERVER_ERROR,
180
         error_http_code: HTTPStatus = HTTPStatus.INTERNAL_SERVER_ERROR,
181
         default_http_code: HTTPStatus = HTTPStatus.OK,
181
         default_http_code: HTTPStatus = HTTPStatus.OK,
182
     ) -> typing.Callable[[typing.Callable[..., typing.Any]], typing.Any]:
182
     ) -> typing.Callable[[typing.Callable[..., typing.Any]], typing.Any]:
183
+        """
184
+        Decorate with a wrapper who check and serialize each items in output
185
+        stream.
186
+
187
+        :param item_schema: Schema of output stream items
188
+        :param processor: ProcessorInterface object to process with given
189
+        schema
190
+        :param context: Context to use here
191
+        :param error_http_code: http code in case of error
192
+        :param default_http_code: http code in case of success
193
+        :return: decorator
194
+        """
183
         processor = processor or MarshmallowOutputProcessor()
195
         processor = processor or MarshmallowOutputProcessor()
184
         processor.schema = item_schema
196
         processor.schema = item_schema
185
         context = context or self._context_getter
197
         context = context or self._context_getter