Skip to content

Commit

Permalink
Replace %env magic with os.environ (#283)
Browse files Browse the repository at this point in the history
This ensures that future attempts to autoformat the code won't break it again.
  • Loading branch information
dniku authored Sep 5, 2019
1 parent 43dfe96 commit dcc7fb8
Show file tree
Hide file tree
Showing 24 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion week01_intro/crossentropy_method.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week01_intro/deep_crossentropy_method.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week01_intro/seminar_gym_interface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions week03_model_free/homework.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1\n",
" os.environ['DISPLAY'] = ':1'\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -428,7 +428,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1\n",
" os.environ['DISPLAY'] = ':1'\n",
"\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
Expand Down
2 changes: 1 addition & 1 deletion week03_model_free/seminar_qlearning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1\n",
" os.environ['DISPLAY'] = ':1'\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
Expand Down
2 changes: 1 addition & 1 deletion week04_approx_rl/homework_lasagne.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"\n",
" !bash ../xvfb start",
"\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week04_approx_rl/homework_pytorch_debug.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week04_approx_rl/homework_pytorch_main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week04_approx_rl/homework_tf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"\n",
" !bash ../xvfb start",
"\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week04_approx_rl/seminar_lasagne.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"\n",
" !bash ../xvfb start",
"\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week04_approx_rl/seminar_pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week04_approx_rl/seminar_tf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\"))==0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY=:1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week06_policy_based/a2c-optional.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week06_policy_based/reinforce_lasagne.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"\n",
" !bash ../xvfb start",
"\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week06_policy_based/reinforce_pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
3 changes: 1 addition & 2 deletions week06_policy_based/reinforce_tensorflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
"metadata": {},
"outputs": [],
"source": [
"%env THEANO_FLAGS = 'floatX=float32'\n",
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week08_pomdp/practice_pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week08_pomdp/practice_tensorflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"\n",
" !bash ../xvfb start",
"\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week08_pomdp/practice_theano.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"\n",
" !bash ../xvfb start",
"\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week09_policy_II/ppo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week09_policy_II/seminar_TRPO_pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week09_policy_II/seminar_TRPO_tensorflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week09_policy_II/seminar_TRPO_theano.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1"
" os.environ['DISPLAY'] = ':1'"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion week10_planning/seminar_MCTS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"import os\n",
"if type(os.environ.get(\"DISPLAY\")) is not str or len(os.environ.get(\"DISPLAY\")) == 0:\n",
" !bash ../xvfb start\n",
" %env DISPLAY = : 1\n",
" os.environ['DISPLAY'] = ':1'\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
Expand Down

0 comments on commit dcc7fb8

Please sign in to comment.