refactor: clean up get_path function and remove unnecessary print statement
Some checks are pending
Docker Image CI / build (push) Waiting to run

This commit is contained in:
patilk 2024-11-15 23:44:59 +01:00
parent ba9e42b9c6
commit 8ca8225122
Signed by: s500042
GPG Key ID: 1921AD722E7392EE
2 changed files with 2 additions and 4 deletions

View File

@ -7,8 +7,6 @@ def get_path():
splitted = pwd.split("/") splitted = pwd.split("/")
splitted[-1] = splitted[-1].replace("\n", "") splitted[-1] = splitted[-1].replace("\n", "")
print(splitted[: splitted.index("webscraper") + 1])
if splitted.count("webscraper") > 1 and "webscraper" in splitted: if splitted.count("webscraper") > 1 and "webscraper" in splitted:
for i in range(len(splitted) - 1, -1, -1): for i in range(len(splitted) - 1, -1, -1):
potential_path = "/".join(splitted[: i + 1]) potential_path = "/".join(splitted[: i + 1])
@ -19,7 +17,8 @@ def get_path():
else: else:
return "This is not a valid webscraper project." return "This is not a valid webscraper project."
else: else:
return "/".join(splitted[: splitted.index("webscraper") + 1]) path = "/".join(splitted[: splitted.index("webscraper") + 1])
return path
def run_main(): def run_main():

View File

@ -1,5 +1,4 @@
import subprocess import subprocess
import os
from run_command import run_command from run_command import run_command
from get_path import get_path from get_path import get_path