Skip to content

Commit 89b62e0

Browse files
committed
remove unused code
1 parent db88daf commit 89b62e0

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

poetry/core/packages/vcs_dependency.py

-39
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,16 @@
1-
import re
2-
import subprocess
3-
41
from typing import TYPE_CHECKING
52
from typing import FrozenSet
63
from typing import List
74
from typing import Optional
8-
from typing import Tuple
95
from typing import Union
106

11-
from poetry.core.vcs import git
12-
137
from .dependency import Dependency
148

159

1610
if TYPE_CHECKING:
1711
from .constraints import BaseConstraint
1812

1913

20-
def extract_org_and_repo_name(parsed_url: git.ParsedUrl) -> Tuple[str, str]:
21-
repo_name = parsed_url.name
22-
if ":" not in parsed_url.pathname:
23-
# https
24-
org_name = parsed_url.pathname.split("/")[1]
25-
else:
26-
# ssh
27-
org_name = parsed_url.pathname.split("/")[0].replace(":", "")
28-
repo_name = repo_name.replace(".git", "")
29-
return org_name, repo_name
30-
31-
32-
def get_default_branch(org_name: str, repo_name: str) -> str:
33-
"""
34-
gets default branch based on the github api.
35-
"""
36-
curl_endpoint = "curl -s -H Accept: application/vnd.github.v3+json https://api.github.com/repos"
37-
cmd = "{}/{}/{} | grep default_branch".format(curl_endpoint, org_name, repo_name)
38-
ps = subprocess.Popen(
39-
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
40-
)
41-
output = ps.communicate()[0]
42-
decoded = output.decode("utf-8")
43-
output_decoded = decoded.split(":")[1]
44-
result = re.search('"(.*)"', output_decoded)
45-
return result.group(1)
46-
47-
4814
class VCSDependency(Dependency):
4915
"""
5016
Represents a VCS dependency
@@ -146,11 +112,6 @@ def base_pep_508_name(self) -> str:
146112
requirement += " @ {}+{}".format(self._vcs, self._source)
147113
else:
148114
requirement += " @ {}+ssh://{}".format(self._vcs, parsed_url.format())
149-
150-
org_name, repo_name = extract_org_and_repo_name(parsed_url)
151-
default_branch = get_default_branch(org_name=org_name, repo_name=repo_name)
152-
default_branch_str = "@{}".format(default_branch)
153-
requirement += default_branch_str
154115
return requirement
155116
if parsed_url.protocol is not None:
156117
requirement += " @ {}+{}@{}".format(self._vcs, self._source, self.reference)

0 commit comments

Comments
 (0)