INNER CODE UNIT · Python
grep_attr
autopilot-rs/autopy · setup.py:17
def grep_attr(body, attr):
return literal_eval(module_attr_re(attr).search(body).group(1))
def read_description():
with open("README.md") as f:
header = "For more information, see the [GitHub Repository]" \
"({0}).".format(REPO_URL)
filter_re = re.compile(r'.*\bPyPI\b.*')
contents = header + "\n" + filter_re.sub("", f.read())
return contents.strip()
def parse_module_metadata():
with open("autopy/__init__.py", "r") as f:
body = f.read()
return [grep_attr(body, attr) for attr in ("version", "author")]