"Fossies" - the Fresh Open Source Software Archive

Member "viewvc-1.2.1/lib/vclib/ccvs/rcsparse/__init__.py" (26 Mar 2020, 1491 Bytes) of package /linux/misc/viewvc-1.2.1.tar.gz:

As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "__init__.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.1.28_vs_1.2.1.

    1 # -*-python-*-
    2 #
    3 # Copyright (C) 1999-2020 The ViewCVS Group. All Rights Reserved.
    4 #
    5 # By using this file, you agree to the terms and conditions set forth in
    6 # the LICENSE.html file which can be found at the top level of the ViewVC
    7 # distribution or at http://viewvc.org/license-1.html.
    8 #
    9 # For more information, visit http://viewvc.org/
   10 #
   11 # -----------------------------------------------------------------------
   13 """This package provides parsing tools for RCS files.
   15 To use this package, first create a subclass of Sink.  This should
   16 declare all the callback methods you care about.  Create an instance
   17 of your class, and open() the RCS file you want to read.  Then call
   18 parse() to parse the file.
   19 """
   21 # Make the "Sink" class and the various exception classes visible in this
   22 # scope.  That way, applications never need to import any of the
   23 # sub-packages.
   24 from common import *
   26 try:
   27   from tparse import parse
   28 except ImportError:
   29   try:
   30     from texttools import Parser
   31   except ImportError:
   32     from default import Parser
   34   def parse(file, sink):
   35     """Parse an RCS file.
   37     Parameters: FILE is the file object to parse.  (I.e. an object of the
   38     built-in Python type "file", usually created using Python's built-in
   39     "open()" function).  It should be opened in binary mode.
   40     SINK is an instance of (some subclass of) Sink.  It's methods will be
   41     called as the file is parsed; see the definition of Sink for the
   42     details.
   43     """
   44     return Parser().parse(file, sink)