This file is indexed.

/usr/share/pythoncad/PythonCAD/Generic/tolerance.py is in pythoncad 0.1.37.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#
# Copyright (c) 2002, 2003 Art Haas
#
# This file is part of PythonCAD.
# 
# PythonCAD 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 2 of the License, or
# (at your option) any later version.
# 
# PythonCAD 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.
# 
# You should have received a copy of the GNU General Public License
# along with PythonCAD; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#
# this is a class that keeps a tolerance value. It should
# be used as a class (static) variable for classes that
# will compare instances with a tolerance
#
# a valid tolerance is a float value 0 or greater
#

TOL = 1e-10

class TolObject(object):
    """A class for maintaining a tolerance value.

The tolerance value is a float that must be 0.0 or
greater. Any class using this class as a base class
will have a tolerance value unique to that class.

There are two member functions:

getTolerance(): return the current tolerance
setTolerance(t): set the new tolerance

    """
    def __init__(self, t=None):
        """Initialize a TolObject.

TolObject(t)

Optional argument t must be a float, and it
must be greater than 0. A default tolerance is set
if the function is called without arguments.
        """
        if t is None:
            t = TOL
        tol = t
        if not isinstance(tol, float):
            tol = float(t)
        if tol < 0.0:
            raise ValueError, "Tolerance must be greater than 0: " + `tol`
        self.__tolerance = tol
        
    def setTolerance(self, t=None):
        """Set the tolerance value.

setTolerance(t)

Optional argument t must be a float, and it
must be greater than 0. The default tolerance is
reset if the function is called without arguments.
This function returns the old tolerance value.
        """
        old_tol = self.__tolerance
        if t is None:
            t = TOL
        tol = t
        if not isinstance(tol, float):
            tol = float(t)
        if tol < 0.0:
            raise ValueError, "Tolerance must be greater than 0: " + `tol`
        self.__tolerance = tol
        return old_tol

    def getTolerance(self):
        """Get the tolerance value.

getTolerance()

Return the current tolerance.
        """
        return self.__tolerance

    tolerance = property(getTolerance, setTolerance, None, "Tolerance value")

class StaticTolObject(object):
    """A class for maintaining a tolerance value.

This class is meant to be a base-class for classes
that wish to use a tolerance value for comparing
one instance to another.

There are two class methods:

getTolerance(): return the current tolerance
setTolerance(tol): set the new tolerance

This class stores the tolerance value as a static class
variable, so any classes using this class as a base class
will share the same tolerance value.
    """

    __tolerance = TOL
    
    def setTolerance(cls, t=None):
        """Set the tolerance value.

Optional argument t must be a float, and itmust be
greater than 0. The default tolerance is reset if
the function is called without arguments.

This function returns the old tolerance value.
        """
        old_tol = cls.__tolerance
        if t is None:
            t = TOL
        _t = t
        if not isinstance(_t, float):
            _t = float(t)
        if _t < 0.0:
            raise ValueError, "Tolerance must be greater than 0: " + `_t`
        cls.__tolerance = _t
        return old_tol

    setTolerance = classmethod(setTolerance)
    
    def getTolerance(cls):
        """Get the tolerance value.

Return the current tolerance.
        """
        return cls.__tolerance

    getTolerance = classmethod(getTolerance)

def toltest(tol):
    """Test that a tolerance value is valid.

toltest(tol)

The argument "tol" should be a float.
    """
    _t = tol
    if not isinstance(_t, float):
        _t = float(tol)
    if _t < TOL:
        raise ValueError, "Invalid tolerance: %g" % _t
    return _t