 # Inline TODOs

| Location | Tag | Todo | GitHub | Issue |
|:---------|:----|:-----|:-------|:------|
| [`zanj/loading.py:86`](/zanj/loading.py#L86) | TODO | add a separate "asserts" function? | [View](https://github.com/mivanit/zanj/blob/main/zanj/loading.py#L86) | [Create](https://github.com/mivanit/zanj/issues/new?title=add%20a%20separate%20%22asserts%22%20function%3F&body=%23%20source%0A%0A%5B%60zanj%2Floading.py%23L86%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Fzanj%2Floading.py%23L86%29%0A%0A%23%20context%0A%60%60%60python%0A%20%20%20%20%22%22%22handler%20for%20loading%20an%20object%20from%20a%20json%20file%20or%20a%20ZANJ%20archive%22%22%22%0A%0A%20%20%20%20%23%20TODO%3A%20add%20a%20separate%20%22asserts%22%20function%3F%0A%20%20%20%20%23%20right%20now%2C%20any%20asserts%20must%20happen%20in%20%60check%60%20or%20%60load%60%20which%20is%20annoying%20with%20lambdas%0A%60%60%60&labels=enhancement) |
| [`zanj/loading.py:144`](/zanj/loading.py#L144) | TODO | how can we type hint this without actually importing torch? | [View](https://github.com/mivanit/zanj/blob/main/zanj/loading.py#L144) | [Create](https://github.com/mivanit/zanj/issues/new?title=how%20can%20we%20type%20hint%20this%20without%20actually%20importing%20torch%3F&body=%23%20source%0A%0A%5B%60zanj%2Floading.py%23L144%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Fzanj%2Floading.py%23L144%29%0A%0A%23%20context%0A%60%60%60python%0A%23%20TODO%3A%20how%20can%20we%20type%20hint%20this%20without%20actually%20importing%20torch%3F%0Adef%20_torch_loaderhandler_load%28%0A%20%20%20%20json_item%3A%20JSONitem%2C%0A%60%60%60&labels=enhancement) |
| [`zanj/serializing.py:55`](/zanj/serializing.py#L55) | TODO | Type `<module 'numpy.lib'>` has no attribute `format` --> zanj/serializing.py:54:5 | [View](https://github.com/mivanit/zanj/blob/main/zanj/serializing.py#L55) | [Create](https://github.com/mivanit/zanj/issues/new?title=Type%20%60%3Cmodule%20%27numpy.lib%27%3E%60%20has%20no%20attribute%20%60format%60%20--%3E%20zanj%2Fserializing.py%3A54%3A5&body=%23%20source%0A%0A%5B%60zanj%2Fserializing.py%23L55%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Fzanj%2Fserializing.py%23L55%29%0A%0A%23%20context%0A%60%60%60python%0Adef%20store_npy%28self%3A%20_ZANJ_pre%2C%20fp%3A%20IO%5Bbytes%5D%2C%20data%3A%20np.ndarray%29%20-%3E%20None%3A%0A%20%20%20%20%22%22%22store%20numpy%20array%20to%20given%20file%20as%20.npy%22%22%22%0A%20%20%20%20%23%20TODO%3A%20Type%20%60%3Cmodule%20%27numpy.lib%27%3E%60%20has%20no%20attribute%20%60format%60%20--%3E%20zanj%2Fserializing.py%3A54%3A5%0A%20%20%20%20%23%20info%3A%20rule%20%60unresolved-attribute%60%20is%20enabled%20by%20default%0A%20%20%20%20np.lib.format.write_array%28%20%20%23%20ty%3A%20ignore%5Bunresolved-attribute%5D%0A%60%60%60&labels=enhancement) |
| [`zanj/serializing.py:125`](/zanj/serializing.py#L125) | TODO | somehow need to control whether a failure here causes a fallback to other handlers, or whether the except should propagate | [View](https://github.com/mivanit/zanj/blob/main/zanj/serializing.py#L125) | [Create](https://github.com/mivanit/zanj/issues/new?title=somehow%20need%20to%20control%20whether%20a%20failure%20here%20causes%20a%20fallback%20to%20other%20handlers%2C%20or%20whether%20the%20except%20should%20propagate&body=%23%20source%0A%0A%5B%60zanj%2Fserializing.py%23L125%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Fzanj%2Fserializing.py%23L125%29%0A%0A%23%20context%0A%60%60%60python%0A%20%20%20%20archive_path%3A%20str%20%3D%20f%22%7Bjoined_path%7D.%7Bitem_type%7D%22%0A%0A%20%20%20%20%23%20TODO%3A%20somehow%20need%20to%20control%20whether%20a%20failure%20here%20causes%20a%20fallback%20to%20other%20handlers%2C%20or%20whether%20the%20except%20should%20propagate%0A%20%20%20%20%23%20this%20will%20probably%20require%20changes%20to%20the%20upstream%20muutils.json_serialize%20code%0A%20%20%20%20if%20archive_path%20in%20jser._externals%3A%0A%60%60%60&labels=enhancement) |
| [`zanj/zanj.py:184`](/zanj/zanj.py#L184) | TODO | calling self.json_serialize again here might be slow | [View](https://github.com/mivanit/zanj/blob/main/zanj/zanj.py#L184) | [Create](https://github.com/mivanit/zanj/issues/new?title=calling%20self.json_serialize%20again%20here%20might%20be%20slow&body=%23%20source%0A%0A%5B%60zanj%2Fzanj.py%23L184%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Fzanj%2Fzanj.py%23L184%29%0A%0A%23%20context%0A%60%60%60python%0A%20%20%20%20%20%20%20%20%23%20serialize%20the%20object%20--%20this%20will%20populate%20self._externals%0A%20%20%20%20%20%20%20%20%23%20TODO%3A%20calling%20self.json_serialize%20again%20here%20might%20be%20slow%0A%20%20%20%20%20%20%20%20json_data%3A%20JSONitem%20%3D%20self.json_serialize%28self.json_serialize%28obj%29%29%0A%60%60%60&labels=enhancement) |
| [`zanj/zanj.py:226`](/zanj/zanj.py#L226) | TODO | load only some part of the zanj file by passing an ObjectPath | [View](https://github.com/mivanit/zanj/blob/main/zanj/zanj.py#L226) | [Create](https://github.com/mivanit/zanj/issues/new?title=load%20only%20some%20part%20of%20the%20zanj%20file%20by%20passing%20an%20ObjectPath&body=%23%20source%0A%0A%5B%60zanj%2Fzanj.py%23L226%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Fzanj%2Fzanj.py%23L226%29%0A%0A%23%20context%0A%60%60%60python%0A%20%20%20%20%29%20-%3E%20Any%3A%0A%20%20%20%20%20%20%20%20%22%22%22load%20the%20object%20from%20a%20ZANJ%20archive%0A%20%20%20%20%20%20%20%20%23%20TODO%3A%20load%20only%20some%20part%20of%20the%20zanj%20file%20by%20passing%20an%20ObjectPath%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20file_path%20%3D%20Path%28file_path%29%0A%60%60%60&labels=enhancement) |
| [`tests/unit/no_torch/test_load_item_recursive.py:144`](/tests/unit/no_torch/test_load_item_recursive.py#L144) | TODO | this doesn't raise any errors | [View](https://github.com/mivanit/zanj/blob/main/tests/unit/no_torch/test_load_item_recursive.py#L144) | [Create](https://github.com/mivanit/zanj/issues/new?title=this%20doesn%27t%20raise%20any%20errors&body=%23%20source%0A%0A%5B%60tests%2Funit%2Fno_torch%2Ftest_load_item_recursive.py%23L144%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Ftests%2Funit%2Fno_torch%2Ftest_load_item_recursive.py%23L144%29%0A%0A%23%20context%0A%60%60%60python%0A%20%20%20%20assert%20result%20%3D%3D%20json_data%0A%0A%20%20%20%20%23%20TODO%3A%20this%20doesn%27t%20raise%20any%20errors%0A%20%20%20%20%23%20Test%20with%20allow_not_loading%3DFalse%20%28should%20raise%20an%20error%29%0A%20%20%20%20%23%20Create%20a%20ZANJ%20with%20EXCEPT%20error%20mode%20to%20ensure%20value%20errors%20are%20raised%0A%60%60%60&labels=enhancement) |
| [`tests/unit/no_torch/test_zanj_serializable_dataclass.py:145`](/tests/unit/no_torch/test_zanj_serializable_dataclass.py#L145) | TODO | explicitly specifying the following does not work, since it gets automatically converted before we call load in `loading_fn`: | [View](https://github.com/mivanit/zanj/blob/main/tests/unit/no_torch/test_zanj_serializable_dataclass.py#L145) | [Create](https://github.com/mivanit/zanj/issues/new?title=explicitly%20specifying%20the%20following%20does%20not%20work%2C%20since%20it%20gets%20automatically%20converted%20before%20we%20call%20load%20in%20%60loading_fn%60%3A&body=%23%20source%0A%0A%5B%60tests%2Funit%2Fno_torch%2Ftest_zanj_serializable_dataclass.py%23L145%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Ftests%2Funit%2Fno_torch%2Ftest_zanj_serializable_dataclass.py%23L145%29%0A%0A%23%20context%0A%60%60%60python%0A%20%20%20%20%20%20%20%20%20%20%20%20Nested.load%28json.loads%28n%29%29%20for%20n%20in%20data%5B%22container%22%5D.split%28%22%5Cn%22%29%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%23%20TODO%3A%20explicitly%20specifying%20the%20following%20does%20not%20work%2C%20since%20it%20gets%20automatically%20converted%20before%20we%20call%20load%20in%20%60loading_fn%60%3A%0A%20%20%20%20%20%20%20%20%23%20serialization_fn%3Dlambda%20c%3A%20%5Bn.serialize%28%29%20for%20n%20in%20c%5D%2C%0A%20%20%20%20%20%20%20%20%23%20loading_fn%3Dlambda%20data%3A%20%5BNested.load%28n%29%20for%20n%20in%20data%5B%22container%22%5D%5D%2C%0A%60%60%60&labels=enhancement) |
| [`tests/unit/no_torch/test_zanj_edge_cases.py:159`](/tests/unit/no_torch/test_zanj_edge_cases.py#L159) | TODO | some sort of error here? | [View](https://github.com/mivanit/zanj/blob/main/tests/unit/no_torch/test_zanj_edge_cases.py#L159) | [Create](https://github.com/mivanit/zanj/issues/new?title=some%20sort%20of%20error%20here%3F&body=%23%20source%0A%0A%5B%60tests%2Funit%2Fno_torch%2Ftest_zanj_edge_cases.py%23L159%60%5D%28https%3A%2F%2Fgithub.com%2Fmivanit%2Fzanj%2Fblob%2Fmain%2Ftests%2Funit%2Fno_torch%2Ftest_zanj_edge_cases.py%23L159%29%0A%0A%23%20context%0A%60%60%60python%0A%20%20%20%20assert%20np.allclose%28data1%5B%22array%22%5D%2C%20data%5B%22array%22%5D%29%0A%20%20%20%20%23%20TODO%3A%20some%20sort%20of%20error%20here%3F%0A%20%20%20%20%23%20assert%20np.allclose%28data2%5B%22array%22%5D%2C%20data%5B%22array%22%5D%29%0A%20%20%20%20assert%20np.allclose%28data3%5B%22array%22%5D%2C%20data%5B%22array%22%5D%29%0A%60%60%60&labels=enhancement) |
