| 43 | return free_port |
| 44 | |
| 45 | def check_local_or_remote(path: str): |
| 46 | # Check if link is a valid folder path |
| 47 | if os.path.isdir(path): |
| 48 | return (True, path) |
| 49 | # Check if link is a valid URL |
| 50 | try: |
| 51 | result = urlparse(path) |
| 52 | if all([result.scheme, result.netloc, result.path]) and 'github.com' in result.netloc: |
| 53 | return (False, result.path[1:]) |
| 54 | except: |
| 55 | raise ValueError("Please provide a valid folder path or GitHub URL.") |
| 56 | |
| 57 | def get_env_path(): |
| 58 | python_path = subprocess.check_output("which python", shell=True).strip().decode("utf-8") |