Skip to content

Commit

Permalink
TSP changed to TWPS
Browse files Browse the repository at this point in the history
  • Loading branch information
travleev committed Jan 20, 2020
1 parent 065ed29 commit 0b56757
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 40 deletions.
12 changes: 8 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
TSP: (T)ext with (S)nippets (P)reprocessor
TWPS: (T)ext (W)ith (P)ython (S)nippets
==========================================

A python package to preprocess text files with embedded code snippets: evaluate
or execute them and replace with the result of evaluation/execution.
A python package to preprocess text files with embedded Python code snippets:
evaluate or execute them and replace with the result of evaluation/execution.

Currently, the only up-to-date description of the command line arguments can be found in the source code `twps/ppp.py`_ or by calling the ``ppp.py`` script with the ``--help`` command line argument (or without any arguments). The description_ found in the ``docs`` folder still describes correctly the main idea and the syntax of the template file, but not the command line arguments.
Currently, the only up-to-date description of the command line arguments can be
found in the source code `twps/ppp.py`_ or by calling the ``ppp.py`` script
with the ``--help`` command line argument (or without any arguments). The
description_ found in the ``docs`` folder still describes correctly the main
idea and the syntax of the template file, but not the command line arguments.

.. _`twps/ppp.py`: twps/ppp.py
.. _description: docs/build/latex/twps.pdf
Expand Down
Binary file removed docs/build/doctrees/bib.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/conclusion.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file removed docs/build/doctrees/examples.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/how_to_use.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/index.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/intro.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ INR report written with the help of Shpinx
===========================================

Documentation written in Sphinx can be translated into several formats, among
them latex. Description for the TSP package is an example of how to modify the
them latex. Description for the TWPS package is an example of how to modify the
latex files generated by Sphinx to fulfill formatting requirements of KIT
internal reports.

Expand Down
6 changes: 3 additions & 3 deletions docs/source/conclusion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Conclusion and acknowledgement
==================================

Basic usage of the TSP package is to simplify preparation of input decks
Basic usage of the TWPS package is to simplify preparation of input decks
for computer codes with limited syntax possibilities. Instead of writing an
input deck directly, a template can be written, which generally has syntax
and structure of the input deck, but also can include Python code snippets,
Expand All @@ -14,7 +14,7 @@ permitted by the input file syntax of the target computer code. Ultimately,
one gets possibility to use the whole legacy of Python when writing input
decks.

TSP was used by the author to generate input files for MCNP code
TWPS was used by the author to generate input files for MCNP code
:raw-latex:`\cite{mcnpREF}` and KANEXT system :raw-latex:`\cite{kanext}` under
Linux and Windows operating systems.

Expand All @@ -36,7 +36,7 @@ improvements can include the following:
* Specification of the default snippet key, commenting characters and delimiters
in the preprocessor command line rather than in the template's first line.

The TSP Python package has been written during work on several projects funded
The TWPS Python package has been written during work on several projects funded
by the European Commission: ELSY :raw-latex:`\cite{ELSY}`, LEADER
:raw-latex:`\cite{LEADERWEB}` and CDT :raw-latex:`\cite{CDT09}`.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# -- General configuration -----------------------------------------------------

general_title = 'TSP Python package: Preprocessor for Text files with Python Snippets'
general_title = 'TWPS Python package: (T)ext (W)ith (P)ython (S)nippets -- a preprocessor for Text files with Python Snippets'

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
Expand Down Expand Up @@ -212,7 +212,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'twps.tex', u'TSP package Documentation',
('index', 'twps.tex', u'TWPS package Documentation',
u'Anton Travleev', 'manual'),
]

Expand Down
6 changes: 3 additions & 3 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Examples
==========

This section shows how the TSP package can be applied to tasks that often arise during preparation of
This section shows how the TWPS package can be applied to tasks that often arise during preparation of
complex input files. This covers inclusion of external files and templates and generation of a set of input
files that differ by some parameter (for e.g. parametric studies).


Inclusion of external files
----------------------------
The TSP package provides no special mechanism to include external files into the resulting
The TWPS package provides no special mechanism to include external files into the resulting
file, however, one can use standard Python capabilities. In the following
example, an external file is read by the ``open`` [#]_ Python function and its
content is printed to the standard output. Since the standard output of the
Expand Down Expand Up @@ -47,7 +47,7 @@ Inclusion of other templates
While in the above example inclusion of text file without any preprocessing is
shown, often it is necessary to include another template that needs first to be
preprocessed. To accomplish this task one needs to use directly the function
:func:`pre_pro` from the module :mod:`text_with_snippets` of the TSP package.
:func:`pre_pro` from the module :mod:`text_with_snippets` of the TWPS package.
In simple situations this function is called by the preprocessor ``ppp.py`` so
that a user does not use it directly; this example shows how to use this
function directly in a template (or in a Python script).
Expand Down
14 changes: 7 additions & 7 deletions docs/source/how_to_use.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. |ppp| replace:: ``ppp.py``

How to use TSP
How to use TWPS
#################

The basic TSP use is to simplify preparation of input decks
The basic TWPS use is to simplify preparation of input decks
for computer codes with limited syntax possibilities. Instead of writing the
input deck directly, a template can be written that generally has syntax
and structure of the input deck, but also can include Python code snippets,
Expand All @@ -13,7 +13,7 @@ permitted by the input file syntax of the target computer code. Ultimately,
one gets possibility to use the whole legacy of Python when writing an input
deck.

The TSP package provides the command line preprocessor, an executable script
The TWPS package provides the command line preprocessor, an executable script
called ``ppp.py``. For the template ``input.t``, the
following command::

Expand Down Expand Up @@ -76,7 +76,7 @@ For details see [#]_.

.. [#] http://docs.python.org/install/index.html.
The TSP package provides script ``ppp.py``. During the installation
The TWPS package provides script ``ppp.py``. During the installation
process, the script will be copied into the directory where the Python
interpreter is installed (under Windows it can be something like
``c:\Python27\Scripts``) and thus will be available at the command prompt. The
Expand All @@ -86,14 +86,14 @@ when called without a command line parameter, generates the following message:
.. literalinclude:: examples/message.txt

Script |ppp| uses function :func:`pre_pro`, defined in the module
:mod:`text_with_snippets` of the TSP package. Although the most common use of
TSP is to call |ppp| script from the terminal command line, one can also import
:mod:`text_with_snippets` of the TWPS package. Although the most common use of
TWPS is to call |ppp| script from the terminal command line, one can also import
this function and use it from the Python interpreter or in a Pyhon script.

The name of the text file to be processed must be given to |ppp| as a command
line argument. The output file will have the name of the input file, with
suffix ``.res`` attached to the filename without extension (thus the template
and resulting file have the same extension). So far the TSP package is
and resulting file have the same extension). So far the TWPS package is
installed, the |ppp| script should be availabe at the command line, and the
command

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TSP package documentation
TWPS package documentation
#############################


Expand Down
14 changes: 7 additions & 7 deletions docs/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,28 @@ template.

The software supporting this concept is implemented in the Python_ programming
language. :raw-latex:`\cite{pythonWEB}` It is distributed as a Python package
called TSP_ (stands for "Text with Snippets Preprocessor") and can be installed
called TWPS_ (stands for "Text with Snippets Preprocessor") and can be installed
onto any machine where Python is installed (tested on Windows 7 and Linux OS).
The TSP package provides an executable that takes a text file as input,
The TWPS package provides an executable that takes a text file as input,
searches for pieces of Python code in it, executes these code chunks and writes an
output text file that is a copy of the input text file, but with the Python
code pieces substituted with the result of their evaluation.

.. _Python: http://www.python.org

.. _TSP: https://github.com/inr-kit/twps
.. _TWPS: https://github.com/inr-kit/twps

This report explains the installation procedure of the TSP package, describes
This report explains the installation procedure of the TWPS package, describes
the syntax of the template file and gives some examples of the usage.

In the rest of the report, the following terminology is used. The file containing
text and the Python code pieces is called a **template file**, or just a **template**. A piece
of the Python code inside the template is a **snippet**. The output file
generated by TSP when processing the template, is a **resulting file**. The script
provided by the TSP package that reads a template file and generates
generated by TWPS when processing the template, is a **resulting file**. The script
provided by the TWPS package that reads a template file and generates
correspondent resulting file, is the **preprocessor**.

To illustrate what the TSP package can be used for, consider the example below: left is the template and and the resulting file on the right:
To illustrate what the TWPS package can be used for, consider the example below: left is the template and and the resulting file on the right:

.. list-table::
:header-rows: 1
Expand Down
2 changes: 1 addition & 1 deletion docs/source/preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\usepackage{sphinxkit}

\inrNumber{INR 31/13 -- NUKLEAR 3462}
\inrTitle{TSP: Python package to facilitate preparation of input files}
\inrTitle{TWPS: Python package to facilitate preparation of input files}
\inrProject{}{}
\inrDate{November 2013}

Expand Down
8 changes: 4 additions & 4 deletions twps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2012 Karlsruhe Institute of Technology (KIT)
#
# This file is part of TSP.
# This file is part of TWPS.
#
# TSP is free software: you can redistribute it and/or modify
# TWPS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# TSP is distributed in the hope that it will be useful,
# TWPS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Expand All @@ -34,7 +34,7 @@
from text_with_snippets import pre_pro
from utils import params

# TSP version. Used in setup.py and in docs
# TWPS version. Used in setup.py and in docs
# Numbering: X.Y.Z, where
# X -- major version. Different major versions are not back-compatible.
# New major version number, when code is rewritten
Expand Down
8 changes: 4 additions & 4 deletions twps/ppp.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/env python
# Copyright 2012 Karlsruhe Institute of Technology (KIT)
#
# This file is part of TSP.
# This file is part of TWPS.
#
# TSP is free software: you can redistribute it and/or modify
# TWPS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# TSP is distributed in the hope that it will be useful,
# TWPS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Expand All @@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""
Script provides command line interface to the TSP python package.
Script provides command line interface to the TWPS python package.
"""

Expand Down
6 changes: 3 additions & 3 deletions twps/text_with_snippets.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/env python
# Copyright 2012 Karlsruhe Institute of Technology (KIT)
#
# This file is part of TSP.
# This file is part of TWPS.
#
# TSP is free software: you can redistribute it and/or modify
# TWPS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# TSP is distributed in the hope that it will be useful,
# TWPS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Expand Down

0 comments on commit 0b56757

Please sign in to comment.