亚洲精品久久久久久第一页-人妻少妇精彩视品一区二区三区-91国产自拍免费视频-免费一级a在线播放视频正片-少妇天天日天天射天天爽-国产大屁股喷水视频在线观看-操美女骚穴抽插性爱视频-亚洲 欧美 中文字幕 丝袜-成人免费无码片在线观看

html隨機(jī)選數(shù)代碼介紹 html隨機(jī)數(shù)生成器( 六 )


[dechin@dechin-manjaro pytest]$ python3 -m pip install flake8-htmlCollecting flake8-htmlDownloading flake8_html-0.4.1-py2.py3-none-any.whl (13 kB)Requirement already satisfied: pygments>=2.2.0 in /home/dechin/anaconda3/lib/python3.8/site-packages (from flake8-html) (2.7.2)Requirement already satisfied: flake8>=3.3.0 in /home/dechin/anaconda3/lib/python3.8/site-packages (from flake8-html) (3.8.4)Requirement already satisfied: jinja2>=2.9.0 in /home/dechin/anaconda3/lib/python3.8/site-packages (from flake8-html) (2.11.2)Requirement already satisfied: importlib-metadata in /home/dechin/anaconda3/lib/python3.8/site-packages (from flake8-html) (2.0.0)Requirement already satisfied: pycodestyle<2.7.0,>=2.6.0a1 in /home/dechin/anaconda3/lib/python3.8/site-packages (from flake8>=3.3.0->flake8-html) (2.6.0)Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /home/dechin/anaconda3/lib/python3.8/site-packages (from flake8>=3.3.0->flake8-html) (0.6.1)Requirement already satisfied: pyflakes<2.3.0,>=2.2.0 in /home/dechin/anaconda3/lib/python3.8/site-packages (from flake8>=3.3.0->flake8-html) (2.2.0)Requirement already satisfied: MarkupSafe>=0.23 in /home/dechin/anaconda3/lib/python3.8/site-packages (from jinja2>=2.9.0->flake8-html) (1.1.1)Requirement already satisfied: zipp>=0.5 in /home/dechin/anaconda3/lib/python3.8/site-packages (from importlib-metadata->flake8-html) (3.4.0)Installing collected packages: flake8-htmlSuccessfully installed flake8-html-0.4.1使用方法如下:
[dechin@dechin-20n2s01200 pytest]$ flake8 --format=html --htmldir=flake-report./random_number.py has issues: medium: 4在當(dāng)前目錄執(zhí)行后,相關(guān)的規(guī)范的issue就不會(huì)在命令行里面逐一顯示,都在flake-report目錄下的index.html中可以查看:
我們可以點(diǎn)擊進(jìn)入相應(yīng)文件的issue清單中去查看:
可以點(diǎn)擊每一個(gè)issue,展開(kāi)內(nèi)容中包含了issue所對(duì)應(yīng)行的代碼內(nèi)容:
經(jīng)過(guò)一番修改之后,我們得到的flake8配置文件和源代碼文件如下:
# .flake8[flake8]exclude = ./test*ignore = W391# random_number.pyfrom projectq import MainEnginefrom projectq.ops import H, Measuredef random_number_generator():eng = MainEngine()qubit = eng.allocate_qubit()H | qubiteng.flush()Measure | qubitrandom_number = int(qubit)eng.flush(deallocate_qubits=True)return random_numberif __name__ == '__main__':random_number = random_number_generator()print('Random number generated by quantum simulator is:{}'.format(random_number))最終我們的目的是使得flake8執(zhí)行的issue清零:
[dechin@dechin-manjaro pytest]$ flake8 --format=html --htmldir=flake-report[dechin@dechin-manjaro pytest]$總結(jié)概要本文通過(guò)引入一個(gè)隨機(jī)數(shù)生成器的案例,介紹了在量子計(jì)算中產(chǎn)生真隨機(jī)數(shù)的方案,同時(shí)給出了量子計(jì)算模擬實(shí)現(xiàn) 。借此機(jī)會(huì)也同時(shí)介紹了python的單元測(cè)試庫(kù)pytest的一些常規(guī)和擴(kuò)展使用方法,以及python的編碼規(guī)范測(cè)試庫(kù)flake8的基本使用方法,希望能夠?qū)Υ蠹矣兴鶈l(fā)以及幫助 。


以上關(guān)于本文的內(nèi)容,僅作參考!溫馨提示:如遇健康、疾病相關(guān)的問(wèn)題,請(qǐng)您及時(shí)就醫(yī)或請(qǐng)專(zhuān)業(yè)人士給予相關(guān)指導(dǎo)!

「愛(ài)刨根生活網(wǎng)」www.malaban59.cn小編還為您精選了以下內(nèi)容,希望對(duì)您有所幫助: