MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / _get_attribute

Method _get_attribute

src/packagedcode/maven.py:739–749  ·  view source on GitHub ↗

Return a single value text attribute for a given xpath or None.

(self, xpath, xml=None)

Source from the content-addressed store, hash-verified

737 return ParentPom('%s:%s:pom:%s' % (group_id, artifact_id, version))
738
739 def _get_attribute(self, xpath, xml=None):
740 """Return a single value text attribute for a given xpath or None."""
741 if xml is None:
742 xml = self.pom_data
743 attr = xml.findtext(xpath)
744 val = attr and attr.strip() or None
745 if TRACE:
746 if 'artifactId' in xpath:
747 logger.debug('MavenPom._get_attribute: xpath: {}'.format(xpath))
748 logger.debug('MavenPom._get_attribute: xml: {}'.format(xml))
749 return val
750
751 def _get_attributes_list(self, xpath, xml=None):
752 """Return a list of text attributes for a given xpath or empty list."""

Callers 9

__init__Method · 0.95
_find_licensesMethod · 0.95
_find_partiesMethod · 0.95
_find_mailing_listsMethod · 0.95
_find_scmMethod · 0.95
_find_ci_managementMethod · 0.95
_find_repositoryMethod · 0.95

Calls 2

debugMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected