Tests whether a given object is a valid continuous partition object.
    :param partition_object: The partition_object to evaluate
    :return: Boolean
765455
def is_valid_continuous_partition_object(partition_object):
    
    if (partition_object is None) or ("weights" not in partition_object) or ("bins" not in partition_object):
        return False
    if("tail_weights" in partition_object):
        if (len(partition_object["tail_weights"])!=2):
            return False
        comb_weights=partition_object["tail_weights"]+partition_object["weights"]
    else:
        comb_weights=partition_object["weights"]
    # Expect one more bin edge than weight; all bin edges should be monotonically increasing; weights should sum to one
    if (len(partition_object['bins']) == (len(partition_object['weights']) + 1)) and \
            np.all(np.diff(partition_object['bins']) > 0) and \
            np.allclose(np.sum(comb_weights), 1):
        return True
    return False
1018247
def check_bucket_exists(self, bucket: str) -> bool:
        
        bucket_obj = self.gcp_client.bucket(bucket)  # type: Bucket
        return bucket_obj.exists()
696784
def partition(cls, iterable, pred):
    

    t1, t2 = itertools.tee(iterable)
    return cls(itertools.filterfalse(pred, t1), filter(pred, t2))
317434
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Partition Volume Descriptor not initialized')

        rec = struct.pack(self.FMT, b'\x00' * 16,
                          self.vol_desc_seqnum, self.part_flags,
                          self.part_num, self.part_contents.record(),
                          self.part_contents_use.record(), self.access_type,
                          self.part_start_location, self.part_length,
                          self.impl_ident.record(), self.implementation_use,
                          b'\x00' * 156)[16:]
        return self.desc_tag.record(rec) + rec
399128
def with_partition_id(self, partition_id):
        
        self.partition_id = partition_id
        self.owner = None
        self.token = None
        self.epoch = 0
        self.event_processor_context = None
1041052
def partition_key(self):
        
        try:
            return self._annotations[self._partition_key]
        except KeyError:
            return self._annotations.get(EventData.PROP_PARTITION_KEY, None)
1746
def absolute(self):
        
        # XXX untested yet!
        if self.is_absolute():
            return self
        # FIXME this must defer to the specific flavour (and, under Windows,
        # use nt._getfullpathname())
        obj = self._from_parts([os.getcwd()] + self._parts, init=False)
        obj._init(template=self)
        return obj
229912
def has_ssd(system_obj):
    
    smart_value = False
    storage_value = False
    smart_resource = _get_attribute_value_of(system_obj, 'smart_storage')
    if smart_resource is not None:
        smart_value = _get_attribute_value_of(
            smart_resource, 'has_ssd', default=False)

    if smart_value:
        return smart_value

    # Its returned before just to avoid hitting BMC if we have
    # already got the SSD device above.
    storage_resource = _get_attribute_value_of(system_obj, 'storages')
    if storage_resource is not None:
        storage_value = _get_attribute_value_of(
            storage_resource, 'has_ssd', default=False)
    return storage_value
41679
def is_auto_partition_required(self, brain_or_object):
        
        obj = api.get_object(brain_or_object)
        if not IAnalysisRequest.providedBy(obj):
            return False
        template = obj.getTemplate()
        return template and template.getAutoPartition()
919216
function singletco(partition) {

	var select = function select(compare, a, i, j, k) {

		while (true) {

			if (j - i < 2) return;

			var p = partition(compare, a, i, j);

			if (k < p) j = p;else if (k > p) i = p + 1;else return;
		}
	};

	return select;
}
863102
public boolean zoneNAryExists(int zoneId, int zoneNAry, int partitionId) {
        int currentZoneNAry = -1;
        for(int replicatingNodeId: getReplicationNodeList(partitionId)) {
            Node replicatingNode = cluster.getNodeById(replicatingNodeId);
            if(replicatingNode.getZoneId() == zoneId) {
                currentZoneNAry++;
                if(currentZoneNAry == zoneNAry) {
                    return true;
                }
            }
        }
        return false;
    }
164611
def equals(self, rest_object):
        

        if self._is_dirty:
            return False

        if rest_object is None:
            return False

        if not isinstance(rest_object, NURESTObject):
            raise TypeError('The object is not a NURESTObject %s' % rest_object)

        if self.rest_name != rest_object.rest_name:
            return False

        if self.id and rest_object.id:
            return self.id == rest_object.id

        if self.local_id and rest_object.local_id:
            return self.local_id == rest_object.local_id

        return False
350158
function _isValidAmbush(object) {
	return _isValidObject(object) &&
		_isValidId(object.id) &&
		_isUniqueId(null, object.id) &&
		_isValidCategory(object.category) &&
		_isValidAction(object.action);
}
483893
def _check_cv(self, val, random_state=None):
        
        # Use default splitter in this case
        if val is None: val = 0.1

        if isinstance(val, float) and val <= 1.0:
            return ShuffleSplit(
                n_splits=1, test_size=val, random_state=random_state
            )

        if hasattr(val, "split") and hasattr(val, "get_n_splits"):
            if random_state is not None and hasattr(val, "random_state"):
                val.random_state = random_state
            return val

        raise YellowbrickValueError(
            "'{}' is not a valid cv splitter".format(type(val))
        )
1097090
def partition_found(partition, description):
    
    # if we want to have a linux partition (/) we use the full path (startswith "/" would result in / /var /dev etc). 
    # if we start with something else, we use the startswith function
    if "/" in partition:
        use_fullcompare = True            
    else:
        use_fullcompare = False
        
    if use_fullcompare and (partition == description):
        return True
    elif not use_fullcompare and description.startswith(partition):
        return True
    else:
        return False
30551
def is_legal_object(self, c: OntologyClass) -> bool:
        
        ranges = self.included_ranges()
        return not ranges or c in ranges or c.super_classes_closure() & ranges
252105
public static boolean containsPartitionAvgRecordMillis(State state, KafkaPartition partition) {
    return state.contains(
        getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS);
  }