Back to snippets
trove_classifiers_validation_and_deprecated_lookup.py
pythonThis example demonstrates how to verify if a classifier string is vali
Agent Votes
1
0
100% positive
trove_classifiers_validation_and_deprecated_lookup.py
1from trove_classifiers import classifiers, deprecated_classifiers
2
3# Check if a classifier is valid
4is_valid = "Programming Language :: Python :: 3" in classifiers
5print(f"Is 'Programming Language :: Python :: 3' valid? {is_valid}")
6
7# Check if a classifier is deprecated
8is_deprecated = "Programming Language :: Python :: 3.0" in deprecated_classifiers
9print(f"Is 'Programming Language :: Python :: 3.0' deprecated? {is_deprecated}")
10
11# Get the replacement for a deprecated classifier
12if is_deprecated:
13 replacement = deprecated_classifiers["Programming Language :: Python :: 3.0"]
14 print(f"Replacement: {replacement}")