Пример #1
0
    def __init__(self, elem):
        util.check_attributes(elem, {'name', 'type'})
        util.check_children(elem, {'summary'})

        self.name = util.get_attr(elem, 'name', Model.NAME_REGEX)
        self.type = util.get_attr(elem, 'type', Model.TYPE_REGEX)
        self.summary = util.get_text_child(elem, 'summary')
Пример #2
0
  def __init__(self, xml_string):
    elem = ET.fromstring(xml_string)
    util.check_attributes(elem, set())
    util.check_children(elem, {'project'})
    util.check_child_names_unique(elem, 'project')

    projects = util.get_compound_children(elem, 'project')
    self.projects = [Project(p) for p in projects]
Пример #3
0
  def __init__(self, elem, project):
    util.check_attributes(elem, {'name'})
    util.check_children(elem, {'summary', 'metric'})
    util.check_child_names_unique(elem, 'metric')

    self.name = util.get_attr(elem, 'name', Model.NAME_REGEX)
    self.summary = util.get_text_child(elem, 'summary')
    self.metrics = [
        Metric(m, project) for m in util.get_compound_children(elem, 'metric')
    ]
Пример #4
0
  def __init__(self, elem, project):
    util.check_attributes(elem, {'name', 'type'})
    util.check_children(elem, {'summary'})

    self.name = util.get_attr(elem, 'name', Model.NAME_REGEX)
    self.type = util.get_attr(elem, 'type', Model.TYPE_REGEX)
    self.summary = util.get_text_child(elem, 'summary')

    if self.type == 'raw-string' and project.id != 'none':
      util.error(
          elem, "raw-string metrics must be in a project with id type "
          "'none', but {} has id type '{}'".format(project.name, project.id))
Пример #5
0
    def __init__(self, elem):
        util.check_attributes(elem, {'name'})
        util.check_children(elem, {'id', 'summary', 'owner', 'event'})
        util.check_child_names_unique(elem, 'event')

        self.name = util.get_attr(elem, 'name', Model.NAME_REGEX)
        self.id = util.get_text_child(elem, 'id', Model.ID_REGEX)
        self.summary = util.get_text_child(elem, 'summary')
        self.owners = util.get_text_children(elem, 'owner', Model.OWNER_REGEX)

        self.events = [
            Event(e) for e in util.get_compound_children(elem, 'event')
        ]