(cls, args)
| 483 | |
| 484 | @classmethod |
| 485 | def _parse_args(cls, args): |
| 486 | # This is useful when you don't want to create an instance, just |
| 487 | # canonicalize some constructor arguments. |
| 488 | parts = [] |
| 489 | for a in args: |
| 490 | if isinstance(a, PurePath): |
| 491 | parts += a._parts |
| 492 | else: |
| 493 | a = os.fspath(a) |
| 494 | if isinstance(a, str): |
| 495 | # Force-cast str subclasses to str (issue #21127) |
| 496 | parts.append(str(a)) |
| 497 | else: |
| 498 | raise TypeError( |
| 499 | "argument should be a str object or an os.PathLike " |
| 500 | "object returning str, not %r" |
| 501 | % type(a)) |
| 502 | return cls._flavour.parse_parts(parts) |
| 503 | |
| 504 | @classmethod |
| 505 | def _from_parts(cls, args): |
no test coverage detected