def loads(self, requirements_text):
        lines = re.findall(Requirement.spec_regex,
                           requirements_text,
                           re.MULTILINE)
        for line in lines:
            self.add(Requirement(line[0], "".join(line[1:])))
def _safe_close(self, sess):
    """Closes a session without raising an exception.

    Just like sess.close() but ignores exceptions.

    Args:
      sess: A `Session`.
    """
    # pylint: disable=broad-except
    try:
      sess.close()
    except Exception:
      # Intentionally not logging to avoid user complaints that
      # they get cryptic errors.  We really do not care that Close
      # fails.
      pass
    # pylint: enable=broad-except