25 lines
667 B
Python
25 lines
667 B
Python
from tungston.core.geology.mineral import Mineral
|
|
|
|
|
|
# Class ############################################################################################
|
|
|
|
class Inclusion:
|
|
|
|
def __init__(self, mineral:Mineral, weight:int=100):
|
|
self.mineral = mineral
|
|
self.weight = weight
|
|
|
|
def __str__(self) -> str:
|
|
if self.weight == 100:
|
|
return self.mineral.name
|
|
|
|
return f"{self.mineral.name} ({self.weight}%)"
|
|
|
|
def __repr__(self) -> str:
|
|
return "".join([str(p) for p in [
|
|
"Inclusion{",
|
|
"mineral: ", self.mineral.name, ", ",
|
|
"weight: ", self.weight,
|
|
"}"
|
|
]])
|