From 2ef057c589545b4bb2a5614558a8926f3afb1f9b Mon Sep 17 00:00:00 2001 From: OhadRubin Date: Sat, 31 Oct 2020 16:25:41 +0200 Subject: [PATCH 1/5] Update code.py --- colabcode/code.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/colabcode/code.py b/colabcode/code.py index c5a4259..07e13b5 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -14,13 +14,13 @@ class ColabCode: - def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False): + def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False,extentions=None): self.port = port self.password = password self.authtoken = authtoken self._mount = mount_drive self._install_code() - self._install_extensions() + self._install_extensions(extentions) self._start_server() self._run_code() @@ -30,9 +30,11 @@ def _install_code(self): ) subprocess.run(["sh", "install.sh"], stdout=subprocess.PIPE) - def _install_extensions(self): + def _install_extensions(self,extentions): for ext in EXTENSIONS: subprocess.run(["code-server", "--install-extension", f"{ext}"]) + for ext in extentions: + subprocess.run(["code-server", "--install-extension", f"{ext}"]) def _start_server(self): if self.authtoken: From 2b12d07565f3505924e5302c5cc8ff033bd13397 Mon Sep 17 00:00:00 2001 From: OhadRubin Date: Sat, 31 Oct 2020 16:27:23 +0200 Subject: [PATCH 2/5] Update code.py --- colabcode/code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colabcode/code.py b/colabcode/code.py index 07e13b5..343d811 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -14,7 +14,7 @@ class ColabCode: - def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False,extentions=None): + def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False,extentions=[]): self.port = port self.password = password self.authtoken = authtoken From ef9e07279e35b0886808381df18a8c0ec3d531e9 Mon Sep 17 00:00:00 2001 From: OhadRubin Date: Sat, 31 Oct 2020 16:30:22 +0200 Subject: [PATCH 3/5] fixed type --- colabcode/code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colabcode/code.py b/colabcode/code.py index 343d811..4516db3 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -14,7 +14,7 @@ class ColabCode: - def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False,extentions=[]): + def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False,extensions=[]): self.port = port self.password = password self.authtoken = authtoken @@ -33,7 +33,7 @@ def _install_code(self): def _install_extensions(self,extentions): for ext in EXTENSIONS: subprocess.run(["code-server", "--install-extension", f"{ext}"]) - for ext in extentions: + for ext in extensions: subprocess.run(["code-server", "--install-extension", f"{ext}"]) def _start_server(self): From 4939f16f011d132491f1d6ea60b99689ba590f25 Mon Sep 17 00:00:00 2001 From: OhadRubin Date: Sat, 31 Oct 2020 16:31:31 +0200 Subject: [PATCH 4/5] fixed typo --- colabcode/code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colabcode/code.py b/colabcode/code.py index 4516db3..28be9b2 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -20,7 +20,7 @@ def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False, self.authtoken = authtoken self._mount = mount_drive self._install_code() - self._install_extensions(extentions) + self._install_extensions(extensions) self._start_server() self._run_code() @@ -30,7 +30,7 @@ def _install_code(self): ) subprocess.run(["sh", "install.sh"], stdout=subprocess.PIPE) - def _install_extensions(self,extentions): + def _install_extensions(self,extensions): for ext in EXTENSIONS: subprocess.run(["code-server", "--install-extension", f"{ext}"]) for ext in extensions: From b6b0c5bc77e64665f1452e86e323e4006a975c62 Mon Sep 17 00:00:00 2001 From: OhadRubin Date: Sat, 31 Oct 2020 16:42:46 +0200 Subject: [PATCH 5/5] Update code.py --- colabcode/code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colabcode/code.py b/colabcode/code.py index 28be9b2..9a32695 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -51,9 +51,9 @@ def _run_code(self): if self._mount and colab_env: drive.mount("/content/drive") if self.password: - code_cmd = f"PASSWORD={self.password} code-server --port {self.port} --disable-telemetry" + code_cmd = f"PASSWORD={self.password} code-server /content/drive/'My Drive' --port {self.port} --disable-telemetry" else: - code_cmd = f"code-server --port {self.port} --auth none --disable-telemetry" + code_cmd = f"code-server /content/drive/'My Drive' --port {self.port} --auth none --disable-telemetry" with subprocess.Popen( [code_cmd], shell=True,