Skip to main content
Glama
slots.py824 B
# Metaclass for mixing slots and descriptors # From "Programming in Python 3" by Mark Summerfield Ch.8 p. 383 class AutoSlotProperties(type): def __new__(mcl, classname, bases, dictionary): slots = list(dictionary.get("__slots__", [])) for getter_name in [key for key in dictionary if key.startswith("get_")]: name = getter_name slots.append("__" + name) getter = dictionary.pop(getter_name) setter = dictionary.get(setter_name, None) if (setter is not None and isinstance(setter, collections.Callable)): del dictionary[setter_name] dictionary[name] = property(getter. setter) dictionary["__slots__"] = tuple(slots) return super().__new__(mcl, classname, bases, dictionary)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Lillard01/chatExcel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server