|
def | create (self, builtin_names, builtin_defs_file, name=None) |
|
def | __init__ (self, api="") |
|
def | create (self, parse_tree, name=None) |
|
Create API-specific information about the builtin metadata. The API
is set when the factory is created. Subclasses KernelTypeFactory
and makes use of its init method.
Definition at line 255 of file kernel.py.
◆ create()
def psyclone.parse.kernel.BuiltInKernelTypeFactory.create |
( |
|
self, |
|
|
|
builtin_names, |
|
|
|
builtin_defs_file, |
|
|
|
name = None |
|
) |
| |
Create API-specific information about the builtin metadata. This
method finds and parses the metadata then makes use of the
KernelTypeFactory parent class to return the api-specific
information about the builtin.
:param builtin_names: a list of valid builtin names
:type builtin_names: list of str
:param str builtin_defs_file: the file containing builtin \
metadata
:param name: the name of the builtin. Defaults to None if \
one is not provided.
:type name: str or NoneType
:raises ParseError: if the supplied name is not one of the \
builtin names
:raises ParseError: if the supplied name is recognised as a \
builtin but the associated file containing the required \
metadata can not be found.
:raises ParseError: if the metadata for the supplied builtin \
can not be parsed.
Definition at line 262 of file kernel.py.
262 def create(self, builtin_names, builtin_defs_file, name=None):
263 '''Create API-specific information about the builtin metadata. This
264 method finds and parses the metadata then makes use of the
265 KernelTypeFactory parent class to return the api-specific
266 information about the builtin.
268 :param builtin_names: a list of valid builtin names
269 :type builtin_names: list of str
270 :param str builtin_defs_file: the file containing builtin \
272 :param name: the name of the builtin. Defaults to None if \
274 :type name: str or NoneType
276 :raises ParseError: if the supplied name is not one of the \
278 :raises ParseError: if the supplied name is recognised as a \
279 builtin but the associated file containing the required \
280 metadata can not be found.
281 :raises ParseError: if the metadata for the supplied builtin \
285 if name
not in builtin_names:
287 f
"BuiltInKernelTypeFactory:create unrecognised built-in name. "
288 f
"Got '{name}' but expected one of {builtin_names}")
291 fname = os.path.join(
292 os.path.dirname(os.path.abspath(__file__)),
294 if not os.path.isfile(fname):
296 f
"BuiltInKernelTypeFactory:create Kernel '{name}' is a "
297 f
"recognised Built-in but cannot find file '{fname}' "
298 f
"containing the meta-data describing the Built-in operations "
299 f
"for API '{self._type}'")
302 parsefortran.FortranParser.cache.clear()
303 fparser.logging.disable(fparser.logging.CRITICAL)
304 parse_tree = fpapi.parse(fname)
305 except Exception
as err:
307 f
"BuiltInKernelTypeFactory:create: Failed to parse the meta-"
308 f
"data for PSyclone built-ins in file '{fname}'.")
from err
312 return KernelTypeFactory.create(self, parse_tree, name)
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/psyclone-ref/checkouts/latest/src/psyclone/parse/kernel.py