MCPcopy Index your code
hub / github.com/dbcli/pgcli / FunctionMetadata

Class FunctionMetadata

pgcli/packages/parseutils/meta.py:51–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51class FunctionMetadata:
52 def __init__(
53 self,
54 schema_name,
55 func_name,
56 arg_names,
57 arg_types,
58 arg_modes,
59 return_type,
60 is_aggregate,
61 is_window,
62 is_set_returning,
63 is_extension,
64 arg_defaults,
65 ):
66 """Class for describing a postgresql function"""
67
68 self.schema_name = schema_name
69 self.func_name = func_name
70
71 self.arg_modes = tuple(arg_modes) if arg_modes else None
72 self.arg_names = tuple(arg_names) if arg_names else None
73
74 # Be flexible in not requiring arg_types -- use None as a placeholder
75 # for each arg. (Used for compatibility with old versions of postgresql
76 # where such info is hard to get.
77 if arg_types:
78 self.arg_types = tuple(arg_types)
79 elif arg_modes:
80 self.arg_types = tuple([None] * len(arg_modes))
81 elif arg_names:
82 self.arg_types = tuple([None] * len(arg_names))
83 else:
84 self.arg_types = None
85
86 self.arg_defaults = tuple(parse_defaults(arg_defaults))
87
88 self.return_type = return_type.strip()
89 self.is_aggregate = is_aggregate
90 self.is_window = is_window
91 self.is_set_returning = is_set_returning
92 self.is_extension = bool(is_extension)
93 self.is_public = self.schema_name and self.schema_name == "public"
94
95 def __eq__(self, other):
96 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
97
98 def __ne__(self, other):
99 return not self.__eq__(other)
100
101 def _signature(self):
102 return (
103 self.schema_name,
104 self.func_name,
105 self.arg_names,
106 self.arg_types,
107 self.arg_modes,
108 self.return_type,

Callers 4

function_meta_dataFunction · 0.90
get_completerMethod · 0.90
functionsMethod · 0.85

Calls

no outgoing calls

Tested by 2

function_meta_dataFunction · 0.72