MCPcopy
hub / github.com/psycopg/psycopg / from_parts

Method from_parts

psycopg/psycopg/_tpc.py:64–78  ·  view source on GitHub ↗
(cls, format_id: int | None, gtrid: str, bqual: str | None)

Source from the content-addressed store, hash-verified

62
63 @classmethod
64 def from_parts(cls, format_id: int | None, gtrid: str, bqual: str | None) -> Xid:
65 if format_id is not None:
66 if bqual is None:
67 raise TypeError("if format_id is specified, bqual must be too")
68 if not 0 <= format_id < 0x80000000:
69 raise ValueError("format_id must be a non-negative 32-bit integer")
70 if len(bqual) > 64:
71 raise ValueError("bqual must be not longer than 64 chars")
72 if len(gtrid) > 64:
73 raise ValueError("gtrid must be not longer than 64 chars")
74
75 elif bqual is None:
76 raise TypeError("if format_id is None, bqual must be None too")
77
78 return Xid(format_id, gtrid, bqual)
79
80 def _as_tid(self) -> str:
81 """

Callers 2

_parse_stringMethod · 0.80
xidMethod · 0.80

Calls 1

XidClass · 0.85

Tested by

no test coverage detected