当前位置: 首页>>代码示例>>Python>>正文


Python __builtin__.True方法代码示例

本文整理汇总了Python中__builtin__.True方法的典型用法代码示例。如果您正苦于以下问题:Python __builtin__.True方法的具体用法?Python __builtin__.True怎么用?Python __builtin__.True使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在__builtin__的用法示例。


在下文中一共展示了__builtin__.True方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _is_dict_same

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def _is_dict_same(expected, actual, ignore_value_of_keys):
    # DAN - I had to flip flop this
    for key in expected:
        if not key in actual:
            return False, \
                   Stack().append(
                        StackItem('Expected key "{0}" Missing from Actual'
                                      .format(key),
                                  expected,
                                  actual))

        if not key in ignore_value_of_keys:
            # have to change order
            #are_same_flag, stack = _are_same(actual[key], expected[key], ignore_value_of_keys)
            
            ### key part noam ###
            are_same_flag, stack = _are_same(expected[key], actual[key],ignore_value_of_keys)
            if not are_same_flag:
                return False, \
                       stack.append(StackItem('Different values', expected[key], actual[key]))
    return True, Stack() 
开发者ID:Wireless-Innovation-Forum,项目名称:Citizens-Broadband-Radio-Service-Device,代码行数:23,代码来源:JsonComparisonUtils.py

示例2: resolve_dotted_attribute

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
    """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d

    Resolves a dotted attribute name to an object.  Raises
    an AttributeError if any attribute in the chain starts with a '_'.

    If the optional allow_dotted_names argument is false, dots are not
    supported and this function operates similar to getattr(obj, attr).
    """

    if allow_dotted_names:
        attrs = attr.split('.')
    else:
        attrs = [attr]

    for i in attrs:
        if i.startswith('_'):
            raise AttributeError(
                'attempt to access private attribute "%s"' % i
                )
        else:
            obj = getattr(obj, i)
    return obj 
开发者ID:mrknow,项目名称:filmkodi,代码行数:25,代码来源:_pydev_SimpleXMLRPCServer.py

示例3: shutdown

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def shutdown():
    '''
    the method get a validation error message and send 400 response to CBSD with the current message  
    or send message that all the steps of the current test had been finished and you need to upload a new csv file 
    '''
    logger = enodeBController.engine.loggerHandler
    app.app_context()
#    func = request.environ.get(consts.NAME_OF_SERVER_WERKZUG)
#    func()
    if("ERROR" in str(request.args['validationMessage'])):
        logger.finish_Step("the server shot down because :  " + str(request.args['validationMessage']),False,StepStatus.FAILED)
        logger.print_to_Logs_Files(str(request.args['validationMessage']), True)
        return abort(400, str(request.args['validationMessage']))
    return consts.SERVER_SHUT_DOWN_MESSAGE + consts.TEST_HAD_BEEN_FINISHED_FLASK 
开发者ID:Wireless-Innovation-Forum,项目名称:Citizens-Broadband-Radio-Service-Device,代码行数:16,代码来源:flaskServer.py

示例4: runFlaskServer

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def runFlaskServer(host,port,ctx):
    app.run(host,port,threaded=True,request_handler=WSGIRequestHandler,ssl_context=ctx) 
开发者ID:Wireless-Innovation-Forum,项目名称:Citizens-Broadband-Radio-Service-Device,代码行数:4,代码来源:flaskServer.py

示例5: _generate_pprint_json

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def _generate_pprint_json(value):
    return json.dumps(value, sort_keys=True, indent=4) 
开发者ID:Wireless-Innovation-Forum,项目名称:Citizens-Broadband-Radio-Service-Device,代码行数:4,代码来源:JsonComparisonUtils.py

示例6: _is_list_same

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def _is_list_same(expected, actual, ignore_value_of_keys):
    for i in xrange(len(expected)):
        are_same_flag, stack = _are_same(expected[i], actual[i], ignore_value_of_keys)
        if not are_same_flag:
            return False, \
                   stack.append(
                       StackItem('Different values (Check order)', expected[i], actual[i]))
    return True, Stack() 
开发者ID:Wireless-Innovation-Forum,项目名称:Citizens-Broadband-Radio-Service-Device,代码行数:10,代码来源:JsonComparisonUtils.py

示例7: Is_Json_contains_key

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def Is_Json_contains_key(jsonFileName,nodeOfJsonRequest,confFile,dirPath,jsonAfterParse=None):
    if(jsonAfterParse==None):
        jsonAfterParse = Get_Json_After_Parse_To_Dic(jsonFileName, confFile, dirPath)
    if(nodeOfJsonRequest in jsonAfterParse):
        return True
    return False 
开发者ID:Wireless-Innovation-Forum,项目名称:Citizens-Broadband-Radio-Service-Device,代码行数:8,代码来源:JsonComparisonUtils.py

示例8: __init__

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def __init__(self, port):
        self.ended = False
        self.port = port
        self.socket = None  # socket to send messages.
        self.exit_process_on_kill = True
        self.processor = Processor() 
开发者ID:mrknow,项目名称:filmkodi,代码行数:8,代码来源:pycompletionserver.py

示例9: __init__

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def __init__(self, host, client_port, mainThread, show_banner=True):
        BaseInterpreterInterface.__init__(self, mainThread)
        self.client_port = client_port
        self.host = host
        self.namespace = {}
        self.interpreter = InteractiveConsole(self.namespace)
        self._input_error_printed = False 
开发者ID:mrknow,项目名称:filmkodi,代码行数:9,代码来源:pydevconsole.py

示例10: exec_code

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def exec_code(code, globals, locals):
    interpreterInterface = get_interpreter()
    interpreterInterface.interpreter.update(globals, locals)

    res = interpreterInterface.need_more(code)

    if res:
        return True

    interpreterInterface.add_exec(code)

    return False 
开发者ID:mrknow,项目名称:filmkodi,代码行数:14,代码来源:pydevconsole.py

示例11: validate_Json_Value_Special_Sign

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def validate_Json_Value_Special_Sign(expected,actual):
    strExpected = str(expected)
    strAcutal = str(actual)
    
    if("range" in str(expected)):
        indexOfPunctuation = strExpected.find(":")
        indexOfSeperationSign = strExpected.find("To")
        lowestVal = strExpected[indexOfPunctuation+1:indexOfSeperationSign]
        heighestVal =  strExpected[indexOfSeperationSign+2:len(strExpected)-1].replace("}","")
        if float(lowestVal) <= float(strAcutal) and (float(heighestVal) >= float(strAcutal)):
            return True
        raise Exception ("ERROR - the actual value : " + strAcutal + " not in the range expected : " + lowestVal + " To : " + heighestVal  )
    if("or" in strExpected):
        try:
            for value in expected.iteritems() :
                strActualOnlyLetters =strAcutal.replace("[", "").replace("u'", "").replace("'","").replace("]","")
                for value in value[1]:
                    strExpectedOnlyLetters = str(value).lower().replace("[", "").replace("u'", "").replace("'","").replace("]","")
                    if len((strExpectedOnlyLetters).split(","))>1 :
                        valuesOfExpected = strExpectedOnlyLetters.split(",")
                        valuesOfActual = strActualOnlyLetters.split(",")
                        for cell in valuesOfActual:
                            if cell in valuesOfExpected:
                                return value         
                    if strExpectedOnlyLetters.upper() == strActualOnlyLetters.upper():
#                     if strExpectedOnlyLetters.upper() == strAcutal.upper():
                        return value
        except :
            indexOfPuncuation = strExpected.find(":")
            strExpected = strExpected[indexOfPuncuation+1:]
            if "[[" in strExpected :
                optionsArray = strExpected[1:-1].split("],[")
                i=0
                for key in optionsArray :
                    key = key.replace("[","").replace("]","")
                    optionsArray[i] = key
                    i+=1
            else:          
                optionsArray = strExpected.replace("'", "").replace("[","").replace("]","").split(",")
            for value in optionsArray :
                strExpectedOnlyLetters = str(value).replace("[", "").replace("u'", "").replace("'","").replace('"',"").replace("]","")
                strActualOnlyLetters =strAcutal.replace("[", "").replace("u'", "").replace("'","").replace("]","")
                if len((value).split(","))>1 :
                    valuesOfExpected = value.replace('"',"").split(",")
                    valuesOfActual = strActualOnlyLetters.split(",")
                    for cell in valuesOfActual:
                        if str(cell).strip() not in valuesOfExpected:
                            return False 
                    return value         
                if strExpectedOnlyLetters == strAcutal:
                    return value
        raise Exception ("ERROR - the actual value : " + strAcutal + " is not one of the valid options in the json file " )
                
    if("maximumLength" in strExpected):
        indexOfPunctuation = strExpected.find(":")
        lenExpected = strExpected[indexOfPunctuation+1:len(strExpected)-1]
        if(len(strAcutal)<=int(lenExpected)):
            return strAcutal
        raise Exception ("the actual value : " + strAcutal + " is more then the limit length  : " +  lenExpected ) 
开发者ID:Wireless-Innovation-Forum,项目名称:Citizens-Broadband-Radio-Service-Device,代码行数:61,代码来源:JsonComparisonUtils.py

示例12: console_exec

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import True [as 别名]
def console_exec(thread_id, frame_id, expression):
    """returns 'False' in case expression is partially correct
    """
    frame = pydevd_vars.find_frame(thread_id, frame_id)

    expression = str(expression.replace('@LINE@', '\n'))

    #Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
    #(Names not resolved in generator expression in method)
    #See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
    updated_globals = {}
    updated_globals.update(frame.f_globals)
    updated_globals.update(frame.f_locals) #locals later because it has precedence over the actual globals

    if IPYTHON:
        return exec_code(CodeFragment(expression), updated_globals, frame.f_locals)

    interpreter = ConsoleWriter()

    try:
        code = compile_command(expression)
    except (OverflowError, SyntaxError, ValueError):
        # Case 1
        interpreter.showsyntaxerror()
        return False

    if code is None:
        # Case 2
        return True

    #Case 3

    try:
        Exec(code, updated_globals, frame.f_locals)

    except SystemExit:
        raise
    except:
        interpreter.showtraceback()

    return False

#=======================================================================================================================
# main
#======================================================================================================================= 
开发者ID:mrknow,项目名称:filmkodi,代码行数:47,代码来源:pydevconsole.py


注:本文中的__builtin__.True方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。