Skip to content

Instantly share code, notes, and snippets.

@dogweather
Last active December 31, 2023 21:31
Show Gist options
  • Save dogweather/a3c12a552674e924b9598d71c42aea35 to your computer and use it in GitHub Desktop.
Save dogweather/a3c12a552674e924b9598d71c42aea35 to your computer and use it in GitHub Desktop.
My best Elixir in Python
def parse_title(dom: XmlResponse) -> Title:
name = pipe(
dom
, html.xpath("//TITLE-TEXT")
, text.titleize
)
number = pipe(
dom
, html.xpath("//TITLE-NUM")
, text.split(" ")
, seq.get(1)
)
children = _parse_divisions_or_articles(number, dom)
url = _source_url(number)
return Title(name, number, children, url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment