MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / to_dict

Method to_dict

src/database/models.py:376–396  ·  view source on GitHub ↗

转换为字典

(self, include_password: bool = False)

Source from the content-addressed store, hash-verified

374 updated_at = Column(DateTime, default=utcnow_naive, onupdate=utcnow_naive)
375
376 def to_dict(self, include_password: bool = False) -> Dict[str, Any]:
377 """转换为字典"""
378 result = {
379 'id': self.id,
380 'name': self.name,
381 'type': self.type,
382 'host': self.host,
383 'port': self.port,
384 'username': self.username,
385 'enabled': self.enabled,
386 'is_default': self.is_default or False,
387 'priority': self.priority,
388 'last_used': self.last_used.isoformat() if self.last_used else None,
389 'created_at': self.created_at.isoformat() if self.created_at else None,
390 'updated_at': self.updated_at.isoformat() if self.updated_at else None,
391 }
392 if include_password:
393 result['password'] = self.password
394 else:
395 result['has_password'] = bool(self.password)
396 return result
397
398 @property
399 def proxy_url(self) -> str:

Callers 7

get_proxies_listFunction · 0.45
create_proxy_itemFunction · 0.45
get_proxy_itemFunction · 0.45
update_proxy_itemFunction · 0.45
set_proxy_defaultFunction · 0.45
_serialize_log_rowFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected