Get a specific File in the Project by its id .. note:: If the project has not been opened, it will be opened upon calling this. .. note:: If files have not been pulled, they will be pulled upon calling this. :param id: Id of File :return: File object, if one with that id exists. Else,
(self, id: str)
| 314 | return result |
| 315 | |
| 316 | def get_file_by_id(self, id: str) -> Optional['file.RemoteFile']: |
| 317 | """ |
| 318 | Get a specific File in the Project by its id |
| 319 | |
| 320 | .. note:: If the project has not been opened, it will be opened upon calling this. |
| 321 | |
| 322 | .. note:: If files have not been pulled, they will be pulled upon calling this. |
| 323 | |
| 324 | :param id: Id of File |
| 325 | :return: File object, if one with that id exists. Else, None |
| 326 | :raises: RuntimeError if there was an error pulling files |
| 327 | """ |
| 328 | if not self.open(): |
| 329 | raise RuntimeError("Failed to open project") |
| 330 | |
| 331 | if not self.has_pulled_files: |
| 332 | self.pull_files() |
| 333 | |
| 334 | value = core.BNRemoteProjectGetFileById(self._handle, id) |
| 335 | if value is None: |
| 336 | return None |
| 337 | return file.RemoteFile(value) |
| 338 | |
| 339 | def get_file_by_name(self, name: str) -> Optional['file.RemoteFile']: |
| 340 | """ |
nothing calls this directly
no test coverage detected