第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在 Python 中使用一個(gè)函數(shù)(方法)的返回值到另一個(gè)函數(shù)(方法)

在 Python 中使用一個(gè)函數(shù)(方法)的返回值到另一個(gè)函數(shù)(方法)

子衿沉夜 2023-04-18 17:41:26
我正在嘗試使用從函數(shù) get_reg_check_type 返回的值“str(check)”,并在另一個(gè)函數(shù) get_status_type 中使用它。我怎樣才能做到這一點(diǎn)?#---- Get Register Check Type # 如果寄存器存在且解鎖則返回“CHECK”;“CHECK_NRF”如果寄存器不存在或被鎖定    def get_reg_check_type(self, addr, lock=definitions.LockTest.LOCK):        check = "CHECK_NRF" # NOTE: if items (bits) are locked, check will stay set to CHECK_NRF        for items in self.register_field_collection:            for item in items:                # Bit exists and is unlocked - return "CHECK"                if (addr == item.register_address):                    if ((lock == definitions.LockTest.LOCK) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW])) or \                       ((lock == definitions.LockTest.A  ) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW, definitions.RegWriteLock.FRU])) or \                       ((lock == definitions.LockTest.AB ) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW, definitions.RegWriteLock.FRU])) or \                       ((lock == definitions.LockTest.ABC) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW, definitions.RegWriteLock.FRU, definitions.RegWriteLock.FEBU])):                        check = "CHECK"        return str(check)            def get_status_type(self):        if self.check = "CHECK_NRF"            status_value = 8'h44        else:            status_value = 8'h40        return status_value
查看完整描述

1 回答

?
繁花不似錦

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊

如果可以在同一個(gè)類中找到這些函數(shù),則可以先調(diào)用get_reg_check_typethen get_status_type。


def get_reg_check_type(self, addr, lock=definitions.LockTest.LOCK):

        check = "CHECK_NRF" # NOTE: if items (bits) are locked, check will stay set to CHECK_NRF

        for items in self.register_field_collection:

            for item in items:

                # Bit exists and is unlocked - return "CHECK"

                if (addr == item.register_address):

                    if ((lock == definitions.LockTest.LOCK) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW])) or \

                       ((lock == definitions.LockTest.A  ) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW, definitions.RegWriteLock.FRU])) or \

                       ((lock == definitions.LockTest.AB ) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW, definitions.RegWriteLock.FRU])) or \

                       ((lock == definitions.LockTest.ABC) and (item.register_write_lock in [definitions.RegWriteLock.NO, definitions.RegWriteLock.FRW, definitions.RegWriteLock.FRU, definitions.RegWriteLock.FEBU])):

                        check = "CHECK"

        self.checked = str(check) # set the value

        

    def get_status_type(self):

        print(self.checked) # get the value

        if self.check = "CHECK_NRF"

            status_value = 8'h44

        else:

            status_value = 8'h40

        return status_value


查看完整回答
反對(duì) 回復(fù) 2023-04-18
  • 1 回答
  • 0 關(guān)注
  • 297 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)