def __instancecheck__(cls, instance): try: int(instance) except (ValueError, TypeError): return (isinstance(instance, six.string_types) and uuidutils.is_uuid_like(instance)) return (isinstance(instance, six.integer_types + six.string_types) and type(instance) != bool)
def validate_job_location_format(entry): if entry.startswith('savanna-db://'): return uuidutils.is_uuid_like(entry[len("savanna-db://"):]) if entry.startswith(su.SWIFT_INTERNAL_PREFIX): #TODO(tmckay):allow su.SWIFT_EXTERNAL_PREFIX in a future version #TODO(nprivalova):add hostname validation return True return False
def validate_job_location_format(entry): if entry.startswith('savanna-db://'): return uuidutils.is_uuid_like(entry[len("savanna-db://"):]) if (entry.startswith('swift-internal://') or entry.startswith('swift-external://')): #TODO(nprivalova):add hostname validation return True return False
def validate_job_location_format(entry): if entry.startswith('savanna-db://'): return uuidutils.is_uuid_like(entry[len("savanna-db://"):]) # TODO(mattf): remove support for OLD_SWIFT_INTERNAL_PREFIX if entry.startswith(su.SWIFT_INTERNAL_PREFIX) or (entry.startswith( su.OLD_SWIFT_INTERNAL_PREFIX)): #TODO(nprivalova):add hostname validation return True return False
def assertIsValidModelObject(self, res): self.assertIsNotNone(res) self.assertIsNotNone(res.dict) self.assertTrue(uuidutils.is_uuid_like(res.id)) # check created/updated delta = datetime.timedelta(seconds=15) now = timeutils.utcnow() self.assertAlmostEqual(res.created, now, delta=delta) self.assertAlmostEqual(res.updated, now, delta=delta)
def validate_uuid_format(entry): return uuidutils.is_uuid_like(entry)