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

Method valid

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

Source from the content-addressed store, hash-verified

605 self.strings = list(e.value for e in self.enum)
606
607 def valid(self, s, partial=False):
608 if not partial:
609 if s not in self.strings:
610 # show as __str__ does: {s1|s2..}
611 raise ArgumentValid("{0} not in {1}".format(s, self))
612 self.val = s
613 return
614
615 # partial
616 for t in self.strings:
617 if t.startswith(s):
618 self.val = s
619 return
620 raise ArgumentValid("{0} not in {1}". format(s, self))
621
622 def __str__(self):
623 if len(self.strings) == 1:

Callers

nothing calls this directly

Calls 2

ArgumentValidClass · 0.85
formatMethod · 0.45

Tested by

no test coverage detected