瀏覽代碼

add docstring

Bastien Sevajol 6 年之前
父節點
當前提交
57708de917
共有 2 個文件被更改,包括 16 次插入0 次删除
  1. 4 0
      hapic/decorator.py
  2. 12 0
      hapic/hapic.py

+ 4 - 0
hapic/decorator.py 查看文件

@@ -337,6 +337,10 @@ class AsyncOutputBodyControllerWrapper(OutputControllerWrapper):
337 337
 
338 338
 
339 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 344
     def get_wrapper(
341 345
         self,
342 346
         func: 'typing.Callable[..., typing.Any]',

+ 12 - 0
hapic/hapic.py 查看文件

@@ -180,6 +180,18 @@ class Hapic(object):
180 180
         error_http_code: HTTPStatus = HTTPStatus.INTERNAL_SERVER_ERROR,
181 181
         default_http_code: HTTPStatus = HTTPStatus.OK,
182 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 195
         processor = processor or MarshmallowOutputProcessor()
184 196
         processor.schema = item_schema
185 197
         context = context or self._context_getter