Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused _warn_tag_mismatch and _warned_tag_pairs #1786

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions asdf/_asdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from ._helpers import validate_version
from .config import config_context, get_config
from .exceptions import (
AsdfConversionWarning,
AsdfDeprecationWarning,
AsdfManifestURIMismatchWarning,
AsdfPackageVersionWarning,
Expand Down Expand Up @@ -169,10 +168,6 @@ def __init__(
self._ignore_unrecognized_tag = ignore_unrecognized_tag
self._ignore_implicit_conversion = ignore_implicit_conversion

# Set of (string, string) tuples representing tag version mismatches
# that we've already warned about for this file.
self._warned_tag_pairs = set()

# Context of a call to treeutil.walk_and_modify, needed in the AsdfFile
# in case walk_and_modify is re-entered by extension code (via
# custom_tree_to_tagged_tree or tagged_tree_to_custom_tree).
Expand Down Expand Up @@ -1592,20 +1587,6 @@ def search(self, key=NotSet, type_=NotSet, value=NotSet, filter_=None):
result = AsdfSearchResult(["root"], self.tree)
return result.search(key=key, type_=type_, value=value, filter_=filter_)

# This function is called from within TypeIndex when deserializing
# the tree for this file. It is kept here so that we can keep
# state on the AsdfFile and prevent a flood of warnings for the
# same tag.
def _warn_tag_mismatch(self, tag, best_tag):
if not self._ignore_version_mismatch and (tag, best_tag) not in self._warned_tag_pairs:
message = (
f"No explicit ExtensionType support provided for tag '{tag}'. "
f"The ExtensionType subclass for tag '{best_tag}' will be used instead. "
"This fallback behavior will be removed in asdf 3.0."
)
warnings.warn(message, AsdfConversionWarning)
self._warned_tag_pairs.add((tag, best_tag))

# This function is called from within yamlutil methods to create
# a context when one isn't explicitly passed in.
def _create_serialization_context(self, operation=_serialization_context.BlockAccess.NONE):
Expand Down
Loading