python |
Pythonタグが付けられた新着投稿 - Qiita |
Pythonのunittestモジュールでモックに返り値を設定する(return_value, side_effect) |
https://qiita.com/ftnext/items/a10ebef22fdafcddd6a6
|
Pythonのunittestモジュールでモックに返り値を設定するreturnvaluesideeffect環境macOSPython※IMOInmyopinionコメントがあればぜひお願いしますIMOざっくり整理モックを呼び出したときに毎回同じ返り値を返してほしい場合はreturnvalue属性を設定するモックを呼び出すたびに異なる返り値を返してほしい場合はsideeffect属性にイテラブルを渡す実行例gtgtgtfromunittestmockimportMockgtgtgtmMockgtgtgtmreturnvaluegtgtgtmgtgtgtmgtgtgtmMockgtgtgtmsideeffectgtgtgtmgtgtgtmgtgtgtmgtgtgtmraiseStopIteration利用シーンのイメージIMOモックのreturnvalueやsideeffectは、patchでモジュールに当てたモックについてよく設定します。 |
2021-04-11 00:37:53 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
create and activate venv |
https://qiita.com/masanaosako/items/f55144e4ca518ba8a41b
|
|
2021-04-11 00:36:46 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
scraping refurbished |
https://qiita.com/masanaosako/items/71c9e406484dab4cb419
|
|
2021-04-11 00:11:52 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【センサー入門】RasPi4でMPU-6050加速度、温度、角速度センサーとカメラ自動追跡で遊んでみた♪ |
https://qiita.com/MuAuan/items/5ea096ea98e2c2ffcc53
|
加速度センサーの測定は前回のMPUと同様にできる。 |
2021-04-11 00:02:53 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
非相対パスでimportした |
https://qiita.com/rrrroji/items/4213771419d6016dcae6
|
tsでの非相対importはbaseUrlからの相対的であると仮定する。 |
2021-04-11 00:26:09 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
JavaScriptだけでCORSによるCanvas汚染を回避する |
https://qiita.com/y52en/items/d7680552909d50ed5e5c
|
JavaScriptだけでCORSによるCanvas汚染を回避する通常別オリジンの画像をcanvasに描画するとCORS制限に引っ掛かりHTMLCanvasElementtoDataURLなどが使えなくなります。 |
2021-04-11 00:19:48 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Rails デフォルト値の変更を反映させたい |
https://teratail.com/questions/332610?rss=all
|
Railsデフォルト値の変更を反映させたい前提・実現したいこと既存のカラムのデフォルト値を変更したいです。 |
2021-04-11 00:49:31 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
NNablaで学習済みのモデルから重みを取り出して再構成したい |
https://teratail.com/questions/332609?rss=all
|
NNablaで学習済みのモデルから重みを取り出して再構成したい実現したいことNNablaで作成済みのモデルを変更したいです。 |
2021-04-11 00:49:17 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
コンストラクタ以外でインスタンス生成時にのみ値を設定できるようにする方法 |
https://teratail.com/questions/332608?rss=all
|
コンストラクタ以外でインスタンス生成時にのみ値を設定できるようにする方法実現したいことtemplateを使ってクラスのインスタンスを生成しているのですが、クラスを定義するときコンストラクタにおまじないのような引数を追加する必要があり、それを回避したいと思っています。 |
2021-04-11 00:41:07 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
pythonのテキストボックスの関数について |
https://teratail.com/questions/332607?rss=all
|
pythonのテキストボックスの関数について前提・実現したいこと初心者です。 |
2021-04-11 00:27:57 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【AWS】AWS VPCとは何か |
https://qiita.com/mzmz__02/items/bc5e78ff2c19f29430e5
|
VPCを設定すると、AWSのサービスの間の連携やインターネットに接続しないプライベートなネットワークの構築などを設定することができる。 |
2021-04-11 00:24:19 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Docker環境構築[Django+Nginx+MySQL] |
https://qiita.com/bananao8770/items/f0963d49812966d0ac7e
|
Docker環境構築DjangoNginxMySQL構成root├ーdockercomposeyml├ーmysql├ーsql├ーnginx│├ーconf││└ーappnginxconf│└ーuwsgiparams└ーpython├ーDockerfile└ーrequirementstxtDjangoDockerfileFROMpythonバッファが溜まってから出力するのを避けるENVPYTHONUNBUFFEREDRUNmkdircodeWORKDIRcodeADDrequirementstxtcodeRUNpipinstallupgradepipampamppipinstallrrequirementstxtADDcoderequirementstxtDjangouwsgiPyMySQLdjangoenvironuWSGIの設定uwsgiparamQUERYSTRINGquerystringuwsgiparamREQUESTMETHODrequestmethoduwsgiparamCONTENTTYPEcontenttypeuwsgiparamCONTENTLENGTHcontentlengthuwsgiparamREQUESTURIrequesturiuwsgiparamPATHINFOdocumenturiuwsgiparamDOCUMENTROOTdocumentrootuwsgiparamSERVERPROTOCOLserverprotocoluwsgiparamREQUESTSCHEMEschemeuwsgiparamHTTPShttpsifnotemptyuwsgiparamREMOTEADDRremoteaddruwsgiparamREMOTEPORTremoteportuwsgiparamSERVERPORTserverportuwsgiparamSERVERNAMEservernameNginxの設定appnginxconfupstreamdjangoiphashserverpythonserverlistenservernamecharsetutflocationstaticaliasstaticlocationuwsgipassdjangoincludeetcnginxuwsgiparamsservertokensoffdockercomposeの設定dockercomposeymlversionservicesnginximagenginxportsvolumesnginxconfetcnginxconfdnginxuwsgiparamsetcnginxuwsgiparamsstaticstaticdependsonpythondbimagemysqlcommandmysqldcharactersetserverutfmbcollationserverutfmbunicodeciportsenvironmentMYSQLROOTPASSWORDrootMYSQLDATABASEtodoListMYSQLUSERuserMYSQLPASSWORDpasswordTZAsiaTokyovolumesmysqlvarlibmysqlsqldockerentrypointinitdbdpythonbuildpythoncommanduwsgisocketmoduleappwsgipyautoreloadlogtotmpmyloglogvolumessrccodestaticstaticexposedependsondbMySQLの設定sqlinitsqlGRANTALLPRIVILEGESONtesttodoListTOuserFLUSHPRIVILEGESプロジェクトの作成terminaldockercomposerunpythondjangoadminpystartprojectappDB設定settingspyimportosimportpymysqlconnectmysqlpymysqlinstallasMySQLdbDATABASESdefaultENGINEdjangodbbackendsmysqlNAMEtodoListUSERuserPASSWORDpasswordHOSTdbPORTMigrationterminaldockercomposerunpythonmanagepymakemigrationsdockercomposerunpythonmanagepymigrateterminaldockercomposeupdCSS適用settingspySTATICURLstaticSTATICROOTstaticterminaldockercomposerunpythonmanagepycollectstatic注意git管理する際は、MySQLの中身をオープンにするのはセキュリティ的によろしくないのでgitignoreに下記を追加しておきましょう。 |
2021-04-11 00:55:24 |
海外TECH |
DEV Community |
JavaScript Baseball |
https://dev.to/denvercoder/javascript-baseball-3pl4
|
JavaScript Baseball Do It Because It s FunSome advice I give to people a lot is once you have a good grasp on your preferred language you should build something you re passionate about or something you enjoy With new programmers a lot of the struggle is habit building Getting into the groove of studying and learning takes time And it s a lot easier if you re having fun while you re doing it Now the key like I said before is to try and create a project that you find interesting You may be thinking But I only like nuclear physics how am I going to write a program about that The key here is not to build some elaborate project at least not at first You could create a project that asks you Nuclear Physics questions and you can keep track of correct answers and provide a scoreboard Then you can build on that idea You can add multiplayer support A timer to answer the questions Some fun animations etc Just add onto it piece by piece until you have something Play BallI m not particularly fond of Baseball I played Little League as a kid I umpired games for the really small kids and I played in High School But I sort of lost interest in it after that I decided to do this project because I had given this project to people that I had mentored in the past and I wanted to see how difficult it really was maybe I was asking too much of them Now I didn t build a Baseball game with full D graphics and controller support It s basically just a bunch of HTML output in the browser I ve abstracted away a lot of the complexity You don t swing at a pitch or anything You just pitch the ball Then a random number generator will either make that pitch a strike or a ball Once you get to balls the batter is walked If you get strikes the batter is out Basically I just use the fundamental rules of baseball to keep track of everything I picked baseball because it s a relatively slow paced game but you can really do this with anything Horse RacingTennisA simple solar system simulatorCricketA Pet Program where there is a creature of some sort that you have to take care of There are tons of options Pick something you enjoy and simulate it Start small and build the project up Do you think that Twitter or Dev to started out the way they are now Nope Twitter probably had the ability to login and send a message and that was it You probably couldn t like follow retweet block mute etc They built an app with minimal functionality and build up from there Here is the link to my easy baseball repo if you d like to take a look at the whole project You can run it yourself and try and figure out how it works It s actually not a lot of code so don t be intimidated Just go have a look If you want you have my full permission and encouragement to build on this project There isn t a lot of functionality and there are a few bugs See if you can find them and fix them Thanks for reading and that s all y all |
2021-04-10 15:40:05 |
海外TECH |
Engadget |
Hitting the Books: How biased AI can hurt users or boost a business's bottom line |
https://www.engadget.com/hitting-the-books-a-citizens-guide-to-artificial-intelligence-john-zerilli-mit-press-153035570.html
|
Hitting the Books How biased AI can hurt users or boost a business x s bottom lineIn A Citizen s Guide to Artificial Intelligence John Zerilli presents readers with an approachable holistic examination of both the history and current state of the art the potential benefits of and challenges facing ever improving AI technology and how this rapidly advancing field could influence society for decades to come |
2021-04-10 15:30:35 |
海外TECH |
Engadget |
The Morning After: The end of the line for Harmony remotes |
https://www.engadget.com/logitech-harmony-tma-151004497.html
|
optimus |
2021-04-10 15:10:04 |
海外科学 |
NYT > Science |
AstraZeneca Vaccine and Blood Clots: What Is Known So Far |
https://www.nytimes.com/2021/04/10/health/astrazeneca-vaccine-blood-clots.html
|
AstraZeneca Vaccine and Blood Clots What Is Known So FarIn rare cases an immune reaction has led to antibodies that caused a serious clotting disorder But public health experts maintain the vaccine s benefits far outweigh the risks for most people |
2021-04-10 15:01:20 |
海外ニュース |
Japan Times latest articles |
Japanese drug regulator to fast track any modified vaccines to fight variants |
https://www.japantimes.co.jp/news/2021/04/10/national/domestic-trials-covid-variant-vaccine/
|
Japanese drug regulator to fast track any modified vaccines to fight variantsVaccines targeting new variants of the coronavirus won t require domestic clinical trials if the production process and handling of the shots are similar to those |
2021-04-11 01:35:56 |
海外ニュース |
Japan Times latest articles |
Suga’s fate may be on the line in key April 25 by-elections |
https://www.japantimes.co.jp/news/2021/04/10/national/politics-diplomacy/by-elections-suga-fate/
|
Suga s fate may be on the line in key April by electionsThe elections in Hokkaido Nagano and Hiroshima prefectures will also be a litmus test for opposition parties ability to cooperate in the general election for |
2021-04-11 00:48:39 |
ニュース |
BBC News - Home |
Prince Philip: Queen 'has been amazing', says Countess of Wessex |
https://www.bbc.co.uk/news/uk-56698794
|
philip |
2021-04-10 15:01:41 |
ニュース |
BBC News - Home |
NI riots: Fourteen police hurt in another night of violence |
https://www.bbc.co.uk/news/uk-northern-ireland-56699716
|
agreement |
2021-04-10 15:38:09 |
ニュース |
BBC News - Home |
Coronavirus: UK reports largest number of second jabs in one day |
https://www.bbc.co.uk/news/uk-56704539
|
positive |
2021-04-10 15:33:49 |
北海道 |
北海道新聞 |
日ハム・栗山監督 通算632勝 球団最多 |
https://www.hokkaido-np.co.jp/article/531820/
|
北海道日本ハム |
2021-04-11 00:10:30 |
コメント
コメントを投稿