MCPcopy Create free account
hub / github.com/numpy/numpy / Function

Class Function

numpy/core/code_generators/genapi.py:134–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

find_functionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected