Spaces:
Configuration error
Configuration error
Download pcswmm_ai/objects.py from razaali10/PCSWMM-MCP-Server: direct link, hf CLI and curl.
- Browser
- Download file 689 Bytes
-
https://huggingface.co/spaces/razaali10/PCSWMM-MCP-Server/resolve/main/pcswmm_ai/objects.py
- Command line
-
hf download hf://spaces/razaali10/PCSWMM-MCP-Server/pcswmm_ai/objects.py
-
curl -L -o objects.py https://huggingface.co/spaces/razaali10/PCSWMM-MCP-Server/resolve/main/pcswmm_ai/objects.py
689 Bytes
| from .utils import public_names | |
| class ObjectService: | |
| def __init__(self, collections): self._collections=collections | |
| def to_record(obj): | |
| r={} | |
| for n in public_names(obj): | |
| try: v=getattr(obj,n) | |
| except Exception: continue | |
| if callable(v): continue | |
| try: r[n]=v if isinstance(v,(str,int,float,bool)) or v is None else str(v) | |
| except Exception: r[n]=None | |
| return r | |
| def collection_records(self,name): | |
| out=[] | |
| for key,obj in self._collections.items(name): | |
| row={"Name":key,"ObjectType":name}; row.update(self.to_record(obj)); out.append(row) | |
| return out | |