MCPcopy
hub / github.com/borgbackup/borg / location_validator

Function location_validator

src/borg/helpers/parseformat.py:727–740  ·  view source on GitHub ↗
(proto=None, other=False)

Source from the content-addressed store, hash-verified

725
726
727def 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
742
743# Register types with jsonargparse so they can be represented in config files

Callers 3

build_parser_transferMethod · 0.85
define_common_optionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected