MCPcopy Index your code
hub / github.com/numpy/numpy / Function

Class Function

numpy/_core/code_generators/genapi.py:140–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138
139
140class Function:
141 def __init__(self, name, return_type, args, doc=''):
142 self.name = name
143 self.return_type = _repl(return_type)
144 self.args = args
145 self.doc = doc
146
147 def _format_arg(self, typename, name):
148 if typename.endswith('*'):
149 return typename + name
150 else:
151 return typename + ' ' + name
152
153 def __str__(self):
154 argstr = ', '.join([self._format_arg(*a) for a in self.args])
155 if self.doc:
156 doccomment = f'/* {self.doc} */\n'
157 else:
158 doccomment = ''
159 return f'{doccomment}{self.return_type} {self.name}({argstr})'
160
161 def api_hash(self):
162 m = hashlib.md5(usedforsecurity=False)
163 m.update(remove_whitespace(self.return_type))
164 m.update('\000')
165 m.update(self.name)
166 m.update('\000')
167 for typename, name in self.args:
168 m.update(remove_whitespace(typename))
169 m.update('\000')
170 return m.hexdigest()[:8]
171
172class ParseError(Exception):
173 def __init__(self, filename, lineno, msg):

Callers 1

find_functionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…