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

Method valid

src/pybind/ceph_argparse.py:450–471  ·  view source on GitHub ↗
(self, s: str, partial: bool = False)

Source from the content-addressed store, hash-verified

448 EntityAddress, that is, IP address[/nonce]
449 """
450 def valid(self, s: str, partial: bool = False) -> None:
451 nonce = None
452 if '/' in s:
453 ip, nonce = s.split('/')
454 if nonce.endswith(']'):
455 nonce = nonce[:-1]
456 ip += ']'
457 else:
458 ip = s
459 super(self.__class__, self).valid(ip)
460 if nonce:
461 nonce_int = None
462 try:
463 nonce_int = int(nonce)
464 except ValueError:
465 pass
466 if nonce_int is None or nonce_int < 0:
467 raise ArgumentValid(
468 '{0}: invalid entity, nonce {1} not integer > 0'.
469 format(s, nonce)
470 )
471 self.val = s
472
473 def __str__(self) -> str:
474 return '<EntityAddr>'

Callers

nothing calls this directly

Calls 4

ArgumentValidClass · 0.85
splitMethod · 0.45
validMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected