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

Method _parse

src/borg/helpers/parseformat.py:625–668  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

623 raise ValueError('Invalid location format: "%s"' % self.processed)
624
625 def _parse(self, text):
626 m = self.ssh_or_sftp_re.match(text)
627 if m:
628 self.proto = m.group("proto")
629 self.user = m.group("user")
630 self._host = m.group("host")
631 self.port = m.group("port") and int(m.group("port")) or None
632 self.path = os.path.normpath(m.group("path"))
633 return True
634 m = self.http_re.match(text)
635 if m:
636 self.proto = m.group("proto")
637 self.user = m.group("user")
638 self._pass = True if m.group("pass") else False
639 self._host = m.group("host")
640 self.port = m.group("port") and int(m.group("port")) or None
641 self.path = m.group("path")
642 return True
643 m = self.rclone_re.match(text)
644 if m:
645 self.proto = m.group("proto")
646 self.path = m.group("path")
647 return True
648 m = self.file_or_socket_re.match(text)
649 if m:
650 self.proto = m.group("proto")
651 self.path = os.path.normpath(m.group("path"))
652 return True
653 m = self.s3_re.match(text)
654 if m:
655 self.proto = m.group("s3type")
656 self.user = m.group("profile") if m.group("profile") else m.group("access_key_id")
657 self._pass = True if m.group("access_key_secret") else False
658 self._host = m.group("hostname")
659 self.port = m.group("port") and int(m.group("port")) or None
660 self.path = m.group("bucket") + "/" + m.group("path")
661 return True
662 m = self.local_re.match(text)
663 if m:
664 self.proto = "file"
665 path = m.group("path")
666 self.path = slashify(os.path.abspath(path)) if is_win32 else os.path.abspath(path)
667 return True
668 return False
669
670 def __str__(self):
671 items = [

Callers 1

parseMethod · 0.95

Calls 2

slashifyFunction · 0.85
matchMethod · 0.45

Tested by

no test coverage detected