Skip to content

Commit

Permalink
Merge pull request #74 from FriedrichFroebel/escapes
Browse files Browse the repository at this point in the history
Fix invalid escape sequences
  • Loading branch information
cdalitz authored Feb 12, 2025
2 parents fc0a29c + 9174d2b commit 9660681
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
main:
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
runs-on: ubuntu-latest
name: Python ${{ matrix.python }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions gamera/gui/gui_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ def code_block(name, arguments, options, content, lineno,

def docstring_to_html(docstring):
try:
corrected = docstring.replace("*args", "\*args")
corrected = corrected.replace("**kwargs", "\*\*kwargs")
corrected = docstring.replace("*args", r"\*args")
corrected = corrected.replace("**kwargs", r"\*\*kwargs")
html = docutils.core.publish_string(corrected, writer_name="html")
except Exception as e:
html = '''<pre>%s</pre><br/<br/><font size=1><pre>%s</pre></font>''' % (docstring, str(e))
Expand Down
2 changes: 1 addition & 1 deletion gamera/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def getstrings (namepattern,verbose=1):


def getcsv (namepatterns, delimiter='\t', verbose=1):
"""
r"""
Loads a list of lists from text files (specified by a UNIX-style
wildcard filename pattern) and converts all numeric values to floats.
Uses the glob module for filename pattern conversion. Loaded filename
Expand Down
6 changes: 3 additions & 3 deletions gamera/plugins/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class contour_samplepoints(PluginFunction):
equidistant on the contour.
*contour*:
when 0 (\"outer_projection\"), the points returned by *contour_left* etc.
are used; when 1 (\"full_contour\") the points returned by *outline(1)*
when 0 ("outer_projection"), the points returned by *contour_left* etc.
are used; when 1 ("full_contour") the points returned by *outline(1)*
are used.
In addition to the points determined by the percentage argument the result
Expand Down Expand Up @@ -108,7 +108,7 @@ def __call__(self, percentage=25, contourtype=0):
__call__ = staticmethod(__call__)

class contour_pavlidis(PluginFunction):
"""
r"""
Returns a point list of the outer contour trace found with Pavlidis'
algorithm (T. Pavlidis: *Algorithms for Grapics and Image Processing.*
pp. 129-165, Springer, 1982).
Expand Down
4 changes: 2 additions & 2 deletions gamera/plugins/edgedetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def __call__(self, mark_both=False):

class outline(PluginFunction):
"""
Traces the outline of the image. When *which* is 0 (\"outer\"),
Traces the outline of the image. When *which* is 0 ("outer"),
the result is obtained by dilating the image and then XOR'ing the
result with the original; when *which* is 1 (\"inner\"), the result
result with the original; when *which* is 1 ("inner"), the result
is obtained by eroding the image and then XOR'ing the
result with the original.
"""
Expand Down
14 changes: 7 additions & 7 deletions gamera/plugins/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class moments(Feature):
center of gravity on *x* and *y* axis normalized by width and height,
respectively. The following seven entries are the
*normalized central moments* (*u20,u02,u11,u30,u12,u21,u03*). For their
definition, see Gonzalez, Woods: \"Digital Image Processing\",
definition, see Gonzalez, Woods: "Digital Image Processing",
Prentice Hall, second edition (2002).
+---------------------------+
Expand Down Expand Up @@ -230,7 +230,7 @@ class compactness(Feature):
class volume16regions(Feature):
"""
Divides the image into a 4 x 4 grid of 16 regions and calculates
the volume within each. This feature is also known as \"zoning\" method.
the volume within each. This feature is also known as "zoning" method.
+---------------------------+
| **Invariant to:** |
Expand All @@ -246,7 +246,7 @@ class volume16regions(Feature):
class volume64regions(Feature):
"""
Divides the image into an 8 x 8 grid of 64 regions and calculates
the volume within each. This feature is also known as \"zoning\" method.
the volume within each. This feature is also known as "zoning" method.
+---------------------------+
| **Invariant to:** |
Expand All @@ -272,8 +272,8 @@ class zernike_moments(Feature):
The present implementation normalizes the Zernike moments by
division with the zeroeth geometric moment *m00*, which results
in an approximate scale invariance according to
S. Belkasim, E. Hassan, T. Obeidi: \"Explicit invariance of Cartesian
Zernike moments.\" Pattern Recognition Letters 28, pp. 1969-1980 (2007)
S. Belkasim, E. Hassan, T. Obeidi: "Explicit invariance of Cartesian
Zernike moments." Pattern Recognition Letters 28, pp. 1969-1980 (2007)
The return values are the absolute values of
*A20, A22, A31, A33, A40, A42, A44, A51, A53, A54, A60, A62, A64, A66*.
Expand Down Expand Up @@ -307,8 +307,8 @@ class zernike_moments_plugin(PluginFunction):
The present implementation normalizes the Zernike moments by
division with the zeroeth geometric moment *m00*, which results
in an approximate scale invariance according to
S. Belkasim, E. Hassan, T. Obeidi: \"Explicit invariance of Cartesian
Zernike moments.\" Pattern Recognition Letters 28, pp. 1969-1980 (2007)
S. Belkasim, E. Hassan, T. Obeidi: "Explicit invariance of Cartesian
Zernike moments." Pattern Recognition Letters 28, pp. 1969-1980 (2007)
The return values are the absolute values of
*A20, A22, A31, A33, A40, A42, A44, A51, A53, A54, A60, A62, A64, A66*.
Expand Down
4 changes: 2 additions & 2 deletions gamera/plugins/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class graph_color_ccs(PluginFunction):
Reference:
C. Dalitz, T. Bolten, O. Christion:
`\"Color Visualization of 2D Segmentations.\"`__
`"Color Visualization of 2D Segmentations."`__
International Conference on Information Visualization Theory
and Applications (IVAPP), pp. 567-572 (2013)
Expand Down Expand Up @@ -357,7 +357,7 @@ class max_empty_rect(PluginFunction):
``RuntimeError`` is thrown. The coordinates of the returned rectangle are
relative to the upper left corner of the image.
Reference: D. Vandevoorde: `\"The Maximal Rectangle Problem.\"`__ Dr. Dobb's,
Reference: D. Vandevoorde: `"The Maximal Rectangle Problem."`__ Dr. Dobb's,
April 1998.
.. __: http://www.drdobbs.com/database/184410529
Expand Down
4 changes: 2 additions & 2 deletions gamera/plugins/image_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ class diff_images(PluginFunction):
Returns a color image representing the difference of two images
following the conventions of a number of Unix diff visualization
tools, such as CVS web. Pixels in both images are black. Pixels
in 'self' but not in the given image (\"deleted\" pixels) are red.
Pixels in the given image but not in self (\"inserted\" pixels)
in 'self' but not in the given image ("deleted" pixels) are red.
Pixels in the given image but not in self ("inserted" pixels)
are green.
"""
category = "Combine"
Expand Down
2 changes: 1 addition & 1 deletion gamera/plugins/listutilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class median_py(PluginFunction):

class kernel_density(PluginFunction):
"""Computes the kernel density for *values* at the specified
*x*-positions. Reference: S.J. Sheather: \"Density Estimation.\"
*x*-positions. Reference: S.J. Sheather: "Density Estimation."
Statistical Science 19 pp. 588-597 (2004).
Arguments:
Expand Down
4 changes: 2 additions & 2 deletions gamera/plugins/pagesegmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,12 @@ class textline_reading_order(PluginFunction):
the following criteria for the pairwise order of two lines:
- line *a* comes before line *b* when *a* is totally to the left
of *b* (order \"column before row\")
of *b* (order "column before row")
- line *a* comes before *b* when both overlap horizontally and
*a* is above *b* (order within a column)
In the reference `\"High Performance Document Analysis\"`__
In the reference `"High Performance Document Analysis"`__
by T.M. Breuel (Symposium on Document Image Understanding,
USA, pp. 209-218, 2003),
an additional constraint is made for the first criterion by demanding
Expand Down
8 changes: 4 additions & 4 deletions gamera/plugins/threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ def __call__(image, smoothness=0.2, max_block_size=512, min_block_size=64,

class soft_threshold(PluginFunction):
"""
Does a greyscale transformation that \"smears out\" the threshold *t* by a
choosable amount *sigma*. This has the effect of a \"soft\" thresholding.
Does a greyscale transformation that "smears out" the threshold *t* by a
choosable amount *sigma*. This has the effect of a "soft" thresholding.
Each grey value *x* is transformed to *F(x,t,sigma)*, where *F*
is the CDF probability distribution with mean *t* and variance
Expand All @@ -257,7 +257,7 @@ class soft_threshold(PluginFunction):
.. __: #otsu-find-threshold
Reference: C. Dalitz: `\"Soft Thresholding for Visual Image Enhancement.\"`__
Reference: C. Dalitz: `"Soft Thresholding for Visual Image Enhancement."`__
Technischer Bericht Nr. 2014-01, Hochschule Niederrhein,
Fachbereich Elektrotechnik und Informatik, 2014
Expand All @@ -281,7 +281,7 @@ class soft_threshold_find_sigma(PluginFunction):
determined such that *F(m,t,sigma)* = 0.99, where *m* is the mean grey
value of all pixels with a grey value greater than *t*.
Reference: C. Dalitz: `\"Soft Thresholding for Visual Image Enhancement.\"`__
Reference: C. Dalitz: `"Soft Thresholding for Visual Image Enhancement."`__
Technischer Bericht Nr. 2014-01, Hochschule Niederrhein,
Fachbereich Elektrotechnik und Informatik, 2014
Expand Down
4 changes: 2 additions & 2 deletions gamera/pstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def linexor (listoflists,columnlist,valuelist):


def linedelimited (inlist,delimiter):
"""
r"""
Returns a string composed of elements in inlist, with each element
separated by 'delimiter.' Used by function writedelimited. Use '\t'
for tab-delimiting.
Expand Down Expand Up @@ -488,7 +488,7 @@ def makestr (x):


def printcc (lst,extra=2):
"""
r"""
Prints a list of lists in columns, customized by the max size of items
within the columns (max size of items in col, plus 'extra' number of spaces).
Use 'dashes' or '\\n' in the list-of-lists to print dashes or blank lines,
Expand Down
2 changes: 1 addition & 1 deletion gamera/ruleengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from gamera import group, util
from .fudge import Fudge

"""This module provides tools for applying graph-rewriting rules to a
r"""This module provides tools for applying graph-rewriting rules to a
set of glyphs.
It would seem nice to invent a completely new language for this task
Expand Down

0 comments on commit 9660681

Please sign in to comment.