Guesses the IFC format using file extension IFCs may be serialised as different formats. The most common is a ``.ifc`` file, which is plaintext and stores data using the STEP Physical File format. IFC can also be stored as a Zipfile, XML, JSON, or SQL. This will return the canonica
(path: Path)
| 295 | |
| 296 | |
| 297 | def guess_format(path: Path) -> SupportedFormat: |
| 298 | """Guesses the IFC format using file extension |
| 299 | |
| 300 | IFCs may be serialised as different formats. The most common is a ``.ifc`` |
| 301 | file, which is plaintext and stores data using the STEP Physical File |
| 302 | format. IFC can also be stored as a Zipfile, XML, JSON, or SQL. |
| 303 | |
| 304 | This will return the canonical form of the format. For example, if a path |
| 305 | has the extension of .xml or .ifcxml (case insensitive), it will return |
| 306 | .ifcXML. |
| 307 | |
| 308 | Users generally won't call this function. The :func:`open` function uses |
| 309 | this internally to guess the file format. |
| 310 | """ |
| 311 | suffix = path.suffix.lower() |
| 312 | if path.is_dir(): |
| 313 | return "rocksdb" |
| 314 | elif suffix == ".ifc": |
| 315 | return ".ifc" |
| 316 | elif suffix in (".ifczip", ".zip"): |
| 317 | return ".ifcZIP" |
| 318 | elif suffix in (".ifcxml", ".xml"): |
| 319 | return ".ifcXML" |
| 320 | elif suffix in (".ifcjson", ".json"): |
| 321 | return ".ifcJSON" |
| 322 | elif suffix in (".ifcsqlite", ".sqlite", ".db"): |
| 323 | return ".ifcSQLite" |
| 324 | return None |
| 325 | |
| 326 | |
| 327 | def stream2(path: Union[Path, str], mmap: bool = False, page_size: int = 0): |