MCPcopy Create free account
hub / github.com/ceph/ceph / valid

Method valid

src/pybind/ceph_argparse.py:695–710  ·  view source on GitHub ↗
(self, s, partial=False)

Source from the content-addressed store, hash-verified

693 'Fragment' ??? XXX
694 """
695 def valid(self, s, partial=False):
696 if s.find('/') == -1:
697 raise ArgumentFormat('{0}: no /'.format(s))
698 val, bits = s.split('/')
699 # XXX is this right?
700 if not val.startswith('0x'):
701 raise ArgumentFormat("{0} not a hex integer".format(val))
702 try:
703 int(val)
704 except ValueError:
705 raise ArgumentFormat('can\'t convert {0} to integer'.format(val))
706 try:
707 int(bits)
708 except ValueError:
709 raise ArgumentFormat('can\'t convert {0} to integer'.format(bits))
710 self.val = s
711
712 def __str__(self):
713 return "<CephFS fragment ID (0xvvv/bbb)>"

Callers

nothing calls this directly

Calls 4

ArgumentFormatClass · 0.85
findMethod · 0.45
formatMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected