From 53a0f3bcc790a76406c1171a8bf0e5b8ea8df8a1 Mon Sep 17 00:00:00 2001 From: Lionel Miller Date: Thu, 5 Sep 2019 13:58:28 +0300 Subject: [PATCH] Replace %env magic with os.environ This ensures that future attempts to autoformat the code won't break it again. --- week1_intro/crossentropy_method.ipynb | 2 +- week1_intro/deep_crossentropy_method.ipynb | 2 +- week1_intro/gym_interface.ipynb | 2 +- week3_model_free/experience_replay.ipynb | 2 +- week3_model_free/qlearning.ipynb | 2 +- week3_model_free/sarsa.ipynb | 2 +- week4_approx/dqn_atari.ipynb | 2 +- week4_approx/practice_approx_qlearning.ipynb | 2 +- week5_policy_based/practice_a3c.ipynb | 2 +- week5_policy_based/practice_reinforce.ipynb | 2 +- week6_outro/practice_mcts.ipynb | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/week1_intro/crossentropy_method.ipynb b/week1_intro/crossentropy_method.ipynb index 952700e47..45a017af8 100644 --- a/week1_intro/crossentropy_method.ipynb +++ b/week1_intro/crossentropy_method.ipynb @@ -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'" ] }, { diff --git a/week1_intro/deep_crossentropy_method.ipynb b/week1_intro/deep_crossentropy_method.ipynb index de4127178..a4bfbe495 100644 --- a/week1_intro/deep_crossentropy_method.ipynb +++ b/week1_intro/deep_crossentropy_method.ipynb @@ -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'" ] }, { diff --git a/week1_intro/gym_interface.ipynb b/week1_intro/gym_interface.ipynb index 6912d2dbc..0e022a468 100644 --- a/week1_intro/gym_interface.ipynb +++ b/week1_intro/gym_interface.ipynb @@ -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" + " os.environ['DISPLAY'] = ':1'" ] }, { diff --git a/week3_model_free/experience_replay.ipynb b/week3_model_free/experience_replay.ipynb index 8ab9d8242..bfb1c3662 100644 --- a/week3_model_free/experience_replay.ipynb +++ b/week3_model_free/experience_replay.ipynb @@ -41,7 +41,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'" ] }, { diff --git a/week3_model_free/qlearning.ipynb b/week3_model_free/qlearning.ipynb index e1a6922b4..fb2110607 100644 --- a/week3_model_free/qlearning.ipynb +++ b/week3_model_free/qlearning.ipynb @@ -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\n", + " os.environ['DISPLAY'] = ':1'\n", " \n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", diff --git a/week3_model_free/sarsa.ipynb b/week3_model_free/sarsa.ipynb index f651eac8a..2948402e2 100644 --- a/week3_model_free/sarsa.ipynb +++ b/week3_model_free/sarsa.ipynb @@ -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\n", + " os.environ['DISPLAY'] = ':1'\n", " \n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", diff --git a/week4_approx/dqn_atari.ipynb b/week4_approx/dqn_atari.ipynb index 3d461c971..b3dfaf83a 100644 --- a/week4_approx/dqn_atari.ipynb +++ b/week4_approx/dqn_atari.ipynb @@ -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'" ] }, { diff --git a/week4_approx/practice_approx_qlearning.ipynb b/week4_approx/practice_approx_qlearning.ipynb index 1057c38ce..895feef04 100644 --- a/week4_approx/practice_approx_qlearning.ipynb +++ b/week4_approx/practice_approx_qlearning.ipynb @@ -26,7 +26,7 @@ "import os\n", "if 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'" ] }, { diff --git a/week5_policy_based/practice_a3c.ipynb b/week5_policy_based/practice_a3c.ipynb index bcecb82e3..824babf34 100644 --- a/week5_policy_based/practice_a3c.ipynb +++ b/week5_policy_based/practice_a3c.ipynb @@ -28,7 +28,7 @@ "import os\n", "if os.environ.get(\"DISPLAY\") is str and len(os.environ.get(\"DISPLAY\"))!=0:\n", " !bash ../xvfb start\n", - " %env DISPLAY=:1" + " os.environ['DISPLAY'] = ':1'" ] }, { diff --git a/week5_policy_based/practice_reinforce.ipynb b/week5_policy_based/practice_reinforce.ipynb index 6ad7b63bc..7d31ca457 100644 --- a/week5_policy_based/practice_reinforce.ipynb +++ b/week5_policy_based/practice_reinforce.ipynb @@ -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'" ] }, { diff --git a/week6_outro/practice_mcts.ipynb b/week6_outro/practice_mcts.ipynb index c3b62b9b4..f7790c4c9 100644 --- a/week6_outro/practice_mcts.ipynb +++ b/week6_outro/practice_mcts.ipynb @@ -16,7 +16,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'" ] }, {