(text)
| 726 | |
| 727 | def location_validator(proto=None, other=False): |
| 728 | def validator(text): |
| 729 | try: |
| 730 | loc = Location(text, other=other) |
| 731 | except ValueError as err: |
| 732 | raise ArgumentTypeError(str(err)) from None |
| 733 | if proto is not None and loc.proto != proto: |
| 734 | if proto == "file": |
| 735 | raise ArgumentTypeError('"%s": Repository must be local' % text) |
| 736 | else: |
| 737 | raise ArgumentTypeError('"%s": Repository must be remote' % text) |
| 738 | return loc |
| 739 | |
| 740 | return validator |
| 741 |