MCPcopy
hub / github.com/psf/black / find_black_version_in_array

Function find_black_version_in_array

action/main.py:102–123  ·  view source on GitHub ↗
(array: object)

Source from the content-addressed store, hash-verified

100
101
102def find_black_version_in_array(array: object) -> str | None:
103 if not isinstance(array, list):
104 return None
105 try:
106 for item in array:
107 # Rudimentary PEP 508 parsing.
108 item = item.split(";")[0]
109 item = EXTRAS_RE.sub("", item).strip()
110 if item == "black":
111 print(
112 "::error::Version specifier missing for 'black' dependency in "
113 "pyproject.toml.",
114 file=sys.stderr,
115 flush=True,
116 )
117 sys.exit(1)
118 elif m := BLACK_VERSION_RE.match(item):
119 return m.group(1).strip()
120 except TypeError:
121 pass
122
123 return None
124
125
126run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True)

Callers 1

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected