MCPcopy Index your code
hub / github.com/StackStorm/st2 / _get_link

Function _get_link

contrib/runners/python_runner/dist_utils.py:63–89  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

61 reqs = []
62
63 def _get_link(line):
64 vcs_prefixes = ["git+", "svn+", "hg+", "bzr+"]
65
66 for vcs_prefix in vcs_prefixes:
67 if line.startswith(vcs_prefix) or line.startswith("-e %s" % (vcs_prefix)):
68 req_name = re.findall(".*#egg=(.+)([&|@]).*$", line)
69
70 if not req_name:
71 req_name = re.findall(".*#egg=(.+?)$", line)
72 else:
73 req_name = req_name[0]
74
75 if not req_name:
76 raise ValueError(
77 'Line "%s" is missing "#egg=<package name>"' % (line)
78 )
79
80 link = line.replace("-e ", "").strip()
81 return link, req_name[0]
82 elif vcs_prefix in line and line.count("@") == 2:
83 # PEP 440 direct reference: <package name>@ <url>@version
84 req_name, link = line.split("@", 1)
85 req_name = req_name.strip()
86 link = f"{link.strip()}#egg={req_name}"
87 return link, req_name
88
89 return None, None
90
91 with open(requirements_file_path, "r") as fp:
92 for line in fp.readlines():

Callers 1

fetch_requirementsFunction · 0.70

Calls 1

countMethod · 0.45

Tested by

no test coverage detected