fparser.common.sourceinfo ========================= .. py:module:: fparser.common.sourceinfo .. autoapi-nested-parse:: Provides functions to determine whether a piece of Fortran source is free or fixed format. It also tries to differentiate between strict and "pyf" although I'm not sure what that is. Attributes ---------- .. autoapisummary:: fparser.common.sourceinfo._HAS_F_EXTENSION fparser.common.sourceinfo._HAS_F_HEADER fparser.common.sourceinfo._HAS_F90_HEADER fparser.common.sourceinfo._HAS_F03_HEADER fparser.common.sourceinfo._HAS_F08_HEADER fparser.common.sourceinfo._HAS_FREE_HEADER fparser.common.sourceinfo._HAS_FIX_HEADER fparser.common.sourceinfo._HAS_PYF_HEADER fparser.common.sourceinfo._FREE_FORMAT_START Classes ------- .. autoapisummary:: fparser.common.sourceinfo.FortranFormat Functions --------- .. autoapisummary:: fparser.common.sourceinfo.get_source_info_str fparser.common.sourceinfo.get_source_info Module Contents --------------- .. py:class:: FortranFormat(is_free, is_strict, enable_f2py=False) Describes the nature of a piece of Fortran source. Source can be fixed or free format. It can also be "strict" or "not strict" although it's not entirely clear what that means. It may refer to the strictness of adherance to fixed format although what that means in the context of free format I don't know. :param bool is_free: True for free format, False for fixed. :param bool is_strict: some amount of strictness. :param bool enable_f2py: whether f2py directives are enabled or treated as comments (the default). .. py:attribute:: _is_free .. py:attribute:: _is_strict .. py:attribute:: _f2py_enabled :value: False .. py:method:: from_mode(mode) :classmethod: Constructs a FortranFormat object from a mode string. Arguments: mode - (String) One of 'free', 'fix', 'f77' or 'pyf' .. py:method:: __eq__(other) .. py:method:: __str__() .. py:property:: is_free Returns true for free format. .. py:property:: is_fixed Returns true for fixed format. .. py:property:: is_strict Returns true for strict format. .. py:property:: is_f77 Returns true for strict fixed format. .. py:property:: is_fix Returns true for slack fixed format. .. py:property:: is_pyf Returns true for strict free format. .. py:property:: f2py_enabled :returns: whether or not f2py directives are enabled. :rtype: bool .. py:property:: mode Returns a string representing this format. .. py:data:: _HAS_F_EXTENSION .. py:data:: _HAS_F_HEADER .. py:data:: _HAS_F90_HEADER .. py:data:: _HAS_F03_HEADER .. py:data:: _HAS_F08_HEADER .. py:data:: _HAS_FREE_HEADER .. py:data:: _HAS_FIX_HEADER .. py:data:: _HAS_PYF_HEADER .. py:data:: _FREE_FORMAT_START .. py:function:: get_source_info_str(source, ignore_encoding=True) Determines the format of Fortran source held in a string. :param bool ignore_encoding: whether or not to ignore any Python-style encoding information in the first line of the file. :returns: a FortranFormat object. :rtype: :py:class:`fparser.common.sourceinfo.FortranFormat` .. py:function:: get_source_info(file_candidate, ignore_encoding=True) Determines the format of Fortran source held in a file. :param file_candidate: a filename or a file object :type file_candidate: str or _io.TextIOWrapper (py3) :returns: the Fortran format encoded as a string. :rtype: str