| 910 | ) |
| 911 | |
| 912 | def get_obj( |
| 913 | self, filter_info: Optional[str] = None, **kwargs |
| 914 | ) -> Optional["HashFile"]: |
| 915 | obj: Optional[HashFile] = None |
| 916 | if self.obj: |
| 917 | obj = self.obj |
| 918 | elif self.files: |
| 919 | tree = Tree.from_list(self.files, hash_name=self.hash_name) |
| 920 | tree.digest() |
| 921 | obj = tree |
| 922 | elif self.hash_info: |
| 923 | try: |
| 924 | obj = oload(self.cache, self.hash_info) |
| 925 | except (FileNotFoundError, ObjectFormatError): |
| 926 | return None |
| 927 | else: |
| 928 | return None |
| 929 | |
| 930 | assert obj |
| 931 | fs_path = self.fs |
| 932 | if filter_info and filter_info != self.fs_path: |
| 933 | prefix = fs_path.relparts(filter_info, self.fs_path) |
| 934 | assert isinstance(obj, Tree) |
| 935 | obj = obj.get_obj(self.cache, prefix) |
| 936 | |
| 937 | return obj |
| 938 | |
| 939 | def checkout( |
| 940 | self, |