From 615bef96eaf60ee95084b10875f59d1c5f0dfa6c Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 28 Sep 2023 07:18:14 -0700 Subject: [PATCH] Remove unused methods (#207) Co-authored-by: Armin Ruech --- .../semconv/model/semantic_attribute.py | 8 ----- .../semconv/model/semantic_convention.py | 31 ------------------- .../opentelemetry/semconv/templating/code.py | 1 - 3 files changed, 40 deletions(-) diff --git a/semantic-conventions/src/opentelemetry/semconv/model/semantic_attribute.py b/semantic-conventions/src/opentelemetry/semconv/model/semantic_attribute.py index 08a5f865..f6df923d 100644 --- a/semantic-conventions/src/opentelemetry/semconv/model/semantic_attribute.py +++ b/semantic-conventions/src/opentelemetry/semconv/model/semantic_attribute.py @@ -44,14 +44,6 @@ class StabilityLevel(Enum): DEPRECATED = 3 -def unique_attributes(attributes): - output = [] - for x in attributes: - if x.fqn not in [attr.fqn for attr in output]: - output.append(x) - return output - - @dataclass class SemanticAttribute: fqn: str diff --git a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py index 0056d1e6..7be05f38 100644 --- a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py +++ b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py @@ -24,9 +24,7 @@ from opentelemetry.semconv.model.exceptions import ValidationError from opentelemetry.semconv.model.semantic_attribute import ( AttributeType, - RequirementLevel, SemanticAttribute, - unique_attributes, ) from opentelemetry.semconv.model.unit_member import UnitMember from opentelemetry.semconv.model.utils import ValidatableYamlNode, validate_id @@ -164,35 +162,6 @@ def contains_attribute(self, attr: "SemanticAttribute"): return True return False - def all_attributes(self): - return unique_attributes(self.attributes + self.conditional_attributes()) - - def sampling_attributes(self): - return unique_attributes( - attr for attr in self.attributes if attr.sampling_relevant - ) - - def required_attributes(self): - return unique_attributes( - attr - for attr in self.attributes - if attr.requirement_level == RequirementLevel.REQUIRED - ) - - def conditional_attributes(self): - return unique_attributes( - attr - for attr in self.attributes - if attr.requirement_level == RequirementLevel.CONDITIONALLY_REQUIRED - ) - - def any_of(self): - result = [] - for constraint in self.constraints: - if isinstance(constraint, AnyOf): - result.append(constraint) - return result - def has_attribute_constraint(self, attr): return any( attribute.equivalent_to(attr) diff --git a/semantic-conventions/src/opentelemetry/semconv/templating/code.py b/semantic-conventions/src/opentelemetry/semconv/templating/code.py index ddb96838..b84a39fd 100644 --- a/semantic-conventions/src/opentelemetry/semconv/templating/code.py +++ b/semantic-conventions/src/opentelemetry/semconv/templating/code.py @@ -158,7 +158,6 @@ def to_camelcase(name: str, first_upper=False) -> str: class CodeRenderer: pattern = f"{{{ID_RE.pattern}}}" - matcher = re.compile(pattern) parameters: typing.Dict[str, str] trim_whitespace: bool