We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
helper function for COCO parser
## 🚀 Feature
**Is your feature request related to a problem? Please describe.**
As described in #79, it's currently very verbose to create a COCO parser, the steps should be ideally be reduced to a single function call.

**Dream API**
```python
    parser = datasets.coco.parser(
        annotations_file="path_to_annotations.json",
        img_dir="path_to_images_dir",
    )
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mantisshrimp/datasets/coco/parsers.py`
Content:
```
1 __all__ = ["COCOImageInfoParser", "COCOAnnotationParser"]
2 
3 from mantisshrimp.imports import *
4 from mantisshrimp.core import *
5 from mantisshrimp.parsers.defaults import *
6 from mantisshrimp.parsers.mixins import *
7 
8 
9 class COCOImageInfoParser(DefaultImageInfoParser):
10     def __init__(self, infos, img_dir):
11         super().__init__()
12         self.infos = infos
13         self.img_dir = img_dir
14 
15     def __iter__(self):
16         yield from self.infos
17 
18     def __len__(self):
19         return len(self.infos)
20 
21     def imageid(self, o) -> int:
22         return o["id"]
23 
24     def filepath(self, o) -> Union[str, Path]:
25         return self.img_dir / o["file_name"]
26 
27     def height(self, o) -> int:
28         return o["height"]
29 
30     def width(self, o) -> int:
31         return o["width"]
32 
33 
34 class COCOAnnotationParser(MaskRCNNParser, AreasParserMixin, IsCrowdsParserMixin):
35     def __init__(self, annotations: list):
36         self.annotations = annotations
37 
38     def __iter__(self):
39         yield from self.annotations
40 
41     def __len__(self):
42         return len(self.annotations)
43 
44     def imageid(self, o) -> int:
45         return o["image_id"]
46 
47     def labels(self, o) -> List[int]:
48         return [o["category_id"]]
49 
50     def bboxes(self, o) -> List[BBox]:
51         return [BBox.from_xywh(*o["bbox"])]
52 
53     def areas(self, o) -> List[float]:
54         return [o["area"]]
55 
56     def masks(self, o) -> List[MaskArray]:
57         seg = o["segmentation"]
58         if o["iscrowd"]:
59             return [RLE.from_coco(seg["counts"])]
60         else:
61             return [Polygon(seg)]
62 
63     def iscrowds(self, o) -> List[bool]:
64         return [o["iscrowd"]]
65
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mantisshrimp/datasets/coco/parsers.py b/mantisshrimp/datasets/coco/parsers.py
--- a/mantisshrimp/datasets/coco/parsers.py
+++ b/mantisshrimp/datasets/coco/parsers.py
@@ -1,9 +1,23 @@
-__all__ = ["COCOImageInfoParser", "COCOAnnotationParser"]
+__all__ = ["parser", "COCOImageInfoParser", "COCOAnnotationParser"]
 
 from mantisshrimp.imports import *
 from mantisshrimp.core import *
-from mantisshrimp.parsers.defaults import *
-from mantisshrimp.parsers.mixins import *
+from mantisshrimp.parsers import *
+
+
+def parser(
+    annotations_file: Union[str, Path], img_dir: Union[str, Path]
+) -> ParserInterface:
+    annotations_dict = json.loads(Path(annotations_file).read())
+
+    image_info_parser = COCOImageInfoParser(
+        infos=annotations_dict["images"], img_dir=img_dir
+    )
+    annotations_parser = COCOAnnotationParser(
+        annotations=annotations_dict["annotations"]
+    )
+
+    return CombinedParser(image_info_parser, annotations_parser)
 
 
 class COCOImageInfoParser(DefaultImageInfoParser):

{"golden_diff": "diff --git a/mantisshrimp/datasets/coco/parsers.py b/mantisshrimp/datasets/coco/parsers.py\n--- a/mantisshrimp/datasets/coco/parsers.py\n+++ b/mantisshrimp/datasets/coco/parsers.py\n@@ -1,9 +1,23 @@\n-__all__ = [\"COCOImageInfoParser\", \"COCOAnnotationParser\"]\n+__all__ = [\"parser\", \"COCOImageInfoParser\", \"COCOAnnotationParser\"]\n \n from mantisshrimp.imports import *\n from mantisshrimp.core import *\n-from mantisshrimp.parsers.defaults import *\n-from mantisshrimp.parsers.mixins import *\n+from mantisshrimp.parsers import *\n+\n+\n+def parser(\n+    annotations_file: Union[str, Path], img_dir: Union[str, Path]\n+) -> ParserInterface:\n+    annotations_dict = json.loads(Path(annotations_file).read())\n+\n+    image_info_parser = COCOImageInfoParser(\n+        infos=annotations_dict[\"images\"], img_dir=img_dir\n+    )\n+    annotations_parser = COCOAnnotationParser(\n+        annotations=annotations_dict[\"annotations\"]\n+    )\n+\n+    return CombinedParser(image_info_parser, annotations_parser)\n \n \n class COCOImageInfoParser(DefaultImageInfoParser):\n", "issue": "helper function for COCO parser\n## \ud83d\ude80 Feature\r\n**Is your feature request related to a problem? Please describe.**\r\nAs described in #79, it's currently very verbose to create a COCO parser, the steps should be ideally be reduced to a single function call.\r\n\r\n**Dream API**\r\n```python\r\n    parser = datasets.coco.parser(\r\n        annotations_file=\"path_to_annotations.json\",\r\n        img_dir=\"path_to_images_dir\",\r\n    )\r\n```\r\n\n", "before_files": [{"content": "__all__ = [\"COCOImageInfoParser\", \"COCOAnnotationParser\"]\n\nfrom mantisshrimp.imports import *\nfrom mantisshrimp.core import *\nfrom mantisshrimp.parsers.defaults import *\nfrom mantisshrimp.parsers.mixins import *\n\n\nclass COCOImageInfoParser(DefaultImageInfoParser):\n    def __init__(self, infos, img_dir):\n        super().__init__()\n        self.infos = infos\n        self.img_dir = img_dir\n\n    def __iter__(self):\n        yield from self.infos\n\n    def __len__(self):\n        return len(self.infos)\n\n    def imageid(self, o) -> int:\n        return o[\"id\"]\n\n    def filepath(self, o) -> Union[str, Path]:\n        return self.img_dir / o[\"file_name\"]\n\n    def height(self, o) -> int:\n        return o[\"height\"]\n\n    def width(self, o) -> int:\n        return o[\"width\"]\n\n\nclass COCOAnnotationParser(MaskRCNNParser, AreasParserMixin, IsCrowdsParserMixin):\n    def __init__(self, annotations: list):\n        self.annotations = annotations\n\n    def __iter__(self):\n        yield from self.annotations\n\n    def __len__(self):\n        return len(self.annotations)\n\n    def imageid(self, o) -> int:\n        return o[\"image_id\"]\n\n    def labels(self, o) -> List[int]:\n        return [o[\"category_id\"]]\n\n    def bboxes(self, o) -> List[BBox]:\n        return [BBox.from_xywh(*o[\"bbox\"])]\n\n    def areas(self, o) -> List[float]:\n        return [o[\"area\"]]\n\n    def masks(self, o) -> List[MaskArray]:\n        seg = o[\"segmentation\"]\n        if o[\"iscrowd\"]:\n            return [RLE.from_coco(seg[\"counts\"])]\n        else:\n            return [Polygon(seg)]\n\n    def iscrowds(self, o) -> List[bool]:\n        return [o[\"iscrowd\"]]\n", "path": "mantisshrimp/datasets/coco/parsers.py"}], "after_files": [{"content": "__all__ = [\"parser\", \"COCOImageInfoParser\", \"COCOAnnotationParser\"]\n\nfrom mantisshrimp.imports import *\nfrom mantisshrimp.core import *\nfrom mantisshrimp.parsers import *\n\n\ndef parser(\n    annotations_file: Union[str, Path], img_dir: Union[str, Path]\n) -> ParserInterface:\n    annotations_dict = json.loads(Path(annotations_file).read())\n\n    image_info_parser = COCOImageInfoParser(\n        infos=annotations_dict[\"images\"], img_dir=img_dir\n    )\n    annotations_parser = COCOAnnotationParser(\n        annotations=annotations_dict[\"annotations\"]\n    )\n\n    return CombinedParser(image_info_parser, annotations_parser)\n\n\nclass COCOImageInfoParser(DefaultImageInfoParser):\n    def __init__(self, infos, img_dir):\n        super().__init__()\n        self.infos = infos\n        self.img_dir = img_dir\n\n    def __iter__(self):\n        yield from self.infos\n\n    def __len__(self):\n        return len(self.infos)\n\n    def imageid(self, o) -> int:\n        return o[\"id\"]\n\n    def filepath(self, o) -> Union[str, Path]:\n        return self.img_dir / o[\"file_name\"]\n\n    def height(self, o) -> int:\n        return o[\"height\"]\n\n    def width(self, o) -> int:\n        return o[\"width\"]\n\n\nclass COCOAnnotationParser(MaskRCNNParser, AreasParserMixin, IsCrowdsParserMixin):\n    def __init__(self, annotations: list):\n        self.annotations = annotations\n\n    def __iter__(self):\n        yield from self.annotations\n\n    def __len__(self):\n        return len(self.annotations)\n\n    def imageid(self, o) -> int:\n        return o[\"image_id\"]\n\n    def labels(self, o) -> List[int]:\n        return [o[\"category_id\"]]\n\n    def bboxes(self, o) -> List[BBox]:\n        return [BBox.from_xywh(*o[\"bbox\"])]\n\n    def areas(self, o) -> List[float]:\n        return [o[\"area\"]]\n\n    def masks(self, o) -> List[MaskArray]:\n        seg = o[\"segmentation\"]\n        if o[\"iscrowd\"]:\n            return [RLE.from_coco(seg[\"counts\"])]\n        else:\n            return [Polygon(seg)]\n\n    def iscrowds(self, o) -> List[bool]:\n        return [o[\"iscrowd\"]]\n", "path": "mantisshrimp/datasets/coco/parsers.py"}]}