import random from glob import glob import numpy as np class Cargo: def __init__(self, height,width,depth,weight,damage,label_state,content,value,position): self.height=height self.width=width self.depth=depth self.weight=weight self.damage=damage self.label_state=label_state self.content=content self.value=value self.position=position def contentSplit(self): if self.content=='fruits': test=glob('./siec/train/fragile/*') self.image=np.random.choice(test) elif self.content=='nuclear_waste': test=glob('./siec/train/toxic/*') self.image = np.random.choice(test) elif self.content=='clothes': test = glob('./siec/train/flammable/*') self.image = np.random.choice(test) else: self.image='./fruit.png' print(self.image) class Clothes(Cargo): def __init__(self, name, size, weight, fragility): super().__init__(name,"clothes", size, weight) self.fragility = fragility class NuclearWaste(Cargo): def __init__(self, name, size, weight, exp_date, toxicity): super().__init__(name,"nuclear_waste" ,size, weight) self.exp_date = exp_date self.toxicity = toxicity class Fruit(Cargo): def __init__(self, name ,size, weight, exp_date): super().__init__(name,"fruit" ,size, weight) self.exp_date = exp_date class Carparts(Cargo): def __init__(self, name ,size, weight): super().__init__(name,"car_parts" ,size, weight) class Forklift: def __init__(self, model): self.model = model class Shelf: def __init__(self, category): self.category = category self.items = [] def add_item(self, item): if isinstance(item, Cargo) and item.category == self.category: self.items.append(item) else: print(f"Can't add: {item.name}. Shelf is for: {self.category}")