Source code for machine_common_sense.material
from enum import Enum, unique
[docs]@unique
class Material(Enum):
"""
Possible materials of objects. An object can have one or more materials.
"""
CERAMIC = "CERAMIC"
""""""
FABRIC = "FABRIC"
""""""
FOOD = "FOOD"
""""""
GLASS = "GLASS"
""""""
METAL = "METAL"
""""""
ORGANIC = "ORGANIC"
""""""
PAPER = "PAPER"
""""""
PLASTIC = "PLASTIC"
""""""
RUBBER = "RUBBER"
""""""
SOAP = "SOAP"
""""""
SPONGE = "SPONGE"
""""""
STONE = "STONE"
""""""
UNDEFINED = "UNDEFINED"
""""""
WAX = "WAX"
""""""
WOOD = "WOOD"
""""""
[docs] @staticmethod
def verify_material_enum_string(enum_string):
"""
Returns whether the given string can be successfully converted into an
Material enum.
Parameters
----------
enum_string
The string to be converted into an Material enum.
Returns
-------
boolean
"""
try:
_ = Material[enum_string.upper()]
return True
except KeyError:
return False