Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check_duplicate_item(self) -> ItemProperties:
"""Determine if this is a duplicate item.
:return: An ItemProperties object.
"""
# Start by setting the duplicate property to False
self.item_dict["duplicate"] = False
# Create an ItemProperties object
item_properties = ItemProperties(**self.item_dict)
# Check list of known bad duplicates
if str(item_properties.id) in self.duplicate_items:
duplicate_status = self.duplicate_items[str(item_properties.id)]["duplicate"]
self.item_dict["duplicate"] = duplicate_status
return None
# Check noted, placeholder and noted properties
# If any of these properties, it must be a duplicate
if item_properties.stacked or item_properties.noted or item_properties.placeholder:
self.item_dict["duplicate"] = True
return None
# Set the item properties that we want to compare
correlation_properties = {
"name": False,
def __init__(self, input_data_file_or_directory: Path = PATH_TO_ITEMS_COMPLETE_JSON):
self.all_items: List[ItemProperties] = list()
self.all_items_dict: Dict[int, ItemProperties] = dict()
self.load_all_items(input_data_file_or_directory)
def __init__(self, input_data_file_or_directory: Path = PATH_TO_ITEMS_COMPLETE_JSON):
self.all_items: List[ItemProperties] = list()
self.all_items_dict: Dict[int, ItemProperties] = dict()
self.load_all_items(input_data_file_or_directory)
def generate_item_object(self):
"""Generate the `ItemProperties` object from the item_dict dictionary."""
self.item_properties = ItemProperties(**self.item_dict)