0
Files
src/tools/metrics/common/model_shared.py
Jay Zhou afa9142409 Move common metric code to shared location
There is some code in UKM that can be leveraged by other metrics. To prevent code duplication, we want to consolidate this code in a common location so all metrics can leverage it.

Fixed: 40870309
Change-Id: Iefd25896380679777030191809a4bb0483b1f669
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5727639
Reviewed-by: Zainab Rizvi <rizvis@google.com>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Jay Zhou <zhouzj@google.com>
Cr-Commit-Position: refs/heads/main@{#1332958}
2024-07-25 15:11:30 +00:00

18 lines
655 B
Python

# Copyright 2024 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import models
# Model definitions for ukm.xml content
_OBSOLETE_TYPE = models.TextNodeType('obsolete')
_OWNER_TYPE = models.TextNodeType('owner', single_line=True)
_SUMMARY_TYPE = models.TextNodeType('summary')
# A key for sorting XML nodes by the value of |attribute|.
_LOWERCASE_FN = lambda attribute: (lambda node: node.get(attribute).lower())
# A constant function as the sorting key for nodes whose orderings should be
# kept as given in the XML file within their parent node.
_KEEP_ORDER = lambda node: 1