(
node_type: Type["Node"],
path: Optional[Path],
fspath: Optional[LEGACY_PATH],
)
| 102 | |
| 103 | |
| 104 | def _imply_path( |
| 105 | node_type: Type["Node"], |
| 106 | path: Optional[Path], |
| 107 | fspath: Optional[LEGACY_PATH], |
| 108 | ) -> Path: |
| 109 | if fspath is not None: |
| 110 | warnings.warn( |
| 111 | NODE_CTOR_FSPATH_ARG.format( |
| 112 | node_type_name=node_type.__name__, |
| 113 | ), |
| 114 | stacklevel=3, |
| 115 | ) |
| 116 | if path is not None: |
| 117 | if fspath is not None: |
| 118 | _check_path(path, fspath) |
| 119 | return path |
| 120 | else: |
| 121 | assert fspath is not None |
| 122 | return Path(fspath) |
| 123 | |
| 124 | |
| 125 | _NodeType = TypeVar("_NodeType", bound="Node") |
no test coverage detected