量縮價跌

            :rtype: bool
438216
def best_sell_2(self):
        
        result = self.data.value[-1] < self.data.value[-2] and \
                 self.data.price[-1] < self.data.price[-2]
        return result
275366
def _send_bool(self,value):
        

        # Sanity check.
        if type(value) != bool and value not in [0,1]:
            err = "{} is not boolean.".format(value)
            raise ValueError(err)

        return struct.pack("?",value)
933464
def boolValue(self):
        
        if self.lastValue == 1 or self.lastValue == "active":
            self._key = 1
            self._boolKey = True
        else:
            self._key = 0
            self._boolKey = False
        return self._boolKey
346180
def to_bool(value):
    # type: (Any) -> bool
    
    if isinstance(value, _compat.string_types):
        return value.upper() in ('Y', 'YES', 'T', 'TRUE', '1', 'OK')
    return bool(value)
746685
def str2bool(value):
    
    try:
        if isinstance(value, (str, unicode)):
            return bool(util.strtobool(value))
    except NameError:  # python 3
        if isinstance(value, str):
            return bool(util.strtobool(value))
    return bool(value)
914946
def _parse_bool(value):
    """"""
    if isinstance(value, bool):
        return value

    elif isinstance(value, str):
        if value == 'True':
            return True
        elif value == 'False':
            return False

    raise Exception("Value %s is not boolean." % value)
633858
def get_bool(self, property):
        
        value = self.get(property)
        if isinstance(value, bool):
            return value
        return value.lower() == "true"
863420
def pop_bool(self, key: str, default: Any = DEFAULT) -> bool:
        
        value = self.pop(key, default)
        if value is None:
            return None
        elif isinstance(value, bool):
            return value
        elif value == "true":
            return True
        elif value == "false":
            return False
        else:
            raise ValueError("Cannot convert variable to bool: " + value)
990725
def convert_to_bool(x: Any, default: bool = None) -> bool:
    
    if isinstance(x, bool):
        return x

    if not x:  # None, zero, blank string...
        return default

    try:
        return int(x) != 0
    except (TypeError, ValueError):
        pass

    try:
        return float(x) != 0
    except (TypeError, ValueError):
        pass

    if not isinstance(x, str):
        raise Exception("Unknown thing being converted to bool: {!r}".format(x))

    x = x.upper()
    if x in ["Y", "YES", "T", "TRUE"]:
        return True
    if x in ["N", "NO", "F", "FALSE"]:
        return False

    raise Exception("Unknown thing being converted to bool: {!r}".format(x))
549735
def p_boolean_literal(self, p):
        
        p[0] = self.asttypes.Boolean(p[1])
        p[0].setpos(p)
816116
def parse_boolean(value):
    

    if value is None:
        return None

    if isinstance(value, bool):
        return value

    if isinstance(value, string_types):
        value = value.lower()
        if value == 'false':
            return False
        if value == 'true':
            return True

    raise ValueError("Could not convert value to boolean: {}".format(value))
466727
def booleanize(truthy):
    '''
    
    '''
    if truthy is None:
        return False
    elif isinstance(truthy, basestring):
        if truthy:
            try:
                return bool(distutils.util.strtobool(truthy))
            except ValueError:
                return True
        else:
            return False
    elif is_collection(truthy):
        return not is_empty(truthy)
    else:
        return bool(truthy)
760346
def to_boolean(value):
    
    if value is not None:
        if str(value).lower() in TRUE_TOKENS:
            return True

        vfloat = to_number(float, value)
        if vfloat is not None:
            return bool(vfloat)

    return False
689335
def parse_bool(cls, value, default=None):
        """"""
        if value is None:
            return default

        elif isinstance(value, bool):
            return value

        elif isinstance(value, str):
            if value == 'True':
                return True
            elif value == 'False':
                return False

        raise Exception("Value %s is not boolean." % value)
1221200
def convert_bool(string):
    
    if string == 'True':
        return True, True
    elif string == 'False':
        return True, False
    else:
        return False, False
1167850
def text_to_bool(value: str) -> bool:
    
    try:
        return bool(strtobool(value))
    except (ValueError, AttributeError):
        return value is not None
1258254
def _validate_bool(value):
    
    if isinstance(value, six.text_type):
        if value.strip().lower() == 'true':
            value = True
        elif value.strip().lower() == 'false':
            value = False
        else:
            raise ValueError('"{}" must be a boolean ("True" or "False")'.format(value))

    if not isinstance(value, bool):
        raise ValueError('"{}" is not a boolean value.'.format(value))

    return value